org.objectweb.jonas.server
Class J2EEServer

java.lang.Object
  extended by javax.management.NotificationBroadcasterSupport
      extended by org.objectweb.jonas.management.reconfig.emitter.ReconfigEmitter
          extended by org.objectweb.jonas.management.j2eemanagement.J2EEManagedObject
              extended by org.objectweb.jonas.server.J2EEServer
All Implemented Interfaces:
EventListener, NotificationBroadcaster, NotificationEmitter, NotificationListener, TimerEventListener

public class J2EEServer
extends J2EEManagedObject
implements TimerEventListener, NotificationListener

MBean class for Server management. Two classes are used to provide all management services : J2EEServer and J2EEServerMBean. This class provide the notification's process when add or remove resources.

Author:
Guillaume Riviere, Michel Bruno
contributors Adriana Danes, Michel-Ange Anton

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.reconfig.emitter.ReconfigEmitter
RECONFIG_TYPE, SAVE_RECONFIG_TYPE
 
Constructor Summary
J2EEServer(String objectName, Server server, String serverName, String serverVersion, String serverVendor, String protocols, String versions)
          J2EEServer MBean constructor.
 
Method Summary
 void addDeployedObject(String objectName)
          Add an object name to the deployedObjects list.
 void addJavaVM(String objectName)
          Add an object name to the javaVMs list.
 void addResource(String pObjectName)
          Add an object name to the resources list.
 String deployEar(String fileName)
          Deploy a J2EE application packaged in a EAR file.
 String deployJar(String fileName)
          Deploy a stand-alone J2EE module packaged in a JAR file.
 String deployRar(String fileName)
          Deploy a J2EE application packaged in a RAR file.
 void deployWar(String fileName)
          Deploy a stand-alone J2EE module packaged in a WAR file.
 String getAppsDirectory()
          Return the Apps directory.
 long getCurrentTotalMemory()
          Get jvm total memory.
 long getCurrentUsedMemory()
          Get jvm used memory.
 List getDeployableEars()
          Return the list of installed Applications ready to deploy.
 List getDeployableJars()
          Return the list of installed EJB container ready to deploy.
 List getDeployableRars()
          Return the list of installed RAR container ready to deploy.
 List getDeployableWars()
          Return the list of installed web applications ready to deploy.
 List getDeployedEars()
          Return the list of all loaded Applications.
 List getDeployedJars()
          Return the list of all loaded EJB container.
 List getDeployedObjects()
          Return the list of MBean names corresponding to the deployed J2EEModules and J2EEApplications.
 List getDeployedRars()
           
 List getDeployedWars()
          Return the list of all loaded web applications.
 String getJarsDirectory()
          Return the Ejbjars directory.
 List getJavaVMs()
          Return the list of MBean names corresponding to the JVMs on which this server has running threads
 String getJonasBase()
           
 String getProtocols()
          Protocols supported by this Server
 int getRange()
          Get range.
 String getRarsDirectory()
          Return the Rars directory.
 List getResources()
          Return the list of MBean names corresponding to the resources available on this server.
 String getServerName()
          Server name.
 String getServerVendor()
          Server vendor.
 String getServerVersion()
          Server version.
 int getSizeTableMeasures()
          Get the size of the table of measures.
 Long[] getTableMeasures()
          Get the table of value.
 String getVersions()
           
 String getWarsDirectory()
          Return the WebApps directory.
 void handleNotification(Notification notification, Object handback)
          Treat the notifications emitted by the JMX server.
 boolean isActivated()
          Get monitoring activation.
 Boolean isEarDeployed(String fileName)
          Test if the specified filename is already deployed or not.
 Boolean isJarDeployed(String fileName)
          Test if the specified filename is already deployed or not.
 Boolean isRarDeployed(String fileName)
          Test if the specified filename is already deployed or not.
 boolean isRarLoaded(String fileName)
          Test if the specified filename is already deployed or not.
 Boolean isWarDeployed(String fileName)
          Test if the specified filename is already deployed or not.
 void removeDeployedObject(String objectName)
          Remove an object name to the deployedObjects list.
 String removeResource(String pObjectName)
          Remove an object name from the resources list.
 void runGC()
          Run the garbage collector.
 void setActivated(boolean pActivated)
          set monitoring activation
 void setJonasBase(String jonasBase)
           
 void setRange(int range)
          set range
 void setSizeTableMeasures(int sizeMeasuresTable)
          Set the size of the table of measures
 void stop()
          Stop server (with stopping the JVM).
 void timeoutExpired(Object arg)
          The measures timeout has expired Do not synchronize this method to avoid deadlocks!
 void unDeployEar(String fileName)
          undeploy a J2EE application packaged in a EAR file.
 void unDeployJar(String fileName)
          Uneploy a stand-alone J2EE module packaged in a JAR file.
 void unDeployRar(String fileName)
          undeploy a J2EE application packaged in a RAR file
 void unDeployWar(String fileName)
          Uneploy a stand-alone J2EE module packaged in a WAR file.
 
