org.globus.wsrf.impl
Class ReflectionResourceProperty

java.lang.Object
  extended by org.globus.wsrf.impl.BaseResourceProperty
      extended by org.globus.wsrf.impl.ReflectionResourceProperty
All Implemented Interfaces:
ResourceProperty

public class ReflectionResourceProperty
extends BaseResourceProperty


Field Summary
private  java.lang.reflect.Method getMethod
           
private static org.globus.util.I18n i18n
           
private static org.apache.commons.logging.Log logger
           
private static org.apache.axis.utils.cache.MethodCache methodCache
           
private static java.lang.Object[] NULL_ARGS
           
private  java.lang.Object obj
           
private  java.lang.String propertyName
           
private  java.lang.reflect.Method setMethod
           
 
Fields inherited from class org.globus.wsrf.impl.BaseResourceProperty
metaData
 
Constructor Summary
  ReflectionResourceProperty(javax.xml.namespace.QName name, java.lang.Object obj)
          Creates a ReflectionResourceProperty instance with a specified QName and object.
  ReflectionResourceProperty(javax.xml.namespace.QName name, java.lang.String propertyName, java.lang.Object obj)
          Creates a ReflectionResourceProperty instance with a specified QName, property name and object.
protected ReflectionResourceProperty(ResourcePropertyMetaData metaData)
          Used by subclasses only.
  ReflectionResourceProperty(ResourcePropertyMetaData metaData, java.lang.Object obj)
          Creates a ReflectionResourceProperty instance with a specified metadata and object.
  ReflectionResourceProperty(ResourcePropertyMetaData metaData, java.lang.String propertyName, java.lang.Object obj)
          Creates a ReflectionResourceProperty instance with a specified metadata, property name and object.
 
Method Summary
 void add(java.lang.Object value)
          Adds a value.
private  void addArray(java.lang.Object value)
           
private  void addList(java.lang.Object value)
           
private  void addSimple(java.lang.Object value)
           
 void clear()
          Removes all values.
private  void clearArray()
           
private  void clearList()
           
private  void clearSimple()
           
 java.lang.Object get(int index)
          Retrieves a value at a specific index.
private  java.lang.Object getArray(int index)
           
private  java.lang.Object getList(int index)
           
private  java.lang.Object getSimple(int index)
           
private  java.lang.Object getValueArray()
           
private  java.util.List getValueList()
           
protected  java.lang.Object getValueSimple()
           
private  java.lang.RuntimeException handleException(java.lang.Throwable e)
           
protected  void initialize()
          Must be called after object and propertyName have been set.
protected  boolean isArray(java.lang.Class returnType)
           
 boolean isEmpty()
          Returns true if the resource property has any values.
private  boolean isEmptyArray()
           
private  boolean isEmptyList()
           
private  boolean isEmptySimple()
           
 java.util.Iterator iterator()
          Returns iterator over the values of this resource property.
private  java.util.Iterator iteratorArray()
           
private  java.util.Iterator iteratorList()
           
private  java.util.Iterator iteratorSimple()
           
 boolean remove(java.lang.Object value)
          Removes a specific value.
private  boolean removeArray(java.lang.Object value)
           
private  boolean removeList(java.lang.Object value)
           
private  boolean removeSimple(java.lang.Object value)
           
 void set(int index, java.lang.Object value)
          Sets a value at a specific index.
private  void setArray(int index, java.lang.Object value)
           
private  void setList(int index, java.lang.Object value)
           
protected  void setObject(java.lang.Object obj)
           
protected  void setPropertyName(java.lang.String propertyName)
           
private  void setSimple(int index, java.lang.Object value)
           
 int size()
          Returns the number of values in the resource property.
private  int sizeArray()
           
private  int sizeList()
           
private  int sizeSimple()
           
private  org.w3c.dom.Element[] toElementArray()
           
private  org.w3c.dom.Element[] toElementList()
           
 org.w3c.dom.Element[] toElements()
          Converts the resource property value into a DOM Element array.
private  org.w3c.dom.Element[] toElementSimple()
           
