public interface FilesService
Modifier and Type | Method and Description |
---|---|
Topic |
createFile(InputStream in,
String repoPath)
Creates a file in the file repository and a corresponding File topic.
|
void |
createFolder(String folderName,
String repoPath)
Creates a folder in the file repository.
|
boolean |
fileExists(String repoPath)
Checks if a file/directory with the given repository path exists in the file repository.
|
Topic |
getChildFileTopic(long folderTopicId,
String repoPath)
Returns the File topic representing the file at a given repository path.
|
Topic |
getChildFolderTopic(long folderTopicId,
String repoPath)
Returns the Folder topic representing the folder at a given repository path.
|
DirectoryListing |
getDirectoryListing(String repoPath) |
File |
getFile(long fileTopicId)
Convenience method to access the file/directory in the file repository that is represented by the given
File/Folder topic.
|
File |
getFile(String repoPath)
Accesses a file/directory in the file repository by the given repository path.
|
Topic |
getFileTopic(String repoPath)
Returns the File topic representing the file at a given repository path.
|
Topic |
getFolderTopic(String repoPath)
Returns the Folder topic representing the folder at a given repository path.
|
String |
getRepositoryPath(URL url)
Checks if the given URL refers to the file repository of this DMX installation.
|
ResourceInfo |
getResourceInfo(String repoPath) |
int |
openFile(long fileTopicId) |
String |
pathPrefix()
Returns a prefix that can be used for constructing a repository path.
|
String |
pathPrefix(long workspaceId)
Returns a prefix that can be used for constructing a repository path.
|
StoredFile |
storeFile(UploadedFile file,
String repoPath)
Receives an uploaded file, stores it in the file repository, and creates a corresponding File topic.
|
Topic getFileTopic(String repoPath)
repoPath
- A repository path. Relative to the repository base path.
Must begin with slash, no slash at the end.
If per-workspace file repos are active (dmx.filerepo.per_workspace=true
)
the repository path must contain the workspace prefix as the first path segment,
e.g. "/workspace-1234"
where 1234
is the workspace ID.
However there is one exception to that rule: if and only if "/"
is passed
as the repository path the workspace prefix is determined automatically with the
semantics of current workspace, based on the request's workspace cookie.
For support with constructing a repository path see the pathPrefix
methods.
Topic getFolderTopic(String repoPath)
repoPath
- A repository path. Relative to the repository base path.
Must begin with slash, no slash at the end.
If per-workspace file repos are active (dmx.filerepo.per_workspace=true
)
the repository path must contain the workspace prefix as the first path segment,
e.g. "/workspace-1234"
where 1234
is the workspace ID.
However there is one exception to that rule: if and only if "/"
is passed
as the repository path the workspace prefix is determined automatically with the
semantics of current workspace, based on the request's workspace cookie.
For support with constructing a repository path see the pathPrefix
methods.
Topic getChildFileTopic(long folderTopicId, String repoPath)
Creates an association (type "Aggregation") between the File topic (role type "Child") and its parent Folder topic (role type "Parent"), if not exists already.
repoPath
- A repository path. Relative to the repository base path.
Must begin with slash, no slash at the end.
If per-workspace file repos are active (dmx.filerepo.per_workspace=true
)
the repository path must contain the workspace prefix as the first path segment,
e.g. "/workspace-1234"
where 1234
is the workspace ID.
However there is one exception to that rule: if and only if "/"
is passed
as the repository path the workspace prefix is determined automatically with the
semantics of current workspace, based on the request's workspace cookie.
For support with constructing a repository path see the pathPrefix
methods.
folderTopicId
- ID of the parent Folder topic.Topic getChildFolderTopic(long folderTopicId, String repoPath)
Creates an association (type "Aggregation") between the Folder topic (role type "Child") and its parent Folder topic (role type "Parent"), if not exists already.
repoPath
- A repository path. Relative to the repository base path.
Must begin with slash, no slash at the end.
If per-workspace file repos are active (dmx.filerepo.per_workspace=true
)
the repository path must contain the workspace prefix as the first path segment,
e.g. "/workspace-1234"
where 1234
is the workspace ID.
However there is one exception to that rule: if and only if "/"
is passed
as the repository path the workspace prefix is determined automatically with the
semantics of current workspace, based on the request's workspace cookie.
For support with constructing a repository path see the pathPrefix
methods.
folderTopicId
- ID of the parent Folder topic.StoredFile storeFile(UploadedFile file, String repoPath)
repoPath
- The directory where to store the uploaded file.
The directory must exist.
A repository path. Relative to the repository base path. Must begin with slash, no slash at the end.
If per-workspace file repos are active (dmx.filerepo.per_workspace=true
)
the repository path must contain the workspace prefix as the first path segment,
e.g. "/workspace-1234"
where 1234
is the workspace ID.
However there is one exception to that rule: if and only if "/"
is passed
as the repository path the workspace prefix is determined automatically with the
semantics of current workspace, based on the request's workspace cookie.
For support with constructing a repository path see the pathPrefix
methods.
Topic createFile(InputStream in, String repoPath)
in
- The input stream the file content is read from.repoPath
- The path and filename of the file to be created.
If that file exists already it is overwritten. ### TODO: rethink overwriting
A repository path. Relative to the repository base path. Must begin with slash, no slash at the end.
If per-workspace file repos are active (dmx.filerepo.per_workspace=true
)
the repository path must contain the workspace prefix as the first path segment,
e.g. "/workspace-1234"
where 1234
is the workspace ID.
However there is one exception to that rule: if and only if "/"
is passed
as the repository path the workspace prefix is determined automatically with the
semantics of current workspace, based on the request's workspace cookie.
For support with constructing a repository path see the pathPrefix
methods.
void createFolder(String folderName, String repoPath)
repoPath
- The directory where to create the folder.
A repository path. Relative to the repository base path. Must begin with slash, no slash at the end.
If per-workspace file repos are active (dmx.filerepo.per_workspace=true
)
the repository path must contain the workspace prefix as the first path segment,
e.g. "/workspace-1234"
where 1234
is the workspace ID.
However there is one exception to that rule: if and only if "/"
is passed
as the repository path the workspace prefix is determined automatically with the
semantics of current workspace, based on the request's workspace cookie.
For support with constructing a repository path see the pathPrefix
methods.
ResourceInfo getResourceInfo(String repoPath)
DirectoryListing getDirectoryListing(String repoPath)
String getRepositoryPath(URL url)
null
if the URL
does not refer to the file repository of this DMX installation.File getFile(String repoPath)
Note: this method does not require the corresponding File/Folder topic to exist.
repoPath
- A repository path. Relative to the repository base path.
Must begin with slash, no slash at the end.
If per-workspace file repos are active (dmx.filerepo.per_workspace=true
)
the repository path must contain the workspace prefix as the first path segment,
e.g. "/workspace-1234"
where 1234
is the workspace ID.
However there is one exception to that rule: if and only if "/"
is passed
as the repository path the workspace prefix is determined automatically with the
semantics of current workspace, based on the request's workspace cookie.
For support with constructing a repository path see the pathPrefix
methods.
FileRepositoryException
- with status code 404 if no such file/directory exists in the file repository.File getFile(long fileTopicId)
fileTopicId
- ID of a File/Folder topic.boolean fileExists(String repoPath)
repoPath
- A repository path. Relative to the repository base path.
Must begin with slash, no slash at the end.
If per-workspace file repos are active (dmx.filerepo.per_workspace=true
)
the repository path must contain the workspace prefix as the first path segment,
e.g. "/workspace-1234"
where 1234
is the workspace ID.
However there is one exception to that rule: if and only if "/"
is passed
as the repository path the workspace prefix is determined automatically with the
semantics of current workspace, based on the request's workspace cookie.
For support with constructing a repository path see the pathPrefix
methods.
true
if the file exists, false
otherwise.String pathPrefix()
dmx.filerepo.per_workspace=true
) the prefix
represents the current workspace (e.g. "/workspace-1234"
), based on the workspace cookie.
In case of per-workspace file repos are not active an empty string is returned.String pathPrefix(long workspaceId)
dmx.filerepo.per_workspace=true
) the prefix
represents the given workspace (e.g. "/workspace-1234"
).
In case of per-workspace file repos are not active an empty string is returned.int openFile(long fileTopicId)
Copyright © 2018. All Rights Reserved.