public class HandlerManager extends Object
addHandler(java.lang.String[], org.wso2.carbon.registry.core.jdbc.handlers.filters.Filter, org.wso2.carbon.registry.core.jdbc.handlers.Handler)
method. Handlers are allowed for a subset
of Registry API methods (see Java doc of Handler class for more details). Handler authors can
further specify exactly for which methods their 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 evaluates 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 and Description |
---|
HandlerManager() |
Modifier and Type | Method and Description |
---|---|
void |
addAssociation(RequestContext requestContext)
Manages the handler invocations of ADD_ASSOCIATION method.
|
String |
addComment(RequestContext requestContext)
Manages the handler invocations of ADD_COMMENT method.
|
void |
addHandler(String[] methods,
Filter filter,
Handler handler)
Registers handlers with the handler manager.
|
void |
addHandler(String[] methods,
Filter filter,
Handler handler,
String lifecyclePhase)
Registers handlers belonging to the given lifecycle phase with the handler manager.
|
void |
addHandlerWithPriority(String[] methods,
Filter filter,
Handler handler)
This is to add a handler that invokes with the high priority, it becomes the first in the
list until another handler with this method is added.
|
void |
addHandlerWithPriority(String[] methods,
Filter filter,
Handler handler,
String lifecyclePhase)
This is to add a handler belonging to the given lifecycle phase that invokes with the high
priority, it becomes the first in the list until another handler with this method is added.
|
void |
applyTag(RequestContext requestContext)
Manages the handler invocations of APPLY_TAG method.
|
String |
copy(RequestContext requestContext)
Manages the handler invocations of COPY method.
|
void |
createLink(RequestContext requestContext)
Manages the handler invocations of CREATE_LINK method.
|
void |
createVersion(RequestContext requestContext)
Manages the handler invocations of CREATE_VERSION method.
|
void |
delete(RequestContext requestContext)
Manages the handler invocations of DELETE method.
|
org.apache.axiom.om.OMElement |
dump(RequestContext requestContext)
Manages the handler invocations of DUMP method.
|
org.apache.axiom.om.OMElement |
dumpLite(RequestContext requestContext)
Manages the handler invocations of DUMP method.
|
void |
editComment(RequestContext requestContext)
Manages the handler invocations of REMOVE_COMMENT method.
|
Collection |
executeQuery(RequestContext requestContext)
Manages the handler invocations of EXECUTE_QUERY method.
|
Resource |
get(RequestContext requestContext)
Manages the handler invocations of GET method.
|
Association[] |
getAllAssociations(RequestContext requestContext)
Manages the handler invocations of GET_ALL_ASSOCIATIONS method.
|
Association[] |
getAssociations(RequestContext requestContext)
Manages the handler invocations of GET_ASSOCIATIONS method.
|
float |
getAverageRating(RequestContext requestContext)
Manages the handler invocations of GET_AVERAGE_RATING method.
|
Comment[] |
getComments(RequestContext requestContext)
Manages the handler invocations of GET_COMMENTS method.
|
int |
getRating(RequestContext requestContext)
Manages the handler invocations of GET_RATING method.
|
RegistryContext |
getRegistryContext(RequestContext requestContext)
Manages the handler invocations of GET_REGISTRY_CONTEXT method.
|
TaggedResourcePath[] |
getResourcePathsWithTag(RequestContext requestContext)
Manages the handler invocations of GET_RESOURCE_PATHS_WITH_TAG method.
|
Tag[] |
getTags(RequestContext requestContext)
Manages the handler invocations of GET_TAGS method.
|
String[] |
getVersions(RequestContext requestContext)
Manages the handler invocations of GET_VERSIONS method.
|
void |
importChild(RequestContext requestContext)
Manages the handler invocations of IMPORT_CHILD method.
|
String |
importResource(RequestContext requestContext)
Manages the handler invocations of IMPORT method.
|
void |
invokeAspect(RequestContext requestContext)
Manages the handler invocations of INVOKE_ASPECT method.
|
boolean |
isProcessingComplete(RequestContext requestContext)
Determines whether the processing of the request is completed or not.
|
String |
move(RequestContext requestContext)
Manages the handler invocations of MOVE method.
|
String |
put(RequestContext requestContext)
Manages the handler invocations of PUT method.
|
void |
putChild(RequestContext requestContext)
Manages the handler invocations of PUT_CHILD method.
|
void |
rateResource(RequestContext requestContext)
Manages the handler invocations of RATE_RESOURCE method.
|
void |
removeAssociation(RequestContext requestContext)
Manages the handler invocations of REMOVE_ASSOCIATION method.
|
void |
removeComment(RequestContext requestContext)
Manages the handler invocations of EDIT_COMMENT method.
|
void |
removeHandler(Handler handler)
remove a handler from all the filters, all the methods
|
void |
removeHandler(Handler handler,
String lifecyclePhase)
remove a handler belonging to the given lifecycle phase from all the filters, all the
methods
|
void |
removeHandler(String[] methods,
Filter filter,
Handler handler)
Removes handlers with the handler manager.
|
void |
removeHandler(String[] methods,
Filter filter,
Handler handler,
String lifecyclePhase)
Removes handlers belonging to the given lifecycle phase with the handler manager.
|
void |
removeLink(RequestContext requestContext)
Manages the handler invocations of REMOVE_LINK method.
|
void |
removeTag(RequestContext requestContext)
Manages the handler invocations of REMOVE_TAG method.
|
String |
rename(RequestContext requestContext)
Manages the handler invocations of RENAME method.
|
boolean |
resourceExists(RequestContext requestContext)
Manages the handler invocations of RESOURCE_EXISTS method.
|
void |
restore(RequestContext requestContext)
Manages the handler invocations of RESTORE method.
|
void |
restoreVersion(RequestContext requestContext)
Manages the handler invocations of RESTORE_VERSION method.
|
Collection |
searchContent(RequestContext requestContext)
Manages the handler invocations of SEARCH_CONTENT method.
|
void |
setEvaluateAllHandlers(boolean evaluateAllHandlers) |
public void addHandler(String[] methods, Filter filter, Handler handler)
methods
- Methods for which the registered handler should be engaged. Allowed values in
the string array are "GET", "PUT", "IMPORT", "DELETE", "PUT_CHILD",
"IMPORT_CHILD", "MOVE", "COPY", "RENAME", "CREATE_LINK", "REMOVE_LINK",
"ADD_ASSOCIATION", "RESOURCE_EXISTS", "REMOVE_ASSOCIATION",
"GET_ASSOCIATIONS", "GET_ALL_ASSOCIATIONS", "APPLY_TAG",
"GET_RESOURCE_PATHS_WITH_TAG", "GET_TAGS", "REMOVE_TAG", "ADD_COMMENT",
"EDIT_COMMENT", "GET_COMMENTS", "RATE_RESOURCE", "GET_AVERAGE_RATING",
"GET_RATING", "CREATE_VERSION", "GET_VERSIONS", "RESTORE_VERSION",
"EXECUTE_QUERY", "SEARCH_CONTENT", and "INVOKE_ASPECT". If null is given,
handler will be engaged to all methods.filter
- Filter instance associated with the handler.handler
- Handler instance to be registered.public void addHandler(String[] methods, Filter filter, Handler handler, String lifecyclePhase)
methods
- Methods for which the registered handler should be engaged. Allowed
values in the string array are "GET", "PUT", "IMPORT", "DELETE",
"PUT_CHILD", "IMPORT_CHILD", "MOVE", "COPY", "RENAME", "CREATE_LINK",
"REMOVE_LINK", "ADD_ASSOCIATION", "RESOURCE_EXISTS",
"REMOVE_ASSOCIATION", "GET_ASSOCIATIONS", "GET_ALL_ASSOCIATIONS",
"APPLY_TAG", "GET_RESOURCE_PATHS_WITH_TAG", "GET_TAGS", "REMOVE_TAG",
"ADD_COMMENT", "EDIT_COMMENT", "GET_COMMENTS", "RATE_RESOURCE",
"GET_AVERAGE_RATING", "GET_RATING", "CREATE_VERSION", "GET_VERSIONS",
"RESTORE_VERSION", "EXECUTE_QUERY", "SEARCH_CONTENT", and
"INVOKE_ASPECT". If null is given, handler will be engaged to all
methods.filter
- Filter instance associated with the handler.lifecyclePhase
- The name of the lifecycle phase.handler
- Handler instance to be registered.public void addHandlerWithPriority(String[] methods, Filter filter, Handler handler)
methods
- Methods for which the registered handler should be engaged. Allowed values in
the string array are "GET", "PUT", "IMPORT", "DELETE", "PUT_CHILD",
"IMPORT_CHILD", "MOVE", "COPY", "RENAME", "CREATE_LINK", "REMOVE_LINK",
"ADD_ASSOCIATION", "RESOURCE_EXISTS", "REMOVE_ASSOCIATION",
"GET_ASSOCIATIONS", "GET_ALL_ASSOCIATIONS", "APPLY_TAG",
"GET_RESOURCE_PATHS_WITH_TAG", "GET_TAGS", "REMOVE_TAG", "ADD_COMMENT",
"EDIT_COMMENT", "GET_COMMENTS", "RATE_RESOURCE", "GET_AVERAGE_RATING",
"GET_RATING", "CREATE_VERSION", "GET_VERSIONS", "RESTORE_VERSION",
"EXECUTE_QUERY", "SEARCH_CONTENT", and "INVOKE_ASPECT". If null is given,
handler will be engaged to all methods.filter
- Filter instance associated with the handler.handler
- Handler instance to be registered.public void addHandlerWithPriority(String[] methods, Filter filter, Handler handler, String lifecyclePhase)
methods
- Methods for which the registered handler should be engaged. Allowed
values in the string array are "GET", "PUT", "IMPORT", "DELETE",
"PUT_CHILD", "IMPORT_CHILD", "MOVE", "COPY", "RENAME", "CREATE_LINK",
"REMOVE_LINK", "ADD_ASSOCIATION", "RESOURCE_EXISTS",
"REMOVE_ASSOCIATION", "GET_ASSOCIATIONS", "GET_ALL_ASSOCIATIONS",
"APPLY_TAG", "GET_RESOURCE_PATHS_WITH_TAG", "GET_TAGS", "REMOVE_TAG",
"ADD_COMMENT", "EDIT_COMMENT", "GET_COMMENTS", "RATE_RESOURCE",
"GET_AVERAGE_RATING", "GET_RATING", "CREATE_VERSION", "GET_VERSIONS",
"RESTORE_VERSION", "EXECUTE_QUERY", "SEARCH_CONTENT", and
"INVOKE_ASPECT". If null is given, handler will be engaged to all
methods.filter
- Filter instance associated with the handler.lifecyclePhase
- The name of the lifecycle phase.handler
- Handler instance to be registered.public void removeHandler(Handler handler)
handler
- the handler to removepublic void removeHandler(Handler handler, String lifecyclePhase)
handler
- the handler to remove.lifecyclePhase
- The name of the lifecycle phase.public void removeHandler(String[] methods, Filter filter, Handler handler)
methods
- Methods for which the registered handler should be disengaged. Allowed values
in the string array are "GET", "PUT", "IMPORT", "DELETE", "PUT_CHILD",
"IMPORT_CHILD", "MOVE", "COPY", "RENAME", "CREATE_LINK", "REMOVE_LINK",
"ADD_ASSOCIATION", "RESOURCE_EXISTS", "REMOVE_ASSOCIATION",
"GET_ASSOCIATIONS", "GET_ALL_ASSOCIATIONS", "APPLY_TAG",
"GET_RESOURCE_PATHS_WITH_TAG", "GET_TAGS", "REMOVE_TAG", "ADD_COMMENT",
"EDIT_COMMENT", "GET_COMMENTS", "RATE_RESOURCE", "GET_AVERAGE_RATING",
"GET_RATING", "CREATE_VERSION", "GET_VERSIONS", "RESTORE_VERSION",
"EXECUTE_QUERY", "SEARCH_CONTENT", and "INVOKE_ASPECT". If null is given,
handler will be disengaged to all methods.filter
- Filter instance associated with the handler. Each filter that you pass in must
have the associated handler set to it.handler
- Handler instance to be unregistered.public void removeHandler(String[] methods, Filter filter, Handler handler, String lifecyclePhase)
methods
- Methods for which the registered handler should be disengaged. Allowed
values in the string array are "GET", "PUT", "IMPORT", "DELETE",
"PUT_CHILD", "IMPORT_CHILD", "MOVE", "COPY", "RENAME", "CREATE_LINK",
"REMOVE_LINK", "ADD_ASSOCIATION", "RESOURCE_EXISTS",
"REMOVE_ASSOCIATION", "GET_ASSOCIATIONS", "GET_ALL_ASSOCIATIONS",
"APPLY_TAG", "GET_RESOURCE_PATHS_WITH_TAG", "GET_TAGS", "REMOVE_TAG",
"ADD_COMMENT", "EDIT_COMMENT", "GET_COMMENTS", "RATE_RESOURCE",
"GET_AVERAGE_RATING", "GET_RATING", "CREATE_VERSION", "GET_VERSIONS",
"RESTORE_VERSION", "EXECUTE_QUERY", "SEARCH_CONTENT", and
"INVOKE_ASPECT". If null is given, handler will be disengaged to all
methods.filter
- Filter instance associated with the handler. Each filter that you pass
in must have the associated handler set to it.handler
- Handler instance to be unregistered.lifecyclePhase
- The name of the lifecycle phase.public boolean isProcessingComplete(RequestContext requestContext)
requestContext
- Details of the request.public void removeComment(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public void editComment(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public void createVersion(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public void restoreVersion(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public void rateResource(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public void removeTag(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public void applyTag(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public void removeAssociation(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public void addAssociation(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public Association[] getAllAssociations(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public Association[] getAssociations(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public TaggedResourcePath[] getResourcePathsWithTag(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public Tag[] getTags(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public Comment[] getComments(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public float getAverageRating(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public int getRating(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public String[] getVersions(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public Collection executeQuery(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public Collection searchContent(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public String addComment(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public Resource get(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public String put(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public String importResource(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public void delete(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public void putChild(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public void importChild(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public void invokeAspect(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public String copy(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public String move(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public String rename(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public void createLink(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public void removeLink(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public boolean resourceExists(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public RegistryContext getRegistryContext(RequestContext requestContext)
requestContext
- Details of the request.public org.apache.axiom.om.OMElement dump(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public void restore(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.public void setEvaluateAllHandlers(boolean evaluateAllHandlers)
public org.apache.axiom.om.OMElement dumpLite(RequestContext requestContext) throws RegistryException
requestContext
- Details of the request.RegistryException
- This exception is thrown for all exceptions occurred inside
handlers or filters.Copyright © 2016 WSO2 Inc. All Rights Reserved.