Java Doc for DescriptorSupport.java in  » 6.0-JDK-Core » management » javax » management » modelmbean » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Home
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
26.ERP CRM Financial
27.ESB
28.Forum
29.Game
30.GIS
31.Graphic 3D
32.Graphic Library
33.Groupware
34.HTML Parser
35.IDE
36.IDE Eclipse
37.IDE Netbeans
38.Installer
39.Internationalization Localization
40.Inversion of Control
41.Issue Tracking
42.J2EE
43.J2ME
44.JBoss
45.JMS
46.JMX
47.Library
48.Mail Clients
49.Music
50.Net
51.Parser
52.PDF
53.Portal
54.Profiler
55.Project Management
56.Report
57.RSS RDF
58.Rule Engine
59.Science
60.Scripting
61.Search Engine
62.Security
63.Sevlet Container
64.Source Control
65.Swing Library
66.Template Engine
67.Test Coverage
68.Testing
69.UML
70.Web Crawler
71.Web Framework
72.Web Mail
73.Web Server
74.Web Services
75.Web Services apache cxf 2.2.6
76.Web Services AXIS2
77.Wiki Engine
78.Workflow Engines
79.XML
80.XML UI
Java Source Code / Java Documentation » 6.0 JDK Core » management » javax.management.modelmbean 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.management.modelmbean.DescriptorSupport

DescriptorSupport
public class DescriptorSupport implements javax.management.Descriptor(Code)
This class represents the metadata set for a ModelMBean element. A descriptor is part of the ModelMBeanInfo, ModelMBeanNotificationInfo, ModelMBeanAttributeInfo, ModelMBeanConstructorInfo, and ModelMBeanParameterInfo.

A descriptor consists of a collection of fields. Each field is in fieldname=fieldvalue format. Field names are not case sensitive, case will be preserved on field values.

All field names and values are not predefined. New fields can be defined and added by any program. Some fields have been predefined for consistency of implementation and support by the ModelMBeanInfo, ModelMBeanAttributeInfo, ModelMBeanConstructorInfo, ModelMBeanNotificationInfo, ModelMBeanOperationInfo and ModelMBean classes.

The serialVersionUID of this class is -6292969195866300415L.
since:
   1.5




Constructor Summary
public  DescriptorSupport()
     Descriptor default constructor. Default initial descriptor size is 20.
public  DescriptorSupport(int initNumFields)
     Descriptor constructor.
public  DescriptorSupport(DescriptorSupport inDescr)
     Descriptor constructor taking a Descriptor as parameter. Creates a new descriptor initialized to the values of the descriptor passed in parameter.
Parameters:
  inDescr - the descriptor to be used to initialize theconstructed descriptor.
public  DescriptorSupport(String inStr)
    

Descriptor constructor taking an XML String.

The format of the XML string is not defined, but an implementation must ensure that the string returned by DescriptorSupport.toXMLString() toXMLString() on an existing descriptor can be used to instantiate an equivalent descriptor using this constructor.

In this implementation, all field values will be created as Strings.

public  DescriptorSupport(String[] fieldNames, Object[] fieldValues)
     Constructor taking field names and field values.
public  DescriptorSupport(String... fields)
     Constructor taking fields in the fieldName=fieldValue format.
Parameters:
  fields - String array with each element containing afield name and value.

Method Summary
public synchronized  Objectclone()
     Returns a new Descriptor which is a duplicate of the Descriptor.
exception:
  RuntimeOperationsException - for illegal value forfield Names or field Values.
public synchronized  booleanequals(Object o)
     Compares this descriptor to the given object.
public synchronized  String[]getFieldNames()
    
public synchronized  ObjectgetFieldValue(String fieldName)
    
public synchronized  Object[]getFieldValues(String... fieldNames)
    
public synchronized  String[]getFields()
    
public synchronized  inthashCode()
    

Returns the hash code value for this descriptor.

public synchronized  booleanisValid()
     Returns true if all of the fields have legal values given their names.

This implementation does not support interoperating with a directory or lookup service.

public synchronized  voidremoveField(String fieldName)
    
public synchronized  voidsetField(String fieldName, Object fieldValue)
    
public synchronized  voidsetFields(String[] fieldNames, Object[] fieldValues)
    
public synchronized  StringtoString()
     Returns a human readable string representing the descriptor.
public synchronized  StringtoXMLString()
    

Returns an XML String representing the descriptor.

