You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ode.apache.org by Stefano Tranquillini <st...@gmail.com> on 2009/12/02 15:45:47 UTC

Parser BPEL

Hi all.
which classes can i take for have the parser of a BPEL?
there's a BPEL api or Library that the ODE used or is a simply DOM parser?
thanks in advance

best

-- 
Stefano

Re: Parser BPEL

Posted by Stefano Tranquillini <st...@gmail.com>.
you are Right, i forgotten about istanceof
thanks.

On Thu, Dec 3, 2009 at 16:37, Tammo van Lessen <tv...@gmail.com> wrote:

> Hi Stefano,
>
> yep, looks ok. instanceof checks would probably be better than
> getType().getLocalPart().equals(...).
>
> Tammo
>
> On 03.12.2009 16:33, Stefano Tranquillini wrote:
> > I solved, or i think so.
> > i create a java project adding these libreries:
> >
> > apache-ode-war-1.3.3/lib/commons-logging-1.1.jar
> > apache-ode-war-1.3.3/lib/log4j-1.2.13.jar
> > apache-ode-war-1.3.3/lib/ode-bpel-api.jar
> > apache-ode-war-1.3.3/lib/ode-bpel-compiler.jar
> > apache-ode-war-1.3.3/lib/ode-bpel-obj.jar
> > apache-ode-war-1.3.3/lib/ode-bpel-schemas.jar
> > apache-ode-war-1.3.3/lib/ode-tools.jar
> > apache-ode-war-1.3.3/lib/ode-utils.jar
> > apache-ode-war-1.3.3/lib/wsdl4j-1.6.1.jar
> > apache-ode-war-1.3.3/lib/xalan-2.7.0-2.jar
> > apache-ode-war-1.3.3/lib/xercesImpl-2.9.0.jar
> > apache-ode-war-1.3.3/lib/commons-collections-3.1.jar
> >
> >
> > and the code is this:
> >
> > to create the Process
> >
> > BpelObjectFactory bof = new BpelObjectFactory();
> > InputSource is = new InputSource("bpel/StartStopAsync.bpel");
> > Process bo = bof.parse(is, null);
> >
> > and then is simple to parse all the code.
> >
> > i need a feedback, i wrote this function in order to read the operation,
> is
> > recurisve:
> >
> > .... how to call the parser function ...
> > Activity root = bo.getRootActivity();
> >              parseActivity(root);
> > .....
> >
> > private static void parseActivity(Activity act) {
> >         if (act.getType().getLocalPart().equals("sequence")){
> >             System.out.println("found a sequence");
> >             SequenceActivity seq = ((SequenceActivity) act);
> >             for (Activity for_act : seq.getActivities()) {
> >                 parseActivity(for_act);
> >             }
> >
> >         } else
> >         if (act.getType().getLocalPart().equals("invoke")){
> >             System.out.println("found an invoke");
> >             InvokeActivity invoke = ((InvokeActivity) act);
> >             System.out.println("parteneLink invoved "
> > +invoke.getPartnerLink());
> >             System.out.println("operation " +invoke.getOperation());
> >             System.out.println();
> >         } else
> >         if (act.getType().getLocalPart().equals("receive")){
> >             System.out.println("found an receive");
> >             ReceiveActivity receive = ((ReceiveActivity) act);
> >             System.out.println("parteneLink invoved "
> > +receive.getPartnerLink());
> >             System.out.println("operation " +receive.getOperation());
> >             System.out.println();
> >         }
> >         if (act.getType().getLocalPart().equals("reply")){
> >             System.out.println("found an replay");
> >             ReplyActivity reply = ((ReplyActivity) act);
> >             System.out.println("parteneLink invoved "
> > +reply.getPartnerLink());
> >             System.out.println("operation " +reply.getOperation());
> >             System.out.println();
> >         }
> >
> >     }
> >
> >
> > is right to do that in this way?
> >
> >
> >
> > On Wed, Dec 2, 2009 at 15:45, Stefano Tranquillini <
> > stefano.tranquillini@gmail.com> wrote:
> >>
> >> Hi all.
> >> which classes can i take for have the parser of a BPEL?
> >> there's a BPEL api or Library that the ODE used or is a simply DOM
> parser?
> >> thanks in advance
> >>
> >> best
> >>
> >> --
> >> Stefano
> >
> >
> >
> > --
> > Stefano
> >
>
>


-- 
Stefano

Re: Parser BPEL

Posted by Tammo van Lessen <tv...@gmail.com>.
Hi Stefano,

yep, looks ok. instanceof checks would probably be better than
getType().getLocalPart().equals(...).

Tammo

