org.objectweb.jonas.server
Class J2EEServerMBean

java.lang.Object
  extended byorg.apache.commons.modeler.BaseModelMBean
      extended byorg.objectweb.jonas.server.J2EEServerMBean
All Implemented Interfaces:
javax.management.DynamicMBean, javax.management.MBeanRegistration, javax.management.modelmbean.ModelMBean, javax.management.modelmbean.ModelMBeanNotificationBroadcaster, javax.management.NotificationBroadcaster, javax.management.PersistentMBean

public class J2EEServerMBean
extends org.apache.commons.modeler.BaseModelMBean

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:
Adriana Danes, Michel-Ange Anton

Field Summary
 
Fields inherited from class org.apache.commons.modeler.BaseModelMBean
attributeBroadcaster, attributes, generalBroadcaster, info, oname, registry, resource, resourceType, source
 
Constructor Summary
J2EEServerMBean()
          Default constructor
 
Method Summary
static void addDeployedObject(java.lang.String pDeployedObject)
          Add a deployed object in the list of the J2EEServer.
 void addNotificationListener(javax.management.NotificationListener pListner, javax.management.NotificationFilter pFilter, java.lang.Object pHandback)
          Add a new listener.
 java.lang.String deployEar(java.lang.String fileName)
          Deploy a J2EE application packaged in a EAR file
 java.lang.String deployFile(java.lang.Integer typeparam, java.lang.Byte[] bfile, java.lang.String filename, java.lang.String[] genicArgs)
          Deploy file (GenIC), needed for Ishmael to work.
 java.lang.String deployJar(java.lang.String fileName)
          Deploy a stand-alone J2EE module packaged in a JAR file
 java.lang.String deployRar(java.lang.String fileName)
          Deploy a J2EE application packaged in a RAR file
 void deployWar(java.lang.String fileName)
          Deploy a stand-alone J2EE module packaged in a War file
 java.lang.String[] getDeployedObjects()
          All The MBean names corresponding to the deployed J2EEModules (ear, jar, war, rar).
 java.lang.String[] getJavaVMs()
          All The MBean names corresponding to the used JVMs.
 java.lang.String[] getResources()
          All The MBean names corresponding to the deployed J2EEResources.
 java.lang.Boolean isEarDeployed(java.lang.String fileName)
          Test if the specified filename is already deployed or not.
 java.lang.Boolean isJarDeployed(java.lang.String fileName)
          Test if the specified filename is already deployed or not.
 java.lang.Boolean isRarDeployed(java.lang.String fileName)
          Test if the specified filename is already deployed or not.
 java.lang.Boolean isWarDeployed(java.lang.String fileName)
          Test if the specified filename is already deployed or not.
static void removeDeployedObject(java.lang.String pDeployedObject)
          Remove a deployed object from the list of the J2EEServer.
 void sendNotification(javax.management.Notification pNotification)
          Send a notification to the listener.
 
Methods inherited from class org.apache.commons.modeler.BaseModelMBean
addAttributeChangeNotificationListener, createDefaultModelMBeanInfo, createResource, getAttribute, getAttributes, getClassName, getJmxName, getManagedResource, getMBeanInfo, getModelerType, getNotificationInfo, getObjectName, getRegistry, initModelInfo, invoke, isModelMBeanInfoValid, load, postDeregister, postRegister, preDeregister, preRegister, removeAttributeChangeNotificationListener, removeAttributeChangeNotificationListener, removeNotificationListener, removeNotificationListener, removeNotificationListener, sendAttributeChangeNotification, sendAttributeChangeNotification, sendNotification, setAttribute, setAttributes, setManagedResource, setModeledType, setModelMBeanInfo, setRegistry, store, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

J2EEServerMBean

public J2EEServerMBean()
                throws javax.management.MBeanException
Default constructor

Throws:
javax.management.MBeanException - if super constructor fails
Method Detail

getDeployedObjects

public java.lang.String[] getDeployedObjects()
All The MBean names corresponding to the deployed J2EEModules (ear, jar, war, rar).

Returns:
The String's array of deployed modules objects names

getResources

public java.lang.String[] getResources()
All The MBean names corresponding to the deployed J2EEResources.

Returns:
The String's array of deployed resources objects names

getJavaVMs

public java.lang.String[] getJavaVMs()
All The MBean names corresponding to the used JVMs.

Returns:
The String's array of used JVMs objects names

sendNotification

public void sendNotification(javax.management.Notification pNotification)
Send a notification to the listener.

Parameters:
pNotification - The notification to send

addNotificationListener

public void addNotificationListener(javax.management.NotificationListener pListner,
                                    javax.management.NotificationFilter pFilter,
                                    java.lang.Object pHandback)
                             throws java.lang.IllegalArgumentException
Add a new listener.

Parameters:
pListner - Listener to notify
pFilter - Notification filter
pHandback - ??
Throws:
java.lang.IllegalArgumentException - if notification is not done

deployJar

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

Parameters:
fileName - file name
Returns:
The ObjectName of the MBean associated to the deployed module
Throws:
java.lang.Exception - Management operation failed

deployWar

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

Parameters:
fileName - file name
Throws:
java.lang.Exception - Management operation failed

deployEar

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

Parameters:
fileName - file name
Returns:
The ObjectName of the MBean associated to the deployed J2EE Application
Throws:
java.lang.Exception - Management operation failed

deployRar

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

Parameters:
fileName - file name
Returns:
The ObjectName of the MBean associated to the deployed J2EE Application
Throws:
java.lang.Exception - Management operation failed

isEarDeployed

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

Parameters:
fileName - the name of the ear file.
Returns:
true if the ear is deployed, otherwise false.
Throws:
java.lang.Exception - Management operation failed

isRarDeployed

public java.lang.Boolean isRarDeployed(java.lang.String fileName)
                                throws java.lang.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, otherwise false.
Throws:
java.lang.Exception - Management operation failed

isJarDeployed

public java.lang.Boolean isJarDeployed(java.lang.String fileName)
                                throws java.lang.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:
java.lang.Exception - Management operation failed

isWarDeployed

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

Parameters:
fileName - the name of the War file.
Returns:
true if the jar is deployed, otherwise false.
Throws:
java.lang.Exception - Management operation failed

deployFile

public java.lang.String deployFile(java.lang.Integer typeparam,
                                   java.lang.Byte[] bfile,
                                   java.lang.String filename,
                                   java.lang.String[] genicArgs)
Deploy file (GenIC), needed for Ishmael to work. The file is in the directory specified by the property "jonas.service.deployment.directory"

Parameters:
typeparam - type of the file (EJB, WAR, EAR, RAR, CAR)
bfile - bytes array of the file
filename - basename of the file to be deployed
genicArgs - arguments for GenIC
Returns:
absolute path of the file
Throws:
RemoteException
EarServiceException
ResourceServiceException
JWebContainerServiceException

addDeployedObject

public static void addDeployedObject(java.lang.String pDeployedObject)
Add a deployed object in the list of the J2EEServer.

Parameters:
pDeployedObject - The object name of deployed object

removeDeployedObject

public static void removeDeployedObject(java.lang.String pDeployedObject)
Remove a deployed object from the list of the J2EEServer.

Parameters:
pDeployedObject - The object name of deployed object