Search in sources :

Example 1 with Module

use of com.sun.enterprise.config.serverbeans.Module in project Payara by payara.

the class ApplicationInfo method save.

/**
 * Saves its state to the configuration. this method must be called within a
 * transaction to the configured Application instance.
 *
 * @param app the application being persisted
 */
public void save(Application app) throws TransactionFailure, PropertyVetoException {
    for (EngineRef ref : engines) {
        Engine engine = app.createChild(Engine.class);
        app.getEngine().add(engine);
        ref.save(engine);
    }
    for (ModuleInfo module : modules) {
        Module modConfig = app.getModule(module.getName());
        if (modConfig == null) {
            // not a JavaEE module, create it here
            modConfig = app.createChild(Module.class);
            modConfig.setName(module.getName());
            app.getModule().add(modConfig);
        }
        module.save(modConfig);
    }
}
Also used : Module(com.sun.enterprise.config.serverbeans.Module) Engine(com.sun.enterprise.config.serverbeans.Engine)

Example 2 with Module

use of com.sun.enterprise.config.serverbeans.Module in project Payara by payara.

the class WebModuleConfigCommand method webModuleConfig.

protected WebModuleConfig webModuleConfig(final ActionReport report) {
    Module m = module(report);
    if (m == null) {
        return null;
    }
    WebModuleConfig config = (WebModuleConfig) engine(report).getApplicationConfig();
    return config;
}
Also used : WebModuleConfig(org.glassfish.web.config.serverbeans.WebModuleConfig) Module(com.sun.enterprise.config.serverbeans.Module)

Example 3 with Module

use of com.sun.enterprise.config.serverbeans.Module in project Payara by payara.

the class WebModuleConfigCommand method module.

private Module module(final ActionReport report) {
    final Application app = application();
    if (app == null) {
        fail(report, "appNotReg", "Application {0} not registered", appName());
        return null;
    }
    /*
         * Be helpful by announcing if the user specified a submodule but this
         * is not an EAR or if the user did NOT specify a submodule but this IS
         * an EAR.
         */
    if (app.isStandaloneModule() && appNameAndOptionalModuleName.contains("/")) {
        fail(report, "standaloneAppNoSubMods", "Application {0} is a stand-alone application and contains no submodules but submodule {1} was specified", appName(), moduleName());
        return null;
    }
    if (!app.isStandaloneModule() && !appNameAndOptionalModuleName.contains("/")) {
        fail(report, "earNoModuleSelection", "Application {0} is an enterprise application; please also specify one of the web module names ({1}) as part of the command argument (for example, {0}/{2})", appName(), webModuleList(app), app.getModule().get(0).getName());
        return null;
    }
    final Module module = app.getModule(moduleName());
    if (module == null) {
        if (app.getModule().isEmpty()) {
            fail(report, "noWebModules", "Application {0} contains no web modules", appName());
        } else {
            fail(report, "noSuchModule", "Application {0} contains web modules {1} but {2} is not one of them", appName(), webModuleList(app), moduleName());
        }
    }
    return module;
}
Also used : Module(com.sun.enterprise.config.serverbeans.Module) Application(com.sun.enterprise.config.serverbeans.Application)

Example 4 with Module

use of com.sun.enterprise.config.serverbeans.Module in project Payara by payara.

the class DolProvider method addModuleConfig.

private void addModuleConfig(DeploymentContext dc, Application application) {
    DeployCommandParameters params = dc.getCommandParameters(DeployCommandParameters.class);
    if (!params.origin.isDeploy()) {
        return;
    }
    try {
        com.sun.enterprise.config.serverbeans.Application app_w = dc.getTransientAppMetaData(com.sun.enterprise.config.serverbeans.ServerTags.APPLICATION, com.sun.enterprise.config.serverbeans.Application.class);
        if (app_w != null) {
            if (application.isVirtual()) {
                Module modConfig = app_w.createChild(Module.class);
                app_w.getModule().add(modConfig);
                modConfig.setName(application.getRegistrationName());
            } else {
                for (ModuleDescriptor moduleDesc : application.getModules()) {
                    Module modConfig = app_w.createChild(Module.class);
                    app_w.getModule().add(modConfig);
                    modConfig.setName(moduleDesc.getArchiveUri());
                }
            }
        }
    } catch (Exception e) {
        Logger.getAnonymousLogger().log(Level.WARNING, "failed to add the module config", e);
    }
}
Also used : DeployCommandParameters(org.glassfish.api.deployment.DeployCommandParameters) Module(com.sun.enterprise.config.serverbeans.Module) IOException(java.io.IOException) SAXParseException(org.xml.sax.SAXParseException)

Example 5 with Module

use of com.sun.enterprise.config.serverbeans.Module in project Payara by payara.

the class ResourcesDeployer method retainResourceConfig.

/**
 * retain old resource configuration for the new archive being deployed.
 * @param dc DeploymentContext
 * @param allResources all resources (app scoped, module scoped) of old application
 * @throws Exception when unable to retain old resource configuration.
 */
public void retainResourceConfig(DeploymentContext dc, Map<String, Resources> allResources) throws Exception {
    String appName = getAppNameFromDeployCmdParams(dc);
    Application application = dc.getTransientAppMetaData(ServerTags.APPLICATION, Application.class);
    Resources appScopedResources = allResources.get(appName);
    if (appScopedResources != null) {
        application.setResources(appScopedResources);
    }
    if (DeploymentUtils.isArchiveOfType(dc.getSource(), DOLUtils.earType(), locator)) {
        List<Module> modules = application.getModule();
        if (modules != null) {
            for (Module module : modules) {
                Resources moduleScopedResources = allResources.get(module.getName());
                if (moduleScopedResources != null) {
                    module.setResources(moduleScopedResources);
                }
            }
        }
    }
}
Also used : Module(com.sun.enterprise.config.serverbeans.Module)

Aggregations

Module (com.sun.enterprise.config.serverbeans.Module)42 Application (com.sun.enterprise.config.serverbeans.Application)11 ActionReport (org.glassfish.api.ActionReport)9 PropertyVetoException (java.beans.PropertyVetoException)5 Engine (com.sun.enterprise.config.serverbeans.Engine)3 Resource (com.sun.enterprise.config.serverbeans.Resource)3 Resources (com.sun.enterprise.config.serverbeans.Resources)3 ArrayList (java.util.ArrayList)3 Property (org.jvnet.hk2.config.types.Property)3 Server (com.sun.enterprise.config.serverbeans.Server)2 ConnectorApplication (com.sun.enterprise.connectors.module.ConnectorApplication)2 IOException (java.io.IOException)2 HashMap (java.util.HashMap)2 ConnectorResource (org.glassfish.connectors.config.ConnectorResource)2 WorkSecurityMap (org.glassfish.connectors.config.WorkSecurityMap)2 ApplicationInfo (org.glassfish.internal.data.ApplicationInfo)2 Resource (org.glassfish.resources.api.Resource)2 ConnectorRuntimeException (com.sun.appserv.connectors.internal.api.ConnectorRuntimeException)1 RemoteRestAdminCommand (com.sun.enterprise.admin.remote.RemoteRestAdminCommand)1 ServerRemoteRestAdminCommand (com.sun.enterprise.admin.remote.ServerRemoteRestAdminCommand)1