All Packages  Class Hierarchy  This Package  Previous  Next  Index

Interface w3c.tools.store.ResourceStore

public interface ResourceStore
A resource store implements persistency for a set of resources. A resource store may implement a number of strategies along different axis, for example:


Method Index

 o acceptUnload()
Can this resource store be unloaded now ? This method gets called by the ResourceStoreManager before calling the shutdown method, when possible.
 o addHolder(ResourceStoreHolder)
Add a store holder.
 o addResource(Resource)
Add this resource to this resource store.
 o enumerateResourceIdentifiers()
Enumerate all the resources saved in this store.
 o getIdentifier()
Get the identifier for that store.
 o getVersion()
Get the version of that resource store.
 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 loadResource(String, Hashtable)
Restore the resource whose name is given.
 o lockResource(ResourceLocker, Resource)
Register for notifications when that resource is unloaded.
 o lookupResource(String)
Get this resource, but only if already loaded.
 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)
Rename a given resource.
 o save()
Save this store.
 o saveResource(Resource)
Stabilize the given resource.
 o shutdown()
Shutdown this store.
 o unlockResource(ResourceLocker, Resource)
Unlock the given resource in the cache.

Methods

 o getVersion
 public abstract int getVersion()
Get the version of that resource store. Version numbers are used to distinguish between pickling format. A resource store implementator has the duty of bumping the returned number whenever it's archiving format changes. Resource stores that relies on some external archiving mechanisms (such as a database), may return a constant.

Returns:
An integer version number.
 o getIdentifier
 public abstract String getIdentifier()
Get the identifier for that store.

Returns:
A uniq store identifier, as a String.
 o addHolder
 public abstract void addHolder(ResourceStoreHolder holder)
Add a store holder. Store holders are object holding references to a given store. Such holders have some duties with regard to the store management, dictated by the ResourceStoreHolder interface.

Parameters:
holder - The object willing to hold a refernce to the store.
 o removeHolder
 public abstract void removeHolder(ResourceStoreHolder holder)
Remove a store holder. Notify the store that the given holder will no longer hold a reference to that store.

Parameters:
holder - The holder that is unsubscribing.
 o loadResource
 public abstract Resource loadResource(String identifier,
                                       Hashtable defs) throws InvalidResourceException
Restore the resource whose name is given. This method doesn't assume that the resource will actually be restored, it can be kept in a cache by the ResourceStore object, and the cached version of the resource may be returned.

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.
Throws: InvalidResourceException
If the resource could not be restored from the store.
 o lookupResource
 public abstract 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 abstract void saveResource(Resource resource)
Stabilize the given resource.

Parameters:
resource - The resource to save.
 o lockResource
 public abstract boolean lockResource(ResourceLocker locker,
                                      Resource resource)
Register for notifications when that resource is unloaded. This method asks the resource store to notify you (as a ResourceLocker implementer) when that resource is unloaded from memory.

Parameters:
resource - The resource to lock.
Returns:
A boolean true if locking succeeded.
See Also:
ResourceLocker
 o unlockResource
 public abstract void unlockResource(ResourceLocker locker,
                                     Resource resource)
Unlock the given resource in the cache.

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

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

Parameters:
identifier - The identifier of the resource to be removed.
 o renameResource
 public abstract void renameResource(String oldid,
                                     String newid)
Rename a given resource.

Parameters:
oldid - The olde resource identifier.
newid - The new resource identifier.
 o markModified
 public abstract void markModified(Resource resource)
Mark this resource as modified.

Parameters:
resource - The resource that has changed (and will have to be pickled some time latter).
 o acceptUnload
 public abstract boolean acceptUnload()
Can this resource store be unloaded now ? This method gets called by the ResourceStoreManager before calling the shutdown method, when possible. An implementation of that method is responsible for checking the acceptUnload method of all its loaded resource before returning true, meaning that the resource store can be unloaded.

Returns:
A boolean true if the resource store can be unloaded.
 o shutdown
 public abstract void shutdown()
Shutdown this store.

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

 o enumerateResourceIdentifiers
 public abstract 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 abstract 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 abstract void initialize(ResourceStoreManager manager,
                                 Object token,
                                 File repository)
This resource store is being built, initialize it with the given arg.

Parameters:
manager - The ResourceStoreManager instance that asks yourself to initialize.
token - The resource store manager key to that resource store, this token should be used when calling methods from the manager that are to act on yourself.
repository - A file, giving the location of the associated repository.

All Packages  Class Hierarchy  This Package  Previous  Next  Index