org.apache.muse.core
Interface Resource

All Superinterfaces:
Initialization, InitializationParameters, Shutdown
All Known Subinterfaces:
WsResource
All Known Implementing Classes:
SimpleResource, SimpleWsResource

public interface Resource
extends Initialization, InitializationParameters, Shutdown

Resource is an aggregate of Capability objects, providing a common host for them to share information and sub-components. The CapabilityContainer interface, while small, is the most important part of the Resource interface, for it describes Resource's primary role in the Muse framework.

This interface also acts as the final stop in the request delegation process, taking method invocation requests from the ResourceRouter and passing them along to the appropriate Capability based on its knowledge of each Capability's supported operations. This allows the Capability classes to do their work in a way that is independent of SOAP request-handling and other plumbing.

From a remote client perspective, Resource is the atomic unit of definition, since WSDL 1.1 does not allow resource interfaces to be broken down into distinct sub-interfaces (capabilities). However, from a server-side programming model perspective, Resource is not the most granular level of resource definition - users should focus on creating capabilities and use Resource as a means of communicating between those capabilities.

Author:
Dan Jemiolo (danj)
See Also:
CapabilityContainer, Capability, Capability.getResource()

Method Summary
 void addCapability(Capability capability)
          Registers the given capability instance with the resource.
 Capability getCapability(String capabilityURI)
           
 Collection getCapabilityURIs()
           
 String getContextPath()
           
 EndpointReference getEndpointReference()
           
 Environment getEnvironment()
           
 Logger getLog()
           
 ResourceManager getResourceManager()
           
 String getWsdlPath()
           
 QName getWsdlPortType()
           
 boolean hasCapability(String capabilityURI)
           
 Element invoke(Element soapBody)
          This is a generic method invocation mechanism that can be used to delegate request handling to a capability or some other component.
 void setContextPath(String contextPath)
           
 void setEndpointReference(EndpointReference epr)
           
 void setEnvironment(Environment environment)
           
 void setLog(Logger log)
           
 void setResourceManager(ResourceManager manager)
           
 void setWsdlPath(String wsdlPath)
           
 void setWsdlPortType(QName wsdlPortType)
           
 
Methods inherited from interface org.apache.muse.core.Initialization
hasBeenInitialized, initialize
 
Methods inherited from interface org.apache.muse.core.InitializationParameters
getInitializationParameter, getInitializationParameters, setInitializationParameters
 
Methods inherited from interface org.apache.muse.core.Shutdown
hasBeenShutdown, shutdown
 

Method Detail

getContextPath

String getContextPath()
Returns:
The unique part of the SOAP endpoint URL that defines this resource's type. Every resource type should have a unique SOAP endpoint. This value should map to a context-path value in muse.

getEndpointReference

EndpointReference getEndpointReference()
Returns:
The unique EPR of the resource instance.

getEnvironment

Environment getEnvironment()
Returns:
The resource's access point for things such as the WS-Addressing context, file system resources, and more.

getLog

Logger getLog()
Returns:
The JDK logger that writes to the Muse log file.

getResourceManager

ResourceManager getResourceManager()
Returns:
The ResourceManager that stores all of the resource type definitions and all current resource instances.

getWsdlPath

String getWsdlPath()
Returns:
The relative path of the WSDL file with the resource's portType.

getWsdlPortType

QName getWsdlPortType()
Returns:
The WSDL portType that defines the resource.

invoke

Element invoke(Element soapBody)
This is a generic method invocation mechanism that can be used to delegate request handling to a capability or some other component. It is intended to be used by code that is handling external requests, and it may not allow the invocation of all methods defined by the type. Internal clients should make 'normal' Java method calls with the actual method parameters; the getCapability(String) method provides access to the Capability objects that make up the resource type, all of which will have 'normal' Java methods for their operations.

Parameters:
soapBody - The parameters for the method, still in their SOAP Body form.
Returns:
The return value of the method, in SOAP Body form. If the operation resulted in a fault, the response XML should be the fault XML.

setContextPath

void setContextPath(String contextPath)

setEndpointReference

void setEndpointReference(EndpointReference epr)

setEnvironment

void setEnvironment(Environment environment)

setLog

void setLog(Logger log)

setResourceManager

void setResourceManager(ResourceManager manager)

setWsdlPath

void setWsdlPath(String wsdlPath)

setWsdlPortType

void setWsdlPortType(QName wsdlPortType)

addCapability

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

Parameters:
capability -

getCapability

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

getCapabilityURIs

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

hasCapability

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.