Ejemplo n.º 1
0
 /**
  * This method initializes the container. Essentially, it will try to load the class that contains
  * the list of entities and reflectively call the method that contains that list. It will then
  * initialize the container with that list.
  */
 public void initialize(Map m) {
   boolean keepInitialMaps = keepAllPredeployedPersistenceUnits();
   if (keepInitialMaps) {
     this.initialPuInfos = new HashMap();
   }
   // always create initialEmSetupImpls - it's used to check for puName uniqueness in
   // initPersistenceUnits
   this.initialEmSetupImpls = new HashMap();
   // ailitchev - copied from findPersistenceUnitInfoInArchives: mkeith - get resource name from
   // prop and include in subsequent call
   String descriptorPath = (String) m.get(PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML);
   final Set<Archive> pars;
   if (descriptorPath != null) {
     pars =
         PersistenceUnitProcessor.findPersistenceArchives(
             initializationClassloader, descriptorPath);
   } else {
     pars = PersistenceUnitProcessor.findPersistenceArchives(initializationClassloader);
   }
   try {
     for (Archive archive : pars) {
       AbstractSessionLog.getLog().log(SessionLog.FINER, "cmp_init_initialize", archive);
       initPersistenceUnits(archive, m);
     }
   } finally {
     for (Archive archive : pars) {
       archive.close();
     }
     this.initialEmSetupImpls = null;
   }
 }
Ejemplo n.º 2
0
 /**
  * Find PersistenceUnitInfo corresponding to the persistence unit name. Returns null if either
  * persistence unit either not found or provider is not supported.
  */
 protected SEPersistenceUnitInfo findPersistenceUnitInfoInArchives(String puName, Map m) {
   SEPersistenceUnitInfo persistenceUnitInfo = null;
   // mkeith - get resource name from prop and include in subsequent call
   String descriptorPath = (String) m.get(PersistenceUnitProperties.ECLIPSELINK_PERSISTENCE_XML);
   final Set<Archive> pars;
   if (descriptorPath != null) {
     pars =
         PersistenceUnitProcessor.findPersistenceArchives(
             initializationClassloader, descriptorPath);
   } else {
     pars = PersistenceUnitProcessor.findPersistenceArchives(initializationClassloader);
   }
   try {
     for (Archive archive : pars) {
       persistenceUnitInfo = findPersistenceUnitInfoInArchive(puName, archive, m);
       if (persistenceUnitInfo != null) {
         break;
       }
     }
   } finally {
     for (Archive archive : pars) {
       archive.close();
     }
   }
   return persistenceUnitInfo;
 }