public abstract class DBRepository extends Object implements Repository, Closeable, RRepositoryFactory
| Constructor and Description |
|---|
DBRepository() |
| Modifier and Type | Method and Description |
|---|---|
FileData |
check(String name)
Read a file descriptor by the given path name.
|
FileData |
checkHistory(String name,
String version)
Read a file descriptor by the given path name of the given version.
|
void |
close() |
FileData |
copy(String srcName,
FileData destData)
Copy a file to the destination file.
|
FileData |
copyHistory(String srcName,
FileData destData,
String version)
Copy a file of the given version to the destination file.
|
boolean |
delete(FileData path)
Delete a file or mark it as deleted.
|
boolean |
deleteHistory(String name,
String version)
Delete a file from the history.
|
protected abstract Connection |
getConnection() |
void |
initialize()
Initialize factory.
|
List<FileData> |
list(String path)
Return a list of files recursively in the given folder.
|
List<FileData> |
listHistory(String name)
List a versions of the given file.
|
FileItem |
read(String name)
Read a file by the given path name.
|
FileItem |
readHistory(String name,
String version)
Read a file by the given path name of the given version.
|
FileData |
rename(String path,
FileData destData)
Rename or move a file.
|
protected void |
safeClose(Connection connection) |
protected void |
safeClose(ResultSet rs) |
protected void |
safeClose(Statement st) |
FileData |
save(FileData data,
InputStream stream)
Save a file.
|
void |
setListener(Listener callback)
Set a listener to monitor changes in the repository.
|
public List<FileData> list(String path) throws IOException
Repositorylist in interface Repositorypath - the folder to scan. The path must be ended by '/' or be
empty.IOException - if not possible to read the directory.public FileData check(String name) throws IOException
Repositorycheck in interface Repositoryname - the path name of the file to read.IOException - if not possible to read the file descriptor.public FileItem read(String name) throws IOException
Repositoryread in interface Repositoryname - the path name of the file to read.IOException - if not possible to read the file.public FileData save(FileData data, InputStream stream) throws IOException
Repositorysave in interface Repositorydata - the file descriptor.stream - the stream to save with the specified file descriptor.IOException - if not possible to save the file.public boolean delete(FileData path)
Repositorydelete in interface Repositorypath - the file descriptor to delete.public FileData copy(String srcName, FileData destData) throws IOException
Repositorycopy in interface RepositorysrcName - the file to copy.destData - the destination file descriptor.IOException - if not possible to copy the filepublic FileData rename(String path, FileData destData) throws IOException
Repositoryrename in interface Repositorypath - the file to rename.destData - the destination file descriptor.IOException - if not possible to rename the filepublic void setListener(Listener callback)
RepositorysetListener in interface Repositorycallback - the listener.public List<FileData> listHistory(String name) throws IOException
RepositoryRepository.read(String) method.listHistory in interface Repositoryname - the file name.IOException - if not possible to read the directory.public FileData checkHistory(String name, String version) throws IOException
RepositoryRepository.check(String) method.checkHistory in interface Repositoryname - the path name of the file to read.version - the version of the file to read, can be null.IOException - if not possible to read the file descriptor.Repository.read(String)public FileItem readHistory(String name, String version) throws IOException
RepositoryRepository.read(String) method.readHistory in interface Repositoryname - the path name of the file to read.version - the version of the file to read, can be null.IOException - if not possible to read the file.Repository.read(String)public boolean deleteHistory(String name, String version)
RepositorydeleteHistory in interface Repositoryname - the file to delete.version - the version of the file to delete, can be null.Repository.delete(FileData)public FileData copyHistory(String srcName, FileData destData, String version) throws IOException
RepositoryRepository.copy(String, FileData) method.copyHistory in interface RepositorysrcName - the file to copy.destData - the destination file descriptor.version - the version of the file to copyIOException - if not possible to copy the fileRepository.copy(String, FileData)protected abstract Connection getConnection() throws SQLException
SQLExceptionprotected void safeClose(ResultSet rs)
protected void safeClose(Connection connection)
protected void safeClose(Statement st)
public void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableIOExceptionpublic void initialize()
RRepositoryFactoryinitialize in interface RRepositoryFactoryCopyright © 2018. All rights reserved.