Search in sources :

Example 1 with ResourceRef$JAXB.readResourceRef

use of org.apache.openejb.jee.ResourceRef$JAXB.readResourceRef in project tomee by apache.

the class DebuggableVmHackery method pruneRefs.

private void pruneRefs(final JndiConsumer bean, final EjbDeployment ejbDeployment) {
    for (final ResourceRef ref : copy(bean.getResourceRef())) {
        if (ref.getResType().startsWith("javax.jms.")) {
            final ResourceLink resourceLink = ejbDeployment.getResourceLink(ref.getName());
            ejbDeployment.getResourceLink().remove(resourceLink);
            bean.getResourceRef().remove(ref);
        }
    }
    for (final ResourceEnvRef ref : bean.getResourceEnvRef()) {
        final ResourceLink resourceLink = ejbDeployment.getResourceLink(ref.getName());
        ejbDeployment.getResourceLink().remove(resourceLink);
    }
    bean.getResourceEnvRef().clear();
    for (final MessageDestinationRef ref : bean.getMessageDestinationRef()) {
        final ResourceLink resourceLink = ejbDeployment.getResourceLink(ref.getName());
        ejbDeployment.getResourceLink().remove(resourceLink);
    }
    bean.getMessageDestinationRef().clear();
    bean.getPersistenceContextRef().clear();
    bean.getPersistenceUnitRef().clear();
}
Also used : MessageDestinationRef(org.apache.openejb.jee.MessageDestinationRef) ResourceLink(org.apache.openejb.jee.oejb3.ResourceLink) ResourceRef(org.apache.openejb.jee.ResourceRef) ResourceEnvRef(org.apache.openejb.jee.ResourceEnvRef)

Example 2 with ResourceRef$JAXB.readResourceRef

use of org.apache.openejb.jee.ResourceRef$JAXB.readResourceRef in project tomee by apache.

the class GeronimoMappedName method mapReferences.

private void mapReferences(final EjbJar ejbJar) {
    if (ejbJar == null) {
        return;
    }
    for (final EnterpriseBean enterpriseBean : ejbJar.getEnterpriseBeans()) {
        for (final EjbRef ref : enterpriseBean.getEjbRef()) {
            // remap only corba references
            final String mappedName = ref.getMappedName();
            if (mappedName != null && (mappedName.startsWith("jndi:corbaloc") || mappedName.startsWith("jndi:corbaname"))) {
                final String refName = ref.getEjbRefName();
                ref.setMappedName(MAPPED_NAME_PREFIX + refName);
            }
            if (null == mappedName && ref.getEjbRefName().equals("ejb/MEJB")) {
                ref.setMappedName("mejb/ejb/mgmt/MEJB");
            }
        }
        for (final MessageDestinationRef ref : enterpriseBean.getMessageDestinationRef()) {
            final String refName = ref.getMessageDestinationRefName();
            ref.setMappedName(MAPPED_NAME_PREFIX + refName);
        }
        for (final PersistenceContextRef ref : enterpriseBean.getPersistenceContextRef()) {
            final String refName = ref.getPersistenceContextRefName();
            ref.setMappedName(MAPPED_NAME_PREFIX + refName);
        }
        for (final PersistenceUnitRef ref : enterpriseBean.getPersistenceUnitRef()) {
            final String refName = ref.getPersistenceUnitRefName();
            ref.setMappedName(MAPPED_NAME_PREFIX + refName);
        }
        for (final ResourceRef ref : enterpriseBean.getResourceRef()) {
            final String refName = ref.getResRefName();
            ref.setMappedName(MAPPED_NAME_PREFIX + refName);
        }
        for (final ResourceEnvRef ref : enterpriseBean.getResourceEnvRef()) {
            final String refName = ref.getResourceEnvRefName();
            ref.setMappedName(MAPPED_NAME_PREFIX + refName);
        }
        for (final ServiceRef ref : enterpriseBean.getServiceRef()) {
            final String refName = ref.getServiceRefName();
            ref.setMappedName(MAPPED_NAME_PREFIX + refName);
        }
    }
}
Also used : MessageDestinationRef(org.apache.openejb.jee.MessageDestinationRef) EnterpriseBean(org.apache.openejb.jee.EnterpriseBean) EjbRef(org.apache.openejb.jee.EjbRef) PersistenceContextRef(org.apache.openejb.jee.PersistenceContextRef) ResourceRef(org.apache.openejb.jee.ResourceRef) ServiceRef(org.apache.openejb.jee.ServiceRef) PersistenceUnitRef(org.apache.openejb.jee.PersistenceUnitRef) ResourceEnvRef(org.apache.openejb.jee.ResourceEnvRef)

