Search in sources :

Example 41 with DeployCommandParameters

use of org.glassfish.api.deployment.DeployCommandParameters in project Payara by payara.

the class WebDeployer method loadWebModuleConfig.

private WebModuleConfig loadWebModuleConfig(DeploymentContext dc) {
    WebModuleConfig wmInfo = new WebModuleConfig();
    try {
        DeployCommandParameters params = dc.getCommandParameters(DeployCommandParameters.class);
        wmInfo.setDescriptor(dc.getModuleMetaData(WebBundleDescriptorImpl.class));
        wmInfo.setVirtualServers(params.virtualservers);
        wmInfo.setLocation(dc.getSourceDir());
        wmInfo.setObjectType(dc.getAppProps().getProperty(ServerTags.OBJECT_TYPE));
    } catch (Exception ex) {
        String msg = rb.getString(LogFacade.UNABLE_TO_LOAD_CONFIG);
        msg = MessageFormat.format(msg, wmInfo.getName());
        logger.log(Level.WARNING, msg, ex);
    }
    return wmInfo;
}
Also used : DeployCommandParameters(org.glassfish.api.deployment.DeployCommandParameters) WebBundleDescriptorImpl(org.glassfish.web.deployment.descriptor.WebBundleDescriptorImpl) String(java.lang.String) DeploymentException(org.glassfish.deployment.common.DeploymentException)

Example 42 with DeployCommandParameters

use of org.glassfish.api.deployment.DeployCommandParameters in project Payara by payara.

the class AppClientGroupFacadeGenerator method earDirUserURIText.

private String earDirUserURIText(final DeploymentContext dc) {
    final DeployCommandParameters deployParams = dc.getCommandParameters(DeployCommandParameters.class);
    final String appName = deployParams.name();
    try {
        return VersioningUtils.getUntaggedName(appName) + "Client/";
    } catch (VersioningSyntaxException ex) {
        Logger.getLogger(JavaWebStartInfo.APPCLIENT_SERVER_MAIN_LOGGER, JavaWebStartInfo.APPCLIENT_SERVER_LOGMESSAGE_RESOURCE).log(Level.SEVERE, null, ex);
    }
    return appName;
}
Also used : DeployCommandParameters(org.glassfish.api.deployment.DeployCommandParameters) VersioningSyntaxException(org.glassfish.deployment.versioning.VersioningSyntaxException)

Example 43 with DeployCommandParameters

use of org.glassfish.api.deployment.DeployCommandParameters in project Payara by payara.

the class StandaloneAppClientDeployerHelper method facadeNameOnly.

/**
 * Returns the name (no path, no type) of the facade JAR.  This is used
 * in both creating the full name and URI of the facade as well as for
 * the name of a subdirectory in the user's download directory.
 *
 * @param dc
 * @return
 */
private String facadeNameOnly(DeploymentContext dc) {
    DeployCommandParameters params = dc.getCommandParameters(DeployCommandParameters.class);
    final String appName = params.name();
    try {
        return VersioningUtils.getUntaggedName(appName) + "Client";
    } catch (VersioningSyntaxException ex) {
        logger.log(Level.SEVERE, ex.getMessage(), ex);
    }
    return appName + "Client";
}
Also used : DeployCommandParameters(org.glassfish.api.deployment.DeployCommandParameters) VersioningSyntaxException(org.glassfish.deployment.versioning.VersioningSyntaxException)

Example 44 with DeployCommandParameters

use of org.glassfish.api.deployment.DeployCommandParameters in project Payara by payara.

the class EarHandler method getApplicationHolder.