private  javax.xml.soap.SOAPElement[] toSOAPElementArray()
           
private  javax.xml.soap.SOAPElement[] toSOAPElementList()
           
 javax.xml.soap.SOAPElement[] toSOAPElements()
          Converts the resource property value into a SOAPElement array.
private  javax.xml.soap.SOAPElement[] toSOAPElementSimple()
           
 
Methods inherited from class org.globus.wsrf.impl.BaseResourceProperty
convert, convertObject, convertPrimitive, getMetaData, setMetaData
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static org.apache.commons.logging.Log logger

i18n

private static org.globus.util.I18n i18n

NULL_ARGS

private static final java.lang.Object[] NULL_ARGS

methodCache

private static org.apache.axis.utils.cache.MethodCache methodCache

propertyName

private java.lang.String propertyName

obj

private java.lang.Object obj

getMethod

private java.lang.reflect.Method getMethod

setMethod

private java.lang.reflect.Method setMethod
Constructor Detail

ReflectionResourceProperty

protected ReflectionResourceProperty(ResourcePropertyMetaData metaData)
Used by subclasses only. Subclasses must call setObject() and setPropertyName() and initialize() first.


ReflectionResourceProperty

public ReflectionResourceProperty(ResourcePropertyMetaData metaData,
                                  java.lang.String propertyName,
                                  java.lang.Object obj)
                           throws ResourcePropertyException
Creates a ReflectionResourceProperty instance with a specified metadata, property name and object.

Throws:
ResourcePropertyException - if invalid metadata, property name or object is passed or a getter function was not found, etc.
See Also:
ResourcePropertyMetaData

ReflectionResourceProperty

public ReflectionResourceProperty(javax.xml.namespace.QName name,
                                  java.lang.String propertyName,
                                  java.lang.Object obj)
                           throws ResourcePropertyException
Creates a ReflectionResourceProperty instance with a specified QName, property name and object. The ReflectionResourceProperty will be initialized with a default SimpleResourcePropertyMetaData instance with the specified QName name.

Throws:
ResourcePropertyException - if invalid QName, property name or object is passed or a getter function was not found, etc.
See Also:
SimpleResourcePropertyMetaData

ReflectionResourceProperty

public ReflectionResourceProperty(javax.xml.namespace.QName name,
                                  java.lang.Object obj)
                           throws ResourcePropertyException
Creates a ReflectionResourceProperty instance with a specified QName and object. The local part of the QName will be used as the property name. The ReflectionResourceProperty will be initialized with a default SimpleResourcePropertyMetaData instance with the specified QName name.

Throws:
ResourcePropertyException - if invalid QName or object is passed or a getter function was not found, etc.
See Also:
SimpleResourcePropertyMetaData

ReflectionResourceProperty

public ReflectionResourceProperty(ResourcePropertyMetaData metaData,
                                  java.lang.Object obj)
                           throws ResourcePropertyException
Creates a ReflectionResourceProperty instance with a specified metadata and object. The metadata's name (the local part of the QName) will be used as the property name.

Throws:
ResourcePropertyException - if invalid metadata or object is passed or a getter function was not found, etc.
See Also:
ResourcePropertyMetaData
Method Detail

setPropertyName

protected void setPropertyName(java.lang.String propertyName)

setObject

protected void setObject(java.lang.Object obj)

initialize

protected void initialize()
                   throws ResourcePropertyException
Must be called after object and propertyName have been set.

Throws:
ResourcePropertyException - if property was incorrectly initialized. For example if invalid object was set, or a getter function was not found, etc.

handleException

private java.lang.RuntimeException handleException(java.lang.Throwable e)

isArray

protected boolean isArray(java.lang.Class returnType)

size

public int size()
Description copied from interface: ResourceProperty
Returns the number of values in the resource property.

Returns:
the number of values.

isEmpty

public boolean isEmpty()
Description copied from interface: ResourceProperty
Returns true if the resource property has any values.

Returns:
true if the resource property has any values. False, otherwise.

iterator

