Class AbstractExecFileTransfer

    • Constructor Detail

      • AbstractExecFileTransfer

        public AbstractExecFileTransfer()
    • Method Detail

      • getLocalLocation

        protected java.io.File getLocalLocation​(OriginalFile root,
                                                OriginalFile ofile)
        Build a path of the form "root.path/root.name/file.path/file.name".
        Parameters:
        root - the root directory
        ofile - a path relative to the root
        Returns:
        the assembled path with separators suitable for the local filesystem
      • checkLocation

        protected void checkLocation​(java.io.File location,
                                     RawFileStorePrx rawFileStore)
                              throws ServerError,
                                     java.io.IOException
        Check that the target location: 1) doesn't exist and 2) is properly written to by the server. If either condition fails, no linking takes place.
        Parameters:
        location - the source file
        rawFileStore - the target on the server
        Throws:
        ServerError - if the raw file store could not be used
        java.io.IOException - for problems with the source file
      • failLocationCheck

        protected java.lang.RuntimeException failLocationCheck​(java.io.File location,
                                                               java.lang.String msg)
      • exec

        protected void exec​(java.io.File file,
                            java.io.File location)
                     throws java.io.IOException
        If createProcessBuilder(java.io.File,java.io.File) returns non-null, executes a local command corresponding to the ProcessBuilder and fails on non-0 return codes. If the ProcessBuilder is null, this method does nothing by default. This method should be overridden by subclasses, see for example CopyFileTransfer.
        Parameters:
        file - the source file
        location - the target on the server
        Throws:
        java.io.IOException - for problems with the source file
      • checkTarget

        protected void checkTarget​(java.io.File location,
                                   TransferState state)
                            throws ServerError
        Check that the server can properly read the copied file. Like checkLocation(File, RawFileStorePrx) but after the invocation of exec(File, File), there is some chance, likely due to file permissions, that the server will not be able to read the transfered file. If so, raise an exception and leave the user to cleanup and modifications.
        Throws:
        ServerError
      • createProcessBuilder

        @Deprecated
        protected java.lang.ProcessBuilder createProcessBuilder​(java.io.File file,
                                                                java.io.File location)
        Deprecated.
        override exec(File, File) instead
        Creates a ProcessBuilder instance ready to have ProcessBuilder.start() called on it. The only critical piece of information should be the return code.
        Parameters:
        file - File to be copied.
        location - Location to copy to.
        Returns:
        an instance ready for performing the transfer