Methods Summary |
---|
private static java.net.URL | findResource(java.lang.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;
|
public static void | launch(org.jboss.ejb3.metamodel.ApplicationClientDD xml, java.lang.String mainClassName, java.lang.String applicationClientName, java.lang.String[] args)Convenience method for launching a client container.
Class mainClass = Class.forName(mainClassName);
ClientContainer container = new ClientContainer(xml, mainClass, applicationClientName);
// TODO: postContruct
container.invokeMain(args);
// TODO: preDestroy
|
public void | launch(java.lang.String mainClassName, java.lang.String clientName, java.lang.String[] args)The AppClientLauncher method for launching a client container.
ApplicationClientDD xml = loadXML();
launch(xml, mainClassName, clientName, args);
|
public static org.jboss.ejb3.metamodel.ApplicationClientDD | loadXML()Convenience method to load the XML descriptor.
URL url = findResource("META-INF/application-client.xml");
URL jbossClientURL = findResource("META-INF/jboss-client.xml");
return loadXML(url, jbossClientURL);
|
public static org.jboss.ejb3.metamodel.ApplicationClientDD | loadXML(java.lang.String urlSpec)
URL url = new URL(urlSpec);
return loadXML(url, null);
|
public static org.jboss.ejb3.metamodel.ApplicationClientDD | loadXML(java.net.URL url, java.net.URL jbossClientURL)
ApplicationClientDD dd = ApplicationClientDDObjectFactory.parse(url);
dd = JBossClientDDObjectFactory.parse(jbossClientURL, dd);
return dd;
|
public static void | main(java.lang.String[] args)Work in progress.
try
{
if(args.length < 1)
throw new IllegalArgumentException("expected a jar filename as argument");
Class<?> mainClass;
String name = args[0];
if(name.endsWith(".jar"))
{
throw new NotImplementedException();
// JarFile jarFile = new JarFile(jarName);
}
else
{
String mainClassName = name;
mainClass = Class.forName(mainClassName);
}
URL appXmlURL = mainClass.getClassLoader().getResource("META-INF/application-client.xml");
if(appXmlURL == null)
throw new RuntimeException("Can't find META-INF/application-client.xml");
ApplicationClientDD xml = ApplicationClientDDObjectFactory.parse(appXmlURL);
// FIXME: j2ee.clientName
List<String> newArgs = new ArrayList<String>();
for(int i = 1; i < args.length; i++)
{
newArgs.add(args[i]);
}
args = newArgs.toArray(args);
// FIXME: when jar gets implemented this won't work anymore
String mainClassName = name;
launch(xml, mainClassName, "FIXME", args);
}
catch (Exception e)
{
e.printStackTrace();
System.exit(1);
}
|