2 Replies Latest reply on Apr 17, 2007 4:59 AM by tom.baeyens

    bpel2 pvm Node creation and linking

    csouillard

      I can see that in BpelParser, the process activity is created as the following :
      Node scopeActivity = bpelProcess.createNode();
      AbstractDescriptor activityDescriptor = (AbstractDescriptor) parser.parseElement(activityElement, parse, "activities");
      scopeActivity.setBehaviour(activityDescriptor);


      My question is :
      is it true that we should create all Nodes of the process like that ? If yes, how a node knows its father ?
      If no, I think the way to create nodes is to get the father Node from the current Binding and call createNode on it... Is that right ? How can we get the father node ?

        • 1. Re: bpel2 pvm Node creation and linking
          tom.baeyens

           

          // let's create the top level node for the bpel process.
           Node processActivity = bpelProcess.createNode();
           bpelProcess.setInitial(processActivity);
           
           parse.putObject(processActivity);
           try {
           // the activity binding parsers will produce a persistable descriptor
           AbstractDescriptor activityDescriptor = (AbstractDescriptor) parseElement(activityElement, parse, "activities");
           // that descriptor specifies the behaviour of the initial node
           processActivity.setBehaviour(activityDescriptor);
           
           } finally {
           parse.popObject();
           }
           return bpelProcess;
          


          then in the composite node bindings you can do

          Node parentNode = parse.findObject(Node.class);
          


          note that the current search in the contextual objects is based on class name. so you have to make sure that no other Node objects are pushed on the stack then the parent nodes. alternatively, if it would become a problem, you could create a special class for this called ParentNode. or change the parse contextual object mechanism...

          does this help you further ?

          • 2. Re: bpel2 pvm Node creation and linking
            tom.baeyens

            ...in the composite node bindings, the new parent node should be pushed on to the object stack in the parse, similar as in the code snippet above.