org.wso2.registry.jdbc.urlhandlers
Class URLHandler

java.lang.Object
  extended by org.wso2.registry.jdbc.urlhandlers.URLHandler
Direct Known Subclasses:
CommentCollectionURLHandler, CommentURLHandler, RatingsCollectionURLHandler, RatingURLHandler, TagURLHandler

public abstract class URLHandler
extends java.lang.Object

Base class for URL handlers. URL handlers are used support virtual resources. JDBC registry allows users to access some none-resource entities in the same way they access normal resources (e.g. comments, tags, ratings). These entities can be accessed by providing a special URL to identify the virtual resource.

For example tags for the resource at path /projects/mybank/design can be accessed by the URL /projects/mybank/design?tags. URL handlers are used to support that behavior. That is, we can register URL handlers to handle each type of virtual resource. Then those URL handlers are responsible for interpreting the special URL and generating the virtual resource referred by that URL.


Field Summary
protected  javax.sql.DataSource dataSource
           
protected  org.wso2.usermanager.Realm realm
           
 
Constructor Summary
protected URLHandler()
           
  URLHandler(javax.sql.DataSource dataSource, org.wso2.usermanager.Realm realm)
           
 
Method Summary
 boolean delete(java.lang.String path)
          Determine if delete(...) on the given url can be handled.
 Resource get(java.lang.String url)
          Determine if get(...) on the given url can be handled.
 java.lang.String put(java.lang.String suggestPath, Resource resource)
          Determine if put(...) on the given url can be handled.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataSource

protected javax.sql.DataSource dataSource

realm

protected org.wso2.usermanager.Realm realm
Constructor Detail

URLHandler

public URLHandler(javax.sql.DataSource dataSource,
                  org.wso2.usermanager.Realm realm)

URLHandler

protected URLHandler()
Method Detail

get

public Resource get(java.lang.String url)
             throws RegistryException
Determine if get(...) on the given url can be handled. If yes, process the request and return the resulting resource. Further processing of the resource is terminated if a resource is returned. If the given url cannot be handled return null, which causes other url handlers to process the request, or the request to be reached the media type handlers.

Parameters:
url - URL to process
Returns:
Resource instance if the URL can be processed. Null if the request cannot be processed.
Throws:
RegistryException

put

public java.lang.String put(java.lang.String suggestPath,
                            Resource resource)
                     throws RegistryException
Determine if put(...) on the given url can be handled. If yes, process the request and persisting the resulting resource. Further processing of the resource is terminated if string (actual path) is returned. If the given url cannot be handled return null, which causes other url handlers to process the request, or the request to be reached the media type handlers.

Parameters:
suggestPath -
resource -
Returns:
Throws:
RegistryException

delete

public boolean delete(java.lang.String path)
               throws RegistryException
Determine if delete(...) on the given url can be handled. If yes, process the request and delete the resulting resource. Further processing of the resource is terminated if true is returned. If the given url cannot be handled return false, which causes other url handlers to process the request, or the request to be reached the media type handlers.

Parameters:
path -
Returns:
Throws:
RegistryException


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