Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.muse.ws.resource.metadata.impl
Class SimpleMetadataDescriptor

    java.lang.Object
      org.apache.muse.ws.resource.metadata.impl.SimpleMetadataDescriptor

All Implemented Interfaces:
  MetadataDescriptor, XmlSerializable

public class SimpleMetadataDescriptor
extends java.lang.Object
implements MetadataDescriptor

SimpleMetadataDescriptor is Muse's default implementation of the RMD parsing and evaluation stage. It stores a simple lookup table of property names and metadata.

Author:
  Dan Jemiolo (danj)

Constructor Summary
`SimpleMetadataDescriptor(org.w3c.dom.Element xml)` Creates a new RMD metadata descriptor from the given XML definition.
`SimpleMetadataDescriptor(java.lang.String name, java.lang.String wsdlLocation, QName wsdlInterface)` This constructor allows users to create RMD docs programmatically, adding wsrmd:Property elements one at a time.

Method Summary
`void` | `addProperty(QName property, java.lang.String modifiability, java.lang.String mutability)` Adds another wsrmd:Property element to the descriptor with the basic metadata attributes required by the spec.
`boolean` | `canDelete(QName propertyQName)`
`boolean` | `canInsert(QName propertyQName)`
`boolean` | `canUpdate(QName propertyQName)`
`java.lang.String` | `getExtendedMetadata(QName propertyQName, QName elementName)` This method allows you to extend a wsrmd:Property definition and provide application-specific metadata for a property.
`java.util.Collection` | `getExtendedMetadataNames(QName propertyQName)`
`java.util.Collection` | `getInitialValues(QName propertyQName)`
`java.util.Collection` | `getInitialValues(QName propertyQName, java.lang.Class javaType)`
`QName` | `getInterface()`
`java.lang.String` | `getLowerBound(QName propertyQName)`
`java.lang.String` | `getModifiability(QName propertyQName)` Most users will probably want to use the canDelete(), canInsert(), and canUpdate() methods to test the permissions of a property; these methods handle the Boolean logic between modifiability and mutability values so you don't have to litter your code with messy if/else blocks.
`java.lang.String` | `getMutability(QName propertyQName)` Most users will probably want to use the canDelete(), canInsert(), and canUpdate() methods to test the permissions of a property; these methods handle the Boolean logic between modifiability and mutability values so you don't have to litter your code with messy if/else blocks.
`java.lang.String` | `getName()`
`java.util.Collection` | `getPropertyNames()`
`java.util.Collection` | `getStaticValues(QName propertyQName)`
`java.util.Collection` | `getStaticValues(QName propertyQName, java.lang.Class javaType)`
`java.lang.String` | `getUpperBound(QName propertyQName)`
`java.util.Collection` | `getValidValues(QName propertyQName)`
`java.util.Collection` | `getValidValues(QName propertyQName, java.lang.Class javaType)`
`java.lang.String` | `getWsdlLocation()`
`boolean` | `hasProperty(QName propertyQName)`
`boolean` | `isInitialValue(QName propertyQName, java.lang.Object value)`
`boolean` | `isReadOnlyExternal(QName propertyQName)`
`boolean` | `isStaticValue(QName propertyQName, java.lang.Object value)`
`boolean` | `isValidValue(QName propertyQName, java.lang.Object value)`
`void` | `removeProperty(QName property)` Removes the wsrmd:Property element with the given name.
`void` | `setExtendedMetadata(QName property, QName elementName, java.lang.String value)` This method allows you to extend a wsrmd:Property definition and provide application-specific metadata for a property.
`void` | `setInitialValues(QName property, java.util.Collection values)`
`void` | `setLowerBound(QName property, java.lang.String value)`
`void` | `setModifiability(QName property, java.lang.String value)`
`void` | `setMutability(QName property, java.lang.String value)`
`void` | `setPropertyName(QName currentProperty, QName newProperty)` Change the name of one of the current wsrmd:Property elements.
`void` | `setStaticValues(QName property, java.util.Collection values)`
`void` | `setUpperBound(QName property, java.lang.String value)`
`void` | `setValidValues(QName property, java.util.Collection values)`
`org.w3c.dom.Element` | `toXML()` Converts this object into an XML representation, as defined by its related schema or specification.
`org.w3c.dom.Element` | `toXML(org.w3c.dom.Document doc)` Converts this object into an XML representation, as defined by its related schema or specification.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SimpleMetadataDescriptor

    public SimpleMetadataDescriptor(java.lang.String name,
                                    java.lang.String wsdlLocation,
                                    QName wsdlInterface)

  This constructor allows users to create RMD docs programmatically, adding wsrmd:Property elements one at a time.

### SimpleMetadataDescriptor

    public SimpleMetadataDescriptor(org.w3c.dom.Element xml)

  Creates a new RMD metadata descriptor from the given XML definition.

