Author: objectiser
Date: 2010-09-07 08:53:47 -0400 (Tue, 07 Sep 2010)
New Revision: 393
Modified:
trunk/samples/purchasing/PurchaseGoods.cdm
trunk/tools/plugins/org.jboss.savara.tools.validator/src/java/org/jboss/savara/tools/validator/osgi/annotations/cdl/validator.presentation
trunk/tools/plugins/org.jboss.savara.tools.validator/src/java/org/jboss/savara/tools/validator/osgi/annotations/cdl/validator.template
trunk/validators/jboss/common/src/main/configs/models/PurchaseGoods.cdm
trunk/validators/jboss/common/src/main/java/org/jboss/savara/validator/pi4soa/ValidatorConfigGenerator.java
Log:
Added destination type to validator annotation, to distinguish between a service name
(where the request and response are associated with the same name) and an endpoint address
style, where the request and response may be associated with different addresses.
Modified: trunk/samples/purchasing/PurchaseGoods.cdm
===================================================================
--- trunk/samples/purchasing/PurchaseGoods.cdm 2010-09-06 16:53:49 UTC (rev 392)
+++ trunk/samples/purchasing/PurchaseGoods.cdm 2010-09-07 12:53:47 UTC (rev 393)
@@ -54,36 +54,36 @@
<variableDefinitions description="This is the variable buy"
name="buy" type="//@typeDefinitions/(a)informationTypes.2"/>
<activities xsi:type="org.pi4soa.cdl:Interaction"
name="BuyRequest" operation="buy"
channelVariable="//@choreographies.0/(a)variableDefinitions.1"
relationship="//@typeDefinitions/(a)relationshipTypes.0">
<exchangeDetails description="This is the exchange details for the request
exchange associated with interaction BuyRequest"
name="BuyRequestRequestExchange"
type="//@typeDefinitions/(a)informationTypes.2">
- <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/store}StoreService}}&a...
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
+ <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/store}StoreService}}&a...
type of destination;enum;endpoint address,service name;service name}}"
/>
		dynamicReplyTo="{{Dynamic
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
</exchangeDetails>
</activities>
<activities xsi:type="org.pi4soa.cdl:Interaction"
name="CreditCheck" operation="checkCredit"
channelVariable="//@choreographies.0/(a)variableDefinitions.0"
relationship="//@typeDefinitions/(a)relationshipTypes.1">
<exchangeDetails description="This is the exchange details for the request
exchange associated with interaction CreditCheck"
name="CreditCheckRequestExchange"
type="//@typeDefinitions/(a)informationTypes.5">
- <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/creditAgency}CreditAge...
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
+ <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/creditAgency}CreditAge...
type of destination;enum;endpoint address,service name;service name}}"
/>
		dynamicReplyTo="{{Dynamic
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
</exchangeDetails>
</activities>
<activities xsi:type="org.pi4soa.cdl:Choice" description="Is credit
ok?">
<activities xsi:type="org.pi4soa.cdl:Sequence"
description="Credit Valid">
<activities xsi:type="org.pi4soa.cdl:Interaction"
name="CreditCheckOk" operation="checkCredit"
channelVariable="//@choreographies.0/(a)variableDefinitions.0"
relationship="//@typeDefinitions/(a)relationshipTypes.1">
<exchangeDetails description="This is the exchange details for the
respond exchange associated with interaction CreditCheckOk"
name="CreditCheckOkRespondExchange"
type="//@typeDefinitions/(a)informationTypes.4" action="Respond">
- <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/creditAgency}CreditAge...
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
+ <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/creditAgency}CreditAge...
type of destination;enum;endpoint address,service name;service name}}"
/>
		dynamicReplyTo="{{Dynamic
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
</exchangeDetails>
</activities>
<activities xsi:type="org.pi4soa.cdl:Interaction"
name="BuyConfirmed" operation="buy"
channelVariable="//@choreographies.0/(a)variableDefinitions.1"
relationship="//@typeDefinitions/(a)relationshipTypes.0">
<exchangeDetails description="This is the exchange details for the
respond exchange associated with interaction BuyConfirmed"
name="BuyConfirmedRespondExchange"
type="//@typeDefinitions/(a)informationTypes.0" action="Respond">
- <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/store}StoreService}}&a...
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
+ <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/store}StoreService}}&a...
type of destination;enum;endpoint address,service name;service name}}"
/>
		dynamicReplyTo="{{Dynamic
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
</exchangeDetails>
</activities>
</activities>
<activities xsi:type="org.pi4soa.cdl:Sequence"
description="Credit Invalid">
<activities xsi:type="org.pi4soa.cdl:Interaction"
name="CreditCheckFailed" operation="checkCredit"
channelVariable="//@choreographies.0/(a)variableDefinitions.0"
relationship="//@typeDefinitions/(a)relationshipTypes.1">
<exchangeDetails description="This is the exchange details for the
respond exchange associated with interaction CreditCheckFailed"
name="CreditCheckFailedRespondExchange"
type="//@typeDefinitions/(a)informationTypes.3" action="Respond"
faultName="CreditCheckFailed">
- <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/creditAgency}CreditAge...
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
+ <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/creditAgency}CreditAge...
type of destination;enum;endpoint address,service name;service name}}"
/>
		dynamicReplyTo="{{Dynamic
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
</exchangeDetails>
</activities>
<activities xsi:type="org.pi4soa.cdl:Interaction"
name="BuyFailed" operation="buy"
channelVariable="//@choreographies.0/(a)variableDefinitions.1"
relationship="//@typeDefinitions/(a)relationshipTypes.0">
<exchangeDetails description="This is the exchange details for the
respond exchange associated with interaction BuyFailed"
name="BuyFailedRespondExchange"
type="//@typeDefinitions/(a)informationTypes.1" action="Respond"
faultName="BuyFailed">
- <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/store}StoreService}}&a...
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
+ <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/store}StoreService}}&a...
type of destination;enum;endpoint address,service name;service name}}"
/>
		dynamicReplyTo="{{Dynamic
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
</exchangeDetails>
</activities>
</activities>
Modified:
trunk/tools/plugins/org.jboss.savara.tools.validator/src/java/org/jboss/savara/tools/validator/osgi/annotations/cdl/validator.presentation
===================================================================
---
trunk/tools/plugins/org.jboss.savara.tools.validator/src/java/org/jboss/savara/tools/validator/osgi/annotations/cdl/validator.presentation 2010-09-06
16:53:49 UTC (rev 392)
+++
trunk/tools/plugins/org.jboss.savara.tools.validator/src/java/org/jboss/savara/tools/validator/osgi/annotations/cdl/validator.presentation 2010-09-07
12:53:47 UTC (rev 393)
@@ -1,3 +1,3 @@
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
-The Service destination is <xsl:if test="validator/destination/@name !=
''" >'<xsl:value-of select="validator/destination/@name"
/>' </xsl:if><xsl:if test="validator/destination/@name =
''" >'undefined' </xsl:if> [Dynamic Reply-To
Destination=<xsl:value-of
select="validator/destination/@dynamicReplyTo"/>]</xsl:template></xsl:stylesheet>
\ No newline at end of file
+The Service destination is <xsl:if test="validator/destination/@name !=
''" >'<xsl:value-of select="validator/destination/@name"
/>' </xsl:if><xsl:if test="validator/destination/@name =
''" >'undefined' </xsl:if> [Type=<xsl:value-of
select="validator/destination/@type"/>] [Dynamic Reply-To
Destination=<xsl:value-of
select="validator/destination/@dynamicReplyTo"/>]</xsl:template></xsl:stylesheet>
\ No newline at end of file
Modified:
trunk/tools/plugins/org.jboss.savara.tools.validator/src/java/org/jboss/savara/tools/validator/osgi/annotations/cdl/validator.template
===================================================================
---
trunk/tools/plugins/org.jboss.savara.tools.validator/src/java/org/jboss/savara/tools/validator/osgi/annotations/cdl/validator.template 2010-09-06
16:53:49 UTC (rev 392)
+++
trunk/tools/plugins/org.jboss.savara.tools.validator/src/java/org/jboss/savara/tools/validator/osgi/annotations/cdl/validator.template 2010-09-07
12:53:47 UTC (rev 393)
@@ -1,4 +1,5 @@
<validator>
<destination name="{{Destination;The URI for the destination;string;;}}"
+ type="{{Type;The type of destination;enum;endpoint address,service name;endpoint
address}}" />
dynamicReplyTo="{{Dynamic ReplyTo;Whether the replyTo destination is
dynamic;boolean;;false}}" />
</validator>
Modified: trunk/validators/jboss/common/src/main/configs/models/PurchaseGoods.cdm
===================================================================
--- trunk/validators/jboss/common/src/main/configs/models/PurchaseGoods.cdm 2010-09-06
16:53:49 UTC (rev 392)
+++ trunk/validators/jboss/common/src/main/configs/models/PurchaseGoods.cdm 2010-09-07
12:53:47 UTC (rev 393)
@@ -54,36 +54,36 @@
<variableDefinitions description="This is the variable buy"
name="buy" type="//@typeDefinitions/(a)informationTypes.2"/>
<activities xsi:type="org.pi4soa.cdl:Interaction"
name="BuyRequest" operation="buy"
channelVariable="//@choreographies.0/(a)variableDefinitions.1"
relationship="//@typeDefinitions/(a)relationshipTypes.0">
<exchangeDetails description="This is the exchange details for the request
exchange associated with interaction BuyRequest"
name="BuyRequestRequestExchange"
type="//@typeDefinitions/(a)informationTypes.2">
- <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/store}StoreService}}&a...
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
+ <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/store}StoreService}}&a...
type of destination;enum;endpoint address,service name;service name}}"
/>
		dynamicReplyTo="{{Dynamic
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
</exchangeDetails>
</activities>
<activities xsi:type="org.pi4soa.cdl:Interaction"
name="CreditCheck" operation="checkCredit"
channelVariable="//@choreographies.0/(a)variableDefinitions.0"
relationship="//@typeDefinitions/(a)relationshipTypes.1">
<exchangeDetails description="This is the exchange details for the request
exchange associated with interaction CreditCheck"
name="CreditCheckRequestExchange"
type="//@typeDefinitions/(a)informationTypes.5">
- <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/creditAgency}CreditAge...
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
+ <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/creditAgency}CreditAge...
type of destination;enum;endpoint address,service name;service name}}"
/>
		dynamicReplyTo="{{Dynamic
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
</exchangeDetails>
</activities>
<activities xsi:type="org.pi4soa.cdl:Choice" description="Is credit
ok?">
<activities xsi:type="org.pi4soa.cdl:Sequence"
description="Credit Valid">
<activities xsi:type="org.pi4soa.cdl:Interaction"
name="CreditCheckOk" operation="checkCredit"
channelVariable="//@choreographies.0/(a)variableDefinitions.0"
relationship="//@typeDefinitions/(a)relationshipTypes.1">
<exchangeDetails description="This is the exchange details for the
respond exchange associated with interaction CreditCheckOk"
name="CreditCheckOkRespondExchange"
type="//@typeDefinitions/(a)informationTypes.4" action="Respond">
- <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/creditAgency}CreditAge...
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
+ <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/creditAgency}CreditAge...
type of destination;enum;endpoint address,service name;service name}}"
/>
		dynamicReplyTo="{{Dynamic
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
</exchangeDetails>
</activities>
<activities xsi:type="org.pi4soa.cdl:Interaction"
name="BuyConfirmed" operation="buy"
channelVariable="//@choreographies.0/(a)variableDefinitions.1"
relationship="//@typeDefinitions/(a)relationshipTypes.0">
<exchangeDetails description="This is the exchange details for the
respond exchange associated with interaction BuyConfirmed"
name="BuyConfirmedRespondExchange"
type="//@typeDefinitions/(a)informationTypes.0" action="Respond">
- <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/store}StoreService}}&a...
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
+ <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/store}StoreService}}&a...
type of destination;enum;endpoint address,service name;service name}}"
/>
		dynamicReplyTo="{{Dynamic
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
</exchangeDetails>
</activities>
</activities>
<activities xsi:type="org.pi4soa.cdl:Sequence"
description="Credit Invalid">
<activities xsi:type="org.pi4soa.cdl:Interaction"
name="CreditCheckFailed" operation="checkCredit"
channelVariable="//@choreographies.0/(a)variableDefinitions.0"
relationship="//@typeDefinitions/(a)relationshipTypes.1">
<exchangeDetails description="This is the exchange details for the
respond exchange associated with interaction CreditCheckFailed"
name="CreditCheckFailedRespondExchange"
type="//@typeDefinitions/(a)informationTypes.3" action="Respond"
faultName="CreditCheckFailed">
- <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/creditAgency}CreditAge...
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
+ <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/creditAgency}CreditAge...
type of destination;enum;endpoint address,service name;service name}}"
/>
		dynamicReplyTo="{{Dynamic
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
</exchangeDetails>
</activities>
<activities xsi:type="org.pi4soa.cdl:Interaction"
name="BuyFailed" operation="buy"
channelVariable="//@choreographies.0/(a)variableDefinitions.1"
relationship="//@typeDefinitions/(a)relationshipTypes.0">
<exchangeDetails description="This is the exchange details for the
respond exchange associated with interaction BuyFailed"
name="BuyFailedRespondExchange"
type="//@typeDefinitions/(a)informationTypes.1" action="Respond"
faultName="BuyFailed">
- <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/store}StoreService}}&a...
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
+ <semanticAnnotations
annotation="<validator>
	<destination
