Search in sources :

Example 21 with EnvEntry$JAXB.readEnvEntry

use of org.apache.openejb.jee.EnvEntry$JAXB.readEnvEntry in project tomee by apache.

the class ApplicationClient$JAXB method _read.

public static final ApplicationClient _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final ApplicationClient applicationClient = new ApplicationClient();
    context.beforeUnmarshal(applicationClient, org.metatype.sxc.jaxb.LifecycleCallback.NONE);
    ArrayList<Text> descriptions = null;
    ArrayList<Text> displayNames = null;
    LocalCollection<Icon> icon = null;
    KeyedCollection<String, EnvEntry> envEntry = null;
    KeyedCollection<String, EjbRef> ejbRef = null;
    KeyedCollection<String, EjbLocalRef> ejbLocalRef = null;
    KeyedCollection<String, ServiceRef> serviceRef = null;
    KeyedCollection<String, ResourceRef> resourceRef = null;
    KeyedCollection<String, ResourceEnvRef> resourceEnvRef = null;
    KeyedCollection<String, MessageDestinationRef> messageDestinationRef = null;
    KeyedCollection<String, PersistenceContextRef> persistenceContextRef = null;
    KeyedCollection<String, PersistenceUnitRef> persistenceUnitRef = null;
    List<org.apache.openejb.jee.LifecycleCallback> postConstruct = null;
    List<org.apache.openejb.jee.LifecycleCallback> preDestroy = null;
    KeyedCollection<String, MessageDestination> messageDestination = null;
    KeyedCollection<String, DataSource> dataSource = null;
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("application-clientType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, ApplicationClient.class);
        }
    }
    // Read attributes
    for (final Attribute attribute : reader.getAttributes()) {
        if (("id" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
            // ATTRIBUTE: id
            final String id = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
            context.addXmlId(reader, id, applicationClient);
            applicationClient.id = id;
        } else if (("metadata-complete" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
            // ATTRIBUTE: metadataComplete
            final Boolean metadataComplete = ("1".equals(attribute.getValue()) || "true".equals(attribute.getValue()));
            applicationClient.metadataComplete = metadataComplete;
        } else if (("version" == attribute.getLocalName()) && (("" == attribute.getNamespace()) || (attribute.getNamespace() == null))) {
            // ATTRIBUTE: version
            applicationClient.version = Adapters.collapsedStringAdapterAdapter.unmarshal(attribute.getValue());
        } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
            context.unexpectedAttribute(attribute, new QName("", "id"), new QName("", "metadata-complete"), new QName("", "version"));
        }
    }
    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
        if (("module-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: moduleName
            final String moduleNameRaw = elementReader.getElementAsString();
            final String moduleName;
            try {
                moduleName = Adapters.collapsedStringAdapterAdapter.unmarshal(moduleNameRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            applicationClient.moduleName = moduleName;
        } else if (("description" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: descriptions
            final Text descriptionsItem = readText(elementReader, context);
            if (descriptions == null) {
                descriptions = new ArrayList<Text>();
            }
            descriptions.add(descriptionsItem);
        } else if (("display-name" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: displayNames
            final Text displayNamesItem = readText(elementReader, context);
            if (displayNames == null) {
                displayNames = new ArrayList<Text>();
            }
            displayNames.add(displayNamesItem);
        } else if (("icon" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: icon
            final Icon iconItem = readIcon(elementReader, context);
            if (icon == null) {
                icon = applicationClient.icon;
                if (icon != null) {
                    icon.clear();
                } else {
                    icon = new LocalCollection<Icon>();
                }
            }
            icon.add(iconItem);
        } else if (("env-entry" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: envEntry
            final EnvEntry envEntryItem = readEnvEntry(elementReader, context);
            if (envEntry == null) {
                envEntry = applicationClient.envEntry;
                if (envEntry != null) {
                    envEntry.clear();
                } else {
                    envEntry = new KeyedCollection<String, EnvEntry>();
                }
            }
            envEntry.add(envEntryItem);
        } else if (("ejb-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: ejbRef
            final EjbRef ejbRefItem = readEjbRef(elementReader, context);
            if (ejbRef == null) {
                ejbRef = applicationClient.ejbRef;
                if (ejbRef != null) {
                    ejbRef.clear();
                } else {
                    ejbRef = new KeyedCollection<String, EjbRef>();
                }
            }
            ejbRef.add(ejbRefItem);
        } else if (("ejb-local-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: ejbLocalRef
            final EjbLocalRef ejbLocalRefItem = readEjbLocalRef(elementReader, context);
            if (ejbLocalRef == null) {
                ejbLocalRef = applicationClient.ejbLocalRef;
                if (ejbLocalRef != null) {
                    ejbLocalRef.clear();
                } else {
                    ejbLocalRef = new KeyedCollection<String, EjbLocalRef>();
                }
            }
            ejbLocalRef.add(ejbLocalRefItem);
        } else if (("service-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: serviceRef
            final ServiceRef serviceRefItem = readServiceRef(elementReader, context);
            if (serviceRef == null) {
                serviceRef = applicationClient.serviceRef;
                if (serviceRef != null) {
                    serviceRef.clear();
                } else {
                    serviceRef = new KeyedCollection<String, ServiceRef>();
                }
            }
            serviceRef.add(serviceRefItem);
        } else if (("resource-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: resourceRef
            final ResourceRef resourceRefItem = readResourceRef(elementReader, context);
            if (resourceRef == null) {
                resourceRef = applicationClient.resourceRef;
                if (resourceRef != null) {
                    resourceRef.clear();
                } else {
                    resourceRef = new KeyedCollection<String, ResourceRef>();
                }
            }
            resourceRef.add(resourceRefItem);
        } else if (("resource-env-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: resourceEnvRef
            final ResourceEnvRef resourceEnvRefItem = readResourceEnvRef(elementReader, context);
            if (resourceEnvRef == null) {
                resourceEnvRef = applicationClient.resourceEnvRef;
                if (resourceEnvRef != null) {
                    resourceEnvRef.clear();
                } else {
                    resourceEnvRef = new KeyedCollection<String, ResourceEnvRef>();
                }
            }
            resourceEnvRef.add(resourceEnvRefItem);
        } else if (("message-destination-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: messageDestinationRef
            final MessageDestinationRef messageDestinationRefItem = readMessageDestinationRef(elementReader, context);
            if (messageDestinationRef == null) {
                messageDestinationRef = applicationClient.messageDestinationRef;
                if (messageDestinationRef != null) {
                    messageDestinationRef.clear();
                } else {
                    messageDestinationRef = new KeyedCollection<String, MessageDestinationRef>();
                }
            }
            messageDestinationRef.add(messageDestinationRefItem);
        } else if (("persistence-context-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: persistenceContextRef
            final PersistenceContextRef persistenceContextRefItem = readPersistenceContextRef(elementReader, context);
            if (persistenceContextRef == null) {
                persistenceContextRef = applicationClient.persistenceContextRef;
                if (persistenceContextRef != null) {
                    persistenceContextRef.clear();
                } else {
                    persistenceContextRef = new KeyedCollection<String, PersistenceContextRef>();
                }
            }
            persistenceContextRef.add(persistenceContextRefItem);
        } else if (("persistence-unit-ref" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: persistenceUnitRef
            final PersistenceUnitRef persistenceUnitRefItem = readPersistenceUnitRef(elementReader, context);
            if (persistenceUnitRef == null) {
                persistenceUnitRef = applicationClient.persistenceUnitRef;
                if (persistenceUnitRef != null) {
                    persistenceUnitRef.clear();
                } else {
                    persistenceUnitRef = new KeyedCollection<String, PersistenceUnitRef>();
                }
            }
            persistenceUnitRef.add(persistenceUnitRefItem);
        } else if (("post-construct" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: postConstruct
            final org.apache.openejb.jee.LifecycleCallback postConstructItem = readLifecycleCallback(elementReader, context);
            if (postConstruct == null) {
                postConstruct = applicationClient.postConstruct;
                if (postConstruct != null) {
                    postConstruct.clear();
                } else {
                    postConstruct = new ArrayList<org.apache.openejb.jee.LifecycleCallback>();
                }
            }
            postConstruct.add(postConstructItem);
        } else if (("pre-destroy" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: preDestroy
            final org.apache.openejb.jee.LifecycleCallback preDestroyItem = readLifecycleCallback(elementReader, context);
            if (preDestroy == null) {
                preDestroy = applicationClient.preDestroy;
                if (preDestroy != null) {
                    preDestroy.clear();
                } else {
                    preDestroy = new ArrayList<org.apache.openejb.jee.LifecycleCallback>();
                }
            }
            preDestroy.add(preDestroyItem);
        } else if (("callback-handler" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: callbackHandler
            final String callbackHandlerRaw = elementReader.getElementAsString();
            final String callbackHandler;
            try {
                callbackHandler = Adapters.collapsedStringAdapterAdapter.unmarshal(callbackHandlerRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            applicationClient.callbackHandler = callbackHandler;
        } else if (("message-destination" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: messageDestination
            final MessageDestination messageDestinationItem = readMessageDestination(elementReader, context);
            if (messageDestination == null) {
                messageDestination = applicationClient.messageDestination;
                if (messageDestination != null) {
                    messageDestination.clear();
                } else {
                    messageDestination = new KeyedCollection<String, MessageDestination>();
                }
            }
            messageDestination.add(messageDestinationItem);
        } else if (("data-source" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: dataSource
            final DataSource dataSourceItem = readDataSource(elementReader, context);
            if (dataSource == null) {
                dataSource = applicationClient.dataSource;
                if (dataSource != null) {
                    dataSource.clear();
                } else {
                    dataSource = new KeyedCollection<String, DataSource>();
                }
            }
            dataSource.add(dataSourceItem);
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "module-name"), new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "display-name"), new QName("http://java.sun.com/xml/ns/javaee", "icon"), new QName("http://java.sun.com/xml/ns/javaee", "env-entry"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-ref"), new QName("http://java.sun.com/xml/ns/javaee", "ejb-local-ref"), new QName("http://java.sun.com/xml/ns/javaee", "service-ref"), new QName("http://java.sun.com/xml/ns/javaee", "resource-ref"), new QName("http://java.sun.com/xml/ns/javaee", "resource-env-ref"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination-ref"), new QName("http://java.sun.com/xml/ns/javaee", "persistence-context-ref"), new QName("http://java.sun.com/xml/ns/javaee", "persistence-unit-ref"), new QName("http://java.sun.com/xml/ns/javaee", "post-construct"), new QName("http://java.sun.com/xml/ns/javaee", "pre-destroy"), new QName("http://java.sun.com/xml/ns/javaee", "callback-handler"), new QName("http://java.sun.com/xml/ns/javaee", "message-destination"), new QName("http://java.sun.com/xml/ns/javaee", "data-source"));
        }
    }
    if (descriptions != null) {
        try {
            applicationClient.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
        } catch (final Exception e) {
            context.setterError(reader, ApplicationClient.class, "setDescriptions", Text[].class, e);
        }
    }
    if (displayNames != null) {
        try {
            applicationClient.setDisplayNames(displayNames.toArray(new Text[displayNames.size()]));
        } catch (final Exception e) {
            context.setterError(reader, ApplicationClient.class, "setDisplayNames", Text[].class, e);
        }
    }
    if (icon != null) {
        applicationClient.icon = icon;
    }
    if (envEntry != null) {
        applicationClient.envEntry = envEntry;
    }
    if (ejbRef != null) {
        applicationClient.ejbRef = ejbRef;
    }
    if (ejbLocalRef != null) {
        applicationClient.ejbLocalRef = ejbLocalRef;
    }
    if (serviceRef != null) {
        applicationClient.serviceRef = serviceRef;
    }
    if (resourceRef != null) {
        applicationClient.resourceRef = resourceRef;
    }
    if (resourceEnvRef != null) {
        applicationClient.resourceEnvRef = resourceEnvRef;
    }
    if (messageDestinationRef != null) {
        applicationClient.messageDestinationRef = messageDestinationRef;
    }
    if (persistenceContextRef != null) {
        applicationClient.persistenceContextRef = persistenceContextRef;
    }
    if (persistenceUnitRef != null) {
        applicationClient.persistenceUnitRef = persistenceUnitRef;
    }
    if (postConstruct != null) {
        applicationClient.postConstruct = postConstruct;
    }
    if (preDestroy != null) {
        applicationClient.preDestroy = preDestroy;
    }
    if (messageDestination != null) {
        applicationClient.messageDestination = messageDestination;
    }
    if (dataSource != null) {
        applicationClient.dataSource = dataSource;
    }
    context.afterUnmarshal(applicationClient, org.metatype.sxc.jaxb.LifecycleCallback.NONE);
    return applicationClient;
}
Also used : Attribute(org.metatype.sxc.util.Attribute) PersistenceContextRef$JAXB.readPersistenceContextRef(org.apache.openejb.jee.PersistenceContextRef$JAXB.readPersistenceContextRef) PersistenceContextRef$JAXB.writePersistenceContextRef(org.apache.openejb.jee.PersistenceContextRef$JAXB.writePersistenceContextRef) ArrayList(java.util.ArrayList) MessageDestinationRef$JAXB.writeMessageDestinationRef(org.apache.openejb.jee.MessageDestinationRef$JAXB.writeMessageDestinationRef) MessageDestinationRef$JAXB.readMessageDestinationRef(org.apache.openejb.jee.MessageDestinationRef$JAXB.readMessageDestinationRef) EjbRef$JAXB.readEjbRef(org.apache.openejb.jee.EjbRef$JAXB.readEjbRef) EjbRef$JAXB.writeEjbRef(org.apache.openejb.jee.EjbRef$JAXB.writeEjbRef) ResourceEnvRef$JAXB.readResourceEnvRef(org.apache.openejb.jee.ResourceEnvRef$JAXB.readResourceEnvRef) ResourceEnvRef$JAXB.writeResourceEnvRef(org.apache.openejb.jee.ResourceEnvRef$JAXB.writeResourceEnvRef) PersistenceUnitRef$JAXB.readPersistenceUnitRef(org.apache.openejb.jee.PersistenceUnitRef$JAXB.readPersistenceUnitRef) PersistenceUnitRef$JAXB.writePersistenceUnitRef(org.apache.openejb.jee.PersistenceUnitRef$JAXB.writePersistenceUnitRef) EnvEntry$JAXB.readEnvEntry(org.apache.openejb.jee.EnvEntry$JAXB.readEnvEntry) EnvEntry$JAXB.writeEnvEntry(org.apache.openejb.jee.EnvEntry$JAXB.writeEnvEntry) XoXMLStreamReader(org.metatype.sxc.util.XoXMLStreamReader) EjbLocalRef$JAXB.writeEjbLocalRef(org.apache.openejb.jee.EjbLocalRef$JAXB.writeEjbLocalRef) EjbLocalRef$JAXB.readEjbLocalRef(org.apache.openejb.jee.EjbLocalRef$JAXB.readEjbLocalRef) MessageDestination$JAXB.readMessageDestination(org.apache.openejb.jee.MessageDestination$JAXB.readMessageDestination) MessageDestination$JAXB.writeMessageDestination(org.apache.openejb.jee.MessageDestination$JAXB.writeMessageDestination) CollapsedStringAdapter(javax.xml.bind.annotation.adapters.CollapsedStringAdapter) QName(javax.xml.namespace.QName) Text$JAXB.readText(org.apache.openejb.jee.Text$JAXB.readText) Text$JAXB.writeText(org.apache.openejb.jee.Text$JAXB.writeText) DataSource$JAXB.writeDataSource(org.apache.openejb.jee.DataSource$JAXB.writeDataSource) DataSource$JAXB.readDataSource(org.apache.openejb.jee.DataSource$JAXB.readDataSource) ResourceRef$JAXB.readResourceRef(org.apache.openejb.jee.ResourceRef$JAXB.readResourceRef) ResourceRef$JAXB.writeResourceRef(org.apache.openejb.jee.ResourceRef$JAXB.writeResourceRef) Icon$JAXB.readIcon(org.apache.openejb.jee.Icon$JAXB.readIcon) Icon$JAXB.writeIcon(org.apache.openejb.jee.Icon$JAXB.writeIcon) LifecycleCallback$JAXB.readLifecycleCallback(org.apache.openejb.jee.LifecycleCallback$JAXB.readLifecycleCallback) LifecycleCallback$JAXB.writeLifecycleCallback(org.apache.openejb.jee.LifecycleCallback$JAXB.writeLifecycleCallback) RuntimeContext(org.metatype.sxc.jaxb.RuntimeContext) ServiceRef$JAXB.readServiceRef(org.apache.openejb.jee.ServiceRef$JAXB.readServiceRef) ServiceRef$JAXB.writeServiceRef(org.apache.openejb.jee.ServiceRef$JAXB.writeServiceRef)

Example 22 with EnvEntry$JAXB.readEnvEntry

use of org.apache.openejb.jee.EnvEntry$JAXB.readEnvEntry in project tomee by apache.

the class StatefulConstructorInjectionTest method setUp.

protected void setUp() throws Exception {
    super.setUp();
    System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, LocalInitialContextFactory.class.getName());
    final ConfigurationFactory config = new ConfigurationFactory();
    final Assembler assembler = new Assembler();
    assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
    assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
    // Setup the descriptor information
    final EjbJar ejbJar = new EjbJar();
    ejbJar.addEnterpriseBean(new StatelessBean(FooBean.class));
    final StatefulBean bean = ejbJar.addEnterpriseBean(new StatefulBean(WidgetBean.class));
    bean.getEnvEntry().add(new EnvEntry("count", Integer.class.getName(), "10"));
    final EjbModule module = new EjbModule(ejbJar);
    module.setBeans(new Beans());
    assembler.createApplication(config.configureApplication(module));
}
Also used : StatefulBean(org.apache.openejb.jee.StatefulBean) EjbModule(org.apache.openejb.config.EjbModule) LocalInitialContextFactory(org.apache.openejb.core.LocalInitialContextFactory) Beans(org.apache.openejb.jee.Beans) TransactionServiceInfo(org.apache.openejb.assembler.classic.TransactionServiceInfo) StatelessBean(org.apache.openejb.jee.StatelessBean) ConfigurationFactory(org.apache.openejb.config.ConfigurationFactory) Assembler(org.apache.openejb.assembler.classic.Assembler) SecurityServiceInfo(org.apache.openejb.assembler.classic.SecurityServiceInfo) EjbJar(org.apache.openejb.jee.EjbJar) EnvEntry(org.apache.openejb.jee.EnvEntry)

Example 23 with EnvEntry$JAXB.readEnvEntry

use of org.apache.openejb.jee.EnvEntry$JAXB.readEnvEntry in project tomee by apache.

the class WebAppEnvEntryTest method war.

@Module
@Classes(cdi = true, value = { CdiBean.class })
public WebApp war() {
    final WebApp webApp = new WebApp().contextRoot("/myapp");
    webApp.getEnvEntry().add(new EnvEntry("foo", String.class.getName(), "bar"));
    return webApp;
}
Also used : WebApp(org.apache.openejb.jee.WebApp) EnvEntry(org.apache.openejb.jee.EnvEntry)

Example 24 with EnvEntry$JAXB.readEnvEntry

use of org.apache.openejb.jee.EnvEntry$JAXB.readEnvEntry in project tomee by apache.

the class ModuleNameInjectionTest method setUp.

protected void setUp() throws Exception {
    super.setUp();
    System.setProperty(javax.naming.Context.INITIAL_CONTEXT_FACTORY, InitContextFactory.class.getName());
    final ConfigurationFactory config = new ConfigurationFactory();
    final Assembler assembler = new Assembler();
    assembler.createProxyFactory(config.configureService(ProxyFactoryInfo.class));
    assembler.createTransactionManager(config.configureService(TransactionServiceInfo.class));
    assembler.createSecurityService(config.configureService(SecurityServiceInfo.class));
    // containers
    final StatelessSessionContainerInfo statelessContainerInfo = config.configureService(StatelessSessionContainerInfo.class);
    statelessContainerInfo.properties.setProperty("TimeOut", "10");
    statelessContainerInfo.properties.setProperty("MaxSize", "0");
    statelessContainerInfo.properties.setProperty("StrictPooling", "false");
    assembler.createContainer(statelessContainerInfo);
    // Setup the descriptor information
    final StatelessBean bean = new StatelessBean(WidgetBean.class);
    bean.addBusinessLocal(Widget.class.getName());
    bean.addBusinessRemote(RemoteWidget.class.getName());
    final EjbJar ejbJar = new EjbJar();
    ejbJar.setModuleName("myEjbModule");
    ejbJar.addEnterpriseBean(bean);
    EnvEntry entry;
    entry = new EnvEntry("moduleName", (String) null, null);
    entry.setLookupName("java:module/ModuleName");
    entry.getInjectionTarget().add((new InjectionTarget(WidgetBean.class.getName(), "moduleName")));
    bean.getEnvEntry().add(entry);
    entry = new EnvEntry("appName", (String) null, null);
    entry.setLookupName("java:app/AppName");
    entry.getInjectionTarget().add((new InjectionTarget(WidgetBean.class.getName(), "appName")));
    bean.getEnvEntry().add(entry);
    final AppModule app = new AppModule(this.getClass().getClassLoader(), "test-app", new Application("myApp"), false);
    app.getEjbModules().add(new EjbModule(ejbJar));
    assembler.createApplication(config.configureApplication(app));
}
Also used : StatelessSessionContainerInfo(org.apache.openejb.assembler.classic.StatelessSessionContainerInfo) InitContextFactory(org.apache.openejb.core.ivm.naming.InitContextFactory) ProxyFactoryInfo(org.apache.openejb.assembler.classic.ProxyFactoryInfo) TransactionServiceInfo(org.apache.openejb.assembler.classic.TransactionServiceInfo) StatelessBean(org.apache.openejb.jee.StatelessBean) InjectionTarget(org.apache.openejb.jee.InjectionTarget) Assembler(org.apache.openejb.assembler.classic.Assembler) SecurityServiceInfo(org.apache.openejb.assembler.classic.SecurityServiceInfo) Application(org.apache.openejb.jee.Application) EjbJar(org.apache.openejb.jee.EjbJar) EnvEntry(org.apache.openejb.jee.EnvEntry)

Example 25 with EnvEntry$JAXB.readEnvEntry

use of org.apache.openejb.jee.EnvEntry$JAXB.readEnvEntry in project tomee by apache.

the class VagueEnvEntriesMatchTest method foo.

@Module
public SingletonBean foo() {
    final SingletonBean singletonBean = new SingletonBean(Blue.class);
    singletonBean.getEnvEntry().add(new EnvEntry().name("one").type(String.class).value("hello"));
    singletonBean.getEnvEntry().add(new EnvEntry().name("two").type(String.class).value("false"));
    singletonBean.getEnvEntry().add(new EnvEntry().name(Blue.class.getName() + "/two").type(String.class).value("true"));
    return singletonBean;
}
Also used : SingletonBean(org.apache.openejb.jee.SingletonBean) EnvEntry(org.apache.openejb.jee.EnvEntry) Module(org.apache.openejb.testing.Module)

Aggregations

EnvEntry (org.apache.openejb.jee.EnvEntry)19 DataSource$JAXB.readDataSource (org.apache.openejb.jee.DataSource$JAXB.readDataSource)14 DataSource$JAXB.writeDataSource (org.apache.openejb.jee.DataSource$JAXB.writeDataSource)14 EjbLocalRef$JAXB.readEjbLocalRef (org.apache.openejb.jee.EjbLocalRef$JAXB.readEjbLocalRef)14 EjbLocalRef$JAXB.writeEjbLocalRef (org.apache.openejb.jee.EjbLocalRef$JAXB.writeEjbLocalRef)14 EjbRef$JAXB.readEjbRef (org.apache.openejb.jee.EjbRef$JAXB.readEjbRef)14 EjbRef$JAXB.writeEjbRef (org.apache.openejb.jee.EjbRef$JAXB.writeEjbRef)14 EnvEntry$JAXB.readEnvEntry (org.apache.openejb.jee.EnvEntry$JAXB.readEnvEntry)14 EnvEntry$JAXB.writeEnvEntry (org.apache.openejb.jee.EnvEntry$JAXB.writeEnvEntry)14 MessageDestinationRef$JAXB.readMessageDestinationRef (org.apache.openejb.jee.MessageDestinationRef$JAXB.readMessageDestinationRef)14 MessageDestinationRef$JAXB.writeMessageDestinationRef (org.apache.openejb.jee.MessageDestinationRef$JAXB.writeMessageDestinationRef)14 PersistenceContextRef$JAXB.readPersistenceContextRef (org.apache.openejb.jee.PersistenceContextRef$JAXB.readPersistenceContextRef)14 PersistenceContextRef$JAXB.writePersistenceContextRef (org.apache.openejb.jee.PersistenceContextRef$JAXB.writePersistenceContextRef)14 PersistenceUnitRef$JAXB.readPersistenceUnitRef (org.apache.openejb.jee.PersistenceUnitRef$JAXB.readPersistenceUnitRef)14 PersistenceUnitRef$JAXB.writePersistenceUnitRef (org.apache.openejb.jee.PersistenceUnitRef$JAXB.writePersistenceUnitRef)14 ResourceEnvRef$JAXB.readResourceEnvRef (org.apache.openejb.jee.ResourceEnvRef$JAXB.readResourceEnvRef)14 ResourceEnvRef$JAXB.writeResourceEnvRef (org.apache.openejb.jee.ResourceEnvRef$JAXB.writeResourceEnvRef)14 ResourceRef$JAXB.readResourceRef (org.apache.openejb.jee.ResourceRef$JAXB.readResourceRef)14 ResourceRef$JAXB.writeResourceRef (org.apache.openejb.jee.ResourceRef$JAXB.writeResourceRef)14 ServiceRef$JAXB.readServiceRef (org.apache.openejb.jee.ServiceRef$JAXB.readServiceRef)14