Class ConnectionFileObject

java.lang.Object
org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
org.pentaho.di.connections.vfs.provider.ConnectionFileObject
All Implemented Interfaces:
Closeable, AutoCloseable, Comparable<org.apache.commons.vfs2.FileObject>, Iterable<org.apache.commons.vfs2.FileObject>, org.apache.commons.vfs2.FileObject, AliasedFileObject

public abstract class ConnectionFileObject extends org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem> implements AliasedFileObject
The abstract base FileObject implementation for the PVFS (Pentaho VFS) VFS provider.

The purpose of ConnectionFileObject is to represent a named connection FileObject. ConnectionFileObject holds a reference to the resolved FileObject and delegates metadata calls to that reference object, but for other calls, such as getChildren, ConnectionFileObject resolves the child file objects, but converts them to PVFS file objects to maintain named connection information.

The various subclasses clarify the cases for which connection file objects and ConnectionFileName are used, as well as allow providing more precise error messages to the user (see requireResolvedFileObject()). The subclasses are:

  • PvfsRootFileObject
  • UndefinedConnectionFileObject
  • ConnectionWithBucketsRootFileObject
  • ResolvedConnectionFileObject
The de facto factory of connection file objects is the method ConnectionFileSystem.createFile(AbstractFileName).
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
     

    Fields inherited from class org.apache.commons.vfs2.provider.AbstractFileObject

    DEFAULT_BUFFER_SIZE

    Fields inherited from interface org.apache.commons.vfs2.FileObject

    EMPTY_ARRAY
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    protected
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
     
    void
    copyFrom(org.apache.commons.vfs2.FileObject file, org.apache.commons.vfs2.FileSelector selector)
     
    protected org.apache.commons.vfs2.FileObject
    createChild(org.apache.commons.vfs2.FileObject childProviderFileObject)
    Convert child provider file object to a child PVFS file object.
    void
     
    void
     
    boolean
     
    int
    delete(org.apache.commons.vfs2.FileSelector selector)
     
    int
     
    protected long
     
    protected InputStream
     
    protected org.apache.commons.vfs2.FileType
     
    protected String[]
     
    Returns the original file object URI but swaps s3:// for s3a:// when needed
    org.apache.commons.vfs2.FileObject
     
    org.apache.commons.vfs2.FileObject[]
    Resolve children from the delegated vfs provider then convert to PVFS
    org.apache.commons.vfs2.FileContent
     
    org.apache.commons.vfs2.operations.FileOperations
     
     
    getInputStream(int bufferSize)
     
     
    Returns the string that contains original file object URI.
     
    getOutputStream(boolean bAppend)
     
    org.apache.commons.vfs2.RandomAccessContent
    getRandomAccessContent(org.apache.commons.vfs2.util.RandomAccessMode mode)
     
    abstract org.apache.commons.vfs2.FileObject
    Gets the resolved file object.
    void
    moveTo(org.apache.commons.vfs2.FileObject destFile)
     
    void
     
    protected abstract org.apache.commons.vfs2.provider.AbstractFileObject<?>
    Gets the resolved file object, throwing if it is not available.

    Methods inherited from class org.apache.commons.vfs2.provider.AbstractFileObject

    canRenameTo, childrenChanged, compareTo, doAttach, doCreateFileContent, doCreateFolder, doDelete, doDetach, doGetAttributes, doGetCertificates, doGetInputStream, doGetLastModifiedTime, doGetOutputStream, doGetRandomAccessContent, doIsExecutable, doIsHidden, doIsReadable, doIsSameFile, doIsSymbolicLink, doIsWriteable, doListChildrenResolved, doRemoveAttribute, doRename, doSetAttribute, doSetExecutable, doSetLastModifiedTime, doSetReadable, doSetWritable, endOutput, exists, finalize, findFiles, findFiles, getAbstractFileSystem, getFileContentInfoFactory, getFileSystem, getParent, getPublicURIString, getType, getURL, handleChanged, handleCreate, handleDelete, holdObject, injectType, isAttached, isContentOpen, isExecutable, isFile, isFolder, isHidden, isReadable, isSameFile, isSymbolicLink, isWriteable, iterator, listFiles, notifyAllStreamsClosed, onChange, onChildrenChanged, resolveFile, resolveFile, setExecutable, setReadable, setWritable, toString

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

    Methods inherited from interface org.apache.commons.vfs2.FileObject

    getPath, getURI

    Methods inherited from interface java.lang.Iterable

    forEach, spliterator
  • Field Details

  • Constructor Details

  • Method Details

    • getName

      public ConnectionFileName getName()
      Specified by:
      getName in interface org.apache.commons.vfs2.FileObject
      Overrides:
      getName in class org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
    • doGetContentSize

      protected long doGetContentSize() throws Exception
      Specified by:
      doGetContentSize in class org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
      Throws:
      Exception
    • doGetInputStream

      protected InputStream doGetInputStream() throws Exception
      Overrides:
      doGetInputStream in class org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
      Throws:
      Exception
    • doGetType

      protected org.apache.commons.vfs2.FileType doGetType() throws Exception
      Specified by:
      doGetType in class org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
      Throws:
      Exception
    • doListChildren

      protected String[] doListChildren() throws Exception
      Specified by:
      doListChildren in class org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
      Throws:
      Exception
    • close

      public void close() throws org.apache.commons.vfs2.FileSystemException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Specified by:
      close in interface org.apache.commons.vfs2.FileObject
      Overrides:
      close in class org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
      Throws:
      org.apache.commons.vfs2.FileSystemException
    • copyFrom

      public void copyFrom(org.apache.commons.vfs2.FileObject file, org.apache.commons.vfs2.FileSelector selector) throws org.apache.commons.vfs2.FileSystemException
      Specified by:
      copyFrom in interface org.apache.commons.vfs2.FileObject
      Overrides:
      copyFrom in class org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
      Throws:
      org.apache.commons.vfs2.FileSystemException
    • createFile

      public void createFile() throws org.apache.commons.vfs2.FileSystemException
      Specified by:
      createFile in interface org.apache.commons.vfs2.FileObject
      Overrides:
      createFile in class org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
      Throws:
      org.apache.commons.vfs2.FileSystemException
    • createFolder

      public void createFolder() throws org.apache.commons.vfs2.FileSystemException
      Specified by:
      createFolder in interface org.apache.commons.vfs2.FileObject
      Overrides:
      createFolder in class org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
      Throws:
      org.apache.commons.vfs2.FileSystemException
    • delete

      public boolean delete() throws org.apache.commons.vfs2.FileSystemException
      Specified by:
      delete in interface org.apache.commons.vfs2.FileObject
      Overrides:
      delete in class org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
      Throws:
      org.apache.commons.vfs2.FileSystemException
    • delete

      public int delete(org.apache.commons.vfs2.FileSelector selector) throws org.apache.commons.vfs2.FileSystemException
      Specified by:
      delete in interface org.apache.commons.vfs2.FileObject
      Overrides:
      delete in class org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
      Throws:
      org.apache.commons.vfs2.FileSystemException
    • deleteAll

      public int deleteAll() throws org.apache.commons.vfs2.FileSystemException
      Specified by:
      deleteAll in interface org.apache.commons.vfs2.FileObject
      Overrides:
      deleteAll in class org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
      Throws:
      org.apache.commons.vfs2.FileSystemException
    • getChild

      @Nullable public org.apache.commons.vfs2.FileObject getChild(String name) throws org.apache.commons.vfs2.FileSystemException
      Specified by:
      getChild in interface org.apache.commons.vfs2.FileObject
      Overrides:
      getChild in class org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
      Throws:
      org.apache.commons.vfs2.FileSystemException
    • getChildren

      public org.apache.commons.vfs2.FileObject[] getChildren() throws org.apache.commons.vfs2.FileSystemException
      Resolve children from the delegated vfs provider then convert to PVFS
      Specified by:
      getChildren in interface org.apache.commons.vfs2.FileObject
      Overrides:
      getChildren in class org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
      Returns:
      File objects with PVFS scheme
      Throws:
      org.apache.commons.vfs2.FileSystemException - File doesn't exist
    • createChild

      @NonNull protected org.apache.commons.vfs2.FileObject createChild(@NonNull org.apache.commons.vfs2.FileObject childProviderFileObject) throws org.apache.commons.vfs2.FileSystemException
      Convert child provider file object to a child PVFS file object.
      Parameters:
      childProviderFileObject - The child provider FileObject.
      Returns:
      The child PVFS FileObject.
      Throws:
      org.apache.commons.vfs2.FileSystemException - File doesn't exist
    • getContent

      public org.apache.commons.vfs2.FileContent getContent() throws org.apache.commons.vfs2.FileSystemException
      Specified by:
      getContent in interface org.apache.commons.vfs2.FileObject
      Overrides:
      getContent in class org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
      Throws:
      org.apache.commons.vfs2.FileSystemException
    • getFileOperations

      public org.apache.commons.vfs2.operations.FileOperations getFileOperations() throws org.apache.commons.vfs2.FileSystemException
      Specified by:
      getFileOperations in interface org.apache.commons.vfs2.FileObject
      Overrides:
      getFileOperations in class org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
      Throws:
      org.apache.commons.vfs2.FileSystemException
    • getInputStream

      public InputStream getInputStream() throws org.apache.commons.vfs2.FileSystemException
      Overrides:
      getInputStream in class org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
      Throws:
      org.apache.commons.vfs2.FileSystemException
    • getInputStream

      public InputStream getInputStream(int bufferSize) throws org.apache.commons.vfs2.FileSystemException
      Overrides:
      getInputStream in class org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
      Throws:
      org.apache.commons.vfs2.FileSystemException
    • getOutputStream

      public OutputStream getOutputStream() throws org.apache.commons.vfs2.FileSystemException
      Overrides:
      getOutputStream in class org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
      Throws:
      org.apache.commons.vfs2.FileSystemException
    • getOutputStream

      public OutputStream getOutputStream(boolean bAppend) throws org.apache.commons.vfs2.FileSystemException
      Overrides:
      getOutputStream in class org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
      Throws:
      org.apache.commons.vfs2.FileSystemException
    • getRandomAccessContent

      public org.apache.commons.vfs2.RandomAccessContent getRandomAccessContent(org.apache.commons.vfs2.util.RandomAccessMode mode) throws org.apache.commons.vfs2.FileSystemException
      Overrides:
      getRandomAccessContent in class org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
      Throws:
      org.apache.commons.vfs2.FileSystemException
    • moveTo

      public void moveTo(org.apache.commons.vfs2.FileObject destFile) throws org.apache.commons.vfs2.FileSystemException
      Specified by:
      moveTo in interface org.apache.commons.vfs2.FileObject
      Overrides:
      moveTo in class org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
      Throws:
      org.apache.commons.vfs2.FileSystemException
    • refresh

      public void refresh() throws org.apache.commons.vfs2.FileSystemException
      Specified by:
      refresh in interface org.apache.commons.vfs2.FileObject
      Overrides:
      refresh in class org.apache.commons.vfs2.provider.AbstractFileObject<ConnectionFileSystem>
      Throws:
      org.apache.commons.vfs2.FileSystemException
    • getResolvedFileObject

      @Nullable public abstract org.apache.commons.vfs2.FileObject getResolvedFileObject()
      Gets the resolved file object.
      Returns:
      The resolved file object, if one is available; null, otherwise.
    • requireResolvedFileObject

      @NonNull protected abstract org.apache.commons.vfs2.provider.AbstractFileObject<?> requireResolvedFileObject() throws org.apache.commons.vfs2.FileSystemException
      Gets the resolved file object, throwing if it is not available.

      Implementers of this method should throw an exception that makes it clear the reason for a resolved file object not being available, such as being the PVFS root or an undefined connection.

      Returns:
      The resolved file object.
      Throws:
      org.apache.commons.vfs2.FileSystemException
    • getOriginalURIString

      public String getOriginalURIString()
      Description copied from interface: AliasedFileObject
      Returns the string that contains original file object URI.
      Specified by:
      getOriginalURIString in interface AliasedFileObject
      Returns:
      original URI string
    • getAELSafeURIString

      public String getAELSafeURIString()
      Description copied from interface: AliasedFileObject
      Returns the original file object URI but swaps s3:// for s3a:// when needed
      Specified by:
      getAELSafeURIString in interface AliasedFileObject
      Returns: