|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--org.w3c.tools.resources.store.SimpleResourceStore
A very naive resource store. This resource store keeps all the resources in a file. It loads all resources (on a per-demand basis), and never unloads them.
| Field Summary | |
protected ResourceStoreManager |
manager
Our resource store manager. |
| Constructor Summary | |
SimpleResourceStore()
|
|
| Method Summary | |
boolean |
acceptUnload()
Can the resource store manager unload that store from memory. |
void |
addResource(org.w3c.tools.resources.Resource resource)
Add a new resource to the resource store. |
java.util.Enumeration |
enumerateResourceIdentifiers()
Enumerate all the resources identifier in this repository. |
protected java.io.RandomAccessFile |
getFileAt(int pos)
Get our file, positionned at the given position. |
java.lang.String |
getIdentifier()
Get the identifier for that store. |
protected byte[] |
getResourceBytes(org.w3c.tools.resources.store.ResourceIndex index,
byte[] into)
Get the bytes that are the pickled version of the given resource. |
int |
getVersion()
Get the store format version number. |
boolean |
hasResource(java.lang.String identifier)
Does this store defines this resource. |
void |
initialize(ResourceStoreManager manager,
java.lang.Object token,
java.io.File repository)
Initialize this simple store with the given file. |
protected void |
internalSave(boolean unload)
Internal save: save the repository back to disk. |
protected void |
loadIndex(java.util.Hashtable target)
Restore our whole index from our repository. |
org.w3c.tools.resources.Resource |
loadResource(java.lang.String identifier,
java.util.Hashtable defs)
Load a resource, or get one from the cache. |
org.w3c.tools.resources.Resource |
lookupResource(java.lang.String identifier)
Lookup this resource. |
static void |
main(java.lang.String[] args)
|
void |
markModified(org.w3c.tools.resources.Resource resource)
Mark the given resource as being modified. |
protected void |
markUsed()
Mark the store as having been used recently. |
protected int |
pickleResource(org.w3c.tools.resources.Resource resource,
java.io.DataOutputStream out)
Pickle the given resource into the given output stream. |
protected void |
printIndex()
Debug - print this resource store index. |
void |
removeResource(java.lang.String identifier)
Remove a resource from this resource store. |
void |
renameResource(java.lang.String oldid,
java.lang.String newid)
Rename a resource in the store. |
void |
save()
Save all our modified resources back to our file. |
void |
saveResource(org.w3c.tools.resources.Resource resource)
Save a given resource. |
void |
shutdown()
Shutdown this store. |
java.lang.String |
toString()
Print a simple resource store. |
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,
wait,
wait,
wait |
| Field Detail |
protected ResourceStoreManager manager
| Constructor Detail |
public SimpleResourceStore()
| Method Detail |
protected final void markUsed()
public java.lang.String getIdentifier()
protected void warning(java.lang.String msg)
msg - The warning message.
protected java.io.RandomAccessFile getFileAt(int pos)
throws java.io.IOException
at - The position at wich you want the stream.
protected void loadIndex(java.util.Hashtable target)
throws java.io.IOException
protected void printIndex()
protected byte[] getResourceBytes(org.w3c.tools.resources.store.ResourceIndex index,
byte[] into)
throws java.io.IOException
identifier - The resource identifier.
protected int pickleResource(org.w3c.tools.resources.Resource resource,
java.io.DataOutputStream out)
throws java.io.IOException
resource - The resource to pickle.out - The data output stream to pickle to.public int getVersion()
public org.w3c.tools.resources.Resource loadResource(java.lang.String identifier,
java.util.Hashtable defs)
throws org.w3c.tools.resources.InvalidResourceException
identifier - The resource identifier.
protected void internalSave(boolean unload)
throws java.io.IOException
unload - Should we unload any existing resources ?public org.w3c.tools.resources.Resource lookupResource(java.lang.String identifier)
identifier - The resource identifier.public void saveResource(org.w3c.tools.resources.Resource resource)
resource - The resource to be save right now.public void addResource(org.w3c.tools.resources.Resource resource)
resource - The resource to add.public void removeResource(java.lang.String identifier)
identifier - The identifier of the resource to be removed.
public void renameResource(java.lang.String oldid,
java.lang.String newid)
oldid - The old resource identifier.newid - The new resource identifier.public void markModified(org.w3c.tools.resources.Resource resource)
identifier - The identifier of the modified resource.public boolean acceptUnload()
public void shutdown()
public void save()
public java.util.Enumeration enumerateResourceIdentifiers()
public boolean hasResource(java.lang.String identifier)
identifier - The resource we are looking for.public java.lang.String toString()
public void initialize(ResourceStoreManager manager,
java.lang.Object token,
java.io.File repository)
manager - The resource store manager that loaded use.token - Our identification token from the above resource store
manager (this is an opaque object).file - The repository file.
public static void main(java.lang.String[] args)
throws java.lang.Exception
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||