Example 3 with ResourceRef$JAXB.readResourceRef

use of org.apache.openejb.jee.ResourceRef$JAXB.readResourceRef in project tomee by apache.

the class ApplyOpenejbJar method deploy.

public AppModule deploy(final AppModule appModule) throws OpenEJBException {
    for (final EjbModule ejbModule : appModule.getEjbModules()) {
        final Map<String, EjbDeployment> ejbDeployments = ejbModule.getOpenejbJar().getDeploymentsByEjbName();
        for (final EnterpriseBean enterpriseBean : ejbModule.getEjbJar().getEnterpriseBeans()) {
            // Get the OpenEJB deployment from openejb-jar.xml
            final EjbDeployment ejbDeployment = ejbDeployments.get(enterpriseBean.getEjbName());
            enterpriseBean.setId(ejbDeployment.getDeploymentId());
            for (final ResourceRef ref : enterpriseBean.getResourceRef()) {
                final ResourceLink resourceLink = ejbDeployment.getResourceLink(ref.getName());
                if (resourceLink != null && resourceLink.getResId() != null) /* don't overwrite with null */
                {
                    ref.setMappedName(resourceLink.getResId());
                }
            }
            for (final ResourceEnvRef ref : enterpriseBean.getResourceEnvRef()) {
                final ResourceLink resourceLink = ejbDeployment.getResourceLink(ref.getName());
                if (resourceLink != null && resourceLink.getResId() != null) /* don't overwrite with null */
                {
                    ref.setMappedName(resourceLink.getResId());
                }
            }
            for (final MessageDestinationRef ref : enterpriseBean.getMessageDestinationRef()) {
                final ResourceLink resourceLink = ejbDeployment.getResourceLink(ref.getName());
                if (resourceLink != null && resourceLink.getResId() != null) /* don't overwrite with null */
                {
                    ref.setMappedName(resourceLink.getResId());
                }
            }
            for (final EjbRef ref : enterpriseBean.getEjbRef()) {
                final EjbLink ejbLink = ejbDeployment.getEjbLink(ref.getName());
                if (ejbLink != null && ejbLink.getDeployentId() != null) /* don't overwrite with null */
                {
                    ref.setMappedName(ejbLink.getDeployentId());
                }
            }
            for (final EjbLocalRef ref : enterpriseBean.getEjbLocalRef()) {
                final EjbLink ejbLink = ejbDeployment.getEjbLink(ref.getName());
                if (ejbLink != null && ejbLink.getDeployentId() != null) /* don't overwrite with null */
                {
                    ref.setMappedName(ejbLink.getDeployentId());
                }
            }
        }
    }
    return appModule;
}
Also used : EjbLocalRef(org.apache.openejb.jee.EjbLocalRef) MessageDestinationRef(org.apache.openejb.jee.MessageDestinationRef) EnterpriseBean(org.apache.openejb.jee.EnterpriseBean) ResourceLink(org.apache.openejb.jee.oejb3.ResourceLink) EjbRef(org.apache.openejb.jee.EjbRef) EjbDeployment(org.apache.openejb.jee.oejb3.EjbDeployment) ResourceRef(org.apache.openejb.jee.ResourceRef) ResourceEnvRef(org.apache.openejb.jee.ResourceEnvRef) EjbLink(org.apache.openejb.jee.oejb3.EjbLink)

Example 4 with ResourceRef$JAXB.readResourceRef

use of org.apache.openejb.jee.ResourceRef$JAXB.readResourceRef in project tomee by apache.

the class AutoConfig method deploy.

