Package org.apache.oodt.cas.pushpull.exceptions

Examples of org.apache.oodt.cas.pushpull.exceptions.ProtocolException


                                    .isDirectory())));
            }
            return files;
        } catch (Exception e) {
            e.printStackTrace();
            throw new ProtocolException("Failed to ls : " + e.getMessage());
        }
    }
View Full Code Here


    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

  protected void chDir(ProtocolPath path) throws ProtocolException {
      try {
          ftp.changeDir(path.getPathString());
      } catch (Exception e) {
          throw new ProtocolException("Failed to cd to " + path + " : "
                  + e.getMessage());
      }
  }
View Full Code Here

  @Override
  public void cdToRoot() throws ProtocolException {
      try {
          chDir(new ProtocolPath("/", true));
      } catch (Exception e) {
          throw new ProtocolException("Failed to cd to root : "
                  + e.getMessage());
      }
  }
View Full Code Here

  public void connect(String host, String username, String password)
          throws ProtocolException {
      try {
          ftp = new FTPClient(host, 21);
      } catch (Exception e) {
          throw new ProtocolException("Failed to connect to: " + host + " : "
                  + e.getMessage());
      }
      isConnected = true;

      try {
          ftp.authorize(username, password);
          ftp.setActive(ftp.setLocalPassive());
      } catch (Exception e) {
          throw new ProtocolException("Failed to login to: " + host + " : "
                  + e.getMessage());
      }
  }
View Full Code Here

  public void disconnectFromServer() throws ProtocolException {
      try {
          ftp.close();
          isConnected = false;
      } catch (Exception e) {
          throw new ProtocolException("Error disconnecting from "
                  + this.getRemoteSite().getURL() + " : " + e.getMessage());
      }
  }
View Full Code Here

          throws ProtocolException {
      try {
          ftp.setActive(ftp.setLocalPassive());
          ftp.get(file.getProtocolPath().getPathString(), toLocalFile);
      } catch (Exception e) {
          throw new ProtocolException("Failed to download: " + file.getName()
                  + " : " + e.getMessage());
      }
  }
View Full Code Here

    isConnected = false;
  }

  protected void chDir(ProtocolPath path) throws ProtocolException {
    if (!(path instanceof HttpPath))
      throw new ProtocolException(
          "HttpClient must receive a HttpPath - failed to cd");

    HttpPath httpPath = (HttpPath) path;
    try {
      if (!this
          .isDirectory(httpPath.getLink().toString(), path.getPathString()))
        throw new ProtocolException(path
            + " is not a directory (mime type must be text/html)");
      this.currentPath = httpPath;
    } catch (Exception e) {
      throw new ProtocolException("Failed to cd to " + path + " : "
          + e.getMessage());
    }
  }
View Full Code Here

      URL newURL = new URL("http://" + host + "/");
      newURL.openStream().close();
      currentPath = parentPath = new HttpPath("/", true, newURL, null);
      isConnected = true;
    } catch (Exception e) {
      throw new ProtocolException("Failed to connect to http://" + host + " : "
          + e.getMessage());
    }
  }
View Full Code Here

        numWritten += numRead;
      }
      in.close();
      out.close();
    } catch (Exception e) {
      throw new ProtocolException("Failed to get file " + file + " : "
          + e.getMessage());
    } finally {
      if (in != null)
        try {
          in.close();
View Full Code Here

TOP

Related Classes of org.apache.oodt.cas.pushpull.exceptions.ProtocolException

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.