## org.w3c.tools.resources
Class ResourceContext

    java.lang.Object
      |
      +--org.w3c.tools.resources.ResourceContext

public class ResourceContext
extends java.lang.Object

The resource context.

Field Summary
`protected ResourceReference` `container` The ResourceReference of the resource container.
`static boolean` `debug` debug flag
`java.util.Hashtable` `modules` The set of registered modules.
`protected ResourceContext` `parent` Our parent context, if any.
`protected ResourceReference` `reference` The ResourceReference of our resource.
`protected ServerInterface` `server` The server of that resource context.
`protected ResourceSpace` `space` Our Resource Space.

Constructor Summary
`ResourceContext(ContainerResource container)` Create a ResourceContext from a container.
`ResourceContext(ResourceContext parent)` Create a ResourceContext from the parent context.
`ResourceContext(ResourceReference rr_container)` Create a ResourceContext from a container ResourceReference.
`ResourceContext(ResourceSpace space, ServerInterface server)` Create a ResourceContext.
`ResourceContext(ServerInterface server)` Create a ResourceContext.

Method Summary
`ResourceReference` `getContainer()` Get the container of the resource.
`java.lang.Object` `getModule(java.lang.String name)` Lookup a module within that context, and up the hierarchy of contexts.
`java.lang.Object` `getModule(java.lang.String name, boolean inherited)` Lookup a module within that resource context.
`ResourceContext` `getParent()` Get that context's ancestor.
`ResourceReference` `getResourceReference()` Get the ResourceReference of the resource.
`ServerInterface` `getServer()` Get the server this context is attached to.
`ResourceSpace` `getSpace()` Get our Resource Space.
`void` `registerModule(java.lang.String name, java.lang.Object impl)` Register a module within that resource context.
`void` `setResourceReference(ResourceReference reference)` Set the ResourceReference of the resource.
`void` `setSpace(ResourceSpace space)` Set the Resource Space.
`java.lang.String` `toString()`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### debug

    public static boolean debug

  debug flag

### parent

    protected ResourceContext parent

  Our parent context, if any.

### modules

    public java.util.Hashtable modules

  The set of registered modules.

### space

    protected ResourceSpace space

  Our Resource Space.

### server

    protected ServerInterface server

  The server of that resource context.

### reference

    protected ResourceReference reference

  The ResourceReference of our resource.

### container

    protected ResourceReference container

  The ResourceReference of the resource container.

Constructor Detail

### ResourceContext

    public ResourceContext(ContainerResource container)

  Create a ResourceContext from a container.
  Parameters:
    `container` - The resource container.

### ResourceContext

    public ResourceContext(ResourceReference rr_container)

  Create a ResourceContext from a container ResourceReference.
  Parameters:
    `container` - The resource reference of the container. Must be an instance of ContainerResource.

### ResourceContext

    public ResourceContext(ResourceContext parent)

  Create a ResourceContext from the parent context.
  Parameters:
    `parent` - The parent resource context.

### ResourceContext

    public ResourceContext(ResourceSpace space,
                           ServerInterface server)

  Create a ResourceContext.
  Parameters:
    `space` - The ResourceSpace.
    `server` - The server.

### ResourceContext

    public ResourceContext(ServerInterface server)

  Create a ResourceContext.
  Parameters:
    `server` - The server.

Method Detail

### getContainer

    public ResourceReference getContainer()

  Get the container of the resource.
  Returns:
    A ResourceReference instance.

### getResourceReference

    public ResourceReference getResourceReference()

  Get the ResourceReference of the resource.
  Returns:
    a ResourceReference instance.

### setResourceReference

    public void setResourceReference(ResourceReference reference)

  Set the ResourceReference of the resource.
  Parameters:
    `reference` - The ResourceReference to set.

### getSpace

    public ResourceSpace getSpace()

  Get our Resource Space.
  Returns:
    A ResourceSpace instance.

### setSpace

    public void setSpace(ResourceSpace space)

  Set the Resource Space.
  Parameters:
    `space` - Our Resource Space.

### getServer

    public ServerInterface getServer()

  Get the server this context is attached to.
  Returns:
    An ServerInterface instance (guaranteed not to be null.)

### getParent

    public ResourceContext getParent()

  Get that context's ancestor.
  Returns:
    A ResourceContext instance, or null.

### registerModule

    public void registerModule(java.lang.String name,
                               java.lang.Object impl)

  Register a module within that resource context.
  Parameters:
    `name` - The module's name.
    `impl` - The module's implementation.

### getModule

    public java.lang.Object getModule(java.lang.String name,
                                      boolean inherited)

  Lookup a module within that resource context.
  Parameters:
    `name` - Name of the module to look for.
    `inherited` - Also look within the contexts hierarchy for an inherited module having that name.

### getModule

    public java.lang.Object getModule(java.lang.String name)

  Lookup a module within that context, and up the hierarchy of contexts.
  Parameters:
    `name` - The module's name.
  Returns:
    An object implementing that module.

### toString

    public java.lang.String toString()

  Overrides:
    toString in class java.lang.Object