@ApplicationScoped public class VFSRepository extends Object implements Repository
| Constructor and Description |
|---|
VFSRepository() |
VFSRepository(org.uberfire.io.IOService ioService) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
assetExists(String assetUniqueId)
Examines repository if asset given by the
assetUniqueId exists |
protected Asset |
buildAsset(org.uberfire.java.nio.file.Path file,
boolean loadContent) |
boolean |
copyAsset(String uniqueId,
String location)
Copy asset given by
uniqueId into destination given by location |
boolean |
copyDirectory(String sourceDirectory,
String location)
Copy directory given by
uniqueId into destination given by location |
String |
createAsset(Asset asset)
Stores given asset in the repository.
|
Directory |
createDirectory(String location)
Stores new directory in given location, in case of sub folders existence in the location
all sub folders are created as well.
|
void |
createGlobalDirOnNewProject(org.guvnor.common.services.project.events.NewProjectEvent newProjectEvent) |
boolean |
deleteAsset(String assetUniqueId)
Deletes asset from repository identified by
assetUniqueId if exists |
boolean |
deleteAssetFromPath(String path)
Deletes asset from repository given by the
path if exists |
boolean |
deleteDirectory(String directory,
boolean failIfNotEmpty)
Deletes directory from repository including its content
NOTE: Directory should be always relative to the repository root
|
boolean |
directoryExists(String directory)
Examines repository if given directory exists in the repository
NOTE: Directory should be always relative to the repository root
|
RepositoryDescriptor |
getDescriptor() |
String |
getName()
Returns name used to identify this repository.
|
Collection<Asset> |
listAssets(String location)
Retrieves all assets stored in the given location.
|
Collection<Asset> |
listAssets(String location,
Filter filter)
Retrieves all assets stored in the given location.
|
Collection<Asset> |
listAssetsRecursively(String startAt,
Filter filter)
Retrieves all directories stored under
startAt location including all sub folders. |
Collection<Directory> |
listDirectories(String startAt)
Retrieves all directories stored under
startAt location. |
Asset |
loadAsset(String assetUniqueId)
Loads an asset given by the
assetUniqueId including actual content of the asset. |
Asset |
loadAssetFromPath(String location)
Loads an asset given by the
path including actual content of the asset. |
boolean |
moveAsset(String uniqueId,
String location,
String name)
Moves asset given by
uniqueId into destination given by location
and renames it with given name |
boolean |
moveDirectory(String sourceDirectory,
String location,
String name)
Moves directory given by
uniqueId into destination given by location
and renames it with given name |
void |
setDescriptor(RepositoryDescriptor descriptor) |
void |
setServletRequest(javax.servlet.http.HttpServletRequest servletRequest) |
String |
updateAsset(Asset asset,
String commitMessage,
String sessionId)
Updates content of the asset
|
protected void |
writeToGlobalDir(String designerContext,
String globalDirPath,
String separator,
List<String> fileNames) |
public VFSRepository()
@Inject
public VFSRepository(@Named(value="ioStrategy")
org.uberfire.io.IOService ioService)
public RepositoryDescriptor getDescriptor()
public void setDescriptor(RepositoryDescriptor descriptor)
public String getName()
RepositorygetName in interface Repositorypublic Collection<Directory> listDirectories(String startAt)
RepositorystartAt location.
NOTE: Directory should be always relative to the repository rootlistDirectories in interface RepositorystartAt - - location where directories should be fetched frompublic Collection<Asset> listAssetsRecursively(String startAt, Filter filter)
RepositorystartAt location including all sub folders.
NOTE: Directory should be always relative to the repository rootlistAssetsRecursively in interface RepositorystartAt - - location where directories should be fetched fromfilter - - filter that allows to narrow the resultspublic Directory createDirectory(String location)
RepositorycreateDirectory in interface Repositorylocation - - location in the repository to be createdpublic boolean directoryExists(String directory)
RepositorydirectoryExists in interface Repositorydirectory - - directory to checkpublic boolean deleteDirectory(String directory, boolean failIfNotEmpty)
RepositorydeleteDirectory in interface Repositorydirectory - - directory to be deletedfailIfNotEmpty - - indicates if delete operation should fail in case given directory is not emptypublic boolean copyDirectory(String sourceDirectory, String location)
RepositoryuniqueId into destination given by locationcopyDirectory in interface RepositorysourceDirectory - - source directory path relative to repository rootlocation - - destination where directory will be copied topublic boolean moveDirectory(String sourceDirectory, String location, String name)
RepositoryuniqueId into destination given by location
and renames it with given namemoveDirectory in interface RepositorysourceDirectory - - source directory path relative to repository rootlocation - - final destination where directory should be moved toname - - name of the directory after move, if null is given name is not changedpublic Collection<Asset> listAssets(String location)
RepositorylistAssets in interface Repositorylocation - - location that assets should be collected frompublic Collection<Asset> listAssets(String location, Filter filter)
RepositorylistAssets in interface Repositorylocation - - location that assets should be collected fromfilter - - allows to defined filter criteria to fetch only assets of interestpublic Asset loadAsset(String assetUniqueId) throws org.uberfire.java.nio.file.NoSuchFileException
RepositoryassetUniqueId including actual content of the asset.loadAsset in interface RepositoryassetUniqueId - - unique identifier of the asset to loadorg.uberfire.java.nio.file.NoSuchFileException - - throws in case of asset given by id does not existpublic Asset loadAssetFromPath(String location) throws org.uberfire.java.nio.file.NoSuchFileException
Repositorypath including actual content of the asset.loadAssetFromPath in interface Repositorylocation - - complete path of the asset to load (relative to the repository root)org.uberfire.java.nio.file.NoSuchFileException - - throws in case of asset given by id does not existpublic String createAsset(Asset asset)
Repositoryasset need to have all meta data and content available
for the operation to successfully complete.createAsset in interface Repositoryasset - - asset to be storedpublic String updateAsset(Asset asset, String commitMessage, String sessionId) throws org.uberfire.java.nio.file.NoSuchFileException
RepositoryupdateAsset in interface Repositoryasset - - asset to be stored with new content in it, all other data (like name, location) should be sameorg.uberfire.java.nio.file.NoSuchFileException - - throws in case of asset given by id does not existpublic boolean deleteAsset(String assetUniqueId)
RepositoryassetUniqueId if existsdeleteAsset in interface RepositoryassetUniqueId - - unique identifier of the assetpublic boolean deleteAssetFromPath(String path)
Repositorypath if existsdeleteAssetFromPath in interface Repositorypath - - complete path of the asset to deletepublic boolean assetExists(String assetUniqueId)
RepositoryassetUniqueId existsassetExists in interface RepositoryassetUniqueId - - unique identifier of the assetpublic boolean copyAsset(String uniqueId, String location)
RepositoryuniqueId into destination given by locationcopyAsset in interface RepositoryuniqueId - - source asset unique idlocation - - destination where asset will be copied topublic boolean moveAsset(String uniqueId, String location, String name)
RepositoryuniqueId into destination given by location
and renames it with given namemoveAsset in interface RepositoryuniqueId - - source asset unique idlocation - - final destination where asset should be moved toname - - name of the asset after move, if null is given name is not changedprotected Asset buildAsset(org.uberfire.java.nio.file.Path file, boolean loadContent)
public void createGlobalDirOnNewProject(@Observes
org.guvnor.common.services.project.events.NewProjectEvent newProjectEvent)
protected void writeToGlobalDir(String designerContext, String globalDirPath, String separator, List<String> fileNames) throws Exception
Exceptionpublic void setServletRequest(javax.servlet.http.HttpServletRequest servletRequest)
Copyright © 2001–2018 JBoss by Red Hat. All rights reserved.