[overlord-commits] Overlord SVN: r579 - in cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src: test/org/jboss/tools/overlord/cdl/bpel/model/component and 1 other directory.
overlord-commits at lists.jboss.org
overlord-commits at lists.jboss.org
Fri Apr 10 18:48:28 EDT 2009
Author: objectiser
Date: 2009-04-10 18:48:28 -0400 (Fri, 10 Apr 2009)
New Revision: 579
Added:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/CompensationHandler.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/FaultHandlers.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/CompensationHandlerTest.java
Modified:
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/If.java
cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Scope.java
Log:
Modelling compensation and fault handlers as directly contained components within the scope. May also be required for some of the other components of the scope - and fault handlers still needs to be completed with tests.
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/CompensationHandler.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/CompensationHandler.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/CompensationHandler.java 2009-04-10 22:48:28 UTC (rev 579)
@@ -0,0 +1,97 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.bpel.model.component;
+
+import java.util.List;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.ConversionContext;
+import org.scribble.model.Activity;
+
+/**
+ * This class represents the 'compensationHandler' construct contained
+ * within the 'scope' activity.
+ */
+public class CompensationHandler extends BPELElement {
+
+ private static final long serialVersionUID = -1994083560689296558L;
+
+ public static final String COMPENSATIONHANDLER="compensationHandler";
+
+ /**
+ * The constructor for the element.
+ *
+ * @param model The BPEL model
+ * @param activity The XML configuration details for the element
+ */
+ public CompensationHandler(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ super(model, activity);
+
+ m_activity = findChildActivity();
+ }
+
+ /**
+ * The constructor for the element.
+ *
+ * @param model The BPEL model
+ */
+ public CompensationHandler(BPELLanguageModel model) {
+ super(model, COMPENSATIONHANDLER);
+ }
+
+ @Override
+ public void convert(List<Activity> activities, ConversionContext context) {
+ // TODO Auto-generated method stub
+
+ }
+
+ /**
+ * This method sets the activity associated with
+ * the 'else' construct.
+ *
+ * @param act The activity
+ */
+ public void setActivity(BPELElement act) {
+ m_activity = act;
+
+ BPELElement existing=findChildActivity();
+ org.w3c.dom.Element existingElem=null;
+
+ if (existing != null) {
+ existingElem = existing.getDOMElement();
+ }
+
+ org.w3c.dom.Element insertBefore=null;
+
+ setChildElement(existingElem, act,
+ insertBefore);
+ }
+
+ /**
+ * This method returns the activity associated with
+ * the 'else' construct.
+ *
+ * @return The activity
+ */
+ public BPELElement getActivity() {
+ return(m_activity);
+ }
+
+ private BPELElement m_activity;
+}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/FaultHandlers.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/FaultHandlers.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/FaultHandlers.java 2009-04-10 22:48:28 UTC (rev 579)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.bpel.model.component;
+
+import java.util.List;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.ConversionContext;
+import org.scribble.model.Activity;
+
+/**
+ * This class represents the 'faultHandlers' construct contained
+ * within the 'scope' activity.
+ */
+public class FaultHandlers extends BPELElement {
+
+ private static final long serialVersionUID = 4136137332367247503L;
+
+ public static final String FAULTHANDLERS="faultHandlers";
+
+ /**
+ * The constructor for the element.
+ *
+ * @param model The BPEL model
+ * @param activity The XML configuration details for the element
+ */
+ public FaultHandlers(BPELLanguageModel model,
+ org.w3c.dom.Element activity) {
+ super(model, activity);
+ }
+
+ /**
+ * The constructor for the element.
+ *
+ * @param model The BPEL model
+ */
+ public FaultHandlers(BPELLanguageModel model) {
+ super(model, FAULTHANDLERS);
+ }
+
+ @Override
+ public void convert(List<Activity> activities, ConversionContext context) {
+ // TODO Auto-generated method stub
+
+ }
+}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/If.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/If.java 2009-04-10 21:56:57 UTC (rev 578)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/If.java 2009-04-10 22:48:28 UTC (rev 579)
@@ -216,6 +216,11 @@
null);
}
+ /**
+ * This method returns the 'else' path.
+ *
+ * @return The 'else' path
+ */
public Else getElsePath() {
return(m_elsePath);
}
Modified: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Scope.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Scope.java 2009-04-10 21:56:57 UTC (rev 578)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/java/org/jboss/tools/overlord/cdl/bpel/model/component/Scope.java 2009-04-10 22:48:28 UTC (rev 579)
@@ -49,9 +49,17 @@
m_messageExchangesElem = findChildElement("messageExchanges");
m_correlationSetsElem = findChildElement("correlationSets");
m_eventHandlersElem = findChildElement("eventHandlers");
- m_faultHandlersElem = findChildElement("faultHandlers");
- m_compensationHandlerElem = findChildElement("compensationHandler");
m_terminationHandlerElem = findChildElement("terminationHandler");
+
+ org.w3c.dom.Element ch=findChildElement(CompensationHandler.COMPENSATIONHANDLER);
+ if (ch != null) {
+ m_compensationHandler = new CompensationHandler(model, ch);
+ }
+
+ org.w3c.dom.Element fhs=findChildElement(FaultHandlers.FAULTHANDLERS);
+ if (fhs != null) {
+ m_faultHandlers = new FaultHandlers(model, fhs);
+ }
}
/**
@@ -198,6 +206,33 @@
}
/**
+ * This method sets the 'compensationHandler' path.
+ *
+ * @param elem The 'compensationHandler' path
+ */
+ public void setCompensationHandler(CompensationHandler elem) {
+ org.w3c.dom.Element existingElem=null;
+
+ if (m_compensationHandler != null) {
+ existingElem = m_compensationHandler.getDOMElement();
+ }
+
+ m_compensationHandler = elem;
+
+ setChildElement(existingElem, elem,
+ null);
+ }
+
+ /**
+ * This method returns the 'compensationHandler' path.
+ *
+ * @return The 'compensationHandler' path
+ */
+ public CompensationHandler getCompensationHandler() {
+ return(m_compensationHandler);
+ }
+
+ /**
* This method validates the BPEL activity and reports warnings or
* errors to the supplied model listener.
*
@@ -224,9 +259,9 @@
private org.w3c.dom.Element m_messageExchangesElem=null;
private org.w3c.dom.Element m_correlationSetsElem=null;
private org.w3c.dom.Element m_eventHandlersElem=null;
- private org.w3c.dom.Element m_faultHandlersElem=null;
- private org.w3c.dom.Element m_compensationHandlerElem=null;
private org.w3c.dom.Element m_terminationHandlerElem=null;
private java.util.List<Variable> m_variables=new java.util.Vector<Variable>();
+ private CompensationHandler m_compensationHandler=null;
+ private FaultHandlers m_faultHandlers=null;
private BPELElement m_activity;
}
Added: cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/CompensationHandlerTest.java
===================================================================
--- cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/CompensationHandlerTest.java (rev 0)
+++ cdl/trunk/tools/plugins/org.jboss.tools.overlord.cdl.bpel/src/test/org/jboss/tools/overlord/cdl/bpel/model/component/CompensationHandlerTest.java 2009-04-10 22:48:28 UTC (rev 579)
@@ -0,0 +1,74 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, Red Hat Middleware LLC, and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+package org.jboss.tools.overlord.cdl.bpel.model.component;
+
+import org.jboss.tools.overlord.cdl.bpel.model.BPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.DefaultBPELLanguageModel;
+import org.jboss.tools.overlord.cdl.bpel.model.component.Sequence;
+
+import junit.framework.TestCase;
+
+public class CompensationHandlerTest extends TestCase {
+
+ public void testIsActivity() {
+ CompensationHandler act=
+ new CompensationHandler(new DefaultBPELLanguageModel(null));
+
+ if (act.isActivity() == true) {
+ fail("Should NOT be an activity");
+ }
+ }
+
+ public void testBuildCompensationHandler() {
+ BPELLanguageModel model=new DefaultBPELLanguageModel(null);
+
+ String xml="<compensationHandler xmlns=\"http://docs.oasis-open.org/wsbpel/2.0/process/executable\">" +
+ "<sequence/></compensationHandler>";
+ org.w3c.dom.Element elem=null;
+
+ try {
+ javax.xml.parsers.DocumentBuilderFactory factory=
+ javax.xml.parsers.DocumentBuilderFactory.newInstance();
+
+ factory.setNamespaceAware(true);
+
+ javax.xml.parsers.DocumentBuilder builder=
+ factory.newDocumentBuilder();
+
+ java.io.InputStream is=new java.io.ByteArrayInputStream(xml.getBytes());
+
+ org.w3c.dom.Document doc=builder.parse(is);
+ elem = doc.getDocumentElement();
+
+ is.close();
+
+ } catch(Exception e) {
+ fail("Failed to convert to doc");
+ }
+
+ CompensationHandler construct=new CompensationHandler(model, elem);
+
+ if (construct.getActivity() == null) {
+ fail("No activity");
+ }
+
+ if ((construct.getActivity() instanceof Sequence) == false) {
+ fail("Activity is not a sequence");
+ }
+ }
+}
More information about the overlord-commits
mailing list