[Design of EJB 3.0] - Re: EJB3 AppClient - tests now pass but there are issues
by scott.stark@jboss.org
"adrian(a)jboss.org" wrote :
| * TEST CLASSPATH
|
| Why is it necessary to add jars other than jbossall-client.jar to the classpath
| to run the client? See my comment in ejb3/build-test.xml
|
| I added jboss-metdata.jar which should be included (at least in part)
| in jbossall-client.jar?
|
|
| | <path id="client.classpath">
| | <pathelement path="${jboss.dist}/client/jbossall-client.jar"/>
| |
| | <!-- FIXME - shouldn't these be in jbossall-client.jar???? -->
| | <path refid="apache.codec.classpath"/>
| | <path refid="apache.log4j.classpath"/>
| | <path refid="apache.logging.classpath"/>
| | <path refid="jboss.test.classpath"/>
| | <path refid="sun.servlet.classpath"/>
| | <pathelement path="${jboss.dist}/client/jboss-ejb3-client.jar"/>
| | <pathelement path="${jboss.dist}/lib/jboss-vfs.jar"/>
| | <path refid="jboss.microcontainer.classpath"/>
| | <path refid="jboss.metadata.classpath"/>
| | </path>
| |
|
| I'll leave Carlo to decide which of these issues needs further attention
| in the EJB3 project.
|
| We should probably raise a main appserver JIRA for the jbossall-client.jar issue?
The client container/launcher requires jboss-metadata.jar, jboss-container.jar (AbstractAnnotationImpl), and jboss-vfs.jar (for the vfs usage I added) to be in the client classpath as well.
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4104172#4104172
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4104172
18 years, 4 months
[Design of AOP on JBoss (Aspects/JBoss)] - Re: ManagedObject stuff for AOP
by adrian@jboss.org
"kabir.khan(a)jboss.com" wrote : AOPBeansSchemaInitializer to use the "new" underlying beans, and create a new SchemaBindingInitializer to parse the "new" use-case.xml.
|
You probably want to look at the JBossXB annotation based parsing?
But that would require the MC being updated to also do that.
The MC based annotation parsing is prototyped in the JBossXB testsuite
so speak to Ales about getting it ported.
The annotation approach has one big advantage which is that
it is a lot easier to include other people's metadata classes in your models.
The metadata (e.g. MC's properties) inherits the namespace of the top level
element/class defining the schema.
e.g. Something like
| @JBossXmlSchema("urn:jboss-aop:2.0")
| public class Aspect
| {
| @XmlElement(name="property")
| public void setProperties(Collection<org.jboss.metadata.spi.PropertyMetaData> properties);
| }
|
Will define an {urn:jboss-aop:2.0}:property so no need to play about with
(hack) namespaces like in the old approach. :-)
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4104169#4104169
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4104169
18 years, 4 months
[Design of EJB 3.0] - Re: EJB3 AppClient - tests now pass but there are issues
by wolfc
Here's my ClientLauncher:
I like it better, because it doesn't do any parsing and it uses server side metadata. So if you don't mind, I'll commit it.
Index: /home/carlo/work/jboss-head/ejb3/src/main/org/jboss/ejb3/client/ClientLauncher.java
| ===================================================================
| --- /home/carlo/work/jboss-head/ejb3/src/main/org/jboss/ejb3/client/ClientLauncher.java (revision 67020)
| +++ /home/carlo/work/jboss-head/ejb3/src/main/org/jboss/ejb3/client/ClientLauncher.java (working copy)
| @@ -22,7 +22,6 @@
| package org.jboss.ejb3.client;
|
| import java.io.IOException;
| -import java.io.InputStream;
| import java.net.URL;
| import java.net.URLClassLoader;
| import java.util.ArrayList;
| @@ -28,21 +27,17 @@
| import java.util.ArrayList;
| import java.util.List;
|
| +import javax.naming.InitialContext;
| +import javax.naming.NamingException;
| +
| import org.jboss.client.AppClientLauncher;
| +import org.jboss.ejb3.metamodel.ApplicationClientDD;
| +import org.jboss.ejb3.metamodel.ApplicationClientDDObjectFactory;
| +import org.jboss.ejb3.metamodel.JBossClientDDObjectFactory;
| import org.jboss.logging.Logger;
| -import org.jboss.metadata.client.jboss.JBossClient5DTDMetaData;
| -import org.jboss.metadata.client.jboss.JBossClient5MetaData;
| import org.jboss.metadata.client.jboss.JBossClientMetaData;
| -import org.jboss.metadata.client.spec.ApplicationClient14DTDMetaData;
| -import org.jboss.metadata.client.spec.ApplicationClient14MetaData;
| -import org.jboss.metadata.client.spec.ApplicationClient5MetaData;
| -import org.jboss.metadata.client.spec.ApplicationClientMetaData;
| import org.jboss.util.NotImplementedException;
| import org.jboss.xb.binding.JBossXBException;
| -import org.jboss.xb.binding.Unmarshaller;
| -import org.jboss.xb.binding.UnmarshallerFactory;
| -import org.jboss.xb.binding.sunday.unmarshalling.DefaultSchemaResolver;
| -import org.jboss.xb.binding.sunday.unmarshalling.SingletonSchemaResolverFactory;
|
| /**
| * This class launches a JavaEE 5 application client.
| @@ -59,39 +54,6 @@
| {
| private static final Logger log = Logger.getLogger(ClientLauncher.class);
|
| - /** The unmarshaller factory */
| - private static UnmarshallerFactory factory = UnmarshallerFactory.newInstance();
| -
| - /** The schema resolver */
| - private static DefaultSchemaResolver resolver = (DefaultSchemaResolver) SingletonSchemaResolverFactory.getInstance().getSchemaBindingResolver();
| -
| - static
| - {
| - // FIXME hardwiring
| - resolver.addClassBindingForLocation("application-client", ApplicationClient14DTDMetaData.class);
| - resolver.addClassBindingForLocation("application-client_1_2.dtd", ApplicationClient14DTDMetaData.class);
| - resolver.addClassBindingForLocation("application-client_1_3.dtd", ApplicationClient14DTDMetaData.class);
| - resolver.addClassBindingForLocation("application-client_1_4.xsd", ApplicationClient14MetaData.class);
| - resolver.addClassBindingForLocation("application-client_5.xsd", ApplicationClient5MetaData.class);
| - resolver.addClassBindingForLocation("jboss-client", JBossClient5DTDMetaData.class);
| - resolver.addClassBindingForLocation("jboss-client_3_0.dtd", JBossClient5DTDMetaData.class);
| - resolver.addClassBindingForLocation("jboss-client_3_2.dtd", JBossClient5DTDMetaData.class);
| - resolver.addClassBindingForLocation("jboss-client_4_0.dtd", JBossClient5DTDMetaData.class);
| - resolver.addClassBindingForLocation("jboss-client_4_2.dtd", JBossClient5DTDMetaData.class);
| - resolver.addClassBindingForLocation("jboss-client_5_0.dtd", JBossClient5DTDMetaData.class);
| - resolver.addClassBindingForLocation("jboss-client_5_0.xsd", JBossClient5MetaData.class);
| - }
| -
| - private static URL findResource(String resourceName)
| - {
| - URL url;
| - if(Thread.currentThread().getContextClassLoader() instanceof URLClassLoader)
| - url = ((URLClassLoader) Thread.currentThread().getContextClassLoader()).findResource(resourceName);
| - else
| - url = Thread.currentThread().getContextClassLoader().getResource(resourceName);
| - return url;
| - }
| -
| /**
| * Convenience method for launching a client container.
| *
| @@ -121,8 +83,9 @@
| * @throws IOException
| * @throws JBossXBException
| */
| - public static JBossClientMetaData loadXML() throws JBossXBException, IOException
| + public static JBossClientMetaData loadXML(String applicationClientName) throws NamingException
| {
| + /*
| URL url = findResource("META-INF/application-client.xml");
| log.trace("application-client.xml found at " + url);
| URL jbossClientURL = findResource("META-INF/jboss-client.xml");
| @@ -128,88 +91,11 @@
| URL jbossClientURL = findResource("META-INF/jboss-client.xml");
| log.trace("jboss-client.xml found at " + jbossClientURL);
| return loadXML(url, jbossClientURL);
| - }
| -
| - @Deprecated
| - public static JBossClientMetaData loadXML(String urlSpec) throws JBossXBException, IOException
| - {
| - URL url = new URL(urlSpec);
| - return loadXML(url, null);
| - }
| -
| - public static Unmarshaller createUnmarshaller() throws JBossXBException, IOException
| - {
| - Unmarshaller unmarshaller = factory.newUnmarshaller();
| - unmarshaller.setSchemaValidation(true);
| - unmarshaller.setValidation(true);
| - return unmarshaller;
| -
| - }
| -
| - public static JBossClientMetaData loadXML(URL url, URL jbossClientURL) throws JBossXBException, IOException
| - {
| - if (url == null)
| - throw new RuntimeException("Null url for application-client.xml");
| -
| - log.debug("Parsing application-client.xml: "+url);
| - Unmarshaller unmarshaller = createUnmarshaller();
| - InputStream is = url.openStream();
| - Object parsed = null;
| - try
| - {
| - parsed = unmarshaller.unmarshal(is, resolver);
| - log.debug("Parsed application-client.xml: "+url+" to: "+parsed);
| - }
| - finally
| - {
| - try
| - {
| - is.close();
| - }
| - catch (Exception ignored)
| - {
| - }
| - }
| - if (parsed == null)
| - throw new JBossXBException("The xml " + url + " is not well formed!");
| -
| - ApplicationClientMetaData applicationClientMetaData = ApplicationClientMetaData.class.cast(parsed);
| -
| - JBossClientMetaData jbossClientMetaData;
| - if (jbossClientURL == null)
| - jbossClientMetaData = new JBossClientMetaData();
| - else
| - {
| -
| - log.debug("Parsing jboss-client.xml: "+jbossClientURL);
| - unmarshaller = createUnmarshaller();
| - is = jbossClientURL.openStream();
| - parsed = null;
| - try
| - {
| - parsed = unmarshaller.unmarshal(is, resolver);
| - log.debug("Parsed jboss-client.xml: "+jbossClientURL+" to: "+parsed);
| -
| - if (parsed == null)
| - throw new JBossXBException("The xml " + url + " is not well formed!");
| -
| - jbossClientMetaData = JBossClientMetaData.class.cast(parsed);
| - }
| - finally
| - {
| - try
| - {
| - is.close();
| - }
| - catch (Exception ignored)
| - {
| - }
| - }
| - }
| -
| - JBossClientMetaData result = new JBossClientMetaData();
| - result.merge(jbossClientMetaData, applicationClientMetaData, true);
| - return result;
| + */
| + log.warn("FIXME: using an unsupported hack to get metadata");
| + InitialContext ctx = new InitialContext();
| + JBossClientMetaData metaData = (JBossClientMetaData) ctx.lookup(applicationClientName + "/metaData");
| + return metaData;
| }
|
| /**
| @@ -241,8 +127,12 @@
| URL appXmlURL = mainClass.getClassLoader().getResource("META-INF/application-client.xml");
| if(appXmlURL == null)
| throw new RuntimeException("Can't find META-INF/application-client.xml");
| - URL jbossXmlURL = mainClass.getClassLoader().getResource("META-INF/jboss-client.xml");
| - JBossClientMetaData xml = loadXML(appXmlURL, jbossXmlURL);
| +
| + // FIXME: client metadata
| + JBossClientMetaData xml = null;
| + //JBossClientMetaData xml = ApplicationClientDDObjectFactory.parse(appXmlURL);
| + if(true)
| + throw new RuntimeException("NYI");
|
| // FIXME: j2ee.clientName
|
| @@ -275,7 +165,7 @@
| public void launch(String mainClassName, String clientName, String args[])
| throws Throwable
| {
| - JBossClientMetaData xml = loadXML();
| + JBossClientMetaData xml = loadXML(clientName);
| launch(xml, mainClassName, clientName, args);
| }
|
| Index: /home/carlo/work/jboss-head/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3ClientDeployer.java
| ===================================================================
| --- /home/carlo/work/jboss-head/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3ClientDeployer.java (revision 66999)
| +++ /home/carlo/work/jboss-head/ejb3/src/main/org/jboss/ejb3/deployers/Ejb3ClientDeployer.java (working copy)
| @@ -84,6 +84,10 @@
| // Notify the client launcher of extra class path entries in an EAR (See EE 8.2)
| encCtx.bind("classPathEntries", getClassPathEntries(unit));
|
| + // TODO: Notify the client launcher of other metadata stuff (injectors, lifecycle callbacks etc)
| + // FIXME: For now I expose the entire metadata
| + encCtx.bind("metaData", metaData);
| +
| String mainClassName = getMainClassName(unit, true);
|
| Class<?> mainClass = loadClass(unit, mainClassName);
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4104160#4104160
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4104160
18 years, 4 months