|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.ow2.weblab.repository.file.FileRepository
public class FileRepository
Simple implementation of a file repository Save each resource to a File.
| Field Summary | |
|---|---|
protected java.io.File |
currentFolder
|
protected int |
filePerFolder
|
protected java.lang.String |
filePrefix
|
protected org.apache.commons.logging.Log |
log
|
protected java.io.File |
pathToFS
|
protected java.lang.String |
repositoryID
|
protected org.ow2.weblab.core.extended.jaxb.WebLabMarshaller |
wlm
|
| Constructor Summary | |
|---|---|
FileRepository(java.lang.String pathToTheRepository,
int filePerFolder,
java.lang.String repositoryID,
java.lang.String filePrefix)
|
|
| Method Summary | |
|---|---|
protected org.ow2.weblab.core.model.Resource |
changeUri(org.ow2.weblab.core.model.Resource res)
Check if the resource is already present if not create a unique wlri and change it in the resource |
protected void |
createNewSubFolder()
Generates a new and unique folder value. |
org.ow2.weblab.core.model.Resource |
getResource(java.lang.String uri)
|
protected org.ow2.weblab.core.model.Resource |
getResourceInside(org.ow2.weblab.core.model.Resource res,
java.lang.String uri)
Recursive route which return resource corresponding to the uri |
protected org.ow2.weblab.core.model.Resource |
getResourceInside(org.ow2.weblab.core.model.Resource res,
java.lang.String uri,
org.ow2.weblab.core.model.Resource newRes)
recursive route which replace newRes in res |
protected org.ow2.weblab.core.model.Resource |
getResourceInside(org.ow2.weblab.core.model.Resource res,
java.lang.String uri,
org.ow2.weblab.core.model.Resource newRes,
org.ow2.weblab.core.model.Resource father)
|
protected java.lang.String |
getUniqueResource()
Use it to get an unique resource identifier |
protected java.io.File |
initPathToFS(java.lang.String pathToTheRepository)
|
protected org.ow2.weblab.core.model.Resource |
loadFile(java.lang.String fileName)
Load the resource corresponding to the file name |
protected void |
replaceResource(org.ow2.weblab.core.model.Resource father,
org.ow2.weblab.core.model.Resource oldRes,
org.ow2.weblab.core.model.Resource newRes)
|
protected org.ow2.weblab.core.model.Resource |
replaceUri(org.ow2.weblab.core.model.Resource res,
java.lang.String uri)
Replace the old uri with the new one on a resource |
java.lang.String |
saveResource(org.ow2.weblab.core.model.Resource resource)
|
protected void |
setCurrentFolder(java.io.File currentFolder)
|
protected void |
writeFile(RepoRI wlRi,
org.ow2.weblab.core.model.Resource res)
Write the resource to the file corresponding to the wlRi |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final java.io.File pathToFS
protected final java.lang.String filePrefix
protected final java.lang.String repositoryID
protected final int filePerFolder
protected final org.apache.commons.logging.Log log
protected java.io.File currentFolder
protected final org.ow2.weblab.core.extended.jaxb.WebLabMarshaller wlm
| Constructor Detail |
|---|
public FileRepository(java.lang.String pathToTheRepository,
int filePerFolder,
java.lang.String repositoryID,
java.lang.String filePrefix)
throws java.io.IOException
java.io.IOException| Method Detail |
|---|
public org.ow2.weblab.core.model.Resource getResource(java.lang.String uri)
throws org.ow2.weblab.core.extended.exception.WebLabCheckedException,
java.io.FileNotFoundException
uri - The URI of the resource to retrieve
org.ow2.weblab.core.extended.exception.WebLabCheckedException - If the resource is not found
java.io.FileNotFoundException
public java.lang.String saveResource(org.ow2.weblab.core.model.Resource resource)
throws org.ow2.weblab.core.extended.exception.WebLabCheckedException
resource - The resource to save
org.ow2.weblab.core.extended.exception.WebLabCheckedException
protected org.ow2.weblab.core.model.Resource getResourceInside(org.ow2.weblab.core.model.Resource res,
java.lang.String uri)
throws org.ow2.weblab.core.extended.exception.WebLabCheckedException
res - main resourceuri - uri to find
org.ow2.weblab.core.extended.exception.WebLabCheckedException
protected org.ow2.weblab.core.model.Resource getResourceInside(org.ow2.weblab.core.model.Resource res,
java.lang.String uri,
org.ow2.weblab.core.model.Resource newRes)
throws org.ow2.weblab.core.extended.exception.WebLabCheckedException
res - main resourceuri - uri to find (the same as in newRes)newRes - new resource which going to replace the funded one
org.ow2.weblab.core.extended.exception.WebLabCheckedException
protected org.ow2.weblab.core.model.Resource getResourceInside(org.ow2.weblab.core.model.Resource res,
java.lang.String uri,
org.ow2.weblab.core.model.Resource newRes,
org.ow2.weblab.core.model.Resource father)
throws org.ow2.weblab.core.extended.exception.WebLabCheckedException
org.ow2.weblab.core.extended.exception.WebLabCheckedException
protected void replaceResource(org.ow2.weblab.core.model.Resource father,
org.ow2.weblab.core.model.Resource oldRes,
org.ow2.weblab.core.model.Resource newRes)
throws org.ow2.weblab.core.extended.exception.WebLabCheckedException
org.ow2.weblab.core.extended.exception.WebLabCheckedException
protected org.ow2.weblab.core.model.Resource loadFile(java.lang.String fileName)
throws org.ow2.weblab.core.extended.exception.WebLabCheckedException,
java.io.FileNotFoundException
fileName -
org.ow2.weblab.core.extended.exception.WebLabCheckedException
java.io.FileNotFoundException
protected org.ow2.weblab.core.model.Resource changeUri(org.ow2.weblab.core.model.Resource res)
throws org.ow2.weblab.core.extended.exception.WebLabCheckedException
res - resource
org.ow2.weblab.core.extended.exception.WebLabCheckedExceptionprotected java.lang.String getUniqueResource()
protected org.ow2.weblab.core.model.Resource replaceUri(org.ow2.weblab.core.model.Resource res,
java.lang.String uri)
throws org.ow2.weblab.core.extended.exception.WebLabCheckedException
res - the resource to be changednewUri - the new uri
org.ow2.weblab.core.extended.exception.WebLabCheckedException
protected void writeFile(RepoRI wlRi,
org.ow2.weblab.core.model.Resource res)
throws java.io.FileNotFoundException,
org.ow2.weblab.core.extended.exception.WebLabCheckedException
wlRi - resource rires - resource to write
java.io.FileNotFoundException
org.ow2.weblab.core.extended.exception.WebLabCheckedException
protected java.io.File initPathToFS(java.lang.String pathToTheRepository)
throws java.io.IOException
pathToTheRepository - The path to the root folder of the repository
java.io.IOException - If the folder cannot be createdprotected void createNewSubFolder()
protected void setCurrentFolder(java.io.File currentFolder)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||