org.sapia.soto.util
Class SotoResourceHandlerChain

java.lang.Object
  extended by org.sapia.resource.ResourceHandlerChain
      extended by org.sapia.soto.util.SotoResourceHandlerChain
All Implemented Interfaces:
org.sapia.resource.ResourceCapable

public class SotoResourceHandlerChain
extends org.sapia.resource.ResourceHandlerChain

Author:
Yanick Duchesne

Constructor Summary
SotoResourceHandlerChain()
           
 
Method Summary
 void addResourceAlias(ResourceAlias alias)
           
 org.sapia.resource.Resource resolveResource(java.lang.String uri)
           
 org.sapia.resource.ResourceHandler select(java.lang.String uri)
          Selects a ResourceHandler from this instance and returns it.
 
Methods inherited from class org.sapia.resource.ResourceHandlerChain
append, doSelect, prepend
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SotoResourceHandlerChain

public SotoResourceHandlerChain()
Method Detail

addResourceAlias

public void addResourceAlias(ResourceAlias alias)
Parameters:
alias - a ResourceAlias

resolveResource

public org.sapia.resource.Resource resolveResource(java.lang.String uri)
                                            throws org.sapia.resource.ResourceNotFoundException,
                                                   java.io.IOException
Specified by:
resolveResource in interface org.sapia.resource.ResourceCapable
Overrides:
resolveResource in class org.sapia.resource.ResourceHandlerChain
Throws:
org.sapia.resource.ResourceNotFoundException
java.io.IOException

select

public org.sapia.resource.ResourceHandler select(java.lang.String uri)
Selects a ResourceHandler from this instance and returns it. The handler is chose based on the given URI.

This instance traverses its handlers, calling the accepts() method on them (the method takes the given URI as a parameter). The first handler that "accepts" the URI (by returning true) is returned to the caller. If no handler as accepted the URI, null is returned.

Overrides:
select in class org.sapia.resource.ResourceHandlerChain
Parameters:
uri - a URI.
Returns:
a ResourceHandler , or null if no handler could be found for the given URI.


Copyright © 2010 Sapia OSS. All Rights Reserved.