All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class org.w3c.tools.resources.FramedResource

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

public class FramedResource
extends Resource
implements FrameEventListener
A FramedResource manage frames which are called during the lookup and the perform.


Variable Index

 o ATTR_OID
Attribute index - The object identifier.
 o attrListener
Our AttributeChangedListener.
 o debugEvent
 o event_disabled
 o framesRef
Our frames references.
 o structListener
Our StructureChangedListener.

Constructor Index

 o FramedResource()

Method Index

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

Variables

 o framesRef
 protected transient Hashtable framesRef
Our frames references.

 o attrListener
 protected transient AttributeChangedListener attrListener
Our AttributeChangedListener.

 o structListener
 protected transient StructureChangedListener structListener
Our StructureChangedListener.

 o debugEvent
 protected transient boolean debugEvent
 o event_disabled
 protected transient boolean event_disabled
 o ATTR_OID
 protected static int ATTR_OID
Attribute index - The object identifier.

Constructors

 o FramedResource
 public FramedResource()

Methods

 o disableEvent
 protected void disableEvent()
 o enableEvent
 protected void enableEvent()
 o getClone
 public Object getClone(Object values[])
Clone this attribute holder, and init it with the given attributes.

Overrides:
getClone in class Resource
 o getServer
 public ServerInterface getServer()
Get the server this resource is served by.

Returns:
The first instance of Jigsaw this resource was attached to.
 o 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.
 o displayEvent
 protected void displayEvent(FramedResource fr,
                             EventObject evt)
 o frameAdded
 public void frameAdded(FrameEvent evt)
This handles the FRAME_ADDED kind of events.

Parameters:
evt - The FrameEvent.
 o frameModified
 public void frameModified(FrameEvent evt)
This handles the FRAME_MODIFIED kind of events.

Parameters:
evt - The event describing the change.
 o frameRemoved
 public void frameRemoved(FrameEvent evt)
A frame is about to be removed This handles the FRAME_REMOVED kind of events.

Parameters:
evt - The event describing the change.
 o registerFrame
 public void registerFrame(ResourceFrame frame,
                           Hashtable defs)
Initialize and attach a new ResourceFrame to that resource.

Parameters:
frame - An uninitialized ResourceFrame instance.
defs - A default set of attribute values.
Overrides:
registerFrame in class Resource
 o registerFrameIfNone
 protected void registerFrameIfNone(String classname,
                                    String identifier) throws ClassNotFoundException, IllegalAccessException, InstantiationException, ClassCastException
Register a new ResourceFrame if none (from the same class) has been registered.

Parameters:
classname - The ResourceFrame class
identifier - The ResourceFrame identifier
Throws: ClassNotFoundException
if the class can't be found
Throws: IllegalAccessException
if the class or initializer is not accessible
Throws: InstantiationException
if the class can't be instanciated
Throws: ClassCastException
if the class is not a ResourceFrame
 o unregisterFrame
 public synchronized void unregisterFrame(ResourceFrame frame)
Unregister a resource frame from the given resource.

Parameters:
frame - The frame to unregister from the resource.
Overrides:
unregisterFrame in class Resource
 o getFramesReference
 public synchronized 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.
 o collectFramesReference
 public synchronized ResourceReference[] collectFramesReference(Class c)
Collect any frame reference pointing to an instance of the given class.

Parameters:
cls - The class of frames we are looking for.
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.
 o getFrameReference
 public synchronized ResourceReference getFrameReference(Class c)
Get the first occurence of a frame of the given class.

Parameters:
cls - The class of te frame to look for.
Returns:
A ResourceReference instance, or null.
 o getFrameReference
 public synchronized 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.
 o processEvent
 public void processEvent(ResourceEvent evt)
(AWT Like), dspatch the Event to all our listeners.

Parameters:
evt - The resourceEvent to dispatch.
 o postEvent
 public void postEvent(ResourceEvent evt)
Post an Event in the Event Queue.

Parameters:
evt - The Event to post.
 o addAttributeChangedListener
 public void addAttributeChangedListener(AttributeChangedListener l)
Add an attribute change listener.

Parameters:
l - The new attribute change listener.
 o removeAttributeChangedListener
 public void removeAttributeChangedListener(AttributeChangedListener l)
Remove an attribute change listener.

Parameters:
l - The listener to remove.
 o postAttributeChangeEvent
 protected void postAttributeChangeEvent(int idx,
                                         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.
 o fireAttributeChangeEvent
 protected void fireAttributeChangeEvent(AttributeChangedEvent evt)
Fire an attribute change event.

Parameters:
evt - the AttributeChangedEvent to fire.
 o addStructureChangedListener
 public void addStructureChangedListener(StructureChangedListener l)
Add a structure change listener.

Parameters:
l - The new structure change listener.
 o removeStructureChangedListener
 public void removeStructureChangedListener(StructureChangedListener l)
Remove a structure change listener.

Parameters:
l - The listener to remove.
 o 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.
 o postStructureChangedEvent
 protected void postStructureChangedEvent(int type)
post an structure change event.

Parameters:
type - The type of the event.
 o fireStructureChangedEvent
 protected void fireStructureChangedEvent(int type)
Fire an structure change event.

Parameters:
type - The type of the event.
 o fireStructureChangedEvent
 protected void fireStructureChangedEvent(StructureChangedEvent evt)
Fire an structure change event.

Parameters:
evt - the StructureChangedEvent to fire.
 o 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
 o delete
 public synchronized 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).

Throws: MultipleLockException
if someone has locked this resource.
Overrides:
delete in class Resource
 o markModified
 public void markModified()
Mark this resource as having been modified.

Overrides:
markModified in class Resource
 o setValue
 public synchronized void setValue(int idx,
                                   Object value)
Set some of this resource attribute. We overide setValue to post events.

Overrides:
setValue in class Resource
 o 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
 o 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
Throws: ResourceException
If an error not relative to the protocol occurs
 o 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
Throws: ResourceException
If an error not relative to the protocol occurs
 o initialize
 public void initialize(Object values[])
Initialize the frames of that framed resource.

Parameters:
values - Default attribute values.
Overrides:
initialize in class AttributeHolder

All Packages  Class Hierarchy  This Package  Previous  Next  Index