Search in sources :

Example 1 with PersistenceContextRef$JAXB.writePersistenceContextRef

use of org.apache.openejb.jee.PersistenceContextRef$JAXB.writePersistenceContextRef 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 2 with PersistenceContextRef$JAXB.writePersistenceContextRef

use of org.apache.openejb.jee.PersistenceContextRef$JAXB.writePersistenceContextRef in project tomee by apache.

the class AutoConfig method processPersistenceRef.

private PersistenceUnit processPersistenceRef(final LinkResolver<PersistenceUnit> persistenceUnits, final PersistenceRef ref, final URI moduleURI, final String componentName, final ValidationContext validation) {
    if (ref.getMappedName() != null && ref.getMappedName().startsWith("jndi:")) {
        return null;
    }
    PersistenceUnit unit = persistenceUnits.resolveLink(ref.getPersistenceUnitName(), moduleURI);
    // Explicitly check if we messed up the "if there's only one,
    // that's what you get" rule by adding our "cmp" unit.
    final Collection<PersistenceUnit> cmpUnits = persistenceUnits.values("cmp");
    if (unit == null && cmpUnits.size() > 0 && persistenceUnits.values().size() - cmpUnits.size() == 1) {
        // We did, there is exactly one non-cmp unit.  Let's find it.
        for (final PersistenceUnit persistenceUnit : persistenceUnits.values()) {
            if (!persistenceUnit.getName().equals("cmp")) {
                // Found it
                unit = persistenceUnit;
                break;
            }
        }
    }
    // try again using the ref name
    if (unit == null) {
        unit = persistenceUnits.resolveLink(ref.getName(), moduleURI);
    }
    // try again using the ref name with any prefix removed
    if (unit == null) {
        final String shortName = ref.getName().replaceFirst(".*/", "");
        unit = persistenceUnits.resolveLink(shortName, moduleURI);
    }
    if (unit != null) {
        ref.setPersistenceUnitName(unit.getName());
        ref.setMappedName(unit.getId());
    } else {
        // ----------------------------------------------
        // Nothing was found.  Let's try and figure out
        // what went wrong and log a validation message
        // ----------------------------------------------
        String refType = "persistence";
        if (ref instanceof PersistenceContextRef) {
            refType += "ContextRef";
        } else {
            refType += "UnitRef";
        }
        String refShortName = ref.getName();
        if (refShortName.matches(".*\\..*/.*")) {
            refShortName = refShortName.replaceFirst(".*/", "");
        }
        final List<String> availableUnits = new ArrayList<String>();
        for (final PersistenceUnit persistenceUnit : persistenceUnits.values()) {
            availableUnits.add(persistenceUnit.getName());
        }
        Collections.sort(availableUnits);
        String unitName = ref.getPersistenceUnitName();
        if (availableUnits.size() == 0) {
            // Print a sample persistence.xml using their data
            if (unitName == null) {
                unitName = refShortName;
            }
            validation.fail(componentName, refType + ".noPersistenceUnits", refShortName, unitName);
        } else if ((ref.getPersistenceUnitName() == null || ref.getPersistenceUnitName().length() == 0) && availableUnits.size() > 1) {
            // Print a correct example of unitName in a ref
            // DMB: Idea, the ability to set a default unit-name in openejb-jar.xml via a property
            final String sampleUnitName = availableUnits.get(0);
            validation.fail(componentName, refType + ".noUnitName", refShortName, Join.join(", ", availableUnits), sampleUnitName);
        } else {
            final Collection<PersistenceUnit> vagueMatches = persistenceUnits.values(ref.getPersistenceUnitName());
            if (vagueMatches.size() != 0) {
                // Print the full rootUrls
                final List<String> possibleUnits = new ArrayList<String>();
                for (final PersistenceUnit persistenceUnit : persistenceUnits.values()) {
                    try {
                        URI unitURI = URLs.uri(persistenceUnit.getId());
                        unitURI = URISupport.relativize(moduleURI, unitURI);
                        possibleUnits.add(unitURI.toString());
                    } catch (final Exception e) {
                        // id is typically not a valid URI
                        possibleUnits.add(persistenceUnit.getId());
                    }
                }
                Collections.sort(possibleUnits);
                validation.fail(componentName, refType + ".vagueMatches", refShortName, unitName, possibleUnits.size(), Join.join("\n", possibleUnits));
            } else {
                validation.fail(componentName, refType + ".noMatches", refShortName, unitName, Join.join(", ", availableUnits));
            }
        }
    }
    return unit;
}
Also used : PersistenceUnit(org.apache.openejb.jee.jpa.unit.PersistenceUnit) PersistenceContextRef(org.apache.openejb.jee.PersistenceContextRef) ArrayList(java.util.ArrayList) Collection(java.util.Collection) Arrays.asList(java.util.Arrays.asList) List(java.util.List) ArrayList(java.util.ArrayList) URI(java.net.URI) OpenEJBException(org.apache.openejb.OpenEJBException)