Methods inherited from class org.objectweb.jonas.management.j2eemanagement.J2EEManagedObject
getObjectName, isEventProvider, isStateManageable, isStatisticsProvider
 
Methods inherited from class org.objectweb.jonas.management.reconfig.emitter.ReconfigEmitter
initLogger, sendReconfigNotification, sendSaveNotification
 
Methods inherited from class javax.management.NotificationBroadcasterSupport
addNotificationListener, getNotificationInfo, handleNotification, removeNotificationListener, removeNotificationListener, sendNotification
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

J2EEServer

public J2EEServer(String objectName,
                  Server server,
                  String serverName,
                  String serverVersion,
                  String serverVendor,
                  String protocols,
                  String versions)
J2EEServer MBean constructor.

Parameters:
objectName - object name of the managed object
server - Server object
serverName - server name
serverVersion - JOnAS version
serverVendor - is JOnAS
protocols - protocols supported
versions - the modules versions cf. VERSIONS file content
Method Detail

getServerName

public String getServerName()
Server name.

Returns:
String JOnAS server name

getServerVersion

public String getServerVersion()
Server version.

Returns:
String JOnAS server version

getServerVendor

public String getServerVendor()
Server vendor.

Returns:
String JOnAS server version

getJonasBase

public String getJonasBase()
Returns:
JONAS_BASE environment property

getDeployedObjects

public List getDeployedObjects()
Return the list of MBean names corresponding to the deployed J2EEModules and J2EEApplications.

Returns:
java.util.ArrayList list of the deployed objects' MBean names

addDeployedObject

public void addDeployedObject(String objectName)
Add an object name to the deployedObjects list.

Parameters:
objectName - Object name corresponding to a J2EEDeployedObject MBean

removeDeployedObject

public void removeDeployedObject(String objectName)
Remove an object name to the deployedObjects list.

Parameters:
objectName - Object name corresponding to a J2EEDeployedObject MBean

getResources

public List getResources()
Return the list of MBean names corresponding to the resources available on this server.

Returns:
java.util.ArrayList list of the resources' MBean names

getJavaVMs

public List getJavaVMs()
Return the list of MBean names corresponding to the JVMs on which this server has running threads

Returns:
java.util.ArrayList list of the JVMs' MBean names

addJavaVM

public void addJavaVM(String objectName)
Add an object name to the javaVMs list.

Parameters:
objectName - Object name correspondig to a JVM MBean

getProtocols

public String getProtocols()
Protocols supported by this Server

Returns:
String protocols supported

getVersions

public String getVersions()
Returns:
Returns the versions.

getCurrentUsedMemory

public long getCurrentUsedMemory()
Get jvm used memory.

Returns:
Long - current used memory

getCurrentTotalMemory

public long getCurrentTotalMemory()
Get jvm total memory.