Parameters:
  `xml` - The XML representation of the descriptor.

Method Detail

### addProperty

    public void addProperty(QName property,
                            java.lang.String modifiability,
                            java.lang.String mutability)

  Description copied from interface: `MetadataDescriptor`
  Adds another wsrmd:Property element to the descriptor with the basic metadata attributes required by the spec.

  Specified by:
    `addProperty` in interface `MetadataDescriptor`
  Parameters:
    `property` - The name of the property this metadata refers to.
    `modifiability` - Use WsrmdConstants.READ_ONLY or WsrmdConstants.READ_WRITE.
    `mutability` - Use WsrmdConstants.CONSTANT, WsrmdConstants.APPENDABLE, or WsrmdConstants.MUTABLE.
  See Also:
    `WsrmdConstants`

### canDelete

    public boolean canDelete(QName propertyQName)

  Specified by:
    `canDelete` in interface `MetadataDescriptor`
  Parameters:
    `propertyQName` -
  Returns:
    True if the property can be deleted (it is read-write and mutable)

### canInsert

    public boolean canInsert(QName propertyQName)

  Specified by:
    `canInsert` in interface `MetadataDescriptor`
  Parameters:
    `propertyQName` -
  Returns:
    True if the property can have new instances inserted (it is read-write and mutable/appendable).

### canUpdate

    public boolean canUpdate(QName propertyQName)

  Specified by:
    `canUpdate` in interface `MetadataDescriptor`
  Parameters:
    `propertyQName` -
  Returns:
    True if the property's instances can be updated (it is read-write and mutable).

### getExtendedMetadata

    public java.lang.String getExtendedMetadata(QName propertyQName,
                                                QName elementName)

  Description copied from interface: `MetadataDescriptor`
  This method allows you to extend a wsrmd:Property definition and provide application-specific metadata for a property. These will be parsed as simple name-value pairs - you cannot associate complex types or XML fragments with an extended metadata item.

  Specified by:
    `getExtendedMetadata` in interface `MetadataDescriptor`
  Parameters:
    `propertyQName` -
    `elementName` - The name of the extended metadata item.
  Returns:
    The value of the extended metadata item, or null if there is no such item.

### getExtendedMetadataNames

    public java.util.Collection getExtendedMetadataNames(QName propertyQName)

  Specified by:
    `getExtendedMetadataNames` in interface `MetadataDescriptor`
  Parameters:
    `propertyQName` -
  Returns:
    The names (QNames) of all extended metadata elements defined for this property. The collection may be empty.

### getInitialValues

    public java.util.Collection getInitialValues(QName propertyQName)

  Specified by:
    `getInitialValues` in interface `MetadataDescriptor`
  Parameters:
    `propertyQName` -
  Returns:
    The collection of initial values defined for this property.
    The actual values are DOM Elements, since that is how they are described in the RMD. They can be compared to the results of a WS-RP GetResourceProperty call.
  See Also:
    `MetadataDescriptor.getInitialValues(QName, Class)`

### getInitialValues

    public java.util.Collection getInitialValues(QName propertyQName,
                                                 java.lang.Class javaType)
                                          throws SoapFault

  Specified by:
    `getInitialValues` in interface `MetadataDescriptor`
  Parameters:
    `propertyQName` -
    `javaType` - The type whose serializer should be used to convert the property values (DOM Elements) into POJOs.
  Returns:
    The array of getInitialValues(QName) in POJO form.
  Throws:
    `SoapFault` -
    - If there is no Serializer registered for the given type.
    - If the property value XML can not be translated into an instance of the given type.
  See Also:
    `MetadataDescriptor.getValidValues(QName)`

### getInterface

    public QName getInterface()

  Specified by:
    `getInterface` in interface `MetadataDescriptor`

### getLowerBound

    public java.lang.String getLowerBound(QName propertyQName)

  Specified by:
    `getLowerBound` in interface `MetadataDescriptor`
  Parameters:
    `propertyQName` -
  Returns:
    The lower bound of the property's valid value range, if one is defined. The user must interpret the string value in the context of the property's type. The method returns null if no range is defined.

### getModifiability

    public java.lang.String getModifiability(QName propertyQName)

  Description copied from interface: `MetadataDescriptor`
  Most users will probably want to use the canDelete(), canInsert(), and canUpdate() methods to test the permissions of a property; these methods handle the Boolean logic between modifiability and mutability values so you don't have to litter your code with messy if/else blocks. This method returns the actual string value of the attribute that is used in the RMD doc.

  Specified by:
    `getModifiability` in interface `MetadataDescriptor`
  Returns:
    WsrmdConstants.READ_ONLY or WsrmdConstants.READ_WRITE
  See Also:
    `MetadataDescriptor.canDelete(QName)`, `MetadataDescriptor.canInsert(QName)`, `MetadataDescriptor.canUpdate(QName)`

