Methods Summary |
---|
public void | disable()Disables this application. The application should be enabled to begin
with. There will
be some time elapsed till the application is disabled. This method
will return asynchronously. This is to exhibit the quiece capabilities.
return; //FIXME: for RI only
/* try
{
this.setAttribute(new Attribute(kEnabled, new Boolean(false)));
super.getConfigContext().flush();
}
catch (Exception e)
{
sLogger.throwing(getClass().getName(), "disable", e);
throw new J2EEApplicationException(e.getMessage());
}
*/
|
public void | enable()Enables this application. The application should be disabled to begin
with. There will
be some time elapsed till the application is enabled. This method
will return asynchronously.
return; //FIXME: for RI only
/* try
{
this.setAttribute(new Attribute(kEnabled, new Boolean(true)));
super.getConfigContext().flush();
}
catch (Exception e)
{
sLogger.throwing(getClass().getName(), "enable", e);
throw new J2EEApplicationException(e.getMessage());
}
*/
|
public java.lang.String[] | getEjbModules()
return getModulesByType(ModulesXMLHelper.MODULE_TYPE_EJB);
|
public java.lang.String[] | getModules()
return getModulesByType(ModulesXMLHelper.MODULE_TYPE_ALL);
|
private java.lang.String[] | getModulesByType(int moduleTypes)
try
{
String location = (String)this.getAttribute(kLocation);
return ModulesXMLHelper.getModulesFromApplicationLocation(location, moduleTypes);
}
catch (Exception e)
{
sLogger.throwing(getClass().getName(), "getModulesByType", e);
throw new J2EEApplicationException(e.getMessage());
}
|
public java.lang.Integer | getState()Gets the jsr77 state corresponding to this module
try {
ServerContext serverContext = ApplicationServer.getServerContext();
String namePattern = (
serverContext.getDefaultDomainName() + ":" +
"j2eeType=J2EEApplication," +
"name=" + ((String)this.getAttribute(kName)) + "," +
"J2EEServer=" + serverContext.getInstanceName() + "," +
"*");
Integer intObj = (Integer)
Switch.getSwitch().getManagementObjectManager().getState(namePattern);
return intObj;
} catch (Exception e) {
sLogger.throwing(getClass().getName(), "getState", e);
throw new J2EEApplicationException(e.getMessage());
}
|
public com.sun.enterprise.admin.common.EntityStatus | getStatus()Returns the Status of this Application.
EntityStatus status = null;
try
{
boolean isAppEnabled = true; //FIXME for RI only
// boolean isAppEnabled = ((Boolean)this.getAttribute(kEnabled)).booleanValue();
status = new EntityStatus();
if (isAppEnabled)
{
status.setEnabled();
}
else
{
status.setDisabled();
}
}
catch (Exception e)
{
sLogger.throwing(getClass().getName(), "getStatus", e);
throw new J2EEApplicationException(e.getMessage());
}
return status;
|
public java.lang.String[] | getWebModules()
return getModulesByType(ModulesXMLHelper.MODULE_TYPE_WEB);
|
public static final void | main(java.lang.String[] args)
System.setProperty("com.sun.aas.instanceRoot", "e:\\tmp");
ManagedJ2EEApplication appMBean =
new ManagedJ2EEApplication("adminapp", "admserv");
EntityStatus status = appMBean.getStatus();
sLogger.info("======== Status = " + status.getStatusString());
if (status.isDisabled())
{
sLogger.info("======== Enabling app");
appMBean.enable();
status = appMBean.getStatus();
sLogger.info("======== Status = " + status.getStatusString());
}
else
{
sLogger.info("======== Disabling app");
appMBean.disable();
status = appMBean.getStatus();
sLogger.info("======== Status = " + status.getStatusString());
}
|
private void | multicastAdminEvent(java.lang.String entityName, java.lang.String actionCode)Multicasts the admin event so that the application gets loaded
dynamically without the need for reconfig.
String instanceName = super.getServerInstanceName();
InstanceEnvironment instEnv = new InstanceEnvironment(instanceName);
try {
instEnv.applyServerXmlChanges(false);
} catch (Exception e) {
sLogger.throwing(getClass().getName(), "getAttr", e);
throw new J2EEApplicationException(e.getMessage());
}
AdminEvent event = new ApplicationDeployEvent(instanceName, entityName, actionCode);
//AdminEventCache.populateConfigChange(super.getConfigContext(), event);
RMIClient serverInstancePinger = AdminChannel.getRMIClient(instanceName);
if (serverInstancePinger.getInstanceStatusCode() != Status.kInstanceRunningCode) {
return;
}
AdminEventResult multicastResult = AdminEventMulticaster.multicastEvent(event);
if (!AdminEventResult.SUCCESS.equals(multicastResult.getResultCode())) {
AdminEventCache cache = AdminEventCache.getInstance(instanceName);
cache.setRestartNeeded(true);
}
|
public void | start()Enables the application. Difference between this method
and enable is persistence of the state. Enable method persists
the state and this method does not persist the state.
try {
String appName = (String)this.getAttribute(kName);
multicastAdminEvent(appName, BaseDeployEvent.ENABLE);
} catch (Exception e) {
sLogger.throwing(getClass().getName(), "start", e);
throw new J2EEApplicationException(e.getMessage());
}
|
public void | stop()Disables the application. Difference between this method
and disable is persistence of the state. Disable method persists
the state and this method does not persist the state.
try {
String appName = (String)this.getAttribute(kName);
multicastAdminEvent(appName, BaseDeployEvent.DISABLE);
} catch (Exception e) {
sLogger.throwing(getClass().getName(), "stop", e);
throw new J2EEApplicationException(e.getMessage());
}
|