-
1. Re: Web Bean Discovery
alesj Nov 14, 2008 8:40 AM (in response to pmuir)"pete.muir@jboss.org" wrote:
The returned Set<Class<?>> should comprise all classes which present in this archive (and any sub-deployments it has e.g. in the war for an ear):
* any web-beans.xml file in any root directory of the application classpath,
* any ejb-jar.xml file in any root directory of the application classpath that also has a web-beans.xml file, and
* any Java class in any archive or directory in the classpath that has a web-beans.xml file in the root directory.
Basically this is saying, give me all classes from classpath of a deployment which has web-beans.xml file in its metadata path?
I don't understand other two restrictions - ejb-jar.xml and Java class.
Note: I think web-beans.xml should be in META-INF (or WEB-INF), not in root -
2. Re: Web Bean Discovery
pmuir Nov 14, 2008 8:49 AM (in response to pmuir)I don't understand the second restriction great either. Gavin?
The third one I think is saying "give me all the classes from any shared (lib/) jar that has web-beans.xml in it's metadata path". Gavin, is that right? -
3. Re: Web Bean Discovery
adrian.brock Nov 14, 2008 9:28 AM (in response to pmuir)"pete.muir@jboss.org" wrote:
I don't understand the second restriction great either. Gavin?
The third one I think is saying "give me all the classes from any shared (lib/) jar that has web-beans.xml in it's metadata path". Gavin, is that right?
He's talking about the spec defined behaviour
(although it is not actually recommended that people use it)
see the JavaEE5 spec 8.3.1.3.d
Another exception to this rule is JAR files located in the library
directory (usually named lib) in the application package. Note that the
presence of component-declaring annotations in shared artifacts, such as
libraries in the library directory and libraries referenced by more than one
module through Class-Path references, can have unintended and
undesirable consequences and is not recommended.
The reason its not recommend is because if you have for example
two ejb jars that reference the same helper jar via the manifest
they could both get processed for an ejb contained in the helper jar
which could in turn lead to the ejb constructed twice and then
not able to bind the remote interface to the same jndi name twice.
And other similar problems. -
4. Re: Web Bean Discovery
adrian.brock Nov 14, 2008 9:30 AM (in response to pmuir)"pete.muir@jboss.org" wrote:
public interface WebBeanDiscovery { public Set<Class<?>> discoverWebBeanClasses(); }
Isn't it more scalabe to useIterable<class<?>>
which could be a Set but also could be something more performant
if there are a very large number of classes. -
5. Re: Web Bean Discovery
gavin.king Nov 14, 2008 12:05 PM (in response to pmuir)Pete, you slightly mangled the quote from the spec by removing it from context :-)
What its really saying is that the web bean manager needs to get given:
* a list of all web-beans.xml files in the app classpath
* a list of all classes in classpath archives with web-beans.xml files
* a list of all EJBs in the application, including their JNDI name and component type -
6. Re: Web Bean Discovery
pmuir Nov 17, 2008 6:24 AM (in response to pmuir)Here's the updated SPI based on Gavin's clarification and Adrian's suggestion:
/** * A container should implement this interface to allow the Web Beans RI to * discover the Web Beans to deploy * * @author Pete Muir * */ public interface WebBeanDiscovery { /** * @return A list of all classes in classpath archives with web-beans.xml files */ public Iterable<Class<?>> discoverWebBeanClasses(); /** * @return A list of all web-beans.xml files in the app classpath */ public Iterable<URL> discoverWebBeansXml(); /** * @return A Map of EJB descriptors, keyed by the EJB bean class */ public Map<Class<?>, EjbDescriptor<?>> discoverEjbs(); }
public interface EjbDescriptor<T> { /** * @return The EJB Bean class */ public Class<T> getType(); /** * @return The JNDI name under which the EJB is registered */ public String getJndiName(); /** * @return The local interfaces of the EJB */ public Iterator<Class<?>> getLocalInterfaces(); /** * @return The remove methods of the EJB */ public Iterator<Method> getRemoveMethods(); }
-
7. Re: Web Bean Discovery
wolfc Nov 17, 2008 6:50 AM (in response to pmuir)"pete.muir@jboss.org" wrote:
/** * @return A Map of EJB descriptors, keyed by the EJB bean class */ public Map<Class<?>, EjbDescriptor<?>> discoverEjbs();
A bean class can be used by multiple EJBs. So you'll have to come up with another key. -
8. Re: Web Bean Discovery
pmuir Nov 17, 2008 10:39 PM (in response to pmuir)"wolfc" wrote:
"pete.muir@jboss.org" wrote:
/** * @return A Map of EJB descriptors, keyed by the EJB bean class */ public Map<Class<?>, EjbDescriptor<?>> discoverEjbs();
A bean class can be used by multiple EJBs. So you'll have to come up with another key.
Ok. We should probably be using ejb name anyway. AFAIK that is unique within an ejb archive, so we may need some combination of the two. -
9. Re: Web Bean Discovery
alesj Nov 18, 2008 11:06 AM (in response to pmuir)"gavin.king@jboss.com" wrote:
* a list of all classes in classpath archives with web-beans.xml files
Let me see if I got this. :-)
yes == includes web-beans.xml
no == doesn't include web-beans.xml
e.g.
- myapp.ear
-- lib
--- ext.jar // yes
--- util.jar // no
-- first.jar // yes
-- second.jar // no
-- users.war
--- WEB-INF
---- web-beans.xml
---- classes
------ org/acme/...
---- lib
----- ui1.jar // yes
----- ui2.jar // no
-- crm.war
--- WEB-INF
---- classes
----- com/foobar/crm/...
---- lib
-----xyz.jar // yes
Classes from the following stuff should be returned:
- ext.jar
- first.jar
- users.war/WEB-INF/classes
- ui1.jar
- xyz.jar
But not the rest, as they don't have proper web-beans.xml in metadata.
Note: no crm.war/WEB-INF/classes, as crm.war/WEB-INF doesn't have web-beans.xml -
10. Re: Web Bean Discovery
gavin.king Nov 18, 2008 11:45 AM (in response to pmuir)Looks right to me :-)
-
11. Re: Web Bean Discovery
pmuir Nov 20, 2008 4:54 AM (in response to pmuir)http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4190794#4190794 - discussion on the EJB metadata discovery.