org.apache.ws.resource
Interface ResourceHome

All Superinterfaces:
ResourceCreation, ResourceDestruction

public interface ResourceHome
extends ResourceCreation, ResourceDestruction

Defines a basic interface through which resources are discovered and removed. The purpose of ResourceHome is to interact with a collection of resources of the same type. Each resource type will have its own custom implementation the ResourceHome interface. The implementation is expected to provide custom methods for creating new resources and optionally methods that act on a set of resource objects.


Method Summary
 boolean add(Resource resource)
          Adds the specified resource to this home if it is not already present (optional operation).
 java.lang.Object extractResourceIdentifier(EndpointReference epr)
          Extracts the Resource identifier from the specified endpoint reference - typically, this is done by deserializing a particular reference parameter that represents the identifier.
 java.lang.Object extractResourceIdentifier(ResourceContext context)
          Extracts the Resource identifier from the specified resource context - typically, this is done by deserializing a particular SOAP header element that contains the identifier.
 Resource find(java.lang.Object resourceId)
          Retrieves a resource.
 MetadataConfiguration getMetadataConfig()
          Returns the MetadataConfigImpl containing any configured Metadata for the Service.
 java.lang.String getPortComponentName()
          Returns the name of the JSR-109 port component corresponding to this home.
 java.lang.String getResourceClassName()
          Returns the Class of the Resource Impl.
 java.lang.String getResourceIdentifierReferenceParameterName()
          Gets the name of the SOAP header element from which this home will extract a resource identifier.
 java.lang.String getServiceClassName()
          Returns the name of the Service class.
 java.lang.String getWsdlTargetNamespace()
          Returns the target namespace of the WSDL.
 void remove(java.lang.Object resourceId)
          Removes a resource.
 void setResourceClassName(java.lang.String className)
          Sets the classname of the Resource Impl.
 void setResourceIdentifierReferenceParameterName(java.lang.String name)
          Sets the name of the SOAP header element from which this home will extract a resource identifier.
 void setServiceClassName(java.lang.String className)
          Sets the Service Impl's .Class
 void setWsdlTargetNamespace(java.lang.String targetNamespace)
          Sets the target namespace of the WSDL of this home's service.
 
Methods inherited from interface org.apache.ws.resource.ResourceCreation
addResourceCreationListener, removeResourceCreationListener
 
Methods inherited from interface org.apache.ws.resource.ResourceDestruction
addResourceDestructionListener, removeResourceDestructionListener
 

Method Detail

getMetadataConfig

public MetadataConfiguration getMetadataConfig()
Returns the MetadataConfigImpl containing any configured Metadata for the Service.

Returns:
MetadataConfigImpl

getPortComponentName

public java.lang.String getPortComponentName()
Returns the name of the JSR-109 port component corresponding to this home. Note, the port component name ends up being the last path component of the service endpoint URL.

Returns:
the name of the JSR-109 port component corresponding to this home

setResourceClassName

public void setResourceClassName(java.lang.String className)
Sets the classname of the Resource Impl.

Parameters:
className - The class name of the Resource Impl.

getResourceClassName

public java.lang.String getResourceClassName()
Returns the Class of the Resource Impl.

Returns:
The Class of the Resource Impl

setResourceIdentifierReferenceParameterName

public void setResourceIdentifierReferenceParameterName(java.lang.String name)
Sets the name of the SOAP header element from which this home will extract a resource identifier. Set to null if this home manages a singleton resource.

Parameters:
name - resource identifier header element name, represented as a string as defined by QName.toString() (e.g. "{http://http://ws.apache.org/namespaces/wsrf/}ResourceIdentifier")

getResourceIdentifierReferenceParameterName

public java.lang.String getResourceIdentifierReferenceParameterName()
Gets the name of the SOAP header element from which this home will extract a resource identifier.

Returns:
the resource identifier header element name, represented as a string in the format defined by QName.toString(); or null if this home manages a singleton resource

setServiceClassName

public void setServiceClassName(java.lang.String className)
Sets the Service Impl's .Class

Parameters:
className - String representation of the class

getServiceClassName

public java.lang.String getServiceClassName()
Returns the name of the Service class.

Returns:
the name of the Service class

setWsdlTargetNamespace

public void setWsdlTargetNamespace(java.lang.String targetNamespace)
Sets the target namespace of the WSDL of this home's service.

Parameters:
targetNamespace -

getWsdlTargetNamespace

public java.lang.String getWsdlTargetNamespace()
Returns the target namespace of the WSDL.

Returns:
The String of the targetnamespace

add

public boolean add(Resource resource)
            throws IllegalResourceTypeException
Adds the specified resource to this home if it is not already present (optional operation). More formally, adds the specified resource, resource, to this home if this home contains no resource existing such that (resource.getID().equals(existing.getID()). If this home already contains a resource with the same ID as the specified resource, the call leaves the home unchanged and returns false. This method will also check to see if the EndpointReference (EPR) has been set on the Resource. If the EPR is null, it will create one and set it on the Resource.

Parameters:
resource - the resource to be added; must not be null
Throws:
java.lang.UnsupportedOperationException - if the add method is not supported by this home
IllegalResourceTypeException - if the resource is not of the type supported by this home

extractResourceIdentifier

public java.lang.Object extractResourceIdentifier(ResourceContext context)
Extracts the Resource identifier from the specified resource context - typically, this is done by deserializing a particular SOAP header element that contains the identifier.

Parameters:
context - a resource context
Returns:
the Resource identifier

extractResourceIdentifier

public java.lang.Object extractResourceIdentifier(EndpointReference epr)
Extracts the Resource identifier from the specified endpoint reference - typically, this is done by deserializing a particular reference parameter that represents the identifier.

Parameters:
epr - the endpoint reference of a WS-Resource
Returns:
the Resource identifier

find

public Resource find(java.lang.Object resourceId)
              throws ResourceUnknownException,
                     ResourceException
Retrieves a resource. Note: This function must not return null. It must either return the resource object or throw an exception if there is no resource with the specified identifier.
If a resource is found and its EndpointReference member variable is not set, the EndpointReference variable will get set on the resource with values obtained from the jndi-config configuration.

Parameters:
resourceId - a resource identifier
Returns:
non-null resource
Throws:
ResourceUnknownException - if no resource exists with the given key
ResourceException - if any other error occurs.

remove

public void remove(java.lang.Object resourceId)
            throws ResourceUnknownException,
                   ResourceException
Removes a resource. Invokes the resource's Resource.destroy() method prior to removal.

Throws:
ResourceUnknownException - if no resource exists with the given key
ResourceException - if any other error occurs


Copyright © 2004-2005 Apache Software Foundation. All Rights Reserved.