org.objectweb.jonas.management.j2eemanagement
Class J2EEDomain

java.lang.Object
  extended by javax.management.NotificationBroadcasterSupport
      extended by org.objectweb.jonas.management.ReconfigDispatcher
          extended by org.objectweb.jonas.management.j2eemanagement.J2EEManagedObject
              extended by org.objectweb.jonas.management.j2eemanagement.J2EEDomain
All Implemented Interfaces:
javax.management.MBeanRegistration, javax.management.NotificationBroadcaster, javax.management.NotificationEmitter, ReconfigDispatcherMBean

public class J2EEDomain
extends J2EEManagedObject
implements javax.management.MBeanRegistration

Implements a managed object which represents either a management domain or a cluster. This J2EEManagedObject is accessed mainly by jonasAdmin. The complete interface is described in the following xml file :

Author:
Adriana Danes, Vivek Lakshmanan, S. Ali Tokmen

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)
          MBean constructor
 
Method Summary
 void addLocalServer(J2EEServer j2eeserver)
          Add the local J2EEServer to the 'servers' list.
 void addServer(java.lang.String serverName, java.lang.String clusterName, java.lang.String clusterDaemonName, java.lang.String[] urls)
          Deprecated. addServer(String, String, String, String[], String, String)
 void addServer(java.lang.String serverName, java.lang.String clusterName, java.lang.String clusterDaemonName, java.lang.String[] urls, java.lang.String username, java.lang.String password)
           
 java.lang.String createCluster(java.lang.String name)
          Create a logical cluster (by jonasAdmin)
 void deployEar(java.lang.String[] target, java.lang.String fileName)
          Deploy a EAR file on a multiple management target composed of servers and/or clusters
 void deployJar(java.lang.String[] target, java.lang.String fileName)
          Deploy a JAR file on a multiple management target composed of servers and/or clusters
 void deployRar(java.lang.String[] target, java.lang.String fileName)
          Deploy a RAR file on a multiple management target composed of servers and/or clusters
 void deployWar(java.lang.String[] target, java.lang.String fileName)
          Deploy a WAR file on a multiple management target composed of servers and/or clusters
 BaseCluster findCluster(java.lang.String name)
          Get a Cluster by its name
 J2EEServer findServer(java.lang.String name)
          Get a Server by its name
 ServerProxy findServerProxy(java.lang.String name)
          Get a Server by its name
 java.lang.String[] getClusterDaemons()
           
 java.lang.String[] getClusters()
          Return the MBeans OBJECT_NAMEs of the clusters in this domain
 javax.management.MBeanServerConnection getConnection(java.lang.String serverName)
           
 java.lang.String[] getConnectorServerURLs(java.lang.String serverName)
          Return connector server urls for a given JOnAS server
 java.lang.String getDescription()
           
 DomainMonitor getDomainMonitor()
          Get the domainMonitor, or null if slave server.
static J2EEDomain getInstance()
          Singleton: Each server (master or slave) must have 1 unique J2EEDomain object.
 java.lang.String getMyName()
          Return the domain name
 java.lang.String[] getServerNames()
          Return the servers' name belonging domain
 java.lang.String[] getServerNames(java.lang.String clusterName)
           
 java.lang.String[] getServers()
          Return the MBeans OBJECT_NAMEs of the servers belonging to this domain
 java.lang.String[] getStartedServers()
          Return the MBeans OBJECT_NAMEs of the servers belonging to this domain but only if they are running.
 boolean isMaster()
           
 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 mbeanServer, javax.management.ObjectName name)
           
 void saveConfig()
          Update and save configuration.
 void setLocalServerRunning()
          Set the local server running and get its info Cannot be done before because some MBeans must exist first.
 void setMaster()
          Set this server as the master
 void startServer(java.lang.String serverName)
          Start a Remote JOnAS Server MBean implementation for jonasAdmin
 void stopServer(java.lang.String serverName)
          Stop a Remote JOnAS Server MBean implementation for jonasAdmin
 void unDeployEar(java.lang.String[] target, java.lang.String fileName)
          Undeploy a EAR file of a multiple management target composed of servers and/or clusters
 void unDeployJar(java.lang.String[] target, java.lang.String fileName)
          Undeploy a JAR file of a multiple management target composed of servers and/or clusters
 void unDeployRar(java.lang.String[] target, java.lang.String fileName)
          Undeploy a RAR file of a multiple management target composed of servers and/or clusters
 void unDeployWar(java.lang.String[] target, java.lang.String fileName)
          Undeploy a WAR file of a multiple management target composed of servers and/or clusters
 void uploadDeployEar(java.lang.String[] target, java.lang.String fileName, boolean replaceExisting)
          Upload and deploy an EAR file on a multiple management target composed of servers and/or clusters
 void uploadDeployJar(java.lang.String[] target, java.lang.String fileName, boolean replaceExisting)
          Upload and deploy a JAR file on a multiple management target composed of servers and/or clusters
 void uploadDeployRar(java.lang.String[] target, java.lang.String fileName, boolean replaceExisting)
          Upload and deploy a RAR file on a multiple management target composed of servers and/or clusters
 void uploadDeployWar(java.lang.String[] target, java.lang.String fileName, boolean replaceExisting)
          Upload and deploy a WAR file on a multiple management target composed of servers and/or clusters
 
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)
           throws javax.management.JMException
MBean constructor

Parameters:
objectName - object name of the managed object
Throws:
javax.management.JMException - ..
Method Detail

setMaster

public void setMaster()
Set this server as the master


getInstance

public static J2EEDomain getInstance()
Singleton: Each server (master or slave) must have 1 unique J2EEDomain object.

Returns:
the unique instance of the J2EEDomain

getConnection

public javax.management.MBeanServerConnection getConnection(java.lang.String serverName)
Parameters:
serverName - Name of the server
Returns:
the connection to the MBeanServer of this server

getServers

public java.lang.String[] getServers()
Return the MBeans OBJECT_NAMEs of the servers belonging to this domain

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

getServerNames

public java.lang.String[] getServerNames()
Return the servers' name belonging domain

Returns:
The list of names corresponding to the servers within this domain

getServerNames

public java.lang.String[] getServerNames(java.lang.String clusterName)
Parameters:
clusterName - name of a cluster in the domain
Returns:
the list of server names corresponding to the servers within a cluster

getStartedServers

public java.lang.String[] getStartedServers()
Return the MBeans OBJECT_NAMEs of the servers belonging to this domain but only if they are running.

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

getClusterDaemons

public java.lang.String[] getClusterDaemons()

getClusters

public java.lang.String[] getClusters()
Return the MBeans OBJECT_NAMEs of the clusters in this domain

Returns:
The list of object names corresponding to the clusters in this domain

getDomainMonitor

public DomainMonitor getDomainMonitor()
Get the domainMonitor, or null if slave server.

Returns:
the domainMonitor, for the master server.

createCluster

public java.lang.String createCluster(java.lang.String name)
Create a logical cluster (by jonasAdmin)

Parameters:
name - the cluster's name
Returns:
the OBJECT_NAME corresponding to the created MBean

addLocalServer

public void addLocalServer(J2EEServer j2eeserver)
Add the local J2EEServer to the 'servers' list. This method is called by the Server.start() method execution.

Parameters:
j2eeserver - J2EEServer object corresponding to the currently managed server (the local server which can be a master or a slave)

setLocalServerRunning

public void setLocalServerRunning()
Set the local server running and get its info Cannot be done before because some MBeans must exist first.


findCluster

public BaseCluster findCluster(java.lang.String name)
Get a Cluster by its name

Parameters:
name - The name of the cluster
Returns:
the Cluster or null if unknown by the domain.

findServer

public J2EEServer findServer(java.lang.String name)
Get a Server by its name

Parameters:
name - The name of the server
Returns:
the Server or null if unknown by the domain.

findServerProxy

public ServerProxy findServerProxy(java.lang.String name)
Get a Server by its name

Parameters:
name - The name of the server
Returns:
the ServerProxy or null if unknown by the domain.

preRegister

public javax.management.ObjectName preRegister(javax.management.MBeanServer mbeanServer,
                                               javax.management.ObjectName name)
                                        throws java.lang.Exception
Specified by:
preRegister in interface javax.management.MBeanRegistration
Parameters:
mbeanServer - 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()

startServer

public void startServer(java.lang.String serverName)
Start a Remote JOnAS Server MBean implementation for jonasAdmin

Parameters:
serverName - Name of the jonas server

stopServer

public void stopServer(java.lang.String serverName)
Stop a Remote JOnAS Server MBean implementation for jonasAdmin

Parameters:
serverName - Name of the jonas server

getDescription

public java.lang.String getDescription()
Returns:
Returns the description.

isMaster

public boolean isMaster()
Returns:
Returns the master.

getMyName

public java.lang.String getMyName()
Return the domain name

Returns:
domain name or cluster name

getConnectorServerURLs

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

Parameters:
serverName - the given JOnAS server name
Returns:
connector server urls for a given JOnAS server

deployJar

public void deployJar(java.lang.String[] target,
                      java.lang.String fileName)
Deploy a JAR file on a multiple management target composed of servers and/or clusters

Parameters:
target - list of server and/or cluster names
fileName - file to be deployed

deployEar

public void deployEar(java.lang.String[] target,
                      java.lang.String fileName)
Deploy a EAR file on a multiple management target composed of servers and/or clusters

Parameters:
target - list of server and/or cluster names
fileName - file to be deployed

deployWar

public void deployWar(java.lang.String[] target,
                      java.lang.String fileName)
Deploy a WAR file on a multiple management target composed of servers and/or clusters

Parameters:
target - list of server and/or cluster names
fileName - file to be deployed

deployRar

public void deployRar(java.lang.String[] target,
                      java.lang.String fileName)
Deploy a RAR file on a multiple management target composed of servers and/or clusters

Parameters:
target - list of server and/or cluster names
fileName - file to be deployed

uploadDeployJar

public void uploadDeployJar(java.lang.String[] target,
                            java.lang.String fileName,
                            boolean replaceExisting)
Upload and deploy a JAR file on a multiple management target composed of servers and/or clusters

Parameters:
target - list of server and/or cluster names
fileName - file to be deployed
replaceExisting - true if the uploaded file can replace a file with the same name in the jars directory

uploadDeployWar

public void uploadDeployWar(java.lang.String[] target,
                            java.lang.String fileName,
                            boolean replaceExisting)
Upload and deploy a WAR file on a multiple management target composed of servers and/or clusters

Parameters:
target - list of server and/or cluster names
fileName - file to be deployed
replaceExisting - true if the uploaded file can replace a file with the same name in the wars directory

uploadDeployEar

public void uploadDeployEar(java.lang.String[] target,
                            java.lang.String fileName,
                            boolean replaceExisting)
Upload and deploy an EAR file on a multiple management target composed of servers and/or clusters

Parameters:
target - list of server and/or cluster names
fileName - file to be deployed
replaceExisting - true if the uploaded file can replace a file with the same name in the apps directory

uploadDeployRar

public void uploadDeployRar(java.lang.String[] target,
                            java.lang.String fileName,
                            boolean replaceExisting)
Upload and deploy a RAR file on a multiple management target composed of servers and/or clusters

Parameters:
target - list of server and/or cluster names
fileName - file to be deployed
replaceExisting - true if the uploaded file can replace a file with the same name in the rars directory

unDeployJar

public void unDeployJar(java.lang.String[] target,
                        java.lang.String fileName)
Undeploy a JAR file of a multiple management target composed of servers and/or clusters

Parameters:
target - list of server and/or cluster names
fileName - file to be undeployed

unDeployWar

public void unDeployWar(java.lang.String[] target,
                        java.lang.String fileName)
Undeploy a WAR file of a multiple management target composed of servers and/or clusters

Parameters:
target - list of server and/or cluster names
fileName - file to be undeployed

unDeployEar

public void unDeployEar(java.lang.String[] target,
                        java.lang.String fileName)
Undeploy a EAR file of a multiple management target composed of servers and/or clusters

Parameters:
target - list of server and/or cluster names
fileName - file to be undeployed

unDeployRar

public void unDeployRar(java.lang.String[] target,
                        java.lang.String fileName)
Undeploy a RAR file of a multiple management target composed of servers and/or clusters

Parameters:
target - list of server and/or cluster names
fileName - file to be undeployed

addServer

public void addServer(java.lang.String serverName,
                      java.lang.String clusterName,
                      java.lang.String clusterDaemonName,
                      java.lang.String[] urls)
               throws javax.management.JMException
Deprecated. addServer(String, String, String, String[], String, String)

Calls addServer(String, String, String, String[], String, String)(serverName, clusterName, clusterDaemonName, urls, null, null)

Parameters:
serverName - name of the server to add
urls - JMX remote connector urls
clusterName - name of the cluster in which the server is to be attached, if any. Null otherwise.
clusterDaemonName - name of the cluster daemon if any. Null otherwise.
Throws:
javax.management.JMException - could not add the server to the domain

addServer

public void addServer(java.lang.String serverName,
                      java.lang.String clusterName,
                      java.lang.String clusterDaemonName,
                      java.lang.String[] urls,
                      java.lang.String username,
                      java.lang.String password)
               throws javax.management.JMException
Parameters:
serverName - name of the server to add
urls - JMX remote connector urls
clusterName - name of the cluster in which the server is to be attached, if any. Null otherwise.
clusterDaemonName - name of the cluster daemon if any. Null otherwise.
username - user name to use when connecting if any. Null otherwise.
password - password to use when connecting if any. Null otherwise.
Throws:
javax.management.JMException - could not add the server to the domain

saveConfig

public void saveConfig()
                throws DomainMapException
Update and save configuration.

Throws:
DomainMapException