Methods Summary |
---|
private void | deploySystemApps()Deploys all system apps under system directory to all
server instances under in domain.xml. There
are three categories in system apps, applicable to admin
instance only, applicable to instances only, applicable to all.
//FIXME: deploying system apps shoudl be done using J2EEC when it is available.
try{
String[] targets = getTargets();
if(targets == null) return;
int size = targets.length;
for(int i = 0; i < size; i++) {
deployToTarget(targets[i]);
}
}catch(Exception ex){
_logger.log(Level.SEVERE,
"core.exception_while_deploying_system_apps", ex);
}
|
private void | deployToTarget(java.lang.String target)Deploys the system apps under system_app_dir to a specific target.
Target here is a single server
String sysAppDirPath = getSystemAppDirPath();
_logger.log(Level.FINE,"core.deploying_system_apps", new Object[]{target, sysAppDirPath});
com.sun.enterprise.deployment.autodeploy.AutoDeployer deployer =
new com.sun.enterprise.deployment.autodeploy.AutoDeployer();
deployer.setTarget(target);
deployer.setDirectoryScanner(new SystemAppScanner(getTargetType(target)));
deployer.disableRenameOnSuccess();
File sysAppDir = new File(sysAppDirPath);
try{
if(sysAppDir.exists() && sysAppDir.canRead()) {
deployer.deployAll(sysAppDir);
_logger.log(Level.FINE,"core.deployed_system_apps",target);
} else {
_logger.log(Level.WARNING, "core.system_app_dir_not_found", new Object[] {sysAppDirPath});
}
}catch(AutoDeploymentException ade) {
_logger.log(Level.SEVERE,
"core.exception_while_deploying_system_apps", ade);
}
|
private java.lang.String | getSystemAppDirPath()
String sysAppDirPath = System.getProperty(Constants.INSTALL_ROOT) + File.separator
+ Constants.LIB + File.separator + Constants.LIB_INSTALL + File.separator + Constants.LIB_INSTALL_APPLICATIONS;
return sysAppDirPath;
|
private java.lang.String | getTargetType(java.lang.String targetName)
/*
if(targetName.equalsIgnoreCase(ServerManager.ADMINSERVER_ID))
return Constants.TARGET_TYPE_ADMIN;
else
return Constants.TARGET_TYPE_INSTANCE;
*/
/**
* commented the above code since it doesn't return the
* target type properly. In case of DAS since the instance name is
* server it returns the type as instance
*
* Following code uses the isDAS of ServerHelper to determine
* if the target type is admin or not
*/
try{
if (ServerHelper.isDAS(_context.getConfigContext(), targetName)) {
return Constants.TARGET_TYPE_ADMIN;
} else {
return Constants.TARGET_TYPE_INSTANCE;
}
}catch(Exception ex){
_logger.log(Level.SEVERE, "core.exception_while_getting_targetType", ex);
}
return null;
|
private java.lang.String[] | getTargets()
try{
ConfigContext confContext = _context.getConfigContext();
Domain domain = (Domain)confContext.getRootConfigBean();
Servers svrs = domain.getServers();
Server[] svrArr = svrs.getServer();
int size = svrArr.length;
String[] targetNames = new String[size];
for(int i = 0 ; i< size; i++) {
targetNames[i] = svrArr[i].getName();
}
return targetNames;
}catch(Exception ex){
_logger.log(Level.SEVERE,
"core.exception_while_getting_targets", ex);
return null;
}
|
private void | loadSystemApps()Loads all the deployed system applications.
_logger.log(Level.FINE, "core.loading_system_apps");
// loads all deployed connector modules
this._connMgr.loadSystem();
// loads all deployed stand alone ejb modules
this._ejbMgr.loadSystem();
// loads all deployed j2ee applications
this._applicationMgr.loadSystem();
|
public void | onReady(com.sun.enterprise.server.ServerContext sc)Server has complted loading the system applications
// not required to notify listeners(ejb containers) as this will be done by ALC
|
public void | onShutdown()Server is shutting down applications
//not required
|
public void | onStartup(com.sun.enterprise.server.ServerContext sc)Server is starting up applications
try {
//deploys any new system apps
deploySystemApps();
loadSystemApps();
} catch (Throwable th) {
_logger.log(Level.SEVERE,
"core.unexpected_error_occured_while_app_loading", th);
}
|
public void | onTermination()Server is terminating the subsystems and the runtime environment.
Gracefully terminate the active use of the public methods of this
subsystem. This method should be the last one called on a given
instance of this subsystem.
//not required
|
public void | startup(com.sun.enterprise.server.ServerContext sc)Right now this lifecycle is not registered as a lifecycle.
This method will be explicitly called from J2EE Server.
This method will call two lifecycle methods: onInit and onStartup.
OnShutdown and onTermination need not be called as the required
task will be done ALC for now. This is a mockup startup method
which will take care of lifecycle methods till onStartup
onInitialization(sc);
onStartup(sc);
|