Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.w3c.tools.resources
Class FramedResource

    java.lang.Object
      |
      +--org.w3c.tools.resources.AttributeHolder
            |
            +--org.w3c.tools.resources.Resource
                  |
                  +--org.w3c.tools.resources.FramedResource

All Implemented Interfaces:
  java.lang.Cloneable, java.util.EventListener, FrameEventListener

Direct Known Subclasses:
  AbstractContainer, AttRes, CheckpointResource, DirectoryLister, FileResource, LabelBureauResource, PasswordEditor, PutListResource, ResourceBroker, ResourceFrame, ServletWrapper, ToolsLister, UnknownResource

public class FramedResource
extends Resource
implements FrameEventListener

A FramedResource manage frames which are called during the lookup and the perform.

Field Summary
`protected static int` | `ATTR_OID` Attribute index - The object identifier.
`protected AttributeChangedListener` | `attrListener` Our AttributeChangedListener.
`protected boolean` | `debugEvent` Debug flag
`protected boolean` | `event_disabled` Do we handle events?
`protected java.util.Hashtable` | `framesRef` Our frames references.
`protected StructureChangedListener` | `structListener` Our StructureChangedListener.

Fields inherited from class org.w3c.tools.resources.Resource
`ATTR_CONTEXT, ATTR_HELP_URL, ATTR_IDENTIFIER, ATTR_LAST_MODIFIED, ATTR_PARENT, ATTR_RESOURCE_FRAMES, ATTR_STORE_ENTRY, ATTR_URL, co, id`

Fields inherited from class org.w3c.tools.resources.AttributeHolder
`attributes, values`

Constructor Summary
`FramedResource()`

Method Summary
`void` | `addAttributeChangedListener(AttributeChangedListener l)` Add an attribute change listener.
`void` | `addStructureChangedListener(StructureChangedListener l)` Add a structure change listener.
`ResourceReference[]` | `collectFramesReference(java.lang.Class c)` Collect any frame reference pointing to an instance of the given class.
`void` | `delete()` Delete this Resource instance, and remove it from its store.
`protected void` | `disableEvent()`
`protected void` | `displayEvent(FramedResource fr, java.util.EventObject evt)`
`protected void` | `enableEvent()`
`protected boolean` | `eventDisabled()`
`protected void` | `fireAttributeChangeEvent(AttributeChangedEvent evt)` Fire an attribute change event.
`protected void` | `fireStructureChangedEvent(int type)` Fire an structure change event.
`protected void` | `fireStructureChangedEvent(StructureChangedEvent evt)` Fire an structure change event.
`void` | `frameAdded(FrameEvent evt)` This handles the `FRAME_ADDED` kind of events.
`void` | `frameModified(FrameEvent evt)` This handles the `FRAME_MODIFIED` kind of events.
`void` | `frameRemoved(FrameEvent evt)` A frame is about to be removed This handles the `FRAME_REMOVED` kind of events.
`java.lang.Object` | `getClone(java.lang.Object[] values)` Clone this attribute holder, and init it with the given attributes.
`ResourceFrame` | `getFrame(java.lang.Class c, java.lang.String identifier)` Get the frame of the given class and identifier.
`ResourceFrame` | `getFrame(java.lang.String classname)` Get the frame of the given class.
`ResourceReference` | `getFrameReference(java.lang.Class c)` Get the first occurence of a frame of the given class.
`ResourceReference` | `getFrameReference(ResourceFrame frame)` Get The FrameReference of the given frame, or null if the frame is not registered.
`ResourceReference[]` | `getFramesReference()` Collect all frames references.
`int` | `getOid()` Get this resource's object identifier.
`void` | `initialize(java.lang.Object[] values)` Initialize the frames of that framed resource.
`boolean` | `lookup(LookupState ls, LookupResult lr)` Lookup the target resource.
`void` | `markModified()` Mark this resource as having been modified.
`void` | `notifyUnload()` This resource is being unloaded.
`ReplyInterface` | `perform(RequestInterface request)` Perform the request.
`protected ReplyInterface` | `performFrames(RequestInterface request)` Perform the request on all the frames of that resource.
`protected void` | `postAttributeChangeEvent(int idx, java.lang.Object newvalue)` post an attribute change event.
`void` | `postEvent(ResourceEvent evt)` Post an Event in the Event Queue.
`protected void` | `postStructureChangedEvent(int type)` post an structure change event.
`protected void` | `postStructureChangedEvent(ResourceReference rr, int type)` post an structure change event.
`void` | `processEvent(ResourceEvent evt)` (AWT Like), dspatch the Event to all our listeners.
`void` | `registerFrame(ResourceFrame frame, java.util.Hashtable defs)` Initialize and attach a new ResourceFrame to that resource.
`protected void` | `registerFrameIfNone(java.lang.String classname, java.lang.String identifier)` Register a new ResourceFrame if none (from the same class) has been registered.
`void` | `removeAttributeChangedListener(AttributeChangedListener l)` Remove an attribute change listener.
`void` | `removeStructureChangedListener(StructureChangedListener l)` Remove a structure change listener.
`void` | `setSilentValue(int idx, java.lang.Object value)` Set a value, without posting event.
`void` | `setSilentValue(java.lang.String name, java.lang.Object value)` Set a value, without posting event.
`void` | `setValue(int idx, java.lang.Object value)` Set some of this resource attribute.
`void` | `unregisterFrame(ResourceFrame frame)` Unregister a resource frame from the given resource.

