|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgov.nih.nci.cagrid.introduce.servicetools.ReflectionResource
public class ReflectionResource
An implementation of ResourceProperties and
ResourceIdentifier which frees the developer from
having to write a getter and possibly a setter to implement every resource
property (RP).
This class uses an Axis-generated JavaBean class based on the Schema
definition of the RP set used by the service port type in WSDL. Since the
generated class contain a JavaBean property as well as QName and Schema type
metadata (such as occurence cardinality) for each RP, it is possible to
automatically create
ReflectionResourceProperty
objects to provide an implementation of the RPs. This is what
ReflectionResource does.
Advantages of using this class:
Usage:
The specialized resource home class should do the following when creating a resource:
Reuse approach:
Typical goals when extending the class:
Classes directly or indirectly extending ReflectionResource property must be
allow instanciation without parameter. If a parameterless constructor is
present it must not do any initialization whatsoever. The reason is to
decouple object creation from initialization so as to match the requirements
of Resource Home classes such as ResourceHomeImpl, which, when materializing
a previously stored persistent resource, creates the resource object first
using a parameterless constructor, and then initializes the object. Code that
creates the key of the resource automatically (for instance a UUID) - in
domain-specific cases where it makes sense - should not be put inside a
parameterless constructor but in an a overriding version of the
initialize() method, or inside the
Resource Home class. In this way a Persistent Resource object can be brought
back from a passivated state and be given the ID it used to have in activated
mode, as opposed to a newly generated ID.
Known limitations:
This class does not provide a getter to the implementation JavaBean, because
it is good practice to access the value of a resource property by obtaining
the ResourceProperty object first, as opposed to
calling the getters and setters of its implementation Bean.
In fact:
getCurrentTime, and the resource properties from
wsnt:NotificationProducer are implemented directly or indirectly by a
SimpleTopicList). ResourceProperty object generic accessors
may do extra processing such as firing change notification events (for
instance if it is a ResourcePropertyTopic).
| Constructor Summary | |
|---|---|
ReflectionResource()
|
|
| Method Summary | |
|---|---|
protected org.globus.wsrf.ResourceProperty |
createNewResourceProperty(javax.xml.namespace.QName rpQName,
java.lang.Object resourceBean)
Warning: this is not a callback (but maybe it should be). |
protected org.globus.wsrf.ResourceProperty |
createNewResourceProperty(org.globus.wsrf.ResourcePropertyMetaData metaData,
java.lang.Object resourceBean)
Override this callback method to specialize the implementation of the resource property value accessors on a per resource property basis. |
java.util.Calendar |
getCurrentTime()
|
java.lang.Object |
getID()
See ResourceIdentifier. |
java.lang.Object |
getResourceBean()
|
org.globus.wsrf.ResourcePropertySet |
getResourcePropertySet()
See ResourceProperties. |
java.util.Calendar |
getTerminationTime()
|
void |
initialize(java.lang.Object resourceBean,
javax.xml.namespace.QName resourceElementQName,
java.lang.Object key)
This should be called before any other resource property addition is made as it will create resource properties object based on the resource properties defined in the schema. |
void |
setTerminationTime(java.util.Calendar time)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ReflectionResource()
| Method Detail |
|---|
public void initialize(java.lang.Object resourceBean,
javax.xml.namespace.QName resourceElementQName,
java.lang.Object key)
throws org.globus.wsrf.ResourceException
resourceBean - Object An instance of the Axis-generated class corresponding
to the resource property set global Schema type or element
(with local type) used by the port type definition. That class
has JavaBean properties matching all the resource properties
of the port type. The ReflectionResource constructor creates
the ResourceProperty objects based on the resource bean, which
JavaBean properties SHOULD thus have been initialized
beforehand. This object provides an easy way to initialize the
values of the resource properties.
resourceElementQName - QName The QName of the resource properties element used by the
port type. This corresponds to the value of the
'wsrp:ResourceProperties' attribute. If the type of this
element is anonymous (i.e. inlined in the element declaration)
then this parameter is optional. If it is non-null though, its
value takes precedence over Axis-generated metadata.
key - Object The resource key object for this resource. This is used
to set the ID property of this object as a ResourceIdentifier,
if the resource class doesn't create it automatically.
org.globus.wsrf.ResourceException
protected org.globus.wsrf.ResourceProperty createNewResourceProperty(javax.xml.namespace.QName rpQName,
java.lang.Object resourceBean)
throws java.lang.Exception
rpQName - QNameresourceBean - Object
java.lang.Exception
protected org.globus.wsrf.ResourceProperty createNewResourceProperty(org.globus.wsrf.ResourcePropertyMetaData metaData,
java.lang.Object resourceBean)
throws java.lang.Exception
The default behavior is to create a new
ReflectionResourceProperty constructed
with the QName of the resource property and the resource implementation
Bean used to construct this ReflectionResource object.
This function handles a few special cases:
metaData - Meta data associated with the resource property objectresourceBean - same as passed to constructor or initialize
java.lang.Exceptionpublic void setTerminationTime(java.util.Calendar time)
setTerminationTime in interface org.globus.wsrf.ResourceLifetimepublic java.util.Calendar getTerminationTime()
getTerminationTime in interface org.globus.wsrf.ResourceLifetimepublic java.util.Calendar getCurrentTime()
getCurrentTime in interface org.globus.wsrf.ResourceLifetimepublic org.globus.wsrf.ResourcePropertySet getResourcePropertySet()
getResourcePropertySet in interface org.globus.wsrf.ResourcePropertiespublic java.lang.Object getID()
getID in interface org.globus.wsrf.ResourceIdentifierpublic java.lang.Object getResourceBean()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||