Tabnine Logo
org.apache.commons.vfs2.provider
Code IndexAdd Tabnine to your IDE (free)

How to use org.apache.commons.vfs2.provider

Best Java code snippets using org.apache.commons.vfs2.provider (Showing top 20 results out of 315)

origin: pentaho/pentaho-kettle

SftpFileObjectWithWindowsSupport( AbstractFileName name, SftpFileSystemWindows fileSystem )
    throws FileSystemException {
 super( name, fileSystem );
 this.path = name.getPath();
}
origin: pentaho/pentaho-kettle

protected void clearFileFromCache( FileName name ) {
 super.removeFileFromCache( name );
}
origin: pentaho/pentaho-kettle

Putter( AtomicBoolean condition, DefaultFileSystemManager fsm ) {
 super( condition );
 this.fsm = fsm;
 provider = mock( AbstractFileProvider.class );
 doNothing().when( provider ).freeUnusedResources();
}
origin: pentaho/pentaho-kettle

/**
 * {@link  org.apache.commons.vfs2.provider.sftp.SftpFileSystem#getChannel() }
 *
 */
private void ensureSession() throws FileSystemException {
 if ( this.session == null || !this.session.isConnected() ) {
  this.doCloseCommunicationLink();
  UserAuthenticationData authData = null;
  Session session;
  try {
   GenericFileName e = (GenericFileName) this.getRootName();
   authData = UserAuthenticatorUtils.authenticate( this.getFileSystemOptions(), SftpFileProvider.AUTHENTICATOR_TYPES );
   session = SftpClientFactory.createConnection( e.getHostName(), e.getPort(), UserAuthenticatorUtils.getData( authData, UserAuthenticationData.USERNAME,
       UserAuthenticatorUtils.toChar( e.getUserName() ) ), UserAuthenticatorUtils.getData( authData, UserAuthenticationData.PASSWORD,
       UserAuthenticatorUtils.toChar( e.getPassword() ) ), this.getFileSystemOptions() );
  } catch ( Exception var7 ) {
   throw new FileSystemException( "vfs.provider.sftp/connect.error", this.getRootName(), var7 );
  } finally {
   UserAuthenticatorUtils.cleanup( authData );
  }
  this.session = session;
 }
}
origin: pentaho/pentaho-kettle

private void updateLocation() {
 String pathText = wPath.getText();
 String scheme = pathText.isEmpty() ? HDFS_SCHEME : UriParser.extractScheme( pathText );
 if ( scheme != null ) {
  List<VFSScheme> availableVFSSchemes = getAvailableVFSSchemes();
  for ( int i = 0; i < availableVFSSchemes.size(); i++ ) {
   VFSScheme s = availableVFSSchemes.get( i );
   if ( scheme.equals( s.scheme ) ) {
    wLocation.select( i );
    selectedVFSScheme = s;
   }
  }
 }
}
origin: pentaho/pentaho-kettle

