    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class w3c.jigsaw.resources.FilteredResource

    java.lang.Object
       |
       +----w3c.tools.store.AttributeHolder
               |
               +----w3c.tools.store.Resource
                       |
                       +----w3c.jigsaw.resources.HTTPResource
                               |
                               +----w3c.jigsaw.resources.FilteredResource

public class FilteredResource
extends HTTPResource

Filtered resources. A filtered resource is a resource that can be filtered through any filters. Filters are trigered at three points during request processing:

- During the lookup, so that they have a chance to check any access rights,
- Before the request is actually processed by its target resource,
- And optionally, after the request has been processed (depending on the return value of the second stage.).

See Also:
  ResourceFilter

##

filters
  Our list of filters.

##

FilteredResource()

##

definesAttribute(int)
  Does this resource or one of its filters define the given attribute.
getClone(Object[])
  Clone this filtered resource.
getFilters()
  Get our whole list of filters.
getFilters(Class, ResourceFilter[])
  Get the list of filters of this class.
getValue(int, Object)
  Filters can supply part of the attributes value for a resource.
lookup(LookupState, LookupResult)
  Register our filters, if any in the lookup result object.
pickle(DataOutputStream)
  Pickle a filtered resource.
registerFilter(ResourceFilter, Hashtable)
  Register a new filter to this resource.
unpickleInstance(DataInputStream, Hashtable, boolean)
  Unpickle a filtered resource.
unregisterFilter(ResourceFilter)
  Unregister a filter to this target.

##

filters

      protected ResourceFilter filters[]

  Our list of filters.

##

FilteredResource

      public FilteredResource()

##

getClone

      public synchronized Object getClone(Object values[])

  Clone this filtered resource. The filters that are plugged on the resource get cloned too.
  Overrides:
    getClone in class AttributeHolder

getFilters

      public synchronized ResourceFilter[] getFilters()

  Get our whole list of filters.

getFilters

      public synchronized int getFilters(Class cls,
                                         ResourceFilter into[])

  Get the list of filters of this class.
  Parameters:
    cls - The class of filters requested.
    into - The array of resource filters to save found filters.
  Returns:
    The number of filters found.

registerFilter

      public synchronized void registerFilter(ResourceFilter filter,
                                              Hashtable defs)

  Register a new filter to this resource. This method register a new filter to the this filtered resource. The provided filter should be an uninitialized ResourceFilter instance.
  Parameters:
    The - uninitialized filter.

unregisterFilter

      public synchronized void unregisterFilter(ResourceFilter filter)

  Unregister a filter to this target.
  Parameters:
    filter - The filter to unregister.

definesAttribute

      public synchronized boolean definesAttribute(int idx) throws IllegalAttributeAccess

  Does this resource or one of its filters define the given attribute.
  Parameters:
    idx - The attribute index.
  Returns:
    A boolean true if attribute is defined.
  Overrides:
    definesAttribute in class AttributeHolder

getValue

      public synchronized Object getValue(int idx,
                                          Object def) throws IllegalAttributeAccess

  Filters can supply part of the attributes value for a resource. This method lookup the current resource for an attribute value, and than examine all its filters, to look for a filter-supplied value.
  Parameters:
    idx - The index of the queried attribute.
    def - The default return value.
  Returns:
    The attribute value, or the provided default value if undef.
  Overrides:
    getValue in class AttributeHolder

lookup

      public boolean lookup(LookupState ls,
                            LookupResult lr) throws HTTPException

  Register our filters, if any in the lookup result object. Sub-classes of the FilteredResource class should either register their filters themselves, or call their super method. The latest way is prefered, of course.
  Parameters:
    ls - The current lookup state.
    lr - The lookup result, being constructed.
  Returns:
    A boolean, true if lookup has found a terminal node, false otherwise. In the latter case, the caller should make sure to continue the lookup process.
  Throws: HTTPException
    If something went wrong.
  Overrides:
    lookup in class HTTPResource

pickle

      public synchronized void pickle(DataOutputStream out) throws IOException

  Pickle a filtered resource. Pickle the resource itself, along with its associated filters.
  Parameters:
    out - The data output stream to pickle to.
  Overrides:
    pickle in class AttributeHolder

unpickleInstance

      public AttributeHolder unpickleInstance(DataInputStream in,
                                              Hashtable defs,
                                              boolean init) throws IOException

  Unpickle a filtered resource. If the resource is not to be initialized, both the resource and its filters aren't initialized.
  Parameters:
    in - The input stream to unpickle from.
    defs - The default attributes for the unpickled resource.
    init - Should the resource be initialize ?
  Throws: IOException
    If the stream could not be read.
  Overrides:
    unpickleInstance in class AttributeHolder

    All Packages  Class Hierarchy  This Package  Previous  Next  Index