The format is not defined, but an implementation must ensure that the string returned by this method can be used to build an equivalent descriptor when instantiated using the constructor DescriptorSupport.DescriptorSupport(String)DescriptorSupport(String inStr) .

Fields which are not String objects will have toString() called on them to create the value.



Constructor Detail
DescriptorSupport
public DescriptorSupport()(Code)
Descriptor default constructor. Default initial descriptor size is 20. It will grow as needed.
Note that the created empty descriptor is not a valid descriptor (the method DescriptorSupport.isValid isValid returns false)



DescriptorSupport
public DescriptorSupport(int initNumFields) throws MBeanException, RuntimeOperationsException(Code)
Descriptor constructor. Takes as parameter the initial capacity of the Map that stores the descriptor fields. Capacity will grow as needed.
Note that the created empty descriptor is not a valid descriptor (the method DescriptorSupport.isValid isValid returns false).
Parameters:
  initNumFields - The initial capacity of the Map thatstores the descriptor fields.
exception:
  RuntimeOperationsException - for illegal value forinitNumFields (<= 0)
exception:
  MBeanException - Wraps a distributed communication Exception.



DescriptorSupport
public DescriptorSupport(DescriptorSupport inDescr)(Code)
Descriptor constructor taking a Descriptor as parameter. Creates a new descriptor initialized to the values of the descriptor passed in parameter.
Parameters:
  inDescr - the descriptor to be used to initialize theconstructed descriptor. If it is null or contains no descriptorfields, an empty Descriptor will be created.



DescriptorSupport
public DescriptorSupport(String inStr) throws MBeanException, RuntimeOperationsException, XMLParseException(Code)

Descriptor constructor taking an XML String.

The format of the XML string is not defined, but an implementation must ensure that the string returned by DescriptorSupport.toXMLString() toXMLString() on an existing descriptor can be used to instantiate an equivalent descriptor using this constructor.

In this implementation, all field values will be created as Strings. If the field values are not Strings, the programmer will have to reset or convert these fields correctly.


Parameters:
  inStr - An XML-formatted string used to populate thisDescriptor. The format is not defined, but anyimplementation must ensure that the string returned bymethod DescriptorSupport.toXMLString toXMLString on an existingdescriptor can be used to instantiate an equivalentdescriptor when instantiated using this constructor.
exception:
  RuntimeOperationsException - If the String inStrpassed in parameter is null
exception:
  XMLParseException - XML parsing problem while parsingthe input String
exception:
  MBeanException - Wraps a distributed communication Exception.



DescriptorSupport
public DescriptorSupport(String[] fieldNames, Object[] fieldValues) throws RuntimeOperationsException(Code)
Constructor taking field names and field values. Neither array can be null.
Parameters:
  fieldNames - String array of field names. No elements ofthis array can be null.
Parameters:
  fieldValues - Object array of the corresponding fieldvalues. Elements of the array can be null. ThefieldValue must be valid for thefieldName (as defined in method DescriptorSupport.isValidisValid)

Note: array sizes of parameters should match. If both arraysare empty, then an empty descriptor is created.


exception:
  RuntimeOperationsException - for illegal value forfield Names or field Values. The array lengths must be equal.If the descriptor construction fails for any reason, thisexception will be thrown.



DescriptorSupport
public DescriptorSupport(String... fields)(Code)
Constructor taking fields in the fieldName=fieldValue format.
Parameters:
  fields - String array with each element containing afield name and value. If this array is null or empty, then thedefault constructor will be executed. Null strings or emptystrings will be ignored.

All field values should be Strings. If the field values arenot Strings, the programmer will have to reset or convert thesefields correctly.

Note: Each string should be of the formfieldName=fieldValue. The field nameends at the first = character; for example if the Stringis a=b=c then the field name is a and its valueis b=c .
exception:
  RuntimeOperationsException - for illegal value forfield Names or field Values. The field must contain an"=". "=fieldValue", "fieldName", and "fieldValue" are illegal.FieldName cannot be null. "fieldName=" will cause the value tobe null. If the descriptor construction fails for any reason,this exception will be thrown.





Method Detail
clone
public synchronized Object clone() throws RuntimeOperationsException(Code)
Returns a new Descriptor which is a duplicate of the Descriptor.
exception:
  RuntimeOperationsException - for illegal value forfield Names or field Values. If the descriptor constructionfails for any reason, this exception will be thrown.



