|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object javax.management.StandardMBean mx4j.tools.i18n.I18NStandardMBean
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 byResourceBundle
are used; in particular : setDefaultLocale(java.util.Locale)
descr=The MBean Description
attr.Counter=The counter
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=paramName2Where N is a sequential number starting at one.
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
op.operationName=The description op.operationName.param.1=The first parameter op.operationName.paramName.1=param1
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
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
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 | |
protected |
I18NStandardMBean(java.lang.Class mbeanInterface)
Makes a I18NStandardMBean for the default locale implemented by a subclass. |
protected |
I18NStandardMBean(java.lang.Class mbeanInterface,
java.util.Locale locale)
Makes a I18NStandardMBean for the given locale implemented by a subclass. |
|
I18NStandardMBean(java.lang.Object implementation,
java.lang.Class mbeanInterface)
Makes an I18NStandardMBean for the default locale with a separate implementation class. |
|
I18NStandardMBean(java.lang.Object implementation,
java.lang.Class mbeanInterface,
java.util.Locale locale)
Makes an I18NStandardMBean for the given locale with a separate implementation class. |
Method Summary | |
protected void |
cacheMBeanInfo(javax.management.MBeanInfo info)
Once the MBeanInfo has been obtained discard our caches. |
protected javax.management.MBeanInfo |
getCachedMBeanInfo()
Initialise internal data structures. |
protected javax.management.MBeanConstructorInfo[] |
getConstructors(javax.management.MBeanConstructorInfo[] cstrs,
java.lang.Object impl)
|
protected java.lang.String |
getDescription(javax.management.MBeanAttributeInfo attr)
Obtain the attribute description. |
protected java.lang.String |
getDescription(javax.management.MBeanConstructorInfo cstr)
Obtain the constructor description. |
protected java.lang.String |
getDescription(javax.management.MBeanConstructorInfo cstr,
javax.management.MBeanParameterInfo param,
int seq)
Obtain the constructor parameter description. |
protected java.lang.String |
getDescription(javax.management.MBeanInfo info)
Obtain global description for MBean. |
protected java.lang.String |
getDescription(javax.management.MBeanOperationInfo op)
Obtain the operation description. |
protected java.lang.String |
getDescription(javax.management.MBeanOperationInfo op,
javax.management.MBeanParameterInfo param,
int seq)
Obtain the operation parameter description. |
protected java.lang.String |
getParameterName(javax.management.MBeanConstructorInfo cstr,
javax.management.MBeanParameterInfo param,
int seq)
Obtain constructor parameter name. |
protected java.lang.String |
getParameterName(javax.management.MBeanOperationInfo op,
javax.management.MBeanParameterInfo param,
int seq)
Obtain operation parameter name. |
static void |
setDefaultLocale(java.util.Locale locale)
Set the locale which will be used for future I18NStandardMBeans. |
Methods inherited from class javax.management.StandardMBean |
getAttribute, getAttributes, getClassName, getDescription, getImpact, getImplementation, getImplementationClass, getMBeanInfo, getMBeanInterface, invoke, setAttribute, setAttributes, setImplementation |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public I18NStandardMBean(java.lang.Object implementation, java.lang.Class mbeanInterface) throws javax.management.NotCompliantMBeanException
StandardMBean.StandardMBean(java.lang.Object, java.lang.Class)
public I18NStandardMBean(java.lang.Object implementation, java.lang.Class mbeanInterface, java.util.Locale locale) throws javax.management.NotCompliantMBeanException
StandardMBean.StandardMBean(java.lang.Object, java.lang.Class)
protected I18NStandardMBean(java.lang.Class mbeanInterface) throws javax.management.NotCompliantMBeanException
StandardMBean.StandardMBean(java.lang.Class)
protected I18NStandardMBean(java.lang.Class mbeanInterface, java.util.Locale locale) throws javax.management.NotCompliantMBeanException
StandardMBean.StandardMBean(java.lang.Class)
Method Detail |
public static void setDefaultLocale(java.util.Locale locale)
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.
locale
- the Locale for future MBeansprotected javax.management.MBeanInfo getCachedMBeanInfo()
This method is always called first during getMBeanInfo processing. We use this to avoid keeping all our internal Maps in memory too long.
StandardMBean.getCachedMBeanInfo()
protected void cacheMBeanInfo(javax.management.MBeanInfo info)
StandardMBean.cacheMBeanInfo(javax.management.MBeanInfo)
protected javax.management.MBeanConstructorInfo[] getConstructors(javax.management.MBeanConstructorInfo[] cstrs, java.lang.Object impl)
protected java.lang.String getDescription(javax.management.MBeanInfo info)
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.
StandardMBean.getDescription(javax.management.MBeanInfo)
protected java.lang.String getDescription(javax.management.MBeanConstructorInfo cstr)
Taken from "cons.N" key in resource bundle.
Maybe "ambiguous constructor" if correct index cannot be determined by an explicit signature or parameter counts.
StandardMBean.getDescription(javax.management.MBeanConstructorInfo)
protected java.lang.String getDescription(javax.management.MBeanConstructorInfo cstr, javax.management.MBeanParameterInfo param, int seq)
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.
StandardMBean.getDescription(javax.management.MBeanConstructorInfo, javax.management.MBeanParameterInfo, int)
protected java.lang.String getParameterName(javax.management.MBeanConstructorInfo cstr, javax.management.MBeanParameterInfo param, int seq)
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.
StandardMBean.getParameterName(javax.management.MBeanConstructorInfo, javax.management.MBeanParameterInfo, int)
protected java.lang.String getDescription(javax.management.MBeanAttributeInfo attr)
Taken from the "attr.attributeName" key in resource bundle.
StandardMBean.getDescription(javax.management.MBeanAttributeInfo)
protected java.lang.String getDescription(javax.management.MBeanOperationInfo op)
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.
StandardMBean.getDescription(javax.management.MBeanOperationInfo)
protected java.lang.String getDescription(javax.management.MBeanOperationInfo op, javax.management.MBeanParameterInfo param, int seq)
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.
StandardMBean.getDescription(javax.management.MBeanOperationInfo, javax.management.MBeanParameterInfo, int)
protected java.lang.String getParameterName(javax.management.MBeanOperationInfo op, javax.management.MBeanParameterInfo param, int seq)
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.
StandardMBean.getParameterName(javax.management.MBeanOperationInfo, javax.management.MBeanParameterInfo, int)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |