org.ow2.jonas.lib.jmbeans
Class J2EEServerMBean

java.lang.Object
  extended by org.apache.commons.modeler.BaseModelMBean
      extended by org.ow2.jonas.lib.jmbeans.J2EEServerMBean
All Implemented Interfaces:
DynamicMBean, MBeanRegistration, ModelMBean, ModelMBeanNotificationBroadcaster, NotificationBroadcaster, PersistentMBean

public class J2EEServerMBean
extends BaseModelMBean

J2EEServer MBean implementation.

Author:
Adriana.Danes@bull.net

Field Summary
 
Fields inherited from class org.apache.commons.modeler.BaseModelMBean
attributeBroadcaster, attributes, generalBroadcaster, info, oname, registry, resource, resourceType, source
 
Constructor Summary
J2EEServerMBean()
           
 
Method Summary
protected static Element addBundleNode(Document document, String elementName, org.osgi.framework.Bundle bundle)
          Helper method for writing a bundle element on a given XML element.
protected static Element addNode(Document document, String elementName, String value)
          Helper method for writing a new element on a given XML element.
protected static Element addNode(Document document, String elementName, String value, Map<String,String> attributes)
          Helper method for writing a new element on a given XML element.
 String[] getClassLoaderFilters()
          Gets the system filters of classloaders.
 String[] getDeployedObjects()
          Implement deployedObjects attribute cf.
 String getExportedPackages(String name, boolean isClass)
          Gets the exported packages for a given package name.
 String getExportedPackagesFromClass(String className)
          Gets the exported packages for a given package name.
 String getExportedPackagesFromPackage(String packageName)
          Gets the exported packages for a given package name.
 String[] getResources()
          Implement resources attribute.
 URL[] getResources(String resourceName)
          Gets all the URL to the given resource.
 String[] getServices()
          Implement services attribute.
 String getServiceState(String service)
          Return the state of a given service.
 String getState()
          Implement the state attribute.
 String loadClass(String className)
          Gets data about loading a given class.
 
Methods inherited from class org.apache.commons.modeler.BaseModelMBean
addAttributeChangeNotificationListener, addNotificationListener, 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, 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 MBeanException,
                       RuntimeOperationsException
Throws:
MBeanException
RuntimeOperationsException
Method Detail

getState

public String getState()
                throws InstanceNotFoundException,
                       RuntimeOperationsException,
                       MBeanException,
                       InvalidTargetObjectTypeException
Implement the state attribute.

Returns:
the current server's state
Throws:
InstanceNotFoundException
RuntimeOperationsException
MBeanException
InvalidTargetObjectTypeException

getResources

public String[] getResources()
                      throws InstanceNotFoundException,
                             RuntimeOperationsException,
                             MBeanException,
                             InvalidTargetObjectTypeException
Implement resources attribute.

Returns:
the list of J2EEResource names in the current server
Throws:
InstanceNotFoundException
RuntimeOperationsException
MBeanException
InvalidTargetObjectTypeException

getServices

public String[] getServices()
                     throws InstanceNotFoundException,
                            RuntimeOperationsException,
                            MBeanException,
                            InvalidTargetObjectTypeException
Implement services attribute.

Returns:
Throws:
InstanceNotFoundException
RuntimeOperationsException
MBeanException
InvalidTargetObjectTypeException

getDeployedObjects

public String[] getDeployedObjects()
                            throws InstanceNotFoundException,
                                   RuntimeOperationsException,
                                   MBeanException,
                                   InvalidTargetObjectTypeException
Implement deployedObjects attribute cf. to JSR77 requirements.

Returns:
Array of OBJECT_NAMEs corresponding to all the deployed modules and apps.
Throws:
InstanceNotFoundException
RuntimeOperationsException
MBeanException
InvalidTargetObjectTypeException

getServiceState

public String getServiceState(String service)
                       throws InstanceNotFoundException,
                              RuntimeOperationsException,
                              MBeanException,
                              InvalidTargetObjectTypeException
Return the state of a given service.

Parameters:
service - name
Returns:
The service state
Throws:
InstanceNotFoundException
RuntimeOperationsException
MBeanException
InvalidTargetObjectTypeException
InvalidTargetObjectTypeExceptio

getExportedPackagesFromPackage

public String getExportedPackagesFromPackage(String packageName)
                                      throws MBeanException,
                                             InstanceNotFoundException,
                                             RuntimeOperationsException,
                                             InvalidTargetObjectTypeException,
                                             TransformerException
Gets the exported packages for a given package name.

Parameters:
packageName - the name of a package or a class
Returns:
the list of exported packages (and bundles exporting it/importing it, etc.)
Throws:
InvalidTargetObjectTypeException - if MBean operation fails
RuntimeOperationsException - if MBean operation fails
InstanceNotFoundException - if MBean operation fails
TransformerException - if XML transformation fails
MBeanException

getExportedPackagesFromClass

public String getExportedPackagesFromClass(String className)
                                    throws MBeanException,
                                           InstanceNotFoundException,
                                           RuntimeOperationsException,
                                           InvalidTargetObjectTypeException,
                                           TransformerException
Gets the exported packages for a given package name.

Parameters:
packageName - the name of a package or a class
Returns:
the list of exported packages (and bundles exporting it/importing it, etc.)
Throws:
InvalidTargetObjectTypeException - if MBean operation fails
RuntimeOperationsException - if MBean operation fails
InstanceNotFoundException - if MBean operation fails
TransformerException - if XML transformation fails
MBeanException

getExportedPackages

public String getExportedPackages(String name,
                                  boolean isClass)
                           throws MBeanException,
                                  InstanceNotFoundException,
                                  RuntimeOperationsException,
                                  InvalidTargetObjectTypeException,
                                  TransformerException
Gets the exported packages for a given package name.

Parameters:
name - the name of a package or a class
boolean - true if it is a class, else false
Returns:
the list of exported packages (and bundles exporting it/importing it, etc.)
Throws:
InvalidTargetObjectTypeException - if MBean operation fails
RuntimeOperationsException - if MBean operation fails
InstanceNotFoundException - if MBean operation fails
TransformerException - if XML transformation fails
MBeanException

loadClass

public String loadClass(String className)
Gets data about loading a given class.

Parameters:
className - the class name
Returns:
a string description for the given class that needs to be loaded

getClassLoaderFilters

public String[] getClassLoaderFilters()
                               throws MBeanException
Gets the system filters of classloaders.

Returns:
the filters for the system classloader
Throws:
MBeanException - if unable to get the system filters

getResources

public URL[] getResources(String resourceName)
                   throws MBeanException
Gets all the URL to the given resource.

Parameters:
resourceName - the name of the resource
Returns:
the list of url, if any
Throws:
MBeanException - if unable to get the resource name

addBundleNode

protected static Element addBundleNode(Document document,
                                       String elementName,
                                       org.osgi.framework.Bundle bundle)
Helper method for writing a bundle element on a given XML element.

Parameters:
document - the document used to create elements
elementName - the element's name
bundle - the given bundle
Returns:
a XML element

addNode

protected static Element addNode(Document document,
                                 String elementName,
                                 String value,
                                 Map<String,String> attributes)
Helper method for writing a new element on a given XML element.

Parameters:
document - the document used to create elements
elementName - the element's name
value - the element's value
attributes - the given attributes to write (if any)
Returns:
a XML element

addNode

protected static Element addNode(Document document,
                                 String elementName,
                                 String value)
Helper method for writing a new element on a given XML element.

Parameters:
document - the document used to create elements
elementName - the element's name
value - the element's value
Returns:
a XML element


Copyright © 2011 OW2 Consortium. All Rights Reserved.