Class FileSystemRepository
java.lang.Object
org.eclipse.dirigible.repository.fs.FileSystemRepository
- All Implemented Interfaces:
IRepository,IRepositoryExporter,IRepositoryImporter,IRepositoryReader,IRepositorySearch,IRepositoryWriter
- Direct Known Subclasses:
LocalRepository
public abstract class FileSystemRepository extends Object implements IRepository
The File System based implementation of
IRepository.-
Field Summary
Fields inherited from interface org.eclipse.dirigible.repository.api.IRepository
DIRIGIBLE_REPOSITORY_CACHE_ENABLED, DIRIGIBLE_REPOSITORY_CACHE_SIZE_LIMIT_IN_MEGABYTES, DIRIGIBLE_REPOSITORY_CACHE_TIME_LIMIT_IN_MINUTES, DIRIGIBLE_REPOSITORY_PROVIDER, DIRIGIBLE_REPOSITORY_PROVIDER_DATABASE, DIRIGIBLE_REPOSITORY_PROVIDER_LOCAL, SEPARATOR, UTF8 -
Constructor Summary
Constructors Constructor Description FileSystemRepository()Constructor with default root folder - user.dir and without database initializationFileSystemRepository(String rootFolder)Constructor with root folder parameter.FileSystemRepository(String rootFolder, boolean absolute)Constructor with root folder parameter. -
Method Summary
Modifier and Type Method Description ICollectioncreateCollection(String path)Creates the collection.protected voidcreateRepository(String rootFolder, boolean absolute)Creates the repository.IResourcecreateResource(String path)Creates the resource.IResourcecreateResource(String path, byte[] content)Creates the resource.IResourcecreateResource(String path, byte[] content, boolean isBinary, String contentType)Creates the resource.IResourcecreateResource(String path, byte[] content, boolean isBinary, String contentType, boolean override)Creates the resource.voiddeleteLinkedPath(String repositoryPath)Delete linked path.voiddispose()Dispose.byte[]exportZip(String relativeRoot, boolean inclusive)Export zip.byte[]exportZip(List<String> relativeRoots)Export zip.List<String>find(String path, String pattern)Find.List<String>getAllResourcePaths()Gets the all resource paths.ICollectiongetCollection(String path)Gets the collection.StringgetInternalResourcePath(String resourcePath)Gets the internal resource path.StringgetParameter(String key)Gets the parameter.LocalRepositoryDaogetRepositoryDao()Gets the repository dao.StringgetRepositoryPath()Gets the repository path.protected StringgetRepositoryRootFolder()Gets the repository root folder.IResourcegetResource(String path)Gets the resource.ICollectiongetRoot()Gets the root.booleanhasCollection(String path)Checks for collection.booleanhasResource(String path)Checks for resource.voidimportZip(byte[] data, String path)Import zip.voidimportZip(byte[] data, String path, boolean override)Import zip.voidimportZip(byte[] data, String relativeRoot, boolean override, boolean excludeRootFolderName, Map<String,String> filter)Import zip.voidimportZip(ZipInputStream zipInputStream, String path)Import zip.voidimportZip(ZipInputStream zipInputStream, String path, boolean override)Import zip.voidimportZip(ZipInputStream zipInputStream, String relativeRoot, boolean override, boolean excludeRootFolderName)Import zip.booleanisLinkedPath(String repositoryPath)Checks if is linked path.booleanisLinkingPathsSupported()Checks if is linking paths supported.voidlinkPath(String repositoryPath, String filePath)Link path.voidremoveCollection(String path)Removes the collection.voidremoveResource(String path)Removes the resource.List<IEntity>searchName(String parameter, boolean caseInsensitive)Search name.List<IEntity>searchName(String root, String parameter, boolean caseInsensitive)Search name.List<IEntity>searchPath(String parameter, boolean caseInsensitive)Search path.voidsearchRefresh()Search refresh.List<IEntity>searchText(String parameter)Search text.protected voidsetParameter(String key, String value)Sets the parameter.
-
Constructor Details
-
FileSystemRepository
Constructor with default root folder - user.dir and without database initialization- Throws:
LocalRepositoryException- in case the repository cannot be created
-
FileSystemRepository
Constructor with root folder parameter.- Parameters:
rootFolder- the root folder- Throws:
LocalRepositoryException- in case the repository cannot be created
-
FileSystemRepository
Constructor with root folder parameter.- Parameters:
rootFolder- the root folderabsolute- whether the root folder is absolute- Throws:
LocalRepositoryException- in case the repository cannot be created
-
-
Method Details
-
createRepository
Creates the repository.- Parameters:
rootFolder- the root folderabsolute- the absolute
-
getRepositoryPath
Gets the repository path.- Specified by:
getRepositoryPathin interfaceIRepository- Returns:
- the repository path
-
getRepositoryRootFolder
Gets the repository root folder.- Returns:
- the repository root folder
-
getRoot
Gets the root.- Specified by:
getRootin interfaceIRepositoryReader- Returns:
- the root
-
createCollection
Creates the collection.- Specified by:
createCollectionin interfaceIRepositoryWriter- Parameters:
path- the path- Returns:
- the i collection
- Throws:
RepositoryWriteException- the repository write exception
-
getCollection
Gets the collection.- Specified by:
getCollectionin interfaceIRepositoryReader- Parameters:
path- the path- Returns:
- the collection
-
removeCollection
Removes the collection.- Specified by:
removeCollectionin interfaceIRepositoryWriter- Parameters:
path- the path- Throws:
RepositoryWriteException- the repository write exception
-
hasCollection
Checks for collection.- Specified by:
hasCollectionin interfaceIRepositoryReader- Parameters:
path- the path- Returns:
- true, if successful
- Throws:
RepositoryReadException- the repository read exception
-
createResource
Creates the resource.- Specified by:
createResourcein interfaceIRepositoryWriter- Parameters:
path- the path- Returns:
- the i resource
- Throws:
RepositoryWriteException- the repository write exception
-
createResource
Creates the resource.- Specified by:
createResourcein interfaceIRepositoryWriter- Parameters:
path- the pathcontent- the content- Returns:
- the i resource
- Throws:
RepositoryWriteException- the repository write exception
-
createResource
public IResource createResource(String path, byte[] content, boolean isBinary, String contentType) throws RepositoryWriteExceptionCreates the resource.- Specified by:
createResourcein interfaceIRepositoryWriter- Parameters:
path- the pathcontent- the contentisBinary- the is binarycontentType- the content type- Returns:
- the i resource
- Throws:
RepositoryWriteException- the repository write exception
-
createResource
public IResource createResource(String path, byte[] content, boolean isBinary, String contentType, boolean override) throws RepositoryWriteExceptionCreates the resource.- Specified by:
createResourcein interfaceIRepositoryWriter- Parameters:
path- the pathcontent- the contentisBinary- the is binarycontentType- the content typeoverride- the override- Returns:
- the i resource
- Throws:
RepositoryWriteException- the repository write exception
-
getResource
Gets the resource.- Specified by:
getResourcein interfaceIRepositoryReader- Parameters:
path- the path- Returns:
- the resource
-
removeResource
Removes the resource.- Specified by:
removeResourcein interfaceIRepositoryWriter- Parameters:
path- the path- Throws:
RepositoryWriteException- the repository write exception
-
hasResource
Checks for resource.- Specified by:
hasResourcein interfaceIRepositoryReader- Parameters:
path- the path- Returns:
- true, if successful
- Throws:
RepositoryReadException- the repository read exception
-
dispose
public void dispose()Dispose.- Specified by:
disposein interfaceIRepositoryWriter
-
getRepositoryDao
Gets the repository dao.- Returns:
- the repository dao
-
importZip
Import zip.- Specified by:
importZipin interfaceIRepositoryImporter- Parameters:
zipInputStream- the zip input streampath- the path- Throws:
RepositoryImportException- the repository import exception
-
importZip
public void importZip(ZipInputStream zipInputStream, String path, boolean override) throws RepositoryImportExceptionImport zip.- Specified by:
importZipin interfaceIRepositoryImporter- Parameters:
zipInputStream- the zip input streampath- the pathoverride- the override- Throws:
RepositoryImportException- the repository import exception
-
importZip
public void importZip(ZipInputStream zipInputStream, String relativeRoot, boolean override, boolean excludeRootFolderName) throws RepositoryImportExceptionImport zip.- Specified by:
importZipin interfaceIRepositoryImporter- Parameters:
zipInputStream- the zip input streamrelativeRoot- the relative rootoverride- the overrideexcludeRootFolderName- the exclude root folder name- Throws:
RepositoryImportException- the repository import exception
-
importZip
Import zip.- Specified by:
importZipin interfaceIRepositoryImporter- Parameters:
data- the datapath- the path- Throws:
RepositoryImportException- the repository import exception
-
importZip
Import zip.- Specified by:
importZipin interfaceIRepositoryImporter- Parameters:
data- the datapath- the pathoverride- the override- Throws:
RepositoryImportException- the repository import exception
-
importZip
public void importZip(byte[] data, String relativeRoot, boolean override, boolean excludeRootFolderName, Map<String,String> filter) throws RepositoryImportExceptionImport zip.- Specified by:
importZipin interfaceIRepositoryImporter- Parameters:
data- the datarelativeRoot- the relative rootoverride- the overrideexcludeRootFolderName- the exclude root folder namefilter- the filter- Throws:
RepositoryImportException- the repository import exception
-
exportZip
Export zip.- Specified by:
exportZipin interfaceIRepositoryExporter- Parameters:
relativeRoots- the relative roots- Returns:
- the byte[]
- Throws:
RepositoryExportException- the repository export exception
-
exportZip
Export zip.- Specified by:
exportZipin interfaceIRepositoryExporter- Parameters:
relativeRoot- the relative rootinclusive- the inclusive- Returns:
- the byte[]
- Throws:
RepositoryExportException- the repository export exception
-
searchName
public List<IEntity> searchName(String parameter, boolean caseInsensitive) throws RepositorySearchExceptionSearch name.- Specified by:
searchNamein interfaceIRepositorySearch- Parameters:
parameter- the parametercaseInsensitive- the case insensitive- Returns:
- the list
- Throws:
RepositorySearchException- the repository search exception
-
searchName
public List<IEntity> searchName(String root, String parameter, boolean caseInsensitive) throws RepositorySearchExceptionSearch name.- Specified by:
searchNamein interfaceIRepositorySearch- Parameters:
root- the rootparameter- the parametercaseInsensitive- the case insensitive- Returns:
- the list
- Throws:
RepositorySearchException- the repository search exception
-
searchPath
public List<IEntity> searchPath(String parameter, boolean caseInsensitive) throws RepositorySearchExceptionSearch path.- Specified by:
searchPathin interfaceIRepositorySearch- Parameters:
parameter- the parametercaseInsensitive- the case insensitive- Returns:
- the list
- Throws:
RepositorySearchException- the repository search exception
-
searchText
Search text.- Specified by:
searchTextin interfaceIRepositorySearch- Parameters:
parameter- the parameter- Returns:
- the list
- Throws:
RepositorySearchException- the repository search exception
-
searchRefresh
Search refresh.- Specified by:
searchRefreshin interfaceIRepositorySearch- Throws:
RepositorySearchException- the repository search exception
-
getAllResourcePaths
Gets the all resource paths.- Specified by:
getAllResourcePathsin interfaceIRepositoryReader- Returns:
- the all resource paths
- Throws:
RepositoryReadException- the repository read exception
-
getParameter
Gets the parameter.- Specified by:
getParameterin interfaceIRepository- Parameters:
key- the key- Returns:
- the parameter
-
setParameter
Sets the parameter.- Parameters:
key- the keyvalue- the value
-
isLinkingPathsSupported
public boolean isLinkingPathsSupported()Checks if is linking paths supported.- Specified by:
isLinkingPathsSupportedin interfaceIRepositoryWriter- Returns:
- true, if is linking paths supported
-
linkPath
Link path.- Specified by:
linkPathin interfaceIRepositoryWriter- Parameters:
repositoryPath- the repository pathfilePath- the file path- Throws:
IOException- Signals that an I/O exception has occurred.
-
deleteLinkedPath
Delete linked path.- Specified by:
deleteLinkedPathin interfaceIRepositoryWriter- Parameters:
repositoryPath- the repository path- Throws:
IOException- Signals that an I/O exception has occurred.
-
isLinkedPath
Checks if is linked path.- Specified by:
isLinkedPathin interfaceIRepositoryWriter- Parameters:
repositoryPath- the repository path- Returns:
- true, if is linked path
-
find
Find.- Specified by:
findin interfaceIRepositorySearch- Parameters:
path- the pathpattern- the pattern- Returns:
- the list
- Throws:
RepositorySearchException- the repository search exception
-
getInternalResourcePath
Gets the internal resource path.- Specified by:
getInternalResourcePathin interfaceIRepository- Parameters:
resourcePath- the resource path- Returns:
- the internal resource path
-