vfs.add(webAppInfo);
}
final Map<String, ValidatorFactory> validatorFactories = new HashMap<String, ValidatorFactory>();
for (CommonInfoObject info : vfs) {
ValidatorFactory factory = null;
try {
factory = ValidatorBuilder.buildFactory(classLoader, info.validationInfo);
} catch (ValidationException ve) {
logger.warning("can't build the validation factory for module " + info.uniqueId, ve);
}
if (factory != null) {
validatorFactories.put(info.uniqueId, factory);
}
}
moduleIds.addAll(validatorFactories.keySet());
// validators bindings
for (Entry<String, ValidatorFactory> validatorFactory : validatorFactories.entrySet()) {
String id = validatorFactory.getKey();
ValidatorFactory factory = validatorFactory.getValue();
try {
containerSystemContext.bind(VALIDATOR_FACTORY_NAMING_CONTEXT + id, factory);
containerSystemContext.bind(VALIDATOR_NAMING_CONTEXT + id, factory.usingContext().getValidator());
} catch (NameAlreadyBoundException e) {
throw new OpenEJBException("ValidatorFactory already exists for module " + id, e);
} catch (Exception e) {
throw new OpenEJBException(e);
}
}
}
// JPA - Persistence Units MUST be processed first since they will add ClassFileTransformers
// to the class loader which must be added before any classes are loaded
Map<String, String> units = new HashMap<String, String>();
PersistenceBuilder persistenceBuilder = new PersistenceBuilder(persistenceClassLoaderHandler);
for (PersistenceUnitInfo info : appInfo.persistenceUnits) {
ReloadableEntityManagerFactory factory;
try {
factory = persistenceBuilder.createEntityManagerFactory(info, classLoader);
containerSystem.getJNDIContext().bind(PERSISTENCE_UNIT_NAMING_CONTEXT + info.id, factory);
units.put(info.name, PERSISTENCE_UNIT_NAMING_CONTEXT + info.id);
} catch (NameAlreadyBoundException e) {
throw new OpenEJBException("PersistenceUnit already deployed: " + info.persistenceUnitRootUrl);
} catch (Exception e) {
throw new OpenEJBException(e);
}
factory.register();
}
// Connectors
for (ConnectorInfo connector : appInfo.connectors) {
ClassLoader oldClassLoader = Thread.currentThread().getContextClassLoader();