org.wso2.registry.jdbc.handlers
Class Handler

java.lang.Object
  extended by org.wso2.registry.jdbc.handlers.Handler
Direct Known Subclasses:
Axis2RepositoryHandler, CommentCollectionURLHandler, CommentURLHandler, RatingCollectionURLHandler, RatingURLHandler, SQLQueryHandler, SynapseRepositoryHandler, TagCollectionURLHandler, TagURLHandler, WSDLMediaTypeHandler, XSDMediaTypeHandler

public abstract class Handler
extends java.lang.Object

Base class of all handler implementations. Provides the methods that handlers should implement. This class also provides the datasource, user realm, registry and repository instances to be used by handler impls.


Field Summary
protected  AuthorizationUtil authorizationUtil
          Some common authorization tasks are implemented in this util.
protected  Registry registry
          Instance of the Registry implementation (possibly the JDBCRegistry).
protected  Repository repository
          Handlers can use this repository to perform resource operations directly with the database, without being intercepted by other media type handlers.
protected  ResourceDAO resourceDAO
          ResourceDAO for directly accessing resources.
 
Constructor Summary
Handler()
           
Handler(Repository repository, Registry registry)
           
 
Method Summary
abstract  void delete(RequestContext requestContext)
          Processes the DELETE action of the media type.
abstract  Resource get(RequestContext requestContext)
          Processes the GET action for resource path of the requestContext.
abstract  void importChild(RequestContext requestContext)
          Invokes when a child resource is imported.
abstract  void importResource(RequestContext requestContext)
          Creates a resource in the given path by fetching the resource content from the given URL.
abstract  void put(RequestContext requestContext)
          Processes the PUT action.
abstract  void putChild(RequestContext requestContext)
          Invokes when a child resource is added.
 void setRegistry(Registry registry)
           
 void setRepository(Repository repository)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

repository

protected Repository repository
Handlers can use this repository to perform resource operations directly with the database, without being intercepted by other media type handlers. It takes care of all version handling operations. It is recommended to use the methods of the repository to put or get resources once the handler specific processing is completed, rather directly using database connections obtained from the datasource.


registry

protected Registry registry
Instance of the Registry implementation (possibly the JDBCRegistry). Media type handler authors can use this registry to perform any action within the media type handler. e.g. tagging, commenting, rating However it is not recommended to use this for put, get, delete and import operations. If this is used for those operations, it will invoke the media type handlers again, which could possibly result in an infinite loop. Use the DefaultMediaTypeHandler instance, which can be obtained from the given MediaTypeManager instance for those four operations.


resourceDAO

protected ResourceDAO resourceDAO
ResourceDAO for directly accessing resources.


authorizationUtil

protected AuthorizationUtil authorizationUtil
Some common authorization tasks are implemented in this util.

Constructor Detail

Handler

public Handler()

Handler

public Handler(Repository repository,
               Registry registry)
Method Detail

get

public abstract Resource get(RequestContext requestContext)
                      throws RegistryException
Processes the GET action for resource path of the requestContext.

Parameters:
requestContext - Information about the current request. requestContext.resourcePath: Path of the resource requestContext.resource: Resource at the given path. This can be null if no other handler has retrieved that resource so far. If it contains a value, matching handlers are free to do any change to the resource, even thay can replace the resource with completely new instance.
Returns:
Resource instance if the handler processed the GET action successfully.
Throws:
RegistryException - If the media type handler is supposed to handle the get on the media type and if the get fails due a handler specific error

put

public abstract void put(RequestContext requestContext)
                  throws RegistryException
Processes the PUT action. Actual path to which the resource is put may differ from the path given in the requestContext.resourcePath. Therefore, after putting the resource, the actual path to which the resource is put is set in the requestContext.actualPath.

Parameters:
requestContext - Information about the current request. requestContext.resourcePath: Path to put the resource. requestContext.resource: Resource to put
Throws:
RegistryException - If the media type handler is supposed to handle the put on the media type and if the put fails due a handler specific error

importResource

public abstract void importResource(RequestContext requestContext)
                             throws RegistryException
Creates a resource in the given path by fetching the resource content from the given URL.

Parameters:
requestContext - Information about the current request. requestContext.resourcePath: Path to add the new resource. requestContext.sourceURL: URL to fetch the resource content requestContext.resource: Resource instance containing the metadata for the resource to be imported. Once import is done, new resource is created combining the metadata of this metadata object and the imported content.
Throws:
RegistryException - If the media type handler is supposed to handle the import on the media type and if the import fails due a handler specific error

delete

public abstract void delete(RequestContext requestContext)
                     throws RegistryException
Processes the DELETE action of the media type.

Parameters:
requestContext - Information about the current request. requestContext.resourcePath: path path of the resource to be deleted.
Throws:
RegistryException - If the media type handler is supposed to handle the delete on the media type and if the delete fails due a handler specific error

putChild

public abstract void putChild(RequestContext requestContext)
                       throws RegistryException
Invokes when a child resource is added. Only the media type handlers of collection resources may have a meaningfull implementation of this method.

Parameters:
requestContext - requestContext.resourcePath: path of the parent collection requestContext.resource: New child resource to be added
Throws:
RegistryException - If the media type handler is supposed to handle the putChild on the media type and if the putChild fails due a handler specific error

importChild

public abstract void importChild(RequestContext requestContext)
                          throws RegistryException
Invokes when a child resource is imported. Only the media type handlers of collection resources may have a meaningfull implementation of this method.

Parameters:
requestContext - requestContext.resourcePath
Throws:
RegistryException - If the media type handler is supposed to handle the importChild on the media type and if the importChild fails due a handler specific error

setRepository

public void setRepository(Repository repository)

setRegistry

public void setRegistry(Registry registry)


Copyright © 2007 Apache Web Services Project. All Rights Reserved.