Package com.cloudera.cdk.morphline.api

Examples of com.cloudera.cdk.morphline.api.MorphlineRuntimeException


      for (Object event : Notifications.getLifecycleEvents(notification)) {
        if (event == Notifications.LifecycleEvent.BEGIN_TRANSACTION) {
          try {
            loader.beginTransaction();
          } catch (SolrServerException e) {
            throw new MorphlineRuntimeException(e);
          } catch (IOException e) {
            throw new MorphlineRuntimeException(e);
          }
        } else if (event == Notifications.LifecycleEvent.COMMIT_TRANSACTION) {
          try {
            loader.commitTransaction();
          } catch (SolrServerException e) {
            throw new MorphlineRuntimeException(e);
          } catch (IOException e) {
            throw new MorphlineRuntimeException(e);
          }
        }
        else if (event == Notifications.LifecycleEvent.ROLLBACK_TRANSACTION) {
          try {
            loader.rollbackTransaction();
          } catch (SolrServerException e) {
            throw new MorphlineRuntimeException(e);
          } catch (IOException e) {
            throw new MorphlineRuntimeException(e);
          }
        }
        else if (event == Notifications.LifecycleEvent.SHUTDOWN) {
          try {
            loader.shutdown();
          } catch (SolrServerException e) {
            throw new MorphlineRuntimeException(e);
          } catch (IOException e) {
            throw new MorphlineRuntimeException(e);
          }
        }
      }
      super.doNotify(notification);
    }
View Full Code Here


      Timer.Context timerContext = elapsedTime.time();
      SolrInputDocument doc = convert(record);
      try {
        loader.load(doc);
      } catch (IOException e) {
        throw new MorphlineRuntimeException(e);
      } catch (SolrServerException e) {
        throw new MorphlineRuntimeException(e);
      } finally {
        timerContext.stop();
      }
     
      // pass record to next command in chain:     
View Full Code Here

    private String getMediaType(InputStream in, Metadata metadata, boolean excludeParameters) {
      MediaType mediaType;
      try {
        mediaType = getDetector().detect(in, metadata);
      } catch (IOException e) {
        throw new MorphlineRuntimeException(e);
      }
      String mediaTypeStr = mediaType.toString();
      if (excludeParameters) {
        int i = mediaTypeStr.indexOf(';');
        if (i >= 0) {
View Full Code Here

       
        JsonNode json;
        try {
          json = databaseReader.get(addr);
        } catch (IOException e) {
          throw new MorphlineRuntimeException("Cannot perform GeoIP lookup for IP: " + addr, e);
        }
       
        ObjectNode location = (ObjectNode) json.get("location");
        if (location != null) {
          JsonNode jlatitude = location.get("latitude");
View Full Code Here

      } else if (isIgnoringRecoverableExceptions()) {
        LOG.warn("Ignoring recoverable exception in production mode for record: " + record, t);
        return;
      }
    }
    throw new MorphlineRuntimeException(t);
  }
View Full Code Here

    InputStream stream = getAttachmentInputStream(record);
    try {
      return doProcess(record, stream);
    } catch (IOException e) {
      throw new MorphlineRuntimeException(e);
    } finally {
      Closeables.closeQuietly(stream);
    }
  }
View Full Code Here

      return charset;
    }
    List charsets = record.get(Fields.ATTACHMENT_CHARSET);
    if (charsets.size() == 0) {
      // TODO try autodetection (AutoDetectReader)
      throw new MorphlineRuntimeException("Missing charset for record: " + record);
    }
    String charsetName = (String) charsets.get(0);       
    return Charset.forName(charsetName);
  }
View Full Code Here

          }
        }
      }
      LOG.warn("tryRules command found no successful rule");
      if (throwExceptionIfAllRulesFailed) {
        throw new MorphlineRuntimeException("tryRules command found no successful rule for record: " + record);
      }
      return false;
    }
View Full Code Here

TOP

Related Classes of com.cloudera.cdk.morphline.api.MorphlineRuntimeException

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.