Hello Rohit;
>>>I am integrating OWB into a Java EE EJB container
Awesome!
>>>Session bean proxy returned by OpenWebBeansEjbPlugin in
>>>public Object getSessionBeanProxy(Bean<?> bean, Class<?> iface,
>>>CreationalContext<?> creationalContext);
This is the proxy object that will be injected into clients. You can use
EjbDefinitionUtility#defineEjbBeanProxy in your plugin. You have to provide EJB
container specific bean instance that extends BaseEjbBean into this method.
For OpenEjb, this is the OpenEjbBean. You must implement your own bean that
creates EJB instances. Basically you will extend BaseEjbBean and override below
methods:
- protected abstract T getInstance(CreationalContext<T> creationalContext);
This is used for getting EJB instance from EJB container.
- public List<Class<?>> getBusinessLocalInterfaces()
This is used for getting local interfaces that constitute the API types of
session beans.
- public List<Method> getRemoveMethods()
This is used for calling "remove" method of statefull session beans
whenever statefull session bean context is destroyed by the OWB.
This is not implemented for OpenEJB because currently OpenEJB does not
provide API to get statefull session beans remove methods. Once it
defines, we will update it.
- public String getEjbName()
This is used by several places.
>>>Is this code pattern specific to openejb or are other java ee containers are
>>>also expected to do the same in their EjbBeanProxyHandlers ?
Same for all ee containers not specific to openejb. openwebbeans-ejb-common is
not specific to openejb. It is a utility module that can be used by other
vendors.
>>Will OWB ejb integration work with other EE containers if
>>>BeansDeployer.discoverEjb is set to false ?
Discovery of EJB beans are managed by the configuration property,
org.apache.webbeans.spi.deployer.useEjbMetaDataDiscoveryService=false. It is
false as default. For EJB bean discovery, this property must be defines as
true.
>>From looking at the code the only integration point of OWB with an
>>EJBContainer is the OpenWebBeansEjbPlugin ?
Yes. But if you want that your managed beans' (that are not session beans)
resource injections are handled by EJB container, you have to also implement
org.apache.webbeans.spi.ResourceInjectionService. This service is used by OWB
container whenever it injects Java EE resources into Managed Beans (for
example, @Resource,@WebServiceRef,@PersistenceContext,@PersistenceUnit etc.)
There is also a SPI module that contains specific interfaces(services) that
must be provided by the containers if they want to use those functionalities.
For example, if you want to support TransactionService, ValidatorService,
SecurityService you have to implement them and you have to override below
methods in your plugin.
public <T> T getSupportedService(Class<T> serviceClass)
- Gets implementation of the interface
public boolean supportService(Class<?> serviceClass)
- Whether or not supports given service interface
You can look at how we implement some of those methods for Tomcat integration
(org.apache.webbeans.web.tomcat.TomcatWebPlugin)
>>Does a Java EE container need to extend
>>><file:///C:/eclipse3.5/owb-cdi/openwebbeans/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/BaseEjbBean.java>org.apache.webbeans.ejb.common.component.BaseEjbBean<T>
>>>?
Yes and you provide some methods implementation that I have mentioned already.
I know that it is a little complex to add an integration at the first pass but
you are more than welcome to join us on #IRC freenode at #openwebbeans. It is
the most easy way to discuss the details.
I will also update our OpenEJB integration. Currently, it is used as an
embeddable in Tomcat, means that it uses ServletContextListener to start
scanning process of the beans. What I want is that it is used by standalone
OpenEJB container with its own scanning.
Those interfaces(for scanning, lifecycle etc.) are also defined in the
webbeans-spi module, i.e, ContainerLifecycle, ScannerService, ContextsService
etc. There are some implementations of those interfaces that are used in
specific environments, i.e, using OWB in Web applications, in Standalone Java
applications etc.
The main startup logic is that
-------------------------------------------
1* Some code to start scanning and deploying beans
This is the WebBeansConfigurationListener for web applications. It calls
ContainerLifecycle methods.
2* Some code extends AbstractLifecycle for implementing ContainerLifecycle
This is the where scanning and deploying begins. It uses scanner service,
context service etc.
3* Some code implements ScannerService that is responsible for providing
classes, beans.xml files
You can look at how we implement those sequences for web profile. You can
inspect codes looking through
"org.apache.webbeans.servlet.WebBeansConfigurationListener"
All configuration information is hold by OpenWebBeansConfiguration class. It
uses properties files and system properties . But you can also directly call
its methods to register your own service implementations.
Thanks;
--Gurkan
________________________________
From: Rohit Kelapure <[email protected]>
To: [email protected]
Sent: Tue, March 16, 2010 5:38:03 PM
Subject: Questions on OpenWebBeansEjbPlugin and OWB-EJB integration
I am integrating OWB into a Java EE EJB container and need more information
on the role of the
Session bean proxy returned by OpenWebBeansEjbPlugin in
public Object getSessionBeanProxy(Bean<?> bean, Class<?> iface,
CreationalContext<?> creationalContext);
The openejb code defines a EjbBeanProxy method handler that calls
OpenWebBeansEjbInterceptor.setThreadLocal(...)
and OpenWebBeansEjbInterceptor.unsetThreadLocal() before an after the method
invoke.
Is this code pattern specific to openejb or are other java ee containers are
also expected to do the same in their EjbBeanProxyHandlers ?
Will OWB ejb integration work with other EE containers if
BeansDeployer.discoverEjb is set to false ?
From looking at the code the only integration point of OWB with an
EJBContainer is the OpenWebBeansEjbPlugin ?
Does a Java EE container need to extend
<file:///C:/eclipse3.5/owb-cdi/openwebbeans/webbeans-ejb/src/main/java/org/apache/webbeans/ejb/common/component/BaseEjbBean.java>org.apache.webbeans.ejb.common.component.BaseEjbBean<T>
?
--Thanks,
Rohit Kelapure
___________________________________________________________________
Yahoo! Türkiye açıldı! http://yahoo.com.tr
İnternet üzerindeki en iyi içeriği Yahoo! Türkiye sizlere sunuyor!