Package ch.ethz.ssh2

Examples of ch.ethz.ssh2.SFTPv3DirectoryEntry


    String slash="";
    if (!workingDirectory.endsWith("/")) slash="/";
    String fullPathname = currentDirectory + slash + pathname;
    Vector files = sftpClient.ls(fullPathname);
    for(int i=0; i<files.size();i++){
      SFTPv3DirectoryEntry entry = (SFTPv3DirectoryEntry) files.get(i);
      if (!entry.attributes.isDirectory()){
        rvVector.add(pathname+"/"+entry.filename);
      } else if (!entry.filename.equals(".") && !entry.filename.equals("..")){
        nList(rvVector, currentDirectory, pathname+"/"+entry.filename);
      }
View Full Code Here


      }
      Vector files = Client().ls(pathname);
      String[] rvFiles = new String[files.size()];

      for (int i = 0; i < files.size(); i++) {
        SFTPv3DirectoryEntry entry = (SFTPv3DirectoryEntry) files.get(i);
        rvFiles[i] = entry.filename;
      }
      reply = "ls OK";
      return rvFiles;
    }
View Full Code Here

  public void addPath(String path) {
    this.path += path;
  }

  public boolean getAllowsChildren() {
    SFTPv3DirectoryEntry node = (SFTPv3DirectoryEntry) getUserObject();
    if (node != null)
      return node.attributes.isDirectory();
    return false;
  }
View Full Code Here

  public String getPathString() {
    return path;
  }

  public String toString() {
    SFTPv3DirectoryEntry node = (SFTPv3DirectoryEntry) getUserObject();
    if (node != null)
      return node.filename;
    else
      return remoteProject.getName();
  }
View Full Code Here

            try {
                Vector instanceLogFileNames = sftpClient.ls(loggingDir);

                for (int i = 0; i < instanceLogFileNames.size(); i++) {
                    SFTPv3DirectoryEntry file = (SFTPv3DirectoryEntry) instanceLogFileNames.get(i);
                    String fileName = file.filename;
                    // code to remove . and .. file which is return from sftpclient ls method
                    if (!file.attributes.isDirectory() && !fileName.equals(".") && !fileName.equals("..")
                            && fileName.contains(".log") && !fileName.contains(".log.")) {
                        noFileFound = false;
View Full Code Here

            try {
                Vector instanceLogFileNames = sftpClient.ls(sourceDir);

                for (int i = 0; i < instanceLogFileNames.size(); i++) {
                    SFTPv3DirectoryEntry file = (SFTPv3DirectoryEntry) instanceLogFileNames.get(i);
                    String fileName = file.filename;
                    // code to remove . and .. file which is return from sftpclient ls method
                    if (!file.attributes.isDirectory() && !fileName.equals(".") && !fileName.equals("..")
                            && fileName.contains(".log") && !fileName.contains(".log.")) {
                        noFileFound = false;
View Full Code Here

            String loggingDir = getLoggingDirectoryForNode(instanceLogFileDirectory, node, sNode, instanceName);

            try {
                instanceLogFileNames = sftpClient.ls(loggingDir);
                for (int i = 0; i < instanceLogFileNames.size(); i++) {
                    SFTPv3DirectoryEntry file = (SFTPv3DirectoryEntry) instanceLogFileNames.get(i);
                    String fileName = file.filename;
                    // code to remove . and .. file which is return from sftpclient ls method
                    if (!file.attributes.isDirectory() && !fileName.equals(".") && !fileName.equals("..")
                            && fileName.contains(".log") && !fileName.contains(".log.")) {
                        instanceLogFileNamesAsString.add(fileName);
                        noFileFound = false;
                    }
                }
            } catch (Exception ex) {
                // if directory doesn't present or missing on remote machine. It happens due to bug 16451
                noFileFound = true;
            }

            if (noFileFound) {
                // this loop is used when user has changed value for server.log but not restarted the server.
                loggingDir = getLoggingDirectoryForNodeWhenNoFilesFound(instanceLogFileDirectory, node, sNode, instanceName);
                instanceLogFileNames = sftpClient.ls(loggingDir);


                for (int i = 0; i < instanceLogFileNames.size(); i++) {
                    SFTPv3DirectoryEntry file = (SFTPv3DirectoryEntry) instanceLogFileNames.get(i);
                    String fileName = file.filename;
                    // code to remove . and .. file which is return from sftpclient ls method
                    if (!file.attributes.isDirectory() && !fileName.equals(".") && !fileName.equals("..")
                            && fileName.contains(".log") && !fileName.contains(".log.")) {
                        instanceLogFileNamesAsString.add(fileName);
                    }
                }
            }

            sftpClient.close();
        } else if (node.getType().equals("DCOM")) {

            String loggingDir = getLoggingDirectoryForNode(instanceLogFileDirectory, node, sNode, instanceName);

            try {
                DcomInfo info = new DcomInfo(node);
                WindowsRemoteFileSystem wrfs = new WindowsRemoteFileSystem(info.getHost(), info.getUser(), info.getPassword());
                WindowsRemoteFile wrf = new WindowsRemoteFile(wrfs, loggingDir);
                String[] allLogFileNames = wrf.list();

                for (int i = 0; i < allLogFileNames.length; i++) {
                    File file = new File(allLogFileNames[i]);
                    String fileName = file.getName();
                    // code to remove . and .. file which is return
                    if (!fileName.equals(".") && !fileName.equals("..") && fileName.contains(".log")
                            && !fileName.contains(".log.")) {
                        instanceLogFileNamesAsString.add(fileName);
                    }
View Full Code Here

    } else if (es == openProject) {
      if (selectedNode instanceof RemoteProjectMutuableTreeNode) {
        RemoteProjectMutuableTreeNode rNode = (RemoteProjectMutuableTreeNode) selectedNode;
        RemoteProject rProject = rNode.getRemoteProject();
        JSimLogic.getInstance().openConnection(rProject);
        SFTPv3DirectoryEntry entry = JSimLogic.getInstance()
            .getDirectoryEntry(rProject,
                rProject.getPath() + rProject.getName());
        if (entry != null) {
          rNode.setJSimNode(entry);
          rNode.createNodes(true);
View Full Code Here

   * (non-Javadoc)
   *
   * @see javax.swing.ListModel#getElementAt(int)
   */
  public Object getElementAt(int index) {
    SFTPv3DirectoryEntry entry = files.get(index);
    return entry.filename;
  }
View Full Code Here

    files.addElement(entry);
    fireIntervalAdded(this, index, index);
  }
 
  public boolean isElementDirectory(int index){
    SFTPv3DirectoryEntry entry = files.get(index);
    return entry.attributes.isDirectory();
  }
View Full Code Here

TOP

Related Classes of ch.ethz.ssh2.SFTPv3DirectoryEntry

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.