Java Doc for I18NStandardMBean.java in  » JMX » mx4j » mx4j » tools » i18n » 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 » JMX » mx4j » mx4j.tools.i18n 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.management.StandardMBean
      mx4j.tools.i18n.I18NStandardMBean

I18NStandardMBean
public class I18NStandardMBean extends StandardMBean (Code)
An extension of StandardMBean to support internationalization.

The I18N information is taken from a property bundle named MyImplMBeanResources where "MyImpl" is the fully qualified class implementing the MBean.

These bundles are nested following the class hierachy of the implementation class. This means that a superclass of the real implementing class can define the resource bundle for the common attributes and operations.

The resource bundle naming rules defined by java.util.ResourceBundle are used; in particular :

  • If a class called MyPackage.MyImplMBeanResources_localInfo exists it is used (programmatic methd)
  • Otherwise the file called MyPackage.MyImplMBeanResources_localInfo.properties is used.

localInfo consists of one or more sections of "language_country_variant" (eg en_GB or fr_FR).

The locale to be used is determined by one of the following mechanisms (in this order)

  • The locale object explicitly passed to the constructor (if not null)
  • The static method I18NStandardMBean.setDefaultLocale
  • The system property "mx4j.descriptionLocale"
  • The current system default locale

The bundle should contain keys as described below :

Global bean description

The global bean description is given by the single key "descr":
 descr=The MBean Description
 

Attributes

Attribute desciptions are given by keys of form "attr.Name" where Name is the attribute name (the method name minus the get/set prefix) :
 attr.Counter=The counter
 

Constructors

Non ambiguous case

All constructors having a different number of arguments may be described in this way:
 cons.N=desciption of constructor N
 cons.N.param.1=Description of first parameter of constructor N
 cons.N.paramName.1=paramName1
 cons.N.param.2=Description of first parameter of constructor N
 cons.N.paramName.2=paramName2
 
Where N is a sequential number starting at one.

Ambiguous case