FileNameParser sftpFilenameParser = SftpFileNameParser.getInstance();
URLFileName file = (URLFileName) sftpFilenameParser.parseUri( null, null, vfsUrl );
if ( !parameterContainsHost( fullParameterName ) || fullParameterName.endsWith( file.getHostName() ) ) {
   identities = new IdentityInfo[] { new IdentityInfo( new File( value ) ) };
  } else {
   identities = temp;
   identities[identities.length - 1] = new IdentityInfo( new File( value ) );
origin: pentaho/pentaho-kettle

private synchronized FileObject processFile( FileName name, boolean useCache ) throws FileSystemException {
 if ( !super.getRootName().getRootURI().equals( name.getRootURI() ) ) {
  throw new FileSystemException( "vfs.provider/mismatched-fs-for-name.error",
    new Object[] { name, super.getRootName(), name.getRootURI() } );
 } else {
  FileObject file;
  if ( useCache ) {
   file = super.getFileFromCache( name );
  } else {
   file = null;
  }
  if ( file == null ) {
   try {
    file = this.createFile( (AbstractFileName) name );
   } catch ( Exception var5 ) {
    return null;
   }
   file = super.decorateFileObject( file );
   if ( useCache ) {
    super.putFileToCache( file );
   }
  }
  if ( super.getFileSystemManager().getCacheStrategy().equals( CacheStrategy.ON_RESOLVE ) ) {
   file.refresh();
  }
  return file;
 }
}
origin: org.apache.commons/commons-vfs2

/**
 * Creates a temporary local copy of a file and its descendants.
 *
 * @param file the start of the tree.
 * @param selector selection what to do with childs.
 * @return replicated root file.
 * @throws Exception any Exception is wrapped as FileSystemException.
 */
protected File doReplicateFile(final FileObject file, final FileSelector selector) throws Exception {
  return getContext().getReplicator().replicateFile(file, selector);
}
origin: apache/accumulo

@SuppressFBWarnings(value = "PATH_TRAVERSAL_IN",
  justification = "input files are specified by admin, not unchecked user input")
@Override
public File replicateFile(FileObject srcFile, FileSelector selector) throws FileSystemException {
 String baseName = srcFile.getName().getBaseName();
 try {
  String safeBasename = UriParser.encode(baseName, TMP_RESERVED_CHARS).replace('%', '_');
  File file = File.createTempFile("vfsr_", "_" + safeBasename, tempDir);
  file.deleteOnExit();
  final FileObject destFile = context.toFileObject(file);
  destFile.copyFrom(srcFile, selector);
  return file;
 } catch (IOException e) {
  throw new FileSystemException(e);
 }
}
origin: apache/commons-vfs

/**
 * Create a FileContent implementation.
 *
 * @return The FileContent.
 * @throws FileSystemException if an error occurs.
 * @since 2.0
 */
protected FileContent doCreateFileContent() throws FileSystemException {
  return new DefaultFileContent(this, getFileContentInfoFactory());
}
origin: org.apache.commons/commons-vfs2

/**
 * Return the FileSystemManager used to instantiate this filesystem.
 *
 * @return the FileSystemManager.
 */
@Override
public FileSystemManager getFileSystemManager() {
  return getContext().getFileSystemManager();
}
origin: org.apache.commons/commons-vfs2

void streamOpened() {
  synchronized (this) {
    openStreams++;
  }
  ((AbstractFileSystem) fileObject.getFileSystem()).streamOpened();
}
origin: org.apache.commons/commons-configuration2

@Override
public URL getURL(final String basePath, final String file) throws MalformedURLException
{
  if ((basePath != null && UriParser.extractScheme(basePath) == null)
    || (basePath == null && UriParser.extractScheme(file) == null))
  {
    return super.getURL(basePath, file);
  }
  try
  {
    final FileSystemManager fsManager = VFS.getManager();
    FileName path;
    if (basePath != null && UriParser.extractScheme(file) == null)
    {
      final FileName base = fsManager.resolveURI(basePath);
      path = fsManager.resolveName(base, file);
    }
    else
    {
      path = fsManager.resolveURI(file);
    }
    final URLStreamHandler handler = new VFSURLStreamHandler(path);
    return new URL(null, path.getURI(), handler);
  }
  catch (final FileSystemException fse)
  {
    throw new ConfigurationRuntimeException("Could not parse basePath: " + basePath
      + " and fileName: " + file, fse);
  }
}
origin: com.github.abashev/commons-vfs2

/**
 * Creates a temporary local copy of a file and its descendants.
 *
 * @param file the start of the tree.
 * @param selector selection what to do with childs.
 * @return replicated root file.
 * @throws Exception any Exception is wrapped as FileSystemException.
 */
protected File doReplicateFile(final FileObject file, final FileSelector selector) throws Exception {
  return getContext().getReplicator().replicateFile(file, selector);
}
origin: org.apache.commons/commons-configuration2

@Override
public String getFileName(final String path)
{
  if (UriParser.extractScheme(path) == null)
  {
    return super.getFileName(path);
  }
  try
  {
    final FileSystemManager fsManager = VFS.getManager();
    final FileName name = fsManager.resolveURI(path);
    return name.getBaseName();
  }
  catch (final FileSystemException fse)
  {
    fse.printStackTrace();
    return null;
  }
}
origin: org.jetbrains.intellij.deps/commons-vfs2

/**
 * Creates a temporary local copy of a file and its descendants.
 */
protected File doReplicateFile(final FileObject file,
                final FileSelector selector)
  throws Exception
{
  return getContext().getReplicator().replicateFile(file, selector);
}
origin: org.apache.commons/commons-configuration2

@Override
public String getBasePath(final String path)
{
  if (UriParser.extractScheme(path) == null)
  {
    return super.getBasePath(path);
  }
  try
  {
    final FileSystemManager fsManager = VFS.getManager();
    final FileName name = fsManager.resolveURI(path);
    return name.getParent().getURI();
  }
  catch (final FileSystemException fse)
  {
    fse.printStackTrace();
    return null;
  }
}
origin: apache/commons-vfs

/**
 * Creates a temporary local copy of a file and its descendants.
 *
 * @param file the start of the tree.
 * @param selector selection what to do with childs.
 * @return replicated root file.
 * @throws Exception any Exception is wrapped as FileSystemException.
 */
protected File doReplicateFile(final FileObject file, final FileSelector selector) throws Exception {
  return getContext().getReplicator().replicateFile(file, selector);
}
origin: org.apache.commons/commons-configuration2

@Override
public URL locateFromURL(final String basePath, final String fileName)
  final String fileScheme = UriParser.extractScheme(fileName);
  if ((basePath == null || UriParser.extractScheme(basePath) == null) && fileScheme == null)
      final String scheme = UriParser.extractScheme(basePath);
      final FileSystemOptions opts = (scheme != null) ? getOptions(scheme) : null;
      FileObject base = (opts == null) ? fsManager.resolveFile(basePath)
origin: org.apache.commons/commons-configuration2

if (UriParser.extractScheme(fileName) != null)
org.apache.commons.vfs2.provider

Most used classes

  • UriParser
    Utilities for dealing with URIs. See RFC 2396 for details. 2005) $
  • SftpFileSystemConfigBuilder
    The config builder for various SFTP configuration options.
  • GenericFileName
    A file name that represents a 'generic' URI, as per RFC 2396. Consists of a scheme, userinfo (typica
  • FtpFileSystemConfigBuilder
    The config builder for various ftp configuration options.
  • AbstractFileSystem
    A partial org.apache.commons.vfs2.FileSystem implementation.
  • FtpsFileSystemConfigBuilder,
  • DefaultLocalFileProvider,
  • AbstractFileName,
  • URLFileName,
  • FtpFileProvider,
  • URLFileNameParser,
  • SftpClientFactory,
  • AbstractFileObject,
  • HostFileNameParser$Authority,
  • HdfsFileProvider,
  • HttpFileProvider,
  • HttpFileSystemConfigBuilder,
  • RamFileSystem,
  • RamFileSystemConfigBuilder
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now