Search in sources :

Example 1 with TransactionServiceInfo

use of org.apache.openejb.assembler.classic.TransactionServiceInfo 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);
    }
}
Also used : ProxyFactoryInfo(org.apache.openejb.assembler.classic.ProxyFactoryInfo) JtaEntityManagerRegistry(org.apache.openejb.persistence.JtaEntityManagerRegistry) OpenEjbVersion(org.apache.openejb.util.OpenEjbVersion) TransactionServiceInfo(org.apache.openejb.assembler.classic.TransactionServiceInfo) PseudoSecurityService(org.apache.openejb.ri.sp.PseudoSecurityService) PassthroughFactory(org.apache.openejb.assembler.dynamic.PassthroughFactory) Assembler(org.apache.openejb.assembler.classic.Assembler) Properties(java.util.Properties) SecurityServiceInfo(org.apache.openejb.assembler.classic.SecurityServiceInfo)

Example 2 with TransactionServiceInfo

use of org.apache.openejb.assembler.classic.TransactionServiceInfo in project tomee by apache.

the class ServerContext method createTransactionManager.

public void createTransactionManager(final TransactionManager service) throws OpenEJBException {
    final TransactionServiceInfo serviceInfo = factory.configureService(service, TransactionServiceInfo.class);
    assembler.createTransactionManager(serviceInfo);
}
Also used : TransactionServiceInfo(org.apache.openejb.assembler.classic.TransactionServiceInfo)

Aggregations

TransactionServiceInfo (org.apache.openejb.assembler.classic.TransactionServiceInfo)2 Properties (java.util.Properties)1 Assembler (org.apache.openejb.assembler.classic.Assembler)1 ProxyFactoryInfo (org.apache.openejb.assembler.classic.ProxyFactoryInfo)1 SecurityServiceInfo (org.apache.openejb.assembler.classic.SecurityServiceInfo)1 PassthroughFactory (org.apache.openejb.assembler.dynamic.PassthroughFactory)1 JtaEntityManagerRegistry (org.apache.openejb.persistence.JtaEntityManagerRegistry)1 PseudoSecurityService (org.apache.openejb.ri.sp.PseudoSecurityService)1 OpenEjbVersion (org.apache.openejb.util.OpenEjbVersion)1