Java Doc for BaseModelMBean.java in  » Library » Apache-commons-modeler-2.0.1-src » org » apache » commons » modeler » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Library » Apache commons modeler 2.0.1 src » org.apache.commons.modeler 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.apache.commons.modeler.BaseModelMBean

All known Subclasses:   org.apache.commons.modeler.mbeans.MBeanProxy,  org.apache.commons.modeler.JndiJmx,
BaseModelMBean
public class BaseModelMBean implements ModelMBean,MBeanRegistration(Code)

Basic implementation of the ModelMBean interface, which supports the minimal requirements of the interface contract.

This can be used directly to wrap an existing java bean, or inside an mlet or anywhere an MBean would be used. The String parameter passed to the constructor will be used to construct an instance of the real object that we wrap. Limitations:

  • Only managed resources of type objectReference are supportd.
  • Caching of attribute values and operation results is not supported. All calls to invoke() are immediately executed.
  • Logging (under control of descriptors) is not supported.
  • Persistence of MBean attributes and operations is not supported.
  • All classes referenced as attribute types, operation parameters, or operation return values must be one of the following:
    • One of the Java primitive types (boolean, byte, char, double, float, integer, long, short). Corresponding value will be wrapped in the appropriate wrapper class automatically.
    • Operations that return no value should declare a return type of void.
  • Attribute caching is not supported

author:
   Craig R. McClanahan
author:
   Costin Manolache
version:
   $Revision: 480402 $ $Date: 2006-11-29 04:43:23 +0000 (Wed, 29 Nov 2006) $

Inner Class :static class MethodKey

Field Summary
final static  Object[]NO_ARGS_PARAM
    
final static  Class[]NO_ARGS_PARAM_SIG
    
protected  BaseNotificationBroadcasterattributeBroadcaster
     Notification broadcaster for attribute changes.
protected  HashMapattributes
     Attribute values.
protected  BaseNotificationBroadcastergeneralBroadcaster
     Notification broadcaster for general notifications.
protected  ModelMBeanInfoinfo
     The ModelMBeanInfo object that controls our activity.
protected  ObjectNameoname
    
protected  Registryregistry
    
protected  Objectresource
     The managed resource this MBean is associated with (if any).
protected  StringresourceType
    
protected  ModelerSourcesource
     Source object used to read this mbean.

Constructor Summary
public  BaseModelMBean()
     Construct a ModelMBean with default ModelMBeanInfo information.
public  BaseModelMBean(ModelMBeanInfo info)
     Construct a ModelMBean associated with the specified ModelMBeanInfo information.
public  BaseModelMBean(String type)
     Construct a ModelMBean of a specified type.
public  BaseModelMBean(String type, ModelerSource source)
    

Method Summary
public  voidaddAttributeChangeNotificationListener(NotificationListener listener, String name, Object handback)
     Add an attribute change notification event listener to this MBean.
public  voidaddNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
     Add a notification event listener to this MBean.
protected  ModelMBeanInfocreateDefaultModelMBeanInfo()
     Create and return a default ModelMBeanInfo object.
protected  voidcreateResource()
     Set the type of the mbean.
public  ObjectgetAttribute(String name)
     Obtain and return the value of a specific attribute of this MBean.
public  AttributeListgetAttributes(String names)
     Obtain and return the values of several attributes of this MBean.
public  StringgetClassName()
    
public  ObjectNamegetJmxName()
    
public  MBeanInfogetMBeanInfo()
     Return the MBeanInfo object for this MBean.
public  ObjectgetManagedResource()
     Get the instance handle of the object against which we execute all methods in this ModelMBean management interface.
public  StringgetModelerType()
    
public  MBeanNotificationInfo[]getNotificationInfo()
     Return an MBeanNotificationInfo object describing the notifications sent by this MBean.
public  StringgetObjectName()
    
public  RegistrygetRegistry()
    
protected  voidinitModelInfo(String type)
     Set the type of the mbean.
public  Objectinvoke(String name, Object params, String signature)
     Invoke a particular method on this MBean, and return any returned value.
