| org.w3c.tools.resources.store.ResourceStore
All known Subclasses: org.w3c.tools.resources.store.ResourceStoreImpl,
ResourceStore | public interface ResourceStore (Code) | | A resource store implements persistency for a set of resources.
A resource store may implement a number of strategies along different
axis, for example:
- It may connect to some database to get the resource attributes.
- It may restrict the classes of the resource it handles (for security
reasons), by using a specific class loader.
- It may implement some caching scheme, to keep memory requirements low.
- It may be distributed (eg using a ResourceStoreStub in the client, but
providing access to a server-side resource store.).
|
Method Summary | |
abstract public boolean | acceptUnload() Can this resource store be unloaded now ?
This method gets called by the ResourceStoreManager before calling
the shutdown method, when possible. | public void | addResource(Resource resource) Add this resource to this resource store. | public Enumeration | enumerateResourceIdentifiers() Enumerate all the resources saved in this store. | public String | getIdentifier() Get the identifier for that store. | public int | getVersion() Get the version of that resource store.
Version numbers are used to distinguish between pickling format. | public boolean | hasResource(String identifier) Check for the existence of a resource in this store.
Parameters: identifier - The identifier of the resource to check. | public void | initialize(ResourceStoreManager manager, Object token, File repository, Serializer serializer) This resource store is being built, initialize it with the given arg. | public Resource | loadResource(String identifier, Hashtable defs) 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. Parameters: defs - Default attribute values. | 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. | public void | markModified(Resource resource) Mark this resource as modified. | public void | removeResource(String identifier) Remove this resource from the repository. | public void | renameResource(String oldid, String newid) Rename a given resource. | public void | save() Save this store. | public void | saveResource(Resource resource) Stabilize the given resource. | public void | shutdown() Shutdown this store. |
acceptUnload | abstract public boolean acceptUnload()(Code) | | 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.
A boolean true if the resource store can beunloaded. |
addResource | public void addResource(Resource resource)(Code) | | Add this resource to this resource store.
Parameters: resource - The resource to be added. |
enumerateResourceIdentifiers | public Enumeration enumerateResourceIdentifiers()(Code) | | Enumerate all the resources saved in this store.
An enumeration of Strings, giving the identifier for all the resources that this store knows about. |
getIdentifier | public String getIdentifier()(Code) | | Get the identifier for that store.
A uniq store identifier, as a String. |
getVersion | public int getVersion()(Code) | | 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.
An integer version number. |
hasResource | public boolean hasResource(String identifier)(Code) | | Check for the existence of a resource in this store.
Parameters: identifier - The identifier of the resource to check. A boolean true if the resource existsin this store, false otherwise. |
initialize | public void initialize(ResourceStoreManager manager, Object token, File repository, Serializer serializer)(Code) | | This resource store is being built, initialize it with the given arg.
Parameters: manager - The ResourceStoreManager instance that asks yourselfto initialize. Parameters: token - The resource store manager key to that resource store, this token should be used when calling methods from the manager thatare to act on yourself. Parameters: repository - A file, giving the location of the associated repository. |
loadResource | public Resource loadResource(String identifier, Hashtable defs) throws InvalidResourceException(Code) | | 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. Parameters: defs - Default attribute values. If the resource needs to berestored from its pickled version, this Hashtable providesa set of default values for some of the attributes. A Resource instance, or null. exception: InvalidResourceException - If the resource could notbe restored from the store. |
lookupResource | public Resource lookupResource(String identifier)(Code) | | 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. A Resource instance, or null. |
markModified | public void markModified(Resource resource)(Code) | | Mark this resource as modified.
Parameters: resource - The resource that has changed (and will have to bepickled some time latter). |
removeResource | public void removeResource(String identifier)(Code) | | Remove this resource from the repository.
Parameters: identifier - The identifier of the resource to be removed. |
renameResource | public void renameResource(String oldid, String newid)(Code) | | Rename a given resource.
Parameters: oldid - The olde resource identifier. Parameters: newid - The new resource identifier. |
save | public void save()(Code) | | Save this store.
|
saveResource | public void saveResource(Resource resource)(Code) | | Stabilize the given resource.
Parameters: resource - The resource to save. |
shutdown | public void shutdown()(Code) | | Shutdown this store.
|
|
|