Search in sources :

Example 1 with IASPersistenceManagerDescriptor

use of org.glassfish.ejb.deployment.descriptor.runtime.IASPersistenceManagerDescriptor in project Payara by payara.

the class PMDescriptorsNode method writeDescriptor.

/**
 * write the descriptor class to a DOM tree and return it
 *
 * @param parent node for the DOM tree
 * @param node name
 * @param the descriptor to write
 * @return the DOM tree top node
 */
public Node writeDescriptor(Node parent, String nodeName, EjbBundleDescriptorImpl descriptor) {
    Node pms = null;
    Vector pmDescriptors = descriptor.getPersistenceManagers();
    if (pmDescriptors != null && !pmDescriptors.isEmpty()) {
        pms = super.writeDescriptor(parent, nodeName, descriptor);
        PMDescriptorNode pmNode = new PMDescriptorNode();
        for (Iterator pmIterator = pmDescriptors.iterator(); pmIterator.hasNext(); ) {
            IASPersistenceManagerDescriptor pmDescriptor = (IASPersistenceManagerDescriptor) pmIterator.next();
            pmNode.writeDescriptor(pms, RuntimeTagNames.PM_DESCRIPTOR, pmDescriptor);
        }
        PersistenceManagerInUse inUse = descriptor.getPersistenceManagerInUse();
        if (inUse != null) {
            PMInUseNode inUseNode = new PMInUseNode();
            inUseNode.writeDescriptor(pms, RuntimeTagNames.PM_INUSE, inUse);
        }
    }
    return pms;
}
Also used : IASPersistenceManagerDescriptor(org.glassfish.ejb.deployment.descriptor.runtime.IASPersistenceManagerDescriptor) Node(org.w3c.dom.Node) RuntimeDescriptorNode(com.sun.enterprise.deployment.node.runtime.RuntimeDescriptorNode) PersistenceManagerInUse(org.glassfish.ejb.deployment.descriptor.runtime.PersistenceManagerInUse) Iterator(java.util.Iterator) Vector(java.util.Vector)

Example 2 with IASPersistenceManagerDescriptor

use of org.glassfish.ejb.deployment.descriptor.runtime.IASPersistenceManagerDescriptor in project Payara by payara.

the class EjbBundleDescriptorImpl method getPreferredPersistenceManager.

public IASPersistenceManagerDescriptor getPreferredPersistenceManager() {
    boolean debug = _logger.isLoggable(Level.FINE);
    if (configured_pms == null || configured_pms.size() == 0) {
        // return the default persistence manager descriptor
        return null;
    }
    String pminuse_id = pm_inuse.get_pm_identifier().trim();
    String pminuse_ver = pm_inuse.get_pm_version().trim();
    if (debug) {
        _logger.fine("IASPersistenceManagerDescriptor.getPreferred - inid*" + pminuse_id.trim() + "*");
        _logger.fine("IASPersistenceManagerDescriptor.getPreferred - inver*" + pminuse_ver.trim() + "*");
    }
    int size = configured_pms.size();
    for (int i = 0; i < size; i++) {
        IASPersistenceManagerDescriptor pmdesc = (IASPersistenceManagerDescriptor) configured_pms.elementAt(i);
        String pmdesc_id = pmdesc.getPersistenceManagerIdentifier();
        String pmdesc_ver = pmdesc.getPersistenceManagerVersion();
        if (debug) {
            _logger.fine("IASPersistenceManagerDescriptor.getPreferred - pmid*" + pmdesc_id.trim() + "*");
            _logger.fine("IASPersistenceManagerDescriptor.getPreferred - pmver*" + pmdesc_ver.trim() + "*");
        }
        if (((pmdesc_id.trim()).equals(pminuse_id)) && ((pmdesc_ver.trim()).equals(pminuse_ver))) {
            if (debug)
                _logger.fine("***IASEjbBundleDescriptor.getPreferredPersistenceManager done -#- ");
            return pmdesc;
        }
    }
    throw new IllegalArgumentException(localStrings.getLocalString("enterprise.deployment.nomatchingpminusefound", "No PersistenceManager found that matches specified PersistenceManager in use."));
}
Also used : IASPersistenceManagerDescriptor(org.glassfish.ejb.deployment.descriptor.runtime.IASPersistenceManagerDescriptor)

Aggregations

IASPersistenceManagerDescriptor (org.glassfish.ejb.deployment.descriptor.runtime.IASPersistenceManagerDescriptor)2 RuntimeDescriptorNode (com.sun.enterprise.deployment.node.runtime.RuntimeDescriptorNode)1 Iterator (java.util.Iterator)1 Vector (java.util.Vector)1 PersistenceManagerInUse (org.glassfish.ejb.deployment.descriptor.runtime.PersistenceManagerInUse)1 Node (org.w3c.dom.Node)1