| java.lang.Object org.w3c.tools.resources.AttributeHolder org.w3c.tools.resources.Resource
All known Subclasses: org.w3c.tools.resources.FramedResource, org.w3c.jigsaw.auth.AuthUser, org.w3c.jigsaw.config.PropertySet,
Resource | public class Resource extends AttributeHolder (Code) | | The resource class describes an object, accessible through the server.
Resource objects are required to have the following properties:
- They must be persistent (their life-time can span multiple server
life-time).
- They must be editable, so that one can change some of their aspects
(such as any associated attribute).
- They must be self-described: each resource must now what kind
of attribute it understands.
- They must be able to update themselves: some of the meta-information
associated with a resource may require lot of CPU to compute.
- They must implement some name-service policy.
These resource objects do not define how they are accessed. See the
sub-classes for specific accesses.
|
Field Summary | |
protected static int | ATTR_CONTEXT Attribute index - The hierarchical context of the resource. | protected static int | ATTR_HELP_URL | protected static int | ATTR_IDENTIFIER Attribute index - The index for the identifier attribute. | protected static int | ATTR_LAST_MODIFIED Attribute index - The index for the last-modified attribute. | protected static int | ATTR_PARENT Attribute index - The index for our parent attribute. | protected static int | ATTR_RESOURCE_FRAMES | protected static int | ATTR_STORE_ENTRY Attribute index - The index of the resource store entry attribute. | protected static int | ATTR_URL Attribute index - The index for our URL attribute. | public static String | co | public static String | id |
Constructor Summary | |
public | Resource() Create an empty resource instance. |
Method Summary | |
public boolean | acceptUnload() Is that resource willing to be unloaded.
This method is a bit tricky to implement. | protected void | checkMultipleLock(ResourceReference rr) Check if this resource is loked more than one time. | public synchronized ResourceFrame[] | collectFrames(Class c) Collect any frame that's an instance of the given class.
Parameters: cls - The class of frames we are looking for. | public synchronized void | delete() Delete this Resource instance, and remove it from its store. | public Object | getClone(Object values) | protected ResourceContext | getContext() Get the hierarchical context for that resource. | public synchronized ResourceFrame | getFrame(Class c) Get the first occurence of a frame of the given class.
Parameters: cls - The class of te frame to look for. | public synchronized ResourceFrame[] | getFrames() Collect all frames. | public String | getHelpURL() Get this resource's help url. | public String | getHelpURL(String topics) Get the help URL for that resource's topic.
Parameters: topic - The topic you want help for. | public String | getIdentifier() Get this resource identifier. | public long | getLastModified() Get this resource last modification time. | public ResourceReference | getParent() Get this resource parent resource. | public ResourceReference | getResourceReference() Get the ResourceReference of that resource. | public ServerInterface | getServer() Get the server this resource is served by. | protected ResourceSpace | getSpace() Get the ResourceSpace where this resource is stored. | protected SpaceEntry | getSpaceEntry() Get the space entry for that resource. | public Object | getStoreEntry() Get the store entry for that resource.
Only the resource store in charge of this resource knows about the
type of the resulting object. | public String | getURLPath() Get the file part of the URL this resource is attached to. | public synchronized Object | getValue(int idx, Object def) | public synchronized Object | getValue(Class c, int idx, Object def) Get an attached frame attribute value.
This method really is a short-hand that combines a getFrame
and getValue method call.
Parameters: cls - The class of the frame we want the value of. Parameters: idx - The attribute index. Parameters: def - The default value (if the attribute value isn't defined). | public void | initialize(Hashtable defs) Initialization method for attribute holders. | public void | initialize(Object values) | public boolean | isInitialized() | public boolean | isUnloaded() | public void | markModified() Mark this resource as having been modified. | public void | notifyUnload() This resource is being unloaded. | public void | pickleValues(Hashtable defs) Set the values. | public void | registerFrame(ResourceFrame frame, Hashtable defs) Initialize and attach a new ResourceFrame to that resource. | protected void | setContext(ResourceContext context) Set the given context as the current context of this resource. | protected void | setContext(ResourceContext context, boolean keepmodules) Set the given context as the current context of this resource. | public synchronized void | setValue(Class c, int idx, Object val) Set an attached frame attribute value. | public void | setValue(int idx, Object value) We overide setValue, to mark the resource as modified. | public synchronized void | unregisterFrame(ResourceFrame frame) Unregister a resource frame from the given resource. | ResourceFrame[] | unsafeCollectFrames(Class c) Collect any frame that's an instance of the given class.
Parameters: cls - The class of frames we are looking for. | protected ResourceContext | unsafeGetContext() | public ResourceFrame | unsafeGetFrame(Class c) Get the first occurence of a frame of the given class.
Parameters: cls - The class of te frame to look for. | public ResourceFrame[] | unsafeGetFrames() Collect all frames. | public String | unsafeGetIdentifier() Get this resource identifier. | public ResourceReference | unsafeGetResourceReference() Get the ResourceReference of that resource. | public String | unsafeGetURLPath() Get the file part of the URL this resource is attached to. | public Object | unsafeGetValue(int idx, Object def) | public void | updateAttributes() The web admin wants us to update any out of date attribute. |
ATTR_CONTEXT | protected static int ATTR_CONTEXT(Code) | | Attribute index - The hierarchical context of the resource.
|
ATTR_HELP_URL | protected static int ATTR_HELP_URL(Code) | | Attribute index - The help URL for this resource (Ref doc)
|
ATTR_IDENTIFIER | protected static int ATTR_IDENTIFIER(Code) | | Attribute index - The index for the identifier attribute.
|
ATTR_LAST_MODIFIED | protected static int ATTR_LAST_MODIFIED(Code) | | Attribute index - The index for the last-modified attribute.
|
ATTR_PARENT | protected static int ATTR_PARENT(Code) | | Attribute index - The index for our parent attribute.
|
ATTR_RESOURCE_FRAMES | protected static int ATTR_RESOURCE_FRAMES(Code) | | Attribute index - Associated resource frames
|
ATTR_STORE_ENTRY | protected static int ATTR_STORE_ENTRY(Code) | | Attribute index - The index of the resource store entry attribute.
|
ATTR_URL | protected static int ATTR_URL(Code) | | Attribute index - The index for our URL attribute.
|
Resource | public Resource()(Code) | | Create an empty resource instance.
Initialize the instance attributes description, and its values.
|
acceptUnload | public boolean acceptUnload()(Code) | | Is that resource willing to be unloaded.
This method is a bit tricky to implement. The guideline is that you
should not dynamically change the returned value (since you can't
control what happens between a call to that method and a call to
the notifyUnload method).
Returning false should never be needed, except
for very strange resources.
A boolean true if the resource can be unloadedfalse otherwise. |
collectFrames | public synchronized ResourceFrame[] collectFrames(Class c)(Code) | | Collect any frame that's an instance of the given class.
Parameters: cls - The class of frames we are looking for. An array of ResourceFrame, containing a set of frames instancesof the given class, or null if no resource frame isavailable. |
delete | public synchronized void delete() throws MultipleLockException(Code) | | 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).
exception: MultipleLockException - if someone else has locked this resource |
getContext | protected ResourceContext getContext()(Code) | | Get the hierarchical context for that resource.
A ResourceContext instance, guaranteed not to be null |
getFrame | public synchronized ResourceFrame getFrame(Class c)(Code) | | Get the first occurence of a frame of the given class.
Parameters: cls - The class of te frame to look for. A ResourceFrame instance, or null. |
getFrames | public synchronized ResourceFrame[] getFrames()(Code) | | Collect all frames.
An array of ResourceFrame, containing a set of frames instancesor null if no resource frame is available. |
getHelpURL | public String getHelpURL()(Code) | | Get this resource's help url.
An URL, encoded as a String, or null if notavailable. |
getHelpURL | public String getHelpURL(String topics)(Code) | | Get the help URL for that resource's topic.
Parameters: topic - The topic you want help for. A String encoded URL, or null if nonewas found. |
getIdentifier | public String getIdentifier()(Code) | | Get this resource identifier.
The String value for the identifier. |
getLastModified | public long getLastModified()(Code) | | Get this resource last modification time.
A long giving the date of the last modification time, or-1 if undefined. |
getParent | public ResourceReference getParent()(Code) | | Get this resource parent resource.
The parent of a resource can be either null if it is
the server root resource, or any Resource.
An instance of ResourceReference, or null |
getResourceReference | public ResourceReference getResourceReference()(Code) | | Get the ResourceReference of that resource. ResourceReference is the
only public way to access a resource.
a ResourceReference instance. |
getServer | public ServerInterface getServer()(Code) | | Get the server this resource is served by.
The first instance of Jigsaw this resource was attached to. |
getSpace | protected ResourceSpace getSpace()(Code) | | Get the ResourceSpace where this resource is stored.
A ResourceSpace instance. |
getSpaceEntry | protected SpaceEntry getSpaceEntry()(Code) | | Get the space entry for that resource. This Object is use to
retrieve the resource in the resource space.
A spaceEntry instance. |
getStoreEntry | public Object getStoreEntry()(Code) | | Get the store entry for that resource.
Only the resource store in charge of this resource knows about the
type of the resulting object. Buy declaring the class of that object
private, the resource store can assume some private access to it.
A java Object instance, or null if no store entry is attached to that resource. |
getURLPath | public String getURLPath()(Code) | | Get the file part of the URL this resource is attached to.
An URL object specifying the location in the information space of this resource. |
getValue | public synchronized Object getValue(Class c, int idx, Object def)(Code) | | Get an attached frame attribute value.
This method really is a short-hand that combines a getFrame
and getValue method call.
Parameters: cls - The class of the frame we want the value of. Parameters: idx - The attribute index. Parameters: def - The default value (if the attribute value isn't defined). The attribute value as an Object instance, or the provideddefault value if the attribute value isn't defined. |
initialize | public void initialize(Hashtable defs)(Code) | | Initialization method for attribute holders.
This method allows to initialize an attribute holder by providing
its attributes values through a Hashtable mapping attribute names
to attribute values.
Parameters: defs - The Hashtable containing the default values. |
isInitialized | public boolean isInitialized()(Code) | | |
isUnloaded | public boolean isUnloaded()(Code) | | unloaded?
true if the resource has been unloaded. |
markModified | public void markModified()(Code) | | Mark this resource as having been modified.
|
notifyUnload | public void notifyUnload()(Code) | | This resource is being unloaded.
The resource is being unloaded from memory, perform any additional
cleanup required.
|
pickleValues | public void pickleValues(Hashtable defs)(Code) | | Set the values. (MUST be called before initialize).
Parameters: defs - The Hashtable containing the values. |
registerFrame | public void registerFrame(ResourceFrame frame, Hashtable defs)(Code) | | Initialize and attach a new ResourceFrame to that resource.
Parameters: frame - An uninitialized ResourceFrame instance. Parameters: defs - A default set of attribute values. |
setContext | protected void setContext(ResourceContext context)(Code) | | Set the given context as the current context of this resource.
Parameters: context - The new context. |
setContext | protected void setContext(ResourceContext context, boolean keepmodules)(Code) | | Set the given context as the current context of this resource.
Parameters: context - The new context. Parameters: keepmodules - If true the new context will have the samemodules than the old one. |
setValue | public synchronized void setValue(Class c, int idx, Object val)(Code) | | Set an attached frame attribute value.
This method really is a short-hand that combines a getFrame
and a setValue method call.
Parameters: cls - The class of the frame we want to modify. Parameters: idx - The attribute to modify. Parameters: val - The new attribute value. |
setValue | public void setValue(int idx, Object value)(Code) | | We overide setValue, to mark the resource as modified.
Parameters: idx - The index of the attribute to modify. Parameters: value - The new attribute value. |
unregisterFrame | public synchronized void unregisterFrame(ResourceFrame frame)(Code) | | Unregister a resource frame from the given resource.
Parameters: frame - The frame to unregister from the resource. |
unsafeCollectFrames | ResourceFrame[] unsafeCollectFrames(Class c)(Code) | | Collect any frame that's an instance of the given class.
Parameters: cls - The class of frames we are looking for. An array of ResourceFrame, containing a set of frames instancesof the given class, or null if no resource frame isavailable. |
unsafeGetFrame | public ResourceFrame unsafeGetFrame(Class c)(Code) | | Get the first occurence of a frame of the given class.
Parameters: cls - The class of te frame to look for. A ResourceFrame instance, or null. |
unsafeGetFrames | public ResourceFrame[] unsafeGetFrames()(Code) | | Collect all frames.
An array of ResourceFrame, containing a set of frames instancesor null if no resource frame is available. |
unsafeGetIdentifier | public String unsafeGetIdentifier()(Code) | | Get this resource identifier.
The String value for the identifier. |
unsafeGetResourceReference | public ResourceReference unsafeGetResourceReference()(Code) | | Get the ResourceReference of that resource. ResourceReference is the
only public way to access a resource.
a ResourceReference instance. |
unsafeGetURLPath | public String unsafeGetURLPath()(Code) | | Get the file part of the URL this resource is attached to.
An URL object specifying the location in the information space of this resource. |
updateAttributes | public void updateAttributes()(Code) | | The web admin wants us to update any out of date attribute.
|
Methods inherited from org.w3c.tools.resources.AttributeHolder | public boolean definesAttribute(int idx) throws IllegalAttributeAccess(Code)(Java Doc) public boolean definesAttribute(String name) throws IllegalAttributeAccess(Code)(Java Doc) public Attribute[] getAttributes()(Code)(Java Doc) public boolean getBoolean(int idx, boolean def)(Code)(Java Doc) public char getChar(int idx, char def)(Code)(Java Doc) public Object getClone(Object values)(Code)(Java Doc) public synchronized Object getClone()(Code)(Java Doc) public synchronized Object getClone(Hashtable defs)(Code)(Java Doc) public double getDouble(int idx, double def)(Code)(Java Doc) public float getFloat(int idx, float def)(Code)(Java Doc) public int getInt(int idx, int def)(Code)(Java Doc) public long getLong(int idx, long def)(Code)(Java Doc) public String getString(int idx, String def)(Code)(Java Doc) public synchronized Object getValue(int idx, Object def) throws IllegalAttributeAccess(Code)(Java Doc) public Object getValue(String name, Object def) throws IllegalAttributeAccess(Code)(Java Doc) public synchronized void initialize(Object nvalues)(Code)(Java Doc) public synchronized void initialize(Hashtable defs)(Code)(Java Doc) public int lookupAttribute(String name)(Code)(Java Doc) public synchronized void pickleValues(Hashtable defs)(Code)(Java Doc) public void print(PrintStream out)(Code)(Java Doc) public void setBoolean(int idx, boolean b)(Code)(Java Doc) public void setChar(int idx, char ch) throws IllegalAttributeAccess(Code)(Java Doc) public void setDouble(int idx, double d) throws IllegalAttributeAccess(Code)(Java Doc) public void setFloat(int idx, float f) throws IllegalAttributeAccess(Code)(Java Doc) public void setInt(int idx, int i) throws IllegalAttributeAccess(Code)(Java Doc) public void setLong(int idx, long l) throws IllegalAttributeAccess(Code)(Java Doc) public void setString(int idx, String s) throws IllegalAttributeAccess(Code)(Java Doc) public synchronized void setValue(int idx, Object value)(Code)(Java Doc) public void setValue(String name, Object value)(Code)(Java Doc) public boolean unsafeDefinesAttribute(int idx) throws IllegalAttributeAccess(Code)(Java Doc) public double unsafeGetDouble(int idx, double def)(Code)(Java Doc) public String unsafeGetString(int idx, String def)(Code)(Java Doc) public Object unsafeGetValue(int idx, Object def) throws IllegalAttributeAccess(Code)(Java Doc)
|
|
|