com.electrotank.electroserver4.extensions.api
Interface EsFileSystemApi


public interface EsFileSystemApi

All needed file I/O methods.

See Also:
ElectroServerApi.getFileSystemApi

Method Summary
 void addKeywords(String path, String name, Collection<String> keywords)
          Associates a collection of keywords with DAT file specified by the given path and filename.
 void delete(String path, String name)
          Deletes the DAT file associated with the given path and filename.
 void deleteDirectory(String path)
          Deletes the directory associated with the given path.
 Collection<com.electrotank.electroserver4.entities.EsFileSystemResponse> findFilesByKeywords(Collection<String> keyword)
          Finds a collection of EsObjects that had been stored previously using the collection of keywords specified.
 com.electrotank.electroserver4.entities.EsFileSystemResponse getEsObject(String path, String name)
          Gets the EsObject that was stored previously with the given path and filename.
 Collection<String> list(String path, boolean recursive)
          Lists the file names of all EsObjects that had been stored previously using the specified path.
 void removeKeywords(String path, String name, Collection<String> keywords)
          Removes a collection of keywords from the DAT file specified by the given path and filename.
 void write(String path, String name, EsObjectRO object, com.electrotank.electroserver4.enumerations.CleanupStrategy cleanupStrategy)
          Writes an EsObjectRO object as a file.
 void write(String path, String name, EsObjectRO object, com.electrotank.electroserver4.enumerations.CleanupStrategy cleanupStrategy, Collection<String> keywords)
          Writes an EsObjectRO object as a file.
 void write(String path, String name, EsObjectRO object, com.electrotank.electroserver4.enumerations.CleanupStrategy cleanupStrategy, Date expiration)
          Writes an EsObjectRO object as a file.
 void write(String path, String name, EsObjectRO object, com.electrotank.electroserver4.enumerations.CleanupStrategy cleanupStrategy, Date expiration, Collection<String> keywords)
          Writes an EsObjectRO object as a file.
 

Method Detail

write

void write(String path,
           String name,
           EsObjectRO object,
           com.electrotank.electroserver4.enumerations.CleanupStrategy cleanupStrategy,
           Date expiration)
Writes an EsObjectRO object as a file. The path and name of the file are hashed, and the file appears as a DAT file named according to the hash value, in a tree structure inside the installation directory/server folder. The EsObjectRO can contain any information that an EsObjectRO can hold; when saving a image, it is converted to a byte array before storing in the EsObjectRO.

Parameters:
path - path to be used to retrieve the file
name - filename to be used to retrieve the file
object - EsObjectRO to save as a DAT file
cleanupStrategy - use CleanupStrategy.EXPIRATION for this type of write
expiration - expiration timestamp

write

void write(String path,
           String name,
           EsObjectRO object,
           com.electrotank.electroserver4.enumerations.CleanupStrategy cleanupStrategy,
           Date expiration,
           Collection<String> keywords)
Writes an EsObjectRO object as a file. The path and name of the file are hashed, and the file appears as a DAT file named according to the hash value, in a tree structure inside the installation directory/server folder. The EsObjectRO can contain any information that an EsObjectRO can hold; when saving a image, it is converted to a byte array before storing in the EsObjectRO.

Parameters:
path - path to be used to retrieve the file
name - filename to be used to retrieve the file
object - EsObjectRO to save as a DAT file
cleanupStrategy - use CleanupStrategy.EXPIRATION for this type of write
expiration - expiration timestamp
keywords - words that might be used in a keyword search

write

void write(String path,
           String name,
           EsObjectRO object,
           com.electrotank.electroserver4.enumerations.CleanupStrategy cleanupStrategy)
Writes an EsObjectRO object as a file. The path and name of the file are hashed, and the file appears as a DAT file named according to the hash value, in a tree structure inside the installation directory/server folder. The EsObjectRO can contain any information that an EsObjectRO can hold; when saving a image, it is converted to a byte array before storing in the EsObjectRO.

Parameters:
path - path to be used to retrieve the file
name - filename to be used to retrieve the file
object - EsObjectRO to save as a DAT file
cleanupStrategy - CleanupStrategy.NEVER, SERVER_STOP, or SESSION

write

void write(String path,
           String name,
           EsObjectRO object,
           com.electrotank.electroserver4.enumerations.CleanupStrategy cleanupStrategy,
           Collection<String> keywords)
Writes an EsObjectRO object as a file. The path and name of the file are hashed, and the file appears as a DAT file named according to the hash value, in a tree structure inside the installation directory/server folder. The EsObjectRO can contain any information that an EsObjectRO can hold; when saving a image, it is converted to a byte array before storing in the EsObjectRO.

Parameters:
path - path to be used to retrieve the file
name - filename to be used to retrieve the file
object - EsObjectRO to save as a DAT file
cleanupStrategy - CleanupStrategy.NEVER, SERVER_STOP, or SESSION
keywords - words that might be used in a keyword search

delete

void delete(String path,
            String name)
Deletes the DAT file associated with the given path and filename.

Parameters:
path - path used when file was written
name - filename used when file was written

deleteDirectory

void deleteDirectory(String path)
Deletes the directory associated with the given path.

Parameters:
path - path used when files were written

addKeywords

void addKeywords(String path,
                 String name,
                 Collection<String> keywords)
Associates a collection of keywords with DAT file specified by the given path and filename.

Parameters:
path - path used when file was written
name - filename used when file was written
keywords - keywords to be added

removeKeywords

void removeKeywords(String path,
                    String name,
                    Collection<String> keywords)
Removes a collection of keywords from the DAT file specified by the given path and filename.

Parameters:
path - path used when file was written
name - filename used when file was written
keywords - keywords to be removed

getEsObject

com.electrotank.electroserver4.entities.EsFileSystemResponse getEsObject(String path,
                                                                         String name)
Gets the EsObject that was stored previously with the given path and filename. For example:
        EsFileSystemApi fileSystemApi = getApi().getFileSystemApi();
        EsFileSystemResponse fileResponse = fileSystemApi.getEsObject(path, filename);
        if (fileResponse == null) {
            handle error retrieving file
        } else {
            EsObject fileObj = fileResponse.getEsObject();
            process fileObj
        }
 

Parameters:
path - path used when file was written
name - filename used when file was written
Returns:
EsFileSystemResponse, containing the EsObject

findFilesByKeywords

Collection<com.electrotank.electroserver4.entities.EsFileSystemResponse> findFilesByKeywords(Collection<String> keyword)
Finds a collection of EsObjects that had been stored previously using the collection of keywords specified.

Parameters:
keyword - collection of keywords to use in the search
Returns:
collection of EsFileSystemResponse, containing the EsObjects

list

Collection<String> list(String path,
                        boolean recursive)
Lists the file names of all EsObjects that had been stored previously using the specified path.

Parameters:
path - path used when file was written
recursive - boolean indicating whether to search subtrees
Returns:
collection of filenames


Copyright © 2007 Electrotank, Inc. All Rights Reserved.