Examples of ProtocolFactory


Examples of org.apache.nutch.protocol.ProtocolFactory

        Configuration conf = NutchConfiguration.create();
        for (int i = 0; i < sampleFiles.length; i++) {
            urlString = "file:" + sampleDir + fileSeparator + sampleFiles[i];

            protocol = new ProtocolFactory(conf).getProtocol(urlString);
            content = protocol.getProtocolOutput(new Text(urlString), new CrawlDatum()).getContent();
            parse = new ParseUtil(conf).parseByExtensionId("parse-rss", content).get(content.getUrl());

            //check that there are 3 outlinks:
            //http://test.channel.com
View Full Code Here

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

  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) {
        LinkedList<Class<ProtocolFactory>> protocolClasses = pi
            .getProtocolClassesForProtocolType(remoteSite.getURL()
                .getProtocol());
        for (Class<ProtocolFactory> clazz : protocolClasses) {
          try {
            if ((protocol = (protocolFactory = clazz.newInstance())
                .newInstance()) != null) {
              if (!connect(protocol, remoteSite, true)) {
                LOG.log(
                    Level.WARNING,
                    "ProtocolFactory "
                        + protocolFactory.getClass().getCanonicalName()
                        + " is not compatible with server at "
                        + remoteSite.getURL());
                protocol = null;
              } else {
                this.urlAndProtocolFactory.put(remoteSite.getURL(),
                    protocolFactory);
                break;
              }
            }
          } catch (Exception e) {
            LOG.log(Level.WARNING, "Failed to instanciate protocol " + clazz
                + " for " + remoteSite.getURL());
          }
        }
        if (protocol == null)
          throw new ProtocolException("Failed to get appropriate protocol for "
              + remoteSite);
      } else {
        connect(protocol = protocolFactory.newInstance(), remoteSite, false);
      }
      if (allowReuse)
        this.reuseProtocols.put(remoteSite.getURL(), protocol);
    }
    return protocol;
View Full Code Here

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

  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) {
        LinkedList<Class<ProtocolFactory>> protocolClasses = pi
            .getProtocolClassesForProtocolType(remoteSite.getURL()
                .getProtocol());
        for (Class<ProtocolFactory> clazz : protocolClasses) {
          try {
            if ((protocol = (protocolFactory = clazz.newInstance())
                .newInstance()) != null) {
              if (!connect(protocol, remoteSite, true)) {
                LOG.log(
                    Level.WARNING,
                    "ProtocolFactory "
                        + protocolFactory.getClass().getCanonicalName()
                        + " is not compatible with server at "
                        + remoteSite.getURL());
                protocol = null;
              } else {
                this.urlAndProtocolFactory.put(remoteSite.getURL(),
                    protocolFactory);
                break;
              }
            }
          } catch (Exception e) {
            LOG.log(Level.WARNING, "Failed to instanciate protocol " + clazz
                + " for " + remoteSite.getURL());
          }
        }
        if (protocol == null)
          throw new ProtocolException("Failed to get appropriate protocol for "
              + remoteSite);
      } else {
        connect(protocol = protocolFactory.newInstance(), remoteSite, false);
      }
      if (allowReuse)
        this.reuseProtocols.put(remoteSite.getURL(), protocol);
    }
    return protocol;
View Full Code Here

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

    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) {
                LinkedList<Class<ProtocolFactory>> protocolClasses = pi
                        .getProtocolClassesForProtocolType(remoteSite.getURL()
                                .getProtocol());
                for (Class<ProtocolFactory> clazz : protocolClasses) {
                    try {
                        if ((protocol = (protocolFactory = clazz.newInstance())
                                .newInstance()) != null) {
                            if (!connect(protocol, remoteSite, true)) {
                                LOG.log(Level.WARNING, "ProtocolFactory "
                                        + protocolFactory.getClass()
                                                .getCanonicalName()
                                        + " is not compatible with server at "
                                        + remoteSite.getURL());
                                protocol = null;
                            } else {
                                this.urlAndProtocolFactory.put(remoteSite
                                        .getURL(), protocolFactory);
                                break;
                            }
                        }
                    } catch (Exception e) {
                        LOG.log(Level.WARNING,
                                "Failed to instanciate protocol " + clazz
                                        + " for " + remoteSite.getURL());
                    }
                }
                if (protocol == null)
                    throw new ProtocolException(
                            "Failed to get appropriate protocol for "
                                    + remoteSite);
            } else {
                connect(protocol = protocolFactory.newInstance(), remoteSite,
                        false);
            }
            if (allowReuse)
                this.reuseProtocols.put(remoteSite.getURL(), protocol);
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.