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

java.lang.Object
  extended by org.apache.muse.core.SimpleResource
      extended by org.apache.muse.ws.resource.impl.SimpleWsResource
All Implemented Interfaces:
Initialization, InitializationParameters, Resource, Shutdown, WsResource

public class SimpleWsResource
extends SimpleResource
implements WsResource

SimpleResource is Muse's default implementation of a WS-RF-compliant resource (WsResource). It parses the resource's WSDL to find the WSRP document schema and then creates the WSRP state model using Muse's default WSRP implementation. The WSRP implementation class can be modified by overriding the createPropertyCollection() method in this class.

Author:
Dan Jemiolo (danj)

Constructor Summary
SimpleWsResource()
           
 
Method Summary
 void addCapability(Capability capability)
          Registers the given capability instance with the resource.
protected  MetadataDescriptor createMetadataDescriptor(Document wsdl)
           
protected  ResourcePropertiesSchema createPropertiesSchema(Document wsdl)
           
protected  ResourcePropertyCollection createPropertyCollection()
          This method returns the concrete WSRP state model - this is not the implementation of the WSRP capabilities (which map SOAP requests to WSRP operations), but it does implement the actual WSRP operations and does the delegation of read/write requests to the capabilities defining the properties.
 Capability getCapability(String capabilityURI)
           
 Collection getCapabilityURIs()
           
 ResourcePropertyCollection getPropertyCollection()
           
 boolean hasCapability(String capabilityURI)
           
 void initialize()
          

The SimpleWsResource implementation takes the following steps: Create WSRP state model - createPropertyCollection()
Create WSRP document schema and apply it to the collection.
Create WSRP metadata and apply it to the collection.
Call super.initialize() to initialize capabilities.
 
Methods inherited from class org.apache.muse.core.SimpleResource
addCapability, getCapability, getCapabilityActions, getCapabilityForAction, getCapabilityURIs, getContextPath, getEndpointReference, getEnvironment, getInitializationParameter, getInitializationParameters, getLog, getResourceManager, getWsdlPath, getWsdlPortType, hasBeenInitialized, hasBeenShutdown, hasCapability, initializeCapabilities, invoke, setContextPath, setEndpointReference, setEnvironment, setInitializationParameters, setLog, setResourceManager, setWsdlPath, setWsdlPortType, shutdown, shutdownCapabilities, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.muse.core.Resource
getContextPath, getEndpointReference, getEnvironment, getLog, getResourceManager, getWsdlPath, getWsdlPortType, invoke, setContextPath, setEndpointReference, setEnvironment, setLog, setResourceManager, setWsdlPath, setWsdlPortType
 
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

SimpleWsResource

public SimpleWsResource()
Method Detail

createMetadataDescriptor

protected MetadataDescriptor createMetadataDescriptor(Document wsdl)
Parameters:
wsdl - The DOM document holding the resource's WSDL.
Returns:
The metadata descriptor referenced in the resource's WSDL, or an 'open' descriptor (no restrictions) if none is found.

createPropertiesSchema

protected ResourcePropertiesSchema createPropertiesSchema(Document wsdl)
Parameters:
wsdl - The DOM document holding the resource's WSDL.
Returns:
The WSRP document schema from the WSDL's types section, or an 'open' schema (no restrictions) if none is found.

createPropertyCollection

protected ResourcePropertyCollection createPropertyCollection()
This method returns the concrete WSRP state model - this is not the implementation of the WSRP capabilities (which map SOAP requests to WSRP operations), but it does implement the actual WSRP operations and does the delegation of read/write requests to the capabilities defining the properties. It is available no matter how many of the WSRP capabilites are exposed to remote clients.

You can replace the default implementation by overriding this method to instantiate a different concrete class. You would then specify the name of your new sub-class using the java-resource-class element in muse.xml.

Returns:
An instance of SimpleResourcePropertyCollection.

getPropertyCollection

public final ResourcePropertyCollection getPropertyCollection()
Specified by:
getPropertyCollection in interface WsResource
Returns:
The internal WSRP state model - despite the fact that this has all of the WSRP operations available, none of them is exposed to remote clients until one or more of the WSRP capabilities is used in the resource's definition.
See Also:
GetCapability, QueryCapability, SetCapability

initialize

public void initialize()
                throws SoapFault


The SimpleWsResource implementation takes the following steps:
  1. Create WSRP state model - createPropertyCollection()

  2. Create WSRP document schema and apply it to the collection.

  3. Create WSRP metadata and apply it to the collection.

  4. Call super.initialize() to initialize capabilities. The WSRP collection is now available to the capabilities during their startup cycle.

  5. Apply metadata by creating components needed to enforce it.

  6. Validate WSRP document according to schema and metadata.

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

addCapability

public void addCapability(Capability capability)
Registers the given capability instance with the resource.

Parameters:
capability -

getCapability

public Capability getCapability(String capabilityURI)
Parameters:
capabilityURI -
Returns:
The Capability associated with the given URI, or null if no such capability exists.

getCapabilityURIs

public Collection getCapabilityURIs()
Returns:
The URIs of all of the capabilities added to the resource.

hasCapability

public boolean hasCapability(String capabilityURI)
Parameters:
capabilityURI -
Returns:
True, if getCapability(String) returns a non-null value.


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