You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ode.apache.org by Carlos Cândido <c....@gmail.com> on 2012/07/05 17:43:12 UTC
WS-BPEL New Extension Element
Hello. So I want to create a new Element on the language. Ill explain
what I want, what I've done and what is my question.
Hope that this post, somehow, helps other people.
So, as I said, I want to create an extension Element called "When". It
appears in the language like this:
<bpel:process ...>
...
<bpel:variables>
...
</bpel:variables>
<ns:when name="test">
<bpel:condition ...> $var > 40 </bpel:condition>
<bpel:empty name="emptyTest"... />
</ns:when>
<bpel:sequence> ---> The Activity of this process
.....
</bpel:sequence>
</bpel:process>
It meaning is quite obvious: When the condition is true, run the
activity. I've inspired my code by what I understand ODE does with the
BPEL "if/switch" and "faultHandlers/catch". The if because the when
condition and the Handler because my 'when' its not an activity, its a
handler kind like.
*So, I've changed the ode-bpel-compiler project this way:*
* In the class org.apache.ode.bpel.compiler.bom.Bpel20QNames I add the
'when' QName
* Created a When.class that extends BpelObject with methods
getCondition() and getActivity()
* in the class org.apache.ode.bpel.compiler.bom.BpelObjectFactory i've
added a new line that maps the QName with the When.class
* in the class org.apache.ode.bpel.compiler.bom.Scope added the method
public List<When> getWhenDefs() that return getChildren(When.class)
* in the class org.apache.ode.bpel.compiler.BpelCompiler i've changed
the method compileScope. In this method I add this:
...
for (When when : src.getWhenDecls()) {
try {
compile(when);
} catch (CompilationException ce) {
recoveredFromError(when, ce);
}
}
* and to the compiler class I added the private method compile(When
when) :
private void compile(When src) {
// FIXME: keep track of line on eclipse IDE
final OScope oscope = _structureStack.topScope();
//validate
if (src.getCondition() == null){
CompilationMessage cmsg = new CompilationMessage();
cmsg.messageText = "When must have a condition";
cmsg.severity = CompilationMessage.ERROR;
throw new CompilationException(cmsg);
}
if (src.getActivity() == null){
CompilationMessage cmsg = new CompilationMessage();
cmsg.messageText = "When must have an activity";
cmsg.severity = CompilationMessage.ERROR;
throw new CompilationException(cmsg);
}
OWhen when = new OWhen(_oprocess, oscope);
when.activity = compile(src.getActivity());
when.expression = compileExpr(src.getCondition());
oscope.addWhenDef(when);
if (__log.isDebugEnabled())
__log.debug("Compiled when ");
}
So as you can see, I created also an OWhen class and I've changed the
OScope so it haves the methods add/getWhenDef(). If what I think is
correct, this way I can put the <when> on the <process> and in any
<scope> (but lets ignore that for now).
*At this point, i've changed to the project ode-bpel-obj.*
The OWhen.class is simply this:
package org.apache.ode.bpel.o;
public class OWhen extends OScope {
/**
*
*/
private static final long serialVersionUID = 757712690524854494L;
public OExpression expression;
public OWhen(OProcess owner, OScope oscope) {
super(owner, oscope);
}
}
I've extended the OSCope cause I followed the
OCompensationHandler/OFailureHandler/etc. class.
So at this point I think that I've "teached" ODE compiler how to
transform the new element in something to be used in the runtime. A bpel
process that I deploy doesnt give any compilation error.
*Now im in the ode-bpel-runtime project.*
To see if at Runtime my When info is the scope of the process I've
edited the method run() of the class org.apache.ode.bpel.runtime.PROCESS
adding this:
public void run() {
System.out.println("IS THERE ANY WHEN IN THIS PROCESS SCOPE??");
for (Object o : _oprocess.procesScope.getWhenDefinitions()){
System.out.println(o.getClass());
}
...
}
I've invoked the process and it can see my when declaration. I assume
that everthing that I've build is correct so far.
So now I wanted to somehow see when my when is executed. Aiming that,
I've altered the class org.apache.ode.bpel.runtime.Empty and in the
method run() I've put a system.out.println(...) just to see the empty
activity execution. Notice that there is ONLY ONE empty activity in my
process and its in the When. The process sequence is the hello world.
So here starts my problems. I didnt notice before but when I invoke the
process the Empty activity executes without any command of my part or
any programming. It just printed my "Empty usage detector sysout".
Can someone give me some hints how can I achieve my goal? I think that a
good path is making an odelistener that when recieve an
VariableModificationEvent with the destination variable beeing the $var
(declared in the When condition) he unlocks the When and execute the
Empty activity a single-time.
I really hope that this half tutorial on "how to make a new element on
BPEL" helps some one.
Thanks in advance.
Cheers from Portugal
Re: WS-BPEL New Extension Element
Posted by Carlos Candido <c....@gmail.com>.
Hi Tammo,
Thanks for the answer. I found what you mentioned in the ReceiveGenerator.
You were right!
Now I must end my WHEN extends BpelJacobRunnable with the logic and its
done!
Thanks alot!
By the way, after looking to source like 30 hours this week I realized how
awsome was your work building ODE. I've already learn some programming
tricks just by analysing it. Thanks for sharing knowledge!
Long live apache!
Cheers,
Carlos Cândido
Tammo van Lessen wrote:
>
> Hi Carlos,
>
> your tutorial looks good so far. Just as a side comment: If you aim at
> being standard compliant, you need to wrap your custom activity in a
> <bpel:extensionActivity> element. You may also have a look at ODE's
> experimental branch, which contains basic support for extension
> activities. However, since your activity appears to be a "structured
> activity", i.e. it contains child activities, this support is probably
> too basic.
>
> I'm not sure if I understood your problem correctly. Is it that your
> sysout statement in EMPTY is called even without your when-activity?
> This is probably the case because the ODE compiler automatically
> inserts OEmpty in receive activities. Instead of supporting receive
> activities natively, the compiler translates it into a pick with a
> single onMessage element that contains an empty activity. This is
> semantically equivalent to the receive activity, and is an explanation
> why you see your sysout text even though there is no empty activity in
> your process.
>
> In general recommend to increase the loglevel to debug for
> org.apache.ode.runtime in order to see which activities are being
> executed. You can also register the DebugBpelEventListener.
>
> HTH,
> Tammo
>
> On Thu, Jul 5, 2012 at 5:43 PM, Carlos Cândido <c....@gmail.com>
> wrote:
>> Hello. So I want to create a new Element on the language. Ill explain
>> what I
>> want, what I've done and what is my question.
>> Hope that this post, somehow, helps other people.
>>
>> So, as I said, I want to create an extension Element called "When". It
>> appears in the language like this:
>>
>> <bpel:process ...>
>> ...
>> <bpel:variables>
>> ...
>> </bpel:variables>
>>
>> <ns:when name="test">
>> <bpel:condition ...> $var > 40 </bpel:condition>
>> <bpel:empty name="emptyTest"... />
>> </ns:when>
>>
>> <bpel:sequence> ---> The Activity of this process
>> .....
>> </bpel:sequence>
>> </bpel:process>
>>
>> It meaning is quite obvious: When the condition is true, run the
>> activity.
>> I've inspired my code by what I understand ODE does with the BPEL
>> "if/switch" and "faultHandlers/catch". The if because the when condition
>> and
>> the Handler because my 'when' its not an activity, its a handler kind
>> like.
>>
>>
>> *So, I've changed the ode-bpel-compiler project this way:*
>>
>> * In the class org.apache.ode.bpel.compiler.bom.Bpel20QNames I add the
>> 'when' QName
>>
>> * Created a When.class that extends BpelObject with methods
>> getCondition() and getActivity()
>>
>> * in the class org.apache.ode.bpel.compiler.bom.BpelObjectFactory i've
>> added a new line that maps the QName with the When.class
>>
>> * in the class org.apache.ode.bpel.compiler.bom.Scope added the method
>> public List<When> getWhenDefs() that return getChildren(When.class)
>>
>> * in the class org.apache.ode.bpel.compiler.BpelCompiler i've changed
>> the method compileScope. In this method I add this:
>>
>> ...
>> for (When when : src.getWhenDecls()) {
>> try {
>> compile(when);
>> } catch (CompilationException ce) {
>> recoveredFromError(when, ce);
>> }
>> }
>>
>> * and to the compiler class I added the private method compile(When
>> when) :
>>
>>
>> private void compile(When src) {
>> // FIXME: keep track of line on eclipse IDE
>> final OScope oscope = _structureStack.topScope();
>>
>> //validate
>> if (src.getCondition() == null){
>> CompilationMessage cmsg = new CompilationMessage();
>> cmsg.messageText = "When must have a condition";
>> cmsg.severity = CompilationMessage.ERROR;
>> throw new CompilationException(cmsg);
>> }
>> if (src.getActivity() == null){
>> CompilationMessage cmsg = new CompilationMessage();
>> cmsg.messageText = "When must have an activity";
>> cmsg.severity = CompilationMessage.ERROR;
>> throw new CompilationException(cmsg);
>> }
>>
>> OWhen when = new OWhen(_oprocess, oscope);
>> when.activity = compile(src.getActivity());
>> when.expression = compileExpr(src.getCondition());
>> oscope.addWhenDef(when);
>>
>> if (__log.isDebugEnabled())
>> __log.debug("Compiled when ");
>> }
>>
>>
>> So as you can see, I created also an OWhen class and I've changed the
>> OScope
>> so it haves the methods add/getWhenDef(). If what I think is correct,
>> this
>> way I can put the <when> on the <process> and in any <scope> (but lets
>> ignore that for now).
>>
>> *At this point, i've changed to the project ode-bpel-obj.*
>> The OWhen.class is simply this:
>> package org.apache.ode.bpel.o;
>>
>> public class OWhen extends OScope {
>>
>> /**
>> *
>> */
>> private static final long serialVersionUID = 757712690524854494L;
>> public OExpression expression;
>>
>> public OWhen(OProcess owner, OScope oscope) {
>> super(owner, oscope);
>> }
>>
>> }
>>
>> I've extended the OSCope cause I followed the
>> OCompensationHandler/OFailureHandler/etc. class.
>>
>> So at this point I think that I've "teached" ODE compiler how to
>> transform
>> the new element in something to be used in the runtime. A bpel process
>> that
>> I deploy doesnt give any compilation error.
>>
>> *Now im in the ode-bpel-runtime project.*
>>
>> To see if at Runtime my When info is the scope of the process I've edited
>> the method run() of the class org.apache.ode.bpel.runtime.PROCESS adding
>> this:
>>
>> public void run() {
>>
>> System.out.println("IS THERE ANY WHEN IN THIS PROCESS SCOPE??");
>> for (Object o : _oprocess.procesScope.getWhenDefinitions()){
>> System.out.println(o.getClass());
>> }
>> ...
>> }
>> I've invoked the process and it can see my when declaration. I assume
>> that
>> everthing that I've build is correct so far.
>>
>> So now I wanted to somehow see when my when is executed. Aiming that,
>> I've
>> altered the class org.apache.ode.bpel.runtime.Empty and in the method
>> run()
>> I've put a system.out.println(...) just to see the empty activity
>> execution.
>> Notice that there is ONLY ONE empty activity in my process and its in the
>> When. The process sequence is the hello world.
>> So here starts my problems. I didnt notice before but when I invoke the
>> process the Empty activity executes without any command of my part or any
>> programming. It just printed my "Empty usage detector sysout".
>>
>> Can someone give me some hints how can I achieve my goal? I think that a
>> good path is making an odelistener that when recieve an
>> VariableModificationEvent with the destination variable beeing the $var
>> (declared in the When condition) he unlocks the When and execute the
>> Empty
>> activity a single-time.
>>
>> I really hope that this half tutorial on "how to make a new element on
>> BPEL"
>> helps some one.
>>
>> Thanks in advance.
>> Cheers from Portugal
>
>
>
> --
> Tammo van Lessen - http://www.taval.de
>
>
--
View this message in context: http://old.nabble.com/WS-BPEL-New-Extension-Element-tp34118967p34132047.html
Sent from the Apache Ode User mailing list archive at Nabble.com.
Re: WS-BPEL New Extension Element
Posted by Carlos Candido <c....@gmail.com>.
Hi Tammo,
thank you for the answer. Yes my problem is that my activitys on <When> are
running with the main Scope.
I've been debuging runtime for a couple hours and you are right, its in the
onMessage that comes the Empty activity.
I've edited my process and it looks like this (in a tree form like) now:
/ FaultHandler -> catch (something)-> Wait
process - Sequence -> Receive -> Assign -> Reply
\ When -> Empty
So when I was debuging the compilation I saw how was the catch compiled and
its something like:
- create OCatch, fill attributes
- Compile OCatch as an activity
- generates the OActivity and and compiles the activity inside the catch
(in this case, the Wait)
- add the new OCatch on the OProcess.faultHandler .
Since the catch is never called the Wait is never executed (obvious). Like I
said before, I tryed to compiled my When like the Catch. Since your hint was
aiming the compiler I changed it again. Now my compile(when) is like this:
private void compile(When src) {
// FIXME Auto-generated method stub
final OScope oscope = _structureStack.topScope();
//validations
....
_recoveryContextStack.push(oscope);
OWhen when = new OWhen(_oprocess, oscope);
// _structureStack.push(when,src);
compile(when, src, new Runnable() {
@Override
public void run() {
_structureStack.topScope().activity =
compile(((When)_structureStack.topSource()).getActivity());
((OWhen)_structureStack.topScope()).expression =
compileExpr(((When)_structureStack.topSource()).getCondition());
}
});
oscope.addWhenDef(when);
_recoveryContextStack.pop();
if (__log.isDebugEnabled())
__log.debug("Compiled when ");
}
So basically now I compile the When as an activity just like bpel compile
the Catch and in the Runnable() I order to compile the activity and the
expression (I try to respect how ODE by default compile so I use that
_structureStack trick). I've noticed that compiling this way the attribute
parent of the OEmpty is now the OWhen. This happens because the
compile(when, src, new Runnable().. ) puts the OWhen in the _structureStack.
Ok great.
After that I noticed this lines of code in the compile of catch:
_recoveryContextStack.push(oscope) and _recoveryContextStack.pop(); . I
don't know what it does, but I included it on code.
After this I buildr Ode and it does exactly the same. The run() method of
EMPTY class in ode.runtimes is invoked.
I didn't used the debugevents listener because I debug step by step on
eclipse Debugger So I can understand everything but unfortunaly Im missing
something.
Can you give me a hint about what I am missing? Why my when.activity is
executed and the catch.activity is not? What is the biggest (or smallest)
detail on compiler that makes the catch.activity beeing associated to the
catch?
By the way, congratulations on the ODE. After the analysis that I've made to
the Source I was quite amazed how this all works. Good work guys. I've
learned alot about java programming with ODE source.
Thanks again.
Cheers,
Carlos Cândido
Tammo van Lessen wrote:
>
> Hi Carlos,
>
> your tutorial looks good so far. Just as a side comment: If you aim at
> being standard compliant, you need to wrap your custom activity in a
> <bpel:extensionActivity> element. You may also have a look at ODE's
> experimental branch, which contains basic support for extension
> activities. However, since your activity appears to be a "structured
> activity", i.e. it contains child activities, this support is probably
> too basic.
>
> I'm not sure if I understood your problem correctly. Is it that your
> sysout statement in EMPTY is called even without your when-activity?
> This is probably the case because the ODE compiler automatically
> inserts OEmpty in receive activities. Instead of supporting receive
> activities natively, the compiler translates it into a pick with a
> single onMessage element that contains an empty activity. This is
> semantically equivalent to the receive activity, and is an explanation
> why you see your sysout text even though there is no empty activity in
> your process.
>
> In general recommend to increase the loglevel to debug for
> org.apache.ode.runtime in order to see which activities are being
> executed. You can also register the DebugBpelEventListener.
>
> HTH,
> Tammo
>
> On Thu, Jul 5, 2012 at 5:43 PM, Carlos Cândido <c....@gmail.com>
> wrote:
>> Hello. So I want to create a new Element on the language. Ill explain
>> what I
>> want, what I've done and what is my question.
>> Hope that this post, somehow, helps other people.
>>
>> So, as I said, I want to create an extension Element called "When". It
>> appears in the language like this:
>>
>> <bpel:process ...>
>> ...
>> <bpel:variables>
>> ...
>> </bpel:variables>
>>
>> <ns:when name="test">
>> <bpel:condition ...> $var > 40 </bpel:condition>
>> <bpel:empty name="emptyTest"... />
>> </ns:when>
>>
>> <bpel:sequence> ---> The Activity of this process
>> .....
>> </bpel:sequence>
>> </bpel:process>
>>
>> It meaning is quite obvious: When the condition is true, run the
>> activity.
>> I've inspired my code by what I understand ODE does with the BPEL
>> "if/switch" and "faultHandlers/catch". The if because the when condition
>> and
>> the Handler because my 'when' its not an activity, its a handler kind
>> like.
>>
>>
>> *So, I've changed the ode-bpel-compiler project this way:*
>>
>> * In the class org.apache.ode.bpel.compiler.bom.Bpel20QNames I add the
>> 'when' QName
>>
>> * Created a When.class that extends BpelObject with methods
>> getCondition() and getActivity()
>>
>> * in the class org.apache.ode.bpel.compiler.bom.BpelObjectFactory i've
>> added a new line that maps the QName with the When.class
>>
>> * in the class org.apache.ode.bpel.compiler.bom.Scope added the method
>> public List<When> getWhenDefs() that return getChildren(When.class)
>>
>> * in the class org.apache.ode.bpel.compiler.BpelCompiler i've changed
>> the method compileScope. In this method I add this:
>>
>> ...
>> for (When when : src.getWhenDecls()) {
>> try {
>> compile(when);
>> } catch (CompilationException ce) {
>> recoveredFromError(when, ce);
>> }
>> }
>>
>> * and to the compiler class I added the private method compile(When
>> when) :
>>
>>
>> private void compile(When src) {
>> // FIXME: keep track of line on eclipse IDE
>> final OScope oscope = _structureStack.topScope();
>>
>> //validate
>> if (src.getCondition() == null){
>> CompilationMessage cmsg = new CompilationMessage();
>> cmsg.messageText = "When must have a condition";
>> cmsg.severity = CompilationMessage.ERROR;
>> throw new CompilationException(cmsg);
>> }
>> if (src.getActivity() == null){
>> CompilationMessage cmsg = new CompilationMessage();
>> cmsg.messageText = "When must have an activity";
>> cmsg.severity = CompilationMessage.ERROR;
>> throw new CompilationException(cmsg);
>> }
>>
>> OWhen when = new OWhen(_oprocess, oscope);
>> when.activity = compile(src.getActivity());
>> when.expression = compileExpr(src.getCondition());
>> oscope.addWhenDef(when);
>>
>> if (__log.isDebugEnabled())
>> __log.debug("Compiled when ");
>> }
>>
>>
>> So as you can see, I created also an OWhen class and I've changed the
>> OScope
>> so it haves the methods add/getWhenDef(). If what I think is correct,
>> this
>> way I can put the <when> on the <process> and in any <scope> (but lets
>> ignore that for now).
>>
>> *At this point, i've changed to the project ode-bpel-obj.*
>> The OWhen.class is simply this:
>> package org.apache.ode.bpel.o;
>>
>> public class OWhen extends OScope {
>>
>> /**
>> *
>> */
>> private static final long serialVersionUID = 757712690524854494L;
>> public OExpression expression;
>>
>> public OWhen(OProcess owner, OScope oscope) {
>> super(owner, oscope);
>> }
>>
>> }
>>
>> I've extended the OSCope cause I followed the
>> OCompensationHandler/OFailureHandler/etc. class.
>>
>> So at this point I think that I've "teached" ODE compiler how to
>> transform
>> the new element in something to be used in the runtime. A bpel process
>> that
>> I deploy doesnt give any compilation error.
>>
>> *Now im in the ode-bpel-runtime project.*
>>
>> To see if at Runtime my When info is the scope of the process I've edited
>> the method run() of the class org.apache.ode.bpel.runtime.PROCESS adding
>> this:
>>
>> public void run() {
>>
>> System.out.println("IS THERE ANY WHEN IN THIS PROCESS SCOPE??");
>> for (Object o : _oprocess.procesScope.getWhenDefinitions()){
>> System.out.println(o.getClass());
>> }
>> ...
>> }
>> I've invoked the process and it can see my when declaration. I assume
>> that
>> everthing that I've build is correct so far.
>>
>> So now I wanted to somehow see when my when is executed. Aiming that,
>> I've
>> altered the class org.apache.ode.bpel.runtime.Empty and in the method
>> run()
>> I've put a system.out.println(...) just to see the empty activity
>> execution.
>> Notice that there is ONLY ONE empty activity in my process and its in the
>> When. The process sequence is the hello world.
>> So here starts my problems. I didnt notice before but when I invoke the
>> process the Empty activity executes without any command of my part or any
>> programming. It just printed my "Empty usage detector sysout".
>>
>> Can someone give me some hints how can I achieve my goal? I think that a
>> good path is making an odelistener that when recieve an
>> VariableModificationEvent with the destination variable beeing the $var
>> (declared in the When condition) he unlocks the When and execute the
>> Empty
>> activity a single-time.
>>
>> I really hope that this half tutorial on "how to make a new element on
>> BPEL"
>> helps some one.
>>
>> Thanks in advance.
>> Cheers from Portugal
>
>
>
> --
> Tammo van Lessen - http://www.taval.de
>
>
--
View this message in context: http://old.nabble.com/WS-BPEL-New-Extension-Element-tp34118967p34130419.html
Sent from the Apache Ode User mailing list archive at Nabble.com.
Re: WS-BPEL New Extension Element
Posted by Tammo van Lessen <tv...@gmail.com>.
Hi Carlos,
your tutorial looks good so far. Just as a side comment: If you aim at
being standard compliant, you need to wrap your custom activity in a
<bpel:extensionActivity> element. You may also have a look at ODE's
experimental branch, which contains basic support for extension
activities. However, since your activity appears to be a "structured
activity", i.e. it contains child activities, this support is probably
too basic.
I'm not sure if I understood your problem correctly. Is it that your
sysout statement in EMPTY is called even without your when-activity?
This is probably the case because the ODE compiler automatically
inserts OEmpty in receive activities. Instead of supporting receive
activities natively, the compiler translates it into a pick with a
single onMessage element that contains an empty activity. This is
semantically equivalent to the receive activity, and is an explanation
why you see your sysout text even though there is no empty activity in
your process.
In general recommend to increase the loglevel to debug for
org.apache.ode.runtime in order to see which activities are being
executed. You can also register the DebugBpelEventListener.
HTH,
Tammo
On Thu, Jul 5, 2012 at 5:43 PM, Carlos Cândido <c....@gmail.com> wrote:
> Hello. So I want to create a new Element on the language. Ill explain what I
> want, what I've done and what is my question.
> Hope that this post, somehow, helps other people.
>
> So, as I said, I want to create an extension Element called "When". It
> appears in the language like this:
>
> <bpel:process ...>
> ...
> <bpel:variables>
> ...
> </bpel:variables>
>
> <ns:when name="test">
> <bpel:condition ...> $var > 40 </bpel:condition>
> <bpel:empty name="emptyTest"... />
> </ns:when>
>
> <bpel:sequence> ---> The Activity of this process
> .....
> </bpel:sequence>
> </bpel:process>
>
> It meaning is quite obvious: When the condition is true, run the activity.
> I've inspired my code by what I understand ODE does with the BPEL
> "if/switch" and "faultHandlers/catch". The if because the when condition and
> the Handler because my 'when' its not an activity, its a handler kind like.
>
>
> *So, I've changed the ode-bpel-compiler project this way:*
>
> * In the class org.apache.ode.bpel.compiler.bom.Bpel20QNames I add the
> 'when' QName
>
> * Created a When.class that extends BpelObject with methods
> getCondition() and getActivity()
>
> * in the class org.apache.ode.bpel.compiler.bom.BpelObjectFactory i've
> added a new line that maps the QName with the When.class
>
> * in the class org.apache.ode.bpel.compiler.bom.Scope added the method
> public List<When> getWhenDefs() that return getChildren(When.class)
>
> * in the class org.apache.ode.bpel.compiler.BpelCompiler i've changed
> the method compileScope. In this method I add this:
>
> ...
> for (When when : src.getWhenDecls()) {
> try {
> compile(when);
> } catch (CompilationException ce) {
> recoveredFromError(when, ce);
> }
> }
>
> * and to the compiler class I added the private method compile(When
> when) :
>
>
> private void compile(When src) {
> // FIXME: keep track of line on eclipse IDE
> final OScope oscope = _structureStack.topScope();
>
> //validate
> if (src.getCondition() == null){
> CompilationMessage cmsg = new CompilationMessage();
> cmsg.messageText = "When must have a condition";
> cmsg.severity = CompilationMessage.ERROR;
> throw new CompilationException(cmsg);
> }
> if (src.getActivity() == null){
> CompilationMessage cmsg = new CompilationMessage();
> cmsg.messageText = "When must have an activity";
> cmsg.severity = CompilationMessage.ERROR;
> throw new CompilationException(cmsg);
> }
>
> OWhen when = new OWhen(_oprocess, oscope);
> when.activity = compile(src.getActivity());
> when.expression = compileExpr(src.getCondition());
> oscope.addWhenDef(when);
>
> if (__log.isDebugEnabled())
> __log.debug("Compiled when ");
> }
>
>
> So as you can see, I created also an OWhen class and I've changed the OScope
> so it haves the methods add/getWhenDef(). If what I think is correct, this
> way I can put the <when> on the <process> and in any <scope> (but lets
> ignore that for now).
>
> *At this point, i've changed to the project ode-bpel-obj.*
> The OWhen.class is simply this:
> package org.apache.ode.bpel.o;
>
> public class OWhen extends OScope {
>
> /**
> *
> */
> private static final long serialVersionUID = 757712690524854494L;
> public OExpression expression;
>
> public OWhen(OProcess owner, OScope oscope) {
> super(owner, oscope);
> }
>
> }
>
> I've extended the OSCope cause I followed the
> OCompensationHandler/OFailureHandler/etc. class.
>
> So at this point I think that I've "teached" ODE compiler how to transform
> the new element in something to be used in the runtime. A bpel process that
> I deploy doesnt give any compilation error.
>
> *Now im in the ode-bpel-runtime project.*
>
> To see if at Runtime my When info is the scope of the process I've edited
> the method run() of the class org.apache.ode.bpel.runtime.PROCESS adding
> this:
>
> public void run() {
>
> System.out.println("IS THERE ANY WHEN IN THIS PROCESS SCOPE??");
> for (Object o : _oprocess.procesScope.getWhenDefinitions()){
> System.out.println(o.getClass());
> }
> ...
> }
> I've invoked the process and it can see my when declaration. I assume that
> everthing that I've build is correct so far.
>
> So now I wanted to somehow see when my when is executed. Aiming that, I've
> altered the class org.apache.ode.bpel.runtime.Empty and in the method run()
> I've put a system.out.println(...) just to see the empty activity execution.
> Notice that there is ONLY ONE empty activity in my process and its in the
> When. The process sequence is the hello world.
> So here starts my problems. I didnt notice before but when I invoke the
> process the Empty activity executes without any command of my part or any
> programming. It just printed my "Empty usage detector sysout".
>
> Can someone give me some hints how can I achieve my goal? I think that a
> good path is making an odelistener that when recieve an
> VariableModificationEvent with the destination variable beeing the $var
> (declared in the When condition) he unlocks the When and execute the Empty
> activity a single-time.
>
> I really hope that this half tutorial on "how to make a new element on BPEL"
> helps some one.
>
> Thanks in advance.
> Cheers from Portugal
--
Tammo van Lessen - http://www.taval.de