|
||||||||||
| 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 static int |
DEFAULT_FILE_PER_FOLDER
|
protected static java.lang.String |
DEFAULT_FILE_PREFIX
|
protected static java.lang.String |
DEFAULT_REPO_ID
|
protected int |
filePerFolder
|
protected java.lang.String |
filePrefix
|
protected java.io.File |
pathToFS
|
protected java.lang.String |
repositoryID
|
protected org.weblab_project.core.jaxb.WebLabMarshaler |
wlm
|
| Constructor Summary | |
|---|---|
FileRepository()
|
|
| Method Summary | |
|---|---|
protected org.weblab_project.core.model.Resource |
changeUri(org.weblab_project.core.model.Resource res)
check if the resource is already present if not create a unique wlri and change it in the resource |
protected java.io.File |
createNewFolder()
Generates a new and unique folder value. |
java.io.File |
getCurrentFolder()
|
int |
getFilePerFolder()
|
java.lang.String |
getFilePrefix()
|
java.io.File |
getPathToFS()
|
java.lang.String |
getRepositoryID()
|
org.weblab_project.core.model.Resource |
getResource(java.lang.String uri)
|
protected org.weblab_project.core.model.Resource |
getResourceInside(org.weblab_project.core.model.Resource res,
java.lang.String uri)
recursive route which return resource corresponding to the uri |
protected org.weblab_project.core.model.Resource |
getResourceInside(org.weblab_project.core.model.Resource res,
java.lang.String uri,
org.weblab_project.core.model.Resource newRes)
recursive route which replace newRes in res |
protected org.weblab_project.core.model.Resource |
getResourceInside(org.weblab_project.core.model.Resource res,
java.lang.String uri,
org.weblab_project.core.model.Resource newRes,
org.weblab_project.core.model.Resource father)
|
protected java.lang.String |
getUniqueResource()
Use it to get an unique resource identifier |
protected org.weblab_project.core.model.Resource |
loadFile(java.lang.String fileName)
load the resource corresponding to the file name |
static FileRepository |
newInstance()
|
static FileRepository |
newInstance(java.net.URL fileUrl)
|
protected void |
replaceResource(org.weblab_project.core.model.Resource father,
org.weblab_project.core.model.Resource oldRes,
org.weblab_project.core.model.Resource newRes)
|
protected org.weblab_project.core.model.Resource |
replaceUri(org.weblab_project.core.model.Resource res,
java.lang.String uri)
Replace the old uri with the new one on a resource |
java.lang.String |
saveResource(org.weblab_project.core.model.Resource resource)
|
void |
setCurrentFolder(java.io.File currentFolder)
|
void |
setFilePerFolder(int filePerFolder)
|
void |
setFilePrefix(java.lang.String filePrefix)
|
void |
setPathToFS(java.io.File pathToFS)
Set the path to the folder file System Creates it if not exist |
void |
setPathToFS(java.lang.String pathToFS)
Set the path to the folder file System (calling setPathToFS(File)) Creates it if not exist |
void |
setRepositoryID(java.lang.String repositoryID)
|
protected void |
writeFile(RepoRI wlRi,
org.weblab_project.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 java.io.File pathToFS
protected static final java.lang.String DEFAULT_REPO_ID
protected java.lang.String repositoryID
protected static final java.lang.String DEFAULT_FILE_PREFIX
protected java.lang.String filePrefix
protected static final int DEFAULT_FILE_PER_FOLDER
protected int filePerFolder
protected java.io.File currentFolder
protected final org.weblab_project.core.jaxb.WebLabMarshaler wlm
| Constructor Detail |
|---|
public FileRepository()
| Method Detail |
|---|
public org.weblab_project.core.model.Resource getResource(java.lang.String uri)
throws org.weblab_project.core.exception.WebLabCheckedException
org.weblab_project.core.exception.WebLabCheckedException
public java.lang.String saveResource(org.weblab_project.core.model.Resource resource)
throws org.weblab_project.core.exception.WebLabCheckedException
org.weblab_project.core.exception.WebLabCheckedException
protected org.weblab_project.core.model.Resource getResourceInside(org.weblab_project.core.model.Resource res,
java.lang.String uri)
throws org.weblab_project.core.exception.WebLabCheckedException
res - main resourceuri - uri to find
org.weblab_project.core.exception.WebLabCheckedException
protected org.weblab_project.core.model.Resource getResourceInside(org.weblab_project.core.model.Resource res,
java.lang.String uri,
org.weblab_project.core.model.Resource newRes)
throws org.weblab_project.core.exception.WebLabCheckedException
res - main resourceuri - uri to find (the same as in newRes)newRes - new resource which going to replace the funded one
org.weblab_project.core.exception.WebLabCheckedException
protected org.weblab_project.core.model.Resource getResourceInside(org.weblab_project.core.model.Resource res,
java.lang.String uri,
org.weblab_project.core.model.Resource newRes,
org.weblab_project.core.model.Resource father)
throws org.weblab_project.core.exception.WebLabCheckedException
org.weblab_project.core.exception.WebLabCheckedException
protected void replaceResource(org.weblab_project.core.model.Resource father,
org.weblab_project.core.model.Resource oldRes,
org.weblab_project.core.model.Resource newRes)
throws org.weblab_project.core.exception.WebLabCheckedException
org.weblab_project.core.exception.WebLabCheckedException
protected org.weblab_project.core.model.Resource loadFile(java.lang.String fileName)
throws org.weblab_project.core.exception.WebLabCheckedException,
java.io.FileNotFoundException
fileName -
org.weblab_project.core.exception.WebLabCheckedException
java.io.FileNotFoundException
public void setPathToFS(java.io.File pathToFS)
throws org.weblab_project.core.exception.WebLabCheckedException
pathToFS - path to the folder file system
org.weblab_project.core.exception.WebLabCheckedException
protected org.weblab_project.core.model.Resource changeUri(org.weblab_project.core.model.Resource res)
throws org.weblab_project.core.exception.WebLabCheckedException
res - resource
org.weblab_project.core.exception.WebLabCheckedExceptionprotected java.lang.String getUniqueResource()
protected java.io.File createNewFolder()
protected org.weblab_project.core.model.Resource replaceUri(org.weblab_project.core.model.Resource res,
java.lang.String uri)
throws org.weblab_project.core.exception.WebLabCheckedException
res - the resource to be changednewUri - the new uri
org.weblab_project.core.exception.WebLabCheckedException
protected void writeFile(RepoRI wlRi,
org.weblab_project.core.model.Resource res)
throws java.io.FileNotFoundException,
org.weblab_project.core.exception.WebLabCheckedException
wlRi - resource rires - resource to write
java.io.FileNotFoundException
org.weblab_project.core.exception.WebLabCheckedException
public void setPathToFS(java.lang.String pathToFS)
throws org.weblab_project.core.exception.WebLabCheckedException
pathToFS - String containing the path to the folder file system
org.weblab_project.core.exception.WebLabCheckedExceptionpublic java.lang.String getRepositoryID()
public void setRepositoryID(java.lang.String repositoryID)
public java.lang.String getFilePrefix()
public void setFilePrefix(java.lang.String filePrefix)
public java.io.File getPathToFS()
public static FileRepository newInstance()
throws org.weblab_project.core.exception.WebLabCheckedException
org.weblab_project.core.exception.WebLabCheckedException
public static FileRepository newInstance(java.net.URL fileUrl)
throws org.weblab_project.core.exception.WebLabCheckedException
org.weblab_project.core.exception.WebLabCheckedExceptionpublic int getFilePerFolder()
public void setFilePerFolder(int filePerFolder)
public java.io.File getCurrentFolder()
public void setCurrentFolder(java.io.File currentFolder)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||