Author: objectiser
Date: 2011-01-30 15:52:55 -0500 (Sun, 30 Jan 2011)
New Revision: 632
Removed:
branches/experimental/2.0.x/bundles/org.savara.protocol/src/main/java/org/savara/protocol/export/text/
branches/experimental/2.0.x/bundles/org.savara.protocol/src/main/java/org/savara/protocol/model/annotation/
Modified:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/generator/GeneratorTest.java
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/resources/results/bpel/
branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/model/annotation/Annotation.java
branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/model/annotation/AnnotationDefinitions.java
branches/experimental/2.0.x/bundles/org.savara.contract/src/main/java/org/savara/contract/model/ContractObject.java
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ChoiceConverterRuleImpl.java
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ConditionalConverterRuleImpl.java
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ConverterUtil.java
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/FinalizeConverterRuleImpl.java
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/FinalizerHandlerConverterRuleImpl.java
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/InteractionConverterRuleImpl.java
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ParallelConverterRuleImpl.java
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/PerformConverterRuleImpl.java
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ProtocolConverterRuleImpl.java
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ProtocolModelConverterRuleImpl.java
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/SequenceConverterRuleImpl.java
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/WhileConverterRuleImpl.java
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/java/org/savara/pi4soa/cdm/parser/ParserTest.java
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/resources/spr/PurchaseGoods.spr
branches/experimental/2.0.x/bundles/org.savara.protocol/src/main/java/org/savara/protocol/contract/generator/impl/ContractIntrospector.java
branches/experimental/2.0.x/bundles/org.savara.protocol/src/main/java/org/savara/protocol/model/util/InteractionUtil.java
branches/experimental/2.0.x/bundles/org.savara.protocol/src/main/java/org/savara/protocol/parser/AnnotationProcessor.java
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/java/org/savara/protocol/contract/generator/GeneratorTest.java
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/java/org/savara/protocol/contract/generator/impl/ContractIntrospectorTest.java
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/java/org/savara/protocol/parser/AnnotationProcessorTest.java
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/java/org/savara/wsdl/generator/WSDLGeneratorTest.java
branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/src/java/org/savara/tools/bpel/generator/Generator.java
Log:
Support new form of scribble annotations.
Modified:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/generator/GeneratorTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/generator/GeneratorTest.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/java/org/savara/bpel/generator/GeneratorTest.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -31,8 +31,6 @@
import org.scribble.common.logging.CachedJournal;
import org.scribble.protocol.model.Role;
import org.scribble.protocol.parser.antlr.ANTLRProtocolParser;
-import org.savara.protocol.contract.generator.ContractGenerator;
-import org.savara.protocol.contract.generator.ContractGeneratorFactory;
import org.savara.protocol.util.ProtocolServices;
public class GeneratorTest {
@@ -99,7 +97,7 @@
org.scribble.protocol.model.ProtocolModel model=null;
ANTLRProtocolParser parser=new ANTLRProtocolParser();
- parser.addAnnotationProcessor(new org.savara.protocol.parser.AnnotationProcessor());
+ parser.setAnnotationProcessor(new org.savara.protocol.parser.AnnotationProcessor());
try {
model = parser.parse(is, journal, null);
@@ -161,12 +159,12 @@
*/
// TODO: SAVARA-167 - issue when projection is based on a sub-protocol
- if
(AnnotationDefinitions.getAnnotation(projected.getProtocol().getProperties(),
+ if
(AnnotationDefinitions.getAnnotation(projected.getProtocol().getAnnotations(),
AnnotationDefinitions.TYPE) == null &&
- AnnotationDefinitions.getAnnotation(model.getProtocol().getProperties(),
+ AnnotationDefinitions.getAnnotation(model.getProtocol().getAnnotations(),
AnnotationDefinitions.TYPE) != null) {
- AnnotationDefinitions.copyAnnotations(model.getProtocol().getProperties(),
- projected.getProtocol().getProperties(), AnnotationDefinitions.TYPE);
+ AnnotationDefinitions.copyAnnotations(model.getProtocol().getAnnotations(),
+ projected.getProtocol().getAnnotations(), AnnotationDefinitions.TYPE);
}
java.util.List<Role> projectedRoles=projected.getRoles();
@@ -198,7 +196,7 @@
new java.util.HashMap<String, String>();
java.util.List<Annotation> list=
-
AnnotationDefinitions.getAnnotations(projected.getProtocol().getProperties(),
+
AnnotationDefinitions.getAnnotations(projected.getProtocol().getAnnotations(),
AnnotationDefinitions.TYPE);
for (Annotation annotation : list) {
Property changes on:
branches/experimental/2.0.x/bundles/org.savara.bpel/src/test/resources/results/bpel
___________________________________________________________________
Name: svn:ignore
+ ESBBroker(a)Broker.generated
ESBBroker(a)Buyer.generated
ESBBroker(a)CreditAgency.generated
ESBBroker(a)SupplierQuoteEngine.generated
ESBBroker(a)SupplierTxnProcessor.generated
PurchaseGoods(a)Buyer.generated
PurchaseGoods(a)CreditAgency.generated
PurchaseGoods(a)Store.generated
ReqRespFault(a)Buyer.generated
ReqRespFault(a)Seller.generated
Modified:
branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/model/annotation/Annotation.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/model/annotation/Annotation.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/model/annotation/Annotation.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -22,8 +22,9 @@
* properties.
*
*/
-public class Annotation {
+public class Annotation implements org.scribble.common.model.Annotation {
+ private String m_id=null;
private String m_name=null;
private java.util.Map<String,Object> m_properties=
new java.util.HashMap<String, Object>();
@@ -33,11 +34,32 @@
*
* @param name The name
*/
- protected Annotation(String name) {
+ public Annotation(String name) {
m_name = name;
}
/**
+ * The constructor initialized with the optional id and
+ * annotation name.
+ *
+ * @param id The optional id
+ * @param name The name
+ */
+ public Annotation(String id, String name) {
+ m_id = id;
+ m_name = name;
+ }
+
+ /**
+ * This method returns the optional id associated with the annotation.
+ *
+ * @return
+ */
+ public String getId() {
+ return(m_id);
+ }
+
+ /**
* This method returns the name.
*
* @return The name
@@ -66,6 +88,31 @@
}
public String toString() {
- return("[[ "+getName()+"("+getProperties()+") ]]");
+ StringBuffer buf=new StringBuffer();
+
+ buf.append(" ");
+ buf.append(getName());
+
+ if (getProperties().size() > 0) {
+ buf.append("(");
+
+ java.util.Set<String> props=getProperties().keySet();
+ boolean f_first=true;
+ for (String prop : props) {
+
+ if (!f_first) {
+ buf.append(",");
+ }
+ buf.append(prop);
+ buf.append("=");
+ buf.append(getProperties().get(prop).toString());
+ f_first = false;
+ }
+
+ buf.append(")");
+ }
+ buf.append(" ");
+
+ return(buf.toString());
}
}
Modified:
branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/model/annotation/AnnotationDefinitions.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/model/annotation/AnnotationDefinitions.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.common/src/main/java/org/savara/common/model/annotation/AnnotationDefinitions.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -63,117 +63,63 @@
public static final String SOURCE_COMPONENT="SourceComponent";
- // Annotation access methods
- private static final String ANNOTATIONS = "Annotations";
-
/**
- * This method returns the list of annotations associated with the supplied model
- * object. If a list does not exist, one will be created if requested.
+ * This method returns the annotation, from the supplied list, with the
+ * supplied name.
*
- * @param modelObjProps The model object properties
- * @param create Whether a list should be create if one does not exist
- * @return The list of annotations, or null if not found and create flag is false
+ * @param annotations The list of annotations
+ * @param name The name
+ * @return The annotation, or null if not found
*/
- @SuppressWarnings("unchecked")
- public static java.util.List<Annotation>
getAnnotations(java.util.Map<String,Object> modelObjProps, boolean create) {
- java.util.List<Annotation> ret=(java.util.List<Annotation>)
- modelObjProps.get(ANNOTATIONS);
+ public static Annotation
getAnnotation(java.util.List<org.scribble.common.model.Annotation> annotations,
+ String name) {
+ Annotation ret=null;
- if (ret == null && create) {
- ret = new java.util.Vector<Annotation>();
- modelObjProps.put(ANNOTATIONS, ret);
+ for (org.scribble.common.model.Annotation an : annotations) {
+ if (an instanceof Annotation && ((Annotation)an).getName().equals(name)) {
+ ret = (Annotation)an;
+ break;
+ }
}
return(ret);
}
-
/**
- * This method creates a new named annotation and adds it to the supplied
- * model object.
+ * This method returns the list of annotations, from the supplied list, with the
+ * supplied name.
*
- * @param modelObjProps The model object properties
- * @param name The name of the annotation to be created
- * @return The created annotation
+ * @param annotations The list of annotations
+ * @param name The name
+ * @return The annotations with the specified name
*/
- public static Annotation createAnnotation(java.util.Map<String,Object>
modelObjProps, String name) {
- Annotation ret=new Annotation(name);
-
- getAnnotations(modelObjProps, true).add(ret);
-
- return(ret);
- }
-
- /**
- * This method returns the list of annotations associated with the supplied model
- * object with the specified name.
- *
- * @param modelObjProps The model object properties
- * @param name The annotation name
- * @return The list of annotations with the supplied name
- */
- @SuppressWarnings("unchecked")
- public static java.util.List<Annotation>
getAnnotations(java.util.Map<String,Object> modelObjProps, String name) {
+ public static java.util.List<Annotation>
getAnnotations(java.util.List<org.scribble.common.model.Annotation> annotations,
+ String name) {
java.util.List<Annotation> ret=new java.util.Vector<Annotation>();
- java.util.List<Annotation> list=(java.util.List<Annotation>)
- modelObjProps.get(ANNOTATIONS);
-
- if (list != null) {
- for (Annotation annotation : list) {
- if (annotation.getName().equals(name)) {
- ret.add(annotation);
- }
+ for (org.scribble.common.model.Annotation an : annotations) {
+ if (an instanceof Annotation && ((Annotation)an).getName().equals(name)) {
+ ret.add((Annotation)an);
}
}
return(ret);
}
-
+
/**
- * This method returns the first annotation associated with the supplied model
- * object with the specified name.
+ * This method copies annotations from the 'from' list, to the 'to'
list, if they
+ * have the specified annotation name.
*
- * @param modelObjProps The model object properties
- * @param name The annotation name
- * @return The first annotation with the supplied name, or null if not found
+ * @param fromAnnotations The 'from' annotations list
+ * @param toAnnotations The 'to' annotations list
+ * @param name The name of the annotation to copy
*/
- @SuppressWarnings("unchecked")
- public static Annotation getAnnotation(java.util.Map<String,Object> modelObjProps,
String name) {
- java.util.List<Annotation> ret=new java.util.Vector<Annotation>();
+ public static void
copyAnnotations(java.util.List<org.scribble.common.model.Annotation>
fromAnnotations,
+ java.util.List<org.scribble.common.model.Annotation> toAnnotations, String name)
{
- java.util.List<Annotation> list=(java.util.List<Annotation>)
- modelObjProps.get(ANNOTATIONS);
-
- if (list != null) {
- for (Annotation annotation : list) {
- if (annotation.getName().equals(name)) {
- ret.add(annotation);
- }
+ for (org.scribble.common.model.Annotation an : fromAnnotations) {
+ if (an instanceof Annotation && ((Annotation)an).getName().equals(name)) {
+ toAnnotations.add((Annotation)an);
}
}
-
- if (ret.size() > 0) {
- return(ret.get(0));
- } else {
- return(null);
- }
}
-
- /**
- * This method copies the named annotation from the 'from' properties to the
- * 'to' properties.
- *
- * @param fromProps The source model object properties
- * @param toProps The target model object properties
- * @param name The annotation name
- */
- public static void copyAnnotations(java.util.Map<String,Object> fromProps,
- java.util.Map<String,Object> toProps, String name) {
- java.util.List<Annotation> fromAnnotations=getAnnotations(fromProps, name);
-
- for (Annotation annotation : fromAnnotations) {
- Annotation toAnnotation=createAnnotation(toProps, name);
- toAnnotation.getProperties().putAll(annotation.getProperties());
- }
- }
}
Modified:
branches/experimental/2.0.x/bundles/org.savara.contract/src/main/java/org/savara/contract/model/ContractObject.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.contract/src/main/java/org/savara/contract/model/ContractObject.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.contract/src/main/java/org/savara/contract/model/ContractObject.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -17,6 +17,8 @@
*/
package org.savara.contract.model;
+import org.savara.common.model.annotation.Annotation;
+
/**
* Generic top level object inherited by all contract objects.
*
@@ -25,6 +27,8 @@
private java.util.Map<String,Object> m_properties=
new java.util.HashMap<String, Object>();
+ private java.util.List<Annotation> m_annotations=
+ new java.util.Vector<Annotation>();
/**
* This method returns the properties associated
@@ -36,4 +40,13 @@
return(m_properties);
}
+ /**
+ * This method returns the list of annotations associated
+ * with the contract object.
+ *
+ * @return The annotations
+ */
+ public java.util.List<Annotation> getAnnotations() {
+ return(m_annotations);
+ }
}
Modified:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ChoiceConverterRuleImpl.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ChoiceConverterRuleImpl.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ChoiceConverterRuleImpl.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -27,7 +27,6 @@
import org.pi4soa.cdl.util.InteractionUtil;
import org.savara.common.model.annotation.Annotation;
import org.savara.common.model.annotation.AnnotationDefinitions;
-import org.savara.protocol.model.util.PropertyName;
import org.scribble.protocol.model.*;
import org.scribble.protocol.model.Choice;
import org.scribble.protocol.model.When;
@@ -133,28 +132,29 @@
}
if (ed.getAction() == ExchangeActionType.RESPOND) {
- Annotation
annotation=AnnotationDefinitions.createAnnotation(block.getProperties(),
- AnnotationDefinitions.CORRELATION);
+ Annotation annotation=new Annotation(AnnotationDefinitions.CORRELATION);
annotation.getProperties().put(AnnotationDefinitions.REPLY_TO_PROPERTY,
ConverterUtil.getLabel(ed));
+ block.getAnnotations().add(annotation);
} else {
// Check if request has response/fault exchanges
java.util.List<ExchangeDetails> resps=
InteractionUtil.getResponseExchangeDetails(ed);
if (resps != null && resps.size() > 0) {
- Annotation
annotation=AnnotationDefinitions.createAnnotation(block.getProperties(),
- AnnotationDefinitions.CORRELATION);
+ Annotation annotation=new Annotation(AnnotationDefinitions.CORRELATION);
annotation.getProperties().put(AnnotationDefinitions.REQUEST_PROPERTY,
ConverterUtil.getLabel(ed));
+ block.getAnnotations().add(annotation);
}
}
- Annotation
scannotation=AnnotationDefinitions.createAnnotation(block.getProperties(),
- AnnotationDefinitions.SOURCE_COMPONENT);
+ Annotation scannotation=new Annotation(AnnotationDefinitions.SOURCE_COMPONENT);
scannotation.getProperties().put(AnnotationDefinitions.ID_PROPERTY,
CDLTypeUtil.getURIFragment(ed));
+
+ block.getAnnotations().add(scannotation);
}
}
@@ -238,11 +238,11 @@
//}
if (ret != null) {
- Annotation scannotation=AnnotationDefinitions.createAnnotation(ret.getProperties(),
- AnnotationDefinitions.SOURCE_COMPONENT);
+ Annotation scannotation=new Annotation(AnnotationDefinitions.SOURCE_COMPONENT);
scannotation.getProperties().put(AnnotationDefinitions.ID_PROPERTY,
CDLTypeUtil.getURIFragment(cdl));
+ ret.getAnnotations().add(scannotation);
}
return(ret);
Modified:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ConditionalConverterRuleImpl.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ConditionalConverterRuleImpl.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ConditionalConverterRuleImpl.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -24,7 +24,6 @@
import org.pi4soa.cdl.util.InteractionUtil;
import org.savara.common.model.annotation.Annotation;
import org.savara.common.model.annotation.AnnotationDefinitions;
-import org.savara.protocol.model.util.PropertyName;
import org.savara.pi4soa.cdm.parser.rules.ChoiceConverterRuleImpl.InteractionLocator;
import org.scribble.protocol.model.*;
import org.scribble.protocol.model.When;
@@ -74,11 +73,12 @@
}
//ret.getSource().setComponentURI(
- Annotation scannotation=AnnotationDefinitions.createAnnotation(ret.getProperties(),
- AnnotationDefinitions.SOURCE_COMPONENT);
+ Annotation scannotation=new Annotation(AnnotationDefinitions.SOURCE_COMPONENT);
scannotation.getProperties().put(AnnotationDefinitions.ID_PROPERTY,
CDLTypeUtil.getURIFragment(cdl));
+ ret.getAnnotations().add(scannotation);
+
When block=new When();
ret.getWhens().add(block);
@@ -105,20 +105,20 @@
ed)));
if (ed.getAction() == ExchangeActionType.RESPOND) {
- Annotation annotation=AnnotationDefinitions.createAnnotation(block.getProperties(),
- AnnotationDefinitions.CORRELATION);
+ Annotation annotation=new Annotation(AnnotationDefinitions.CORRELATION);
annotation.getProperties().put(AnnotationDefinitions.REPLY_TO_PROPERTY,
ConverterUtil.getLabel(ed));
+ block.getAnnotations().add(annotation);
} else {
// Check if request has response/fault exchanges
java.util.List<ExchangeDetails> resps=
InteractionUtil.getResponseExchangeDetails(ed);
if (resps != null && resps.size() > 0) {
- Annotation
annotation=AnnotationDefinitions.createAnnotation(block.getProperties(),
- AnnotationDefinitions.CORRELATION);
+ Annotation annotation=new Annotation(AnnotationDefinitions.CORRELATION);
annotation.getProperties().put(AnnotationDefinitions.REQUEST_PROPERTY,
ConverterUtil.getLabel(ed));
+ block.getAnnotations().add(annotation);
}
}
}
Modified:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ConverterUtil.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ConverterUtil.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ConverterUtil.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -19,8 +19,6 @@
*/
package org.savara.pi4soa.cdm.parser.rules;
-import javax.xml.namespace.QName;
-
import org.pi4soa.cdl.Choreography;
import org.pi4soa.cdl.DefaultCDLVisitor;
import org.pi4soa.cdl.ExchangeDetails;
@@ -31,8 +29,6 @@
import org.pi4soa.common.xml.XMLUtils;
import org.savara.common.model.annotation.Annotation;
import org.savara.common.model.annotation.AnnotationDefinitions;
-import org.savara.protocol.model.util.PropertyName;
-import org.savara.protocol.model.util.TypeSystem;
import org.scribble.protocol.model.*;
/**
@@ -54,8 +50,8 @@
// XML type and an abstract type derived from the
// XML namespace and localpart.
- org.pi4soa.common.xml.XMLPrefixResolver resolver=
- org.pi4soa.cdl.util.CDLTypeUtil.getPrefixResolver(infoType.getPackage());
+ //org.pi4soa.common.xml.XMLPrefixResolver resolver=
+ // org.pi4soa.cdl.util.CDLTypeUtil.getPrefixResolver(infoType.getPackage());
String typeName=null;
// TODO: Need to have general way to convert
@@ -63,12 +59,12 @@
if (org.pi4soa.common.util.NamesUtil.isSet(infoType.getTypeName())) {
typeName = infoType.getTypeName();
- AnnotationDefinitions.createAnnotation(ret.getProperties(),
- AnnotationDefinitions.XSD_TYPE);
+ Annotation scannotation=new Annotation(AnnotationDefinitions.XSD_TYPE);
+ ret.getAnnotations().add(scannotation);
} else if (org.pi4soa.common.util.NamesUtil.isSet(infoType.getElementName())) {
typeName = infoType.getElementName();
- AnnotationDefinitions.createAnnotation(ret.getProperties(),
- AnnotationDefinitions.XSD_ELEMENT);
+ Annotation scannotation=new Annotation(AnnotationDefinitions.XSD_ELEMENT);
+ ret.getAnnotations().add(scannotation);
}
if (typeName != null) {
@@ -170,9 +166,10 @@
Role role=new Role();
role.setName(XMLUtils.getLocalname(ptype.getName()));
- Annotation annotation=AnnotationDefinitions.createAnnotation(role.getProperties(),
AnnotationDefinitions.NAMESPACE);
+ Annotation annotation=new Annotation(AnnotationDefinitions.NAMESPACE);
annotation.getProperties().put(AnnotationDefinitions.NAME_PROPERTY,
CDLTypeUtil.getNamespace(ptype.getName(), ptype, true));
+ role.getAnnotations().add(annotation);
ret.add(role);
}
@@ -188,9 +185,10 @@
Role role=new Role();
role.setName(XMLUtils.getLocalname(pinst.getName()));
- Annotation annotation=AnnotationDefinitions.createAnnotation(role.getProperties(),
AnnotationDefinitions.NAMESPACE);
+ Annotation annotation=new Annotation(AnnotationDefinitions.NAMESPACE);
annotation.getProperties().put(AnnotationDefinitions.NAME_PROPERTY,
CDLTypeUtil.getNamespace(pinst.getName(), pinst, true));
+ role.getAnnotations().add(annotation);
ret.add(role);
}
@@ -259,9 +257,10 @@
Role role=new Role();
role.setName(XMLUtils.getLocalname(ptype.getName()));
- Annotation annotation=AnnotationDefinitions.createAnnotation(role.getProperties(),
AnnotationDefinitions.NAMESPACE);
+ Annotation annotation=new Annotation(AnnotationDefinitions.NAMESPACE);
annotation.getProperties().put(AnnotationDefinitions.NAME_PROPERTY,
CDLTypeUtil.getNamespace(ptype.getName(), ptype, true));
+ role.getAnnotations().add(annotation);
ret.add(role);
}
@@ -278,9 +277,10 @@
Role role=new Role();
role.setName(XMLUtils.getLocalname(pinst.getName()));
- Annotation annotation=AnnotationDefinitions.createAnnotation(role.getProperties(),
AnnotationDefinitions.NAMESPACE);
+ Annotation annotation=new Annotation(AnnotationDefinitions.NAMESPACE);
annotation.getProperties().put(AnnotationDefinitions.NAME_PROPERTY,
CDLTypeUtil.getNamespace(pinst.getName(), pinst, true));
+ role.getAnnotations().add(annotation);
ret.add(role);
}
Modified:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/FinalizeConverterRuleImpl.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/FinalizeConverterRuleImpl.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/FinalizeConverterRuleImpl.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -57,11 +57,11 @@
new org.scribble.protocol.model.Run();
org.pi4soa.cdl.Finalize cdl=(org.pi4soa.cdl.Finalize)cdlType;
- Annotation scannotation=AnnotationDefinitions.createAnnotation(ret.getProperties(),
- AnnotationDefinitions.SOURCE_COMPONENT);
+ Annotation scannotation=new Annotation(AnnotationDefinitions.SOURCE_COMPONENT);
scannotation.getProperties().put(AnnotationDefinitions.ID_PROPERTY,
CDLTypeUtil.getURIFragment(cdl));
+ ret.getAnnotations().add(scannotation);
ProtocolReference ref=new ProtocolReference();
ref.setName(cdl.getChoreography().getName()+"_"+cdl.getFinalizer().getName());
Modified:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/FinalizerHandlerConverterRuleImpl.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/FinalizerHandlerConverterRuleImpl.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/FinalizerHandlerConverterRuleImpl.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -19,21 +19,15 @@
*/
package org.savara.pi4soa.cdm.parser.rules;
-import java.util.logging.Logger;
-
import org.pi4soa.cdl.*;
import org.pi4soa.cdl.Interaction;
import org.pi4soa.cdl.util.CDLTypeUtil;
-import org.pi4soa.common.util.NamesUtil;
-import org.pi4soa.common.xml.XMLUtils;
import org.savara.common.model.annotation.Annotation;
import org.savara.common.model.annotation.AnnotationDefinitions;
import org.scribble.protocol.model.*;
public class FinalizerHandlerConverterRuleImpl implements ConverterRule {
- private static final String CONVERSATION_TYPE = "conversationType";
-
/**
* This method determines whether the rule can be applied
* to the supplied CDL type.
@@ -63,11 +57,11 @@
Protocol ret=new Protocol();
FinalizerHandler choreo=(FinalizerHandler)cdlType;
- Annotation scannotation=AnnotationDefinitions.createAnnotation(ret.getProperties(),
- AnnotationDefinitions.SOURCE_COMPONENT);
+ Annotation scannotation=new Annotation(AnnotationDefinitions.SOURCE_COMPONENT);
scannotation.getProperties().put(AnnotationDefinitions.ID_PROPERTY,
CDLTypeUtil.getURIFragment(choreo));
+ ret.getAnnotations().add(scannotation);
context.pushScope();
@@ -307,5 +301,5 @@
}
*/
- private static Logger logger =
Logger.getLogger("org.pi4soa.scribble.cdm.parser.rules");
+ //private static Logger logger =
Logger.getLogger("org.pi4soa.scribble.cdm.parser.rules");
}
Modified:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/InteractionConverterRuleImpl.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/InteractionConverterRuleImpl.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/InteractionConverterRuleImpl.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -25,7 +25,6 @@
import org.pi4soa.cdl.Interaction;
import org.savara.common.model.annotation.Annotation;
import org.savara.common.model.annotation.AnnotationDefinitions;
-import org.savara.protocol.model.util.PropertyName;
import org.scribble.protocol.model.*;
import org.scribble.protocol.model.Choice;
import org.scribble.protocol.model.When;
@@ -276,11 +275,11 @@
//interaction.getSource().setComponentURI(
- Annotation
scannotation=AnnotationDefinitions.createAnnotation(interaction.getProperties(),
- AnnotationDefinitions.SOURCE_COMPONENT);
+ Annotation scannotation=new Annotation(AnnotationDefinitions.SOURCE_COMPONENT);
scannotation.getProperties().put(AnnotationDefinitions.ID_PROPERTY,
CDLTypeUtil.getURIFragment(details));
+ interaction.getAnnotations().add(scannotation);
// Check if interaction's channel has been explicitly defined
/*
@@ -348,9 +347,9 @@
// Set interface name
if (cdl.getToRoleType() != null) {
// TODO: Deal with interfaces that have multiple behaviours
- Annotation
annotation=AnnotationDefinitions.createAnnotation(interaction.getProperties(),
- AnnotationDefinitions.INTERFACE);
+ Annotation annotation=new Annotation(AnnotationDefinitions.INTERFACE);
annotation.getProperties().put(AnnotationDefinitions.NAME_PROPERTY,
getInterfaceName(cdl));
+ interaction.getAnnotations().add(annotation);
}
interaction.setFromRole(new Role(getFromRole(context, details)));
@@ -382,10 +381,10 @@
InteractionUtil.getResponseExchangeDetails(details);
if (resps != null && resps.size() > 0) {
- Annotation
annotation=AnnotationDefinitions.createAnnotation(interaction.getProperties(),
- AnnotationDefinitions.CORRELATION);
+ Annotation annotation=new Annotation(AnnotationDefinitions.CORRELATION);
annotation.getProperties().put(AnnotationDefinitions.REQUEST_PROPERTY,
ConverterUtil.getLabel(details));
+ interaction.getAnnotations().add(annotation);
}
// Check if fault thrown
@@ -441,10 +440,10 @@
}
if (details.getAction() == ExchangeActionType.RESPOND) {
- Annotation
annotation=AnnotationDefinitions.createAnnotation(interaction.getProperties(),
- AnnotationDefinitions.CORRELATION);
+ Annotation annotation=new Annotation(AnnotationDefinitions.CORRELATION);
annotation.getProperties().put(AnnotationDefinitions.REPLY_TO_PROPERTY,
ConverterUtil.getLabel(details));
+ interaction.getAnnotations().add(annotation);
}
// Check if fault thrown
@@ -743,9 +742,9 @@
ms.setOperation(cdl.getOperation());
if (NamesUtil.isSet(details.getFaultName())) {
- Annotation annotation=AnnotationDefinitions.createAnnotation(parent.getProperties(),
- AnnotationDefinitions.FAULT);
+ Annotation annotation=new Annotation(AnnotationDefinitions.FAULT);
annotation.getProperties().put(AnnotationDefinitions.NAME_PROPERTY,
details.getFaultName());
+ parent.getAnnotations().add(annotation);
}
// Define interaction message type
Modified:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ParallelConverterRuleImpl.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ParallelConverterRuleImpl.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ParallelConverterRuleImpl.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -57,11 +57,11 @@
new org.scribble.protocol.model.Parallel();
org.pi4soa.cdl.Parallel cdl=(org.pi4soa.cdl.Parallel)cdlType;
- Annotation scannotation=AnnotationDefinitions.createAnnotation(ret.getProperties(),
- AnnotationDefinitions.SOURCE_COMPONENT);
+ Annotation scannotation=new Annotation(AnnotationDefinitions.SOURCE_COMPONENT);
scannotation.getProperties().put(AnnotationDefinitions.ID_PROPERTY,
CDLTypeUtil.getURIFragment(cdl));
+ ret.getAnnotations().add(scannotation);
// Process all of the activities within the
// choreography
Modified:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/PerformConverterRuleImpl.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/PerformConverterRuleImpl.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/PerformConverterRuleImpl.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -19,8 +19,6 @@
*/
package org.savara.pi4soa.cdm.parser.rules;
-import java.util.logging.Logger;
-
import org.pi4soa.cdl.*;
import org.pi4soa.cdl.util.CDLTypeUtil;
import org.savara.common.model.annotation.Annotation;
@@ -98,11 +96,11 @@
// possibly when split is supported
}
- Annotation scannotation=AnnotationDefinitions.createAnnotation(run.getProperties(),
- AnnotationDefinitions.SOURCE_COMPONENT);
+ Annotation scannotation=new Annotation(AnnotationDefinitions.SOURCE_COMPONENT);
scannotation.getProperties().put(AnnotationDefinitions.ID_PROPERTY,
CDLTypeUtil.getURIFragment(cdl));
+ run.getAnnotations().add(scannotation);
ProtocolReference ref=new ProtocolReference();
ref.setName(cdl.getChoreography().getName());
@@ -153,5 +151,5 @@
return(ret);
}
- private static Logger logger =
Logger.getLogger("org.savara.pi4soa.cdm.parser.rules");
+ //private static Logger logger =
Logger.getLogger("org.savara.pi4soa.cdm.parser.rules");
}
Modified:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ProtocolConverterRuleImpl.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ProtocolConverterRuleImpl.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ProtocolConverterRuleImpl.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -19,26 +19,11 @@
*/
package org.savara.pi4soa.cdm.parser.rules;
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-
import org.pi4soa.cdl.*;
-import org.pi4soa.cdl.Interaction;
-import org.pi4soa.cdl.interfaces.InterfaceDefinition;
-import org.pi4soa.cdl.interfaces.InterfaceVisitor;
-import org.pi4soa.cdl.interfaces.MessageDefinition;
-import org.pi4soa.cdl.interfaces.OperationDefinition;
-import org.pi4soa.cdl.interfaces.RoleTypeDefinition;
import org.pi4soa.cdl.util.CDLTypeUtil;
-import org.pi4soa.cdl.util.PackageUtil;
import org.pi4soa.common.util.NamesUtil;
-import org.pi4soa.common.xml.XMLUtils;
-import org.savara.protocol.model.util.PropertyName;
-import org.savara.protocol.model.util.TypeSystem;
import org.savara.common.model.annotation.Annotation;
import org.savara.common.model.annotation.AnnotationDefinitions;
-import org.savara.contract.model.*;
import org.scribble.protocol.model.*;
public class ProtocolConverterRuleImpl implements ConverterRule {
@@ -72,11 +57,11 @@
Protocol ret=new Protocol();
Choreography choreo=(Choreography)cdlType;
- Annotation scannotation=AnnotationDefinitions.createAnnotation(ret.getProperties(),
- AnnotationDefinitions.SOURCE_COMPONENT);
+ Annotation scannotation=new Annotation(AnnotationDefinitions.SOURCE_COMPONENT);
scannotation.getProperties().put(AnnotationDefinitions.ID_PROPERTY,
CDLTypeUtil.getURIFragment(choreo));
+ ret.getAnnotations().add(scannotation);
context.pushScope();
@@ -108,14 +93,14 @@
context.setState(r.getName(), r);
// Associate Namespace annotation with protocol
- Annotation annotation=AnnotationDefinitions.getAnnotation(r.getProperties(),
+ Annotation annotation=AnnotationDefinitions.getAnnotation(r.getAnnotations(),
AnnotationDefinitions.NAMESPACE);
if (annotation != null) {
- Annotation pa=AnnotationDefinitions.createAnnotation(ret.getProperties(),
- AnnotationDefinitions.NAMESPACE);
+ Annotation pa=new Annotation(AnnotationDefinitions.NAMESPACE);
pa.getProperties().putAll(annotation.getProperties());
pa.getProperties().put(AnnotationDefinitions.ROLE_PROPERTY, r.getName());
+ ret.getAnnotations().add(pa);
}
}
@@ -633,7 +618,7 @@
}
*/
- private static Logger logger =
Logger.getLogger(ProtocolConverterRuleImpl.class.getPackage().getName());
+ //private static Logger logger =
Logger.getLogger(ProtocolConverterRuleImpl.class.getPackage().getName());
/*
public static class InterfaceVisitorImpl implements InterfaceVisitor,
Modified:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ProtocolModelConverterRuleImpl.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ProtocolModelConverterRuleImpl.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/ProtocolModelConverterRuleImpl.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -63,11 +63,12 @@
ProtocolModel ret=new ProtocolModel();
org.pi4soa.cdl.Package cdlpack=(org.pi4soa.cdl.Package)cdlType;
- Annotation scannotation=AnnotationDefinitions.createAnnotation(ret.getProperties(),
- AnnotationDefinitions.SOURCE_COMPONENT);
+ Annotation scannotation=new Annotation(AnnotationDefinitions.SOURCE_COMPONENT);
scannotation.getProperties().put(AnnotationDefinitions.ID_PROPERTY,
CDLTypeUtil.getURIFragment(cdlpack));
+ ret.getAnnotations().add(scannotation);
+
// Convert information types into type imports
for (org.pi4soa.cdl.InformationType itype :
cdlpack.getTypeDefinitions().getInformationTypes()) {
@@ -131,8 +132,7 @@
while (nss.hasNext()) {
NameSpace ns=nss.next();
- Annotation
type=AnnotationDefinitions.createAnnotation(ret.getProtocol().getProperties(),
- AnnotationDefinitions.TYPE);
+ Annotation type=new Annotation(AnnotationDefinitions.TYPE);
type.getProperties().put(AnnotationDefinitions.NAMESPACE_PROPERTY, ns.getURI());
type.getProperties().put(AnnotationDefinitions.PREFIX_PROPERTY, ns.getPrefix());
@@ -140,6 +140,8 @@
if (ns.getSchemaLocation() != null && ns.getSchemaLocation().trim().length()
> 0) {
type.getProperties().put(AnnotationDefinitions.LOCATION_PROPERTY,
ns.getSchemaLocation());
}
+
+ ret.getProtocol().getAnnotations().add(type);
}
// Move any namespace annotations from sub-protocols to the top level protocol
@@ -148,8 +150,8 @@
ret.getProtocol().visit(new DefaultVisitor() {
public boolean start(Protocol elem) {
if (elem != top) {
- AnnotationDefinitions.copyAnnotations(elem.getProperties(),
- top.getProperties(), AnnotationDefinitions.NAMESPACE);
+ AnnotationDefinitions.copyAnnotations(elem.getAnnotations(),
+ top.getAnnotations(), AnnotationDefinitions.NAMESPACE);
}
return(true);
Modified:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/SequenceConverterRuleImpl.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/SequenceConverterRuleImpl.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/SequenceConverterRuleImpl.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -57,11 +57,11 @@
new org.scribble.protocol.model.Block();
org.pi4soa.cdl.Sequence cdl=(org.pi4soa.cdl.Sequence)cdlType;
- Annotation scannotation=AnnotationDefinitions.createAnnotation(ret.getProperties(),
- AnnotationDefinitions.SOURCE_COMPONENT);
+ Annotation scannotation=new Annotation(AnnotationDefinitions.SOURCE_COMPONENT);
scannotation.getProperties().put(AnnotationDefinitions.ID_PROPERTY,
CDLTypeUtil.getURIFragment(cdl));
+ ret.getAnnotations().add(scannotation);
context.pushState();
Modified:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/WhileConverterRuleImpl.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/WhileConverterRuleImpl.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/main/java/org/savara/pi4soa/cdm/parser/rules/WhileConverterRuleImpl.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -57,11 +57,11 @@
new org.scribble.protocol.model.Repeat();
org.pi4soa.cdl.While cdl=(org.pi4soa.cdl.While)cdlType;
- Annotation scannotation=AnnotationDefinitions.createAnnotation(ret.getProperties(),
- AnnotationDefinitions.SOURCE_COMPONENT);
+ Annotation scannotation=new Annotation(AnnotationDefinitions.SOURCE_COMPONENT);
scannotation.getProperties().put(AnnotationDefinitions.ID_PROPERTY,
CDLTypeUtil.getURIFragment(cdl));
+ ret.getAnnotations().add(scannotation);
context.pushState();
Modified:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/java/org/savara/pi4soa/cdm/parser/ParserTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/java/org/savara/pi4soa/cdm/parser/ParserTest.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/java/org/savara/pi4soa/cdm/parser/ParserTest.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -23,8 +23,6 @@
import junit.framework.TestSuite;
import org.scribble.common.logging.CachedJournal;
-import org.scribble.common.logging.Journal;
-import org.scribble.protocol.export.text.TextProtocolExporterVisitor;
import org.savara.pi4soa.cdm.parser.CDMProtocolParser;
import org.savara.protocol.util.ProtocolServices;
@@ -94,7 +92,7 @@
} else {
org.scribble.protocol.export.text.TextProtocolExporter exporter=
- new org.savara.protocol.export.text.TextProtocolExporter();
+ new org.scribble.protocol.export.text.TextProtocolExporter();
java.io.ByteArrayOutputStream os=new java.io.ByteArrayOutputStream();
Modified:
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/resources/spr/PurchaseGoods.spr
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/resources/spr/PurchaseGoods.spr 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.pi4soa.cdm/src/test/resources/spr/PurchaseGoods.spr 2011-01-30
20:52:55 UTC (rev 632)
@@ -1,15 +1,41 @@
import xsd "{http://www.jboss.org/examples/store}BuyConfirmed" as BuyConfirmed,
"{http://www.jboss.org/examples/store}BuyFailed" as BuyFailed,
"{http://www.jboss.org/examples/store}BuyRequest" as BuyRequest from
"http://www.jboss.org/examples/store";
import xsd "{http://www.jboss.org/examples/creditAgency}CreditCheckInvalid" as
CreditCheckInvalid, "{http://www.jboss.org/examples/creditAgency}CreditCheckOk"
as CreditCheckOk,
"{http://www.jboss.org/examples/creditAgency}CreditCheckRequest" as
CreditCheckRequest from "http://www.jboss.org/examples/creditAgency";
import xsd "{http://www.w3.org/2001/XMLSchema}string" as IDType,
"{http://www.w3.org/2001/XMLSchema}anyURI" as URITokenType from
"http://www.w3.org/2001/XMLSchema";
+[[ SourceComponent(id=//(a)choreographies.0) ]]
+[[
Namespace(name=http://www.jboss.org/savara/examples,role=Buyer) ]]
+[[
Namespace(name=http://www.jboss.org/examples/creditAgency,role=CreditAgency) ]]
+[[
Namespace(name=http://www.jboss.org/examples/store,role=Store) ]]
+[[
Type(prefix=tns,namespace=http://www.jboss.org/savara/examples) ]]
+[[
Type(prefix=xsd,namespace=http://www.w3.org/2001/XMLSchema) ]]
+[[
Type(location=store.xsd,prefix=sto,namespace=http://www.jboss.org/example... ]]
+[[
Type(location=creditAgency.xsd,prefix=ca,namespace=http://www.jboss.org/e...
]]
protocol PurchaseGoodsProcess {
role Buyer, CreditAgency, Store;
+ [[ SourceComponent(id=//@choreographies.0/@activities.0/(a)exchangeDetails.0) ]]
+ [[
Interface(name={http://www.jboss.org/examples/store}StoreInterface) ]]
+ [[ Correlation(request=buy) ]]
buy(BuyRequest) from Buyer to Store;
+ [[ SourceComponent(id=//@choreographies.0/@activities.1/(a)exchangeDetails.0) ]]
+ [[
Interface(name={http://www.jboss.org/examples/creditAgency}CreditAgencyIn... ]]
+ [[ Correlation(request=checkCredit) ]]
checkCredit(CreditCheckRequest) from Store to CreditAgency;
+ [[ SourceComponent(id=//@choreographies.0/(a)activities.2) ]]
choice from CreditAgency to Store {
+ [[ Correlation(replyTo=checkCredit) ]]
checkCredit(CreditCheckOk):
+ [[
SourceComponent(id=//@choreographies.0/@activities.2/@activities.0/@activities.1/(a)exchangeDetails.0)
]]
+ [[
Interface(name={http://www.jboss.org/examples/store}StoreInterface) ]]
+ [[ Correlation(replyTo=buy) ]]
buy(BuyConfirmed) from Store to Buyer;
+ [[ Fault(name=CreditCheckFailed) ]]
+ [[ Correlation(replyTo=checkCredit) ]]
+ [[
SourceComponent(id=//@choreographies.0/@activities.2/@activities.1/@activities.0/(a)exchangeDetails.0)
]]
checkCredit(CreditCheckInvalid):
+ [[
SourceComponent(id=//@choreographies.0/@activities.2/@activities.1/@activities.1/(a)exchangeDetails.0)
]]
+ [[ Fault(name=BuyFailed) ]]
+ [[
Interface(name={http://www.jboss.org/examples/store}StoreInterface) ]]
+ [[ Correlation(replyTo=buy) ]]
buy(BuyFailed) from Store to Buyer;
}
Modified:
branches/experimental/2.0.x/bundles/org.savara.protocol/src/main/java/org/savara/protocol/contract/generator/impl/ContractIntrospector.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.protocol/src/main/java/org/savara/protocol/contract/generator/impl/ContractIntrospector.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.protocol/src/main/java/org/savara/protocol/contract/generator/impl/ContractIntrospector.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -25,7 +25,6 @@
import java.util.logging.Logger;
import org.savara.protocol.model.util.InteractionUtil;
-import org.savara.protocol.model.util.PropertyName;
import org.savara.common.model.annotation.Annotation;
import org.savara.common.model.annotation.AnnotationDefinitions;
import org.savara.contract.model.Contract;
@@ -37,13 +36,10 @@
import org.savara.contract.model.Type;
import org.savara.contract.model.TypeDefinition;
import org.scribble.common.logging.Journal;
-import org.scribble.protocol.model.AbstractModelObjectVisitor;
-import org.scribble.protocol.model.Choice;
import org.scribble.protocol.model.DefaultVisitor;
import org.scribble.protocol.model.Protocol;
import org.scribble.protocol.model.Interaction;
import org.scribble.protocol.model.Run;
-import org.scribble.protocol.model.ModelObject;
import org.scribble.protocol.model.Role;
import org.scribble.protocol.model.TypeImport;
import org.scribble.protocol.model.TypeImportList;
@@ -101,7 +97,7 @@
m_contract.setName(m_serverRole.getName());
- java.util.List<Annotation>
annotations=AnnotationDefinitions.getAnnotations(protocol.getProperties(),
+ java.util.List<Annotation>
annotations=AnnotationDefinitions.getAnnotations(protocol.getAnnotations(),
AnnotationDefinitions.NAMESPACE);
if (annotations != null) {
for (Annotation annotation : annotations) {
Modified:
branches/experimental/2.0.x/bundles/org.savara.protocol/src/main/java/org/savara/protocol/model/util/InteractionUtil.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.protocol/src/main/java/org/savara/protocol/model/util/InteractionUtil.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.protocol/src/main/java/org/savara/protocol/model/util/InteractionUtil.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -152,7 +152,7 @@
public static String getRequestLabel(Interaction interaction) {
String ret=null;
- Annotation annotation=AnnotationDefinitions.getAnnotation(interaction.getProperties(),
+ Annotation
annotation=AnnotationDefinitions.getAnnotation(interaction.getAnnotations(),
AnnotationDefinitions.CORRELATION);
if (annotation != null) {
ret = (String)annotation.getProperties().get(AnnotationDefinitions.REQUEST_PROPERTY);
@@ -162,7 +162,7 @@
public static String getReplyToLabel(Interaction interaction) {
String ret=null;
- Annotation annotation=AnnotationDefinitions.getAnnotation(interaction.getProperties(),
+ Annotation
annotation=AnnotationDefinitions.getAnnotation(interaction.getAnnotations(),
AnnotationDefinitions.CORRELATION);
if (annotation != null) {
ret =
(String)annotation.getProperties().get(AnnotationDefinitions.REPLY_TO_PROPERTY);
@@ -172,7 +172,7 @@
public static String getRequestLabel(When interaction) {
String ret=null;
- Annotation annotation=AnnotationDefinitions.getAnnotation(interaction.getProperties(),
+ Annotation
annotation=AnnotationDefinitions.getAnnotation(interaction.getAnnotations(),
AnnotationDefinitions.CORRELATION);
if (annotation != null) {
ret = (String)annotation.getProperties().get(AnnotationDefinitions.REQUEST_PROPERTY);
@@ -182,7 +182,7 @@
public static String getReplyToLabel(When interaction) {
String ret=null;
- Annotation annotation=AnnotationDefinitions.getAnnotation(interaction.getProperties(),
+ Annotation
annotation=AnnotationDefinitions.getAnnotation(interaction.getAnnotations(),
AnnotationDefinitions.CORRELATION);
if (annotation != null) {
ret =
(String)annotation.getProperties().get(AnnotationDefinitions.REPLY_TO_PROPERTY);
@@ -271,7 +271,7 @@
boolean ret=false;
if (isResponse(interaction) &&
- AnnotationDefinitions.getAnnotation(interaction.getProperties(),
+ AnnotationDefinitions.getAnnotation(interaction.getAnnotations(),
AnnotationDefinitions.FAULT) != null) {
ret = true;
}
@@ -290,7 +290,7 @@
boolean ret=false;
if (InteractionUtil.isResponse(interaction) &&
- AnnotationDefinitions.getAnnotation(interaction.getProperties(),
+ AnnotationDefinitions.getAnnotation(interaction.getAnnotations(),
AnnotationDefinitions.FAULT) != null) {
ret = true;
}
@@ -307,7 +307,7 @@
*/
public static String getFaultName(Interaction interaction) {
String ret=null;
- Annotation annotation=AnnotationDefinitions.getAnnotation(interaction.getProperties(),
+ Annotation
annotation=AnnotationDefinitions.getAnnotation(interaction.getAnnotations(),
AnnotationDefinitions.FAULT);
if (annotation != null) {
@@ -326,7 +326,7 @@
*/
public static String getFaultName(When interaction) {
String ret=null;
- Annotation annotation=AnnotationDefinitions.getAnnotation(interaction.getProperties(),
+ Annotation
annotation=AnnotationDefinitions.getAnnotation(interaction.getAnnotations(),
AnnotationDefinitions.FAULT);
if (annotation != null) {
Modified:
branches/experimental/2.0.x/bundles/org.savara.protocol/src/main/java/org/savara/protocol/parser/AnnotationProcessor.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.protocol/src/main/java/org/savara/protocol/parser/AnnotationProcessor.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.protocol/src/main/java/org/savara/protocol/parser/AnnotationProcessor.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -18,19 +18,17 @@
package org.savara.protocol.parser;
import org.savara.common.model.annotation.Annotation;
-import org.savara.common.model.annotation.AnnotationDefinitions;
import org.scribble.common.logging.Journal;
-import org.scribble.protocol.model.ModelObject;
public class AnnotationProcessor implements
org.scribble.protocol.parser.antlr.AnnotationProcessor {
- public void process(String annotation, ModelObject modelObject,
- Journal journal) {
+ public Annotation getAnnotation(String annotation, java.util.Map<String, Object>
properties,
+ Journal journal) {
java.util.StringTokenizer st=new java.util.StringTokenizer(annotation); //,
"(),=");
String name=st.nextToken(" (");
- Annotation an=AnnotationDefinitions.createAnnotation(modelObject.getProperties(),
name);
+ Annotation an=new Annotation(name);
if (st.hasMoreTokens()) {
String token=st.nextToken("()");
@@ -42,7 +40,7 @@
String[] vals=props[i].split("=");
if (vals.length != 2) {
- journal.error("Name/Value of annotation could not be derived",
modelObject.getProperties());
+ journal.error("Name/Value of annotation could not be derived",
properties);
} else {
an.getProperties().put(vals[0], vals[1]);
}
@@ -55,13 +53,15 @@
index = annotation.indexOf(')', index+token.length());
if (index == -1) {
- journal.error("')' not found in annotation",
modelObject.getProperties());
+ journal.error("')' not found in annotation", properties);
}
}
} else {
- journal.error("'(' not found in annotation",
modelObject.getProperties());
+ journal.error("'(' not found in annotation", properties);
}
}
+
+ return(an);
}
}
Modified:
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/java/org/savara/protocol/contract/generator/GeneratorTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/java/org/savara/protocol/contract/generator/GeneratorTest.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/java/org/savara/protocol/contract/generator/GeneratorTest.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -94,7 +94,7 @@
org.scribble.protocol.model.ProtocolModel model=null;
ANTLRProtocolParser parser=new ANTLRProtocolParser();
- parser.addAnnotationProcessor(new org.savara.protocol.parser.AnnotationProcessor());
+ parser.setAnnotationProcessor(new org.savara.protocol.parser.AnnotationProcessor());
try {
model = parser.parse(is, journal, null);
Modified:
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/java/org/savara/protocol/contract/generator/impl/ContractIntrospectorTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/java/org/savara/protocol/contract/generator/impl/ContractIntrospectorTest.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/java/org/savara/protocol/contract/generator/impl/ContractIntrospectorTest.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -22,7 +22,6 @@
package org.savara.protocol.contract.generator.impl;
import org.savara.protocol.contract.generator.impl.ContractIntrospector;
-import org.savara.protocol.model.util.PropertyName;
import org.savara.common.model.annotation.Annotation;
import org.savara.common.model.annotation.AnnotationDefinitions;
import org.savara.contract.model.Contract;
@@ -40,14 +39,13 @@
import org.scribble.protocol.model.MessageSignature;
import org.scribble.protocol.model.Role;
import org.scribble.protocol.model.TypeReference;
-import org.scribble.protocol.util.InteractionUtil;
import static org.junit.Assert.*;
public class ContractIntrospectorTest {
private static final String MY_ROLE = "myRole";
- private static final String TYPE_NS = "typeNS";
+ //private static final String TYPE_NS = "typeNS";
private static final String TYPE_LP = "typeLP";
private static final String OP_NAME = "opName";
@@ -263,9 +261,9 @@
interaction.setMessageSignature(msig);
interaction.setFromRole(new Role());
- Annotation
annotation=AnnotationDefinitions.createAnnotation(interaction.getProperties(),
- AnnotationDefinitions.CORRELATION);
+ Annotation annotation=new Annotation(AnnotationDefinitions.CORRELATION);
annotation.getProperties().put(AnnotationDefinitions.REQUEST_PROPERTY,
"label");
+ interaction.getAnnotations().add(annotation);
introspector.accept(interaction);
Modified:
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/java/org/savara/protocol/parser/AnnotationProcessorTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/java/org/savara/protocol/parser/AnnotationProcessorTest.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.protocol/src/test/java/org/savara/protocol/parser/AnnotationProcessorTest.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -39,14 +39,16 @@
CachedJournal journal=new CachedJournal();
- processor.process(annotationText, mobj, journal);
+ Annotation an=processor.getAnnotation(annotationText, mobj.getProperties(), journal);
if (journal.hasErrors()) {
fail("Error reported");
}
- Annotation annotation=AnnotationDefinitions.getAnnotation(mobj.getProperties(), name);
+ mobj.getAnnotations().add(an);
+ Annotation annotation=AnnotationDefinitions.getAnnotation(mobj.getAnnotations(),
name);
+
if (annotation == null) {
fail("Annotation not associated with object");
}
@@ -74,14 +76,16 @@
CachedJournal journal=new CachedJournal();
- processor.process(annotationText, mobj, journal);
+ Annotation an=processor.getAnnotation(annotationText, mobj.getProperties(), journal);
if (journal.hasErrors()) {
fail("Error reported");
}
- Annotation annotation=AnnotationDefinitions.getAnnotation(mobj.getProperties(), name);
+ mobj.getAnnotations().add(an);
+ Annotation annotation=AnnotationDefinitions.getAnnotation(mobj.getAnnotations(),
name);
+
if (annotation == null) {
fail("Annotation not associated with object");
}
@@ -125,7 +129,7 @@
CachedJournal journal=new CachedJournal();
- processor.process(annotationText, mobj, journal);
+ processor.getAnnotation(annotationText, mobj.getProperties(), journal);
if (journal.hasErrors() == false) {
fail("Error expected");
@@ -144,7 +148,7 @@
CachedJournal journal=new CachedJournal();
- processor.process(annotationText, mobj, journal);
+ processor.getAnnotation(annotationText, mobj.getProperties(), journal);
if (journal.hasErrors() == false) {
fail("Error expected");
@@ -164,7 +168,7 @@
CachedJournal journal=new CachedJournal();
- processor.process(annotationText, mobj, journal);
+ processor.getAnnotation(annotationText, mobj.getProperties(), journal);
if (journal.hasErrors() == false) {
fail("Error expected");
Modified:
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/java/org/savara/wsdl/generator/WSDLGeneratorTest.java
===================================================================
---
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/java/org/savara/wsdl/generator/WSDLGeneratorTest.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/bundles/org.savara.wsdl/src/test/java/org/savara/wsdl/generator/WSDLGeneratorTest.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -180,7 +180,7 @@
ref1.setDataType(new QName(TEST_NAME_SPACE,TEST_TYPE_LP).toString());
ref1.setTypeSystem(TypeSystem.XSD);
- AnnotationDefinitions.createAnnotation(ref1.getProperties(),
AnnotationDefinitions.XSD_TYPE);
+ ref1.getAnnotations().add(new Annotation(AnnotationDefinitions.XSD_TYPE));
c.getTypeDefinitions().add(ref1);
@@ -283,7 +283,7 @@
ref.setName(TEST_TYPE_LP);
ref.setDataType(new QName(TEST_TYPE_NS,TEST_TYPE_LP).toString());
ref.setTypeSystem(TypeSystem.XSD);
- AnnotationDefinitions.createAnnotation(ref.getProperties(),
AnnotationDefinitions.XSD_TYPE);
+ ref.getAnnotations().add(new Annotation(AnnotationDefinitions.XSD_TYPE));
c.getTypeDefinitions().add(ref);
/*
@@ -353,7 +353,7 @@
ref1.setName(TEST_TYPE_LP);
ref1.setDataType(new QName(TEST_TYPE_NS,TEST_TYPE_LP).toString());
ref1.setTypeSystem(TypeSystem.XSD);
- AnnotationDefinitions.createAnnotation(ref1.getProperties(),
AnnotationDefinitions.XSD_TYPE);
+ ref1.getAnnotations().add(new Annotation(AnnotationDefinitions.XSD_TYPE));
c.getTypeDefinitions().add(ref1);
/*
@@ -470,7 +470,7 @@
src.setDataType(new QName(TEST_TYPE_NS,TEST_TYPE_LP).toString());
src.setTypeSystem(TypeSystem.XSD);
- AnnotationDefinitions.createAnnotation(src.getProperties(),
AnnotationDefinitions.XSD_TYPE);
+ src.getAnnotations().add(new Annotation(AnnotationDefinitions.XSD_TYPE));
c.getTypeDefinitions().add(src);
Type t=new Type();
@@ -556,7 +556,7 @@
ref1.setName(TEST_TYPE_LP);
ref1.setDataType(new QName(TEST_NAME_SPACE,TEST_TYPE_LP).toString());
ref1.setTypeSystem(TypeSystem.XSD);
- AnnotationDefinitions.createAnnotation(ref1.getProperties(),
AnnotationDefinitions.XSD_TYPE);
+ ref1.getAnnotations().add(new Annotation(AnnotationDefinitions.XSD_TYPE));
c.getTypeDefinitions().add(ref1);
/*
@@ -585,7 +585,7 @@
ref2.setName(TEST_TYPE_LP2);
ref2.setDataType(new QName(TEST_NAME_SPACE2,TEST_TYPE_LP).toString());
ref2.setTypeSystem(TypeSystem.XSD);
- AnnotationDefinitions.createAnnotation(ref2.getProperties(),
AnnotationDefinitions.XSD_TYPE);
+ ref2.getAnnotations().add(new Annotation(AnnotationDefinitions.XSD_TYPE));
c.getTypeDefinitions().add(ref2);
/*
@@ -613,7 +613,7 @@
ref3.setName(TEST_TYPE_LP3);
ref3.setDataType(new QName(TEST_NAME_SPACE3,TEST_TYPE_LP).toString());
ref3.setTypeSystem(TypeSystem.XSD);
- AnnotationDefinitions.createAnnotation(ref3.getProperties(),
AnnotationDefinitions.XSD_TYPE);
+ ref3.getAnnotations().add(new Annotation(AnnotationDefinitions.XSD_TYPE));
c.getTypeDefinitions().add(ref3);
/*
Modified:
branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/src/java/org/savara/tools/bpel/generator/Generator.java
===================================================================
---
branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/src/java/org/savara/tools/bpel/generator/Generator.java 2011-01-28
12:18:34 UTC (rev 631)
+++
branches/experimental/2.0.x/tools/plugins/org.savara.tools.bpel/src/java/org/savara/tools/bpel/generator/Generator.java 2011-01-30
20:52:55 UTC (rev 632)
@@ -239,12 +239,12 @@
if (local != null) {
// TODO: SAVARA-167 - issue when projection is based on a sub-protocol
- if (AnnotationDefinitions.getAnnotation(local.getProtocol().getProperties(),
+ if (AnnotationDefinitions.getAnnotation(local.getProtocol().getAnnotations(),
AnnotationDefinitions.TYPE) == null &&
- AnnotationDefinitions.getAnnotation(m_protocolModel.getProtocol().getProperties(),
- AnnotationDefinitions.TYPE) != null) {
- AnnotationDefinitions.copyAnnotations(m_protocolModel.getProtocol().getProperties(),
- local.getProtocol().getProperties(), AnnotationDefinitions.TYPE);
+ AnnotationDefinitions.getAnnotation(m_protocolModel.getProtocol().getAnnotations(),
+ AnnotationDefinitions.TYPE) != null) {
+ AnnotationDefinitions.copyAnnotations(m_protocolModel.getProtocol().getAnnotations(),
+ local.getProtocol().getAnnotations(), AnnotationDefinitions.TYPE);
}
// TODO: Obtain model generator from manager class (SAVARA-156)
@@ -283,7 +283,7 @@
new java.util.HashMap<String, String>();
java.util.List<Annotation> list=
- AnnotationDefinitions.getAnnotations(localcm.getProtocol().getProperties(),
+ AnnotationDefinitions.getAnnotations(localcm.getProtocol().getAnnotations(),
AnnotationDefinitions.TYPE);
for (Annotation annotation : list) {