Example 3 with PersistenceContextRef$JAXB.writePersistenceContextRef

use of org.apache.openejb.jee.PersistenceContextRef$JAXB.writePersistenceContextRef in project tomee by apache.

the class CmpJpaConversion method addPersistenceContextRef.

/**
 * Add a persistence context reference for the CMP
 * persistence contexts to this EntityBean definition.
 *
 * @param bean The bean we're updating.
 * @return Returns true if the context was added.  Returns false if
 * the bean already is associated with the CMP persistence
 * context.
 */
private boolean addPersistenceContextRef(final EntityBean bean) {
    // if a ref is already defined, skip this bean
    if (bean.getPersistenceContextRefMap().containsKey("java:" + JpaCmpEngine.CMP_PERSISTENCE_CONTEXT_REF_NAME)) {
        return false;
    }
    final PersistenceContextRef persistenceContextRef = new PersistenceContextRef();
    persistenceContextRef.setName("java:" + JpaCmpEngine.CMP_PERSISTENCE_CONTEXT_REF_NAME);
    persistenceContextRef.setPersistenceUnitName(CMP_PERSISTENCE_UNIT_NAME);
    bean.getPersistenceContextRef().add(persistenceContextRef);
    return true;
}
Also used : PersistenceContextRef(org.apache.openejb.jee.PersistenceContextRef)

Example 4 with PersistenceContextRef$JAXB.writePersistenceContextRef

use of org.apache.openejb.jee.PersistenceContextRef$JAXB.writePersistenceContextRef in project tomee by apache.

the class CheckPersistenceRefs method validate.

public void validate(final EjbModule ejbModule) {
    for (final EnterpriseBean bean : ejbModule.getEjbJar().getEnterpriseBeans()) {
        if (bean instanceof SessionBean) {
            final SessionBean sessionBean = (SessionBean) bean;
            if (sessionBean.getSessionType() == null) {
                // skipping since we don't know here what is the type
                continue;
            }
        }
        final String beanType = getType(bean);
        if (beanType.equals("Stateful")) {
            // skip statefuls and Comp ManagedBean
            continue;
        }
        for (final PersistenceContextRef ref : bean.getPersistenceContextRef()) {
            if (isExtented(ref)) {
                String refName = ref.getName();
                final String prefix = bean.getEjbClass() + "/";
                if (refName.startsWith(prefix)) {
                    refName = refName.substring(prefix.length());
                }
                fail(bean, "persistenceContextExtented.nonStateful", refName, beanType);
            }
        }
    }
}
Also used : EnterpriseBean(org.apache.openejb.jee.EnterpriseBean) PersistenceContextRef(org.apache.openejb.jee.PersistenceContextRef) SessionBean(org.apache.openejb.jee.SessionBean)

Example 5 with PersistenceContextRef$JAXB.writePersistenceContextRef

use of org.apache.openejb.jee.PersistenceContextRef$JAXB.writePersistenceContextRef 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