Package org.apache.oodt.cas.protocol

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


   }
  
   public void testCreateProtocol() throws URISyntaxException {
      DownloadCliAction da = new DownloadCliAction();
      da.setUrl("http://localhost/some/file");
      Protocol protocol = da.createProtocol(pm);
      assertNotNull(protocol);
      assertTrue(protocol instanceof MockProtocol);
      assertEquals("http1", ((MockProtocol) protocol).getFactoryId());
   }
View Full Code Here


  public void testInitialState() {
    assertNotNull(protocolManager.getConfig());
  }
 
  public void testProtocolFactoryMapping() throws URISyntaxException {
    Protocol protocol = protocolManager.getProtocolBySite(new URI("ftp://localhost"), new NoAuthentication(), null);
    assertNotNull(protocol);
    assertTrue(protocol instanceof MockProtocol);
    MockProtocol mockProtocol = (MockProtocol) protocol;
    assertEquals("ftp1", mockProtocol.getFactoryId());
   
View Full Code Here

    assertEquals("ftp1", mockProtocol.getFactoryId());

  }
 
  public void testVerifier() throws URISyntaxException {
    Protocol protocol = protocolManager.getProtocolBySite(new URI("ftp://localhost"), new NoAuthentication(), new ProtocolVerifier() {
      public boolean verify(Protocol protocol, URI site,
          Authentication auth) {
        if (protocol instanceof MockProtocol) {
          MockProtocol mockProtocol = (MockProtocol) protocol;
          return mockProtocol.getFactoryId().equals("ftp3");
View Full Code Here

        }
    }

    Protocol getNextAvaliableSession(RemoteSiteFile file) throws CrawlerException {
        // wait for available session, then load it
        Protocol session;
        while ((session = getSession(file)) == null) {
            try {
                waitMainThread();
            } catch (InterruptedException e1) {
            }
View Full Code Here

     *             If downloading session Protocol has to be reconnected and
     *             there is an error communicating with the server
     */
    synchronized Protocol getSession(RemoteSiteFile file) throws CrawlerException {
        try {
            Protocol session = null;
      if (file.getSite().getMaxConnections() < 0
          || file.getSite().getMaxConnections() > this.getCurrentlyDownloadingFiles().size()) {
              if (avaliableSessions.size() > 0) {
                  session = modifyAvailableSessionForPath(file);
              } else if (numberOfSessions < max_sessions) {
View Full Code Here

        true);
    }

    Protocol modifyAvailableSessionForPath(RemoteSiteFile file)
            throws ProtocolException, RemoteConnectionException {
        Protocol session = getAvailableSession();
        if (!file.getSite().getURL().getHost().equals(
                file.getSite().getURL().getHost())
                || !protocolHandler.isProtocolConnected(session)) {
            protocolHandler.disconnect(session);
            session = protocolHandler.getAppropriateProtocol(file, /* reuse */
 
View Full Code Here

        threadController.execute(new Runnable() {
            @Override
            public void run() {
                boolean successful = false;
                int retries = 0;
                Protocol curSession = session;

                if (FileRetrievalSystem.this.dListener != null)
                    FileRetrievalSystem.this.dListener
                            .downloadStarted(remoteFile.getProtocolFile());
View Full Code Here

   */
  public Protocol getAppropriateProtocol(RemoteSiteFile pFile,
      boolean allowReuse, boolean navigateToPathLoc)
      throws RemoteConnectionException {
    try {
      Protocol protocol = getAppropriateProtocol(pFile, allowReuse);
      if (protocol != null && navigateToPathLoc) {
        if (pFile.isDir())
          this.cd(protocol, pFile);
        else
          this.cd(protocol, new RemoteSiteFile(pFile.getParent(), pFile.getSite()));
View Full Code Here

    return this.getAppropriateProtocolBySite(pFile.getSite(), allowReuse);
  }

  public Protocol getAppropriateProtocolBySite(RemoteSite remoteSite,
      boolean allowReuse) throws ProtocolException {
    Protocol protocol = null;
    if ((allowReuse && ((protocol = reuseProtocols.get(remoteSite.getURL())) == null))
        || !allowReuse) {
      ProtocolFactory protocolFactory = this.urlAndProtocolFactory
          .get(remoteSite.getURL());
      if (protocolFactory == null) {
View Full Code Here

        }
    }

    Protocol getNextAvaliableSession(RemoteSiteFile file) throws CrawlerException {
        // wait for available session, then load it
        Protocol session;
        while ((session = getSession(file)) == null) {
            try {
                waitMainThread();
            } catch (InterruptedException e1) {
            }
View Full Code Here

TOP

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

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.