use of com.sun.enterprise.config.serverbeans.Module in project Payara by payara.
the class ListResources method execute.
/**
* Executes the command with the command parameters passed as Properties
* where the keys are the parameter names and the values the parameter values
*
* @param context information
*/
public void execute(AdminCommandContext context) {
if (appName != null) {
if (!isValidApplication(appName)) {
ActionReport report = context.getActionReport();
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
ActionReport.MessagePart messagePart = report.getTopMessagePart();
messagePart.setMessage("Invalid application [" + appName + "]");
return;
}
}
if (moduleName != null) {
if (!isValidModule(appName, moduleName)) {
ActionReport report = context.getActionReport();
report.setActionExitCode(ActionReport.ExitCode.FAILURE);
ActionReport.MessagePart messagePart = report.getTopMessagePart();
messagePart.setMessage("Invalid module [" + moduleName + "] in application [" + appName + "]");
return;
}
}
if (appName != null && moduleName != null) {
Application application = applications.getApplication(appName);
Module module = application.getModule(moduleName);
Resources moduleScopedResources = module.getResources();
if (moduleScopedResources != null) {
ActionReport report = context.getActionReport();
ActionReport.MessagePart messagePart = report.getTopMessagePart();
generateResourcesList(messagePart, moduleScopedResources.getResources());
}
} else if (appName != null) {
Application application = applications.getApplication(appName);
Resources appScopedResources = application.getResources();
if (appScopedResources != null) {
ActionReport report = context.getActionReport();
ActionReport.MessagePart messagePart = report.getTopMessagePart();
generateResourcesList(messagePart, appScopedResources.getResources());
}
}
}
use of com.sun.enterprise.config.serverbeans.Module in project Payara by payara.
the class ResourcesDeployer method preserveResources.
private void preserveResources(Application app) {
String appName = app.getName();
Map<String, Resources> allResources = new HashMap<String, Resources>();
Resources appScopedResources = app.getResources();
if (appScopedResources != null) {
allResources.put(appName, appScopedResources);
}
List<Module> modules = app.getModule();
if (modules != null) {
for (Module module : modules) {
Resources moduleScopedResources = module.getResources();
if (moduleScopedResources != null) {
allResources.put(module.getName(), moduleScopedResources);
}
}
}
// store the resource-configuration
ResourcesRegistry.putResources(appName, allResources);
}
use of com.sun.enterprise.config.serverbeans.Module in project Payara by payara.
the class ApplicationScopedResourcesManager method undeployResources.
/**
* Undeploy all resources associated with a given application
* @param applicationName
*/
public void undeployResources(String applicationName) {
Application app = applications.getApplication(applicationName);
if (app != null) {
List<Module> modules = app.getModule();
if (modules != null) {
for (Module module : modules) {
Resources moduleScopedResources = module.getResources();
if (moduleScopedResources != null) {
undeployResources(moduleScopedResources);
}
}
}
Resources appScopedResources = app.getResources();
if (appScopedResources != null) {
undeployResources(appScopedResources);
}
}
}
use of com.sun.enterprise.config.serverbeans.Module in project Payara by payara.
the class ApplicationScopedResourcesManager method deployResources.
/**
* deploy resources
* @param resources list
*/
public void deployResources(Collection<Resource> resources) {
if (resources != null) {
String applicationName = null;
String moduleName = null;
for (Resource resource : resources) {
Object parentObject = resource.getParent().getParent();
if (parentObject instanceof Application) {
applicationName = ((Application) parentObject).getName();
} else if (parentObject instanceof Module) {
moduleName = ((Module) parentObject).getName();
applicationName = ((Application) ((Module) parentObject).getParent()).getName();
}
if (resource instanceof BindableResource) {
BindableResource bindableResource = (BindableResource) resource;
ResourceInfo resourceInfo = new ResourceInfo(bindableResource.getJndiName(), applicationName, moduleName);
resourcesBinder.deployResource(resourceInfo, resource);
} else if (resource instanceof ResourcePool) {
// ignore, as they are loaded lazily
} else {
// only other resources left are RAC, CWSM
try {
getResourceDeployer(resource).deployResource(resource, applicationName, moduleName);
} catch (Exception e) {
Object[] params = { ResourceUtil.getGenericResourceInfo(resource), e };
_logger.log(Level.WARNING, "resources.resource-manager.deploy-resource-failed", params);
}
}
}
addListenerToResources(resources);
}
}
use of com.sun.enterprise.config.serverbeans.Module in project Payara by payara.
the class WebModuleConfigCommand method engine.
protected Engine engine(final ActionReport report) {
Module module = module(report);
if (module == null) {
return null;
}
Engine e = module.getEngine(WEB_SNIFFER_TYPE);
if (e == null) {
fail(report, "noSuchEngine", "Application {0}/module {1} does not contain engine {2}", appName(), moduleName(), WEB_SNIFFER_TYPE);
}
return e;
}
Aggregations