    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Class w3c.www.protocol.http.cache.jdbmResourceStore

    java.lang.Object
       |
       +----w3c.www.protocol.http.cache.jdbmResourceStore

public class jdbmResourceStore
extends Object
implements ResourceStore

##

defdefs
LOADED_LIMIT
LOADED_THRESOLD

##

jdbmResourceStore()

##

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.
getLoadedCount()
getResourceBytes(String)
  Get the bytes that are the pickled version of the given resource.
hasResource(String)
  Check for the existence of a resource in this store.
initialize(ResourceStoreManager, 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.
lockResource(ResourceLocker, String)
  Lock the given resource in the cache.
lookupResource(String)
  Get this resource, but only if already loaded.
main(String[])
  Dump all resources.
markModified(String)
  Mark this resource as modified.
removeResource(String)
  Remove this resource from the repository.
renameResource(String, String)
runStoreSweeper()
save()
  Save this store.
saveResource(jdbmResource)
saveResource(String)
  Stabilize the resource having the given identifier.
setPersist(Resource)
shutdown()
  Shutdown this store.
unloadResource()
  Unload one selected resource from the store.
unlockResource(ResourceLocker, String)
  Unlock the given resource in the cache.

##

LOADED_LIMIT

      public final static int LOADED_LIMIT

LOADED_THRESOLD

      public final static int LOADED_THRESOLD

defdefs

      protected Hashtable defdefs

##

jdbmResourceStore

      public jdbmResourceStore()

##

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(String identifier) throws UnknownResourceException

  Stabilize the resource having the given identifier.
  Parameters:
    identifier - The resource identifier.
  Throws: UnknownResourceException
    If the resource is unknown.

lockResource

      public boolean lockResource(ResourceLocker locker,
                                  String identifier)

  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.

unlockResource

      public void unlockResource(ResourceLocker locker,
                                 String identifier)

  Unlock the given resource in the cache.
  Parameters:
    identifier - The identifier of the resource to be unlocked.

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(String identifier)

  Mark this resource as modified.
  Parameters:
    identifier - The identifier of the modified resource.

shutdown

      public void shutdown()

  Shutdown this store.

save

      public synchronized void save()

  Save this store.

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.

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,
                             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