// Add the common launcher beans, ClassLoaderSystem
BeanMetaDataBuilder builder = BeanMetaDataBuilderFactory.createBuilder("ClassLoaderSystem", ClassLoaderSystem.class.getName());
builder.setFactoryClass(ClientLauncher.class.getName());
builder.setFactoryMethod("getClassLoaderSystem");
BeanMetaData classLoaderSystemBMD = builder.getBeanMetaData();
addBeanMetaData(beanFactories, beans, classLoaderSystemBMD);
// ClassLoading
builder = BeanMetaDataBuilderFactory.createBuilder("ClassLoading", ClassLoading.class.getName());
builder.addMethodInstallCallback("addModule", ControllerState.CONFIGURED);
builder.addMethodUninstallCallback("removeModule", ControllerState.CONFIGURED);
BeanMetaData classLoadingBMD = builder.getBeanMetaData();
addBeanMetaData(beanFactories, beans, classLoadingBMD);
try
{
builder = BeanMetaDataBuilderFactory.createBuilder("ClientContainer",
"org.jboss.ejb3.client.ClientContainer");
VFSClassLoaderFactory factory = new VFSClassLoaderFactory("ClientLauncherClassPath");
ArrayList<String> roots = new ArrayList<String>();
// Create the classpath
log.info("Setting up classpath from: ");
for(String path : classPath)
{
log.info(path);
mount(path);
roots.add(path);
}
for(String path : extraClassPath)
{
log.info(path);
mount(path);
roots.add(path);
}
log.info("End classpath");
factory.setRoots(roots);
beanFactories.add(factory);
// ClientContainer(xml, mainClass, applicationClientName, jndiEnv);
String classLoaderName = factory.getContextName();
if(classLoaderName == null)
classLoaderName = factory.getName() + ":" + factory.getVersion();
String metaDataJndiName = applicationClientName + "/metaData";
ValueMetaData xmlMD = new JndiDependencyValueMetaData(metaDataJndiName, jndiEnv, classLoaderName);
builder.addConstructorParameter(JBossClientMetaData.class.getName(), xmlMD);
//builder.addConstructorParameter(JBossClientMetaData.class.getName(), xml);
builder.addConstructorParameter(Class.class.getName(), mainClassName);
builder.addConstructorParameter(String.class.getName(), applicationClientName);
builder.addConstructorParameter(Properties.class.getName(), jndiEnv);
// Use vfs class loader as the ClientContainer class loader
ValueMetaData classLoader = builder.createInject(classLoaderName);
builder.setClassLoader(classLoader);
BeanMetaData clientContainerMD = builder.getBeanMetaData();
AbstractKernelDeployment deployment = new AbstractKernelDeployment();
deployment.setName(factory.getName() + ":" + factory.getVersion());
addBeanMetaData(beanFactories, beans, clientContainerMD);
deployment.setBeanFactories(beanFactories);