org.objectweb.jonas.management.j2eemanagement
Class J2EEDomain

java.lang.Object
  extended byjavax.management.NotificationBroadcasterSupport
      extended byorg.objectweb.jonas.management.ReconfigDispatcher
          extended byorg.objectweb.jonas.management.j2eemanagement.J2EEManagedObject
              extended byorg.objectweb.jonas.management.j2eemanagement.J2EEDomain
All Implemented Interfaces:
java.util.EventListener, javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, javax.management.NotificationListener, ReconfigDispatcherMBean

public class J2EEDomain
extends J2EEManagedObject
implements javax.management.MBeanRegistration, javax.management.NotificationListener

Implements a managed object which represents a management domain. Domain management information is present in two data structures: myServers and managedServersToUrls. The first one containes the OBJECT_NAMEs of the J2EEServers the domain is supposed to contain, and the second containes the JMX Connector URLs each server provides for management. Both are updated by addServer() and removeServer() methods.

Author:
Adriana Danes, Vivek Lakshmanan

Field Summary
 
Fields inherited from class org.objectweb.jonas.management.j2eemanagement.J2EEManagedObject
J2EE_TYPE_APPLICATION, J2EE_TYPE_SERVER, NAME
 
Fields inherited from class org.objectweb.jonas.management.ReconfigDispatcher
RECONFIG_TYPE, SAVE_RECONFIG_TYPE
 
Constructor Summary
J2EEDomain(java.lang.String objectName, boolean stateManageable, boolean statisticsProvider, boolean eventProvider)
          MBean constructor
 
Method Summary
 void addServer(java.lang.String serverOn, java.lang.String[] connectorServerURLs)
           
 void addServer(java.lang.String serverOn, java.lang.String[] connectorServerURLs, boolean handleNotification)
          Add an OBJECT_NAME to the servers list.
 boolean deployEar(java.lang.String[] target, java.lang.String fileName)
          Deploy a EAR module on a target if no other deployment operation is executing.
 boolean deployJar(java.lang.String[] target, java.lang.String fileName)
          Deploy a JAR module on a target if no other deployment operation is executing.
 boolean deployRar(java.lang.String[] target, java.lang.String fileName)
          Deploy a RAR module on a target if no other deployment operation is executing.
 boolean deployWar(java.lang.String[] target, java.lang.String fileName)
          Deploy a WAR module on a target if no other deployment operation is executing.
 java.lang.String[] getConnectorServerURLs(java.lang.String serverName)
          Return the connector server urls for a given server.
 java.lang.String getGlobalErrorReport()
           
 JmxService getJmxService()
           
 java.lang.String getProgress()
           
 java.util.HashMap getProgressReport()
           
 java.lang.String[] getServerNames()
          Returns the names of the servers currently managed.
 java.lang.String[] getServers()
          Return the MBeans OBJECT_NAMEs of the servers running in this domain.
 void handleNotification(javax.management.Notification notification, java.lang.Object handback)
           
 void postDeregister()
           
 void postRegister(java.lang.Boolean registrationDone)
          Add J2EEDomain MBean (myself) as listener to registration/unregistration notifications of JOnAS management MBeans.
 void preDeregister()
           
 javax.management.ObjectName preRegister(javax.management.MBeanServer server, javax.management.ObjectName name)
           
 java.lang.String removeServer(java.lang.String serverOn)
          Remove an object name from the servers list.
 void resetProgress()
          Set progress to null
 void setGlobalErrorReport(java.lang.String globalErrorReport)
           
 void setJmxService(JmxService jmxService)
           
 void setProgressReport(java.util.HashMap report)
           
 boolean unDeployEar(java.lang.String[] target, java.lang.String fileName)
          Un-deploy a EAR module on a target if no other deployment operation is executing.
 boolean unDeployJar(java.lang.String[] target, java.lang.String fileName)
          Un-deploy a JAR module on a target if no other deployment operation is executing.
 boolean unDeployRar(java.lang.String[] target, java.lang.String fileName)
          Un-deploy a RAR module on a target if no other deployment operation is executing.
 boolean unDeployWar(java.lang.String[] target, java.lang.String fileName)
          Un-deploy a WAR module on a target if no other deployment operation is executing.
 boolean uploadDeployEar(java.lang.String[] target, java.lang.String fileName, boolean replaceExisting)
          Upload an EAR modlue to all targets and deploy the new module.
 boolean uploadDeployJar(java.lang.String[] target, java.lang.String fileName, boolean replaceExisting)
          Upload an JAR modlue to all targets and deploy the new module.
 boolean uploadDeployRar(java.lang.String[] target, java.lang.String fileName, boolean replaceExisting)
          Upload an RAR modlue to all targets and deploy the new module.
 boolean uploadDeployWar(java.lang.String[] target, java.lang.String fileName, boolean replaceExisting)
          Upload an WAR modlue to all targets and deploy the new module.
 boolean uploadFile(java.lang.String[] target, java.lang.String fileName, boolean replaceExisting)
          Upload a module to each of the target servers.
 
