All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class w3c.jigsaw.upgrade.from1to2.SimpleResourceStore

java.lang.Object
   |
   +----w3c.jigsaw.upgrade.from1to2.SimpleResourceStore

public class SimpleResourceStore
extends Object
A very naive resource store. This resource store keeps all the resources in a file. It loads all resources (on a per-demand basis), and never unloads them.


Constructor Index

 o SimpleResourceStore()

Method Index

 o enumerateResourceIdentifiers()
Enumerate all the resources identifier in this repository.
 o getFileAt(int)
Get our file, positionned at the given position.
 o getResourceBytes(ResourceIndex, byte[])
Get the bytes that are the pickled version of the given resource.
 o initialize(File)
Initialize this simple store with the given file.
 o loadIndex(Hashtable)
Restore our whole index from our repository.
 o save()
Internal save: save the repository back to disk.
 o toString()
Print a simple resource store.
 o upgrade(String)

Constructors

 o SimpleResourceStore
 public SimpleResourceStore()

Methods

 o getFileAt
 protected RandomAccessFile getFileAt(int pos) throws IOException
Get our file, positionned at the given position. We won't keep our repository file always open (too much of these resource stroe would burn our available file descriptors).

Parameters:
at - The position at wich you want the stream.
 o loadIndex
 protected synchronized void loadIndex(Hashtable target) throws IOException
Restore our whole index from our repository.

 o getResourceBytes
 protected synchronized byte[] getResourceBytes(ResourceIndex index,
                                                byte into[]) throws IOException
Get the bytes that are the pickled version of the given resource. This opens the file for each resource, it could of course be optimized for the cases were all the resources are to be loaded at once.

Parameters:
identifier - The resource identifier.
Returns:
The length, in the instance buffer, of the bytes that makes this resource.
 o save
 public synchronized void save() throws IOException
Internal save: save the repository back to disk.

Parameters:
unload - Should we unload any existing resources ?
 o upgrade
 public boolean upgrade(String identifier) throws IOException, ResourceUpgraderException
 o enumerateResourceIdentifiers
 public Enumeration enumerateResourceIdentifiers()
Enumerate all the resources identifier in this repository.

 o toString
 public String toString()
Print a simple resource store.

Overrides:
toString in class Object
 o initialize
 public void initialize(File repository) throws IOException
Initialize this simple store with the given file.

Parameters:
manager - The resource store manager that loaded use.
file - The repository file.

All Packages  Class Hierarchy  This Package  Previous  Next  Index