Methods inherited from class org.w3c.tools.resources.Resource
`acceptUnload, checkMultipleLock, collectFrames, getContext, getFrame, getFrames, getHelpURL, getHelpURL, getIdentifier, getLastModified, getParent, getResourceReference, getServer, getSpace, getSpaceEntry, getStoreEntry, getURLPath, getValue, getValue, initialize, isInitialized, isUnloaded, pickleValues, setContext, setContext, setValue, unsafeGetContext, unsafeGetValue, updateAttributes`

Methods inherited from class org.w3c.tools.resources.AttributeHolder
`definesAttribute, definesAttribute, getAttributes, getBoolean, getChar, getClone, getClone, getDouble, getFloat, getInt, getLong, getString, getValue, lookupAttribute, print, setBoolean, setChar, setDouble, setFloat, setInt, setLong, setString, setValue`

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

Field Detail

### debugEvent

    protected final boolean debugEvent

  Debug flag

  See Also:
    Constant Field Values

### event_disabled

    protected boolean event_disabled

  Do we handle events?

### framesRef

    protected java.util.Hashtable framesRef

  Our frames references.

### attrListener

    protected AttributeChangedListener attrListener

  Our AttributeChangedListener.

### structListener

    protected StructureChangedListener structListener

  Our StructureChangedListener.

### ATTR_OID

    protected static int ATTR_OID

  Attribute index - The object identifier.

Constructor Detail

### FramedResource

    public FramedResource()

Method Detail

### disableEvent

    protected void disableEvent()

### enableEvent

    protected void enableEvent()

### eventDisabled

    protected boolean eventDisabled()

### getClone

    public java.lang.Object getClone(java.lang.Object[] values)

  Description copied from class: `AttributeHolder`
  Clone this attribute holder, and init it with the given attributes.

  Overrides:
    `getClone` in class `Resource`
  Parameters:
    `values` - Attribute values to overide in the clone.
  Returns:
    A clone of this resource.

### getOid

    public int getOid()

  Get this resource's object identifier. An object identifier is to be used specifically in etags. It's purpose is to uniquify the etag of a resource. It's computed as a random number , on demand only.

  Returns:
    A uniq object identifier for that resource, as an inteeger.

### displayEvent

    protected void displayEvent(FramedResource fr,
                                java.util.EventObject evt)

### frameAdded

    public void frameAdded(FrameEvent evt)

  This handles the `FRAME_ADDED` kind of events.

  Specified by:
    `frameAdded` in interface `FrameEventListener`
  Parameters:
    `evt` - The FrameEvent.

### frameModified

    public void frameModified(FrameEvent evt)

  This handles the `FRAME_MODIFIED` kind of events.

  Specified by:
    `frameModified` in interface `FrameEventListener`
  Parameters:
    `evt` - The event describing the change.

### frameRemoved

    public void frameRemoved(FrameEvent evt)

  A frame is about to be removed This handles the `FRAME_REMOVED` kind of events.

  Specified by:
    `frameRemoved` in interface `FrameEventListener`
  Parameters:
    `evt` - The event describing the change.

### registerFrame

    public void registerFrame(ResourceFrame frame,
                              java.util.Hashtable defs)

  Initialize and attach a new ResourceFrame to that resource.

  Overrides:
    `registerFrame` in class `Resource`
  Parameters:
    `frame` - An uninitialized ResourceFrame instance.
    `defs` - A default set of attribute values.

### registerFrameIfNone

    protected void registerFrameIfNone(java.lang.String classname,
                                       java.lang.String identifier)
                                throws java.lang.ClassNotFoundException,
                                       java.lang.IllegalAccessException,
                                       java.lang.InstantiationException,
                                       java.lang.ClassCastException

  Register a new ResourceFrame if none (from the same class) has been registered.

  Parameters:
    `classname` - The ResourceFrame class
    `identifier` - The ResourceFrame identifier
  Throws:
    `java.lang.ClassNotFoundException` - if the class can't be found
    `java.lang.IllegalAccessException` - if the class or initializer is not accessible
    `java.lang.InstantiationException` - if the class can't be instanciated
    `java.lang.ClassCastException` - if the class is not a ResourceFrame

### unregisterFrame

    public void unregisterFrame(ResourceFrame frame)

  Unregister a resource frame from the given resource.

  Overrides:
    `unregisterFrame` in class `Resource`
  Parameters:
    `frame` - The frame to unregister from the resource.

### getFramesReference

    public ResourceReference[] getFramesReference()

  Collect all frames references.

  Returns:
    An array of ResourceReference, containing a set of FrameReference instances or null if no resource frame is available.

### collectFramesReference

    public ResourceReference[] collectFramesReference(java.lang.Class c)

  Collect any frame reference pointing to an instance of the given class.

  Returns:
    An array of ResourceReference, containing a set of FrameReference pointing to instances of the given class, or null if no resource frame is available.

### getFrameReference

    public ResourceReference getFrameReference(java.lang.Class c)

  Get the first occurence of a frame of the given class.

  Returns:
    A ResourceReference instance, or null.

### getFrameReference

    public ResourceReference getFrameReference(ResourceFrame frame)

  Get The FrameReference of the given frame, or null if the frame is not registered.

  Parameters:
    `frame` - The ResourceFrame.
  Returns:
    A ResourceReference instance.

### getFrame

    public ResourceFrame getFrame(java.lang.Class c,
                                  java.lang.String identifier)

  Get the frame of the given class and identifier.

  Parameters:
    `identifier` - the frame identifier
  Returns:
    a ResourceFrame instance of null

### getFrame

    public ResourceFrame getFrame(java.lang.String classname)

  Get the frame of the given class.

  Parameters:
    `classname` - the class name
  Returns:
    a ResourceFrame instance of null.

### processEvent

    public void processEvent(ResourceEvent evt)

  (AWT Like), dspatch the Event to all our listeners.

  Parameters:
    `evt` - The resourceEvent to dispatch.

### postEvent

    public void postEvent(ResourceEvent evt)

  Post an Event in the Event Queue.

  Parameters:
    `evt` - The Event to post.

### addAttributeChangedListener

    public void addAttributeChangedListener(AttributeChangedListener l)

  Add an attribute change listener.

  Parameters:
    `l` - The new attribute change listener.

### removeAttributeChangedListener

    public void removeAttributeChangedListener(AttributeChangedListener l)

  Remove an attribute change listener.

  Parameters:
    `l` - The listener to remove.

