    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class w3c.jigsaw.resources.ResourceFilter

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

public class ResourceFilter
extends Resource
implements HTTPFilter, ResourceShadower

##

ATTR_TARGET
  Attribute index - Our target attribute.
target_attributes
  Our target attribute description:
target_values
  Our target shadowed values.

##

ResourceFilter()

##

definesTargetAttribute(int)
  Does this filters defines the given target attribute.
definesTargetAttribute(String)
  Does this filters defines the given target attribute.
getHelpURL()
  Get this resource's help url.
getHelpURL(String)
  Get the help URL for that resource's attribute.
getTargetAttributes()
  Get our target attribute list.
getTargetResource()
  Get our target resource.
getTargetValue(int, Object)
  Get a shadowed attribute value.
getTargetValue(String, Object)
  Get a shadowed attribute value (by name).
ingoingFilter(Request)
  Simplified ingoingFilter API.
ingoingFilter(Request, HTTPFilter[], int)
  The ingoingFilter method.
initialize(Object[])
  Initialize the filter.
lookup(LookupState, LookupResult)
  Lookup time filtering.
markModified()
  Mark this filter as modified.
outgoingFilter(Request, Reply)
  Simplified API to the outgoing filter metho.
outgoingFilter(Request, Reply, HTTPFilter[], int)
  The outgoingFilter method.
pickle(DataOutputStream)
  Pickle a filter.
setTargetValue(int, Object)
  Set a shadow attribute value.
setTargetValue(String, Object)
  Set a shadow attribute value.
unpickleInstance(DataInputStream, Hashtable, boolean)
  Unpickle a resource filter.

##

ATTR_TARGET

      protected static int ATTR_TARGET

  Attribute index - Our target attribute.

target_attributes

      protected Attribute target_attributes[]

  Our target attribute description:

target_values

      protected Object target_values[]

  Our target shadowed values.

##

ResourceFilter

      public ResourceFilter()

##

getHelpURL

      public String getHelpURL()

  Get this resource's help url.
  Returns:
    An URL, encoded as a String, or null if not available.
  Overrides:
    getHelpURL in class Resource

getHelpURL

      public String getHelpURL(String topic)

  Get the help URL for that resource's attribute.
  Parameters:
    topic - The topic (can be an attribute name, or a property, etc).
  Returns:
    A String encoded URL, or null.
  Overrides:
    getHelpURL in class Resource

getTargetResource

      public Resource getTargetResource()

  Get our target resource.

getTargetAttributes

      public Attribute[] getTargetAttributes()

  Get our target attribute list.

getTargetValue

      public Object getTargetValue(int idx,
                                   Object def)

  Get a shadowed attribute value.
  Parameters:
    idx - The index of the attribute.
    def - The default value to return if undef.
  Returns:
    The attribute value or the provided default value.

getTargetValue

      public Object getTargetValue(String name,
                                   Object def)

  Get a shadowed attribute value (by name).
  Parameters:
    name - The name of the attribute.
    def - The default value to return if undef.
  Returns:
    The attribute value or the provided default value.

setTargetValue

      public void setTargetValue(int idx,
                                 Object def)

  Set a shadow attribute value.
  Parameters:
    idx - The index of the attribute to set.
    value - Its new value.

setTargetValue

      public void setTargetValue(String name,
                                 Object def)

  Set a shadow attribute value.
  Parameters:
    name - The name of the attribute to set.
    value - Its new value.

definesTargetAttribute

      public boolean definesTargetAttribute(int idx)

  Does this filters defines the given target attribute.
  Parameters:
    idx - The index of the target attribute.
  Returns:
    A boolean true
  definesTargetAttribute

        public boolean definesTargetAttribute(String name)

    Does this filters defines the given target attribute.
    Parameters:
      name - The name of the target attribute.
    Returns:
      A boolean true
    markModified

          public void markModified()

      Mark this filter as modified. Delegate the dirty bit to our target.
      Overrides:
        markModified in class Resource
    lookup

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

      Lookup time filtering. This method is called while Jigsaw performs resource lookup. Each time a lookup end up on the target resource of that filter, this method will be called.
      Parameters:
        ls - The current lookup state.
        lr - The current lookup result.
      Returns:
        A boolean, true if this filter has performed the whole lookup, and side-effect the lookup result appropriatelly, false otherwise.
    ingoingFilter

          public Reply ingoingFilter(Request request) throws HTTPException

      Simplified ingoingFilter API. This is a default, simplified API to the ingoing filter method.
      Parameters:
        request - The request to filter.
      Returns:
        A Reply instance, or null if processing should continue normally.
      Throws: HTTPException
        If processing should be interrupted, because an abnormal situation occured.
    ingoingFilter

          public Reply ingoingFilter(Request request,
                                     HTTPFilter filters[],
                                     int i) throws HTTPException

      The ingoingFilter method. This is the method that really gets called by Jigsaw core. By default it will invoke the simpler `ingoingFilter` method, taking only the request has a parameter.
      Parameters:
        request - The request that is about to be handled.
        filters - The whole filter list to be applied to the resource.
        i - A pointer into the above array, indicating which filters have already been triggered (the one whose index are lower than i), and what filters have to be triggered (the one whose index are greater or equal to i+1).
      Returns:
        A Reply instance, if the filter did know how to answer the request without further processing, null otherwise.
    outgoingFilter

          public Reply outgoingFilter(Request request,
                                      Reply reply) throws HTTPException

      Simplified API to the outgoing filter metho. This is a simplified API to the ougoing filter method, you can either overide this method, or the more powerfull one.
      Parameters:
        request - The original request.
        reply - It's original reply.
      Returns:
        A Reply instance, or null if processing should continue normally.
      Throws: HTTPException
        If processing should be interrupted, because an abnormal situation occured.
    outgoingFilter

          public Reply outgoingFilter(Request request,
                                      Reply reply,
                                      HTTPFilter filters[],
                                      int fidx) throws HTTPException

      The outgoingFilter method. This method is the one that gets called by Jigsaw core. By default it will call the simpler `outgoingFilter` method that takes only the request and the reply as parameters.
      Parameters:
        request - The request that has been processed.
        reply - The original reply as emitted by the resource.
        filters - The whole filter that applies to the resource.
        i - The current index of filters. The i filter is ourself, filters with lower indexes have already been applied, and filters with greater indexes are still to be applied.
      Returns:
        A Reply instance, if that filter know how to complete the request processing, or null if reminaing filters are to be called by Jigsaw engine.
    pickle

          public void pickle(DataOutputStream out) throws IOException

      Pickle a filter. Pickle the filter attributes themselves, and than the set of shadow attribute values we maintain for our target.
      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 resource filter. Unpickle the attribute of the filter, and than the shadow attribute of our target.
      Parameters:
        in - The input stream to unpickle form.
        defs - The default values for our shadow attributes.
        init - Should the filter be initialized ?
      Throws: IOException
        If the input stream couldn't be read.
      Overrides:
        unpickleInstance in class AttributeHolder
    initialize

          public void initialize(Object values[])

      Initialize the filter.
      Parameters:
        values - The default attribute values.
      Overrides:
        initialize in class AttributeHolder

        All Packages  Class Hierarchy  This Package  Previous  Next  Index