|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.sconman.rep.FSBasicRepository
public class FSBasicRepository
File repository. This repository stores files in directories acording to year/month/day/copy.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface net.sourceforge.sconman.IRepository |
---|
IRepository.IVisitor |
Field Summary | |
---|---|
protected Category |
category
Category of the repository |
protected java.lang.String |
rootPath
FSBasicRepository root path |
Fields inherited from interface net.sourceforge.sconman.IRepository |
---|
STORE_OK |
Constructor Summary | |
---|---|
FSBasicRepository()
Default constructor |
|
FSBasicRepository(java.lang.String rootPath)
Constructor |
Method Summary | |
---|---|
java.lang.String |
add(java.lang.String baseDir,
java.lang.String filePath)
Given a filename, return a valid path to store it calling getOutputStream(java.lang.String) |
java.lang.String |
addNonamed(java.lang.String baseDir,
java.lang.String fileExtension)
Given a file extension, return a valid path to store it calling getOutputStream(java.lang.String) |
void |
deserializeXML(org.kxml2.io.KXmlParser in)
Deserialize from XML |
boolean |
exists(java.lang.String path)
Checks if 'path' points to a valid entry |
Category |
getCategory()
Gets the category of the repository |
protected java.io.File |
getFile(java.lang.String uri)
Retrieves a file from the repository |
java.io.InputStream |
getInputStream(java.lang.String path)
Returns an input channel to read contents |
java.util.Date |
getLastModified(java.lang.String path)
Returns the last lastAccessed time for the pointed entry |
java.io.OutputStream |
getOutputStream(java.lang.String path)
Returns an output channel to store contents |
java.lang.String |
getRootPath()
|
void |
initialize()
Initialize the repository |
void |
remove(java.lang.String path)
Removes the stored file, given its path |
void |
serializeXML(org.kxml2.io.KXmlSerializer out)
Serialize to XML |
void |
setCategory(Category category)
Sets the category to the repository |
protected void |
setRootPath(java.lang.String rootPath)
|
long |
size(java.lang.String path)
Gets the size of the file |
int |
store(java.io.InputStream is,
java.lang.String path)
Store an InputStream in the repository |
void |
visit(java.lang.String relativePath,
IRepository.IVisitor visitor)
Explores the filesystem from relative path to the repository root path |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.String rootPath
protected Category category
Constructor Detail |
---|
public FSBasicRepository()
public FSBasicRepository(java.lang.String rootPath)
rootPath
- Method Detail |
---|
public java.lang.String getRootPath()
protected void setRootPath(java.lang.String rootPath)
rootPath
- public boolean exists(java.lang.String path)
IRepository
exists
in interface IRepository
path
- The path to check
public java.io.OutputStream getOutputStream(java.lang.String path) throws java.io.IOException
getOutputStream
in interface IRepository
path
- The path to the file
java.io.IOException
public java.io.InputStream getInputStream(java.lang.String path) throws java.io.IOException
getInputStream
in interface IRepository
path
- The path to the file
java.io.IOException
public void remove(java.lang.String path) throws java.io.IOException
remove
in interface IRepository
path
-
java.io.IOException
public java.lang.String add(java.lang.String baseDir, java.lang.String filePath) throws java.io.IOException
getOutputStream(java.lang.String)
add
in interface IRepository
filePath
- The file id
java.io.IOException
public java.lang.String addNonamed(java.lang.String baseDir, java.lang.String fileExtension) throws java.io.IOException
getOutputStream(java.lang.String)
addNonamed
in interface IRepository
fileExtension
- The file extension
java.io.IOException
protected java.io.File getFile(java.lang.String uri)
uri
- Path relative to the root
public void visit(java.lang.String relativePath, IRepository.IVisitor visitor)
visit
in interface IRepository
relativePath
- The root path where the visits should begin atvisitor
- The visitor that will traverse the repositorypublic java.util.Date getLastModified(java.lang.String path)
IRepository
getLastModified
in interface IRepository
path
- The path to the entry
public int store(java.io.InputStream is, java.lang.String path) throws java.io.IOException
IRepository
store
in interface IRepository
is
- The InputStreampath
- The path to the file
java.io.IOException
public void initialize() throws java.io.IOException
IRepository
initialize
in interface IRepository
java.io.IOException
public long size(java.lang.String path)
IRepository
size
in interface IRepository
path
- The path to the file
public void serializeXML(org.kxml2.io.KXmlSerializer out) throws java.io.IOException
IXMLSerializable
serializeXML
in interface IXMLSerializable
out
- The KXmlSerializer to do the output
java.io.IOException
- Thrown if there's an IO problempublic void deserializeXML(org.kxml2.io.KXmlParser in) throws org.xmlpull.v1.XmlPullParserException, java.io.IOException
IXMLSerializable
deserializeXML
in interface IXMLSerializable
in
- The KXml pull parser
org.xmlpull.v1.XmlPullParserException
- Thrown if there's an XML problem
java.io.IOException
- Thrown if there's an IO problempublic void setCategory(Category category)
IRepository
setCategory
in interface IRepository
category
- The categorypublic Category getCategory()
IRepository
getCategory
in interface IRepository
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |