Package org.teiid.query.processor.xml

Examples of org.teiid.query.processor.xml.Program


    public void testTempGroupPlan() throws Exception {
        QueryMetadataInterface qmi = example1();
       
        XMLPlan plan = helpPlan("SELECT * FROM vm1.doc6", qmi); //$NON-NLS-1$
       
        Program program = plan.getOriginalProgram();

        int i = 0;
        assertTrue(program.getInstructionAt(i++) instanceof ExecStagingTableInstruction);
        assertTrue(program.getInstructionAt(i++) instanceof ExecSqlInstruction);
        assertTrue(program.getInstructionAt(i++) instanceof BlockInstruction);
        assertTrue(program.getInstructionAt(i++) instanceof MoveCursorInstruction);
        assertTrue(program.getInstructionAt(i++) instanceof WhileInstruction);
        assertTrue(program.getInstructionAt(i++) instanceof EndBlockInstruction);
        assertTrue(program.getInstructionAt(i++) instanceof ExecStagingTableInstruction);
    }
View Full Code Here


        }
               
    prePlan(planEnv, debug);

        // Generate program to create document
        Program programPlan = XMLPlanToProcessVisitor.planProgram(planEnv.mappingDoc, planEnv);
       
        // create plan from program and initialized environment
        XMLProcessorEnvironment env = planEnv.createProcessorEnvironment(programPlan);   
        XMLPlan plan = new XMLPlan(env);
      plan.setXMLSchemas(metadata.getXMLSchemas(group.getMetadataID()));
View Full Code Here

        // if we are dealing with multiple documents                       
        endFragment(currentProgram, element);       
    }
  
    public void start(MappingSourceNode node, Map context) {
        Program currentProgram = (Program)programStack.peek();
       
        commonStart(node, context);
       
        String source = node.getActualResultSetName();
        ResultSetInfo info= node.getResultSetInfo();
       
        if (info.isJoinedWithParent()) {
            //create a dependent while loop
            JoinedWhileInstruction whileInst = new JoinedWhileInstruction(source, new Integer(info.getMappingClassNumber()),
                                                                          info.getMappingClassSymbol(), node.getResultName());
            currentProgram.addInstruction(whileInst);
           
            Program childProgram = new Program();
            whileInst.setBlockProgram(childProgram);
           
            programStack.push(childProgram);
            return;
        }
       
        // Add instruction to execute relational query
        ExecSqlInstruction sqlInst = new ExecSqlInstruction(source, info);
        currentProgram.addInstruction(sqlInst);
       
        BlockInstruction blockInst = new BlockInstruction(source);
        currentProgram.addInstruction(blockInst);
       
        // Add instruction to read the first row in
        MoveCursorInstruction moveCursor = new MoveCursorInstruction(source);
        currentProgram.addInstruction(moveCursor);

        // set up while instruction, add sub Program
        WhileInstruction whileInst = new WhileInstruction(source);
        currentProgram.addInstruction(whileInst);
       
        Program childProgram = new Program();
        whileInst.setBlockProgram(childProgram);

        // when while is done close the resultset(note that the child program will
        // have all the statements.
        EndBlockInstruction closeInst = new EndBlockInstruction(source);
View Full Code Here

        // are going to loop for children with new program
        programStack.push(childProgram);
    }
   
    public void end(MappingSourceNode node, Map context) {
        Program currentProgram = (Program)programStack.peek();       
       
        String source = node.getActualResultSetName()
        ResultSetInfo info= node.getResultSetInfo();
       
        if (!info.isJoinRoot()) {
            // move to next row.
            currentProgram.addInstruction(new MoveCursorInstruction(source));
        }

        // Since each element with a source started a new program;
        // since now we are done with children, we need to pop to current program                                   
        this.programStack.pop();
View Full Code Here

        }
       
        List stagingTables = node.getStagingTables();
        for (final Iterator i = stagingTables.iterator(); i.hasNext();) {
            final String table = (String)i.next();
            Program currentProgram = (Program)programStack.peek();

            // load staging
            currentProgram.addInstruction(new ExecStagingTableInstruction(table, planEnv.getStagingTableResultsInfo(table)));
           
            // unload sttaging
            String unloadName = planEnv.unLoadResultName(table);
            cleanupProgram.addInstruction(new ExecStagingTableInstruction(unloadName, planEnv.getStagingTableResultsInfo(unloadName)));
        } // for
View Full Code Here

            endRootRecursive(node, context);           
        }
    }
   
    public void start(final MappingRecursiveElement element, Map context){
        Program currentProgram = (Program)programStack.peek();
       
        // if we are dealing with multiple documents
        startFragment(currentProgram, element);
       
        ProcessorInstruction tagInst = TagBuilderVisitor.buildTag(element);
        currentProgram.addInstruction(tagInst);
               
        // this is set by root recursive node. Note that the MappingClass on recursive
        // node is same as the source on the root recursive node.
        Program recursiveProgram = (Program)context.get(element.getMappingClass().toUpperCase());
        IfInstruction ifInst = new IfInstruction();
        RecurseProgramCondition recurseCondition = buildRecurseCondition(element, recursiveProgram);
        ifInst.addCondition(recurseCondition);
        ifInst.setDefaultCondition(new DefaultCondition(new Program()));
       
        currentProgram.addInstruction(ifInst);
    }  
View Full Code Here

       
        currentProgram.addInstruction(ifInst);
    }  
   
    public void end(final MappingRecursiveElement element, Map context){
        Program currentProgram = (Program)programStack.peek();       

        // if we are dealing with multiple documents                       
        endFragment(currentProgram, element);               
    }
View Full Code Here

    public XMLPlanToProcessVisitor(XMLPlannerEnvironment env) {
        this.planEnv = env;
    }

    public void start(MappingDocument doc, Map context) {
        Program currentProgram = new Program();
        this.programStack.push(currentProgram);
    }
View Full Code Here

        // cleanup program will have instructions to unload the staging table.
        originalProgram.addInstructions(cleanupProgram);
    }
       
    public void start(MappingAttribute attribute, Map context){
        Program currentProgram = (Program)this.programStack.peek();
        ProcessorInstruction tagInst = TagBuilderVisitor.buildTag(attribute);
        if (tagInst != null) {
            currentProgram.addInstruction(tagInst);
        }       
    }
View Full Code Here

    public void end(MappingAttribute attribute, Map context){
    }
   
    public void start(MappingCommentNode comment, Map context){
        Program currentProgram = (Program)this.programStack.peek();
        ProcessorInstruction tagInst = TagBuilderVisitor.buildTag(comment);
        if (tagInst != null) {
            currentProgram.addInstruction(tagInst);
        }
    }
View Full Code Here

TOP

Related Classes of org.teiid.query.processor.xml.Program

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.