Search in sources :

Example 1 with ReferenceLocationInfo

use of org.apache.openejb.assembler.classic.ReferenceLocationInfo in project aries by apache.

the class EJBExtender method processJPAMappings.

private void processJPAMappings(EjbJarInfo ejbInfo) {
    for (EnterpriseBeanInfo ebi : ejbInfo.enterpriseBeans) {
        for (PersistenceUnitReferenceInfo pui : ebi.jndiEnc.persistenceUnitRefs) {
            pui.location = new ReferenceLocationInfo();
            pui.location.jndiName = "aries/integration/unit/" + pui.persistenceUnitName;
        }
        for (PersistenceContextReferenceInfo pci : ebi.jndiEnc.persistenceContextRefs) {
            pci.location = new ReferenceLocationInfo();
            pci.location.jndiName = "aries/integration/context/" + pci.persistenceUnitName;
        }
    }
}
Also used : EnterpriseBeanInfo(org.apache.openejb.assembler.classic.EnterpriseBeanInfo) PersistenceContextReferenceInfo(org.apache.openejb.assembler.classic.PersistenceContextReferenceInfo) ReferenceLocationInfo(org.apache.openejb.assembler.classic.ReferenceLocationInfo) PersistenceUnitReferenceInfo(org.apache.openejb.assembler.classic.PersistenceUnitReferenceInfo)

Example 2 with ReferenceLocationInfo

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

the class JndiEncInfoBuilder method buildLocationInfo.

private ReferenceLocationInfo buildLocationInfo(final JndiReference reference) {
    final String lookupName = reference.getLookupName();
    if (lookupName != null) {
        final ReferenceLocationInfo location = new ReferenceLocationInfo();
        location.jndiName = lookupName;
        return location;
    }
    final String mappedName = reference.getMappedName();
    if (mappedName != null && mappedName.startsWith("jndi:")) {
        final ReferenceLocationInfo location = new ReferenceLocationInfo();
        final String name = mappedName.substring(5);
        if (name.startsWith("ext://")) {
            final URI uri = URLs.uri(name);
            location.jndiProviderId = uri.getHost();
            location.jndiName = uri.getPath();
        } else {
            location.jndiName = name;
        }
        return location;
    }
    return null;
}
Also used : ReferenceLocationInfo(org.apache.openejb.assembler.classic.ReferenceLocationInfo) URI(java.net.URI)

Aggregations

ReferenceLocationInfo (org.apache.openejb.assembler.classic.ReferenceLocationInfo)2 URI (java.net.URI)1 EnterpriseBeanInfo (org.apache.openejb.assembler.classic.EnterpriseBeanInfo)1 PersistenceContextReferenceInfo (org.apache.openejb.assembler.classic.PersistenceContextReferenceInfo)1 PersistenceUnitReferenceInfo (org.apache.openejb.assembler.classic.PersistenceUnitReferenceInfo)1