Java Doc for Registry.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.Registry

Registry
public class Registry implements RegistryMBean,MBeanRegistration(Code)
Registry for modeler MBeans. This is the main entry point into modeler. It provides methods to create and manipulate model mbeans and simplify their use. Starting with version 1.1, this is no longer a singleton and the static methods are strongly deprecated. In a container environment we can expect different applications to use different registries. This class is itself an mbean. IMPORTANT: public methods not marked with @since x.x are experimental or internal. Should not be used.
author:
   Craig R. McClanahan
author:
   Costin Manolache


Field Summary
public static  StringMODELER_MANIFEST
     Experimental support for manifest-based discovery.

Constructor Summary
public  Registry()
    

Method Summary
public  voidaddManagedBean(ManagedBean bean)
     Add a new bean metadata to the set of beans known to this registry.
public  ObjectconvertValue(String type, String value)
     EXPERIMENTAL Convert a string to object, based on type.
public  ManagedBeanfindManagedBean(String name)
     Find and return the managed bean definition for the specified bean name, if any; otherwise return null.
Parameters:
  name - Name of the managed bean to be returned.
public  ManagedBeanfindManagedBean(Object bean, Class beanClass, String type)
     Find or load metadata.
public  ManagedBeanfindManagedBean(Class beanClass, String type)
    
public  String[]findManagedBeans()
     Return the set of bean names for all managed beans known to this registry.
public  String[]findManagedBeans(String group)
     Return the set of bean names for all managed beans known to this registry that belong to the specified group.
public synchronized  intgetId(String domain, String name)
     Return an int ID for faster access.
public synchronized  MBeanServergetMBeanServer()
     Factory method to create (if necessary) and return our MBeanServer instance.
public  MBeanOperationInfogetMethodInfo(ObjectName oname, String opName)
    
public static synchronized  RegistrygetRegistry(Object key, Object guard)
     Factory method to create (if necessary) and return our Registry instance. Use this method to obtain a Registry - all other static methods are deprecated and shouldn't be used. The current version uses a static - future versions could use the thread class loader.
Parameters:
  key - Support for application isolation.
public static synchronized  RegistrygetRegistry()
    
public static  MBeanServergetServer()
     Factory method to create (if necessary) and return our MBeanServer instance.
public  StringgetType(ObjectName oname, String attName)
     Get the type of an attribute of the object, from the metadata.
public  voidinvoke(List mbeans, String operation, boolean failFirst)
     Invoke a operation on a list of mbeans.
public  Listload(String sourceType, Object source, String param)
     Experimental.
public  voidloadCachedDescriptors(Object source)
     Load the registry from a cached .ser file.
public synchronized  voidloadDescriptors(String packageName, ClassLoader classLoader)
     Lookup the component descriptor in the package and in the parent packages.
public  voidloadDescriptors(String sourceType, Object source, String param)
     Experimental.
public  voidloadDescriptors(Object source)
     Load the registry from the XML input found in the specified input stream.
Parameters:
  source - Source to be used to load.
public  ListloadMBeans(Object source, ClassLoader cl)
     Load an extended mlet file.
public  ListloadMBeans(Object source)
    
public  voidloadMetadata(Object source)
     Load descriptors.
public static  voidloadRegistry(InputStream stream)
     Load the registry from the XML input found in the specified input stream.
public  voidpostDeregister()
    
public  voidpostRegister(Boolean registrationDone)
    
public  voidpreDeregister()
    
public  ObjectNamepreRegister(MBeanServer server, ObjectName name)
    
public  voidregisterComponent(Object bean, String oname, String type)
     Register a bean by creating a modeler mbean and adding it to the MBeanServer. If metadata is not loaded, we'll look up and read a file named "mbeans-descriptors.ser" or "mbeans-descriptors.xml" in the same package or parent. If the bean is an instance of DynamicMBean.
public  voidregisterComponent(Object bean, ObjectName oname, String type)
    
public  voidregisterComponent(Object bean, String domain, String type, String name)
    
public  voidremoveManagedBean(ManagedBean bean)
     Remove an existing bean from the set of beans known to this registry.
public  voidresetMetadata()
    
public  voidsetGuard(Object guard)
    
public  voidsetMBeanServer(MBeanServer server)
     Set the MBeanServer to be utilized for our registered management beans.
public static  voidsetServer(MBeanServer mbeanServer)
     Set the MBeanServer to be utilized for our registered management beans.
public static  voidsetUseContextClassLoader(boolean enable)
     Allow containers to isolate apps.
public  voidstop()
     Lifecycle method - clean up the registry metadata.
public  voidunregisterComponent(String oname)
     Unregister a component.
public  voidunregisterComponent(ObjectName oname)
     Unregister a component.
public  voidunregisterComponent(String domain, String name)
    
