org.w3c.tools.resources
Class ResourceFrame

java.lang.Object
  extended by org.w3c.tools.resources.AttributeHolder
      extended by org.w3c.tools.resources.Resource
          extended by org.w3c.tools.resources.FramedResource
              extended by org.w3c.tools.resources.ResourceFrame
All Implemented Interfaces:
java.lang.Cloneable, java.util.EventListener, AttributeChangedListener, FrameEventListener
Direct Known Subclasses:
MetaDataFrame, ProtocolFrame, ResourceFilter, UnknownFrame

public class ResourceFrame
extends FramedResource
implements AttributeChangedListener

The resource frame class. A ResourceFrame can be attached to a resource.


Field Summary
protected static java.lang.Class filterClass
          The special class of filter.
protected  FrameEventListener frameListener
          Our FrameEventListener.
protected  FramedResource resource
          Our target resource.
 
Fields inherited from class org.w3c.tools.resources.FramedResource
ATTR_OID, attrListener, debugEvent, event_disabled, framesRef, structListener
 
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
ResourceFrame()
           
 
Method Summary
 void addFrameEventListener(FrameEventListener l)
          Add a frame event listener.
 void attributeChanged(AttributeChangedEvent evt)
          Listen its resource.
 boolean checkRequest(RequestInterface request)
          Check if this kind of request can be perform by this resource.
protected  boolean eventDisabled()
           
protected  void fireFrameEvent(FrameEvent evt)
          Fire a frameEvent.
 void frameModified(FrameEvent evt)
          This handles the FRAME_MODIFIED kind of events.
 ResourceFilter[] getFilters()
          Get our whole list of filters.
 ResourceFilter[] getFilters(java.lang.Class cls)
          Get the list of filters of this class.
 ResourceReference getFrameReference()
          Get The FrameReference of this frame, or null if this frame is not registered.
 FramedResource getResource()
          Get the target resource.
 ResourceReference getResourceReference()
          Get the ResourceReference of that resource.
protected  SpaceEntry getSpaceEntry()
          Get the space entry for that resource.
 java.lang.String getURLPath()
          Get the file part of the URL this resource is attached to.
 boolean lookup(LookupState ls, LookupResult lr)
          Lookup the target resource.
protected  boolean lookupFilters(LookupState ls, LookupResult lr)
          lookup only filters.
protected  boolean lookupFrames(LookupState ls, LookupResult lr)
          lookup frames excluding filters.
 ReplyInterface perform(RequestInterface request)
          Perform the request
protected  void postFrameEvent(int type)
          Post a frameEvent.
 void processEvent(ResourceEvent evt)
          (AWT Like), dspatch the Event to all our listeners.
 void registerResource(FramedResource resource)
          Register a target resource.
 void removeFrameEventListener(FrameEventListener l)
          Remove a frame event listener.
 void setValue(int idx, java.lang.Object value)
          We overide setValue, to fire event.
 void unregisterResource(Resource resource)
          Register a target resource.
protected  void updateDefaultChildAttributes(java.util.Hashtable attrs)
          If our target resource has some children, we could have some attribute to give to them.
 
Methods inherited from class org.w3c.tools.resources.FramedResource
addAttributeChangedListener, addStructureChangedListener, collectFramesReference, delete, disableEvent, displayEvent, enableEvent, fireAttributeChangeEvent, fireStructureChangedEvent, fireStructureChangedEvent, frameAdded, frameRemoved, getClone, getFrame, getFrame, getFrameReference, getFrameReference, getFramesReference, getOid, initialize, markModified, notifyUnload, performFrames, postAttributeChangeEvent, postEvent, postStructureChangedEvent, postStructureChangedEvent, registerFrame, registerFrameIfNone, removeAttributeChangedListener, removeStructureChangedListener, setSilentValue, setSilentValue, unregisterFrame
 
Methods inherited from class org.w3c.tools.resources.Resource
acceptUnload, checkMultipleLock, collectFrames, getContext, getFrame, getFrames, getHelpURL, getHelpURL, getIdentifier, getLastModified, getParent, getServer, getSpace, getStoreEntry, getValue, getValue, initialize, isInitialized, isUnloaded, pickleValues, setContext, setContext, setValue, unsafeGetContext, unsafeGetFrame, unsafeGetFrames, unsafeGetIdentifier, unsafeGetResourceReference, unsafeGetURLPath, 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, unsafeDefinesAttribute, unsafeGetDouble, unsafeGetString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

