Author: asankha
Date: Thu Sep 28 22:40:14 2006
New Revision: 451135
URL: http://svn.apache.org/viewvc?view=rev&rev=451135
Log:
Commiting for Ruwan
Added:
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/Property.java
Modified:
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/DynamicProperty.java
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/SynapseConfiguration.java
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/Util.java
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/XMLConfigurationBuilder.java
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/XMLConfigurationSerializer.java
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/registry/AbstractRegistry.java
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/registry/Registry.java
incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/mediators/TestUtils.java
incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/mediators/builtin/PropertyMediatorTest.java
incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/registry/url/SimpleURLRegistryTest.java
incubator/synapse/trunk/java/modules/extensions/src/org/apache/synapse/mediators/spring/SpringMediator.java
incubator/synapse/trunk/java/modules/extensions/src/org/apache/synapse/mediators/transform/XSLTMediator.java
incubator/synapse/trunk/java/modules/extensions/src/org/apache/synapse/mediators/validate/ValidateMediator.java
incubator/synapse/trunk/java/modules/extensions/test/org/apache/synapse/ValidateMediatorTest.java
incubator/synapse/trunk/java/modules/extensions/test/org/apache/synapse/XSLTMediatorTest.java
Modified:
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/DynamicProperty.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/DynamicProperty.java?view=diff&rev=451135&r1=451134&r2=451135
==============================================================================
---
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/DynamicProperty.java
(original)
+++
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/DynamicProperty.java
Thu Sep 28 22:40:14 2006
@@ -1,103 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed under the Apache License, Version 2.0 (the "License");
-* you may not use this file except in compliance with the License.
-* You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-package org.apache.synapse.config;
-
-/**
- * A DynamicProperty is a Synapse (global) property (defined within the
'definitions'
- * section) of a SynapseConfiguration. However, these properties are implicitly
- * tied to a Registry, and will be automatically refreshed after a cacheable
lease
- * expires for such a property. The cachable duration for each property is
given
- * by the registry when the RegistryEntry for a property is requested. This
duration
- * can change while the property is being used, and will be refreshed at each
- * value expiry. However, the resource will be loaded, iff the RegistryEntry
returned
- * after a value expiry as a version later than the version cached. Else, the
- * existing value of the resource will be renewed for a further period, as
stated by
- * the new RegistryEntry lookup.
- */
-public class DynamicProperty {
- /** The name of the registry to which this key applies */
- private String registryName = null;
- /** The registry key */
- private String key;
- /** The cached object */
- private Object value = null;
- /** An XML to Object mapper - if one is available */
- private XMLToObjectMapper mapper = null;
- /** The version of the cached resource */
- private long version;
- /** The local expiry time for the cached resource */
- private long expiryTime;
-
- public DynamicProperty(String key) {
- this.key = key;
- }
-
- public String getKey() {
- return key;
- }
-
- public void setKey(String key) {
- this.key = key;
- }
-
- public Object getValue() {
- return value;
- }
-
- public boolean isCached() {
- return value != null;
- }
-
- public void setValue(Object cache) {
- this.value = cache;
- }
-
- public XMLToObjectMapper getMapper() {
- return mapper;
- }
-
- public void setMapper(XMLToObjectMapper mapper) {
- this.mapper = mapper;
- }
-
- public long getExpiryTime() {
- return expiryTime;
- }
-
- public void setExpiryTime(long expiryTime) {
- this.expiryTime = expiryTime;
- }
-
- public boolean isExpired() {
- return System.currentTimeMillis() > expiryTime;
- }
-
- public long getVersion() {
- return version;
- }
-
- public void setVersion(long version) {
- this.version = version;
- }
-
- public String getRegistryName() {
- return registryName;
- }
-
- public void setRegistryName(String registryName) {
- this.registryName = registryName;
- }
-}
Added:
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/Property.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/Property.java?view=auto&rev=451135
==============================================================================
---
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/Property.java
(added)
+++
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/Property.java
Thu Sep 28 22:40:14 2006
@@ -0,0 +1,177 @@
+package org.apache.synapse.config;
+
+import org.apache.synapse.SynapseException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.axiom.om.OMElement;
+
+import java.net.URL;
+
+/*
+* Copyright 2004,2005 The Apache Software Foundation.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+public class Property {
+
+ private static final Log log = LogFactory.getLog(Property.class);
+
+ /**
+ * The name of the registry to which this key applies
+ */
+ private String registryName;
+ /**
+ * Name of the property
+ */
+ private String name;
+ /**
+ * The type of the static proprerty
+ */
+ private int type;
+ /**
+ * Source URL of the property if it is a SRC_TYPE
+ */
+ private URL src;
+ /**
+ * The registry key
+ */
+ private String key;
+ /**
+ * The value of the property
+ * This can be either an OMElement or an String
+ */
+ private Object value;
+ /**
+ * An XML to Object mapper - if one is available
+ * @deprecated
+ */
+ private XMLToObjectMapper mapper;
+ /**
+ * The version of the cached resource
+ */
+ private long version;
+ /**
+ * The local expiry time for the cached resource
+ */
+ private long expiryTime;
+
+ public String getRegistryName() {
+ return this.registryName;
+ }
+
+ public void setRegistryName(String registryName) {
+ this.registryName = registryName;
+ }
+
+ public String getName() {
+ return this.name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public void setType(int type) {
+ if (type <= 4 && type >= 0)
+ this.type = type;
+ else
+ handleException("Invalid property type for the static property");
+ }
+
+ public URL getSrc() {
+ return src;
+ }
+
+ public void setSrc(URL src) {
+ this.src = src;
+ }
+
+ public String getKey() {
+ return this.key;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ /**
+ * Gets the value of the property. String if the type is
INLINE_STRING_TYPE or VALUE_TYPE,
+ * OMElement otherwise.
+ * @return Either an OMElement or a String
+ */
+ public Object getValue() {
+ return value;
+ }
+
+ public void setValue(Object value) {
+ this.value = value;
+ }
+
+ /**
+ *
+ * @return mapper
+ * @deprecated
+ */
+ public XMLToObjectMapper getMapper() {
+ return mapper;
+ }
+
+ /**
+ *
+ * @param mapper
+ * @deprecated
+ */
+ public void setMapper(XMLToObjectMapper mapper) {
+ this.mapper = mapper;
+ }
+
+ public long getVersion() {
+ return version;
+ }
+
+ public void setVersion(long version) {
+ this.version = version;
+ }
+
+ public long getExpiryTime() {
+ return expiryTime;
+ }
+
+ public void setExpiryTime(long expiryTime) {
+ this.expiryTime = expiryTime;
+ }
+
+ public boolean isExpired() {
+ return System.currentTimeMillis() > expiryTime;
+ }
+
+ public boolean isCached() {
+ return value != null;
+ }
+
+ private void handleException(String msg) {
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+
+ public static final int INLINE_STRING_TYPE = 0;
+ public static final int INLINE_XML_TYPE = 1;
+ public static final int VALUE_TYPE = 2;
+ public static final int SRC_TYPE = 3;
+ public static final int DYNAMIC_TYPE = 4;
+}
Modified:
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/SynapseConfiguration.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/SynapseConfiguration.java?view=diff&rev=451135&r1=451134&r2=451135
==============================================================================
---
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/SynapseConfiguration.java
(original)
+++
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/SynapseConfiguration.java
Thu Sep 28 22:40:14 2006
@@ -54,7 +54,7 @@
/**
* This is the "main" (or default) synapse mediator which mediates each
and every message
- * It could/would hold a Mediator object or a DynamicProperty (if loaded
from a registry)
+ * It could/would hold a Mediator object or a Property (if loaded from a
registry)
*/
private Object mainMediator = null;
@@ -73,7 +73,7 @@
* @param name the name of the sequence
* @param dp a DynamicProperty reflecting the dynamic sequence
*/
- public void addNamedSequence(String name, DynamicProperty dp) {
+ public void addNamedSequence(String name, Property dp) {
namedSequences.put(name, dp);
}
@@ -84,13 +84,14 @@
*/
public Mediator getNamedSequence(String name) {
Object o = namedSequences.get(name);
- if (o != null && o instanceof DynamicProperty) {
- DynamicProperty dp = (DynamicProperty) o;
- o = getRegistry(dp.getRegistryName()).getProperty(dp);
+ if (o != null && o instanceof Property) {
+ Property dp = (Property) o;
+ o = getProperty(dp);
if (o == null) {
handleException("Invalid DynamicSequence for name : " + name +
" from registry");
}
}
+ // todo: do we need to check weather the o is a Mediator
(DynamicProperty)
return (Mediator) o;
}
@@ -115,9 +116,9 @@
*/
public Mediator getMainMediator() {
Object o = mainMediator;
- if (o != null && o instanceof DynamicProperty) {
- DynamicProperty dp = (DynamicProperty) o;
- o = getRegistry(dp.getRegistryName()).getProperty(dp);
+ if (o != null && o instanceof Property) {
+ Property dp = (Property) o;
+ o = getProperty(dp);
if (o == null) {
handleException("Invalid Synapse Mainmediator from registry");
}
@@ -133,7 +134,7 @@
this.mainMediator = mainMediator;
}
- public void setMainMediator(DynamicProperty dp) {
+ public void setMainMediator(Property dp) {
this.mainMediator = dp;
}
@@ -142,8 +143,16 @@
* @param name the name of the property
* @param value its value
*/
- public void addProperty(String name, Object value) {
- globalProps.put(name, value);
+ public void addProperty(String name, Property value) {
+ if(name != null && value != null) {
+ if(globalProps.containsKey(name)) {
+ log.warn("Overiding the global property with name : " + name);
+ } else {
+ globalProps.put(name, value);
+ }
+ } else {
+ log.error("Name and the value of the property cannot be null");
+ }
}
/**
@@ -153,43 +162,62 @@
*/
public Object getProperty(String name) {
Object o = globalProps.get(name);
- if (o != null && o instanceof DynamicProperty) {
- DynamicProperty dp = (DynamicProperty) o;
- o = getRegistry(dp.getRegistryName()).getProperty(dp);
- if (o == null) {
- handleException("Invalid DynamicProperty reference for key : "
+ name);
+ Object obj = null;
+ if(o != null && o instanceof Property) {
+ Property prop = (Property) o;
+ if(prop.getType() == Property.DYNAMIC_TYPE) {
+ obj = getRegistry(prop.getRegistryName()).getProperty(prop);
+ } else {
+ obj = prop.getValue();
}
}
- return o;
+ return obj;
}
/**
- * Deletes the mediator named with the given name
- * @param name of the property to be deleted
+ * Get the Property object of the named property
+ * @param name key of the property being looked up
+ * @return its value
*/
- public void deleteProperty(String name) {
+ public Property getPropertyObject(String name) {
Object o = globalProps.get(name);
- if(o == null) {
- handleException("Invalid property reference for key : " + name);
+ Property prop = null;
+ if(o != null && o instanceof Property) {
+ prop = (Property) o;
} else {
- globalProps.remove(name);
+ handleException("Property with name " + name + " doesnt exists in
the registry");
}
+ return prop;
}
/**
- * Return the raw DynamicProperty property with the given name if such an
- * object exists. This call does not load/re-load or check expiry of the
- * actual object from the registry for a DynamicProperty. If the given name
- * does not map to a DynamicProperty, this method returns null
- * @param name the name of a DynamicProperty
- * @return raw DynamicProperty object, or null
+ * Get the value of the named property
+ * @param prop key of the property being looked up
+ * @return its value
*/
- public DynamicProperty getDynamicProperty(String name) {
+ public Object getProperty(Property prop) {
+ Object obj = null;
+ if(prop != null) {
+ if(prop.getType() == Property.DYNAMIC_TYPE) {
+ obj = getRegistry(prop.getRegistryName()).getProperty(prop);
+ } else {
+ obj = prop.getValue();
+ }
+ }
+ return obj;
+ }
+
+ /**
+ * Deletes the mediator named with the given name
+ * @param name of the property to be deleted
+ */
+ public void deleteProperty(String name) {
Object o = globalProps.get(name);
- if (o != null && o instanceof DynamicProperty) {
- return (DynamicProperty) o;
+ if(o == null) {
+ handleException("Invalid property reference for key : " + name);
+ } else {
+ globalProps.remove(name);
}
- return null;
}
/**
@@ -206,7 +234,7 @@
* @param name name of Dynamic Endpoint
* @param dp the DynamicProperty referencing the endpoint
*/
- public void addNamedEndpoint(String name, DynamicProperty dp) {
+ public void addNamedEndpoint(String name, Property dp) {
namedEndpoints.put(name, dp);
}
@@ -217,9 +245,9 @@
*/
public Endpoint getNamedEndpoint(String name) {
Object o = namedEndpoints.get(name);
- if (o != null && o instanceof DynamicProperty) {
- DynamicProperty dp = (DynamicProperty) o;
- o = getRegistry(dp.getRegistryName()).getProperty(dp);
+ if (o != null && o instanceof Property) {
+ Property dp = (Property) o;
+ o = getProperty(dp);
if (o == null) {
handleException("Invalid DynamicEndpoint for name : " + name +
" from registry");
}
@@ -255,7 +283,15 @@
* @return the Proxy service
*/
public ProxyService getProxyService(String name) {
- return (ProxyService) proxyServices.get(name);
+ Object o = proxyServices.get(name);
+ if (o != null && o instanceof Property) {
+ Property dp = (Property) o;
+ o = getProperty(dp);
+ if (o == null) {
+ handleException("Invalid DynamicEndpoint for name : " + name +
" from registry");
+ }
+ }
+ return (ProxyService) o;
}
/**
Modified:
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/Util.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/Util.java?view=diff&rev=451135&r1=451134&r2=451135
==============================================================================
---
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/Util.java
(original)
+++
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/Util.java
Thu Sep 28 22:40:14 2006
@@ -106,6 +106,7 @@
OMElement omElem = builder.getDocumentElement();
// detach from URL connection and keep in memory
+ // TODO remove this
omElem.build();
if (xmlToObject != null) {
Modified:
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/XMLConfigurationBuilder.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/XMLConfigurationBuilder.java?view=diff&rev=451135&r1=451134&r2=451135
==============================================================================
---
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/XMLConfigurationBuilder.java
(original)
+++
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/XMLConfigurationBuilder.java
Thu Sep 28 22:40:14 2006
@@ -18,13 +18,14 @@
import org.apache.axiom.om.OMAttribute;
import org.apache.axiom.om.OMContainer;
import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMText;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.synapse.SynapseException;
-import org.apache.synapse.config.DynamicProperty;
import org.apache.synapse.config.Endpoint;
import org.apache.synapse.config.SynapseConfiguration;
+import org.apache.synapse.config.Property;
import org.apache.synapse.core.axis2.ProxyService;
import org.apache.synapse.mediators.base.SequenceMediator;
import org.apache.synapse.mediators.base.SynapseMediator;
@@ -100,14 +101,17 @@
if (rules == null) {
handleException("A valid Synapse configuration MUST specify the
main mediator using the <rules> element");
} else {
- OMAttribute key = rules.getAttribute(new
QName(Constants.NULL_NAMESPACE, "key"));
+ OMAttribute key = rules.getAttribute(new
QName(Constants.NULL_NAMESPACE, "key"));
if (key != null) {
- DynamicProperty dp = new
DynamicProperty(key.getAttributeValue());
+ Property dp = new Property();
+ dp.setName("namespace");
+ dp.setType(Property.DYNAMIC_TYPE);
+ dp.setKey(key.getAttributeValue());
dp.setMapper(MediatorFactoryFinder.getInstance());
config.setMainMediator(dp);
} else {
SynapseMediator sm = (SynapseMediator)
- MediatorFactoryFinder.getInstance().getMediator(rules);
+ MediatorFactoryFinder.getInstance().getMediator(rules);
if (sm.getList().isEmpty()) {
handleException("Invalid configuration, the main mediator
specified by the <rules> element is empty");
} else {
@@ -132,7 +136,8 @@
if (is != null) {
try {
is.close();
- } catch (IOException e) {}
+ } catch (IOException e) {
+ }
}
return config;
@@ -142,55 +147,70 @@
* <pre>
* <set-property name="string" value="string"/>
* </pre>
+ *
* @param elem
*/
public static void defineProperty(SynapseConfiguration config, OMElement
elem) {
- OMAttribute name = elem.getAttribute(new
QName(Constants.NULL_NAMESPACE, "name"));
+ OMAttribute name = elem.getAttribute(new
QName(Constants.NULL_NAMESPACE, "name"));
OMAttribute value = elem.getAttribute(new
QName(Constants.NULL_NAMESPACE, "value"));
- OMAttribute src = elem.getAttribute(new
QName(Constants.NULL_NAMESPACE, "src"));
- OMAttribute key = elem.getAttribute(new
QName(Constants.NULL_NAMESPACE, "key"));
+ OMAttribute src = elem.getAttribute(new
QName(Constants.NULL_NAMESPACE, "src"));
+ OMAttribute key = elem.getAttribute(new
QName(Constants.NULL_NAMESPACE, "key"));
if (name == null) {
handleException("The 'name' attribute is required for a property
definition");
- } else if (
- (value != null && src != null) ||
- (value != null && key != null) ||
- (src != null && key != null)) {
- // if more than one attribute of (value|src|key) is specified
- handleException("A property must use exactly one of 'value', " +
- "'src' or 'key' attributes");
-
- } else if (value == null && src == null && key == null) {
- // if no attribute of (value|src|key) is specified, check if this
is a TextNode
- if (elem.getFirstOMChild() != null) {
- config.addProperty(name.getAttributeValue(),
elem.getFirstOMChild());
- } else {
+ } else {
+ if ((value != null && src != null) || (value != null && key !=
null) ||
+ (src != null && key != null)) {
+ // if more than one attribute of (value|src|key) is specified
handleException("A property must use exactly one of 'value', "
+
- "'src' or 'key' attributes");
- }
- }
-
- // a simple string literal property
- if (value != null) {
- config.addProperty(name.getAttributeValue(),
value.getAttributeValue());
-
- // a property (XML) loaded once through the given URL as an OMNode
- } else if (src != null) {
- try {
- config.addProperty(name.getAttributeValue(),
- org.apache.synapse.config.Util.getObject(new
URL(src.getAttributeValue())));
- } catch (MalformedURLException e) {
- handleException("Invalid URL specified by 'src' attribute : " +
- src.getAttributeValue(), e);
+ "'src' or 'key' attributes");
+ } else if (value == null && src == null && key == null) {
+ // if no attribute of (value|src|key) is specified, check if
this is a TextNode
+ if (elem.getFirstOMChild() != null) {
+ Property prop = new Property();
+ prop.setName(name.getAttributeValue());
+ if (elem.getFirstElement() instanceof OMText) {
+ // Inline String literal
+ prop.setType(Property.INLINE_STRING_TYPE);
+ prop.setValue(elem.getFirstElement().getText());
+ } else {
+ // Inline XML fragment as the property
+ prop.setType(Property.INLINE_XML_TYPE);
+ prop.setValue(elem.getFirstElement());
+ }
+ config.addProperty(name.getAttributeValue(), prop);
+ } else {
+ handleException("A property must use exactly one of
'value', " +
+ "'src' or 'key' attributes");
+ }
+ } else if (value != null) {
+ // a simple string literal property
+ Property prop = new Property();
+ prop.setName(name.getAttributeValue());
+ prop.setType(Property.VALUE_TYPE);
+ prop.setValue(value.getAttributeValue());
+ config.addProperty(name.getAttributeValue(), prop);
+ } else if (src != null) {
+ // a property (XML) loaded once through the given URL as an
OMNode
+ try {
+ Property prop = new Property();
+ prop.setName(name.getAttributeValue());
+ prop.setType(Property.SRC_TYPE);
+ prop.setSrc(new URL(src.getAttributeValue()));
+ prop.setValue(org.apache.synapse.config.Util.getObject(
+ new URL(src.getAttributeValue())));
+ config.addProperty(name.getAttributeValue(), prop);
+ } catch (MalformedURLException e) {
+ handleException("Invalid URL specified by 'src' attribute
: " +
+ src.getAttributeValue(), e);
+ }
+ } else {
+ // a DynamicProperty which refers to an XML resource on a
remote registry
+ Property prop = new Property();
+ prop.setName(name.getAttributeValue());
+ prop.setType(Property.DYNAMIC_TYPE);
+ prop.setKey(key.getAttributeValue());
+ config.addProperty(name.getAttributeValue(), prop);
}
-
- // a DynamicProperty which refers to an XML resource on a remote
registry
- } else if (key != null) {
- config.addProperty(name.getAttributeValue(),
- new DynamicProperty(key.getAttributeValue()));
-
- // an inline XML fragment
- } else {
- config.addProperty(name.getAttributeValue(),
elem.getFirstElement());
}
}
@@ -200,38 +220,44 @@
* Mediator*
* </sequence>
* </pre>
+ *
* @param ele
*/
public static void defineSequence(SynapseConfiguration config, OMElement
ele) {
OMAttribute name = ele.getAttribute(new
QName(Constants.NULL_NAMESPACE, "name"));
- OMAttribute key = ele.getAttribute(new
QName(Constants.NULL_NAMESPACE, "key"));
+ OMAttribute key = ele.getAttribute(new QName(Constants.NULL_NAMESPACE,
"key"));
if (name != null && key != null) {
- DynamicProperty dp = new DynamicProperty(key.getAttributeValue());
+ Property dp = new Property();
+ dp.setType(Property.DYNAMIC_TYPE);
+ dp.setKey(key.getAttributeValue());
dp.setMapper(MediatorFactoryFinder.getInstance());
config.addNamedSequence(name.getAttributeValue(), dp);
} else {
SequenceMediator seq = (SequenceMediator)
- MediatorFactoryFinder.getInstance().getMediator(ele);
+ MediatorFactoryFinder.getInstance().getMediator(ele);
config.addNamedSequence(seq.getName(), seq);
}
}
/**
* Create an endpoint definition digesting an XML fragment
- *
+ * <p/>
* <pre>
* <endpoint name="string" [key="string"] [address="url"]>
* .. extensibility ..
* </endpoint>
* </pre>
+ *
* @param ele the <endpoint> element
*/
public static void defineEndpoint(SynapseConfiguration config, OMElement
ele) {
OMAttribute name = ele.getAttribute(new
QName(Constants.NULL_NAMESPACE, "name"));
- OMAttribute key = ele.getAttribute(new
QName(Constants.NULL_NAMESPACE, "key"));
+ OMAttribute key = ele.getAttribute(new QName(Constants.NULL_NAMESPACE,
"key"));
if (name != null && key != null) {
- DynamicProperty dp = new DynamicProperty(key.getAttributeValue());
+ Property dp = new Property();
+ dp.setType(Property.DYNAMIC_TYPE);
+ dp.setKey(key.getAttributeValue());
dp.setMapper(EndpointFactory.getInstance());
config.addNamedEndpoint(name.getAttributeValue(), dp);
} else {
Modified:
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/XMLConfigurationSerializer.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/XMLConfigurationSerializer.java?view=diff&rev=451135&r1=451134&r2=451135
==============================================================================
---
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/XMLConfigurationSerializer.java
(original)
+++
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/config/xml/XMLConfigurationSerializer.java
Thu Sep 28 22:40:14 2006
@@ -22,15 +22,13 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.synapse.SynapseException;
-import org.apache.synapse.config.DynamicProperty;
import org.apache.synapse.config.Endpoint;
import org.apache.synapse.config.SynapseConfiguration;
+import org.apache.synapse.config.Property;
import org.apache.synapse.core.axis2.ProxyService;
import javax.xml.stream.XMLStreamException;
import java.io.OutputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
import java.util.Iterator;
public class XMLConfigurationSerializer {
@@ -91,7 +89,6 @@
}
private static void serializeProperties(OMElement definitions,
SynapseConfiguration synCfg) {
-
Iterator iter = synCfg.getGlobalProps().keySet().iterator();
while (iter.hasNext()) {
String propertyName = (String) iter.next();
@@ -99,28 +96,22 @@
property.addAttribute(fac.createOMAttribute(
"name", nullNS, propertyName));
- DynamicProperty dp = synCfg.getDynamicProperty(propertyName);
- if (dp != null) {
+ Property prop = synCfg.getPropertyObject(propertyName);
+ if (prop.getType() == Property.DYNAMIC_TYPE) {
property.addAttribute(fac.createOMAttribute(
- "key", nullNS, dp.getKey()));
-
+ "key", nullNS, prop.getKey()));
+ } else if (prop.getType() == Property.SRC_TYPE) {
+ property.addAttribute(fac.createOMAttribute(
+ "src", nullNS, prop.getSrc().toString()));
+ } else if (prop.getType() == Property.VALUE_TYPE) {
+ property.addAttribute(fac.createOMAttribute(
+ "value", nullNS, (String) prop.getValue()));
+ } else if (prop.getType() == Property.INLINE_XML_TYPE) {
+ property.addChild((OMElement) prop.getValue());
+ } else if (prop.getType() == Property.INLINE_STRING_TYPE) {
+ property.addChild(fac.createOMText((String) prop.getValue()));
} else {
- Object prop = synCfg.getProperty(propertyName);
- if (prop instanceof String) {
- try {
- // this is a hack to test if the string is a URL
- new URL((String) prop);
- property.addAttribute(fac.createOMAttribute(
- "src", nullNS, (String) prop));
-
- } catch (MalformedURLException e) {
- property.addAttribute(fac.createOMAttribute(
- "value", nullNS, (String) prop));
- }
-
- } else if (prop instanceof OMElement) {
- property.addChild((OMElement) prop);
- }
+ handleException("Property type undefined");
}
definitions.addChild(property);
@@ -135,12 +126,12 @@
Object endpt = synCfg.getNamedEndpoint(endpointName);
OMElement endpoint = fac.createOMElement("endpoint", synNS);
- if (endpt instanceof DynamicProperty) {
- DynamicProperty dp = (DynamicProperty) endpt;
+ if (endpt instanceof Property) {
+ Property dp = (Property) endpt;
endpoint.addAttribute(fac.createOMAttribute(
- "name", nullNS, endpointName));
+ "name", nullNS, endpointName));
endpoint.addAttribute(fac.createOMAttribute(
- "key", nullNS, dp.getKey()));
+ "key", nullNS, dp.getKey()));
} else if (endpt instanceof Endpoint) {
EndpointSerializer.serializeEndpoint((Endpoint) endpt,
definitions);
Modified:
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/registry/AbstractRegistry.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/registry/AbstractRegistry.java?view=diff&rev=451135&r1=451134&r2=451135
==============================================================================
---
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/registry/AbstractRegistry.java
(original)
+++
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/registry/AbstractRegistry.java
Thu Sep 28 22:40:14 2006
@@ -18,8 +18,8 @@
import org.apache.axiom.om.OMNode;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.synapse.config.DynamicProperty;
import org.apache.synapse.config.XMLToObjectMapper;
+import org.apache.synapse.config.Property;
import java.net.URI;
import java.util.HashMap;
@@ -43,7 +43,7 @@
* @param dp the DynamicProperty for the registry lookup
* @return the matching resultant object
*/
- public Object getProperty(DynamicProperty dp) {
+ public Object getProperty(Property dp) {
OMNode omNode = null;
RegistryEntry re = null;
Modified:
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/registry/Registry.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/registry/Registry.java?view=diff&rev=451135&r1=451134&r2=451135
==============================================================================
---
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/registry/Registry.java
(original)
+++
incubator/synapse/trunk/java/modules/core/src/org/apache/synapse/registry/Registry.java
Thu Sep 28 22:40:14 2006
@@ -16,7 +16,7 @@
package org.apache.synapse.registry;
import org.apache.axiom.om.OMNode;
-import org.apache.synapse.config.DynamicProperty;
+import org.apache.synapse.config.Property;
import java.util.Map;
@@ -40,7 +40,7 @@
* @param dp the DynamicProperty
* @return the value from the registry or local cache
*/
- public Object getProperty(DynamicProperty dp);
+ public Object getProperty(Property dp);
/**
* Get the registry entry for the given key
Modified:
incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/mediators/TestUtils.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/mediators/TestUtils.java?view=diff&rev=451135&r1=451134&r2=451135
==============================================================================
---
incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/mediators/TestUtils.java
(original)
+++
incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/mediators/TestUtils.java
Thu Sep 28 22:40:14 2006
@@ -22,10 +22,13 @@
import org.apache.synapse.MessageContext;
import org.apache.synapse.TestMessageContext;
import org.apache.synapse.config.SynapseConfiguration;
+import org.apache.synapse.config.Property;
import org.apache.synapse.core.SynapseEnvironment;
import org.apache.synapse.core.axis2.Axis2MessageContext;
import org.apache.synapse.core.axis2.Axis2SynapseEnvironment;
import org.apache.synapse.registry.url.SimpleURLRegistry;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import javax.xml.stream.XMLInputFactory;
import javax.xml.stream.XMLStreamReader;
@@ -46,7 +49,7 @@
Iterator iter = props.keySet().iterator();
while (iter.hasNext()) {
String key = (String) iter.next();
- testConfig.addProperty(key, props.get(key));
+ testConfig.addProperty(key, (Property)props.get(key));
}
}
synCtx.setConfiguration(testConfig);
Modified:
incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/mediators/builtin/PropertyMediatorTest.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/mediators/builtin/PropertyMediatorTest.java?view=diff&rev=451135&r1=451134&r2=451135
==============================================================================
---
incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/mediators/builtin/PropertyMediatorTest.java
(original)
+++
incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/mediators/builtin/PropertyMediatorTest.java
Thu Sep 28 22:40:14 2006
@@ -20,6 +20,7 @@
import org.apache.synapse.MessageContext;
import org.apache.synapse.core.axis2.Axis2MessageContext;
import org.apache.synapse.config.SynapseConfiguration;
+import org.apache.synapse.config.Property;
import org.apache.synapse.mediators.MediatorProperty;
import org.apache.synapse.mediators.TestUtils;
@@ -48,7 +49,11 @@
MessageContext synCtx = TestUtils.getTestContext("<empty/>");
SynapseConfiguration synCfg = new SynapseConfiguration();
- synCfg.addProperty("name", "value");
+ Property prop = new Property();
+ prop.setName("name");
+ prop.setType(Property.VALUE_TYPE);
+ prop.setValue("value");
+ synCfg.addProperty("name", prop);
synCtx.setConfiguration(synCfg);
assertTrue(
Modified:
incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/registry/url/SimpleURLRegistryTest.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/registry/url/SimpleURLRegistryTest.java?view=diff&rev=451135&r1=451134&r2=451135
==============================================================================
---
incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/registry/url/SimpleURLRegistryTest.java
(original)
+++
incubator/synapse/trunk/java/modules/core/test/org/apache/synapse/registry/url/SimpleURLRegistryTest.java
Thu Sep 28 22:40:14 2006
@@ -16,7 +16,7 @@
package org.apache.synapse.registry.url;
import junit.framework.TestCase;
-import org.apache.synapse.config.DynamicProperty;
+import org.apache.synapse.config.Property;
import org.apache.synapse.registry.Registry;
import java.io.BufferedWriter;
@@ -37,18 +37,20 @@
Registry reg = new SimpleURLRegistry();
reg.addConfigProperty("root", "file:./");
reg.addConfigProperty("cachableDuration", "1500");
- DynamicProperty dp = new DynamicProperty(FILE);
+ Property prop = new Property();
+ prop.setType(Property.DYNAMIC_TYPE);
+ prop.setKey(FILE);
// initial load of file from registry
- assertEquals(TEXT_1, reg.getProperty(dp).toString());
+ assertEquals(TEXT_1, reg.getProperty(prop).toString());
// sleep 1 sec
Thread.sleep(1000);
- assertEquals(TEXT_1, reg.getProperty(dp).toString());
+ assertEquals(TEXT_1, reg.getProperty(prop).toString());
// sleep another 1 sec, has expired in cache, but content hasnt changed
Thread.sleep(1000);
- assertEquals(TEXT_1, reg.getProperty(dp).toString());
+ assertEquals(TEXT_1, reg.getProperty(prop).toString());
// the renewed cache should be valid for another 1.5 secs
// change the file now and change next cache duration
@@ -56,15 +58,15 @@
reg.addConfigProperty("cachableDuration", "100");
// still cached content should be available and valid
- assertEquals(TEXT_1, reg.getProperty(dp).toString());
+ assertEquals(TEXT_1, reg.getProperty(prop).toString());
// now sleep 1 sec, still cache should be valid
Thread.sleep(1000);
- assertEquals(TEXT_1, reg.getProperty(dp).toString());
+ assertEquals(TEXT_1, reg.getProperty(prop).toString());
// sleep another 1 sec.. cache should expire and new content should be
loaded
Thread.sleep(1000);
- assertEquals(TEXT_2, reg.getProperty(dp).toString());
+ assertEquals(TEXT_2, reg.getProperty(prop).toString());
// change content back to original
writeToFile(TEXT_1);
@@ -72,7 +74,7 @@
// sleep for .5 sec, now the new content should be loaded as new
expiry time
// is .1 sec
Thread.sleep(500);
- assertEquals(TEXT_1, reg.getProperty(dp).toString());
+ assertEquals(TEXT_1, reg.getProperty(prop).toString());
}
public void tearDown() throws Exception {
Modified:
incubator/synapse/trunk/java/modules/extensions/src/org/apache/synapse/mediators/spring/SpringMediator.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/extensions/src/org/apache/synapse/mediators/spring/SpringMediator.java?view=diff&rev=451135&r1=451134&r2=451135
==============================================================================
---
incubator/synapse/trunk/java/modules/extensions/src/org/apache/synapse/mediators/spring/SpringMediator.java
(original)
+++
incubator/synapse/trunk/java/modules/extensions/src/org/apache/synapse/mediators/spring/SpringMediator.java
Thu Sep 28 22:40:14 2006
@@ -20,8 +20,8 @@
import org.apache.synapse.MessageContext;
import org.apache.synapse.SynapseException;
import org.apache.synapse.Mediator;
-import org.apache.synapse.config.DynamicProperty;
import org.apache.synapse.config.Util;
+import org.apache.synapse.config.Property;
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.GenericApplicationContext;
@@ -54,7 +54,7 @@
public boolean mediate(MessageContext synCtx) {
- DynamicProperty dp =
synCtx.getConfiguration().getDynamicProperty(configKey);
+ Property dp = synCtx.getConfiguration().getPropertyObject(configKey);
// if the configKey refers to a dynamic property
if (dp != null) {
Modified:
incubator/synapse/trunk/java/modules/extensions/src/org/apache/synapse/mediators/transform/XSLTMediator.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/extensions/src/org/apache/synapse/mediators/transform/XSLTMediator.java?view=diff&rev=451135&r1=451134&r2=451135
==============================================================================
---
incubator/synapse/trunk/java/modules/extensions/src/org/apache/synapse/mediators/transform/XSLTMediator.java
(original)
+++
incubator/synapse/trunk/java/modules/extensions/src/org/apache/synapse/mediators/transform/XSLTMediator.java
Thu Sep 28 22:40:14 2006
@@ -27,8 +27,8 @@
import org.apache.commons.logging.LogFactory;
import org.apache.synapse.MessageContext;
import org.apache.synapse.SynapseException;
-import org.apache.synapse.config.DynamicProperty;
import org.apache.synapse.config.Util;
+import org.apache.synapse.config.Property;
import org.apache.synapse.mediators.AbstractMediator;
import org.apache.synapse.mediators.MediatorProperty;
import org.jaxen.JaxenException;
@@ -128,7 +128,7 @@
}
// build transformer - if necessary
- DynamicProperty dp =
msgCtx.getConfiguration().getDynamicProperty(xsltKey);
+ Property dp = msgCtx.getConfiguration().getPropertyObject(xsltKey);
// if the xsltKey refers to a dynamic property
if (dp != null) {
Modified:
incubator/synapse/trunk/java/modules/extensions/src/org/apache/synapse/mediators/validate/ValidateMediator.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/extensions/src/org/apache/synapse/mediators/validate/ValidateMediator.java?view=diff&rev=451135&r1=451134&r2=451135
==============================================================================
---
incubator/synapse/trunk/java/modules/extensions/src/org/apache/synapse/mediators/validate/ValidateMediator.java
(original)
+++
incubator/synapse/trunk/java/modules/extensions/src/org/apache/synapse/mediators/validate/ValidateMediator.java
Thu Sep 28 22:40:14 2006
@@ -23,8 +23,8 @@
import org.apache.commons.logging.LogFactory;
import org.apache.synapse.MessageContext;
import org.apache.synapse.SynapseException;
-import org.apache.synapse.config.DynamicProperty;
import org.apache.synapse.config.Util;
+import org.apache.synapse.config.Property;
import org.apache.synapse.mediators.AbstractListMediator;
import org.apache.synapse.mediators.MediatorProperty;
import org.jaxen.JaxenException;
@@ -201,7 +201,7 @@
Iterator iter = schemaKeys.iterator();
while (iter.hasNext()) {
String propKey = (String) iter.next();
- DynamicProperty dp =
msgCtx.getConfiguration().getDynamicProperty(propKey);
+ Property dp = msgCtx.getConfiguration().getPropertyObject(propKey);
if (dp != null) {
if (!dp.isCached() || dp.isExpired()) {
reCreate = true; // request re-initialization of
Validator
Modified:
incubator/synapse/trunk/java/modules/extensions/test/org/apache/synapse/ValidateMediatorTest.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/extensions/test/org/apache/synapse/ValidateMediatorTest.java?view=diff&rev=451135&r1=451134&r2=451135
==============================================================================
---
incubator/synapse/trunk/java/modules/extensions/test/org/apache/synapse/ValidateMediatorTest.java
(original)
+++
incubator/synapse/trunk/java/modules/extensions/test/org/apache/synapse/ValidateMediatorTest.java
Thu Sep 28 22:40:14 2006
@@ -19,10 +19,10 @@
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.impl.builder.StAXOMBuilder;
import org.apache.axiom.om.xpath.AXIOMXPath;
-import org.apache.synapse.config.DynamicProperty;
import org.apache.synapse.mediators.TestUtils;
import org.apache.synapse.mediators.validate.ValidateMediator;
import org.apache.synapse.mediators.validate.ValidateMediatorFactory;
+import org.apache.synapse.config.Property;
import javax.xml.stream.XMLStreamException;
import java.io.ByteArrayInputStream;
@@ -149,7 +149,10 @@
validate.addChild(testMediator);
Map props = new HashMap();
- props.put("xsd-key", new
DynamicProperty("file:../core/test-resources/misc/validate.xsd"));
+ Property prop = new Property();
+ prop.setType(Property.DYNAMIC_TYPE);
+ prop.setKey("file:../core/test-resources/misc/validate.xsd");
+ props.put("xsd-key", prop);
// test validate mediator, with static enveope
validate.mediate(TestUtils.getTestContext(VALID_ENVELOPE, props));
@@ -176,8 +179,14 @@
validate.addChild(testMediator);
Map props = new HashMap();
- props.put("xsd-key-1", new
DynamicProperty("file:../core/test-resources/misc/validate.xsd"));
- props.put("xsd-key-2", new
DynamicProperty("file:../core/test-resources/misc/validate2.xsd"));
+ Property prop = new Property();
+ prop.setType(Property.DYNAMIC_TYPE);
+ prop.setKey("file:../core/test-resources/misc/validate.xsd");
+ props.put("xsd-key-1", prop);
+ Property prop2 = new Property();
+ prop2.setType(Property.DYNAMIC_TYPE);
+ prop2.setKey("file:../core/test-resources/misc/validate2.xsd");
+ props.put("xsd-key-2", prop2);
// test validate mediator, with static enveope
validate.mediate(TestUtils.getTestContext(VALID_ENVELOPE_TWO_SCHEMAS,
props));
@@ -204,8 +213,14 @@
validate.addChild(testMediator);
Map props = new HashMap();
- props.put("xsd-key-1", new
DynamicProperty("file:../core/test-resources/misc/validate.xsd"));
- props.put("xsd-key-2", new
DynamicProperty("file:../core/test-resources/misc/validate2.xsd"));
+ Property prop = new Property();
+ prop.setType(Property.DYNAMIC_TYPE);
+ prop.setKey("file:../core/test-resources/misc/validate.xsd");
+ props.put("xsd-key-1", prop);
+ Property prop2 = new Property();
+ prop2.setType(Property.DYNAMIC_TYPE);
+ prop2.setKey("file:../core/test-resources/misc/validate2.xsd");
+ props.put("xsd-key-2", prop2);
// test validate mediator, with static enveope
validate.mediate(TestUtils.getTestContext(INVALID_ENVELOPE_TWO_SCHEMAS, props));
@@ -231,7 +246,10 @@
validate.addChild(testMediator);
Map props = new HashMap();
- props.put("xsd-key-1", new
DynamicProperty("file:../core/test-resources/misc/validate.xsd"));
+ Property prop = new Property();
+ prop.setType(Property.DYNAMIC_TYPE);
+ prop.setKey("file:../core/test-resources/misc/validate.xsd");
+ props.put("xsd-key-1", prop);
// test validate mediator, with static enveope
validate.mediate(TestUtils.getTestContext(IN_VALID_ENVELOPE, props));
@@ -257,7 +275,10 @@
validate.addChild(testMediator);
Map props = new HashMap();
- props.put("xsd-key-1", new
DynamicProperty("file:../core/test-resources/misc/validate.xsd"));
+ Property prop = new Property();
+ prop.setType(Property.DYNAMIC_TYPE);
+ prop.setKey("file:../core/test-resources/misc/validate.xsd");
+ props.put("xsd-key-1", prop);
// test validate mediator, with static enveope
validate.mediate(TestUtils.getTestContext(VALID_ENVELOPE_NO_NS,
props));
@@ -283,7 +304,10 @@
validate.addChild(testMediator);
Map props = new HashMap();
- props.put("xsd-key-1", new
DynamicProperty("file:../core/test-resources/misc/validate.xsd"));
+ Property prop = new Property();
+ prop.setType(Property.DYNAMIC_TYPE);
+ prop.setKey("file:../core/test-resources/misc/validate.xsd");
+ props.put("xsd-key-1", prop);
// test validate mediator, with static enveope
validate.mediate(TestUtils.getTestContext(IN_VALID_ENVELOPE_NO_NS,
props));
@@ -334,7 +358,10 @@
validate.addChild(testMediator);
Map props = new HashMap();
- props.put("xsd-key-1", new
DynamicProperty("file:../core/test-resources/misc/validate.xsd"));
+ Property prop = new Property();
+ prop.setType(Property.DYNAMIC_TYPE);
+ prop.setKey("file:../core/test-resources/misc/validate.xsd");
+ props.put("xsd-key-1", prop);
// test validate mediator, with static enveope
Modified:
incubator/synapse/trunk/java/modules/extensions/test/org/apache/synapse/XSLTMediatorTest.java
URL:
http://svn.apache.org/viewvc/incubator/synapse/trunk/java/modules/extensions/test/org/apache/synapse/XSLTMediatorTest.java?view=diff&rev=451135&r1=451134&r2=451135
==============================================================================
---
incubator/synapse/trunk/java/modules/extensions/test/org/apache/synapse/XSLTMediatorTest.java
(original)
+++
incubator/synapse/trunk/java/modules/extensions/test/org/apache/synapse/XSLTMediatorTest.java
Thu Sep 28 22:40:14 2006
@@ -19,9 +19,11 @@
import org.apache.axiom.om.OMContainer;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.xpath.AXIOMXPath;
-import org.apache.synapse.config.DynamicProperty;
import org.apache.synapse.mediators.TestUtils;
import org.apache.synapse.mediators.transform.XSLTMediator;
+import org.apache.synapse.config.Property;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import java.util.HashMap;
import java.util.Map;
@@ -56,7 +58,10 @@
transformMediator.setXsltKey("xslt-key");
Map props = new HashMap();
- props.put("xslt-key", new
DynamicProperty("file:../core/test-resources/misc/transform.xslt"));
+ Property prop = new Property();
+ prop.setType(Property.DYNAMIC_TYPE);
+ prop.setKey("file:../core/test-resources/misc/transform.xslt");
+ props.put("xslt-key", prop);
// invoke transformation, with static enveope
MessageContext synCtx = TestUtils.getTestContext(SOURCE, props);
@@ -93,7 +98,10 @@
transformMediator.setXsltKey("xslt-key");
Map props = new HashMap();
- props.put("xslt-key", new
DynamicProperty("file:../core/test-resources/misc/transform.xslt"));
+ Property prop = new Property();
+ prop.setType(Property.DYNAMIC_TYPE);
+ prop.setKey("file:../core/test-resources/misc/transform.xslt");
+ props.put("xslt-key", prop);
// invoke transformation, with static enveope
MessageContext synCtx = TestUtils.getTestContext(SOURCE, props);
@@ -131,8 +139,11 @@
transformMediator.setXsltKey("xslt-key");
Map props = new HashMap();
- props.put("xslt-key", new
DynamicProperty("file:../core/test-resources/misc/transform.xslt"));
-
+ Property prop = new Property();
+ prop.setType(Property.DYNAMIC_TYPE);
+ prop.setKey("file:../core/test-resources/misc/transform.xslt");
+ props.put("xslt-key", prop);
+
// invoke transformation, with static enveope
MessageContext synCtx = TestUtils.getTestContext(ENCLOSING_SOURCE,
props);
transformMediator.mediate(synCtx);
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]