Search in sources :

Example 61 with Application

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);
    }
}
Also used : BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) Application(com.sun.enterprise.deployment.Application)

Example 62 with Application

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;
}
Also used : DeployCommandParameters(org.glassfish.api.deployment.DeployCommandParameters) Application(com.sun.enterprise.deployment.Application)

Example 63 with 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;
}
Also used : Types(org.glassfish.hk2.classmodel.reflect.Types) Sniffer(org.glassfish.api.container.Sniffer) IOException(java.io.IOException) Parser(org.glassfish.hk2.classmodel.reflect.Parser) DeployCommandParameters(org.glassfish.api.deployment.DeployCommandParameters) SAXParseException(org.xml.sax.SAXParseException) ReadableArchive(org.glassfish.api.deployment.archive.ReadableArchive) File(java.io.File) Application(com.sun.enterprise.deployment.Application)

Example 64 with 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);
            }
        }
    }
}
Also used : WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) BundleDescriptor(com.sun.enterprise.deployment.BundleDescriptor) ApplicationInfo(org.glassfish.internal.data.ApplicationInfo) WebBundleDescriptor(com.sun.enterprise.deployment.WebBundleDescriptor) ActionReport(org.glassfish.api.ActionReport) Application(com.sun.enterprise.deployment.Application)

Example 65 with Application

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();
}
Also used : ReadableArchive(org.glassfish.api.deployment.archive.ReadableArchive) Application(com.sun.enterprise.deployment.Application) File(java.io.File) URL(java.net.URL) IOException(java.io.IOException) DeploymentException(org.glassfish.deployment.common.DeploymentException)

Aggregations

Application (com.sun.enterprise.deployment.Application)66 BundleDescriptor (com.sun.enterprise.deployment.BundleDescriptor)17 WebBundleDescriptor (com.sun.enterprise.deployment.WebBundleDescriptor)10 DeployCommandParameters (org.glassfish.api.deployment.DeployCommandParameters)10 ApplicationInfo (org.glassfish.internal.data.ApplicationInfo)10 IOException (java.io.IOException)9 File (java.io.File)8 ModuleDescriptor (org.glassfish.deployment.common.ModuleDescriptor)8 EjbBundleDescriptor (com.sun.enterprise.deployment.EjbBundleDescriptor)7 ReadableArchive (org.glassfish.api.deployment.archive.ReadableArchive)7 EjbDescriptor (com.sun.enterprise.deployment.EjbDescriptor)5 DeploymentException (org.glassfish.deployment.common.DeploymentException)5 SAXParseException (org.xml.sax.SAXParseException)5 ApplicationClientDescriptor (com.sun.enterprise.deployment.ApplicationClientDescriptor)4 ArrayList (java.util.ArrayList)4 WebappClassLoader (org.glassfish.web.loader.WebappClassLoader)4 OpsParams (org.glassfish.api.deployment.OpsParams)3 EjbBundleDescriptorImpl (org.glassfish.ejb.deployment.descriptor.EjbBundleDescriptorImpl)3 Applications (com.sun.enterprise.config.serverbeans.Applications)2 WebComponentDescriptor (com.sun.enterprise.deployment.WebComponentDescriptor)2