org.ow2.jonas.lib.management.domain
Class J2EEDomain

java.lang.Object
  extended by org.ow2.jonas.lib.management.javaee.ManagedObject
      extended by org.ow2.jonas.lib.management.javaee.J2EEManagedObject
          extended by org.ow2.jonas.lib.management.domain.J2EEDomain
All Implemented Interfaces:
MBeanRegistration

public class J2EEDomain
extends J2EEManagedObject
implements MBeanRegistration

Implements a managed object which represents a management domain. The complete interface is described in mbeans-descriptors.xml

Author:
Adriana Danes, Vivek Lakshmanan

Field Summary
 
Fields inherited from class org.ow2.jonas.lib.management.javaee.J2EEManagedObject
J2EE_TYPE_APPLICATION, J2EE_TYPE_SERVER, NAME
 
Constructor Summary
J2EEDomain(String objectName)
          MBean constructor.
 
Method Summary
 String createCluster(String name)
          Create a logical cluster (used by jonasAdmin).
 void deployEar(String[] target, String fileName)
          Deploy a EAR file on a multiple management target composed of servers and/or clusters.
 void deployJar(String[] target, String fileName)
          Deploy a JAR file on a multiple management target composed of servers and/or clusters.
 void deployRar(String[] target, String fileName)
          Deploy a RAR file on a multiple management target composed of servers and/or clusters.
 void deployWar(String[] target, String fileName)
          Deploy a WAR file on a multiple management target composed of servers and/or clusters.
 void forgetAllDeploy()
          Forget all deploy information.
 String[] getClusterDaemons()
          Implement clusterDaemons management attribute.
 String getClusterdaemonState(String clusterdaemonName)
          Return the state of a cluster daemon in the domain.
 String[] getClusters()
          Implement clusters management attribute.
 String getClusterState(String clusterName)
          Return the state of a cluster in the domain.
 String getClusterType(String clusterName)
          Return the type of a cluster in the domain.
 String[] getDeployServers(String fileName)
          Get the list of servers where a file is being deployed.
 String getDeployState(String fileName, String serverName)
          Get the current state of deployment operation.
 String getDescription()
          Implement description management attribute.
 DomainMonitor getDomainMonitor()
          Get the domainMonitor, or null if slave server.
 String getErrorMessage(String filename, String servername)
          Get the error message associated to the error state.
