    All Packages  Class Hierarchy  This Package  Previous  Next  Index

# Interface w3c.jigsaw.resources.ResourceStore

public interface ResourceStore
extends Object

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.).

  ##

  addResource(Resource)
    Add this resource to this resource store.
  enumerateResourceIdentifiers()
    Enumerate all the resources saved in this store.
  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.
  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.
  markModified(String)
    Mark this resource as modified.
  removeResource(String)
    Remove this resource from the repository.
  renameResource(String, String)
    Rename a given resource.
  save()
    Save this store.
  saveResource(String)
    Stabilize the resource having the given identifier.
  shutdown()
    Shutdown this store.
  unlockResource(ResourceLocker, String)
    Unlock the given resource in the cache.

  ##

  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.
  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.
  saveResource

        public abstract 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 abstract 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 abstract 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 abstract void addResource(Resource resource)

    Add this resource to this resource store.
    Parameters:
      resource - The resource to be added.
  removeResource

        public abstract void removeResource(String identifier)

    Remove this resource from the repository.
    Parameters:
      identifier - The identifier of the resource to be removed.
  renameResource

        public abstract void renameResource(String oldid,
                                            String newid)

    Rename a given resource.
    Parameters:
      oldid - The olde resource identifier.
      newid - The new resource identifier.
  markModified

        public abstract void markModified(String identifier)

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

        public abstract void shutdown()

    Shutdown this store.
  save

        public abstract void save()

    Save this store.
  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.
  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.
  initialize

        public abstract 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.

      All Packages  Class Hierarchy  This Package  Previous  Next  Index