All Packages Class Hierarchy This Package Previous Next Index
Class org.w3c.tools.jdbm.jdbmResourceStore
java.lang.Object
|
+----org.w3c.tools.jdbm.jdbmResourceStore
- public class jdbmResourceStore
- extends Object
- implements ResourceStore
-
LOADED_LIMIT
-
-
LOADED_THRESOLD
-
-
jdbmResourceStore()
-
-
acceptUnload()
-
-
addResource(Resource)
- Add this resource to this resource store.
-
dbmError(Exception, String)
- A jdbm error has occured, this is potentially serious.
-
enumerateResourceIdentifiers()
- Enumerate all the resources saved in this store.
-
getIdentifier()
- Get the identifier for that store.
-
getLoadedCount()
-
-
getResourceBytes(String)
- Get the bytes that are the pickled version of the given resource.
-
getVersion()
-
-
hasResource(String)
- Check for the existence of a resource in this store.
-
initialize(ResourceStoreManager, Object, File)
- This resource store is being built, initialize it with the given arg.
-
listLRU(PrintStream, String)
-
-
loadResource(String)
-
-
loadResource(String, Hashtable)
- Restore the resource whose name is given.
-
lookupResource(String)
- Get this resource, but only if already loaded.
-
main(String[])
- Dump all resources.
-
markModified(Resource)
- Mark this resource as modified.
-
removeResource(String)
- Remove this resource from the repository.
-
renameResource(String, String)
-
-
reorganize()
-
-
runStoreSweeper()
-
-
save()
- Save this store.
-
saveResource(jdbmResource)
-
-
saveResource(Resource)
- Stabilize the resource having the given identifier.
-
setPersist(Resource)
-
-
shutdown()
- Shutdown this store.
-
startReorganize()
-
-
unloadResource()
- Unload one selected resource from the store.
LOADED_LIMIT
public static final int LOADED_LIMIT
LOADED_THRESOLD
public static final int LOADED_THRESOLD
jdbmResourceStore
public jdbmResourceStore()
reorganize
protected void reorganize()
startReorganize
protected final void startReorganize()
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.
getVersion
public int getVersion()
setPersist
public void setPersist(Resource resource)
listLRU
public void listLRU(PrintStream out,
String msg)
runStoreSweeper
public void runStoreSweeper()
getLoadedCount
public final int getLoadedCount()
unloadResource
public void unloadResource()
- Unload one selected resource from the store.
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.
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.
saveResource
protected void saveResource(jdbmResource entry)
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.
loadResource
public Resource loadResource(String identifier) throws InvalidResourceException
renameResource
public synchronized void renameResource(String oldid,
String newid)
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.
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.
addResource
public void addResource(Resource resource)
- Add this resource to this resource store.
- Parameters:
- resource - The resource to be added.
removeResource
public void removeResource(String identifier)
- Remove this resource from the repository.
- Parameters:
- identifier - The identifier of the resource to be removed.
markModified
public void markModified(Resource resource)
- Mark this resource as modified.
- Parameters:
- identifier - The identifier of the modified resource.
acceptUnload
public boolean acceptUnload()
shutdown
public void shutdown()
- Shutdown this store.
save
public void save()
- Save this store.
enumerateResourceIdentifiers
public synchronized 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.
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.
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.
main
public static void main(String args[])
- Dump all resources.
All Packages Class Hierarchy This Package Previous Next Index