|
|||||||||
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 Serializer |
serializer
|
protected java.lang.String |
server_name
server name; |
protected ResourceStoreState |
state
|
static java.lang.String |
STATE_F
|
protected java.io.File |
storedir
Our store directory. |
static int |
SUBDIRS
Number of sub-levels file system directories in the store directory. |
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,
java.lang.String serializer_class,
int max_loaded_store,
java.util.Hashtable defs)
Create a new resource store manager for given store directory. |
Method Summary | |
void |
acquireChildren(SpaceEntry sentry)
Acquire the StoreEntry of the space entry. |
void |
acquireChildren(SpaceEntry sentry,
java.io.File repository,
boolean transientFlag)
acquire children from an external file. |
ResourceReference |
addResource(SpaceEntry sentry,
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. |
protected boolean |
checkSubDirs()
|
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(SpaceEntry sentry)
Delete all the children of resource indentified by its space entry. |
void |
deleteResource(SpaceEntry sentry,
Resource resource)
delete this resource from the StoreEntry (and the repository). |
void |
displayIndex()
|
java.util.Enumeration |
enumerateResourceIdentifiers(SpaceEntry sentry)
Enumerate the name (ie identifiers) of the space entry children. |
int |
getCurrentStoreIdentifier()
|
ResourceEventQueue |
getEventQueue()
|
java.lang.String |
getHTMLStatus()
Implementation of Status interface Display statistics about usage of the resource store manager |
protected java.io.File |
getIndexFile()
Get the index file. |
protected int |
getMaxLoadedStore()
|
protected java.io.File |
getOldIndexFile()
Get the index file. |
protected java.lang.Integer |
getRootKey()
Get The root key. |
protected java.io.File |
getRootRepository()
Get the root repository. |
protected void |
incrLoadedStore()
|
protected void |
loadNewEntriesIndex()
|
ResourceReference |
loadResource(SpaceEntry sentry,
java.lang.String identifier,
java.util.Hashtable defs)
Restore the resource whose name is given. |
ResourceReference |
loadRootResource(java.lang.String identifier,
java.util.Hashtable defs)
Restore the resource whose name is given from the root NewStoreEntry. |
ResourceReference |
lookupResource(SpaceEntry sentry,
java.lang.String identifier)
Lookup this resource. |
void |
markModified(SpaceEntry sentry,
Resource resource)
Mark the given resource as being modified. |
void |
markUsed(java.lang.Object token)
Mark the given store as having been used recently. |
protected NewStoreEntry |
pickLRUEntry()
Pick the least recently used entry, and remove all links to it. |
void |
renameResource(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(SpaceEntry sentry)
Save all the children of the resource indentified by its spaec entry. |
protected void |
saveNewEntriesIndex()
|
void |
saveResource(SpaceEntry sentry,
Resource resource)
Save this resource to the StoreEntry of the space entry. |
void |
shutdown()
Shutdown this resource store manager. |
static void |
updateEntriesIndex(java.io.File oldIndexFile,
java.io.File newIndexFile,
Serializer serializer)
update the old index file. |
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 SUBDIRS
public static final java.lang.String ROOT_REP
public static final java.lang.String STATE_F
public boolean debugMemory
protected Serializer serializer
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, java.lang.String serializer_class, 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 NewStoreEntry 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 boolean checkSubDirs()
protected java.io.File getIndexFile()
protected java.io.File getOldIndexFile()
protected java.io.File getRootRepository()
protected java.lang.Integer getRootKey()
protected void warning(java.lang.String msg)
msg
- The warning message.protected void saveNewEntriesIndex()
protected void loadNewEntriesIndex()
public static void updateEntriesIndex(java.io.File oldIndexFile, java.io.File newIndexFile, Serializer serializer) throws java.io.IOException
the
- index file (serialized hashtable of StoreEntry)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.protected boolean used(java.lang.String rep)
public void salvage()
public void displayIndex()
public ResourceStoreState salvageState()
public ResourceReference loadRootResource(java.lang.String identifier, java.util.Hashtable defs)
identifier
- The identifier of the resource to restore.defs
- Default attribute values.public ResourceReference lookupResource(SpaceEntry sentry, java.lang.String identifier)
sentry
- The resource space entry.identifier
- The resource identifier.public ResourceReference loadResource(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 ResourceReference addResource(SpaceEntry sentry, Resource resource, java.util.Hashtable defs)
sentry
- The resource space entry.resource
- The resource to add.defs
- Default attribute values.public void saveResource(SpaceEntry sentry, Resource resource)
sentry
- The resource space entryresource
- The resource to save.public void markModified(SpaceEntry sentry, Resource resource)
sentry
- The resource space entry.resource
- The resource to mark as modified.public void renameResource(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(SpaceEntry sentry, Resource resource)
sentry
- The resource space entryresource
- The resource to delete.public void deleteChildren(SpaceEntry sentry)
sentry
- The resource space entrypublic void saveChildren(SpaceEntry sentry)
sentry
- The resource space entryprotected void checkMaxLoadedStore()
public void acquireChildren(SpaceEntry sentry, java.io.File repository, boolean transientFlag)
sentry
- The resource space entry.repository
- The file used to store children.public void acquireChildren(SpaceEntry sentry)
sentry
- The resource space entry.public java.lang.String getHTMLStatus()
public java.util.Enumeration enumerateResourceIdentifiers(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 |