de.deepamehta.plugins.files.service
Interface FilesService

Show UML class diagram
All Superinterfaces:
PluginService
All Known Implementing Classes:
FilesPlugin

public interface FilesService
extends PluginService


Method Summary
 Topic createChildFileTopic(long folderTopicId, String path)
           
 Topic createChildFolderTopic(long folderTopicId, String path)
           
 Topic createFile(InputStream in, String path)
          Creates a file in the file repository, and creates a corresponding File topic.
 Topic createFileTopic(String path)
          Creates and returns a File topic representing the file at a given repository path.
 void createFolder(String folderName, String path)
          Creates a folder in the file repository.
 Topic createFolderTopic(String path)
          Creates and returns a 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.
 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

createFileTopic

Topic createFileTopic(String path)
Creates and returns a File topic representing the file at a given repository path. If such a File topic exists already that topic is returned.

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

createFolderTopic

Topic createFolderTopic(String path)
Creates and returns a Folder topic representing the folder at a given repository path. If such a Folder topic exists already that topic is returned.

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

createChildFileTopic

Topic createChildFileTopic(long folderTopicId,
                           String path)

createChildFolderTopic

Topic createChildFolderTopic(long folderTopicId,
                             String path)

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

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.