Package com.odiago.flumebase.plan

Examples of com.odiago.flumebase.plan.NamedSourceNode


    for (String fieldName : fieldNames) {
      AssignedSymbol sym = (AssignedSymbol) outTable.resolve(fieldName).resolveAliases();
      outFields.add(new TypedField(fieldName, sym.getType(), sym.getAssignedName(), fieldName));
    }

    PlanNode node = new NamedSourceNode(mSourceName, outFields);
    planContext.getFlowSpec().addRoot(node);
    Schema outSchema = createFieldSchema(outFields);
    outContext.setSchema(outSchema);
    outContext.setOutFields(outFields);
    node.setAttr(PlanNode.OUTPUT_SCHEMA_ATTR, outSchema);

    return outContext;
  }
View Full Code Here


      EntityTarget targetType = dropNode.getType();
      // Perform the operation.
      mRootSymbolTable.remove(name);
      mSubmitterSession.sendInfo("DROP " + targetType.toString().toUpperCase());
    } else if (node instanceof NamedSourceNode) {
      NamedSourceNode namedInput = (NamedSourceNode) node;
      String streamName = namedInput.getStreamName();
      Symbol symbol = mRootSymbolTable.resolve(streamName).resolveAliases();
      if (null == symbol) {
        throw new DAGOperatorException("No symbol for stream: " + streamName);
      }

      if (!(symbol instanceof StreamSymbol)) {
        throw new DAGOperatorException("Identifier " + streamName + " has type: "
            + symbol.getType() + ", not STREAM.");
      }

      StreamSymbol streamSymbol = (StreamSymbol) symbol;

      switch (streamSymbol.getSourceType()) {
      case File:
        String fileName = streamSymbol.getSource();
        newElem = new FileSourceElement(newContext, fileName, streamSymbol.isLocal(),
            namedInput.getFields(), streamSymbol);
        break;
      case Source:
        if (!streamSymbol.isLocal()) {
          throw new DAGOperatorException("Do not know how to handle a non-local source yet.");
        }
        String flumeSource = streamSymbol.getSource();
        long flowIdNum = mFlowId.getId();
        String flowSourceId = "flumebase-flow-" + flowIdNum + "-" + streamSymbol.getName();
        newElem = new LocalFlumeSourceElement(newContext, flowSourceId,
            mFlumeConfig, flumeSource, (Schema) namedInput.getAttr(PlanNode.OUTPUT_SCHEMA_ATTR),
            namedInput.getFields(), streamSymbol);
        if (!streamSymbol.isLocal()) {
          LOG.info("Created local Flume logical node: " + flowSourceId);
          LOG.info("You may need to connect upstream Flume elements to this source.");
        }

        // Mark Flume as required to execute this flow.
        mLocalFlow.setFlumeRequired(true);
        break;
      case Memory:
        newElem = new LocalInMemSourceElement(newContext,
            namedInput.getFields(), (InMemStreamSymbol) streamSymbol);
        break;
      case Node:
        String nodeSourceId = "flumebase-flow-" + mFlowId.getId() + "-" + streamSymbol.getName();
        newElem = new FlumeNodeElement(newContext, nodeSourceId,
            mFlumeConfig, streamSymbol.getSource(),
            (Schema) namedInput.getAttr(PlanNode.OUTPUT_SCHEMA_ATTR),
            namedInput.getFields(), streamSymbol);

        LOG.info("Created local Flume receiver context: " + nodeSourceId);
        LOG.info("This will be connected to upstream Flume node: " + streamSymbol.getSource());

        // Mark Flume as required to execute this flow.
View Full Code Here

TOP

Related Classes of com.odiago.flumebase.plan.NamedSourceNode

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.