org.apache.muse.ws.resource.impl
Class AbstractWsResourceCapability

java.lang.Object
  extended by org.apache.muse.core.AbstractCapability
      extended by org.apache.muse.ws.resource.impl.AbstractWsResourceCapability
All Implemented Interfaces:
Capability, Initialization, InitializationParameters, Shutdown, WsResourceCapability
Direct Known Subclasses:
AbstractManageabilityCapability, SimpleEntry, SimpleGetCapability, SimpleImmediateTermination, SimpleNotificationProducer, SimplePullPoint, SimplePullPointCreation, SimpleQueryCapability, SimpleScheduledTermination, SimpleServiceGroup, SimpleServiceGroupRegistration, SimpleSetCapability, SimpleSubscriptionManager

public abstract class AbstractWsResourceCapability
extends AbstractCapability
implements WsResourceCapability

AbstractWsResourceCapability is a foundation for user-defined capabilities for WSRF-based resources. It builds on the utilities of its parent class by providing the plumbing code needed to map WSRP requests to getter/setter methods in the concrete capability class. For example, it provides the logic needed to map a WSRP GetResourceProperty request for property myns:Widget to the getWidget() method in the concrete class (if getWidget() is not defined, a fault is thrown at initialization time).

This class allows users to implement their capabilities' properties using simple getter/setter logic (like a traditional Java bean) or more complicated APIs, but they do not have to worry about the XML and spec restrictions that are needed to implement WSRP operations. The combination of the getter/setter methods and the WSRP document schema gives this class everything it needs to transform Java beans into the foundation for WSRP.

Author:
Dan Jemiolo (danj)

Constructor Summary
AbstractWsResourceCapability()
           
 
Method Summary
protected  void createGettersAndSetters(QName propertyName)
           
 void deleteProperty(QName propertyQName)
           
protected  Method getGetter(QName propertyQName)
           
 Element[] getProperty(QName propertyQName)
           
protected  Element[] getPropertyElements(QName name, Object value)
           
 QName[] getPropertyNames()
          Concrete capability classes that define properties MUST override this method and provide the names of the properties.
protected  Method getSetter(QName propertyQName)
           
 WsResource getWsResource()
           
 void initialize()
          

AbstractWsResourceCapability continues the initialization process by inspecting the concrete class to find all of the getters (and, if applicable, setters) for its resource properties.
 void insertProperty(QName propertyQName, Element[] values)
           
protected  Object invokeMethod(Method method, Object[] params)
           
 void setResource(Resource resource)
           
 void updateProperty(QName propertyQName, Element[] values)
           
 
Methods inherited from class org.apache.muse.core.AbstractCapability
getActions, getCapabilityURI, getEnvironment, getInitializationParameter, getInitializationParameters, getLog, getMessageHandler, getPersistence, getResource, hasBeenInitialized, hasBeenShutdown, initializeCompleted, prepareShutdown, setCapabilityURI, setEnvironment, setInitializationParameters, setLog, setMessageHandler, setMessageHandlers, setPersistence, shutdown
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.muse.core.Capability
getActions, getCapabilityURI, getEnvironment, getLog, getMessageHandler, getPersistence, getResource, initializeCompleted, prepareShutdown, setCapabilityURI, setEnvironment, setLog, setMessageHandlers, setPersistence
 
Methods inherited from interface org.apache.muse.core.Initialization
hasBeenInitialized
 
Methods inherited from interface org.apache.muse.core.InitializationParameters
getInitializationParameter, getInitializationParameters, setInitializationParameters
 
Methods inherited from interface org.apache.muse.core.Shutdown
hasBeenShutdown, shutdown
 

Constructor Detail

AbstractWsResourceCapability

public AbstractWsResourceCapability()
Method Detail

createGettersAndSetters

protected void createGettersAndSetters(QName propertyName)

deleteProperty

public void deleteProperty(QName propertyQName)
                    throws BaseFault
Throws:
BaseFault

getGetter

protected Method getGetter(QName propertyQName)

getProperty

public Element[] getProperty(QName propertyQName)
                      throws BaseFault
Throws:
BaseFault

getPropertyElements

protected Element[] getPropertyElements(QName name,
                                        Object value)
                                 throws BaseFault
Parameters:
name -
value -
Returns:
The XML representation of the resource property value(s).
Throws:
BaseFault

getPropertyNames

public QName[] getPropertyNames()
Concrete capability classes that define properties MUST override this method and provide the names of the properties.

Returns:
The names of the resource properties defined by this capability.

getSetter

protected Method getSetter(QName propertyQName)

getWsResource

public WsResource getWsResource()
Specified by:
getWsResource in interface WsResourceCapability
Returns:
The same as getResource(), cast to the WsResource type.

initialize

public void initialize()
                throws SoapFault


AbstractWsResourceCapability continues the initialization process by inspecting the concrete class to find all of the getters (and, if applicable, setters) for its resource properties. It then registers itself with the resource's WSRP collection so that read and write requests for its properties are delegated to it.

Specified by:
initialize in interface Initialization
Overrides:
initialize in class AbstractCapability
Throws:
SoapFault

insertProperty

public void insertProperty(QName propertyQName,
                           Element[] values)
                    throws BaseFault
Throws:
BaseFault

invokeMethod

protected Object invokeMethod(Method method,
                              Object[] params)
                       throws BaseFault
Throws:
BaseFault

setResource

public void setResource(Resource resource)
Specified by:
setResource in interface Capability
Overrides:
setResource in class AbstractCapability

updateProperty

public void updateProperty(QName propertyQName,
                           Element[] values)
                    throws BaseFault
Throws:
BaseFault


Copyright © 2005-2011 Apache Web Services - Muse. All Rights Reserved.