org.wso2.registry.jdbc.handlers
Class HandlerManager

java.lang.Object
  extended by org.wso2.registry.jdbc.handlers.HandlerManager

public class HandlerManager
extends java.lang.Object

Manages the handlers and thier invocations. Handlers, which are required to be invoked must be registered with this class using the addHanlder(...) method. Handlers are allowed for a subset of Registry API methods (see Java doc of Handler class for more detrails). Handler authors can further specify exactly for which methods thier handlers should engage. For example, handler author may specify his handler should be engaged only for GET and DELETE operations. This class maintains separate maps for each supported operation and puts handlers to corresponding maps once registered. Handlers are registered with a Filter instance. Filter decides (based on the request) whether or not to invoke its associated handler. This class has a separate method for each supported operation. These methods are invoked by BasicRegistry once such method is invoked in the Registry API. Then this class iterates through the map corresponding to the invoked method and evalautes filters of registered handlers. For each filter which evaluates to true, its associated handler will be invoked. This process continues either till there is no more handlers or till the processingComplete parameter of the RequestContext is set to true. There is only one instance of this class exists per registry instance.


Constructor Summary
HandlerManager()
           
 
Method Summary
 void addHandler(java.lang.String[] methods, Filter filter, Handler handler)
          Registers handlers with the handler manager.
 void delete(RequestContext requestContext)
          Manages the handler invocations of DELETE method.
 Resource get(RequestContext requestContext)
          Manages the handler invocations of GET method.
 void importChild(RequestContext requestContext)
          Manages the handler invocations of IMPORT_CHILD method.
 java.lang.String importResource(RequestContext requestContext)
          Manages the handler invocations of IMPORT method.
 java.lang.String put(RequestContext requestContext)
          Manages the handler invocations of PUT method.
 void putChild(RequestContext requestContext)
          Manages the handler invocations of PUT_CHILD method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HandlerManager

public HandlerManager()
Method Detail

addHandler

public void addHandler(java.lang.String[] methods,
                       Filter filter,
                       Handler handler)
Registers handlers with the handler manager. Each handler should be registered with a Filter. If a handler should be engaged only to a subset of allowed methods, those methods can be specified as a string array.

Parameters:
methods - Methods for which the registered handler should be engaged. Allowed values in the string array are "GET", "PUT", "IMPORT", "DELETE", "PUT_CHILD", and "IMPORT_CHILD". If null is given, handler will be engaged to all methods.
filter - Filter instance associated with the handler.
handler - Handler instance to be registered.

get

public Resource get(RequestContext requestContext)
             throws RegistryException
Manages the handler invocations of GET method.

Parameters:
requestContext - Details of the request.
Returns:
Resource requested from the GET operation.
Throws:
RegistryException - This exception is thrown for all exceptions occured inside handlers or filters.

put

public java.lang.String put(RequestContext requestContext)
                     throws RegistryException
Manages the handler invocations of PUT method.

Parameters:
requestContext - Details of the request.
Returns:
Path where the resource is actually stored. Subsequent accesses to the resource should use this path.
Throws:
RegistryException - This exception is thrown for all exceptions occured inside handlers or filters.

importResource

public java.lang.String importResource(RequestContext requestContext)
                                throws RegistryException
Manages the handler invocations of IMPORT method.

Parameters:
requestContext - Details of the request.
Returns:
Path where the resource is actually stored. Subsequent accesses to the resource should use this path.
Throws:
RegistryException - This exception is thrown for all exceptions occured inside handlers or filters.

delete

public void delete(RequestContext requestContext)
            throws RegistryException
Manages the handler invocations of DELETE method.

Parameters:
requestContext - Details of the request.
Throws:
RegistryException - This exception is thrown for all exceptions occured inside handlers or filters.

putChild

public void putChild(RequestContext requestContext)
              throws RegistryException
Manages the handler invocations of PUT_CHILD method.

Parameters:
requestContext - Details of the request.
Throws:
RegistryException - This exception is thrown for all exceptions occured inside handlers or filters.

importChild

public void importChild(RequestContext requestContext)
                 throws RegistryException
Manages the handler invocations of IMPORT_CHILD method.

Parameters:
requestContext - Details of the request.
Throws:
RegistryException - This exception is thrown for all exceptions occured inside handlers or filters.


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