openejb = JaxbOpenejb.createOpenejb();
}
loadPropertiesDeclaredConfiguration(openejb);
sys = new OpenEjbConfiguration();
sys.containerSystem = new ContainerSystemInfo();
sys.facilities = new FacilitiesInfo();
for (JndiProvider provider : openejb.getJndiProvider()) {
JndiContextInfo info = configureService(provider, JndiContextInfo.class);
sys.facilities.remoteJndiContexts.add(info);
}
sys.facilities.securityService = configureService(openejb.getSecurityService(), SecurityServiceInfo.class);
sys.facilities.transactionService = configureService(openejb.getTransactionManager(), TransactionServiceInfo.class);
List<ResourceInfo> resources = new ArrayList<ResourceInfo>();
for (Resource resource : openejb.getResource()) {
ResourceInfo resourceInfo = configureService(resource, ResourceInfo.class);
resources.add(resourceInfo);
}
Collections.sort(resources, new ResourceInfoComparator(resources));
sys.facilities.resources.addAll(resources);
// ConnectionManagerInfo service = configureService(openejb.getConnectionManager(), ConnectionManagerInfo.class);
// sys.facilities.connectionManagers.add(service);
if (openejb.getProxyFactory() != null){
sys.facilities.intraVmServer = configureService(openejb.getProxyFactory(), ProxyFactoryInfo.class);
}
for (Container declaration : openejb.getContainer()) {
ContainerInfo info = createContainerInfo(declaration);
sys.containerSystem.containers.add(info);
}
List<Deployments> deployments = openejb.getDeployments();
// make a copy of the list because we update it
deployments = new ArrayList<Deployments>(deployments);
// resolve jar locations ////////////////////////////////////// BEGIN ///////
FileUtils base = SystemInstance.get().getBase();
List<String> declaredApps = new ArrayList<String>(deployments.size());
try {
for (Deployments deployment : deployments) {
DeploymentsResolver.loadFrom(deployment, base, declaredApps);
}
} catch (SecurityException ignored) {
}
for (String pathname : declaredApps) {
try {
File jarFile = new File(pathname);
AppInfo appInfo = configureApplication(jarFile);
sys.containerSystem.applications.add(appInfo);
} catch (OpenEJBException alreadyHandled) {
}
}
if (SystemInstance.get().getOptions().get(DEPLOYMENTS_CLASSPATH_PROPERTY, true)) {
List<String> classpathApps = new ArrayList<String>();
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
DeploymentsResolver.loadFromClasspath(base, classpathApps, classLoader);
ArrayList<File> jarFiles = new ArrayList<File>();
for (String path : classpathApps) {
if (declaredApps.contains(path)) continue;
jarFiles.add(new File(path));
}
try {
if (SystemInstance.get().getOptions().get(CLASSPATH_AS_EAR, true)) {
AppInfo appInfo = configureApplication(classLoader, "classpath.ear", jarFiles);
sys.containerSystem.applications.add(appInfo);
} else for (File jarFile : jarFiles) {
AppInfo appInfo = configureApplication(jarFile);
sys.containerSystem.applications.add(appInfo);
}
} catch (OpenEJBException alreadyHandled) {
}
}
final OpenEjbConfiguration finished = sys;
sys = null;
openejb = null;
return finished;
// return sys;
}