Package org.apache.oodt.cas.pushpull.protocol

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


      throws ProtocolException {
    try {
      String pwd = this.currentFolder.getFullName();
      if (!pwd.equals("") && !pwd.startsWith("/"))
        pwd = "/" + pwd;
      return new ProtocolFile(this.getRemoteSite(), new ProtocolPath(pwd, true));
    } catch (Exception e) {
      throw new ProtocolException("Failed to pwd : " + e.getMessage());
    }
  }
View Full Code Here


        Stack<ProtocolFile> files = new Stack<ProtocolFile>();
        files.add(frs.getCurrentFile(remoteSite));

        // start crawling
        while (!files.isEmpty()) {
            ProtocolFile file = files.peek();
            try {
                // if directory, then add its children to the crawl list
                if (file.isDirectory()) {

                    // get next page worth of children
                    List<ProtocolFile> children = frs.getNextPage(file,
                            new ProtocolFileFilter() {
                                public boolean accept(ProtocolFile pFile) {
View Full Code Here

        try {
            LinkedList<ProtocolFile> files = new LinkedList<ProtocolFile>();
            File[] fileList = currentFile.listFiles();
            for (File file : fileList) {
                if (file != null)
                    files.add(new ProtocolFile(this.getRemoteSite(),
                            new ProtocolPath(file.getAbsolutePath(), file
                                    .isDirectory())));
            }
            return files;
        } catch (Exception e) {
View Full Code Here

    }

    @Override
    public ProtocolFile getCurrentWorkingDir() throws ProtocolException {
        try {
            return new ProtocolFile(this.getRemoteSite(), new ProtocolPath(
                    currentFile.getAbsolutePath(), true));
        } catch (Exception e) {
            throw new ProtocolException("Failed to pwd : " + e.getMessage());
        }
    }
View Full Code Here

    return parseLink(currentPath);
  }

  public ProtocolFile getCurrentWorkingDir() throws ProtocolException {
    try {
      return new ProtocolFile(this.getRemoteSite(), currentPath);
    } catch (Exception e) {
      throw new ProtocolException("Failed to get current working directory : "
          + e.getMessage());
    }
  }
View Full Code Here

          String href = link.getUri();
          String linkName = link.getTitle();
          String curPath = this.pwd().getProtocolPath().getPathString();
          String linkPath = curPath + (curPath.endsWith("/") ? "" : "/")
              + linkName;
          children.add(new ProtocolFile(this.getRemoteSite(), new HttpPath(
              linkPath, isDirectory(href, linkPath), new URL(href), path)));
        }
        linkChildren.put(path.getLink().toString(), children);

      } catch (Exception e) {
View Full Code Here

              continue;
            }
          }
        } while (st.hasMoreTokens());
        if (curPath.equals(this.parentPath))
          return new ProtocolFile(this.getRemoteSite(), new HttpPath(path,
              isDir, new URL("http://"
                  + this.getRemoteSite().getURL().getHost() + path), curPath));
      }
      return new ProtocolFile(this.getRemoteSite(), curPath);
    } catch (Exception e) {
      throw new ProtocolException("Failed to get ProtocolPath for " + path);
    }
  }
View Full Code Here

    if (urlString == null)
      throw new Exception("Must specify a url to download: --url <url>");

    URL url = new URL(urlString);
    ProtocolFile urlFile = new ProtocolFile(null, new HttpPath(url.getPath(),
        false, url, null));
    File toFile = new File(downloadToDir, urlFile.getName());
    toFile = toFile.getAbsoluteFile();
    toFile.createNewFile();
    new HttpClient().getFile(urlFile, toFile);
  }
View Full Code Here

            LOG.log(Level.INFO, "Testing protocol "
                    + protocol.getClass().getCanonicalName()
                    + " . . . this may take a few minutes . . .");
            // test ls, cd, and pwd
            this.cdToHOME(protocol);
            ProtocolFile home = this.pwd(protocol);
            this.ls(protocol);
            if (remoteSite.getCdTestDir() != null)
                this.cd(protocol, new ProtocolFile(remoteSite,
                        new ProtocolPath(remoteSite.getCdTestDir(), true)));
            else
                this.cdToROOT(protocol);
            this.cdToHOME(protocol);
            if (home == null || !home.equals(protocol.pwd()))
                throw new ProtocolException(
                        "Home directory not the same after cd");
        } catch (Exception e) {
            LOG.log(Level.SEVERE, "Protocol "
                    + protocol.getClass().getCanonicalName()
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.pushpull.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.