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);
}
}
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;
}
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;
}
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);
}
}
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);
}
}
}
}
}
Aggregations