This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 86472 - Validation system should report cases where Exit is not supported
Summary: Validation system should report cases where Exit is not supported
Status: VERIFIED FIXED
Alias: None
Product: soa
Classification: Unclassified
Component: BPEL Validation (show other bugs)
Version: 5.x
Hardware: All All
: P2 blocker (vote)
Assignee: Denis Anisimov
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-10-04 15:09 UTC by Michael Frisino
Modified: 2006-10-17 16:35 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Frisino 2006-10-04 15:09:48 UTC
We did very late re-introduction of Exit activity at request of runtime team.
The IDE currently allows user to add Exit activity to any legal BPEL 2.0
location, as per BPEL 2.0 specification.

However, the BPEL SE runtime will only support the use of Exit under certain
limited use cases. Other cases will not be supported at runtime. The IDE cannot
prevent users from adding the Exit to the unsupported locations. However, the
validation system can/should generate Warning/Error (Error would be best in this
case) that the feature is not supported by runtime.

The rules for error detection are:

-<exit> in a <flow> activity is not supported

-<exit> in <onAlarm> or <onEvent> of an <eventHandler> is not supported. The
only case in which <exit> is supported in the <onAlarm> or <onEvent> is when the
business process does not have a <flow> activity and there are no <onAlarm>s or
<onEvent>s executing in parallel.


Validator will attempt to enforce those rules by:

Assuming this means "exit" not supported ANYWHERE in Flow, no matter how deep
the Flow happens to be. So basically if recursive descent into Flow finds an
Exit, this is not supported.

Also, if we do recursive descent ito Event Handlers and find "Exit" , this too
is not supported - ....  except in extreme case where:
1)there is only one onAlarm or one onEvent child in the EventHandlers?
AND
2) there is no Flow ANYWHERE in the project?  (or does the location of Flow
relative to the EventHandlers matter ? The first rule, above, already addressed
Exit anywhere inside of Flow, so does this case refer to a situation where the
Exit is not inside of a flow? )

Those last two except conditions need clarification from Prashant. It is
possible to keep the rule simple even if it excludes some actually supported
cases (assuming they are not high priority cases).
Comment 1 Michael Frisino 2006-10-04 15:10:33 UTC
Also looking for clarification from runtime team:


> Denis writes: I also don't understand exactly what it means : "and there are
no <onAlarm>s or <onEvent>s executing in parallel."

I beleive this means that the EventHandlers element has not parallel children. -
Basically, it means that the event handlers element can have EXACTLY ONE child
(either an onAlarm or an OnEvent) . Prashant please clarify. I suspect this
means they only support the exit where there is absolutely zero effective
parallelism - i.e. exactly one child in a particular EventHandlers container
.
Comment 2 Michael Frisino 2006-10-04 15:12:04 UTC
Once clarified, these "not supported cases" should be added to BPEL Designer
Guide in the Lanuage section.
Comment 3 Michael Frisino 2006-10-04 15:19:00 UTC
adding Venkat to this list. Venkat, we need clariifcation from Gabe or Prashant.
Comment 4 Venkat Chellasamy 2006-10-05 00:32:43 UTC
Prashant,

can you add your comments for documentation?
Comment 5 prashantbhagat 2006-10-05 00:37:39 UTC
The following cases for exit activity are not supported:

1. <exit> anywhere in a <flow> activity is not supported.
2. <exit> anywhere in <onAlarm> or <onEvent> of an <eventHandler> is not 
supported.

Comment 6 Denis Anisimov 2006-10-05 08:03:41 UTC
Fixed in _dev branch.
Comment 7 Denis Anisimov 2006-10-05 08:43:25 UTC
File [changed]: BPELRuntimeNotSupportedVisitor.java
Url:
http://enterprise.netbeans.org/source/browse/enterprise/bpel/bpelapi/src/org/netbeans/modules/bpel/model/validation/runtime/BPELRuntimeNotSupportedVisitor.java?r1=1.1.2.14.2.1&r2=1.1.2.14.2.2
Delta lines:  +33 -2
--------------------
--- BPELRuntimeNotSupportedVisitor.java	3 Oct 2006 12:11:30 -0000	1.1.2.14.2.1
+++ BPELRuntimeNotSupportedVisitor.java	5 Oct 2006 06:41:23 -0000	1.1.2.14.2.2
@@ -38,6 +38,7 @@
 import org.netbeans.modules.bpel.model.api.CorrelationContainer;
 import org.netbeans.modules.bpel.model.api.CorrelationSetContainer;
 import org.netbeans.modules.bpel.model.api.Documentation;
+import org.netbeans.modules.bpel.model.api.Exit;
 import org.netbeans.modules.bpel.model.api.ExtensibleAssign;
 import org.netbeans.modules.bpel.model.api.ExtensibleElements;
 import org.netbeans.modules.bpel.model.api.Flow;
@@ -47,6 +48,7 @@
 import org.netbeans.modules.bpel.model.api.Invoke;
 import org.netbeans.modules.bpel.model.api.LinkContainer;
 import org.netbeans.modules.bpel.model.api.MessageExchangeContainer;
+import org.netbeans.modules.bpel.model.api.OnAlarmEvent;
 import org.netbeans.modules.bpel.model.api.OnEvent;
 import org.netbeans.modules.bpel.model.api.OnMessage;
 import org.netbeans.modules.bpel.model.api.PartnerLink;
@@ -386,6 +388,22 @@
             addElementError(messageExchangeContainer);
     }
     
+    /* 
+     * Fix for #86472 - Validation system should report cases where Exit is not
supported
+     * (non-Javadoc)
+     * @see
org.netbeans.modules.bpel.model.api.support.BpelModelVisitorAdaptor#visit(org.netbeans.modules.bpel.model.api.Exit)
+     */
+    @Override
+    public void visit( Exit terminate )
+    {
+        super.visit(terminate);
+         BpelContainer container = hasParent(terminate, Flow.class, 
+                 OnEvent.class , OnAlarmEvent.class );
+         if ( container!= null ) {
+             addElementsInParentError(container, terminate);
+         }
+    }
+    
     private void checkAbsenceExtensions( ExtensibleElements element ) {
         if ( element instanceof AbstractDocumentComponent ){
             AbstractDocumentComponent component =
@@ -498,8 +516,21 @@
         }
     }
     
-    private Validator myValidator;
-    
+    private BpelContainer hasParent( BpelEntity entity , 
+            Class<? extends BpelContainer>... types )
+    {
+        BpelContainer parent = entity.getParent();
+        while( parent != null ) {
+            for( Class<? extends BpelContainer> clazz :types ) {
+                if ( clazz.isInstance(parent)) {
+                    return parent;
+                }
+            }
+            parent = parent.getParent();
+        }
+        return null;
+    }
     
+    private Validator myValidator;
     
 }
Comment 8 Michael Frisino 2006-10-05 11:07:56 UTC
I have reviewed code. Also, I have tested on release55_dev. Fix seems to work as
designed. Please commit to release55. Change target milestone to 5.5. Close issue.
Comment 9 Michael Frisino 2006-10-05 14:32:52 UTC
Denis has checked into release55 branch also. Ready for testing.
Comment 10 Mikhail Kondratyev 2006-10-17 16:35:07 UTC
Verified in build from 2006.10.16_1