use of org.apache.openejb.assembler.classic.ProxyFactoryInfo in project aries by apache.
the class EJBExtender method setupOpenEJB.
private void setupOpenEJB() throws OpenEJBException {
// Avoid a ClassLoader problem
ClassLoader cl = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(OpenEjbVersion.class.getClassLoader());
OpenEjbVersion.get();
} finally {
Thread.currentThread().setContextClassLoader(cl);
}
Assembler a = new Assembler();
TransactionServiceInfo tsi = new TransactionServiceInfo();
tsi.service = "TransactionManager";
tsi.id = "OSGi Transaction Manager";
PassthroughFactory.add(tsi, OSGiTransactionManager.get());
// Avoid another ClassLoader problem
try {
Thread.currentThread().setContextClassLoader(PassthroughFactory.class.getClassLoader());
a.createTransactionManager(tsi);
} finally {
Thread.currentThread().setContextClassLoader(cl);
}
try {
// Overwrite existing, default JPA integration with an Aries JPA integrated one
Assembler.getContext().put(JtaEntityManagerRegistry.class.getName(), AriesPersistenceContextIntegration.get());
SystemInstance.get().setComponent(JtaEntityManagerRegistry.class, AriesPersistenceContextIntegration.get());
} catch (NoClassDefFoundError ncdfe) {
// TODO log that no JPA Context integration is available
}
SecurityServiceInfo ssi = new SecurityServiceInfo();
ssi.service = "SecurityService";
ssi.id = "Pseudo Security Service";
PassthroughFactory.add(ssi, new PseudoSecurityService());
// Avoid another ClassLoader problem
try {
Thread.currentThread().setContextClassLoader(PassthroughFactory.class.getClassLoader());
a.createSecurityService(ssi);
} finally {
Thread.currentThread().setContextClassLoader(cl);
}
ProxyFactoryInfo proxyFactoryInfo = new ProxyFactoryInfo();
proxyFactoryInfo.id = "Aries ProxyFactory";
proxyFactoryInfo.service = "ProxyFactory";
proxyFactoryInfo.properties = new Properties();
PassthroughFactory.add(proxyFactoryInfo, AriesProxyService.get());
try {
Thread.currentThread().setContextClassLoader(PassthroughFactory.class.getClassLoader());
a.createProxyFactory(proxyFactoryInfo);
} finally {
Thread.currentThread().setContextClassLoader(cl);
}
}
Aggregations