private void deploy(final EjbModule ejbModule, final AppResources appResources) throws OpenEJBException {
    final OpenejbJar openejbJar;
    if (ejbModule.getOpenejbJar() != null) {
        openejbJar = ejbModule.getOpenejbJar();
    } else {
        openejbJar = new OpenejbJar();
        ejbModule.setOpenejbJar(openejbJar);
    }
    final Map<String, EjbDeployment> deployments = openejbJar.getDeploymentsByEjbName();
    for (final EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
        final EjbDeployment ejbDeployment = deployments.get(bean.getEjbName());
        if (ejbDeployment == null) {
            throw new OpenEJBException("No ejb deployment found for ejb " + bean.getEjbName());
        }
        final String beanType = getType(bean);
        final Class<? extends ContainerInfo> containerInfoType = ConfigurationFactory.getContainerInfoType(beanType);
        logger.debug("Bean type of bean {0} is {1}", bean.getEjbName(), beanType);
        if (ejbDeployment.getContainerId() == null && !skipMdb(bean)) {
            logger.debug("Container for bean {0} is not set, looking for a suitable container", bean.getEjbName());
            String containerId = getUsableContainer(containerInfoType, bean, appResources);
            if (containerId == null) {
                logger.debug("Suitable container for bean {0} not found, creating one", bean.getEjbName());
                containerId = createContainer(containerInfoType, ejbDeployment, bean);
            }
            logger.debug("Setting container ID {0} for bean {1}", containerId, bean.getEjbName());
            ejbDeployment.setContainerId(containerId);
        }
        logger.debug("Container ID for bean {0} is {1}", bean.getEjbName(), ejbDeployment.getContainerId());
        // create the container if it doesn't exist
        final List<String> containerIds = configFactory.getContainerIds();
        final Collection<ContainerInfo> containerInfos = appResources.getContainerInfos();
        for (final ContainerInfo containerInfo : containerInfos) {
            containerIds.add(containerInfo.id);
        }
        if (!containerIds.contains(ejbDeployment.getContainerId()) && !skipMdb(bean)) {
            logger.debug("Desired container {0} not found. Containers available: {1}. Creating a new container.", ejbDeployment.getContainerId(), Join.join(", ", containerIds));
            createContainer(containerInfoType, ejbDeployment, bean);
        }
        // Resource reference
        for (final ResourceRef ref : bean.getResourceRef()) {
            processResourceRef(ref, ejbDeployment, appResources, ejbModule);
        }
        // Resource env reference
        for (final JndiReference ref : bean.getResourceEnvRef()) {
            processResourceEnvRef(ref, ejbDeployment, appResources, ejbModule.getClassLoader());
        }
        // Message destination reference
        for (final MessageDestinationRef ref : bean.getMessageDestinationRef()) {
            processResourceEnvRef(ref, ejbDeployment, appResources, ejbModule.getClassLoader());
        }
        // mdb message destination id
        if (autoCreateResources && bean instanceof MessageDrivenBean) {
            final MessageDrivenBean mdb = (MessageDrivenBean) bean;
            final ResourceLink resourceLink = ejbDeployment.getResourceLink("openejb/destination");
            if (resourceLink != null) {
                try {
                    final String destinationId = getResourceEnvId(bean.getEjbName(), resourceLink.getResId(), mdb.getMessageDestinationType(), appResources);
                    resourceLink.setResId(destinationId);
                } catch (final OpenEJBException e) {
                    // The MDB doesn't need the auto configured "openejb/destination" env entry
                    ejbDeployment.removeResourceLink("openejb/destination");
                }
            }
        }
    }
}
Also used : OpenEJBException(org.apache.openejb.OpenEJBException) EnterpriseBean(org.apache.openejb.jee.EnterpriseBean) MessageDestinationRef(org.apache.openejb.jee.MessageDestinationRef) OpenejbJar(org.apache.openejb.jee.oejb3.OpenejbJar) JndiReference(org.apache.openejb.jee.JndiReference) MessageDrivenBean(org.apache.openejb.jee.MessageDrivenBean) ResourceLink(org.apache.openejb.jee.oejb3.ResourceLink) ContainerInfo(org.apache.openejb.assembler.classic.ContainerInfo) MdbContainerInfo(org.apache.openejb.assembler.classic.MdbContainerInfo) EjbDeployment(org.apache.openejb.jee.oejb3.EjbDeployment) ResourceRef(org.apache.openejb.jee.ResourceRef)

Example 5 with ResourceRef$JAXB.readResourceRef

use of org.apache.openejb.jee.ResourceRef$JAXB.readResourceRef in project tomee by apache.

the class Interceptor$JAXB method _read.

