All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class w3c.tools.store.jdbmResourceStore

java.lang.Object
   |
   +----w3c.tools.store.jdbmResourceStore

public class jdbmResourceStore
extends Object
implements ResourceStore

Variable Index

 o LOADED_LIMIT
 o LOADED_THRESOLD

Constructor Index

 o jdbmResourceStore()

Method Index

 o acceptUnload()
 o addHolder(ResourceStoreHolder)
Add a holder to that store.
 o addResource(Resource)
Add this resource to this resource store.
 o dbmError(Exception, String)
A jdbm error has occured, this is potentially serious.
 o enumerateResourceIdentifiers()
Enumerate all the resources saved in this store.
 o getIdentifier()
Get the identifier for that store.
 o getLoadedCount()
 o getResourceBytes(String)
Get the bytes that are the pickled version of the given resource.
 o getVersion()
 o hasResource(String)
Check for the existence of a resource in this store.
 o initialize(ResourceStoreManager, Object, File)
This resource store is being built, initialize it with the given arg.
 o listLRU(PrintStream, String)
 o loadResource(String)
 o loadResource(String, Hashtable)
Restore the resource whose name is given.
 o lockResource(ResourceLocker, Resource)
Lock the given resource in the cache.
 o lookupResource(String)
Get this resource, but only if already loaded.
 o main(String[])
Dump all resources.
 o markModified(Resource)
Mark this resource as modified.
 o removeHolder(ResourceStoreHolder)
Remove a store holder.
 o removeResource(String)
Remove this resource from the repository.
 o renameResource(String, String)
 o reorganize()
 o runStoreSweeper()
 o save()
Save this store.
 o saveResource(jdbmResource)
 o saveResource(Resource)
Stabilize the resource having the given identifier.
 o setPersist(Resource)
 o shutdown()
Shutdown this store.
 o startReorganize()
 o unloadResource()
Unload one selected resource from the store.
 o unlockResource(ResourceLocker, Resource)
Unlock the given resource in the cache.

Variables

 o LOADED_LIMIT
 public static final int LOADED_LIMIT
 o LOADED_THRESOLD
 public static final int LOADED_THRESOLD

Constructors

 o jdbmResourceStore
 public jdbmResourceStore()

Methods

 o reorganize
 protected void reorganize()
 o startReorganize
 protected final void startReorganize()
 o addHolder
 public synchronized void addHolder(ResourceStoreHolder holder)
Add a holder to that store.

Parameters:
holder - The holder to add.
 o removeHolder
 public synchronized void removeHolder(ResourceStoreHolder holder)
Remove a store holder.

Parameters:
holder - The holder to remove.
 o getIdentifier
 public String getIdentifier()
Get the identifier for that store. We use the repository as an identifier, which is safe here.

Returns:
The absolute path of the repository.
 o getVersion
 public int getVersion()
 o setPersist
 public void setPersist(Resource resource)
 o listLRU
 public void listLRU(PrintStream out,
                     String msg)
 o runStoreSweeper
 public void runStoreSweeper()
 o getLoadedCount
 public final int getLoadedCount()
 o unloadResource
 public void unloadResource()
Unload one selected resource from the store.

 o dbmError
 protected void dbmError(Exception ex,
                         String msg)
A jdbm error has occured, this is potentially serious.

Parameters:
ex - The dbm exception.
msg - An informative description of the error.
 o getResourceBytes
 protected synchronized byte[] getResourceBytes(String identifier)
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 saveResource
 protected void saveResource(jdbmResource entry)
 o loadResource
 public Resource loadResource(String identifier,
                              Hashtable defs) throws InvalidResourceException
Restore the resource whose name is given.

Parameters:
identifier - The identifier of the resource to restore.
defs - Default attribute values. If the resource needs to be restored from its pickled version, this Hashtable provides a set of default values for some of the attributes.
Returns:
A Resource instance, or null.
 o loadResource
 public Resource loadResource(String identifier) throws InvalidResourceException
 o renameResource
 public synchronized void renameResource(String oldid,
                                         String newid)
 o lookupResource
 public Resource lookupResource(String identifier)
Get this resource, but only if already loaded. The resource store may (recommended) maintain a cache of the resource it loads from its store. If the resource having this identifier has already been loaded, return it, otherwise, return null.

Parameters:
identifier - The resource identifier.
Returns:
A Resource instance, or null.
 o saveResource
 public void saveResource(Resource resource)
Stabilize the resource having the given identifier.

Parameters:
identifier - The resource identifier.
Throws: UnknownResourceException
If the resource is unknown.
 o lockResource
 public boolean lockResource(ResourceLocker locker,
                             Resource resource)
Lock the given resource in the cache.

Parameters:
identifier - The identifier of the resource to be locked in cache.
Returns:
A boolean true if locking succeeded.
 o unlockResource
 public void unlockResource(ResourceLocker locker,
                            Resource resource)
Unlock the given resource in the cache.

Parameters:
identifier - The identifier of the resource to be unlocked.
 o addResource
 public void addResource(Resource resource)
Add this resource to this resource store.

Parameters:
resource - The resource to be added.
 o removeResource
 public void removeResource(String identifier)
Remove this resource from the repository.

Parameters:
identifier - The identifier of the resource to be removed.
 o markModified
 public void markModified(Resource resource)
Mark this resource as modified.

Parameters:
identifier - The identifier of the modified resource.
 o acceptUnload
 public boolean acceptUnload()
 o shutdown
 public void shutdown()
Shutdown this store.

 o save
 public synchronized void save()
Save this store.

 o enumerateResourceIdentifiers
 public Enumeration enumerateResourceIdentifiers()
Enumerate all the resources saved in this store.

Returns:
An enumeration of Strings, giving the identifier for all the resources that this store knows about.
 o hasResource
 public boolean hasResource(String identifier)
Check for the existence of a resource in this store.

Parameters:
identifier - The identifier of the resource to check.
Returns:
A boolean true if the resource exists in this store, false otherwise.
 o initialize
 public void initialize(ResourceStoreManager manager,
                        Object token,
                        File repository)
This resource store is being built, initialize it with the given arg.

Parameters:
repository - A file, giving the location of the associated repository.
 o main
 public static void main(String args[])
Dump all resources.


All Packages  Class Hierarchy  This Package  Previous  Next  Index