protected  booleanisModelMBeanInfoValid(ModelMBeanInfo info)
    
public  voidload()
     Instantiates this MBean instance from data found in the persistent store.
public  voidpostDeregister()
    
public  voidpostRegister(Boolean registrationDone)
    
public  voidpreDeregister()
    
public  ObjectNamepreRegister(MBeanServer server, ObjectName name)
    
public  voidremoveAttributeChangeNotificationListener(NotificationListener listener, String name)
     Remove an attribute change notification event listener from this MBean.
public  voidremoveAttributeChangeNotificationListener(NotificationListener listener, String attributeName, Object handback)
     Remove an attribute change notification event listener from this MBean.
public  voidremoveNotificationListener(NotificationListener listener)
     Remove a notification event listener from this MBean.
public  voidremoveNotificationListener(NotificationListener listener, Object handback)
     Remove a notification event listener from this MBean.
public  voidremoveNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback)
     Remove a notification event listener from this MBean.
public  voidsendAttributeChangeNotification(AttributeChangeNotification notification)
     Send an AttributeChangeNotification to all registered listeners.
public  voidsendAttributeChangeNotification(Attribute oldValue, Attribute newValue)
     Send an AttributeChangeNotification to all registered listeners.
public  voidsendNotification(Notification notification)
     Send a Notification to all registered listeners as a jmx.modelmbean.general notification.
public  voidsendNotification(String message)
     Send a Notification which contains the specified string as a jmx.modelmbean.generic notification.
public  voidsetAttribute(Attribute attribute)
     Set the value of a specific attribute of this MBean.
public  AttributeListsetAttributes(AttributeList attributes)
     Set the values of several attributes of this MBean.
public  voidsetManagedResource(Object resource, String type)
     Set the instance handle of the object against which we will execute all methods in this ModelMBean management interface. This method will detect and call "setModelMbean" method.
public  voidsetModelMBeanInfo(ModelMBeanInfo info)
     Initialize the ModelMBeanInfo associated with this ModelMBean.
public  voidsetModeledType(String type)
     Set the type of the mbean.
public  voidsetRegistry(Registry registry)
    
public  voidstore()
     Capture the current state of this MBean instance and write it out to the persistent store.
public  StringtoString()
    

Field Detail
NO_ARGS_PARAM
final static Object[] NO_ARGS_PARAM(Code)



NO_ARGS_PARAM_SIG
final static Class[] NO_ARGS_PARAM_SIG(Code)



attributeBroadcaster
protected BaseNotificationBroadcaster attributeBroadcaster(Code)
Notification broadcaster for attribute changes.



attributes
protected HashMap attributes(Code)
Attribute values. XXX That can be stored in the value Field



generalBroadcaster
protected BaseNotificationBroadcaster generalBroadcaster(Code)
Notification broadcaster for general notifications.



info
protected ModelMBeanInfo info(Code)
The ModelMBeanInfo object that controls our activity.



oname
protected ObjectName oname(Code)



registry
protected Registry registry(Code)
Registry we are associated with



resource
protected Object resource(Code)
The managed resource this MBean is associated with (if any).



resourceType
protected String resourceType(Code)



source
protected ModelerSource source(Code)
Source object used to read this mbean. Can be used to persist the mbean




Constructor Detail
BaseModelMBean
public BaseModelMBean() throws MBeanException, RuntimeOperationsException(Code)
Construct a ModelMBean with default ModelMBeanInfo information.
exception:
  MBeanException - if the initializer of an objectthrows an exception
exception:
  RuntimeOperationsException - if an IllegalArgumentExceptionoccurs



BaseModelMBean
public BaseModelMBean(ModelMBeanInfo info) throws MBeanException, RuntimeOperationsException(Code)
Construct a ModelMBean associated with the specified ModelMBeanInfo information.
Parameters:
  info - ModelMBeanInfo for this MBean
exception:
  MBeanException - if the initializer of an objectthrows an exception
exception:
  RuntimeOperationsException - if an IllegalArgumentExceptionoccurs



