de.deepamehta.plugins.files
Interface FilesService

All Known Implementing Classes:
FilesPlugin

public interface FilesService


Method Summary
 de.deepamehta.core.Topic createFile(InputStream in, String path)
          Creates a file in the file repository, and creates a corresponding File topic.
 void createFolder(String folderName, String path)
          Creates a folder in the file repository.
 de.deepamehta.core.Topic getChildFileTopic(long folderTopicId, String path)
          Returns the File topic representing the file at a given repository path.
 de.deepamehta.core.Topic getChildFolderTopic(long folderTopicId, String path)
          Returns the Folder topic representing the folder at a given repository path.
 DirectoryListing getDirectoryListing(String path)
           
 File getFile(long fileTopicId)
          Accesses a file/directory in the file repository that is represented by the given File/Folder topic.
 File getFile(String path)
          Accesses a file/directory in the file repository by the given repository path.
 de.deepamehta.core.Topic getFileTopic(String path)
          Returns the File topic representing the file at a given repository path.
 de.deepamehta.core.Topic getFolderTopic(String path)
          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 DeepaMehta installation.
 ResourceInfo getResourceInfo(String path)
           
 void openFile(long fileTopicId)
           
 StoredFile storeFile(UploadedFile file, String path)
          Receives an uploaded file, stores it in the file repository, and creates a corresponding File topic.
 

Method Detail

getFileTopic

de.deepamehta.core.Topic getFileTopic(String path)
Returns the File topic representing the file at a given repository path. If no such File topic exists it is created.

Parameters:
path - A repository path. Relative to the repository base path. Must begin with slash, no slash at the end.
Returns:
The File topic. Its child topics ("File Name", "Path", "Media Type", "Size") are included.

getFolderTopic

de.deepamehta.core.Topic getFolderTopic(String path)
Returns the Folder topic representing the folder at a given repository path. If no such Folder topic exists it is created.

Parameters:
path - A repository path. Relative to the repository base path. Must begin with slash, no slash at the end.
Returns:
The Folder topic. Its child topics ("Folder Name", "Path") are included.

getChildFileTopic

de.deepamehta.core.Topic getChildFileTopic(long folderTopicId,
                                           String path)
Returns the File topic representing the file at a given repository path. If no such File topic exists it is created.

Creates an association (type "Aggregation") between the File topic (role type "Child") and its parent Folder topic (role type "Parent"), if not exists already.

Parameters:
path - A repository path. Relative to the repository base path. Must begin with slash, no slash at the end.
folderTopicId - ID of the parent Folder topic.
Returns:
The File topic. Its child topics ("File Name", "Path", "Media Type", "Size") are included.

getChildFolderTopic

de.deepamehta.core.Topic getChildFolderTopic(long folderTopicId,
                                             String path)
Returns the Folder topic representing the folder at a given repository path. If no such Folder topic exists it is created.

Creates an association (type "Aggregation") between the Folder topic (role type "Child") and its parent Folder topic (role type "Parent"), if not exists already.

Parameters:
path - A repository path. Relative to the repository base path. Must begin with slash, no slash at the end.
folderTopicId - ID of the parent Folder topic.
Returns:
The Folder topic. Its child topics ("Folder Name", "Path") are included.

storeFile

StoredFile storeFile(UploadedFile file,
                     String path)
Receives an uploaded file, stores it in the file repository, and creates a corresponding File topic.

Parameters:
path - The directory where to store the uploaded file. A repository path. Relative to the repository base path. Must begin with slash, no slash at the end. The directory must exist.
Returns:
a StoredFile object which holds 2 information: the name of the uploaded file, and the ID of the created File topic.

createFile

de.deepamehta.core.Topic createFile(InputStream in,
                                    String path)
Creates a file in the file repository, and creates a corresponding File topic.

Parameters:
in - The input stream the file content is read from.
path - The path and filename of the file to be created. A repository path. Relative to the repository base path. Must begin with slash, no slash at the end. If that file exists already it is overwritten. ### TODO: rethink overwriting
Returns:
the File topic that corresponds to the created file.

createFolder

void createFolder(String folderName,
                  String path)
Creates a folder in the file repository. Note: to corresponding Folder topic is created.

Parameters:
path - 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.

getResourceInfo

ResourceInfo getResourceInfo(String path)

getDirectoryListing

DirectoryListing getDirectoryListing(String path)

getRepositoryPath

String getRepositoryPath(URL url)
Checks if the given URL refers to the file repository of this DeepaMehta installation.

Returns:
the refered file's/directory's repository path, or null if the URL does not refer to the file repository of this DeepaMehta installation.

getFile

File getFile(String path)
Accesses a file/directory in the file repository by the given repository path. Note: this method doesn't require the corresponding File/Folder topic to exist.

Parameters:
path - A repository path. Relative to the repository base path. Must begin with slash, no slash at the end.

getFile

File getFile(long fileTopicId)
Accesses a file/directory in the file repository that is represented by the given File/Folder topic.


openFile

void openFile(long fileTopicId)


Copyright © 2015. All rights reserved.