### getMutability

    public java.lang.String getMutability(QName propertyQName)

  Description copied from interface: `MetadataDescriptor`
  Most users will probably want to use the canDelete(), canInsert(), and canUpdate() methods to test the permissions of a property; these methods handle the Boolean logic between modifiability and mutability values so you don't have to litter your code with messy if/else blocks. This method returns the actual string value of the attribute that is used in the RMD doc.

  Specified by:
    `getMutability` in interface `MetadataDescriptor`
  Returns:
    WsrmdConstants.CONSTANT, WsrmdConstants.APPENDABLE, or WsrmdConstants.MUTABLE
  See Also:
    `MetadataDescriptor.canDelete(QName)`, `MetadataDescriptor.canInsert(QName)`, `MetadataDescriptor.canUpdate(QName)`

### getName

    public java.lang.String getName()

  Specified by:
    `getName` in interface `MetadataDescriptor`
  Returns:
    The name of the metadata descriptor (defined in XML by its "name" attribute).

### getPropertyNames

    public java.util.Collection getPropertyNames()

  Specified by:
    `getPropertyNames` in interface `MetadataDescriptor`
  Returns:
    The collection of property names that are defined in this descriptor.

### getStaticValues

    public java.util.Collection getStaticValues(QName propertyQName)

  Specified by:
    `getStaticValues` in interface `MetadataDescriptor`
  Parameters:
    `propertyQName` -
  Returns:
    The collection of static values defined for this property. If no static values exist, the collection will be empty.
    The actual values are DOM Elements, since that is how they are described in the RMD. They can be compared to the results of a WS-RP GetResourceProperty call.
  See Also:
    `MetadataDescriptor.getStaticValues(QName, Class)`

### getStaticValues

    public java.util.Collection getStaticValues(QName propertyQName,
                                                java.lang.Class javaType)
                                         throws SoapFault

  Specified by:
    `getStaticValues` in interface `MetadataDescriptor`
  Parameters:
    `propertyQName` -
    `javaType` - The type whose serializer should be used to convert the property values (DOM Elements) into POJOs.
  Returns:
    The array of getStaticValues(QName) in POJO form.
  Throws:
    `SoapFault` -
    - If there is no Serializer registered for the given type.
    - If the property value XML can not be translated into an instance of the given type.
  See Also:
    `MetadataDescriptor.getStaticValues(QName)`

### getUpperBound

    public java.lang.String getUpperBound(QName propertyQName)

  Specified by:
    `getUpperBound` in interface `MetadataDescriptor`
  Parameters:
    `propertyQName` -
  Returns:
    The upper bound of the property's valid value range, if one is defined. The user must interpret the string value in the context of the property's type. The method returns null if no range is defined.

### getValidValues

    public java.util.Collection getValidValues(QName propertyQName)

  Specified by:
    `getValidValues` in interface `MetadataDescriptor`
  Parameters:
    `propertyQName` -
  Returns:
    The collection of valid values defined for this property. If no valid values exist, the collection will be empty (in this case, all values are valid).
    The actual values are DOM Elements, since that is how they are described in the RMD (unlike a valid value range, the valid values are complete property instances). They can be compared to the results of a WS-RP GetResourceProperty call.
  See Also:
    `MetadataDescriptor.getValidValues(QName, Class)`

### getValidValues

    public java.util.Collection getValidValues(QName propertyQName,
                                               java.lang.Class javaType)
                                        throws SoapFault

  Specified by:
    `getValidValues` in interface `MetadataDescriptor`
  Parameters:
    `propertyQName` -
    `javaType` - The type whose serializer should be used to convert the property values (DOM Elements) into POJOs.
  Returns:
    The array of getValidValues(QName) in POJO form.
  Throws:
    `SoapFault` -
    - If there is no Serializer registered for the given type.
    - If the property value XML can not be translated into an instance of the given type.
  See Also:
    `MetadataDescriptor.getValidValues(QName)`

### getWsdlLocation

    public java.lang.String getWsdlLocation()

  Specified by:
    `getWsdlLocation` in interface `MetadataDescriptor`

### hasProperty

    public boolean hasProperty(QName propertyQName)

  Specified by:
    `hasProperty` in interface `MetadataDescriptor`
  Parameters:
    `propertyQName` -
  Returns:
    True if the descriptor defines a property with the given name.

### isInitialValue

    public boolean isInitialValue(QName propertyQName,
                                  java.lang.Object value)

  Specified by:
    `isInitialValue` in interface `MetadataDescriptor`
  Parameters:
    `propertyQName` -
    `value` -
  Returns:
    True if the given value is found in the property's set of initial values. If the property has no initial values defined, the method returns "false".