Methods inherited from class org.objectweb.jonas.management.j2eemanagement.J2EEManagedObject
getObjectName, isEventProvider, isStateManageable, isStatisticsProvider
 
Methods inherited from class org.objectweb.jonas.management.ReconfigDispatcher
addNotificationListener, getFilter, getHandback, getListener, getNotificationInfo, initLogger, removeNotificationListener, sendReconfigNotification, sendSaveNotification
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
handleNotification, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

J2EEDomain

public J2EEDomain(java.lang.String objectName,
                  boolean stateManageable,
                  boolean statisticsProvider,
                  boolean eventProvider)
           throws javax.management.JMException
MBean constructor

Parameters:
objectName - object name of the managed object
stateManageable - if true, this managed object implements J2EE State Management Model
statisticsProvider - if true, this managed object implements the J2EE StatisticProvide Model
eventProvider - if true, this managed object implements the J2EE EventProvider Model
Throws:
javax.management.JMException - ..
Method Detail

getServers

public java.lang.String[] getServers()
Return the MBeans OBJECT_NAMEs of the servers running in this domain. Convert myServers ArrayList of OBJECT_NAMEs to an array of Strings of OBJECT_NAMEs

Returns:
The list of object names corresponding to the servers associated with this domain

getServerNames

public java.lang.String[] getServerNames()
Returns the names of the servers currently managed.

Returns:
Names of servers currently managed.

getConnectorServerURLs

public java.lang.String[] getConnectorServerURLs(java.lang.String serverName)
Return the connector server urls for a given server.

Parameters:
serverName - the server we are inquiring for
Returns:
The list of connector server urls corresponding to the given server

addServer

public void addServer(java.lang.String serverOn,
                      java.lang.String[] connectorServerURLs,
                      boolean handleNotification)
               throws javax.management.MalformedObjectNameException,
                      java.lang.Exception
Add an OBJECT_NAME to the servers list. If this method is not called by a handleNotification, then this method uses the Enroller MBean to send a discovery notification towards the JMX service in order to create a connection.

Parameters:
serverOn - ObjectName (String form) of a J2EEServer to be add in this domain
connectorServerURLs - connector server urls for this server
handleNotification - true if the method is called by a handleNotification method, false otherwise
Throws:
javax.management.MalformedObjectNameException
java.lang.Exception

addServer

public void addServer(java.lang.String serverOn,
                      java.lang.String[] connectorServerURLs)
               throws javax.management.MalformedObjectNameException,
                      java.lang.Exception
Throws:
javax.management.MalformedObjectNameException
java.lang.Exception

removeServer

public java.lang.String removeServer(java.lang.String serverOn)
Remove an object name from the servers list.

Parameters:
serverOn - ObjectName (String form) of a J2EEServer to be removed from this domain
Returns:
Object name of the removed J2EEServer

preRegister

public javax.management.ObjectName preRegister(javax.management.MBeanServer server,
                                               javax.management.ObjectName name)
                                        throws java.lang.Exception
Specified by:
preRegister in interface javax.management.MBeanRegistration
Parameters:
server - The MBean server in which the MBean will be registered.
name - The object name of the MBean
Returns:
The object name of the MBean
Throws:
java.lang.Exception

postRegister

public void postRegister(java.lang.Boolean registrationDone)
Add J2EEDomain MBean (myself) as listener to registration/unregistration notifications of JOnAS management MBeans.

Specified by:
postRegister in interface javax.management.MBeanRegistration
Parameters:
registrationDone - Indicates whether or not the MBean has been successfully registered

preDeregister

public void preDeregister()
                   throws java.lang.Exception
Specified by:
preDeregister in interface javax.management.MBeanRegistration
Throws:
java.lang.Exception
See Also:
MBeanRegistration.preDeregister()

postDeregister

public void postDeregister()
Specified by:
postDeregister in interface javax.management.MBeanRegistration
See Also:
MBeanRegistration.postDeregister()

handleNotification

public void handleNotification(javax.management.Notification notification,
                               java.lang.Object handback)
Specified by:
handleNotification in interface javax.management.NotificationListener
Parameters:
notification - received notification
handback - received handback

getProgress

public java.lang.String getProgress()
Returns:
Returns the progress value.

resetProgress

public void resetProgress()
Set progress to null


deployJar

public boolean deployJar(java.lang.String[] target,
                         java.lang.String fileName)
Deploy a JAR module on a target if no other deployment operation is executing.

Parameters:
target - The OBJECT_NAMES of the J2EEServers composing the target
fileName - file containing the module (installed on each target)
Returns:
true if the operation was executed, false if the operation was rejected

unDeployJar

public boolean unDeployJar(java.lang.String[] target,
                           java.lang.String fileName)
