public MetaData getMetaData() {
return new MetaData(false, new Class[] { Application.class }, null);
}
private Application processDOL(DeploymentContext dc) throws IOException {
ReadableArchive sourceArchive = dc.getSource();
sourceArchive.setExtraData(Types.class, dc.getTransientAppMetaData(Types.class.getName(), Types.class));
sourceArchive.setExtraData(Parser.class, dc.getTransientAppMetaData(Parser.class.getName(), Parser.class));
ClassLoader cl = dc.getClassLoader();
DeployCommandParameters params = dc.getCommandParameters(DeployCommandParameters.class);
String name = params.name();
String archiveType = dc.getArchiveHandler().getArchiveType();
Archivist archivist = archivistFactory.getArchivist(archiveType, cl);
if (archivist == null) {
// if no JavaEE medata was found in the archive, we return
// an empty Application object
return Application.createApplication();
}
archivist.setAnnotationProcessingRequested(true);
String xmlValidationLevel = dasConfig.getDeployXmlValidation();
archivist.setXMLValidationLevel(xmlValidationLevel);
if (xmlValidationLevel.equals("none")) {
archivist.setXMLValidation(false);
}
archivist.setRuntimeXMLValidationLevel(xmlValidationLevel);
if (xmlValidationLevel.equals("none")) {
archivist.setRuntimeXMLValidation(false);
}
Collection<Sniffer> sniffers = dc.getTransientAppMetaData(DeploymentProperties.SNIFFERS, Collection.class);
archivist.setExtensionArchivists(archivistFactory.getExtensionsArchivists(sniffers, archivist.getModuleType()));
ApplicationHolder holder = dc.getModuleMetaData(ApplicationHolder.class);
File deploymentPlan = params.deploymentplan;
handleDeploymentPlan(deploymentPlan, archivist, sourceArchive, holder);
long start = System.currentTimeMillis();
Application application=null;
if (holder!=null) {
application = holder.app;
application.setAppName(name);
application.setClassLoader(cl);
if (application.isVirtual()) {
ModuleDescriptor md = application.getStandaloneBundleDescriptor().getModuleDescriptor();
md.setModuleName(name);
}
try {
applicationFactory.openWith(application, sourceArchive,
archivist);
} catch(SAXParseException e) {
throw new IOException(e);
}
}
else {
// for case where user specified --name
// and it's a standalone module
try {
application = applicationFactory.openArchive(
name, archivist, sourceArchive, true);
application.setAppName(name);
ModuleDescriptor md = application.getStandaloneBundleDescriptor().getModuleDescriptor();
md.setModuleName(name);
} catch(SAXParseException e) {
throw new IOException(e);
}
}
application.setRegistrationName(name);
sourceArchive.removeExtraData(Types.class);
sourceArchive.removeExtraData(Parser.class);
Logger.getAnonymousLogger().log(Level.FINE, "DOL Loading time" + (System.currentTimeMillis() - start));
return application;
}