public static final Interceptor _read(final XoXMLStreamReader reader, RuntimeContext context) throws Exception {
    // Check for xsi:nil
    if (reader.isXsiNil()) {
        return null;
    }
    if (context == null) {
        context = new RuntimeContext();
    }
    final Interceptor interceptor = new Interceptor();
    context.beforeUnmarshal(interceptor, org.metatype.sxc.jaxb.LifecycleCallback.NONE);
    ArrayList<Text> descriptions = null;
    List<AroundInvoke> aroundInvoke = null;
    List<AroundTimeout> aroundTimeout = 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, DataSource> dataSource = null;
    List<org.apache.openejb.jee.LifecycleCallback> postActivate = null;
    List<org.apache.openejb.jee.LifecycleCallback> prePassivate = null;
    List<org.apache.openejb.jee.LifecycleCallback> afterBegin = null;
    List<org.apache.openejb.jee.LifecycleCallback> beforeCompletion = null;
    List<org.apache.openejb.jee.LifecycleCallback> afterCompletion = null;
    // Check xsi:type
    final QName xsiType = reader.getXsiType();
    if (xsiType != null) {
        if (("interceptorType" != xsiType.getLocalPart()) || ("http://java.sun.com/xml/ns/javaee" != xsiType.getNamespaceURI())) {
            return context.unexpectedXsiType(reader, Interceptor.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, interceptor);
            interceptor.id = id;
        } else if (XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI != attribute.getNamespace()) {
            context.unexpectedAttribute(attribute, new QName("", "id"));
        }
    }
    // Read elements
    for (final XoXMLStreamReader elementReader : reader.getChildElements()) {
        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 (("interceptor-class" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: interceptorClass
            final String interceptorClassRaw = elementReader.getElementAsString();
            final String interceptorClass;
            try {
                interceptorClass = Adapters.collapsedStringAdapterAdapter.unmarshal(interceptorClassRaw);
            } catch (final Exception e) {
                context.xmlAdapterError(elementReader, CollapsedStringAdapter.class, String.class, String.class, e);
                continue;
            }
            interceptor.interceptorClass = interceptorClass;
        } else if (("around-invoke" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: aroundInvoke
            final AroundInvoke aroundInvokeItem = readAroundInvoke(elementReader, context);
            if (aroundInvoke == null) {
                aroundInvoke = interceptor.aroundInvoke;
                if (aroundInvoke != null) {
                    aroundInvoke.clear();
                } else {
                    aroundInvoke = new ArrayList<AroundInvoke>();
                }
            }
            aroundInvoke.add(aroundInvokeItem);
        } else if (("around-timeout" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: aroundTimeout
            final AroundTimeout aroundTimeoutItem = readAroundTimeout(elementReader, context);
            if (aroundTimeout == null) {
                aroundTimeout = interceptor.aroundTimeout;
                if (aroundTimeout != null) {
                    aroundTimeout.clear();
                } else {
                    aroundTimeout = new ArrayList<AroundTimeout>();
                }
            }
            aroundTimeout.add(aroundTimeoutItem);
        } 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 = interceptor.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 = interceptor.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 = interceptor.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 = interceptor.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 = interceptor.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 = interceptor.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 = interceptor.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 = interceptor.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 = interceptor.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 = interceptor.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 = interceptor.preDestroy;
                if (preDestroy != null) {
                    preDestroy.clear();
                } else {
                    preDestroy = new ArrayList<org.apache.openejb.jee.LifecycleCallback>();
                }
            }
            preDestroy.add(preDestroyItem);
        } 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 = interceptor.dataSource;
                if (dataSource != null) {
                    dataSource.clear();
                } else {
                    dataSource = new KeyedCollection<String, DataSource>();
                }
            }
            dataSource.add(dataSourceItem);
        } else if (("post-activate" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: postActivate
            final org.apache.openejb.jee.LifecycleCallback postActivateItem = readLifecycleCallback(elementReader, context);
            if (postActivate == null) {
                postActivate = interceptor.postActivate;
                if (postActivate != null) {
                    postActivate.clear();
                } else {
                    postActivate = new ArrayList<org.apache.openejb.jee.LifecycleCallback>();
                }
            }
            postActivate.add(postActivateItem);
        } else if (("pre-passivate" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: prePassivate
            final org.apache.openejb.jee.LifecycleCallback prePassivateItem = readLifecycleCallback(elementReader, context);
            if (prePassivate == null) {
                prePassivate = interceptor.prePassivate;
                if (prePassivate != null) {
                    prePassivate.clear();
                } else {
                    prePassivate = new ArrayList<org.apache.openejb.jee.LifecycleCallback>();
                }
            }
            prePassivate.add(prePassivateItem);
        } else if (("after-begin" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: afterBegin
            final org.apache.openejb.jee.LifecycleCallback afterBeginItem = readLifecycleCallback(elementReader, context);
            if (afterBegin == null) {
                afterBegin = interceptor.afterBegin;
                if (afterBegin != null) {
                    afterBegin.clear();
                } else {
                    afterBegin = new ArrayList<org.apache.openejb.jee.LifecycleCallback>();
                }
            }
            afterBegin.add(afterBeginItem);
        } else if (("before-completion" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: beforeCompletion
            final org.apache.openejb.jee.LifecycleCallback beforeCompletionItem = readLifecycleCallback(elementReader, context);
            if (beforeCompletion == null) {
                beforeCompletion = interceptor.beforeCompletion;
                if (beforeCompletion != null) {
                    beforeCompletion.clear();
                } else {
                    beforeCompletion = new ArrayList<org.apache.openejb.jee.LifecycleCallback>();
                }
            }
            beforeCompletion.add(beforeCompletionItem);
        } else if (("after-completion" == elementReader.getLocalName()) && ("http://java.sun.com/xml/ns/javaee" == elementReader.getNamespaceURI())) {
            // ELEMENT: afterCompletion
            final org.apache.openejb.jee.LifecycleCallback afterCompletionItem = readLifecycleCallback(elementReader, context);
            if (afterCompletion == null) {
                afterCompletion = interceptor.afterCompletion;
                if (afterCompletion != null) {
                    afterCompletion.clear();
                } else {
                    afterCompletion = new ArrayList<org.apache.openejb.jee.LifecycleCallback>();
                }
            }
            afterCompletion.add(afterCompletionItem);
        } else {
            context.unexpectedElement(elementReader, new QName("http://java.sun.com/xml/ns/javaee", "description"), new QName("http://java.sun.com/xml/ns/javaee", "interceptor-class"), new QName("http://java.sun.com/xml/ns/javaee", "around-invoke"), new QName("http://java.sun.com/xml/ns/javaee", "around-timeout"), 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", "data-source"), new QName("http://java.sun.com/xml/ns/javaee", "post-activate"), new QName("http://java.sun.com/xml/ns/javaee", "pre-passivate"), new QName("http://java.sun.com/xml/ns/javaee", "after-begin"), new QName("http://java.sun.com/xml/ns/javaee", "before-completion"), new QName("http://java.sun.com/xml/ns/javaee", "after-completion"));
        }
    }
    if (descriptions != null) {
        try {
            interceptor.setDescriptions(descriptions.toArray(new Text[descriptions.size()]));
        } catch (final Exception e) {
            context.setterError(reader, Interceptor.class, "setDescriptions", Text[].class, e);
        }
    }
    if (aroundInvoke != null) {
        interceptor.aroundInvoke = aroundInvoke;
    }
    if (aroundTimeout != null) {
        interceptor.aroundTimeout = aroundTimeout;
    }
    if (envEntry != null) {
        interceptor.envEntry = envEntry;
    }
    if (ejbRef != null) {
        interceptor.ejbRef = ejbRef;
    }
    if (ejbLocalRef != null) {
        interceptor.ejbLocalRef = ejbLocalRef;
    }
    if (serviceRef != null) {
        interceptor.serviceRef = serviceRef;
    }
    if (resourceRef != null) {
        interceptor.resourceRef = resourceRef;
    }
    if (resourceEnvRef != null) {
        interceptor.resourceEnvRef = resourceEnvRef;
    }
    if (messageDestinationRef != null) {
        interceptor.messageDestinationRef = messageDestinationRef;
    }
    if (persistenceContextRef != null) {
        interceptor.persistenceContextRef = persistenceContextRef;
    }
    if (persistenceUnitRef != null) {
        interceptor.persistenceUnitRef = persistenceUnitRef;
    }
    if (postConstruct != null) {
        interceptor.postConstruct = postConstruct;
    }
    if (preDestroy != null) {
        interceptor.preDestroy = preDestroy;
    }
    if (dataSource != null) {
        interceptor.dataSource = dataSource;
    }
    if (postActivate != null) {
        interceptor.postActivate = postActivate;
    }
    if (prePassivate != null) {
        interceptor.prePassivate = prePassivate;
    }
    if (afterBegin != null) {
        interceptor.afterBegin = afterBegin;
    }
    if (beforeCompletion != null) {
        interceptor.beforeCompletion = beforeCompletion;
    }
    if (afterCompletion != null) {
        interceptor.afterCompletion = afterCompletion;
    }
    context.afterUnmarshal(interceptor, org.metatype.sxc.jaxb.LifecycleCallback.NONE);
    return interceptor;
}
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) AroundInvoke$JAXB.writeAroundInvoke(org.apache.openejb.jee.AroundInvoke$JAXB.writeAroundInvoke) AroundInvoke$JAXB.readAroundInvoke(org.apache.openejb.jee.AroundInvoke$JAXB.readAroundInvoke) 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) 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) AroundTimeout$JAXB.readAroundTimeout(org.apache.openejb.jee.AroundTimeout$JAXB.readAroundTimeout) AroundTimeout$JAXB.writeAroundTimeout(org.apache.openejb.jee.AroundTimeout$JAXB.writeAroundTimeout) 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) 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)

Aggregations

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 ServiceRef$JAXB.writeServiceRef (org.apache.openejb.jee.ServiceRef$JAXB.writeServiceRef)14