public  voidunregisterRegistry(ClassLoader loader)
    

Field Detail
MODELER_MANIFEST
public static String MODELER_MANIFEST(Code)
Experimental support for manifest-based discovery.




Constructor Detail
Registry
public Registry()(Code)




Method Detail
addManagedBean
public void addManagedBean(ManagedBean bean)(Code)
Add a new bean metadata to the set of beans known to this registry. This is used by internal components.
Parameters:
  bean - The managed bean to be added
since:
   1.0



convertValue
public Object convertValue(String type, String value)(Code)
EXPERIMENTAL Convert a string to object, based on type. Used by several components. We could provide some pluggability. It is here to keep things consistent and avoid duplication in other tasks
Parameters:
  type - Fully qualified class name of the resulting value
Parameters:
  value - String value to be converted Converted value



findManagedBean
public ManagedBean findManagedBean(String name)(Code)
Find and return the managed bean definition for the specified bean name, if any; otherwise return null.
Parameters:
  name - Name of the managed bean to be returned. Since 1.1, bothshort names or the full name of the class can be used.
since:
   1.0



findManagedBean
public ManagedBean findManagedBean(Object bean, Class beanClass, String type) throws Exception(Code)
Find or load metadata.



findManagedBean
public ManagedBean findManagedBean(Class beanClass, String type) throws Exception(Code)



findManagedBeans
public String[] findManagedBeans()(Code)
Return the set of bean names for all managed beans known to this registry.
since:
   1.0



findManagedBeans
public String[] findManagedBeans(String group)(Code)
Return the set of bean names for all managed beans known to this registry that belong to the specified group.
Parameters:
  group - Name of the group of interest, or nullto select beans that do not belong to a group
since:
   1.0



getId
public synchronized int getId(String domain, String name)(Code)
Return an int ID for faster access. Will be used for notifications and for other operations we want to optimize.
Parameters:
  domain - Namespace
Parameters:
  name - Type of the notification An unique id for the domain:name combination
since:
   1.1



getMBeanServer
public synchronized MBeanServer getMBeanServer()(Code)
Factory method to create (if necessary) and return our MBeanServer instance.



getMethodInfo
public MBeanOperationInfo getMethodInfo(ObjectName oname, String opName)(Code)
Find the operation info for a method
Parameters:
  oname -
Parameters:
  opName - the operation info for the specified operation



getRegistry
public static synchronized Registry getRegistry(Object key, Object guard)(Code)
Factory method to create (if necessary) and return our Registry instance. Use this method to obtain a Registry - all other static methods are deprecated and shouldn't be used. The current version uses a static - future versions could use the thread class loader.
Parameters:
  key - Support for application isolation. If null, the context classloader will be used ( if setUseContextClassLoader is called ) or the default registry is returned.
Parameters:
  guard - Prevent access to the registry by untrusted components
since:
   1.1



getRegistry
public static synchronized Registry getRegistry()(Code)
Get a "singelton" registry, or one per thread if setUseContextLoader was called
since:
   1.0



getServer
public static MBeanServer getServer()(Code)
Factory method to create (if necessary) and return our MBeanServer instance.
since:
   1.0



getType
public String getType(ObjectName oname, String attName)(Code)
Get the type of an attribute of the object, from the metadata.
Parameters:
  oname -
Parameters:
  attName - null if metadata about the attribute is not found
since:
   1.1



invoke
public void invoke(List mbeans, String operation, boolean failFirst) throws Exception(Code)
Invoke a operation on a list of mbeans. Can be used to implement lifecycle operations.
Parameters:
  mbeans - list of ObjectName on which we'll invoke the operations
Parameters:
  operation - Name of the operation ( init, start, stop, etc)
Parameters:
  failFirst - If false, exceptions will be ignored
throws:
  Exception -
since:
   1.1



load
public List load(String sourceType, Object source, String param) throws Exception(Code)
Experimental.
Parameters:
  sourceType -
Parameters:
  source -
Parameters:
  param - List of descriptors
throws:
  Exception -



loadCachedDescriptors
public void loadCachedDescriptors(Object source) throws Exception(Code)
Load the registry from a cached .ser file. This is typically 2-3 times faster than parsing the XML.
Parameters:
  source - Source to be used to load. Can be an InputStream or URL.
exception:
  Exception - if any parsing or processing error occurs



loadDescriptors
public synchronized void loadDescriptors(String packageName, ClassLoader classLoader)(Code)
Lookup the component descriptor in the package and in the parent packages.
Parameters:
  packageName -



loadDescriptors
public void loadDescriptors(String sourceType, Object source, String param) throws Exception(Code)
Experimental. Will become private, some code may still use it
Parameters:
  sourceType -
Parameters:
  source -
Parameters:
  param -
