Package org.apache.droids.api

Examples of org.apache.droids.api.ManagedContentEntity


   
    if (protocol.isAllowed(uri)) {
      if (log.isInfoEnabled()) {
        log.info("Loading " + uri);
      }
      ManagedContentEntity entity = protocol.load(uri);
      try {
        String contentType = entity.getMimeType();
        if (log.isDebugEnabled()) {
          log.debug("Content type " + contentType);
        }
        if (contentType == null){
          log.info("Missing content type... can't parse...");
        }
        else {
          Parser parser = droid.getParserFactory().getParser(contentType);
          if( parser == null ) {
            if (log.isDebugEnabled()) {
              log.debug("Could not find parser for " + contentType);
            }
          }
          else {
            Parse parse = parser.parse(entity, link);
            if( parse.getOutlinks() != null ) {
              Collection<Link> outlinks = getFilteredOutlinks( parse );
              droid.getQueue().addAll( outlinks );
            }
            entity.setParse(parse);
            handle(entity, link);
          }
        }
      } finally {
        entity.finish();
      }
    }
    else {
      if (log.isInfoEnabled()) {
        log.info("Stopping processing since"
View Full Code Here


   
    if (protocol.isAllowed(uri)) {
      if (LOG.isInfoEnabled()) {
        LOG.info("Loading " + uri);
      }
      ManagedContentEntity entity = null;
      try {
        entity = protocol.load(uri);
      } catch(OutOfMemoryError e) {
        LOG.error("Out of memory processing: " + uri + " skipping", e);
        throw new DroidsException(e);
      }
      try {
        String contentType = entity.getMimeType();
        if (LOG.isDebugEnabled()) {
          LOG.debug("Content type " + contentType);
        }
        if (contentType == null){
          LOG.info("Missing content type... can't parse...");
        }
        else {
          Parser parser = droid.getParserFactory().getParser(contentType);
          if( parser == null ) {
            if (LOG.isDebugEnabled()) {
              LOG.debug("Could not find parser for " + contentType);
            }
          }
          else {
            Parse parse = parser.parse(entity, link);
            if( parse.getNewTasks() != null && parse.isFollowed() ) {
              Collection<Link> outlinks = getFilteredOutlinks( parse );
              droid.getQueue().addAll( outlinks );
            }
            entity.setParse(parse);
            handle(entity, link);
          }
        }
      } finally {
        entity.finish();
      }
    }
    else {
      if (LOG.isInfoEnabled()) {
        LOG.info("Stopping processing since"
View Full Code Here

TOP

Related Classes of org.apache.droids.api.ManagedContentEntity

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.