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
 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, java.lang.Boolean moveIntoDeployableDirectory)
          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
 void deployLocalFile(java.lang.String pathname, java.lang.String[] genicArgs)
          Deploy local file and generate classes with Genic tool
 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.
 java.lang.Boolean removeModuleFile(java.lang.String fileName)
          Remove a specified J2EE module
 java.lang.String sendFile(byte[] fileContent, java.lang.String fileName, boolean replaceExisting)
          Send a file to JOnAS Base with the given input stream and write it in the corresponding directory, ie JONAS_BASE/apps, JONAS_BASE/ejbjars, etc.
 void sendNotification(javax.management.Notification pNotification)
          Send a notification to the listener.
 java.lang.String wsgenLocalFile(java.lang.String pathname, java.lang.Boolean unpacked)
          Apply WsGen on a local file and generate webservices artifacts
 
Methods inherited from class org.apache.commons.modeler.BaseModelMBean
addAttributeChangeNotificationListener, createDefaultModelMBeanInfo, createResource, getAttribute, getAttributes, getClassName, 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

deployLocalFile

public void deployLocalFile(java.lang.String pathname,
                            java.lang.String[] genicArgs)
Deploy local file and generate classes with Genic tool

Parameters:
pathname - : local path name to the application
genicArgs - : list of genic's parameters

wsgenLocalFile

public java.lang.String wsgenLocalFile(java.lang.String pathname,
                                       java.lang.Boolean unpacked)
Apply WsGen on a local file and generate webservices artifacts

Parameters:
pathname - : local path name to the component
unpacked - true if we want to have an unpacked directory as result
Returns:
Returns the path to the modified archive

deployFile

public java.lang.String deployFile(java.lang.Integer typeparam,
                                   java.lang.Byte[] bfile,
                                   java.lang.String filename,
                                   java.lang.String[] genicArgs,
                                   java.lang.Boolean moveIntoDeployableDirectory)
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 (if moveIntoDeployableDirectory full path name because local file)
genicArgs - arguments for GenIC
moveIntoDeployableDirectory - true to copy the file into the deployable JOnAS_BASE directory
Returns:
absolute path of the file
Throws:
RemoteException
EarServiceException
ResourceServiceException
JWebContainerServiceException

sendFile

public java.lang.String sendFile(byte[] fileContent,
                                 java.lang.String fileName,
                                 boolean replaceExisting)
                          throws java.lang.Exception
Send a file to JOnAS Base with the given input stream and write it in the corresponding directory, ie JONAS_BASE/apps, JONAS_BASE/ejbjars, etc. It is based on the filename extension

Parameters:
fileContent - the content (bytes) of the file
fileName - name of the file
replaceExisting - replace existing file if any
Returns:
the path of the file
Throws:
java.lang.Exception - if file is already present and if the user don't want to replace existing file.

removeModuleFile

public java.lang.Boolean removeModuleFile(java.lang.String fileName)
                                   throws java.lang.Exception
Remove a specified J2EE module

Parameters:
fileName - Name of file to remove
Returns:
true if file has been removed
Throws:
java.lang.Exception - if remove fails