Un-deploy a JAR module on a target if no other deployment operation is executing.

Parameters:
target - The OBJECT_NAMES of the J2EEServers composing the target
fileName - file containing the module
Returns:
true if the operation was executed, false if the operation was rejected

deployWar

public boolean deployWar(java.lang.String[] target,
                         java.lang.String fileName)
Deploy a WAR module on a target if no other deployment operation is executing.

Parameters:
target - The OBJECT_NAMES of the J2EEServers composing the target
fileName - file containing the module (installed on each target)
Returns:
true if the operation was executed, false if the operation was rejected

unDeployWar

public boolean unDeployWar(java.lang.String[] target,
                           java.lang.String fileName)
Un-deploy a WAR module on a target if no other deployment operation is executing.

Parameters:
target - The OBJECT_NAMES of the J2EEServers composing the target
fileName - file containing the module
Returns:
true if the operation was executed, false if the operation was rejected

deployRar

public boolean deployRar(java.lang.String[] target,
                         java.lang.String fileName)
Deploy a RAR module on a target if no other deployment operation is executing.

Parameters:
target - The OBJECT_NAMES of the J2EEServers composing the target
fileName - file containing the module (installed on each target)
Returns:
true if the operation was executed, false if the operation was rejected

unDeployRar

public boolean unDeployRar(java.lang.String[] target,
                           java.lang.String fileName)
Un-deploy a RAR module on a target if no other deployment operation is executing.

Parameters:
target - The OBJECT_NAMES of the J2EEServers composing the target
fileName - file containing the module
Returns:
true if the operation was executed, false if the operation was rejected

deployEar

public boolean deployEar(java.lang.String[] target,
                         java.lang.String fileName)
Deploy a EAR module on a target if no other deployment operation is executing.

Parameters:
target - The OBJECT_NAMES of the J2EEServers composing the target
fileName - file containing the module (installed on each target)
Returns:
true if the operation was executed, false if the operation was rejected

unDeployEar

public boolean unDeployEar(java.lang.String[] target,
                           java.lang.String fileName)
Un-deploy a EAR module on a target if no other deployment operation is executing.

Parameters:
target - The OBJECT_NAMES of the J2EEServers composing the target
fileName - file containing the module
Returns:
true if the operation was executed, false if the operation was rejected

uploadDeployEar

public boolean uploadDeployEar(java.lang.String[] target,
                               java.lang.String fileName,
                               boolean replaceExisting)
Upload an EAR modlue to all targets and deploy the new module.

Parameters:
target - a list target servers
fileName - file containing the module
replaceExisting - should a file with the same name on the target server be overwritten
Returns:
true if the operation was executed, false if the operation was rejected

uploadDeployWar

public boolean uploadDeployWar(java.lang.String[] target,
                               java.lang.String fileName,
                               boolean replaceExisting)
Upload an WAR modlue to all targets and deploy the new module.

Parameters:
target - a list target servers
fileName - file containing the module
replaceExisting - should a file with the same name on the target server be overwritten
Returns:
true if the operation was executed, false if the operation was rejected

uploadDeployJar

public boolean uploadDeployJar(java.lang.String[] target,
                               java.lang.String fileName,
                               boolean replaceExisting)
Upload an JAR modlue to all targets and deploy the new module.

Parameters:
target - a list target servers
fileName - file containing the module
replaceExisting - should a file with the same name on the target server be overwritten
Returns:
true if the operation was executed, false if the operation was rejected

uploadDeployRar

public boolean uploadDeployRar(java.lang.String[] target,
                               java.lang.String fileName,
                               boolean replaceExisting)
Upload an RAR modlue to all targets and deploy the new module.

Parameters:
target - a list target servers
fileName - file containing the module
replaceExisting - should a file with the same name on the target server be overwritten
Returns:
true if the operation was executed, false if the operation was rejected

uploadFile

public boolean uploadFile(java.lang.String[] target,
                          java.lang.String fileName,
                          boolean replaceExisting)
Upload a module to each of the target servers.

Parameters:
target - a list of the target servers
fileName - file containing the module
replaceExisting - should a file with the same name on the target server be overwritten
Returns:
true if the operation was executed, false if the operation was rejected

getJmxService

public JmxService getJmxService()
Returns:
Returns the jmxService.

setJmxService

public void setJmxService(JmxService jmxService)
Parameters:
jmxService - The jmxService to set.

getProgressReport

public java.util.HashMap getProgressReport()
Returns:
Returns the report.

setProgressReport

public void setProgressReport(java.util.HashMap report)
Parameters:
report - The report to set.

getGlobalErrorReport

public java.lang.String getGlobalErrorReport()
Returns:
Returns the globalErrorReport.

setGlobalErrorReport

public void setGlobalErrorReport(java.lang.String globalErrorReport)
Parameters:
globalErrorReport - The globalErrorReport to set.