File file = new File(System.getProperty("user.home") + "/.m2/repository/org/apache/openejb/openejb-itests-beans/3.0-incubating-SNAPSHOT/openejb-itests-beans-3.0-incubating-SNAPSHOT.jar");
if (!file.canRead()) return;
JarFile moduleFile = new JarFile(file);
TransactionManager transactionManager = new GeronimoTransactionManager();
OpenEjbSystem openEjbSystem = new OpenEjbSystemGBean(transactionManager);
addEjbContainer(openEjbSystem, "Default Stateless Container", "STATELESS");
addEjbContainer(openEjbSystem, "Default Stateful Container", "STATEFUL");
addEjbContainer(openEjbSystem, "Default BMP Container", "BMP_ENTITY");
addEjbContainer(openEjbSystem, "Default CMP Container", "CMP_ENTITY");
addEjbContainer(openEjbSystem, "Default MDB Container", "MESSAGE");
// load ejb-jar.xml
String ejbJarXml = XmlUtil.loadEjbJarXml(null, moduleFile);
assertNotNull(ejbJarXml);
EjbJar ejbJar = XmlUtil.unmarshal(EjbJar.class, ejbJarXml);
// load openejb-jar.xml
String openejbJarXml = XmlUtil.loadOpenejbJarXml(null, moduleFile);
OpenejbJar openejbJar = XmlUtil.unmarshal(OpenejbJar.class, openejbJarXml);
// create the module object
ClassLoader classLoader = new URLClassLoader(new URL[] {file.toURL()}, getClass().getClassLoader());
EjbModule ejbModule = new EjbModule(classLoader, moduleFile.getName(), ejbJar, openejbJar);
// configure the application
EjbJarInfo ejbJarInfo = openEjbSystem.configureApplication(ejbModule);
openEjbSystem.createEjbJar(ejbJarInfo, classLoader);
}