BaseModelMBean
public BaseModelMBean(String type) throws MBeanException, RuntimeOperationsException(Code)
Construct a ModelMBean of a specified type. The type can be a class name or the key used in one of the descriptors. If no descriptor is available, we'll first try to locate one in the same package with the class, then use introspection. The mbean resource will be created.
Parameters:
  type - Class name or the type key used in the descriptor.
throws:
  MBeanException -
throws:
  RuntimeOperationsException -



BaseModelMBean
public BaseModelMBean(String type, ModelerSource source) throws MBeanException, RuntimeOperationsException(Code)




Method Detail
addAttributeChangeNotificationListener
public void addAttributeChangeNotificationListener(NotificationListener listener, String name, Object handback) throws IllegalArgumentException(Code)
Add an attribute change notification event listener to this MBean.
Parameters:
  listener - Listener that will receive event notifications
Parameters:
  name - Name of the attribute of interest, or nullto indicate interest in all attributes
Parameters:
  handback - Handback object to be sent along with eventnotifications
exception:
  IllegalArgumentException - if the listener parameter is null



addNotificationListener
public void addNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws IllegalArgumentException(Code)
Add a notification event listener to this MBean.
Parameters:
  listener - Listener that will receive event notifications
Parameters:
  filter - Filter object used to filter event notificationsactually delivered, or null for no filtering
Parameters:
  handback - Handback object to be sent along with eventnotifications
exception:
  IllegalArgumentException - if the listener parameter is null



createDefaultModelMBeanInfo
protected ModelMBeanInfo createDefaultModelMBeanInfo()(Code)
Create and return a default ModelMBeanInfo object.



createResource
protected void createResource()(Code)
Set the type of the mbean. This is used as a key to locate the description in the Registry.



getAttribute
public Object getAttribute(String name) throws AttributeNotFoundException, MBeanException, ReflectionException(Code)
Obtain and return the value of a specific attribute of this MBean.
Parameters:
  name - Name of the requested attribute
exception:
  AttributeNotFoundException - if this attribute is notsupported by this MBean
exception:
  MBeanException - if the initializer of an objectthrows an exception
exception:
  ReflectionException - if a Java reflection exceptionoccurs when invoking the getter



getAttributes
public AttributeList getAttributes(String names)(Code)
Obtain and return the values of several attributes of this MBean.
Parameters:
  names - Names of the requested attributes



getClassName
public String getClassName()(Code)



getJmxName
public ObjectName getJmxName()(Code)



getMBeanInfo
public MBeanInfo getMBeanInfo()(Code)
Return the MBeanInfo object for this MBean.



getManagedResource
public Object getManagedResource() throws InstanceNotFoundException, InvalidTargetObjectTypeException, MBeanException, RuntimeOperationsException(Code)
Get the instance handle of the object against which we execute all methods in this ModelMBean management interface.
exception:
  InstanceNotFoundException - if the managed resource objectcannot be found
exception:
  MBeanException - if the initializer of the object throwsan exception
exception:
  RuntimeOperationsException - if the managed resource or theresource type is null or invalid



getModelerType
public String getModelerType()(Code)



getNotificationInfo
public MBeanNotificationInfo[] getNotificationInfo()(Code)
Return an MBeanNotificationInfo object describing the notifications sent by this MBean.



getObjectName
public String getObjectName()(Code)



getRegistry
public Registry getRegistry()(Code)



initModelInfo
protected void initModelInfo(String type)(Code)
Set the type of the mbean. This is used as a key to locate the description in the Registry.
Parameters:
  type - the type of classname of the modeled object



invoke
public Object invoke(String name, Object params, String signature) throws MBeanException, ReflectionException(Code)
Invoke a particular method on this MBean, and return any returned value.

IMPLEMENTATION NOTE - This implementation will attempt to invoke this method on the MBean itself, or (if not available) on the managed resource object associated with this MBean.


Parameters:
  name - Name of the operation to be invoked
Parameters:
  params - Array containing the method parameters of this operation
Parameters:
  signature - Array containing the class names representingthe signature of this operation
exception:
  MBeanException - if the initializer of an objectthrows an exception
exception:
  ReflectioNException - if a Java reflection exceptionoccurs when invoking a method



