Package org.kitesdk.morphline.api

Examples of org.kitesdk.morphline.api.MorphlineRuntimeException


            if (server != null) {
              try {
                server.stop();
                server.join();
              } catch (Exception e) {
                throw new MorphlineRuntimeException(e);
              }
            }
          }
        }
      }
View Full Code Here


      ArchiveInputStream ais;
      try {
        ArchiveStreamFactory factory = new ArchiveStreamFactory();
        ais = factory.createArchiveInputStream(stream);
      } catch (ArchiveException e) {
        throw new MorphlineRuntimeException("Unable to unpack document stream", e);
      }

      try {
        ArchiveEntry entry = ais.getNextEntry();
        while (entry != null) {
          if (!entry.isDirectory()) {
            if (!parseEntry(ais, entry, extractor, record)) {
              return false;
            }
          }
          entry = ais.getNextEntry();
        }
      } catch (IOException e) {
        throw new MorphlineRuntimeException(e);
      } finally {
        Closeables.closeQuietly(ais);
      }
      return true;
    }
View Full Code Here

  @Override
  protected final boolean doProcess(Record inputRecord, InputStream stream) throws IOException {
    try {
      return doProcess2(inputRecord, stream);
    } catch (SaxonApiException e) {
      throw new MorphlineRuntimeException(e);
    } catch (XMLStreamException e) {
      throw new MorphlineRuntimeException(e);
    }
  }
View Full Code Here

    @Override
    protected boolean doProcess(Record record) {
      try {
        return script.evaluate(record, getConfig(), this, getChild(), getContext(), LOG);
      } catch (ScriptException e) {
        throw new MorphlineRuntimeException("Cannot execute script", e);
      }
    } 
View Full Code Here

              in = new GZIPInputStream(in, 64 * 1024);
            }
            in = new BufferedInputStream(in);
            outputRecord.put(Fields.ATTACHMENT_BODY, in);
          } catch (IOException e) {
            throw new MorphlineRuntimeException(e);
          }
 
          // pass record to next command in chain:
          if (!getChild().process(outputRecord)) {
            return false;
View Full Code Here

          return readColumnWise(reader, template);
        default :
          throw new IllegalStateException();
        }
      } catch (IOException e) {
        throw new MorphlineRuntimeException("IOException while processing attachment "
                + attachmentPath.getName(), e);
      } finally {
        if (reader != null) {
          reader.close();
        }
View Full Code Here

      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

              loader.deleteByQuery(query.toString());
            }
          }
        }
      } 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

          }
          tokenStream.end();
          tokenStream.close();
        }
      } catch (IOException e) {
        throw new MorphlineRuntimeException(e);
      }
     
      // pass record to next command in chain:
      return super.doProcess(record);
    }
View Full Code Here

      if (uniqueKeyName == null || (preserveExisting && doc.getFields().containsKey(uniqueKeyName))) {
        ; // we must preserve the existing id
      } else {
        Object baseId = doc.getFirstValue(baseIdFieldName);
        if (baseId == null) {
          throw new MorphlineRuntimeException("Record field " + baseIdFieldName
              + " must not be null as it is needed as a basis for a unique key for solr doc: " + doc);
        }
        doc.replaceValues(uniqueKeyName, baseId.toString() + "#" + num);         
      }
     
View Full Code Here

TOP

Related Classes of org.kitesdk.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.