private ApplicationHolder getApplicationHolder(ReadableArchive source, DeploymentContext context, boolean isDirectory) {
    ApplicationHolder holder = context.getModuleMetaData(ApplicationHolder.class);
    if (holder == null || holder.app == null) {
        try {
            DeployCommandParameters params = context.getCommandParameters(DeployCommandParameters.class);
            if (params != null && params.altdd != null) {
                source.addArchiveMetaData(DeploymentProperties.ALT_DD, params.altdd);
            }
            long start = System.currentTimeMillis();
            ApplicationArchivist archivist = habitat.getService(ApplicationArchivist.class);
            archivist.setAnnotationProcessingRequested(true);
            String xmlValidationLevel = dasConfig.getDeployXmlValidation();
            archivist.setXMLValidationLevel(xmlValidationLevel);
            if (xmlValidationLevel.equals("none")) {
                archivist.setXMLValidation(false);
            }
            holder = new ApplicationHolder(archivist.createApplication(source, isDirectory));
            _logger.log(FINE, "time to read application.xml {0}", System.currentTimeMillis() - start);
        } catch (IOException | SAXParseException e) {
            throw new RuntimeException(e);
        }
        context.addModuleMetaData(holder);
    }
    if (holder.app == null) {
        throw new RuntimeException(strings.get("errReadMetadata"));
    }
    return holder;
}
Also used : DeployCommandParameters(org.glassfish.api.deployment.DeployCommandParameters) ApplicationHolder(org.glassfish.javaee.core.deployment.ApplicationHolder) SAXParseException(org.xml.sax.SAXParseException) ApplicationArchivist(com.sun.enterprise.deployment.archivist.ApplicationArchivist) IOException(java.io.IOException)

Example 45 with DeployCommandParameters

use of org.glassfish.api.deployment.DeployCommandParameters in project Payara by payara.

the class ResourceValidator method event.

@Override
public void event(Event<?> event) {
    if (event.is(Deployment.AFTER_APPLICATION_CLASSLOADER_CREATION)) {
        DeploymentContext deploymentContext = (DeploymentContext) event.hook();
        Application application = deploymentContext.getModuleMetaData(Application.class);
        DeployCommandParameters commandParams = deploymentContext.getCommandParameters(DeployCommandParameters.class);
        target = commandParams.target;
        if (System.getProperty("deployment.resource.validation", "true").equals("false")) {
            deplLogger.log(Level.INFO, SKIP_RESOURCE_VALIDATION);
            return;
        }
        if (application == null) {
            return;
        }
        AppResources appResources = new AppResources();
        // Puts all resources found in the application via annotation or xml into appResources
        parseResources(deploymentContext, application, appResources);
        // Ensure we have a valid component invocation before triggering lookups
        try (Context ctx = contextUtil.empty().pushContext()) {
            validateResources(deploymentContext, application, appResources);
        }
    }
}
Also used : DeployCommandParameters(org.glassfish.api.deployment.DeployCommandParameters) Context(org.glassfish.internal.api.JavaEEContextUtil.Context) DeploymentContext(org.glassfish.api.deployment.DeploymentContext) InitialContext(javax.naming.InitialContext) DeploymentContext(org.glassfish.api.deployment.DeploymentContext) Application(com.sun.enterprise.deployment.Application)

Aggregations

DeployCommandParameters (org.glassfish.api.deployment.DeployCommandParameters)69 IOException (java.io.IOException)25 File (java.io.File)24 ExtendedDeploymentContext (org.glassfish.internal.deployment.ExtendedDeploymentContext)24 ActionReport (org.glassfish.api.ActionReport)23 DeploymentContext (org.glassfish.api.deployment.DeploymentContext)16 Application (com.sun.enterprise.deployment.Application)14 ReadableArchive (org.glassfish.api.deployment.archive.ReadableArchive)13 DeploymentProperties (org.glassfish.deployment.common.DeploymentProperties)13 Logger (java.util.logging.Logger)12 Properties (java.util.Properties)10 DeploymentContextImpl (org.glassfish.deployment.common.DeploymentContextImpl)10 DeploymentException (org.glassfish.deployment.common.DeploymentException)10 ApplicationInfo (org.glassfish.internal.data.ApplicationInfo)10 ArchiveHandler (org.glassfish.api.deployment.archive.ArchiveHandler)9 VersioningSyntaxException (org.glassfish.deployment.versioning.VersioningSyntaxException)9 Deployment (org.glassfish.internal.deployment.Deployment)9 PropertyVetoException (java.beans.PropertyVetoException)8 URI (java.net.URI)8 UndeployCommandParameters (org.glassfish.api.deployment.UndeployCommandParameters)8