filterClass

protected static java.lang.Class filterClass
The special class of filter.


frameListener

protected transient FrameEventListener frameListener
Our FrameEventListener.


resource

protected FramedResource resource
Our target resource.

Constructor Detail

ResourceFrame

public ResourceFrame()
Method Detail

eventDisabled

protected boolean eventDisabled()
Overrides:
eventDisabled in class FramedResource

getURLPath

public java.lang.String getURLPath()
Get the file part of the URL this resource is attached to.

Overrides:
getURLPath in class Resource
Returns:
An URL object specifying the location in the information space of this resource.

getSpaceEntry

protected SpaceEntry getSpaceEntry()
Get the space entry for that resource. This Object is use to retrieve the resource in the resource space. A ResourceFrame has no SpaceEntry.

Overrides:
getSpaceEntry in class Resource
Returns:
always null.

getFrameReference

public ResourceReference getFrameReference()
Get The FrameReference of this frame, or null if this frame is not registered.

Returns:
A ResourceReference instance.

getResourceReference

public ResourceReference getResourceReference()
Description copied from class: Resource
Get the ResourceReference of that resource. ResourceReference is the only public way to access a resource.

Overrides:
getResourceReference in class Resource
Returns:
a ResourceReference instance.

updateDefaultChildAttributes

protected void updateDefaultChildAttributes(java.util.Hashtable attrs)
If our target resource has some children, we could have some attribute to give to them.

Parameters:
attrs - A Hashtable.

checkRequest

public boolean checkRequest(RequestInterface request)
Check if this kind of request can be perform by this resource.

Parameters:
request - A RequestInterface instance
Returns:
a boolean.

perform

public ReplyInterface perform(RequestInterface request)
                       throws ProtocolException,
                              ResourceException
Perform the request

Overrides:
perform in class FramedResource
Parameters:
request - the incomming 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

lookupFilters

protected boolean lookupFilters(LookupState ls,
                                LookupResult lr)
                         throws ProtocolException
lookup only filters.

Throws:
ProtocolException - If an error relative to the protocol occurs

lookupFrames

protected boolean lookupFrames(LookupState ls,
                               LookupResult lr)
                        throws ProtocolException
lookup frames excluding filters.

Throws:
ProtocolException - If an error relative to the protocol occurs

lookup

public boolean lookup(LookupState ls,
                      LookupResult lr)
               throws ProtocolException
Lookup the target resource.

Overrides:
lookup in class FramedResource
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

processEvent

public void processEvent(ResourceEvent evt)
Description copied from class: FramedResource
(AWT Like), dspatch the Event to all our listeners.

Overrides:
processEvent in class FramedResource
Parameters:
evt - The resourceEvent to dispatch.

addFrameEventListener

public void addFrameEventListener(FrameEventListener l)
Add a frame event listener.

Parameters:
l - The new frame event listener.

removeFrameEventListener

public void removeFrameEventListener(FrameEventListener l)
Remove a frame event listener.

Parameters:
l - The listener to remove.

postFrameEvent

protected void postFrameEvent(int type)
Post a frameEvent.

Parameters:
the - frame event type.

fireFrameEvent

protected void fireFrameEvent(FrameEvent evt)
Fire a frameEvent.

Parameters:
the - frame event type.

attributeChanged

public void attributeChanged(AttributeChangedEvent evt)
Listen its resource.

Specified by:
attributeChanged in interface AttributeChangedListener
Parameters:
evt - The AttributeChangeEvent describing the change.

frameModified

public void frameModified(FrameEvent evt)
This handles the FRAME_MODIFIED kind of events.

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

setValue

public void setValue(int idx,
                     java.lang.Object value)
We overide setValue, to fire event.

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

getResource

public FramedResource getResource()
Get the target resource.

Returns:
a resource instance.

registerResource

public void registerResource(FramedResource resource)
Register a target resource. Called after initialize, set the context. getServer() can be call only after this method call.


unregisterResource

public void unregisterResource(Resource resource)
Register a target resource.


getFilters

public ResourceFilter[] getFilters()
Get our whole list of filters.


getFilters

public ResourceFilter[] getFilters(java.lang.Class cls)
Get the list of filters of this class.

Parameters:
cls - The class of filters requested.
Returns:
An array of filters, which are instances of the given class.