static J2EEDomain getInstance()
          Singleton: Each server (master or slave) must have 1 unique J2EEDomain object.
 String getMyName()
          Implement myName management attribute.
 String getServerClusterdaemon(String serverName)
          Return the cluster daemon name of a server in the domain.
 String[] getServerNames()
          Implement serverNames management attribute.
 String[] getServers()
          Implement servers JSR77 management attribute.
 String[] getServersInCluster(String clusterName)
          Get the name of the servers in the domain that are belonging to a cluster.
 String[] getServersNotInCluster(String clusterName)
          Get the name of the servers in the domain except the ones that are already belonging to this cluster.
 String getServerState(String serverName)
          Return the state of a server in the domain.
 String[] getStartedServers()
          Implement startedServers management attribute.
 void haltServer(String serverName)
          Halt a Remote JOnAS Server.
 boolean isMaster()
          Implement master management attribute.
 void postDeregister()
           
 void postRegister(Boolean registrationDone)
          Add J2EEDomain MBean (myself) as listener to registration/unregistration notifications of JOnAS management MBeans.
 void preDeregister()
           
 ObjectName preRegister(MBeanServer mbeanServer, ObjectName name)
           
 void setJmxService(JmxService jmxService)
           
 void setMaster(boolean ismaster, String serverName)
          Set this server as the master.
 void setMyJ2EEServerOn(String myJ2EEServerOn)
          Set the local server's OBJECT_NAME.
 boolean startRemoteTarget(String target)
          Start a remote target on the behalf of ClientAdmin.
 void startServer(String serverName)
          Start a Remote JOnAS Server.
 boolean stopRemoteTarget(String target)
          Stop a remote target on the behalf of ClientAdmin.
 void stopServer(String serverName)
          Stop a Remote JOnAS Server.
 void unDeployEar(String[] target, String fileName)
          Undeploy a EAR file of a multiple management target composed of servers and/or clusters.
 void unDeployJar(String[] target, String fileName)
          Undeploy a JAR file of a multiple management target composed of servers and/or clusters.
 void unDeployRar(String[] target, String fileName)
          Undeploy a RAR file of a multiple management target composed of servers and/or clusters.
 void unDeployWar(String[] target, String fileName)
          Undeploy a WAR file of a multiple management target composed of servers and/or clusters.
 void uploadDeployEar(String[] target, String fileName, boolean replaceExisting)
          Upload and deploy an EAR file on a multiple management target composed of servers and/or clusters.
 boolean uploadDeployFileOn(String target, String filename)
          Upload and deploy a module to a target on the behalf of Adm.
 void uploadDeployJar(String[] target, String fileName, boolean replaceExisting)
          Upload and deploy a JAR file on a multiple management target composed of servers and/or clusters.
 void uploadDeployRar(String[] target, String fileName, boolean replaceExisting)
          Upload and deploy a RAR file on a multiple management target composed of servers and/or clusters.
 void uploadDeployWar(String[] target, 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.ow2.jonas.lib.management.javaee.J2EEManagedObject
getObjectName, isEventProvider, isStateManageable, isStatisticsProvider, setEventProvider, setObjectName, setStateManageable, setStatisticsProvider
 
Methods inherited from class org.ow2.jonas.lib.management.javaee.ManagedObject
sendNotification, sendReconfigNotification, sendSaveNotification, setModelMBean
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

J2EEDomain

public J2EEDomain(String objectName)
           throws JMException
MBean constructor.

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

getErrorMessage

public String getErrorMessage(String filename,
                              String servername)
Get the error message associated to the error state.

Parameters:
filename - file to deploy
servername - server where deployment is done
Returns:
error message

forgetAllDeploy

public void forgetAllDeploy()
Forget all deploy information.


getClusterDaemons

public String[] getClusterDaemons()
Implement clusterDaemons management attribute.

Returns:
Array contining the ClusterDaemon MBeans OBJECT_NAMEs.

getClusters

public String[] getClusters()
Implement clusters management attribute. Return the MBeans OBJECT_NAMEs of the clusters in this domain

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

getDescription

public String getDescription()
Implement description management attribute.

Returns:
Returns the domain description.

isMaster

public boolean isMaster()
Implement master management attribute.

Returns:
Returns the master.

getMyName

public String getMyName()
Implement myName management attribute.

Returns:
domain name

getServerNames

public String[] getServerNames()
Implement serverNames management attribute.

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

getServers

public String[] getServers()
Implement servers JSR77 management attribute. Return the MBean OBJECT_NAMEs of the servers belonging to this domain

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

getStartedServers

public String[] getStartedServers()
Implement startedServers management attribute.

Returns:
The list of MBean OBJECT_NAMEs of the servers belonging to this domain but only if they are running.

createCluster

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

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

startServer

public void startServer(String serverName)
Start a Remote JOnAS Server.

Parameters:
serverName - Name of the jonas server

haltServer

public void haltServer(String serverName)
Halt a Remote JOnAS Server.

Parameters:
serverName - Name of the jonas server

stopServer

public void stopServer(String serverName)
Stop a Remote JOnAS Server.

Parameters:
serverName - Name of the jonas server

deployJar

public void deployJar(String[] target,
                      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(String[] target,
                      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(String[] target,
                      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(String[] target,
                      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(String[] target,
                            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(String[] target,
                            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(String[] target,
                            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(String[] target,
                            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(String[] target,
                        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(String[] target,
                        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(String[] target,
                        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(String[] target,
                        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

getDeployServers

public String[] getDeployServers(String fileName)
Get the list of servers where a file is being deployed.

Parameters:
fileName - file in deployment
Returns:
target servers name

getDeployState

public String getDeployState(String fileName,
                             String serverName)
Get the current state of deployment operation.

Parameters:
fileName - file to deploy
serverName - server where deployment is done
Returns:
one of "progress","ok","fail"

getServersNotInCluster

public String[] getServersNotInCluster(String clusterName)
Get the name of the servers in the domain except the ones that are already belonging to this cluster. This method is used to attach a server u=in the domain to a cluster.

Parameters:
clusterName - the cluster name
Returns:
name of the servers that can be attached to the cluster

getServersInCluster

public String[] getServersInCluster(String clusterName)
Get the name of the servers in the domain that are belonging to a cluster.

Parameters:
clusterName - the cluster name
Returns:
name of the servers that are attached to the cluster

getServerState

public String getServerState(String serverName)
Return the state of a server in the domain. Used by JonasAdmin.

Parameters:
serverName - the server name
Returns:
Get the state of a server in the domain

getClusterState

public String getClusterState(String clusterName)
Return the state of a cluster in the domain. Used by JonasAdmin.

Parameters:
clusterName - the cluster name
Returns:
Get the state of a cluster in the domain

getClusterdaemonState

public String getClusterdaemonState(String clusterdaemonName)
Return the state of a cluster daemon in the domain. Used by JonasAdmin.

Parameters:
clusterdaemonName - the cluster name
Returns:
Get the state of a cluster daemon in the domain

getClusterType

public String getClusterType(String clusterName)
Return the type of a cluster in the domain. Used by JonasAdmin.

Parameters:
clusterName - the cluster name
Returns:
Get the type of a cluster in the domain

getServerClusterdaemon

public String getServerClusterdaemon(String serverName)
Return the cluster daemon name of a server in the domain. Used by JonasAdmin.

Parameters:
serverName - the server name
Returns:
Get the cluster daemon name of a server in the domain

getInstance

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

Returns:
the unique instance of the J2EEDomain

getDomainMonitor

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

Returns:
the domainMonitor, for the master server.

setMaster

public void setMaster(boolean ismaster,
                      String serverName)
Set this server as the master. Used by the J2EEDomain creator.

Parameters:
ismaster - true if the current server is master
serverName - current server name

setMyJ2EEServerOn

public void setMyJ2EEServerOn(String myJ2EEServerOn)
Set the local server's OBJECT_NAME. Used by the J2EEDomain creator.

Parameters:
myJ2EEServerOn - the local server's OBJECT_NAME

startRemoteTarget

public boolean startRemoteTarget(String target)
                          throws JMException
Start a remote target on the behalf of ClientAdmin. Already checked the current server is a master.

Parameters:
target - the target to start
Returns:
true is success, false otherwise
Throws:
JMException - problem when trying to start

stopRemoteTarget

public boolean stopRemoteTarget(String target)
                         throws JMException
Stop a remote target on the behalf of ClientAdmin. Already checked the current server is a master.

Parameters:
target - the target to stop
Returns:
true is success, false otherwise
Throws:
JMException - problem when trying to stop

uploadDeployFileOn

public boolean uploadDeployFileOn(String target,
                                  String filename)
Upload and deploy a module to a target on the behalf of Adm. Already checked the current server is a master.

Parameters:
target - the target to deploy on
filename - the file containing the module
Returns:
true is success, false otherwise

preRegister

public ObjectName preRegister(MBeanServer mbeanServer,
                              ObjectName name)
                       throws Exception
Specified by:
preRegister in interface 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:
Exception - This exception will be caught by the MBean server and re-thrown as an MBeanRegistrationException

postRegister

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

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

preDeregister

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

postDeregister

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

setJmxService

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


Copyright © 2010 OW2 Consortium. All Rights Reserved.