isModelMBeanInfoValid
protected boolean isModelMBeanInfoValid(ModelMBeanInfo info)(Code)
Is the specified ModelMBeanInfo instance valid?

IMPLEMENTATION NOTE - This implementation does not check anything, but this method can be overridden as required.


Parameters:
  info - The ModelMBeanInfo object to check



load
public void load() throws InstanceNotFoundException, MBeanException, RuntimeOperationsException(Code)
Instantiates this MBean instance from data found in the persistent store. The data loaded could include attribute and operation values. This method should be called during construction or initialization of the instance, and before the MBean is registered with the MBeanServer.

IMPLEMENTATION NOTE - This implementation does not support persistence.


exception:
  InstanceNotFoundException - if the managed resource objectcannot be found
exception:
  MBeanException - if the initializer of the object throwsan exception
exception:
  RuntimeOperationsException - if an exception is reportedby the persistence mechanism



postDeregister
public void postDeregister()(Code)



postRegister
public void postRegister(Boolean registrationDone)(Code)



preDeregister
public void preDeregister() throws Exception(Code)



preRegister
public ObjectName preRegister(MBeanServer server, ObjectName name) throws Exception(Code)



removeAttributeChangeNotificationListener
public void removeAttributeChangeNotificationListener(NotificationListener listener, String name) throws ListenerNotFoundException(Code)
Remove an attribute change notification event listener from this MBean.
Parameters:
  listener - The listener to be removed
Parameters:
  name - The attribute name for which no more events are required
exception:
  ListenerNotFoundException - if this listener is notregistered in the MBean



removeAttributeChangeNotificationListener
public void removeAttributeChangeNotificationListener(NotificationListener listener, String attributeName, Object handback) throws ListenerNotFoundException(Code)
Remove an attribute change notification event listener from this MBean.
Parameters:
  listener - The listener to be removed
Parameters:
  attributeName - The attribute name for which no more events are required
Parameters:
  handback - Handback object to be sent along with eventnotifications
exception:
  ListenerNotFoundException - if this listener is notregistered in the MBean



removeNotificationListener
public void removeNotificationListener(NotificationListener listener) throws ListenerNotFoundException(Code)
Remove a notification event listener from this MBean.
Parameters:
  listener - The listener to be removed (any and all registrationsfor this listener will be eliminated)
exception:
  ListenerNotFoundException - if this listener is notregistered in the MBean



removeNotificationListener
public void removeNotificationListener(NotificationListener listener, Object handback) throws ListenerNotFoundException(Code)
Remove a notification event listener from this MBean.
Parameters:
  listener - The listener to be removed (any and all registrationsfor this listener will be eliminated)
Parameters:
  handback - Handback object to be sent along with eventnotifications
exception:
  ListenerNotFoundException - if this listener is notregistered in the MBean



removeNotificationListener
public void removeNotificationListener(NotificationListener listener, NotificationFilter filter, Object handback) throws ListenerNotFoundException(Code)
Remove a notification event listener from this MBean.
Parameters:
  listener - The listener to be removed (any and all registrationsfor this listener will be eliminated)
Parameters:
  filter - Filter object used to filter event notificationsactually delivered, or null for no filtering
Parameters:
  handback - Handback object to be sent along with eventnotifications
exception:
  ListenerNotFoundException - if this listener is notregistered in the MBean



sendAttributeChangeNotification
public void sendAttributeChangeNotification(AttributeChangeNotification notification) throws MBeanException, RuntimeOperationsException(Code)
Send an AttributeChangeNotification to all registered listeners.
Parameters:
  notification - The AttributeChangeNotificationthat will be passed
exception:
  MBeanException - if an object initializer throws anexception
exception:
  RuntimeOperationsException - wraps IllegalArgumentExceptionwhen the specified notification is null or invalid



sendAttributeChangeNotification
public void sendAttributeChangeNotification(Attribute oldValue, Attribute newValue) throws MBeanException, RuntimeOperationsException(Code)
Send an AttributeChangeNotification to all registered listeners.
Parameters:
  oldValue - The original value of the Attribute