equals
public synchronized boolean equals(Object o)(Code)
Compares this descriptor to the given object. The objects are equal if the given object is also a Descriptor, and if the two Descriptors have the same field names (possibly differing in case) and the same associated values. The respective values for a field in the two Descriptors are equal if the following conditions hold:

  • If one value is null then the other must be too.
  • If one value is a primitive array then the other must be a primitive array of the same type with the same elements.
  • If one value is an object array then the other must be too and java.util.Arrays.deepEquals(Object[]Object[]) Arrays.deepEquals must return true.
  • Otherwise Object.equals(Object) must return true.

Parameters:
  o - the object to compare with. true if the objects are the same; false otherwise.



getFieldNames
public synchronized String[] getFieldNames()(Code)



getFieldValue
public synchronized Object getFieldValue(String fieldName) throws RuntimeOperationsException(Code)



getFieldValues
public synchronized Object[] getFieldValues(String... fieldNames)(Code)



getFields
public synchronized String[] getFields()(Code)



hashCode
public synchronized int hashCode()(Code)

Returns the hash code value for this descriptor. The hash code is computed as the sum of the hash codes for each field in the descriptor. The hash code of a field with name n and value v is n.toLowerCase().hashCode() ^ h . Here h is the hash code of v , computed as follows:

  • If v is null then h is 0.
  • If v is a primitive array then h is computed using the appropriate overloading of java.util.Arrays.hashCode .
  • If v is an object array then h is computed using java.util.Arrays.deepHashCode(Object[]) Arrays.deepHashCode .
  • Otherwise h is v.hashCode() .
A hash code value for this object.



isValid
public synchronized boolean isValid() throws RuntimeOperationsException(Code)
Returns true if all of the fields have legal values given their names.

This implementation does not support interoperating with a directory or lookup service. Thus, conforming to the specification, no checking is done on the "export" field.

Otherwise this implementation returns false if:

  • name and descriptorType fieldNames are not defined, or null, or empty, or not String
  • class, role, getMethod, setMethod fieldNames, if defined, are null or not String
  • persistPeriod, currencyTimeLimit, lastUpdatedTimeStamp, lastReturnedTimeStamp if defined, are null, or not a Numeric String or not a Numeric Value >= -1
  • log fieldName, if defined, is null, or not a Boolean or not a String with value "t", "f", "true", "false". These String values must not be case sensitive.
  • visibility fieldName, if defined, is null, or not a Numeric String or a not Numeric Value >= 1 and <= 4
  • severity fieldName, if defined, is null, or not a Numeric String or not a Numeric Value >= 0 and <= 6
  • persistPolicy fieldName, if defined, is null, or not one of the following strings:
    "OnUpdate", "OnTimer", "NoMoreOftenThan", "OnUnregister", "Always", "Never". These String values must not be case sensitive.

exception:
  RuntimeOperationsException - If the validity checkingfails for any reason, this exception will be thrown.



removeField
public synchronized void removeField(String fieldName)(Code)



setField
public synchronized void setField(String fieldName, Object fieldValue) throws RuntimeOperationsException(Code)



setFields
public synchronized void setFields(String[] fieldNames, Object[] fieldValues) throws RuntimeOperationsException(Code)



toString
public synchronized String toString()(Code)
Returns a human readable string representing the descriptor. The string will be in the format of "fieldName=fieldValue,fieldName2=fieldValue2,..."
If there are no fields in the descriptor, then an empty String is returned.
If a fieldValue is an object then the toString() method is called on it and its returned value is used as the value for the field enclosed in parenthesis.
exception:
  RuntimeOperationsException - for illegal value forfield Names or field Values. If the descriptor string failsfor any reason, this exception will be thrown.



toXMLString
public synchronized String toXMLString()(Code)

Returns an XML String representing the descriptor.

The format is not defined, but an implementation must ensure that the string returned by this method can be used to build an equivalent descriptor when instantiated using the constructor DescriptorSupport.DescriptorSupport(String)DescriptorSupport(String inStr) .

Fields which are not String objects will have toString() called on them to create the value. The value will be enclosed in parentheses. It is not guaranteed that you can reconstruct these objects unless they have been specifically set up to support toString() in a meaningful format and have a matching constructor that accepts a String in the same format.

If the descriptor is empty the following String is returned: <Descriptor></Descriptor>

the XML string.
exception:
  RuntimeOperationsException - for illegal value forfield Names or field Values. If the XML formatted stringconstruction fails for any reason, this exception will bethrown.



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.