### postAttributeChangeEvent

    protected void postAttributeChangeEvent(int idx,
                                            java.lang.Object newvalue)

  post an attribute change event. Actually this kind of event should not be posted. So fire them!

  Parameters:
    `idx` - The index of the attribute that has changed.
    `newvalue` - The new value for that attribute.

### fireAttributeChangeEvent

    protected void fireAttributeChangeEvent(AttributeChangedEvent evt)

  Fire an attribute change event.

  Parameters:
    `evt` - the AttributeChangedEvent to fire.

### addStructureChangedListener

    public void addStructureChangedListener(StructureChangedListener l)

  Add a structure change listener.

  Parameters:
    `l` - The new structure change listener.

### removeStructureChangedListener

    public void removeStructureChangedListener(StructureChangedListener l)

  Remove a structure change listener.

  Parameters:
    `l` - The listener to remove.

### postStructureChangedEvent

    protected void postStructureChangedEvent(ResourceReference rr,
                                             int type)

  post an structure change event.

  Parameters:
    `rr` - the ResourceReference of the source.
    `type` - The type of the event.

### postStructureChangedEvent

    protected void postStructureChangedEvent(int type)

  post an structure change event.

  Parameters:
    `type` - The type of the event.

### fireStructureChangedEvent

    protected void fireStructureChangedEvent(int type)

  Fire an structure change event.

  Parameters:
    `type` - The type of the event.

### fireStructureChangedEvent

    protected void fireStructureChangedEvent(StructureChangedEvent evt)

  Fire an structure change event.

  Parameters:
    `evt` - the StructureChangedEvent to fire.

### notifyUnload

    public void notifyUnload()

  This resource is being unloaded. The resource is being unloaded from memory, perform any additional cleanup required.

  Overrides:
    `notifyUnload` in class `Resource`

### delete

    public void delete()
                throws MultipleLockException

  Delete this Resource instance, and remove it from its store. This method will erase definitely this resource, for ever, by removing it from its resource store (when doable).

  Overrides:
    `delete` in class `Resource`
  Throws:
    `MultipleLockException` - if someone has locked this resource.

### markModified

    public void markModified()

  Mark this resource as having been modified.

  Overrides:
    `markModified` in class `Resource`

### setValue

    public void setValue(int idx,
                         java.lang.Object value)

  Set some of this resource attribute. We overide setValue to post events.

  Overrides:
    `setValue` in class `Resource`
  Parameters:
    `idx` - The index of the attribute to modify.
    `value` - The new attribute value.

### setSilentValue

    public void setSilentValue(int idx,
                               java.lang.Object value)

  Set a value, without posting event.

  Parameters:
    `idx` - The attribute index, in the list of attributes advertized by the resource.
    `value` - The new value for this attribute.

### setSilentValue

    public void setSilentValue(java.lang.String name,
                               java.lang.Object value)

  Set a value, without posting event.

  Parameters:
    `name` - The attribute name.
    `value` - The new value for the attribute.

### lookup

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

  Lookup the target resource.

  Parameters:
    `ls` - The current lookup state
    `lr` - The result
  Returns:
    true if lookup is done.
  Throws:
    `ProtocolException` - If an error relative to the protocol occurs

### performFrames

    protected ReplyInterface performFrames(RequestInterface request)
                                    throws ProtocolException,
                                           ResourceException

  Perform the request on all the frames of that resource. The Reply returned is the first non-null reply.

  Parameters:
    `request` - A RequestInterface instance.
  Returns:
    A ReplyInterface instance.
  Throws:
    `ProtocolException` - If an error relative to the protocol occurs
    `ResourceException` - If an error not relative to the protocol occurs

### perform

    public ReplyInterface perform(RequestInterface request)
                           throws ProtocolException,
                                  ResourceException

  Perform the request.

  Returns:
    a ReplyInterface instance
  Throws:
    `ProtocolException` - If an error relative to the protocol occurs
    `ResourceException` - If an error not relative to the protocol occurs

### initialize

    public void initialize(java.lang.Object[] values)

  Initialize the frames of that framed resource.

  Overrides:
    `initialize` in class `Resource`
  Parameters:
    `values` - Default attribute values.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD