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;
}
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."));
}
Aggregations