Methods Summary |
---|
public void | addWebModule(com.sun.enterprise.config.serverbeans.WebModule wm)Adds the given WebModule to the list of monitorable entries for
dynamic reloading.
if (wm != null && isEnabled(wm.getConfigContext(), wm.getName())) {
String name = wm.getName();
String id = name + "[" + _id + "]";
String fileName = getReloadFilename(wm);
MonitorableEntry entry = new MonitorableEntry(id, name,
new File(fileName),
this);
_reloadables.add(id);
reloadMonitor.addMonitorableEntry(entry);
}
|
public void | addWebModules(com.sun.enterprise.config.serverbeans.WebModule[] modules)Adds the given WebModule instances to the list of monitorable entries
for dynamic reloading.
if (modules != null && modules.length > 0) {
for (int i = 0; i < modules.length; i++) {
addWebModule(modules[i]);
}
}
|
public boolean | deploy(MonitorableEntry entry, java.io.File archive)Callback from the auto deploy monitor when a new archive is detected.
// auto-deploy has not been implemented in S1AS7
return false;
|
private java.lang.String | getReloadFilename(com.sun.enterprise.config.serverbeans.WebModule wm)Returns the absolute pathname to the .reload file in the
specified web module's directory.
String path = wm.getLocation();
File dir = new File(path);
if (!dir.isAbsolute())
path = _modulesRoot + "/" + path;
return path + "/" + ReloadMonitor.RELOAD_FILE;
|
protected boolean | isEnabled(com.sun.enterprise.config.ConfigContext config, java.lang.String moduleName)Whether or not a component (either an application or a module) should be
enabled is defined by the "enable" attribute on both the
application/module element and the application-ref element.
try {
if (config == null) {
config = AdminService.getAdminService().getAdminContext().getAdminConfigContext();
}
ConfigBean app = ApplicationHelper.findApplication(config,
moduleName);
Server server = ServerBeansFactory.getServerBean(config);
ApplicationRef appRef = server.getApplicationRefByRef(moduleName);
return ((app != null && app.isEnabled()) &&
(appRef != null && appRef.isEnabled()));
} catch (ConfigException e) {
_logger.log(Level.FINE, "Error in finding " + moduleName, e);
//If there is anything wrong, do not enable the module
return false;
}
|
public boolean | reload(MonitorableEntry entry)Callback from the reload monitor thread for a web module.
This is done when the user updates the $MODULE_ROOT/$MODULE/.reload
file indicating the server runtime for a dynamic reload.
// The actual reload is done by the NSAPI reconfiguration logic which
// the reload monitor thread invokes (at the end), so simply return
// true here.
InstanceEnvironment ienv = ApplicationServer.getServerContext().getInstanceEnvironment();
//4926513 work-around --- use displayname
// for "foo", the id will be "foo[0]"
//String moduleName = entry.getId();
String moduleName = entry.getDisplayName();
boolean status = false;
try {
DeploymentRequest req = new DeploymentRequest(ienv, DeployableObjectType.WEB, DeploymentCommand.DEPLOY);
// monitored file points to $APP_ROOT/.reload
req.setFileSource(entry.getMonitoredFile().getParentFile());
// application registration name
req.setName(moduleName);
// we are always trying a redeployment
req.setForced(true);
AutoDirReDeployer deployer = new AutoDirReDeployer(req);
status = deployer.redeploy();
} catch (IASDeploymentException de) {
_logger.log(Level.WARNING,"core.error_in_reload_war_module",de);
return false;
}
return status;
|
public void | start(long pollInterval)Enable dynamic reloading (via the .reload file) for all the
standalone web-modules that are marked as enabled
This method is invoked be WebContainer.start() only when
dynamic reloading has been enabled in server.xml.
// --------------------------------------------------------- Public Methods
reloadMonitor = ReloadMonitor.getInstance(pollInterval * 1000);
|
public void | stop()Remove the modules (that were previously registered by start()) from
the reload monitor thread.
This method is invoked be WebContainer.stop() only when
dynamic reloading has been enabled in server.xml.
ReloadMonitor reloadMonitor = ReloadMonitor.getInstance(1);
for (int i = 0; i < _reloadables.size(); i++) {
String id = (String) _reloadables.get(i);
reloadMonitor.removeMonitoredEntry(id);
}
_reloadables.clear();
_reloadables = null;
|