Returns:
Long - current total memory

getRange

public int getRange()
Get range.

Returns:
Integer - range

getSizeTableMeasures

public int getSizeTableMeasures()
Get the size of the table of measures.

Returns:
Number of measures

getTableMeasures

public Long[] getTableMeasures()
Get the table of value.

Returns:
Long[] measures table

isActivated

public boolean isActivated()
Get monitoring activation.

Returns:
Boolean is activated

stop

public void stop()
          throws Exception
Stop server (with stopping the JVM).

Throws:
Exception

runGC

public void runGC()
Run the garbage collector.


setJonasBase

public void setJonasBase(String jonasBase)
Parameters:
jonasBase - JONAS_BASE environment property

setRange

public void setRange(int range)
set range

Parameters:
range - range for free memory measurement

setSizeTableMeasures

public void setSizeTableMeasures(int sizeMeasuresTable)
Set the size of the table of measures

Parameters:
sizeMeasuresTable - Number of measures

timeoutExpired

public void timeoutExpired(Object arg)
The measures timeout has expired Do not synchronize this method to avoid deadlocks!

Specified by:
timeoutExpired in interface TimerEventListener
Parameters:
arg - Object

setActivated

public void setActivated(boolean pActivated)
set monitoring activation

Parameters:
pActivated - true is activated

deployJar

public String deployJar(String fileName)
                 throws Exception
Deploy a stand-alone J2EE module packaged in a JAR file.

Parameters:
fileName - the file name of the JAR to be be deployed.
Returns:
The ObjectName of the MBean associated to the deployed module
Throws:
Exception - Management operation could not be executed or failed

isJarDeployed

public Boolean isJarDeployed(String fileName)
                      throws Exception
Test if the specified filename is already deployed or not.

Parameters:
fileName - the name of the jar file.
Returns:
true if the jar is deployed, otherwise false.
Throws:
Exception - Management operation could not be executed

unDeployJar

public void unDeployJar(String fileName)
                 throws Exception
Uneploy a stand-alone J2EE module packaged in a JAR file.

Parameters:
fileName - the file name of the JAR to be be undeployed.
Throws:
Exception - Management operation could not be executed or failed

getDeployedJars

public List getDeployedJars()
                     throws Exception
Return the list of all loaded EJB container.

Returns:
The list of deployed EJB container
Throws:
Exception

getDeployableJars

public List getDeployableJars()
                       throws Exception
Return the list of installed EJB container ready to deploy.

Returns:
The list of deployable EJB container
Throws:
Exception

getJarsDirectory

public String getJarsDirectory()
                        throws Exception
Return the Ejbjars directory.

Returns:
The Ejbjars directory
Throws:
Exception

isWarDeployed

public Boolean isWarDeployed(String fileName)
                      throws Exception
Test if the specified filename is already deployed or not.

Parameters:
fileName - the name of the war file.
Returns:
true if the war is deployed, otherwise false.
Throws:
Exception - Management operation could not be executed

deployWar

public void deployWar(String fileName)
               throws Exception
Deploy a stand-alone J2EE module packaged in a WAR file.

Parameters:
fileName - the file name of the WAR to be be deployed.
Throws:
Exception - Management operation could not be executed or failed

unDeployWar

public void unDeployWar(String fileName)
                 throws Exception
Uneploy a stand-alone J2EE module packaged in a WAR file.

Parameters:
fileName - the file name of the WAR to be be undeployed.
Throws:
Exception - Management operation could not be executed or failed

getDeployableWars

public List getDeployableWars()
                       throws Exception
Return the list of installed web applications ready to deploy.

Returns:
The list of deployable web applications
Throws:
Exception - if the deployable wars can't be returned

getDeployedWars

public List getDeployedWars()
                     throws Exception
Return the list of all loaded web applications.

Returns:
The list of deployed web applications
Throws:
Exception - if the deployed wars can't be returned

getWarsDirectory