On 03.12.2009 16:33, Stefano Tranquillini wrote:
> I solved, or i think so.
> i create a java project adding these libreries:
> 
> apache-ode-war-1.3.3/lib/commons-logging-1.1.jar
> apache-ode-war-1.3.3/lib/log4j-1.2.13.jar
> apache-ode-war-1.3.3/lib/ode-bpel-api.jar
> apache-ode-war-1.3.3/lib/ode-bpel-compiler.jar
> apache-ode-war-1.3.3/lib/ode-bpel-obj.jar
> apache-ode-war-1.3.3/lib/ode-bpel-schemas.jar
> apache-ode-war-1.3.3/lib/ode-tools.jar
> apache-ode-war-1.3.3/lib/ode-utils.jar
> apache-ode-war-1.3.3/lib/wsdl4j-1.6.1.jar
> apache-ode-war-1.3.3/lib/xalan-2.7.0-2.jar
> apache-ode-war-1.3.3/lib/xercesImpl-2.9.0.jar
> apache-ode-war-1.3.3/lib/commons-collections-3.1.jar
> 
> 
> and the code is this:
> 
> to create the Process
> 
> BpelObjectFactory bof = new BpelObjectFactory();
> InputSource is = new InputSource("bpel/StartStopAsync.bpel");
> Process bo = bof.parse(is, null);
> 
> and then is simple to parse all the code.
> 
> i need a feedback, i wrote this function in order to read the operation, is
> recurisve:
> 
> .... how to call the parser function ...
> Activity root = bo.getRootActivity();
>              parseActivity(root);
> .....
> 
> private static void parseActivity(Activity act) {
>         if (act.getType().getLocalPart().equals("sequence")){
>             System.out.println("found a sequence");
>             SequenceActivity seq = ((SequenceActivity) act);
>             for (Activity for_act : seq.getActivities()) {
>                 parseActivity(for_act);
>             }
> 
>         } else
>         if (act.getType().getLocalPart().equals("invoke")){
>             System.out.println("found an invoke");
>             InvokeActivity invoke = ((InvokeActivity) act);
>             System.out.println("parteneLink invoved "
> +invoke.getPartnerLink());
>             System.out.println("operation " +invoke.getOperation());
>             System.out.println();
>         } else
>         if (act.getType().getLocalPart().equals("receive")){
>             System.out.println("found an receive");
>             ReceiveActivity receive = ((ReceiveActivity) act);
>             System.out.println("parteneLink invoved "
> +receive.getPartnerLink());
>             System.out.println("operation " +receive.getOperation());
>             System.out.println();
>         }
>         if (act.getType().getLocalPart().equals("reply")){
>             System.out.println("found an replay");
>             ReplyActivity reply = ((ReplyActivity) act);
>             System.out.println("parteneLink invoved "
> +reply.getPartnerLink());
>             System.out.println("operation " +reply.getOperation());
>             System.out.println();
>         }
> 
>     }
> 
> 
> is right to do that in this way?
> 
> 
> 
> On Wed, Dec 2, 2009 at 15:45, Stefano Tranquillini <
> stefano.tranquillini@gmail.com> wrote:
>>
>> Hi all.
>> which classes can i take for have the parser of a BPEL?
>> there's a BPEL api or Library that the ODE used or is a simply DOM parser?
>> thanks in advance
>>
>> best
>>
>> --
>> Stefano
> 
> 
> 
> --
> Stefano
> 


Re: Parser BPEL

Posted by Stefano Tranquillini <st...@gmail.com>.
I solved, or i think so.
i create a java project adding these libreries:

apache-ode-war-1.3.3/lib/commons-logging-1.1.jar
apache-ode-war-1.3.3/lib/log4j-1.2.13.jar
apache-ode-war-1.3.3/lib/ode-bpel-api.jar
apache-ode-war-1.3.3/lib/ode-bpel-compiler.jar
apache-ode-war-1.3.3/lib/ode-bpel-obj.jar
apache-ode-war-1.3.3/lib/ode-bpel-schemas.jar
apache-ode-war-1.3.3/lib/ode-tools.jar
apache-ode-war-1.3.3/lib/ode-utils.jar
apache-ode-war-1.3.3/lib/wsdl4j-1.6.1.jar
apache-ode-war-1.3.3/lib/xalan-2.7.0-2.jar
apache-ode-war-1.3.3/lib/xercesImpl-2.9.0.jar
apache-ode-war-1.3.3/lib/commons-collections-3.1.jar


and the code is this:

to create the Process

BpelObjectFactory bof = new BpelObjectFactory();
InputSource is = new InputSource("bpel/StartStopAsync.bpel");
Process bo = bof.parse(is, null);

and then is simple to parse all the code.

i need a feedback, i wrote this function in order to read the operation, is
recurisve:

.... how to call the parser function ...
Activity root = bo.getRootActivity();
             parseActivity(root);
.....

private static void parseActivity(Activity act) {
        if (act.getType().getLocalPart().equals("sequence")){
            System.out.println("found a sequence");
            SequenceActivity seq = ((SequenceActivity) act);
            for (Activity for_act : seq.getActivities()) {
                parseActivity(for_act);
            }

        } else
        if (act.getType().getLocalPart().equals("invoke")){
            System.out.println("found an invoke");
            InvokeActivity invoke = ((InvokeActivity) act);
            System.out.println("parteneLink invoved "
+invoke.getPartnerLink());
            System.out.println("operation " +invoke.getOperation());
            System.out.println();
        } else
        if (act.getType().getLocalPart().equals("receive")){
            System.out.println("found an receive");
            ReceiveActivity receive = ((ReceiveActivity) act);
            System.out.println("parteneLink invoved "
+receive.getPartnerLink());
            System.out.println("operation " +receive.getOperation());
            System.out.println();
        }
        if (act.getType().getLocalPart().equals("reply")){
            System.out.println("found an replay");
            ReplyActivity reply = ((ReplyActivity) act);
            System.out.println("parteneLink invoved "
+reply.getPartnerLink());
            System.out.println("operation " +reply.getOperation());
            System.out.println();
        }

    }


is right to do that in this way?



On Wed, Dec 2, 2009 at 15:45, Stefano Tranquillini <
stefano.tranquillini@gmail.com> wrote:
>
> Hi all.
> which classes can i take for have the parser of a BPEL?
> there's a BPEL api or Library that the ODE used or is a simply DOM parser?
> thanks in advance
>
> best
>
> --
> Stefano



--
Stefano