public java.util.Iterator iterator()
Description copied from interface: ResourceProperty
Returns iterator over the values of this resource property.

Returns:
iterator over the values of this resource property.

get

public java.lang.Object get(int index)
Description copied from interface: ResourceProperty
Retrieves a value at a specific index.

Parameters:
index - the index of value to retrieve.
Returns:
the value at the given index. This operation might fail if the index is out of bounds.

set

public void set(int index,
                java.lang.Object value)
Description copied from interface: ResourceProperty
Sets a value at a specific index.

Parameters:
index - the index to set value at.
value - the new value

add

public void add(java.lang.Object value)
Description copied from interface: ResourceProperty
Adds a value.

Parameters:
value - the value to add.

remove

public boolean remove(java.lang.Object value)
Description copied from interface: ResourceProperty
Removes a specific value. If the resource property contains multiple of the same value, only the first one is removed.

Parameters:
value - value to remove.
Returns:
true if the value was removed. False otherwise.

clear

public void clear()
Description copied from interface: ResourceProperty
Removes all values.


toSOAPElements

public javax.xml.soap.SOAPElement[] toSOAPElements()
                                            throws SerializationException
Description copied from interface: ResourceProperty
Converts the resource property value into a SOAPElement array. Each value is wrapped into an element named after the resource property. If the RP has no values (is null), and RP element was defined as:

Returns:
the resource property as a SOAPElement array.
Throws:
SerializationException - if conversion fails.

toElements

public org.w3c.dom.Element[] toElements()
                                 throws SerializationException
Description copied from interface: ResourceProperty
Converts the resource property value into a DOM Element array. Each value is wrapped into an element named after the resource property. If the RP has no values (is null), and RP element was defined as:

Returns:
the resource property as a DOM Element array.
Throws:
SerializationException - if conversion fails.

getValueSimple

protected java.lang.Object getValueSimple()

sizeSimple

private int sizeSimple()

isEmptySimple

private boolean isEmptySimple()

iteratorSimple

private java.util.Iterator iteratorSimple()

getSimple

private java.lang.Object getSimple(int index)

setSimple

private void setSimple(int index,
                       java.lang.Object value)

clearSimple

private void clearSimple()

addSimple

private void addSimple(java.lang.Object value)

removeSimple

private boolean removeSimple(java.lang.Object value)

toSOAPElementSimple

private javax.xml.soap.SOAPElement[] toSOAPElementSimple()
                                                  throws SerializationException
Throws:
SerializationException

toElementSimple

private org.w3c.dom.Element[] toElementSimple()
                                       throws SerializationException
Throws:
SerializationException

getValueArray

private java.lang.Object getValueArray()

sizeArray

private int sizeArray()

isEmptyArray

private boolean isEmptyArray()

iteratorArray

private java.util.Iterator iteratorArray()

getArray

private java.lang.Object getArray(int index)

setArray

private void setArray(int index,
                      java.lang.Object value)

clearArray

private void clearArray()

addArray

private void addArray(java.lang.Object value)

removeArray

private boolean removeArray(java.lang.Object value)

toSOAPElementArray

private javax.xml.soap.SOAPElement[] toSOAPElementArray()
                                                 throws SerializationException
Throws:
SerializationException

toElementArray

private org.w3c.dom.Element[] toElementArray()
                                      throws SerializationException
Throws:
SerializationException

getValueList

private java.util.List getValueList()

sizeList

private int sizeList()

isEmptyList

private boolean isEmptyList()

iteratorList

private java.util.Iterator iteratorList()

getList

private java.lang.Object getList(int index)

setList

private void setList(int index,
                     java.lang.Object value)

clearList

private void clearList()

addList

private void addList(java.lang.Object value)

removeList

private boolean removeList(java.lang.Object value)

toSOAPElementList

private javax.xml.soap.SOAPElement[] toSOAPElementList()
                                                throws SerializationException
Throws:
SerializationException

toElementList

private org.w3c.dom.Element[] toElementList()
                                     throws SerializationException
Throws:
SerializationException