Package org.apache.oodt.cas.protocol

Examples of org.apache.oodt.cas.protocol.ProtocolFile


      Vector<ChannelSftp.LsEntry> sftpFiles = (Vector<ChannelSftp.LsEntry>) sftpChannel
          .ls(sftpChannel.pwd());
      Vector<ProtocolFile> returnFiles = new Vector<ProtocolFile>();
      for (ChannelSftp.LsEntry sftpFile : sftpFiles) {
        String path = this.pwd().getPath();
        ProtocolFile pFile = new ProtocolFile(path + "/" + sftpFile.getFilename(), sftpFile
            .getAttrs().isDir());
        if (filter.accept(pFile)) {
          returnFiles.add(pFile);
        }
      }
View Full Code Here


    }
  }
 
  public ProtocolFile pwd() throws ProtocolException {
    try {
      return new ProtocolFile(sftpChannel.pwd(), true);
    } catch (Exception e) {
      throw new ProtocolException("Failed to pwd : " + e.getMessage());
    }
  }
View Full Code Here

  public void setSite(RemoteSite site) {
    this.site = site;
  }

  public RemoteSiteFile getRemoteParent() {
    ProtocolFile parent = super.getParent();
    return new RemoteSiteFile(parent.getPath(), parent.isDir(), this.site);
  }
View Full Code Here

    ProtocolFile parent = super.getParent();
    return new RemoteSiteFile(parent.getPath(), parent.isDir(), this.site);
  }

  public RemoteSiteFile getAbsoluteFile() {
    ProtocolFile parent = super.getAbsoluteFile();
    return new RemoteSiteFile(parent.getPath(), parent.isDir(), this.site);
  }
View Full Code Here

    int port = context.getPort();
    File pubKeyFile = createPubKeyForPort(port);
    JschSftpProtocol sftpProtocol = new JschSftpProtocol(port);
    sftpProtocol.connect("localhost", new HostKeyAuthentication("bfoster", "",
        pubKeyFile.getAbsoluteFile().getAbsolutePath()));
    ProtocolFile homeDir = sftpProtocol.pwd();
    ProtocolFile testDir = new ProtocolFile(homeDir, "sshTestDir", true);
    sftpProtocol.cd(testDir);
    assertEquals(testDir, sftpProtocol.pwd());
    List<ProtocolFile> lsResults = new ArrayList<ProtocolFile>(
        sftpProtocol.ls(new ProtocolFileFilter() {
          public boolean accept(ProtocolFile file) {
            return file.getName().equals("sshTestFile");
          }
        }));
    assertEquals(1, lsResults.size());
    ProtocolFile testFile = lsResults.get(0);
    assertEquals(new ProtocolFile(testDir, "sshTestFile", false), testFile);
  }
View Full Code Here

        pubKeyFile.getAbsoluteFile().getAbsolutePath()));
    File bogusFile = File.createTempFile("bogus", "bogus");
    File tmpFile = new File(bogusFile.getParentFile(), "TestJschSftpProtocol");
    bogusFile.delete();
    tmpFile.mkdirs();
    sftpProtocol.cd(new ProtocolFile("sshTestDir", true));
    File testDownloadFile = new File(tmpFile, "testDownloadFile");
    sftpProtocol.get(new ProtocolFile("sshTestFile", false), testDownloadFile);
    assertTrue(FileUtils.contentEquals(new File("src/testdata/sshTestDir/sshTestFile"), testDownloadFile));
    FileUtils.forceDelete(tmpFile);
  }
View Full Code Here

    }
  }

  public String getAbsPathFor(Protocol protocol, String path, boolean isDir) {
    try {
      protocol.cd(new ProtocolFile(path, isDir));
      return protocol.pwd().getAbsoluteFile().getPath();
    } catch (Exception e) {
      e.printStackTrace();
      return null;
    }
View Full Code Here

                  + e.getMessage());
      }
  }
 
  public void cdRoot() throws ProtocolException {
    cd(new ProtocolFile(ProtocolFile.SEPARATOR, true));
  }
View Full Code Here

  public void cdRoot() throws ProtocolException {
    cd(new ProtocolFile(ProtocolFile.SEPARATOR, true));
  }
 
  public void cdHome() throws ProtocolException {
    cd(new ProtocolFile(homeDir, true));
  }
View Full Code Here

      try {
          ftp.setActive(ftp.setLocalPassive());
          Vector<FileInfo> fileList = (Vector<FileInfo>) ftp.list("*", null);
          Vector<ProtocolFile> returnList = new Vector<ProtocolFile>();
          for (FileInfo file : fileList) {
              returnList.add(new ProtocolFile(this.pwd(), file.getName(), file.isDirectory()));
          }
          return returnList;
      } catch (Exception e) {
          throw new ProtocolException("Failed to get list of files : "
                  + e.getMessage());
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.protocol.ProtocolFile

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.