public String getWarsDirectory()
                        throws Exception
Return the WebApps directory.

Returns:
The WebApps directory
Throws:
Exception - if the webapps directory can't be returned

deployEar

public String deployEar(String fileName)
                 throws Exception
Deploy a J2EE application packaged in a EAR file.

Parameters:
fileName - the file name of the EAR to be be deployed.
Returns:
The ObjectName of the MBean associated to the deployed J2EE Application
Throws:
Exception - Management operation could not be executed or failed

isEarDeployed

public Boolean isEarDeployed(String fileName)
                      throws Exception
Test if the specified filename is already deployed or not. This method is defined in the EarService interface.

Parameters:
fileName - the name of the ear file.
Returns:
true if the ear is deployed, else false.
Throws:
Exception - Management operation could not be executed or failed

unDeployEar

public void unDeployEar(String fileName)
                 throws Exception
undeploy a J2EE application packaged in a EAR file.

Parameters:
fileName - the file name of the EAR to be be undeployed.
Throws:
Exception - Management operation could not be executed or failed

getAppsDirectory

public String getAppsDirectory()
                        throws Exception
Return the Apps directory.

Returns:
The Apps directory
Throws:
Exception

getDeployedEars

public List getDeployedEars()
                     throws Exception
Return the list of all loaded Applications.

Returns:
The list of deployed Applications
Throws:
Exception - if the list of deployed ears can't be returned

getDeployableEars

public List getDeployableEars()
                       throws Exception
Return the list of installed Applications ready to deploy.

Returns:
The list of deployable Applications
Throws:
Exception - if the list of deployable ears can't be returned

deployRar

public String deployRar(String fileName)
                 throws Exception
Deploy a J2EE application packaged in a RAR file.

Parameters:
fileName - the file name of the RAR to be be deployed.
Returns:
The ObjectName of the MBean associated to the deployed J2EE Application
Throws:
Exception - Management operation could not be executed or failed

isRarDeployed

public Boolean isRarDeployed(String fileName)
                      throws Exception
Test if the specified filename is already deployed or not.

Parameters:
fileName - the name of the rar file.
Returns:
true if the rar is deployed, else false.
Throws:
Exception - Management operation could not be executed or failed

unDeployRar

public void unDeployRar(String fileName)
                 throws Exception
undeploy a J2EE application packaged in a RAR file

Parameters:
fileName - the file name of the RAR to be be undeployed.
Throws:
Exception - Management operation could not be executed or failed

isRarLoaded

public boolean isRarLoaded(String fileName)
                    throws Exception
Test if the specified filename is already deployed or not.

Parameters:
fileName - the name of the rar file.
Returns:
true if the rar is deployed, else false.
Throws:
Exception

getDeployableRars

public List getDeployableRars()
                       throws Exception
Return the list of installed RAR container ready to deploy.

Returns:
The list of deployable RAR container
Throws:
Exception - if error retrieving the list

getDeployedRars

public List getDeployedRars()
                     throws Exception
Returns:
the list of RAR files deployed
Throws:
Exception - if error retrieving the list

getRarsDirectory

public String getRarsDirectory()
                        throws Exception
Return the Rars directory.

Returns:
The Rars directory
Throws:
Exception

addResource

public void addResource(String pObjectName)
Add an object name to the resources list.

Parameters:
pObjectName - Object name correspondig to a J2EEResource MBean

removeResource

public String removeResource(String pObjectName)
Remove an object name from the resources list.

Parameters:
pObjectName - Object name correspondig to a J2EEResource MBean
Returns:
Object name to the removed J2EEResource MBean

handleNotification

public void handleNotification(Notification notification,
                               Object handback)
Treat the notifications emitted by the JMX server. This method determines the type of the notification and calls the specific treatement.

Specified by:
handleNotification in interface NotificationListener
Parameters:
notification - received notification
handback - received handback object


Copyright © 2007 OW2 Consortium. All Rights Reserved.