Package com.jcraft.jsch

Examples of com.jcraft.jsch.SftpATTRS


    }

    @Override
    FileStream open(final String path) throws IOException {
      try {
        final SftpATTRS a = ftp.lstat(path);
        return new FileStream(ftp.get(path), a.getSize());
      } catch (SftpException je) {
        if (je.id == ChannelSftp.SSH_FX_NO_SUCH_FILE)
          throw new FileNotFoundException(path);
        throw new TransportException("Can't get " + objectsPath + "/"
            + path + ": " + je.getMessage(), je);
View Full Code Here


    }

    @Override
    FileStream open(final String path) throws IOException {
      try {
        final SftpATTRS a = ftp.lstat(path);
        return new FileStream(ftp.get(path), a.getSize());
      } catch (SftpException je) {
        if (je.id == ChannelSftp.SSH_FX_NO_SUCH_FILE)
          throw new FileNotFoundException(path);
        throw new TransportException("Can't get " + objectsPath + "/"
            + path + ": " + je.getMessage(), je);
View Full Code Here

        if (c != null) {
          Boolean containsWildcardCharacter = false;
          Boolean isDirectory = false;
          try {
            SftpATTRS ss = c.lstat(path);
            isDirectory = ss.isDir();
          } catch (SftpException e) {
            containsWildcardCharacter = true;
          }
         
          Vector<LsEntry> files = (Vector<LsEntry>) c.ls(path);
          for (LsEntry lsEntry : files) {
            SftpATTRS sftpAttrs = lsEntry.getAttrs();
           
            if (sftpAttrs == null) {
              throw new IllegalArgumentException(
                  "paramkey dir not found on the remote server: "
                      + lsEntry.getFilename());
            } else if (sftpAttrs.isDir()) {
              LOGGER.info(lsEntry.getFilename()
                  + " is a directory, permission string is "
                  + sftpAttrs.getPermissionsString());
            } else {
              LOGGER.info(lsEntry.getFilename()
                  + " is a file, permission string is "
                  + sftpAttrs.getPermissionsString());
            }
           
            if (lsEntry.getFilename().startsWith(".")
                || lsEntry.getFilename()
                    .startsWith("_")
View Full Code Here

 
      channel = session.openChannel("sftp");
      channel.connect();
      c = (ChannelSftp) channel;
     
      SftpATTRS sftpAttrs = c.lstat(path);
      if (sftpAttrs == null){
        throw new IllegalArgumentException(
            "paramkey dir not found on the remote server: " + path);
      }else if (sftpAttrs.isDir() ){
        logger.info("removing files under the " + path);
        c.rm(path + "/" + prefixname + "*");
      }else{
        logger.error(path + " is a file, please make sure it is only a directory. ");
        return;
View Full Code Here

    }

    public ExternalResourceMetaData getMetaData(URI uri) throws IOException {
        LockableSftpClient sftpClient = sftpClientFactory.createSftpClient(uri, credentials);
        try {
            SftpATTRS attributes = sftpClient.getSftpClient().lstat(uri.getPath());
            return attributes != null ? toMetaData(uri, attributes) : null;
        } catch (com.jcraft.jsch.SftpException e) {
            if (e.id == ChannelSftp.SSH_FX_NO_SUCH_FILE) {
                return null;
            }
View Full Code Here

TOP

Related Classes of com.jcraft.jsch.SftpATTRS

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.