Parameters:
  newValue - The new value of the Attribute
exception:
  MBeanException - if an object initializer throws anexception
exception:
  RuntimeOperationsException - wraps IllegalArgumentExceptionwhen the specified notification is null or invalid



sendNotification
public void sendNotification(Notification notification) throws MBeanException, RuntimeOperationsException(Code)
Send a Notification to all registered listeners as a jmx.modelmbean.general notification.
Parameters:
  notification - The Notification that will be passed
exception:
  MBeanException - if an object initializer throws anexception
exception:
  RuntimeOperationsException - wraps IllegalArgumentExceptionwhen the specified notification is null or invalid



sendNotification
public void sendNotification(String message) throws MBeanException, RuntimeOperationsException(Code)
Send a Notification which contains the specified string as a jmx.modelmbean.generic notification.
Parameters:
  message - The message string to be passed
exception:
  MBeanException - if an object initializer throws anexception
exception:
  RuntimeOperationsException - wraps IllegalArgumentExceptionwhen the specified notification is null or invalid



setAttribute
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, MBeanException, ReflectionException(Code)
Set the value of a specific attribute of this MBean.
Parameters:
  attribute - The identification of the attribute to be setand the new value
exception:
  AttributeNotFoundException - if this attribute is notsupported by this MBean
exception:
  MBeanException - if the initializer of an objectthrows an exception
exception:
  ReflectionException - if a Java reflection exceptionoccurs when invoking the getter



setAttributes
public AttributeList setAttributes(AttributeList attributes)(Code)
Set the values of several attributes of this MBean.
Parameters:
  attributes - THe names and values to be set The list of attributes that were set and their new values



setManagedResource
public void setManagedResource(Object resource, String type) throws InstanceNotFoundException, InvalidTargetObjectTypeException, MBeanException, RuntimeOperationsException(Code)
Set the instance handle of the object against which we will execute all methods in this ModelMBean management interface. This method will detect and call "setModelMbean" method. A resource can implement this method to get a reference to the model mbean. The reference can be used to send notification and access the registry.
Parameters:
  resource - The resource object to be managed
Parameters:
  type - The type of reference for the managed resource("ObjectReference", "Handle", "IOR", "EJBHandle", or"RMIReference")
exception:
  InstanceNotFoundException - if the managed resource objectcannot be found
exception:
  InvalidTargetObjectTypeException - if this ModelMBean isasked to handle a reference type it cannot deal with
exception:
  MBeanException - if the initializer of the object throwsan exception
exception:
  RuntimeOperationsException - if the managed resource or theresource type is null or invalid



setModelMBeanInfo
public void setModelMBeanInfo(ModelMBeanInfo info) throws MBeanException, RuntimeOperationsException(Code)
Initialize the ModelMBeanInfo associated with this ModelMBean. After the information and associated descriptors have been customized, the ModelMBean should be registered with the associated MBeanServer. Currently the model can be set after registration. This behavior is deprecated and won't be supported in future versions.
Parameters:
  info - The ModelMBeanInfo object to be used by this ModelMBean
exception:
  MBeanException - If an exception occurs recording thisModelMBeanInfo information
exception:
  RuntimeOperations - if the specified parameter isnull or invalid



setModeledType
public void setModeledType(String type)(Code)
Set the type of the mbean. This is used as a key to locate the description in the Registry.
Parameters:
  type - the type of classname of the modeled object



setRegistry
public void setRegistry(Registry registry)(Code)



store
public void store() throws InstanceNotFoundException, MBeanException, RuntimeOperationsException(Code)
Capture the current state of this MBean instance and write it out to the persistent store. The state stored could include attribute and operation values. If one of these methods of persistence is not supported, a "service not found" exception will be thrown.

IMPLEMENTATION NOTE - This implementation does not support persistence.


exception:
  InstanceNotFoundException - if the managed resource objectcannot be found
exception:
  MBeanException - if the initializer of the object throwsan exception, or persistence is not supported
exception:
  RuntimeOperationsException - if an exception is reportedby the persistence mechanism



toString
public String toString()(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.