name="{{Destination;The URI for the
destination;string;;{http://www.jboss.org/examples/store}StoreService}}&a...
type of destination;enum;endpoint address,service name;service name}}"
/>
		dynamicReplyTo="{{Dynamic
ReplyTo;Whether the replyTo destination is dynamic;boolean;;false}}"
/>
</validator>
"
name="validator"/>
</exchangeDetails>
</activities>
</activities>
Modified:
trunk/validators/jboss/common/src/main/java/org/jboss/savara/validator/pi4soa/ValidatorConfigGenerator.java
===================================================================
---
trunk/validators/jboss/common/src/main/java/org/jboss/savara/validator/pi4soa/ValidatorConfigGenerator.java 2010-09-06
16:53:49 UTC (rev 392)
+++
trunk/validators/jboss/common/src/main/java/org/jboss/savara/validator/pi4soa/ValidatorConfigGenerator.java 2010-09-07
12:53:47 UTC (rev 393)
@@ -23,6 +23,7 @@
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
+import org.jboss.util.xml.DOMWriter;
import org.pi4soa.cdl.*;
import org.pi4soa.common.annotations.*;
@@ -70,6 +71,10 @@
e.printStackTrace();
}
+ if (logger.isDebugEnabled()) {
+ logger.debug(DOMWriter.printNode(ret, true));
+ }
+
return(ret);
}
@@ -128,6 +133,8 @@
public class InputOutputAnalyser extends DefaultCDLVisitor {
+ private static final String DESTINATION_TYPE_ENDPOINT_ADDRESS = "endpoint
address";
+ private static final String TYPE_ATTR = "type";
private static final String DYNAMIC_REPLY_TO_ATTR = "dynamicReplyTo";
private static final String VALIDATOR_ANNOTATION = "validator";
private static final String VALIDATOR_ELEMENT = "validator";
@@ -240,43 +247,45 @@
if (from) {
if (details.getAction() == ExchangeActionType.REQUEST) {
elemName = OUTPUT_ELEMENT;
- } else {
+ } else if (dest.getAttribute(TYPE_ATTR).equals(DESTINATION_TYPE_ENDPOINT_ADDRESS))
{
elemName = INPUT_ELEMENT;
}
} else {
if (details.getAction() == ExchangeActionType.REQUEST) {
elemName = INPUT_ELEMENT;
- } else {
+ } else if (dest.getAttribute(TYPE_ATTR).equals(DESTINATION_TYPE_ENDPOINT_ADDRESS))
{
elemName = OUTPUT_ELEMENT;
}
}
- org.w3c.dom.Element elem=m_service.getOwnerDocument().createElement(elemName);
-
- // Parameter has been stored in a structured manner
- // to support use of templates and presentations,
- // so need to extract the value
- java.util.List<TemplateParameter> params=
- m_templateProcessor.getTemplateParameters(dest.getAttribute(NAME_ATTR));
-
- if (params != null && params.size() > 0) {
- elem.setAttribute(EPR_ATTR, params.get(0).getValue());
- }
-
- if (dest.hasAttribute(DYNAMIC_REPLY_TO_ATTR)) {
- params=m_templateProcessor.getTemplateParameters(dest.getAttribute(DYNAMIC_REPLY_TO_ATTR));
-
+ if (elemName != null) {
+ org.w3c.dom.Element elem=m_service.getOwnerDocument().createElement(elemName);
+
+ // Parameter has been stored in a structured manner
+ // to support use of templates and presentations,
+ // so need to extract the value
+ java.util.List<TemplateParameter> params=
+ m_templateProcessor.getTemplateParameters(dest.getAttribute(NAME_ATTR));
+
if (params != null && params.size() > 0) {
-
- if (params.get(0).getValue().equalsIgnoreCase("true")) {
- elem.setAttribute(DYNAMIC_REPLY_TO_ATTR, "true");
+ elem.setAttribute(EPR_ATTR, params.get(0).getValue());
+ }
+
+ if (dest.hasAttribute(DYNAMIC_REPLY_TO_ATTR)) {
+ params=m_templateProcessor.getTemplateParameters(dest.getAttribute(DYNAMIC_REPLY_TO_ATTR));
+
+ if (params != null && params.size() > 0) {
+
+ if (params.get(0).getValue().equalsIgnoreCase("true")) {
+ elem.setAttribute(DYNAMIC_REPLY_TO_ATTR, "true");
+ }
}
}
+
+ if (elem.hasAttribute(EPR_ATTR)) {
+ m_service.appendChild(elem);
+ }
}
-
- if (elem.hasAttribute(EPR_ATTR)) {
- m_service.appendChild(elem);
- }
}
}