use of com.sun.enterprise.deployment.Application in project Payara by payara.
the class TracerVisitor method accept.
@Override
public void accept(BundleDescriptor descriptor) {
if (descriptor instanceof Application) {
Application application = (Application) descriptor;
accept(application);
for (BundleDescriptor ebd : application.getBundleDescriptorsOfType(DOLUtils.ejbType())) {
ebd.visit(getSubDescriptorVisitor(ebd));
}
for (BundleDescriptor wbd : application.getBundleDescriptorsOfType(DOLUtils.warType())) {
// the validation step from bombing.
if (wbd != null) {
wbd.visit(getSubDescriptorVisitor(wbd));
}
}
for (BundleDescriptor cd : application.getBundleDescriptorsOfType(DOLUtils.rarType())) {
cd.visit(getSubDescriptorVisitor(cd));
}
for (BundleDescriptor acd : application.getBundleDescriptorsOfType(DOLUtils.carType())) {
acd.visit(getSubDescriptorVisitor(acd));
}
super.accept(descriptor);
} else {
super.accept(descriptor);
}
}
use of com.sun.enterprise.deployment.Application in project Payara by payara.
the class DolProvider method load.
public Application load(DeploymentContext dc) throws IOException {
DeployCommandParameters params = dc.getCommandParameters(DeployCommandParameters.class);
Application application = processDOL(dc);
// write out xml files if needed
if (Boolean.valueOf(WRITEOUT_XML)) {
saveAppDescriptor(application, dc);
}
if (application.isVirtual()) {
dc.addModuleMetaData(application.getStandaloneBundleDescriptor());
for (RootDeploymentDescriptor extension : application.getStandaloneBundleDescriptor().getExtensionsDescriptors()) {
dc.addModuleMetaData(extension);
}
}
addModuleConfig(dc, application);
validateKeepStateOption(dc, params, application);
return application;
}
use of com.sun.enterprise.deployment.Application in project Payara by payara.
the class DolProvider method processDOL.
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);
sourceArchive.addArchiveMetaData(DeploymentProperties.APP_PROPS, dc.getAppProps());
sourceArchive.addArchiveMetaData(DeploymentProperties.COMMAND_PARAMS, params);
String name = params.name();
String archiveType = dc.getArchiveHandler().getArchiveType();
Archivist archivist = archivistFactory.getArchivist(archiveType, cl);
if (archivist == null) {
// 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);
application.setRoleMapper(null);
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 {
// 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;
}
use of com.sun.enterprise.deployment.Application in project Payara by payara.
the class GetContextRootCommand method execute.
/**
* Entry point from the framework into the command execution
* @param context context for the command.
*/
public void execute(AdminCommandContext context) {
final ActionReport report = context.getActionReport();
ActionReport.MessagePart part = report.getTopMessagePart();
ApplicationInfo appInfo = appRegistry.get(appname);
if (appInfo != null) {
Application app = appInfo.getMetaData(Application.class);
if (app != null) {
// strip the version suffix (delimited by colon), if present
int versionSuffix = modulename.indexOf(':');
String versionLessModuleName = versionSuffix > 0 ? modulename.substring(0, versionSuffix) : modulename;
BundleDescriptor bundleDesc = app.getModuleByUri(versionLessModuleName);
if (bundleDesc != null && bundleDesc instanceof WebBundleDescriptor) {
String contextRoot = ((WebBundleDescriptor) bundleDesc).getContextRoot();
part.addProperty(DeploymentProperties.CONTEXT_ROOT, contextRoot);
part.setMessage(contextRoot);
}
}
}
}
use of com.sun.enterprise.deployment.Application in project Payara by payara.
the class JavaEEDeployer method getModuleClassPath.
/**
* Returns the classpath associated with this module
* Can be used to compile generated cmp classes,
* rmi stubs etc.
*
* @return the classpath for this module
*/
protected String getModuleClassPath(DeploymentContext ctx) {
// get the base module classpath
// this includes the system classpath and deploy time lib libraries
StringBuilder classpath = new StringBuilder(ASClassLoaderUtil.getModuleClassPath(habitat, ctx));
try {
// add the module dir
classpath.append(ctx.getSourceDir().toURI().getPath());
classpath.append(File.pathSeparator);
// add the stubs dir
classpath.append(ctx.getScratchDir("ejb").toURI().getPath());
classpath.append(File.pathSeparator);
// add the ear lib libraries if it's ear
Application app = ctx.getModuleMetaData(Application.class);
if (!app.isVirtual()) {
ReadableArchive parentArchive = ctx.getSource().getParentArchive();
String compatProp = ctx.getAppProps().getProperty(DeploymentProperties.COMPATIBILITY);
List<URL> earLibURLs = ASClassLoaderUtil.getAppLibDirLibrariesAsList(new File(parentArchive.getURI()), app.getLibraryDirectory(), compatProp);
for (URL url : earLibURLs) {
classpath.append(url.toURI().getPath());
classpath.append(File.pathSeparator);
}
}
} catch (Exception e) {
// log a warning
}
return classpath.toString();
}
Aggregations