throws:
  Exception -



loadDescriptors
public void loadDescriptors(Object source) throws Exception(Code)
Load the registry from the XML input found in the specified input stream.
Parameters:
  source - Source to be used to load. Can be an InputStream or URL.
exception:
  Exception - if any parsing or processing error occurs



loadMBeans
public List loadMBeans(Object source, ClassLoader cl) throws Exception(Code)
Load an extended mlet file. The source can be an URL, File or InputStream. All mbeans will be instantiated, registered and the attributes will be set. The result is a list of ObjectNames.
Parameters:
  source - InputStream or URL of the file
Parameters:
  cl - ClassLoader to be used to load the mbeans, or null to use thedefault JMX mechanism ( i.e. all registered loaders ) List of ObjectName for the loaded mbeans
throws:
  Exception -
since:
   1.1



loadMBeans
public List loadMBeans(Object source) throws Exception(Code)



loadMetadata
public void loadMetadata(Object source) throws Exception(Code)
Load descriptors. The source can be a File or URL or InputStream for the descriptors file. In the case of File and URL, if the extension is ".ser" a serialized version will be loaded. Also ( experimental for now ) a ClassLoader - in which case META-INF/ will be used. This method should be used to explicitely load metadata - but this is not required in most cases. The registerComponent() method will find metadata in the same pacakge.
Parameters:
  source -



loadRegistry
public static void loadRegistry(InputStream stream) throws Exception(Code)
Load the registry from the XML input found in the specified input stream.
Parameters:
  stream - InputStream containing the registry configurationinformation
exception:
  Exception - if any parsing or processing error occurs
since:
   1.0



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)



registerComponent
public void registerComponent(Object bean, String oname, String type) throws Exception(Code)
Register a bean by creating a modeler mbean and adding it to the MBeanServer. If metadata is not loaded, we'll look up and read a file named "mbeans-descriptors.ser" or "mbeans-descriptors.xml" in the same package or parent. If the bean is an instance of DynamicMBean. it's metadata will be converted to a model mbean and we'll wrap it - so modeler services will be supported If the metadata is still not found, introspection will be used to extract it automatically. If an mbean is already registered under this name, it'll be first unregistered. If the component implements MBeanRegistration, the methods will be called. If the method has a method "setRegistry" that takes a RegistryMBean as parameter, it'll be called with the current registry.
Parameters:
  bean - Object to be registered
Parameters:
  oname - Name used for registration
Parameters:
  type - The type of the mbean, as declared in mbeans-descriptors. Ifnull, the name of the class will be used. This can be used as a hint orby subclasses.
since:
   1.1



registerComponent
public void registerComponent(Object bean, ObjectName oname, String type) throws Exception(Code)
Register a component XXX make it private
Parameters:
  bean -
Parameters:
  oname -
Parameters:
  type -
throws:
  Exception -



registerComponent
public void registerComponent(Object bean, String domain, String type, String name) throws Exception(Code)



removeManagedBean
public void removeManagedBean(ManagedBean bean)(Code)
Remove an existing bean from the set of beans known to this registry.
Parameters:
  bean - The managed bean to be removed
since:
   1.0



resetMetadata
public void resetMetadata()(Code)



setGuard
public void setGuard(Object guard)(Code)
Set a guard object that will prevent access to this registry by unauthorized components
Parameters:
  guard -
since:
   1.1



setMBeanServer
public void setMBeanServer(MBeanServer server)(Code)
Set the MBeanServer to be utilized for our registered management beans.
Parameters:
  server - The new MBeanServer instance



setServer
public static void setServer(MBeanServer mbeanServer)(Code)
Set the MBeanServer to be utilized for our registered management beans.
Parameters:
  mbeanServer - The new MBeanServer instance
since:
   1.0



setUseContextClassLoader
public static void setUseContextClassLoader(boolean enable)(Code)
Allow containers to isolate apps. Can be called only once. It is highly recommended you call this method if using Registry in a container environment. The default is false for backward compatibility
Parameters:
  enable -
since:
   1.1



stop
public void stop()(Code)
Lifecycle method - clean up the registry metadata.
since:
   1.1



unregisterComponent
public void unregisterComponent(String oname)(Code)
Unregister a component. We'll first check if it is registered, and mask all errors. This is mostly a helper.
Parameters:
  oname -
since:
   1.1



unregisterComponent
public void unregisterComponent(ObjectName oname)(Code)
Unregister a component. This is just a helper that avoids exceptions by checking if the mbean is already registered
Parameters:
  oname -



unregisterComponent
public void unregisterComponent(String domain, String name)(Code)



unregisterRegistry
public void unregisterRegistry(ClassLoader loader)(Code)
Called by a registry or by the container to unload a loader
Parameters:
  loader -



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.