Where several constructors exist with the same number of arguments an explicit signature must be given. The signature is a comma separated list of class descriptions (as returned by java.lang.Class.getName and has the key cons.N.sig :
 cons.N.sig=int,java.lang.Object
 cons.N.param.1=The int parameter
 cons.N.param.2=The Object parameter
 

Operations

No overloading

When no overloaded versions of an operation exist (same method name but different parameters) the simplest case shown below can be used :
 op.operationName=The description
 op.operationName.param.1=The first parameter
 op.operationName.paramName.1=param1
 

Non ambiguous overloading case

When operation overloading is used but the overloaded versions differ in the number of parameters the format below can be used :
 op.operationName.1=The first version of operationName
 op.operationName.1.param.1=parameter for first version
 op.operationName.1.paramName.1=param1
 op.operationName.2=The second version of operationName
 op.operationName.2.paramName.1=param1
 op.operationName.2.param.1=first parameter for second version
 op.operationName.2.param.2=second parameter for second version
 op.operationName.2.paramName.2=param2
 

Ambiguous overloading case

When operations with the same name have the same number of arguments an explicit signature must be used :
 op.operationName.1.sig=int
 op.operationName.1=The first version of operationName (takes int)
 op.operationName.1.param.1=parameter for first version
 op.operationName.1.paramName.1=param1
 op.operationName.2.sig=java.lang.Object
 op.operationName.2=The second version of operationName (take Object)
 op.operationName.2.paramName.1=param1
 op.operationName.2.param.1=first parameter for second version
 

Restrictions

Parameter names must only contain characters allowed in a Java identifier (in particular spaces are not allowed). This is required by the JMX specifications. No such restrictions exist for the other descriptions.

Behaviour with missing data

If no resource bunde exists for the MBean a java.util.MissingResourceException will be thrown by the constructor.

If the resouce bundle is found but the bean description, constructor description or parameter name is missing the String "??(key)" will be returned instead (eg "??(op.myOperation)".

If a paramName key is missing (for constructor or operation) the version normally given by StandardMBean is used (generally "pN").

If a non ambiguous description cannot be determined the fixed (non translatable) descriptions "ambiguous constructor", "parameter for ambiguous constructor", "ambiguous operation", "parameter for ambiguous operation" are returned.




Constructor Summary
public  I18NStandardMBean(Object implementation, Class mbeanInterface)
     Makes an I18NStandardMBean for the default locale with a separate implementation class.
public  I18NStandardMBean(Object implementation, Class mbeanInterface, Locale locale)
     Makes an I18NStandardMBean for the given locale with a separate implementation class.
protected  I18NStandardMBean(Class mbeanInterface)
     Makes a I18NStandardMBean for the default locale implemented by a subclass.
protected  I18NStandardMBean(Class mbeanInterface, Locale locale)
     Makes a I18NStandardMBean for the given locale implemented by a subclass.

Method Summary
protected  voidcacheMBeanInfo(MBeanInfo info)
     Once the MBeanInfo has been obtained discard our caches.
protected  MBeanInfogetCachedMBeanInfo()
     Initialise internal data structures.
protected  MBeanConstructorInfo[]getConstructors(MBeanConstructorInfo[] cstrs, Object impl)
    
protected  StringgetDescription(MBeanInfo info)
     Obtain global description for MBean.
protected  StringgetDescription(MBeanConstructorInfo cstr)
     Obtain the constructor description.
protected  StringgetDescription(MBeanConstructorInfo cstr, MBeanParameterInfo param, int seq)
     Obtain the constructor parameter description.
protected  StringgetDescription(MBeanAttributeInfo attr)
     Obtain the attribute description.
protected  StringgetDescription(MBeanOperationInfo op)
     Obtain the operation description.
protected  StringgetDescription(MBeanOperationInfo op, MBeanParameterInfo param, int seq)
     Obtain the operation parameter description.
protected  StringgetParameterName(MBeanConstructorInfo cstr, MBeanParameterInfo param, int seq)
     Obtain constructor parameter name.
protected  StringgetParameterName(MBeanOperationInfo op, MBeanParameterInfo param, int seq)
     Obtain operation parameter name.
public static  voidsetDefaultLocale(Locale locale)
     Set the locale which will be used for future I18NStandardMBeans.


Constructor Detail
I18NStandardMBean
public I18NStandardMBean(Object implementation, Class mbeanInterface) throws NotCompliantMBeanException(Code)
Makes an I18NStandardMBean for the default locale with a separate implementation class.
See Also:   javax.management.StandardMBean.StandardMBean(java.lang.Objectjava.lang.Class)



I18NStandardMBean
public I18NStandardMBean(Object implementation, Class mbeanInterface, Locale locale) throws NotCompliantMBeanException(Code)
Makes an I18NStandardMBean for the given locale with a separate implementation class.
See Also:   javax.management.StandardMBean.StandardMBean(java.lang.Objectjava.lang.Class)



I18NStandardMBean
protected I18NStandardMBean(Class mbeanInterface) throws NotCompliantMBeanException(Code)
Makes a I18NStandardMBean for the default locale implemented by a subclass.
See Also:   javax.management.StandardMBean.StandardMBean(java.lang.Class)



I18NStandardMBean
protected I18NStandardMBean(Class mbeanInterface, Locale locale) throws NotCompliantMBeanException(Code)
Makes a I18NStandardMBean for the given locale implemented by a subclass.
See Also:   javax.management.StandardMBean.StandardMBean(java.lang.Class)




Method Detail
cacheMBeanInfo
protected void cacheMBeanInfo(MBeanInfo info)(Code)
Once the MBeanInfo has been obtained discard our caches.
See Also:   javax.management.StandardMBean.cacheMBeanInfo(javax.management.MBeanInfo)



getCachedMBeanInfo
protected MBeanInfo getCachedMBeanInfo()(Code)
Initialise internal data structures.

This method is always called first during getMBeanInfo processing. We use this to avoid keeping all our internal Maps in memory too long.
See Also:   javax.management.StandardMBean.getCachedMBeanInfo




getConstructors
protected MBeanConstructorInfo[] getConstructors(MBeanConstructorInfo[] cstrs, Object impl)(Code)



getDescription
protected String getDescription(MBeanInfo info)(Code)
Obtain global description for MBean.

Taken from "descr" key in resource bundle.

Also performs internal initialisations requiring the MBeanInfo obtained by introspection. Therefore the superclass must call this method BEFORE the other hooks.
See Also:   javax.management.StandardMBean.getDescription(javax.management.MBeanInfo)




getDescription
protected String getDescription(MBeanConstructorInfo cstr)(Code)
Obtain the constructor description.

Taken from "cons.N" key in resource bundle.

Maybe "ambiguous constructor" if correct index cannot be determined by an explicit signature or parameter counts.
See Also:   javax.management.StandardMBean.getDescription(javax.management.MBeanConstructorInfo)




getDescription
protected String getDescription(MBeanConstructorInfo cstr, MBeanParameterInfo param, int seq)(Code)
Obtain the constructor parameter description.

Taken from "cons.N.param.seq" key in resource bundle.

Maybe "parameter for ambiguous constructor" if correct index cannot be determined by an explicit signature or parameter counts.
See Also:   javax.management.StandardMBean.getDescription(javax.management.MBeanConstructorInfojavax.management.MBeanParameterInfoint)




getDescription
protected String getDescription(MBeanAttributeInfo attr)(Code)
Obtain the attribute description.

Taken from the "attr.attributeName" key in resource bundle.
See Also:   javax.management.StandardMBean.getDescription(javax.management.MBeanAttributeInfo)




getDescription
protected String getDescription(MBeanOperationInfo op)(Code)
Obtain the operation description.

Taken from the "op.operationName.N" or the "op.operationName" key in the resource bundle.

May be "ambiguous operation" if the correct key cannot be determined by signature or parameter counts.
See Also:   javax.management.StandardMBean.getDescription(javax.management.MBeanOperationInfo)




getDescription
protected String getDescription(MBeanOperationInfo op, MBeanParameterInfo param, int seq)(Code)
Obtain the operation parameter description.

Taken from the "op.operationName.N.param.M" or the "op.operationName.param" key in the resource bundle.

May be "parameter for ambiguous operation" if the correct key cannot be determined by signature or parameter counts.
See Also:   javax.management.StandardMBean.getDescription(javax.management.MBeanOperationInfojavax.management.MBeanParameterInfoint)




getParameterName
protected String getParameterName(MBeanConstructorInfo cstr, MBeanParameterInfo param, int seq)(Code)
Obtain constructor parameter name.

Taken from "cons.N.paramName.seq" key in resource bundle.

If this key does not exist or if the correct index N cannot be determined by an explicit signature or parameter counts the superclass method is called.
See Also:   javax.management.StandardMBean.getParameterName(javax.management.MBeanConstructorInfojavax.management.MBeanParameterInfoint)




getParameterName
protected String getParameterName(MBeanOperationInfo op, MBeanParameterInfo param, int seq)(Code)
Obtain operation parameter name.

Taken from the "op.operationName.N.paramName.M" or the "op.operationName.paramName.M" key in the resource bundle.

If this key does not exist or if the correct index N cannot be determined by an explicit signature or parameter counts the superclass method is called.
See Also:   javax.management.StandardMBean.getParameterName(javax.management.MBeanOperationInfojavax.management.MBeanParameterInfoint)




setDefaultLocale
public static void setDefaultLocale(Locale locale)(Code)
Set the locale which will be used for future I18NStandardMBeans.

The locale specified can be overridden on a per class basis via the constructors but overrides other means of setting the Locale (system properties).

Changing the locale has no effect on already constructed MBeans.
Parameters:
  locale - the Locale for future MBeans




Methods inherited from javax.management.StandardMBean
protected void cacheMBeanInfo(MBeanInfo info)(Code)(Java Doc)
public Object getAttribute(String attribute) throws AttributeNotFoundException, MBeanException, ReflectionException(Code)(Java Doc)
public AttributeList getAttributes(String[] attributes)(Code)(Java Doc)
protected MBeanInfo getCachedMBeanInfo()(Code)(Java Doc)
protected String getClassName(MBeanInfo info)(Code)(Java Doc)
protected MBeanConstructorInfo[] getConstructors(MBeanConstructorInfo[] constructors, Object implementation)(Code)(Java Doc)
protected String getDescription(MBeanInfo info)(Code)(Java Doc)
protected String getDescription(MBeanFeatureInfo info)(Code)(Java Doc)
protected String getDescription(MBeanAttributeInfo info)(Code)(Java Doc)
protected String getDescription(MBeanConstructorInfo info)(Code)(Java Doc)
protected String getDescription(MBeanOperationInfo info)(Code)(Java Doc)
protected String getDescription(MBeanConstructorInfo constructor, MBeanParameterInfo param, int sequence)(Code)(Java Doc)
protected String getDescription(MBeanOperationInfo operation, MBeanParameterInfo param, int sequence)(Code)(Java Doc)
protected int getImpact(MBeanOperationInfo info)(Code)(Java Doc)
public Object getImplementation()(Code)(Java Doc)
public Class getImplementationClass()(Code)(Java Doc)
public MBeanInfo getMBeanInfo()(Code)(Java Doc)
final public Class getMBeanInterface()(Code)(Java Doc)
protected String getParameterName(MBeanConstructorInfo constructor, MBeanParameterInfo param, int sequence)(Code)(Java Doc)
protected String getParameterName(MBeanOperationInfo operation, MBeanParameterInfo param, int sequence)(Code)(Java Doc)
public Object invoke(String method, Object[] arguments, String[] params) throws MBeanException, ReflectionException(Code)(Java Doc)
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException(Code)(Java Doc)
public AttributeList setAttributes(AttributeList attributes)(Code)(Java Doc)
public void setImplementation(Object implementation) throws NotCompliantMBeanException(Code)(Java Doc)

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.