|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.w3c.tools.resources.store.ResourceStoreManager
Field Summary | |
protected boolean |
closed
Is this store shutdown ? |
boolean |
debugMemory
|
protected ResourceEventQueue |
eventQueue
|
protected java.io.File |
index
Our index file. |
protected LRUList |
lru
The store entries least recetenly used list. |
static java.lang.String |
root_rep
|
protected java.io.File |
root_repository
Our root repository. |
protected java.lang.String |
server_name
server name; |
protected ResourceStoreState |
state
|
protected java.io.File |
storedir
Our store directory. |
static int |
STOREFILE_IDENTIFIER
The identifier for resource store files. |
protected org.w3c.tools.resources.store.StoreManagerSweeper |
sweeper
Our sweeper thread: |
Constructor Summary | |
ResourceStoreManager(java.lang.String server_name,
java.io.File storedir,
java.lang.String default_root_class,
java.lang.String default_root_name,
int max_loaded_store,
java.util.Hashtable defs)
Create a new resource store manager for given store directory. |
Method Summary | |
void |
acquireChildren(org.w3c.tools.resources.SpaceEntry sentry)
Acquire the StoreEntry of the space entry. |
void |
acquireChildren(org.w3c.tools.resources.SpaceEntry sentry,
java.io.File repository,
boolean transientFlag)
acquire children from an external file. |
org.w3c.tools.resources.ResourceReference |
addResource(org.w3c.tools.resources.SpaceEntry sentry,
org.w3c.tools.resources.Resource resource,
java.util.Hashtable defs)
Add this resource to the StoreEntry of the space entry. |
protected void |
checkClosed()
Check that this resource store manager isn't closed. |
protected void |
checkMaxLoadedStore()
|
void |
checkpoint()
Checkpoint all modified resource stores, by saving them to disk. |
void |
collect()
Collect enough entries to go back into fixed limits. |
java.lang.String |
createResourceStoreRepository()
Create a resource store repository name. |
protected void |
decrLoadedStore()
|
void |
deleteChildren(org.w3c.tools.resources.SpaceEntry sentry)
Delete all the children of resource indentified by its space entry. |
void |
deleteResource(org.w3c.tools.resources.SpaceEntry sentry,
org.w3c.tools.resources.Resource resource)
delete this resource from the StoreEntry (and the repository). |
void |
displayIndex()
|
java.util.Enumeration |
enumerateResourceIdentifiers(org.w3c.tools.resources.SpaceEntry sentry)
Enumerate the name (ie identifiers) of the space entry children. |
int |
getCurrentStoreIdentifier()
|
ResourceEventQueue |
getEventQueue()
|
protected java.io.File |
getIndexFile()
Get the index file. |
protected int |
getMaxLoadedStore()
|
protected java.lang.Integer |
getRootKey()
Get The root key. |
protected java.io.File |
getRootRepository()
Get the root repository. |
protected void |
incrLoadedStore()
|
protected void |
loadEntriesIndex()
Load the index file. |
org.w3c.tools.resources.ResourceReference |
loadResource(org.w3c.tools.resources.SpaceEntry sentry,
java.lang.String identifier,
java.util.Hashtable defs)
Restore the resource whose name is given. |
org.w3c.tools.resources.ResourceReference |
loadRootResource(java.lang.String identifier,
java.util.Hashtable defs)
Restore the resource whose name is given from the root StoreEntry. |
org.w3c.tools.resources.ResourceReference |
lookupResource(org.w3c.tools.resources.SpaceEntry sentry,
java.lang.String identifier)
Lookup this resource. |
void |
markModified(org.w3c.tools.resources.SpaceEntry sentry,
org.w3c.tools.resources.Resource resource)
Mark the given resource as being modified. |
void |
markUsed(java.lang.Object token)
Mark the given store as having been used recently. |
static void |
pickleProlog(java.io.DataOutputStream out,
ResourceStore store)
Dump a prolog in given stream for that resource store. |
protected org.w3c.tools.resources.store.StoreEntry |
pickLRUEntry()
Pick the least recently used entry, and remove all links to it. |
void |
renameResource(org.w3c.tools.resources.SpaceEntry sentry,
java.lang.String oldid,
java.lang.String newid)
Rename a resource in this resource space. |
void |
salvage()
|
ResourceStoreState |
salvageState()
Try to salvage the resource store manager state. |
void |
saveChildren(org.w3c.tools.resources.SpaceEntry sentry)
Save all the children of the resource indentified by its spaec entry. |
protected void |
saveEntriesIndex()
Save the index file. |
void |
saveResource(org.w3c.tools.resources.SpaceEntry sentry,
org.w3c.tools.resources.Resource resource)
Save this resource to the StoreEntry of the space entry. |
void |
shutdown()
Shutdown this resource store manager. |
static void |
unpickleProlog(java.io.DataInputStream in,
ResourceStore store)
Read in the prolog from the given input stream. |
protected boolean |
used(java.lang.String rep)
|
protected void |
warning(java.lang.String msg)
Emit the given string as a warning, to whoever it is appropriate. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Field Detail |
public static final int STOREFILE_IDENTIFIER
pickleProlog
will start
with a dump of that integer.pickleProlog(java.io.DataOutputStream, org.w3c.tools.resources.store.ResourceStore)
,
unpickleProlog(java.io.DataInputStream, org.w3c.tools.resources.store.ResourceStore)
public static final java.lang.String root_rep
public boolean debugMemory
protected boolean closed
protected java.io.File storedir
protected java.io.File index
protected java.lang.String server_name
protected java.io.File root_repository
protected LRUList lru
protected ResourceStoreState state
protected org.w3c.tools.resources.store.StoreManagerSweeper sweeper
protected ResourceEventQueue eventQueue
Constructor Detail |
public ResourceStoreManager(java.lang.String server_name, java.io.File storedir, java.lang.String default_root_class, java.lang.String default_root_name, int max_loaded_store, java.util.Hashtable defs)
storedir
- The store directory to manage.Method Detail |
public ResourceEventQueue getEventQueue()
protected final int getMaxLoadedStore()
protected void incrLoadedStore()
protected void decrLoadedStore()
protected final void checkClosed()
protected org.w3c.tools.resources.store.StoreEntry pickLRUEntry()
public void collect()
public java.lang.String createResourceStoreRepository()
loadResourceStore
method
that takes a key as a parameter, this allows to caller to abstract
itself from the physical location of the repository.public int getCurrentStoreIdentifier()
protected java.io.File getIndexFile()
protected java.io.File getRootRepository()
protected java.lang.Integer getRootKey()
protected void warning(java.lang.String msg)
msg
- The warning message.protected void saveEntriesIndex()
protected void loadEntriesIndex()
public void shutdown()
public void checkpoint()
public void markUsed(java.lang.Object token)
token
- The token the resource store manager provided you when
it initialized the store.public static void pickleProlog(java.io.DataOutputStream out, ResourceStore store) throws java.io.IOException
out
- The output stream to dump the prolog to.store
- The resource store which is being dumped.unpickleProlog(java.io.DataInputStream, org.w3c.tools.resources.store.ResourceStore)
public static void unpickleProlog(java.io.DataInputStream in, ResourceStore store) throws java.io.IOException, NotAStoreException, InvalidStoreClassException, StoreClassVersionException
Using that method, as well as using the pickleProlog
method is optional; however, using one makes using the other
mandatory.
in
- The input stream to read the prolog from.store
- The store that is to be created from the given input
stream.pickleProlog(java.io.DataOutputStream, org.w3c.tools.resources.store.ResourceStore)
protected boolean used(java.lang.String rep)
public void salvage()
public void displayIndex()
public ResourceStoreState salvageState()
public org.w3c.tools.resources.ResourceReference loadRootResource(java.lang.String identifier, java.util.Hashtable defs)
identifier
- The identifier of the resource to restore.defs
- Default attribute values.public org.w3c.tools.resources.ResourceReference lookupResource(org.w3c.tools.resources.SpaceEntry sentry, java.lang.String identifier)
sentry
- The resource space entry.identifier
- The resource identifier.public org.w3c.tools.resources.ResourceReference loadResource(org.w3c.tools.resources.SpaceEntry sentry, java.lang.String identifier, java.util.Hashtable defs)
sentry
- The resource space entry.identifier
- The identifier of the resource to restore.defs
- Default attribute values.public org.w3c.tools.resources.ResourceReference addResource(org.w3c.tools.resources.SpaceEntry sentry, org.w3c.tools.resources.Resource resource, java.util.Hashtable defs)
sentry
- The resource space entry.resource
- The resource to add.defs
- Default attribute values.public void saveResource(org.w3c.tools.resources.SpaceEntry sentry, org.w3c.tools.resources.Resource resource)
sentry
- The resource space entryresource
- The resource to save.public void markModified(org.w3c.tools.resources.SpaceEntry sentry, org.w3c.tools.resources.Resource resource)
sentry
- The resource space entry.resource
- The resource to mark as modified.public void renameResource(org.w3c.tools.resources.SpaceEntry sentry, java.lang.String oldid, java.lang.String newid)
sentry
- The resource space entry.oldid
- The old resorce identifier.newid
- The new resorce identifier.public void deleteResource(org.w3c.tools.resources.SpaceEntry sentry, org.w3c.tools.resources.Resource resource)
sentry
- The resource space entryresource
- The resource to delete.public void deleteChildren(org.w3c.tools.resources.SpaceEntry sentry)
sentry
- The resource space entrypublic void saveChildren(org.w3c.tools.resources.SpaceEntry sentry)
sentry
- The resource space entryprotected void checkMaxLoadedStore()
public void acquireChildren(org.w3c.tools.resources.SpaceEntry sentry, java.io.File repository, boolean transientFlag)
sentry
- The resource space entry.repository
- The file used to store children.public void acquireChildren(org.w3c.tools.resources.SpaceEntry sentry)
sentry
- The resource space entry.public java.util.Enumeration enumerateResourceIdentifiers(org.w3c.tools.resources.SpaceEntry sentry)
sentry
- The space entry.all
- Should all resources be listed.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |