| java.lang.Object org.w3c.tools.resources.AttributeHolder org.w3c.tools.resources.Resource org.w3c.tools.resources.FramedResource org.w3c.tools.resources.FileResource
All known Subclasses: org.w3c.jigsaw.zip.ZipFileResource, org.w3c.jigsaw.resources.ImageFileResource, org.w3c.jigsaw.resources.HttpFileResource,
Field Summary | |
protected static int | ATTR_FILENAME Attributes index - The filename attribute. | protected static int | ATTR_FILESTAMP Attribute index - The date at which we last checked the file content. | protected static int | ATTR_FILE_BACKUP | protected static int | ATTR_FILE_LENGTH Attribute index - The index for the content length attribute. | protected File | file The file we refer to. |
Method Summary | |
public long | checkContent() Check this file content, and update attributes if needed. | public File | getBackupFile() Get the name of the backup file for this resource. | public boolean | getBackupFlag() Get the backup flag, create a backup file when content change
if true. | public synchronized File | getFile() Get this file resource file name. | public int | getFileLength() | public long | getFileStamp() Get the date at which we last examined the file. | public String | getFilename() Get this resource filename attribute. | public void | initialize(Object values) Initialize the FileResource instance. | public synchronized boolean | newContent(InputStream in) Save the given stream as the underlying file content.
This method preserve the old file version in a ~ file.
Parameters: in - The input stream to use as the resource entity. | public synchronized void | setValue(int idx, Object value) Set some of this resource attribute. | public void | updateAttributes() Update our computed attributes. | public void | updateFileAttributes() Update the file related attributes. | public synchronized boolean | verify() Is that resource still wrapping an existing file ?
If the underlying file has disappeared and if the
container directory is extensible, remove the resource. |
ATTR_FILENAME | protected static int ATTR_FILENAME(Code) | | Attributes index - The filename attribute.
|
ATTR_FILESTAMP | protected static int ATTR_FILESTAMP(Code) | | Attribute index - The date at which we last checked the file content.
|
ATTR_FILE_BACKUP | protected static int ATTR_FILE_BACKUP(Code) | | Attribute index - The index for the backup flag
|
ATTR_FILE_LENGTH | protected static int ATTR_FILE_LENGTH(Code) | | Attribute index - The index for the content length attribute.
|
file | protected File file(Code) | | The file we refer to.
This is a cached version of some attributes, so we need to override
the setValue method in order to be able to catch any changes to it.
|
checkContent | public long checkContent()(Code) | | Check this file content, and update attributes if needed.
This method is normally called before any perform request is done, so
that we make sure that all meta-informations is up to date before
handling a request.
The time of the last update to the resource. |
getBackupFile | public File getBackupFile()(Code) | | Get the name of the backup file for this resource.
A File object suitable to receive the backup version of thisfile. |
getBackupFlag | public boolean getBackupFlag()(Code) | | Get the backup flag, create a backup file when content change
if true.
|
getFile | public synchronized File getFile()(Code) | | Get this file resource file name.
a File instance. exception: InvalidParentException - If no parent is available, and then the FileReource is unable to get its file. |
getFileLength | public int getFileLength()(Code) | | Get this file length
|
getFileStamp | public long getFileStamp()(Code) | | Get the date at which we last examined the file.
|
getFilename | public String getFilename()(Code) | | Get this resource filename attribute.
|
initialize | public void initialize(Object values)(Code) | | Initialize the FileResource instance.
|
newContent | public synchronized boolean newContent(InputStream in) throws IOException(Code) | | Save the given stream as the underlying file content.
This method preserve the old file version in a ~ file.
Parameters: in - The input stream to use as the resource entity. A boolean, true if the resource was justcreated, false otherwise. exception: IOException - If dumping the content failed. |
setValue | public synchronized void setValue(int idx, Object value)(Code) | | Set some of this resource attribute.
We just catch here any write access to the filename's, to update
our cache file object.
|
updateAttributes | public void updateAttributes()(Code) | | Update our computed attributes.
|
updateFileAttributes | public void updateFileAttributes()(Code) | | Update the file related attributes.
The file we serve has changed since the last time we checked it, if
any of the attribute values depend on the file content, this is the
appropriate place to recompute them.
|
verify | public synchronized boolean verify() throws MultipleLockException(Code) | | Is that resource still wrapping an existing file ?
If the underlying file has disappeared and if the
container directory is extensible, remove the resource.
true if that resource is wrapping an existing file exception: org.w3c.tools.resources.MultipleLockException - When the resource try to delete itself (because there is no more file) |
Methods inherited from org.w3c.tools.resources.FramedResource | public void addAttributeChangedListener(AttributeChangedListener l)(Code)(Java Doc) public void addStructureChangedListener(StructureChangedListener l)(Code)(Java Doc) public synchronized ResourceReference[] collectFramesReference(Class c)(Code)(Java Doc) public synchronized void delete() throws MultipleLockException(Code)(Java Doc) protected void disableEvent()(Code)(Java Doc) protected void displayEvent(FramedResource fr, EventObject evt)(Code)(Java Doc) protected void enableEvent()(Code)(Java Doc) protected boolean eventDisabled()(Code)(Java Doc) protected void fireAttributeChangeEvent(AttributeChangedEvent evt)(Code)(Java Doc) protected void fireStructureChangedEvent(int type)(Code)(Java Doc) protected void fireStructureChangedEvent(StructureChangedEvent evt)(Code)(Java Doc) public void frameAdded(FrameEvent evt)(Code)(Java Doc) public void frameModified(FrameEvent evt)(Code)(Java Doc) public void frameRemoved(FrameEvent evt)(Code)(Java Doc) public Object getClone(Object values)(Code)(Java Doc) public synchronized ResourceFrame getFrame(Class c, String identifier)(Code)(Java Doc) public synchronized ResourceFrame getFrame(String classname)(Code)(Java Doc) public synchronized ResourceReference getFrameReference(Class c)(Code)(Java Doc) public synchronized ResourceReference getFrameReference(ResourceFrame frame)(Code)(Java Doc) public synchronized ResourceReference[] getFramesReference()(Code)(Java Doc) public int getOid()(Code)(Java Doc) public void initialize(Object values)(Code)(Java Doc) public boolean lookup(LookupState ls, LookupResult lr) throws ProtocolException(Code)(Java Doc) public void markModified()(Code)(Java Doc) public void notifyUnload()(Code)(Java Doc) public ReplyInterface perform(RequestInterface request) throws ProtocolException, ResourceException(Code)(Java Doc) protected ReplyInterface performFrames(RequestInterface request) throws ProtocolException, ResourceException(Code)(Java Doc) protected void postAttributeChangeEvent(int idx, Object newvalue)(Code)(Java Doc) public void postEvent(ResourceEvent evt)(Code)(Java Doc) protected void postStructureChangedEvent(ResourceReference rr, int type)(Code)(Java Doc) protected void postStructureChangedEvent(int type)(Code)(Java Doc) public void processEvent(ResourceEvent evt)(Code)(Java Doc) public void registerFrame(ResourceFrame frame, Hashtable defs)(Code)(Java Doc) protected void registerFrameIfNone(String classname, String identifier) throws ClassNotFoundException, IllegalAccessException, InstantiationException, ClassCastException(Code)(Java Doc) public void removeAttributeChangedListener(AttributeChangedListener l)(Code)(Java Doc) public void removeStructureChangedListener(StructureChangedListener l)(Code)(Java Doc) public synchronized void setSilentValue(int idx, Object value)(Code)(Java Doc) public synchronized void setSilentValue(String name, Object value)(Code)(Java Doc) public synchronized void setValue(int idx, Object value)(Code)(Java Doc) public synchronized void unregisterFrame(ResourceFrame frame)(Code)(Java Doc) ResourceFrame unsafeGetFrame(Class c, String identifier)(Code)(Java Doc)
|
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)
|
|
|