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 Details

    • getName

      String getName()
      Get Protocol name.
      Returns:
      the name of the protocol
    • getSourceFilename

      String getSourceFilename(String source)
      Get the name of the filename that correspond to the source.
      Parameters:
      source - the source
      Returns:
      a String with the filename
    • getDataFileParent

      DataFile getDataFileParent(DataFile src)
      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

      InputStream getData(DataFile src) throws IOException
      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

      OutputStream putData(DataFile dest) throws IOException
      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 use
      md - metadata for the stream to write
      Returns:
      an OutputStream
      Throws:
      IOException - if an error occurs while creating the OutputStream
    • putData

      void putData(DataFile src, DataFile dest) throws IOException
      Copy data from a source to a destination source
      Parameters:
      src - source source
      dest - destination source
      Throws:
      IOException - if an error occurs while copying data
    • exists

      boolean exists(DataFile src, boolean followLink)
      Test a source exists.
      Parameters:
      src - source to use
      followLink - 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

      void mkdir(DataFile dir) throws IOException
      Create a directory.
      Parameters:
      dir - directory to create
      Throws:
      IOException - if an error occurs while creating the directory
    • mkdirs

      void mkdirs(DataFile dir) throws IOException
      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

      void symlink(DataFile target, DataFile link) throws IOException
      Create a symbolic link.
      Parameters:
      target - target file
      link - symbolic link file
      Throws:
      IOException - if an error occurs while creating the symbolic link
    • delete

      void delete(DataFile file, boolean recursive) throws IOException
      Delete a file.
      Parameters:
      file - file to delete
      recursive - recursive deletion
      Throws:
      IOException - if an error occurs while deleting the file
    • list

      List<DataFile> list(DataFile dir) throws IOException
      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

      void rename(DataFile file, DataFile dest) throws IOException
      Rename a file.
      Parameters:
      file - the file to rename
      dest - the destination file
      Throws:
      IOException - if an error occurs while renaming the directory
    • getMetadata

      DataFileMetadata getMetadata(DataFile src) throws IOException
      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

      File getSourceAsFile(DataFile src)
      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

      Path getSourceAsPath(DataFile src)
      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