use of com.sun.enterprise.config.serverbeans.Module in project Payara by payara.
the class InstallerThread method install.
/**
* <p> Install the admingui.war file.</p>
*/
private void install() throws Exception {
if (domain.getSystemApplicationReferencedFrom(env.getInstanceName(), AdminConsoleAdapter.ADMIN_APP_NAME) != null) {
// Application is already installed
adapter.setStateMsg(AdapterState.APPLICATION_INSTALLED_BUT_NOT_LOADED);
return;
}
// Set the adapter state
adapter.setStateMsg(AdapterState.INSTALLING);
if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "Installing the Admin Console Application...");
}
// create the application entry in domain.xml
ConfigCode code = new ConfigCode() {
@Override
public Object run(ConfigBeanProxy... proxies) throws PropertyVetoException, TransactionFailure {
SystemApplications sa = (SystemApplications) proxies[0];
Application app = sa.createChild(Application.class);
sa.getModules().add(app);
app.setName(AdminConsoleAdapter.ADMIN_APP_NAME);
app.setEnabled(Boolean.TRUE.toString());
// TODO
app.setObjectType("system-admin");
app.setDirectoryDeployed("true");
app.setContextRoot(contextRoot);
try {
app.setLocation("${com.sun.aas.installRootURI}/lib/install/applications/" + AdminConsoleAdapter.ADMIN_APP_NAME);
} catch (Exception me) {
// can't do anything
throw new RuntimeException(me);
}
Module singleModule = app.createChild(Module.class);
app.getModule().add(singleModule);
singleModule.setName(app.getName());
Engine webe = singleModule.createChild(Engine.class);
webe.setSniffer("web");
Engine sece = singleModule.createChild(Engine.class);
sece.setSniffer("security");
singleModule.getEngines().add(webe);
singleModule.getEngines().add(sece);
Server s = (Server) proxies[1];
List<ApplicationRef> arefs = s.getApplicationRef();
ApplicationRef aref = s.createChild(ApplicationRef.class);
aref.setRef(app.getName());
aref.setEnabled(Boolean.TRUE.toString());
// TODO
aref.setVirtualServers(getVirtualServerList());
arefs.add(aref);
return true;
}
};
Server server = domain.getServerNamed(env.getInstanceName());
ConfigSupport.apply(code, domain.getSystemApplications(), server);
// Set the adapter state
adapter.setStateMsg(AdapterState.APPLICATION_INSTALLED_BUT_NOT_LOADED);
if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "Admin Console Application Installed.");
}
}
use of com.sun.enterprise.config.serverbeans.Module in project Payara by payara.
the class ConnectorRuntime method getResources.
public Resources getResources(ResourceInfo resourceInfo) {
if (ConnectorsUtil.isModuleScopedResource(resourceInfo)) {
Application application = getApplications().getApplication(resourceInfo.getApplicationName());
Module module = application.getModule(resourceInfo.getModuleName());
return module.getResources();
} else if (ConnectorsUtil.isApplicationScopedResource(resourceInfo)) {
Application application = getApplications().getApplication(resourceInfo.getApplicationName());
return application.getResources();
}
return getResources();
}
use of com.sun.enterprise.config.serverbeans.Module in project Payara by payara.
the class ConnectorRuntime method getWorkSecurityMap.
/**
* {@inheritDoc}
*/
public List<WorkSecurityMap> getWorkSecurityMap(String raName) {
List<WorkSecurityMap> workSecurityMap = ConnectorsUtil.getWorkSecurityMaps(raName, getResources());
List<WorkSecurityMap> appScopedMap = null;
String appName = raName;
if (!ConnectorsUtil.isStandAloneRA(raName)) {
appName = ConnectorsUtil.getApplicationNameOfEmbeddedRar(raName);
Application application = getApplications().getApplication(appName);
if (application != null) {
// embedded RAR
String resourceAdapterName = ConnectorsUtil.getRarNameFromApplication(raName);
Module module = application.getModule(resourceAdapterName);
if (module != null) {
Resources msr = module.getResources();
if (msr != null) {
appScopedMap = ConnectorsUtil.getWorkSecurityMaps(raName, msr);
}
}
}
} else {
Application app = getApplications().getApplication(appName);
if (app != null) {
Resources asc = app.getResources();
if (asc != null) {
appScopedMap = ConnectorsUtil.getWorkSecurityMaps(raName, asc);
}
}
}
if (appScopedMap != null) {
workSecurityMap.addAll(appScopedMap);
}
return workSecurityMap;
}
use of com.sun.enterprise.config.serverbeans.Module in project Payara by payara.
the class JdbcRecoveryResourceHandler method getAllJdbcResources.
private Collection<JdbcResource> getAllJdbcResources() {
Collection<JdbcResource> allResources = new ArrayList<JdbcResource>();
Collection<JdbcResource> jdbcResources = domain.getResources().getResources(JdbcResource.class);
allResources.addAll(jdbcResources);
for (Application app : applications.getApplications()) {
if (ResourcesUtil.createInstance().isEnabled(app)) {
Resources appScopedResources = app.getResources();
if (appScopedResources != null && appScopedResources.getResources() != null) {
allResources.addAll(appScopedResources.getResources(JdbcResource.class));
}
List<Module> modules = app.getModule();
if (modules != null) {
for (Module module : modules) {
Resources msr = module.getResources();
if (msr != null && msr.getResources() != null) {
allResources.addAll(msr.getResources(JdbcResource.class));
}
}
}
}
}
return allResources;
}
use of com.sun.enterprise.config.serverbeans.Module in project Payara by payara.
the class AbstractConnectorResourceDeployer method validatePreservedResource.
/**
* {@inheritDoc}
*/
public void validatePreservedResource(Application oldApp, Application newApp, Resource resource, Resources allResources) throws ResourceConflictException {
// check whether old app has any RAR
List<Module> oldRARModules = new ArrayList<Module>();
List<Module> oldModules = oldApp.getModule();
for (Module oldModule : oldModules) {
if (oldModule.getEngine(ConnectorConstants.CONNECTOR_MODULE) != null) {
oldRARModules.add(oldModule);
}
}
/*
//check whether new app has any RAR
//TODO ASR : <sniffer> info is not available during initial phase of deployment. Hence doing "module-name" check.
List<Module> newRARModules = new ArrayList<Module>();
List<Module> newModules = newApp.getModule();
for (Module newModule : newModules) {
if (newModule.getEngine(ResourceConstants.CONNECTOR_MODULE) != null) {
newRARModules.add(newModule);
}
}
*/
List<Module> newRARModules = newApp.getModule();
// check whether all old RARs are present in new RARs list.
List<Module> staleRars = new ArrayList<Module>();
for (Module oldRARModule : oldRARModules) {
String oldRARModuleName = oldRARModule.getName();
boolean found = false;
for (Module newRARModule : newRARModules) {
String newRARModuleName = newRARModule.getName();
if (newRARModuleName.equals(oldRARModuleName)) {
found = true;
}
}
if (!found) {
staleRars.add(oldRARModule);
}
}
String appName = newApp.getName();
if (staleRars.size() > 0) {
validateResourcesForStaleReference(appName, staleRars, allResources);
}
}
Aggregations