Author: asankha
Date: Mon May 21 21:29:19 2007
New Revision: 540417
URL: http://svn.apache.org/viewvc?view=rev&rev=540417
Log:
fix validate mediator to use the standard synapse property mechanism instead of
using a string-value Map
Modified:
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ValidateMediatorSerializer.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/ValidateMediator.java
webservices/synapse/trunk/java/src/site/resources/Synapse_Configuration_Language.html
Modified:
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ValidateMediatorSerializer.java
URL:
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ValidateMediatorSerializer.java?view=diff&rev=540417&r1=540416&r2=540417
==============================================================================
---
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ValidateMediatorSerializer.java
(original)
+++
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/ValidateMediatorSerializer.java
Mon May 21 21:29:19 2007
@@ -67,7 +67,7 @@
schema.addAttribute(fac.createOMAttribute("key", nullNS, key));
}
- serializeProperties(validate, mediator.getProperties().entrySet());
+ serializeProperties(validate, mediator.getProperties());
OMElement onFail = fac.createOMElement("on-fail", synNS, validate);
serializeChildren(onFail, mediator.getList());
Modified:
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/ValidateMediator.java
URL:
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/ValidateMediator.java?view=diff&rev=540417&r1=540416&r2=540417
==============================================================================
---
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/ValidateMediator.java
(original)
+++
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/ValidateMediator.java
Mon May 21 21:29:19 2007
@@ -86,7 +86,7 @@
* A Map containing properties for the validate mediator - such as
* features to be passed to the actual validator (Xerces)
*/
- private Map properties = new HashMap();
+ private List properties = new ArrayList();
/**
* This is the actual Validator instance used to validate messages -
probably
@@ -243,12 +243,11 @@
factory.setErrorHandler(errorHandler);
// set any features on/off as requested
- iter = properties.entrySet().iterator();
+ iter = properties.iterator();
while (iter.hasNext()) {
- Map.Entry entry = (Map.Entry) iter.next();
- String value = (String) entry.getValue();
+ MediatorProperty prop = (MediatorProperty) iter.next();
factory.setFeature(
- (String) entry.getKey(), value != null &&
"true".equals(value));
+ prop.getName(), prop.getValue() != null &&
"true".equals(prop.getValue()));
}
Schema schema = null;
@@ -322,7 +321,14 @@
* @return property string value (usually true|false)
*/
public Object getProperty(String key) {
- return properties.get(key);
+ Iterator iter = properties.iterator();
+ while (iter.hasNext()) {
+ MediatorProperty prop = (MediatorProperty) iter.next();
+ if (key.equals(prop.getName())) {
+ return prop.getValue();
+ }
+ }
+ return null;
}
/**
@@ -333,7 +339,10 @@
* @see #getProperty(String)
*/
public void setProperty(String key, Object value) {
- properties.put(key, value);
+ MediatorProperty prop = new MediatorProperty();
+ prop.setName(key);
+ prop.setValue(value.toString());
+ properties.add(prop);
}
/**
@@ -393,7 +402,7 @@
* Properties for the actual Xerces validator
* @return properties to be passed to the Xerces validator
*/
- public Map getProperties() {
+ public List getProperties() {
return properties;
}
}
Modified:
webservices/synapse/trunk/java/src/site/resources/Synapse_Configuration_Language.html
URL:
http://svn.apache.org/viewvc/webservices/synapse/trunk/java/src/site/resources/Synapse_Configuration_Language.html?view=diff&rev=540417&r1=540416&r2=540417
==============================================================================
---
webservices/synapse/trunk/java/src/site/resources/Synapse_Configuration_Language.html
(original)
+++
webservices/synapse/trunk/java/src/site/resources/Synapse_Configuration_Language.html
Mon May 21 21:29:19 2007
@@ -373,13 +373,7 @@
<h2><a name="mediator">Mediators</a></h2>
<p>A mediator token refers to any of the following tokens:</p>
-<pre><a href="#send">send</a> | <a href="#drop">drop</a> | <a
href="#log">log</a> | <a
-href="#makefault">makefault</a> | <a href="#xslt">transform</a> | <a
-href="#header">header</a> | <a href="#filter">filter</a> | <a
-href="#switch">switch</a> | <a href="#class">class</a> | <a
-href="#validate">validate</a> | <a href="#property">property</a> | <a
-href="#sequence">sequence ref</a> | <a href="#in">in</a> | <a
-href="#out">out</a> | <a href="#rmsequence">RMSequence</a></pre>
+<pre><a href="#send">send</a> | <a href="#drop">drop</a> | <a
href="#log">log</a> | <a href="#makefault">makefault</a> | <a
href="#xslt">transform</a> | <a href="#header">header</a> | <a
href="#filter">filter</a> | <a href="#switch">switch</a> | <a
href="#class">class</a> | <a href="#validate">validate</a> | <a
href="#property">property</a> | <a href="#sequence">sequence ref</a> | <a
href="#in">in</a> | <a href="#out">out</a> | <a
href="#rmsequence">RMSequence</a></pre>
<p>In addition to the above, Synapse will be able to load mediators via the
J2SE Service Provider model. Mediator extensions must implement the
@@ -495,7 +489,7 @@
<h4><a name="validate">Validate</a></h4>
<pre> <validate [source="xpath"]>
- <parameter name="validation-feature-id" value="true|false"/>*
+ <property name="validation-feature-id" value="true|false"/>*
<schema key="string"/>+
<on-fail>
mediator+
@@ -506,12 +500,9 @@
the source xpath expression, against the schema specified. If the source
attribute is not specified, the validation is performed against the first
child of the SOAP body of the current message. If the validation fails, the
-on-fail sequence of mediators is executed. Parameters could be used to turn
-on/off some of the underlying features of the validator.</p>
-
-<p>Note: As the validation mediator is strongly dependent on the Xerces2-J
-2.8.0 parser, it is bundled with the Synapse extensions, so that the Synapse
-core will remain simple and lightweight.</p>
+on-fail sequence of mediators is executed. Properties could be used to turn
+on/off some of the underlying features of the validator (See
+http://xerces.apache.org/xerces2-j/features.html)</p>
<p></p>
@@ -536,13 +527,13 @@
<h4><a name="xslt">XSLT</a></h4>
<pre> <xslt key="string" [source="xpath"]>
- <parameter name="string" (value="literal" | expression="xpath")/>*
+ <property name="string" (value="literal" | expression="xpath")/>*
</xslt></pre>
<p>The <xslt> mediator applies the specified XSLT transformation to the
given element. If the source element is not specified, it defaults to the
first child of the soap body. Optionally parameters (XSLT) could be passed
-into the transformations through the <parameter> elements.</p>
+into the transformations through the <property> elements.</p>
<p></p>
@@ -611,17 +602,18 @@
<h4><a name="rmsequence">RMSequence</a></h4>
<pre> <RMSequence (correlation="xpath" [last-message="xpath"]) |
single="true" [version="1.0|1.1"]/></pre>
-<p>The <RMSequence> mediator can be used to create a sequence of
-messages to communicate via WS-Reliable Messaging with an WS-RM enabled
-endpoint (<enableRM>). The simple use case of this mediator is to
specify
-a single="true" property, because this means that only one message is involved
in
-the same sequence. However if multiple messages should be sent in the same
sequence,
-the correlation property should be used with a XPath expression that selects
an
-unique element value from the incoming message. With the result of the XPath
-expression, Synapse can group messages together that belong to the same
sequence.
-To close the sequence neatly, for the last message of the sequence also an
-XPath expression should be specified. With the version attribute the
-WS-RM specification version to be used can be specified, 1.0 or 1.1. </p>
+<p>The <RMSequence> mediator can be used to create a sequence of
+messages to communicate via WS-Reliable Messaging with an WS-RM enabled
+endpoint (<enableRM>). The simple use case of this mediator is to
+specify a single="true" property, because this means that only one message is
+involved in the same sequence. However if multiple messages should be sent in
+the same sequence, the correlation property should be used with a XPath
+expression that selects an unique element value from the incoming message.
+With the result of the XPath expression, Synapse can group messages together
+that belong to the same sequence. To close the sequence neatly, for the last
+message of the sequence also an XPath expression should be specified. With
+the version attribute the WS-RM specification version to be used can be
+specified, 1.0 or 1.1. </p>
<h3>Extension mediator</h3>
@@ -722,4 +714,3 @@
<p></p>
</body>
</html>
-
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]