Interface DataProtocol
- All Known Implementing Classes:
AdditionalAnnotationDataProtocol,AnnotationDataProtocol,DeprecatedDataProtocol,FileDataProtocol,FTPPathDataProtocol,FTPURLDataProtocol,GenomeDataProtocol,GFFDataProtocol,GTFDataProtocol,HDFSPathDataProtocol,HTTPPathDataProtocol,HTTPSPathDataProtocol,HTTPSURLDataProtocol,HTTPURLDataProtocol,PathDataProtocol,StorageDataProtocol,URLDataProtocol
public interface DataProtocol
This interface define a protocol.
- Since:
- 1.0
- Author:
- Laurent Jourdren
-
Method Summary
Modifier and TypeMethodDescriptionbooleanTest if the delete() method is available with this protocol.booleancanList()Test if the list() method is available with this protocol.booleancanMkdir()Test if the mkdir() and mkdirs() methods are available with this protocol.booleancanRead()Test if source is readable with this protocol.booleanTest if the renameTo() method is available with this protocol.booleanTest if the symlink() method is available with this protocol.booleancanWrite()Test if source is writable with this protocol.voidDelete a file.booleanTest a source exists.Create an InputStream from the source.Get the parent source of the source.getMetadata(DataFile src) Get the metadata for the source.getName()Get Protocol name.getSourceAsFile(DataFile src) Get the underlying File object for the DataFile if the protocol allow it.getSourceAsPath(DataFile src) Get the underlying File object for the DataFile if the protocol allow it.getSourceFilename(String source) Get the name of the filename that correspond to the source.List a directory.voidCreate a directory.voidCreate a directory and its parents if not exists.Create an OutputStream from the source.voidCopy data from a source to a destination sourceputData(DataFile dest, DataFileMetadata md) Create an OutputStream from the source.voidRename a file.voidCreate a symbolic link.
-
Method Details
-
getName
String getName()Get Protocol name.- Returns:
- the name of the protocol
-
getSourceFilename
Get the name of the filename that correspond to the source.- Parameters:
source- the source- Returns:
- a String with the filename
-
getDataFileParent
Get the parent source of the source.- Parameters:
src- source to use- Returns:
- a String with the source of the parent or null if there is parent
-
getData
Create an InputStream from the source.- Parameters:
src- source to use- Returns:
- an InputStream
- Throws:
IOException- if an error occurs while creating the InputStream
-
putData
Create an OutputStream from the source.- Parameters:
dest- destination to use- Returns:
- an OutputStream
- Throws:
IOException- if an error occurs while creating the OutputStream
-
putData
Create an OutputStream from the source.- Parameters:
dest- source to usemd- metadata for the stream to write- Returns:
- an OutputStream
- Throws:
IOException- if an error occurs while creating the OutputStream
-
putData
Copy data from a source to a destination source- Parameters:
src- source sourcedest- destination source- Throws:
IOException- if an error occurs while copying data
-
exists
Test a source exists.- Parameters:
src- source to usefollowLink- if the source is a symbolic file and followLink is true, it will check if the symbolic link target exists instead of the link- Returns:
- true if the source exists
-
mkdir
Create a directory.- Parameters:
dir- directory to create- Throws:
IOException- if an error occurs while creating the directory
-
mkdirs
Create a directory and its parents if not exists.- Parameters:
dir- directory to create- Throws:
IOException- if an error occurs while creating the directory
-
symlink
Create a symbolic link.- Parameters:
target- target filelink- symbolic link file- Throws:
IOException- if an error occurs while creating the symbolic link
-
delete
Delete a file.- Parameters:
file- file to deleterecursive- recursive deletion- Throws:
IOException- if an error occurs while deleting the file
-
list
List a directory.- Parameters:
dir- directory to list- Returns:
- a list of DataFile objects
- Throws:
IOException- if an error occurs while listing the directory
-
rename
Rename a file.- Parameters:
file- the file to renamedest- the destination file- Throws:
IOException- if an error occurs while renaming the directory
-
getMetadata
Get the metadata for the source.- Parameters:
src- source to use- Returns:
- always a metadataObject
- Throws:
IOException- if an error occurs while getting metadata
-
canRead
boolean canRead()Test if source is readable with this protocol.- Returns:
- true if the source is readable
-
canWrite
boolean canWrite()Test if source is writable with this protocol.- Returns:
- true if the source is writable
-
canMkdir
boolean canMkdir()Test if the mkdir() and mkdirs() methods are available with this protocol.- Returns:
- true if mkdir() and mkdirs() are available
-
canSymlink
boolean canSymlink()Test if the symlink() method is available with this protocol.- Returns:
- true if symlink() is available
-
canDelete
boolean canDelete()Test if the delete() method is available with this protocol.- Returns:
- true if delete() is available
-
canList
boolean canList()Test if the list() method is available with this protocol.- Returns:
- true if list() is available
-
canRename
boolean canRename()Test if the renameTo() method is available with this protocol.- Returns:
- true if renameTo() is available
-
getSourceAsFile
Get the underlying File object for the DataFile if the protocol allow it.- Parameters:
src- source DataFile- Returns:
- a File object or null if the protocol does not allow it
-
getSourceAsPath
Get the underlying File object for the DataFile if the protocol allow it.- Parameters:
src- source DataFile- Returns:
- a File object or null if the protocol does not allow it
-