### isReadOnlyExternal

    public boolean isReadOnlyExternal(QName propertyQName)

  Specified by:
    `isReadOnlyExternal` in interface `MetadataDescriptor`
  Parameters:
    `propertyQName` -
  Returns:
    True if the property cannot be modified by external clients, but is mutable by internal code (it is read-only but mutable).

### isStaticValue

    public boolean isStaticValue(QName propertyQName,
                                 java.lang.Object value)

  Specified by:
    `isStaticValue` in interface `MetadataDescriptor`
  Parameters:
    `propertyQName` -
    `value` -
  Returns:
    True if the given value is found in the property's set of static values. If the property has no static values defined, the method returns "false".

### isValidValue

    public boolean isValidValue(QName propertyQName,
                                java.lang.Object value)

  Specified by:
    `isValidValue` in interface `MetadataDescriptor`
  Parameters:
    `propertyQName` -
    `value` -
  Returns:
    True if the given value is found in the property's set of valid values. If the property has no valid values defined, the method returns "true".

### removeProperty

    public void removeProperty(QName property)

  Description copied from interface: `MetadataDescriptor`
  Removes the wsrmd:Property element with the given name.

  Specified by:
    `removeProperty` in interface `MetadataDescriptor`
  Parameters:
    `property` - The name of the property to remove.

### setExtendedMetadata

    public void setExtendedMetadata(QName property,
                                    QName elementName,
                                    java.lang.String value)

  Description copied from interface: `MetadataDescriptor`
  This method allows you to extend a wsrmd:Property definition and provide application-specific metadata for a property.

  Specified by:
    `setExtendedMetadata` in interface `MetadataDescriptor`
  Parameters:
    `property` - The wsrmd:Property element to which the new element should be added.
    `elementName` - The name of the extended metadata item. param value The value of the extended metadata item(may be null).

### setInitialValues

    public void setInitialValues(QName property,
                                 java.util.Collection values)
                          throws SoapFault

  Specified by:
    `setInitialValues` in interface `MetadataDescriptor`
  Throws:
    `SoapFault`

### setLowerBound

    public void setLowerBound(QName property,
                              java.lang.String value)

  Specified by:
    `setLowerBound` in interface `MetadataDescriptor`

### setModifiability

    public void setModifiability(QName property,
                                 java.lang.String value)

  Specified by:
    `setModifiability` in interface `MetadataDescriptor`
  Parameters:
    `property` - The wsrmd:Property element whose modifiability attribute will be changed.
    `value` - WsrmdConstants.READ_ONLY or WsrmdConstants.READ_WRITE

### setMutability

    public void setMutability(QName property,
                              java.lang.String value)

  Specified by:
    `setMutability` in interface `MetadataDescriptor`
  Parameters:
    `property` - The wsrmd:Property element whose mutability attribute will be changed.
    `value` - WsrmdConstants.CONSTANT, WsrmdConstants.APPENDABLE, or WsrmdConstants.MUTABLE

### setPropertyName

    public void setPropertyName(QName currentProperty,
                                QName newProperty)

  Description copied from interface: `MetadataDescriptor`
  Change the name of one of the current wsrmd:Property elements. The new name cannot be one of the existing properties' names.

  Specified by:
    `setPropertyName` in interface `MetadataDescriptor`
  Parameters:
    `currentProperty` -
    `newProperty` -

### setStaticValues

    public void setStaticValues(QName property,
                                java.util.Collection values)
                         throws SoapFault

  Specified by:
    `setStaticValues` in interface `MetadataDescriptor`
  Throws:
    `SoapFault`

### setUpperBound

    public void setUpperBound(QName property,
                              java.lang.String value)

  Specified by:
    `setUpperBound` in interface `MetadataDescriptor`

### setValidValues

    public void setValidValues(QName property,
                               java.util.Collection values)
                        throws SoapFault

  Specified by:
    `setValidValues` in interface `MetadataDescriptor`
  Throws:
    `SoapFault`

### toXML

    public org.w3c.dom.Element toXML()

  Description copied from interface: `XmlSerializable`
  Converts this object into an XML representation, as defined by its related schema or specification. The format of the XML is dependent on the concrete type.

  Specified by:
    `toXML` in interface `XmlSerializable`
  Returns:
    An XML representation of this object.

### toXML

    public org.w3c.dom.Element toXML(org.w3c.dom.Document doc)

  Description copied from interface: `XmlSerializable`
  Converts this object into an XML representation, as defined by its related schema or specification. The format of the XML is dependent on the concrete type.

  Specified by:
    `toXML` in interface `XmlSerializable`
  Parameters:
    `doc` - The DOM Document that will be used to create all of the nodes in the resulting XML fragment.
  Returns:
    An XML representation of this object.

Overview | Package | Class | Tree | Serialized | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD