Search in sources :

Example 1 with JndiConsumer

use of org.apache.openejb.jee.JndiConsumer in project tomee by apache.

the class BuiltInEnvironmentEntries method deploy.

public AppModule deploy(final AppModule appModule) throws OpenEJBException {
    for (final ClientModule module : appModule.getClientModules()) {
        final JndiConsumer consumer = module.getApplicationClient();
        if (consumer == null) {
            continue;
        }
        add(consumer, module, appModule, false);
    }
    for (final WebModule module : appModule.getWebModules()) {
        final JndiConsumer consumer = module.getWebApp();
        if (consumer == null) {
            continue;
        }
        add(consumer, module, appModule, addDefaults);
    }
    for (final EjbModule module : appModule.getEjbModules()) {
        final EjbJar ejbJar = module.getEjbJar();
        if (ejbJar == null) {
            continue;
        }
        for (final EnterpriseBean consumer : ejbJar.getEnterpriseBeans()) {
            add(consumer, module, appModule, addDefaults && BeanContext.Comp.class.getName().equals(consumer.getEjbClass()));
        }
    }
    return appModule;
}
Also used : EnterpriseBean(org.apache.openejb.jee.EnterpriseBean) JndiConsumer(org.apache.openejb.jee.JndiConsumer) EjbJar(org.apache.openejb.jee.EjbJar)

Example 2 with JndiConsumer

use of org.apache.openejb.jee.JndiConsumer in project tomee by apache.

the class CleanEnvEntries method removeUnsetEnvEntries.

public AppModule removeUnsetEnvEntries(final AppModule appModule) throws OpenEJBException {
    final Map<String, EnvEntry> appEnvEntryMap = getAppEnvEntryMap(appModule);
    for (final ClientModule module : appModule.getClientModules()) {
        final JndiConsumer consumer = module.getApplicationClient();
        if (consumer == null) {
            continue;
        }
        removeUnsetEnvEntries(appEnvEntryMap, consumer);
    }
    for (final WebModule module : appModule.getWebModules()) {
        final JndiConsumer consumer = module.getWebApp();
        if (consumer == null) {
            continue;
        }
        removeUnsetEnvEntries(appEnvEntryMap, consumer);
    }
    for (final EjbModule module : appModule.getEjbModules()) {
        final EjbJar ejbJar = module.getEjbJar();
        if (ejbJar == null) {
            continue;
        }
        for (final EnterpriseBean consumer : ejbJar.getEnterpriseBeans()) {
            if (CompManagedBean.class.isInstance(consumer)) {
                // unused can be used by CDI (ear lib using webapp contextual binding)
                continue;
            }
            removeUnsetEnvEntries(appEnvEntryMap, consumer);
        }
    }
    return appModule;
}
Also used : EnterpriseBean(org.apache.openejb.jee.EnterpriseBean) JndiConsumer(org.apache.openejb.jee.JndiConsumer) EnvEntry(org.apache.openejb.jee.EnvEntry) EjbJar(org.apache.openejb.jee.EjbJar)

Example 3 with JndiConsumer

use of org.apache.openejb.jee.JndiConsumer in project tomee by apache.

the class CleanEnvEntries method fillInMissingType.

public AppModule fillInMissingType(final AppModule appModule) throws OpenEJBException {
    for (final ClientModule module : appModule.getClientModules()) {
        final JndiConsumer consumer = module.getApplicationClient();
        if (consumer == null) {
            continue;
        }
        fillInMissingType(consumer, module);
    }
    for (final WebModule module : appModule.getWebModules()) {
        final JndiConsumer consumer = module.getWebApp();
        if (consumer == null) {
            continue;
        }
        fillInMissingType(consumer, module);
    }
    for (final EjbModule module : appModule.getEjbModules()) {
        final EjbJar ejbJar = module.getEjbJar();
        if (ejbJar == null) {
            continue;
        }
        for (final EnterpriseBean consumer : ejbJar.getEnterpriseBeans()) {
            fillInMissingType(consumer, module);
        }
    }
    return appModule;
}
Also used : EnterpriseBean(org.apache.openejb.jee.EnterpriseBean) JndiConsumer(org.apache.openejb.jee.JndiConsumer) EjbJar(org.apache.openejb.jee.EjbJar)

Example 4 with JndiConsumer

use of org.apache.openejb.jee.JndiConsumer in project tomee by apache.

the class ConvertJMSDestinationDefinitions method deploy.

@Override
public AppModule deploy(final AppModule appModule) throws OpenEJBException {
    final List<JndiConsumer> jndiConsumers = collectConsumers(appModule);
    final KeyedCollection<String, JMSDestination> destinations = new KeyedCollection<>();
    for (final JndiConsumer consumer : jndiConsumers) {
        if (consumer != null) {
            destinations.addAll(consumer.getJMSDestination());
        }
    }
    for (final JMSDestination destination : destinations) {
        appModule.getResources().add(toResource(destination));
    }
    return appModule;
}
Also used : JMSDestination(org.apache.openejb.jee.JMSDestination) KeyedCollection(org.apache.openejb.jee.KeyedCollection) JndiConsumer(org.apache.openejb.jee.JndiConsumer)

Example 5 with JndiConsumer

use of org.apache.openejb.jee.JndiConsumer in project tomee by apache.

the class ConvertJMSConnectionFactoryDefinitions method deploy.

@Override
public AppModule deploy(final AppModule appModule) throws OpenEJBException {
    final List<JndiConsumer> jndiConsumers = collectConsumers(appModule);
    final KeyedCollection<String, JMSConnectionFactory> factories = new KeyedCollection<>();
    for (final JndiConsumer consumer : jndiConsumers) {
        if (consumer != null) {
            factories.addAll(consumer.getJMSConnectionFactories());
        }
    }
    for (final JMSConnectionFactory factory : factories) {
        appModule.getResources().add(toResource(factory));
    }
    return appModule;
}
Also used : KeyedCollection(org.apache.openejb.jee.KeyedCollection) JndiConsumer(org.apache.openejb.jee.JndiConsumer) JMSConnectionFactory(org.apache.openejb.jee.JMSConnectionFactory)

Aggregations

JndiConsumer (org.apache.openejb.jee.JndiConsumer)11 EjbJar (org.apache.openejb.jee.EjbJar)5 EnterpriseBean (org.apache.openejb.jee.EnterpriseBean)5 KeyedCollection (org.apache.openejb.jee.KeyedCollection)3 ArrayList (java.util.ArrayList)2 URI (java.net.URI)1 HashMap (java.util.HashMap)1 Properties (java.util.Properties)1 DataSource (javax.sql.DataSource)1 ResourceInfo (org.apache.openejb.assembler.classic.ResourceInfo)1 Resource (org.apache.openejb.config.sys.Resource)1 DataSource (org.apache.openejb.jee.DataSource)1 EnvEntry (org.apache.openejb.jee.EnvEntry)1 JMSConnectionFactory (org.apache.openejb.jee.JMSConnectionFactory)1 JMSDestination (org.apache.openejb.jee.JMSDestination)1 ResourceRef (org.apache.openejb.jee.ResourceRef)1 SessionBean (org.apache.openejb.jee.SessionBean)1 PersistenceUnit (org.apache.openejb.jee.jpa.unit.PersistenceUnit)1 SuperProperties (org.apache.openejb.util.SuperProperties)1