Package org.teiid.query.util

Examples of org.teiid.query.util.CommandContext


    }

  private void openPlan() throws TeiidComponentException,
      TeiidProcessingException {
    if (this.contexts != null && !this.contexts.isEmpty()) {
      CommandContext context = updatePlans[planIndex].getContext();
      context.getVariableContext().clear();
      VariableContext currentValues = this.contexts.get(planIndex);
      context.getVariableContext().putAll(currentValues);
    }
    updatePlans[planIndex].reset();
    updatePlans[planIndex].open();
    planOpened[planIndex] = true;
  }
View Full Code Here


    }

    public void helpProcessInstructions(Program prog, XMLProcessorEnvironment env, String expected) throws Exception {
        env.pushProgram(prog);
      XMLPlan plan = new XMLPlan(env);
      TestProcessor.doProcess(plan, new FakeDataManager(), new List[] {Arrays.asList(expected)}, new CommandContext());
    }
View Full Code Here

        FakeXMLProcessorEnvironment env = new FakeXMLProcessorEnvironment();
        Program program = exampleProgram(metadata, env);
       
        BufferManager bufferMgr = BufferManagerFactory.getStandaloneBufferManager();
        XMLPlan temp = new XMLPlan(env);
        CommandContext context = new CommandContext("pid", null, null, null, 1); //$NON-NLS-1$
        temp.initialize(context,null,bufferMgr);

        List schema = new ArrayList();
        schema.add(new ElementSymbol(resultSetName + ElementSymbol.SEPARATOR + "itemNum")); //$NON-NLS-1$
        schema.add(new ElementSymbol(resultSetName + ElementSymbol.SEPARATOR + "itemName")); //$NON-NLS-1$
View Full Code Here

        FakeXMLProcessorEnvironment env = new FakeXMLProcessorEnvironment();
        Program program = exampleProgram2(crit, metadata, env);
               
        BufferManager bufferMgr = BufferManagerFactory.getStandaloneBufferManager();
        XMLPlan temp = new XMLPlan(env);
        CommandContext context = new CommandContext("pid", null, null, null, 1); //$NON-NLS-1$
        temp.initialize(context,null,bufferMgr);
        env.addData(resultSetName, command.getProjectedSymbols(), new List[] {
                    Arrays.asList( new Object[] { "001", "Lamp", new Integer(5) } ),         //$NON-NLS-1$ //$NON-NLS-2$
                    Arrays.asList( new Object[] { "002", "Screwdriver", new Integer(100) } ),         //$NON-NLS-1$ //$NON-NLS-2$
                    Arrays.asList( new Object[] { "003", "Goat", new Integer(4) } )         //$NON-NLS-1$ //$NON-NLS-2$
View Full Code Here

      state.close();
      //}
    }
    if (!state.done) {
      if (state.processor == null) {
        CommandContext subContext = context.clone();
        state.plan.reset();
            state.processor = new QueryProcessor(state.plan, subContext, manager, this.dataMgr);
            if (currentContext != null) {
              state.processor.getContext().pushVariableContext(currentContext);
            }
View Full Code Here

    }
   
    @Override
    public void open() throws TeiidComponentException,
        TeiidProcessingException {
      CommandContext context  = getContext().clone();
      context.pushVariableContext(new VariableContext());
      this.setContext(context);
      DependentProcedureExecutionNode.shareVariableContext(this, context);
      super.open();
    }
View Full Code Here

        unexecutedCommands = new HashSet<Integer>();
        List<Command> commandsToExecute = new ArrayList<Command>(updateCommands.size());
        // Find the commands to be executed
        for (int i = 0; i < updateCommands.size(); i++) {
            Command updateCommand = (Command)updateCommands.get(i).clone();
            CommandContext context = this.getContext();
            if (this.contexts != null && !this.contexts.isEmpty()) {
              context = context.clone();
              context.setVariableContext(this.contexts.get(i));
            }
            boolean needProcessing = false;
            if(shouldEvaluate != null && shouldEvaluate.get(i)) {
                updateCommand = (Command) updateCommand.clone();
                Evaluator eval = getEvaluator(Collections.emptyMap());
                eval.initialize(context, getDataManager());
                AccessNode.rewriteAndEvaluate(updateCommand, eval, context, context.getMetadata());
            }
            needProcessing = RelationalNodeUtil.shouldExecute(updateCommand, true);
            if (needProcessing) {
                commandsToExecute.add(updateCommand);
            } else {
View Full Code Here

   
  public void open()
    throws TeiidComponentException, TeiidProcessingException {
    super.open();
        // Initialize plan for execution
        CommandContext subContext = getContext().clone();
        subContext.pushVariableContext(new VariableContext());
        plan.initialize(subContext, getDataManager(), this.getBufferManager());       
       
        if (openPlanImmediately() && prepareNextCommand()) {
            needsProcessing = true;
            plan.open();
View Full Code Here

      }
    }

    // do a recursion check
    // Add group to recursion stack
    CommandContext context = procEnv.getContext();
    context.pushCall(parentProcCommand.getVirtualGroup().getCanonicalName());
  }
View Full Code Here

    public static TransformationMetadata createMetadata(String vdbFile) {
        return VDBMetadataFactory.getVDBMetadata(vdbFile);
    }
       
    protected void doProcess(QueryMetadataInterface metadata, String sql, CapabilitiesFinder capFinder, ProcessorDataManager dataManager, List[] expectedResults, boolean debug) throws Exception {
      CommandContext context = createCommandContext();
      context.setMetadata(metadata);
        Command command = TestOptimizer.helpGetCommand(sql, metadata, null);

        // plan
        AnalysisRecord analysisRecord = new AnalysisRecord(false, debug);
        ProcessorPlan plan = null;
View Full Code Here

TOP

Related Classes of org.teiid.query.util.CommandContext

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.