org.apache.catalina.resources
Class ResourceBean

java.lang.Object
  |
  +--org.apache.catalina.resources.ResourceBean
Direct Known Subclasses:
DirectoryBean

public class ResourceBean
extends java.lang.Object

Abstraction bean that represents the properties of a "resource" that may or may not be a "directory", in a fashion that is independent of the actual underlying medium used to represent those entries. Convenient constructors are provided to populate our properties from common sources, but it is feasible to do everything with property setters if necessary.

Version:
$Revision: 1.1 $ $Date: 2000/08/11 22:45:58 $
Author:
Craig R. McClanahan

Field Summary
protected  byte[] data
          The data content of this resource.
protected  long lastModified
          The last modified date/time for this resource, in milliseconds since the epoch.
protected  java.lang.String name
          The normalized context-relative name of this resource.
protected  DirectoryBean parent
          The parent resource (normally a directory entry) of this resource.
protected  long size
          The size of this resource, in bytes.
 
Constructor Summary
ResourceBean(java.lang.String name)
          Construct a new resource bean for the named resource, with default properties.
ResourceBean(java.lang.String name, java.io.File file)
          Construct a new resource bean for the named resource, with properties populated from the specified object.
ResourceBean(java.lang.String name, java.util.jar.JarEntry entry)
          Construct a new resource bean for the named resource, with properties populated from the specified object.
 
Method Summary
 void cache(java.io.InputStream input)
          Cache the data for this resource from the specified input stream.
 byte[] getData()
           
 long getLastModified()
           
 java.lang.String getName()
           
 DirectoryBean getParent()
           
 long getSize()
           
protected  void populate(java.io.File file)
          Populate our properties from the specified File object.
protected  void populate(java.util.jar.JarEntry entry)
          Populate our properties from the specified JarEntry object.
 void setData(byte[] data)
           
 void setLastModified(long lastModified)
           
 void setName(java.lang.String name)
           
 void setParent(DirectoryBean parent)
           
 void setSize(long size)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

data

protected byte[] data
The data content of this resource. This property is only initialized when the corresponding property setter method is called.

lastModified

protected long lastModified
The last modified date/time for this resource, in milliseconds since the epoch.

name

protected java.lang.String name
The normalized context-relative name of this resource.

parent

protected DirectoryBean parent
The parent resource (normally a directory entry) of this resource. Note that this property is not set from an underlying File or JarEntry argument to our constructor -- you must call setParent() explicitly if you wish to maintain this relationship.

size

protected long size
The size of this resource, in bytes.
Constructor Detail

ResourceBean

public ResourceBean(java.lang.String name)
Construct a new resource bean for the named resource, with default properties.
Parameters:
name - Normalized context-relative name of this resource

ResourceBean

public ResourceBean(java.lang.String name,
                    java.io.File file)
Construct a new resource bean for the named resource, with properties populated from the specified object. Note that the data content of this resource is not initialized unless and until setData() is called.
Parameters:
name - Normalized context-relative name of this resource
file - File representing this resource entry

ResourceBean

public ResourceBean(java.lang.String name,
                    java.util.jar.JarEntry entry)
Construct a new resource bean for the named resource, with properties populated from the specified object. Note that the data content of this resource is not initialized unless and until setData() is called.
Parameters:
name - Normalized context-relative name of this resource
entry - JAR entry representing this resource entry
Method Detail

getData

public byte[] getData()

setData

public void setData(byte[] data)

getLastModified

public long getLastModified()

setLastModified

public void setLastModified(long lastModified)

getName

public java.lang.String getName()

setName

public void setName(java.lang.String name)

getParent

public DirectoryBean getParent()

setParent

public void setParent(DirectoryBean parent)

getSize

public long getSize()

setSize

public void setSize(long size)

cache

public void cache(java.io.InputStream input)
           throws java.io.IOException
Cache the data for this resource from the specified input stream.
Parameters:
input - InputStream from which to read the data for this resource
Throws:
java.io.IOException - if an input/output error occurs

populate

protected void populate(java.io.File file)
Populate our properties from the specified File object.
Parameters:
file - File representing this entry

populate

protected void populate(java.util.jar.JarEntry entry)
Populate our properties from the specified JarEntry object.
Parameters:
entry - JarEntry representing this entry


Copyright © 2000 Apache Software Foundation. All Rights Reserved.