You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@synapse.apache.org by ch...@apache.org on 2007/03/07 11:43:16 UTC
svn commit: r515523 - in
/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse:
config/ config/xml/ config/xml/endpoints/ mediators/builtin/send/
mediators/builtin/send/endpoints/ registry/
Author: chathura_ce
Date: Wed Mar 7 02:43:15 2007
New Revision: 515523
URL: http://svn.apache.org/viewvc?view=rev&rev=515523
Log:
Implemented the registry support for new endpoints. Now endpoints can be created from the configurations stored in the registry.
Added:
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/XMLToEndpointMapper.java
Modified:
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/EndpointDefinition.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/EndpointDefinitionFactory.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/EndpointDefinitionSerializer.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/RegistryFactory.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SendMediatorFactory.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SendMediatorSerializer.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/XMLConfigurationSerializer.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/AddressEndpointFactory.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointAbstractFactory.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointAbstractSerializer.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointFactory.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointSerializer.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/IndirectEndpointFactory.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/IndirectEndpointSerializer.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/SendConstants.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/SendMediator.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/AddressEndpoint.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/Endpoint.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/FailoverEndpoint.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/IndirectEndpoint.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/LoadbalanceEndpoint.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/WSDLEndpoint.java
webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/AbstractRegistry.java
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/EndpointDefinition.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/EndpointDefinition.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/EndpointDefinition.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/EndpointDefinition.java Wed Mar 7 02:43:15 2007
@@ -23,20 +23,14 @@
/**
- * An endpoint can be used to give a logical name to an endpoint address, and possibly reused.
- * If the address is not just a simple URL, then extensibility elements may be used to indicate
- * the address. (i.e. an endpoint always will "resolve" into an absolute endpoint address.
- *
- * In future registry lookups etc may be used to resolve a named endpoint into its absolute address
+ * Endpoint definition contains the information about an web services endpoint. It is used by leaf
+ * level endpoints to keep these information (e.g. AddressEndpoint and WSDLEndpoint). An EndpointDefinition
+ * object is used by only one endpoint and they cannot be looked up in the registry.
*/
public class EndpointDefinition {
- /** The name of this endpoint instance */
- private String name = null;
/** The simple address this endpoint resolves to - if explicitly specified */
private String address = null;
- /** The name of the actual endpoint to which this instance refers to */
- private String ref = null;
/** Should messages be sent in an WS-RM Sequence ? */
private boolean reliableMessagingOn = false;
/** Should messages be sent using WS-A? */
@@ -57,32 +51,11 @@
private boolean useMTOM = false;
/** use SWA **/
private boolean useSwa = false;
- /** is this definition dynamic */
- private boolean dynamic = false;
- /** the registry key to load this definition if dynamic */
- private String registryKey = null;
-
/** To decide to whether statistics should have collected or not */
private int statisticsEnable = Constants.STATISTICS_UNSET;
/**
- * Return the name of the endpoint
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Set the name of this named endpoint
- * @param name the name to be set
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
* This should return the absolute EPR address referenced by the named endpoint. This may be possibly computed.
* @return an absolute address to be used to reference the named endpoint
*/
@@ -99,22 +72,6 @@
}
/**
- * Get the name of the Endpoint to which this instance refers to
- * @return the name of the referenced endpoint
- */
- public String getRef() {
- return ref;
- }
-
- /**
- * Set the name of an Endpoint as the referenced endpoint of this instance
- * @param ref the name of the Endpoint referenced
- */
- public void setRef(String ref) {
- this.ref = ref;
- }
-
- /**
* Is RM turned on on this endpoint?
* @return true if on
*/
@@ -249,37 +206,5 @@
*/
public void setStatisticsEnable(int statisticsEnable) {
this.statisticsEnable = statisticsEnable;
- }
-
- /**
- * Is this a dynamic endpoint?
- * @return true if dynamic
- */
- public boolean isDynamic() {
- return dynamic;
- }
-
- /**
- * Mark this as a dynamic endpoint
- * @param dynamic true if this is a dynamic endpoint
- */
- public void setDynamic(boolean dynamic) {
- this.dynamic = dynamic;
- }
-
- /**
- * Return the registry key used to load this endpoint dynamically
- * @return
- */
- public String getRegistryKey() {
- return registryKey;
- }
-
- /**
- * get the registry key used to load this endpoint dynamically
- * @param registryKey
- */
- public void setRegistryKey(String registryKey) {
- this.registryKey = registryKey;
}
}
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java Wed Mar 7 02:43:15 2007
@@ -26,6 +26,8 @@
import org.apache.synapse.Constants;
import org.apache.synapse.mediators.builtin.send.endpoints.Endpoint;
import org.apache.synapse.config.xml.MediatorFactoryFinder;
+import org.apache.synapse.config.xml.endpoints.EndpointAbstractFactory;
+import org.apache.synapse.config.xml.endpoints.XMLToEndpointMapper;
import org.apache.synapse.core.axis2.ProxyService;
import org.apache.synapse.registry.Registry;
import org.apache.axis2.AxisFault;
@@ -243,8 +245,7 @@
return (Endpoint) o;
} else if (registry != null) {
Entry entry = new Entry(key);
- //entry.setMapper(EndpointFactory.getInstance());
- // TODO chathura
+ entry.setMapper(XMLToEndpointMapper.getInstance());
o = registry.getResource(entry);
if (o != null && o instanceof Endpoint) {
return (Endpoint) o;
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/EndpointDefinitionFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/EndpointDefinitionFactory.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/EndpointDefinitionFactory.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/EndpointDefinitionFactory.java Wed Mar 7 02:43:15 2007
@@ -44,75 +44,43 @@
*/
public class EndpointDefinitionFactory implements XMLToObjectMapper {
- private static Log log = LogFactory.getLog(EndpointDefinitionFactory.class);
+ private static Log log = LogFactory.getLog(EndpointDefinitionFactory.class);
- private static final EndpointDefinitionFactory instance = new EndpointDefinitionFactory();
+ private static final EndpointDefinitionFactory instance = new EndpointDefinitionFactory();
- private EndpointDefinitionFactory() {
- }
+ private EndpointDefinitionFactory() {
+ }
- public static EndpointDefinition createEndpoint(OMElement elem,
- boolean anonymousEndpoint) {
-
- OMAttribute name = elem.getAttribute(new QName(
- Constants.NULL_NAMESPACE, "name"));
- OMAttribute address = elem.getAttribute(new QName(
- Constants.NULL_NAMESPACE, "address"));
- OMAttribute force = elem.getAttribute(new QName(
- Constants.NULL_NAMESPACE, "force"));
+ public static EndpointDefinition createEndpoint(OMElement elem,
+ boolean anonymousEndpoint) {
+
+ OMAttribute address = elem.getAttribute(new QName(
+ Constants.NULL_NAMESPACE, "address"));
+ OMAttribute force = elem.getAttribute(new QName(
+ Constants.NULL_NAMESPACE, "force"));
OMAttribute optimize = elem.getAttribute(new QName(
- Constants.NULL_NAMESPACE, "optimize"));
+ Constants.NULL_NAMESPACE, "optimize"));
EndpointDefinition endpoint = new EndpointDefinition();
- if (!anonymousEndpoint) {
- if (name == null) {
- handleException("The 'name' attribute is required for a named endpoint definition");
- } else {
- endpoint.setName(name.getAttributeValue());
- }
- if (address != null) {
- endpoint.setAddress(address.getAttributeValue());
- } else {
- // right now an address is *required*
- handleException("The 'address' attribute is required for an endpoint");
- }
- OMAttribute statistics = elem.getAttribute(
- new QName(Constants.NULL_NAMESPACE, Constants.STATISTICS_ATTRIB_NAME));
- if (statistics != null) {
- String statisticsValue = statistics.getAttributeValue();
- if (statisticsValue != null) {
- if (Constants.STATISTICS_ENABLE.equals(statisticsValue)) {
- endpoint.setStatisticsEnable(org.apache.synapse.Constants.STATISTICS_ON);
- } else if (Constants.STATISTICS_DISABLE.equals(statisticsValue)) {
- endpoint.setStatisticsEnable(org.apache.synapse.Constants.STATISTICS_OFF);
- }
- }
- }
+
+ if (address != null) {
+ endpoint.setAddress(address.getAttributeValue());
} else {
- OMAttribute reference = elem.getAttribute(new QName(
- Constants.NULL_NAMESPACE, "key"));
- if (reference != null) {
- endpoint.setRef(reference.getAttributeValue());
- } else if (address != null) {
- endpoint.setAddress(address.getAttributeValue());
- } else {
- handleException("One of the 'address' or 'ref' attributes are required in an "
- + "anonymous endpoint");
- }
- }
-
-
- if (force != null)
- {
- String forceValue = force.getAttributeValue().trim().toLowerCase();
- if (forceValue.equals("pox")) {
- endpoint.setForcePOX(true);
- } else if (forceValue.equals("soap")) {
- endpoint.setForceSOAP(true);
- } else {
- handleException("force value -\""+forceValue+"\" not yet implemented");
- }
- }
+ handleException("One of the 'address' or 'ref' attributes are required in an "
+ + "anonymous endpoint");
+ }
+
+ if (force != null)
+ {
+ String forceValue = force.getAttributeValue().trim().toLowerCase();
+ if (forceValue.equals("pox")) {
+ endpoint.setForcePOX(true);
+ } else if (forceValue.equals("soap")) {
+ endpoint.setForceSOAP(true);
+ } else {
+ handleException("force value -\""+forceValue+"\" not yet implemented");
+ }
+ }
if (optimize != null && optimize.getAttributeValue().length() > 0) {
String method = optimize.getAttributeValue().trim();
@@ -120,68 +88,68 @@
endpoint.setUseMTOM(true);
} else if ("swa".equalsIgnoreCase(method)) {
endpoint.setUseSwa(true);
- }
+ }
}
OMElement wsAddr = elem.getFirstChildWithName(new QName(
- Constants.SYNAPSE_NAMESPACE, "enableAddressing"));
- if (wsAddr != null) {
- endpoint.setAddressingOn(true);
- String useSepList = wsAddr.getAttributeValue(new QName(
- "separateListener"));
- if (useSepList != null) {
- if (useSepList.trim().toLowerCase().startsWith("tr")
- || useSepList.trim().startsWith("1")) {
- endpoint.setUseSeparateListener(true);
- }
- }
- }
-
- OMElement wsSec = elem.getFirstChildWithName(new QName(
- Constants.SYNAPSE_NAMESPACE, "enableSec"));
- if (wsSec != null) {
- endpoint.setSecurityOn(true);
- OMAttribute policy = wsSec.getAttribute(new QName(
- Constants.NULL_NAMESPACE, "policy"));
- if (policy != null) {
- endpoint.setWsSecPolicyKey(policy.getAttributeValue());
- }
- }
- OMElement wsRm = elem.getFirstChildWithName(new QName(
- Constants.SYNAPSE_NAMESPACE, "enableRM"));
- if (wsRm != null) {
- endpoint.setReliableMessagingOn(true);
- OMAttribute policy = wsRm.getAttribute(new QName(
- Constants.NULL_NAMESPACE, "policy"));
- if (policy != null) {
- endpoint.setWsRMPolicyKey(policy.getAttributeValue());
- }
- }
-
- return endpoint;
- // }
- }
-
- private static void handleException(String msg) {
- log.error(msg);
- throw new SynapseException(msg);
- }
-
- private static void handleException(String msg, Exception e) {
- log.error(msg, e);
- throw new SynapseException(msg, e);
- }
-
- public Object getObjectFromOMNode(OMNode om) {
- if (om instanceof OMElement) {
- return createEndpoint((OMElement) om, false);
- } else {
- handleException("Invalid XML configuration for an Endpoint. OMElement expected");
- }
- return null;
- }
-
- public static EndpointDefinitionFactory getInstance() {
- return instance;
- }
+ Constants.SYNAPSE_NAMESPACE, "enableAddressing"));
+ if (wsAddr != null) {
+ endpoint.setAddressingOn(true);
+ String useSepList = wsAddr.getAttributeValue(new QName(
+ "separateListener"));
+ if (useSepList != null) {
+ if (useSepList.trim().toLowerCase().startsWith("tr")
+ || useSepList.trim().startsWith("1")) {
+ endpoint.setUseSeparateListener(true);
+ }
+ }
+ }
+
+ OMElement wsSec = elem.getFirstChildWithName(new QName(
+ Constants.SYNAPSE_NAMESPACE, "enableSec"));
+ if (wsSec != null) {
+ endpoint.setSecurityOn(true);
+ OMAttribute policy = wsSec.getAttribute(new QName(
+ Constants.NULL_NAMESPACE, "policy"));
+ if (policy != null) {
+ endpoint.setWsSecPolicyKey(policy.getAttributeValue());
+ }
+ }
+ OMElement wsRm = elem.getFirstChildWithName(new QName(
+ Constants.SYNAPSE_NAMESPACE, "enableRM"));
+ if (wsRm != null) {
+ endpoint.setReliableMessagingOn(true);
+ OMAttribute policy = wsRm.getAttribute(new QName(
+ Constants.NULL_NAMESPACE, "policy"));
+ if (policy != null) {
+ endpoint.setWsRMPolicyKey(policy.getAttributeValue());
+ }
+ }
+
+ return endpoint;
+ // }
+ }
+
+ private static void handleException(String msg) {
+ log.error(msg);
+ throw new SynapseException(msg);
+ }
+
+ private static void handleException(String msg, Exception e) {
+ log.error(msg, e);
+ throw new SynapseException(msg, e);
+ }
+
+ public Object getObjectFromOMNode(OMNode om) {
+ if (om instanceof OMElement) {
+ return createEndpoint((OMElement) om, false);
+ } else {
+ handleException("Invalid XML configuration for an Endpoint. OMElement expected");
+ }
+ return null;
+ }
+
+ public static EndpointDefinitionFactory getInstance() {
+ return instance;
+ }
}
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/EndpointDefinitionSerializer.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/EndpointDefinitionSerializer.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/EndpointDefinitionSerializer.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/EndpointDefinitionSerializer.java Wed Mar 7 02:43:15 2007
@@ -62,76 +62,56 @@
OMElement endpoint = fac.createOMElement("endpoint", synNS);
- if (endpt.isDynamic()) {
- endpoint.addAttribute(fac.createOMAttribute(
- "name", nullNS, endpt.getName()));
- endpoint.addAttribute(fac.createOMAttribute(
- "key", nullNS, endpt.getRegistryKey()));
+ if (endpt.isForcePOX()) {
+ endpoint.addAttribute(fac.createOMAttribute("force", nullNS, "pox"));
+ } else if (endpt.isForceSOAP()) {
+ endpoint.addAttribute(fac.createOMAttribute("force", nullNS, "soap"));
+ }
+ if (endpt.getAddress() != null) {
+ endpoint.addAttribute(fac.createOMAttribute(
+ "address", nullNS, endpt.getAddress()));
} else {
+ handleException("Invalid Endpoint. Address is required");
+ }
+ int isEnableStatistics = endpt.getStatisticsEnable();
+ String statisticsValue = null;
+ if (isEnableStatistics == org.apache.synapse.Constants.STATISTICS_ON) {
+ statisticsValue = Constants.STATISTICS_ENABLE;
+ } else if (isEnableStatistics == org.apache.synapse.Constants.STATISTICS_OFF) {
+ statisticsValue = Constants.STATISTICS_DISABLE;
+ }
+ if (statisticsValue != null) {
+ endpoint.addAttribute(fac.createOMAttribute(
+ Constants.STATISTICS_ATTRIB_NAME, nullNS, statisticsValue));
+ }
+ if (endpt.isAddressingOn()) {
+ OMElement addressing = fac.createOMElement("enableAddressing", synNS);
+ if (endpt.isUseSeparateListener()) {
+ addressing.addAttribute(fac.createOMAttribute(
+ "separateListener", nullNS, "true"));
+ }
+ endpoint.addChild(addressing);
+ }
- // is this an endpoint ref or an actual endpoint
- if (endpt.getName() == null && endpt.getRef() != null) {
- endpoint.addAttribute(fac.createOMAttribute(
- "ref", nullNS, endpt.getRef()));
-
- } else {
- if (endpt.isForcePOX()) {
- endpoint.addAttribute(fac.createOMAttribute("force", nullNS, "pox"));
- } else if (endpt.isForceSOAP()) {
- endpoint.addAttribute(fac.createOMAttribute("force", nullNS, "soap"));
- }
-
- if (endpt.getName() != null) {
- endpoint.addAttribute(fac.createOMAttribute(
- "name", nullNS, endpt.getName()));
- }
- if (endpt.getAddress() != null) {
- endpoint.addAttribute(fac.createOMAttribute(
- "address", nullNS, endpt.getAddress()));
- } else {
- handleException("Invalid Endpoint. Address is required");
- }
- int isEnableStatistics = endpt.getStatisticsEnable();
- String statisticsValue = null;
- if (isEnableStatistics == org.apache.synapse.Constants.STATISTICS_ON) {
- statisticsValue = Constants.STATISTICS_ENABLE;
- } else if (isEnableStatistics == org.apache.synapse.Constants.STATISTICS_OFF) {
- statisticsValue = Constants.STATISTICS_DISABLE;
- }
- if (statisticsValue != null) {
- endpoint.addAttribute(fac.createOMAttribute(
- Constants.STATISTICS_ATTRIB_NAME, nullNS, statisticsValue));
- }
- if (endpt.isAddressingOn()) {
- OMElement addressing = fac.createOMElement("enableAddressing", synNS);
- if (endpt.isUseSeparateListener()) {
- addressing.addAttribute(fac.createOMAttribute(
- "separateListener", nullNS, "true"));
- }
- endpoint.addChild(addressing);
- }
-
- if (endpt.isReliableMessagingOn()) {
- OMElement rm = fac.createOMElement("enableRM", synNS);
- if (endpt.getWsRMPolicyKey() != null) {
- rm.addAttribute(fac.createOMAttribute(
- "policy", nullNS, endpt.getWsRMPolicyKey()));
- }
- endpoint.addChild(rm);
- }
+ if (endpt.isReliableMessagingOn()) {
+ OMElement rm = fac.createOMElement("enableRM", synNS);
+ if (endpt.getWsRMPolicyKey() != null) {
+ rm.addAttribute(fac.createOMAttribute(
+ "policy", nullNS, endpt.getWsRMPolicyKey()));
+ }
+ endpoint.addChild(rm);
+ }
- if (endpt.isSecurityOn()) {
- OMElement sec = fac.createOMElement("enableSec", synNS);
- if (endpt.getWsSecPolicyKey() != null) {
- sec.addAttribute(fac.createOMAttribute(
- "policy", nullNS, endpt.getWsSecPolicyKey()));
- }
- endpoint.addChild(sec);
- }
+ if (endpt.isSecurityOn()) {
+ OMElement sec = fac.createOMElement("enableSec", synNS);
+ if (endpt.getWsSecPolicyKey() != null) {
+ sec.addAttribute(fac.createOMAttribute(
+ "policy", nullNS, endpt.getWsSecPolicyKey()));
}
+ endpoint.addChild(sec);
}
-
+
if (parent != null) {
parent.addChild(endpoint);
}
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/RegistryFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/RegistryFactory.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/RegistryFactory.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/RegistryFactory.java Wed Mar 7 02:43:15 2007
@@ -41,7 +41,7 @@
private static final Log log = LogFactory.getLog(RegistryFactory.class);
public static final QName PROVIDER_Q = new QName(Constants.NULL_NAMESPACE, "provider");
- public static final QName PROPERTY_Q = new QName(Constants.NULL_NAMESPACE, "property");
+ public static final QName PARAMETER_Q = new QName(Constants.NULL_NAMESPACE, "parameter");
public static final QName NAME_Q = new QName(Constants.NULL_NAMESPACE, "name");
public static final QName VALUE_Q = new QName(Constants.NULL_NAMESPACE, "value");
@@ -73,7 +73,7 @@
}
private static void setProperties(Registry reg, OMElement elem) {
- Iterator iter = elem.getChildrenWithName(PROPERTY_Q);
+ Iterator iter = elem.getChildrenWithName(PARAMETER_Q);
while (iter.hasNext()) {
Object o = iter.next();
if (o instanceof OMElement) {
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SendMediatorFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SendMediatorFactory.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SendMediatorFactory.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SendMediatorFactory.java Wed Mar 7 02:43:15 2007
@@ -38,7 +38,7 @@
/**
* The Send mediator factory parses a Send element and creates an instance of the mediator
*
- * //TODO support endpoints, failover and loadbalacing
+ * //TODO document endpoints, failover and loadbalacing
*
* The <send> element is used to send messages out of Synapse to some endpoint. In the simplest case,
* the place to send the message to is implicit in the message (via a property of the message itself)-
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SendMediatorSerializer.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SendMediatorSerializer.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SendMediatorSerializer.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/SendMediatorSerializer.java Wed Mar 7 02:43:15 2007
@@ -33,7 +33,8 @@
import java.util.Iterator;
/**
- * //TODO support endpoints, failover and loadbalacing
+ *
+ * //TODO document endpoints, failover and loadbalacing
*
* The <send> element is used to send messages out of Synapse to some endpoint. In the simplest case,
* the place to send the message to is implicit in the message (via a property of the message itself)-
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/XMLConfigurationSerializer.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/XMLConfigurationSerializer.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/XMLConfigurationSerializer.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/XMLConfigurationSerializer.java Wed Mar 7 02:43:15 2007
@@ -31,6 +31,7 @@
import org.apache.synapse.config.SynapseConfiguration;
import org.apache.synapse.config.Entry;
import org.apache.synapse.config.xml.endpoints.EndpointSerializer;
+import org.apache.synapse.config.xml.endpoints.EndpointAbstractSerializer;
import org.apache.synapse.core.axis2.ProxyService;
import javax.xml.stream.XMLStreamException;
@@ -116,9 +117,15 @@
private static void serializeEndpoints(OMElement definitions, Map endpoints) {
Iterator iter = endpoints.keySet().iterator();
while (iter.hasNext()) {
- String key = (String) iter.next();
- //EndpointSerializer.serializeEndpoint((Endpoint) endpoints.get(key), definitions);
- // TODO chathura
+ String key = (String) iter.next();
+ Object o = endpoints.get(key);
+ if (o instanceof Endpoint) {
+ Endpoint endpoint = (Endpoint) o;
+ OMElement epElement = EndpointAbstractSerializer.
+ getEndpointSerializer(endpoint).serializeEndpoint(endpoint);
+ definitions.addChild(epElement);
+ }
+
}
}
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/AddressEndpointFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/AddressEndpointFactory.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/AddressEndpointFactory.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/AddressEndpointFactory.java Wed Mar 7 02:43:15 2007
@@ -78,23 +78,17 @@
}
private EndpointDefinition createEndpointDefinition(OMElement elem) {
-
- OMAttribute name = elem.getAttribute(new QName(
- org.apache.synapse.config.xml.Constants.NULL_NAMESPACE, "name"));
+
OMAttribute address = elem.getAttribute(new QName(
org.apache.synapse.config.xml.Constants.NULL_NAMESPACE, "uri"));
OMAttribute force = elem.getAttribute(new QName(
org.apache.synapse.config.xml.Constants.NULL_NAMESPACE, "force"));
OMAttribute optimize = elem.getAttribute(new QName(
org.apache.synapse.config.xml.Constants.NULL_NAMESPACE, "optimize"));
- OMAttribute reference = elem.getAttribute(new QName(
- org.apache.synapse.config.xml.Constants.NULL_NAMESPACE, "key"));
EndpointDefinition endpoint = new EndpointDefinition();
- if (reference != null) {
- endpoint.setRef(reference.getAttributeValue());
- } else if (address != null) {
+ if (address != null) {
endpoint.setAddress(address.getAttributeValue());
} else {
handleException("One of the 'address' or 'ref' attributes are required in an "
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointAbstractFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointAbstractFactory.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointAbstractFactory.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointAbstractFactory.java Wed Mar 7 02:43:15 2007
@@ -21,11 +21,23 @@
import org.apache.axiom.om.OMElement;
import org.apache.synapse.Constants;
+import org.apache.synapse.SynapseException;
import javax.xml.namespace.QName;
+/**
+ * Abstract factory for endpoint factories. Use this class to obtain the EndpointFactory implementation
+ * for the required endpoint configuration.
+ */
public class EndpointAbstractFactory {
+ /**
+ * Returns the EndpointFactory implementation for given endpoint configuration. Throws a SynapseException,
+ * if there is no EndpointFactory for given configuration.
+ *
+ * @param configElement Endpoint configuration.
+ * @return EndpointFactory implementation.
+ */
public static EndpointFactory getEndpointFactroy(OMElement configElement) {
if (configElement.getAttribute(new QName("key")) != null) {
@@ -61,6 +73,6 @@
return endpointFactory;
}
- return null;
+ throw new SynapseException("Invalid endpoint configuration.");
}
}
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointAbstractSerializer.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointAbstractSerializer.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointAbstractSerializer.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointAbstractSerializer.java Wed Mar 7 02:43:15 2007
@@ -22,8 +22,19 @@
import org.apache.synapse.mediators.builtin.send.endpoints.*;
import org.apache.synapse.SynapseException;
+/**
+ * Abstract serialier for endpoint serializers. Use this class to obtain the EndpointSerializer
+ * implementation for particular endpoint type.
+ */
public class EndpointAbstractSerializer {
+ /**
+ * Returns the EndpointSerializer implementation for the given endpoint. Throws a SynapseException,
+ * if there is no serializer for the given endpoint type.
+ *
+ * @param endpoint Endpoint implementaion.
+ * @return EndpointSerializer implementation.
+ */
public static EndpointSerializer getEndpointSerializer(Endpoint endpoint) {
if (endpoint instanceof AddressEndpoint) {
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointFactory.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointFactory.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointFactory.java Wed Mar 7 02:43:15 2007
@@ -23,6 +23,26 @@
import org.apache.synapse.config.XMLToObjectMapper;
import org.apache.axiom.om.OMElement;
+/**
+ * All endpoint factories should implement this interface. Use EndpointAbstractFactory to obtain the
+ * correct endpoint fatory for particular endpoint configuration. As endpoints can be nested inside
+ * each other, EndpointFactory implementations may call other EndpointFactory implementations recursively
+ * to obtain the required endpoint hierachy.
+ *
+ * This also serves as the XMLToObjactMapper implementation for specific endpoint implementations.
+ * If the endpoint type is not known use XMLToEndpointMapper as the generic XMLToObjectMapper for
+ * all endpoints.
+ */
public interface EndpointFactory extends XMLToObjectMapper {
+
+ /**
+ * Creates the Endpoint implementation for the given XML endpoint configuration. If the endpoint
+ * configuration is an inline one, it should be anonymous endpoint. If it is defined as an immediate
+ * child element of the <definitions> it should have a name, which is used as the key in local registry.
+ *
+ * @param epConfig OMElement conatining the endpoint configuration.
+ * @param anonymousEndpoint false if the endpoint has a name. true otherwise.
+ * @return Endpoint implementation for the given configuration.
+ */
public Endpoint createEndpoint(OMElement epConfig, boolean anonymousEndpoint);
}
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointSerializer.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointSerializer.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointSerializer.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointSerializer.java Wed Mar 7 02:43:15 2007
@@ -22,7 +22,18 @@
import org.apache.axiom.om.OMElement;
import org.apache.synapse.mediators.builtin.send.endpoints.Endpoint;
+/**
+ * All endpoint serializers should implement this interface. Use EndpointAbstractSerializer to obtain
+ * the correct EndpointSerializer implementation for a particular endpoint. EndpointSerializer implementation
+ * may call other EndpointSerializer implementations to serialize nested endpoints.
+ */
public interface EndpointSerializer {
+ /**
+ * Serializes the given endpoint implementation to an XML object.
+ *
+ * @param endpoint Endpoint implementation to be serialized.
+ * @return OMElement containing XML configuration.
+ */
public OMElement serializeEndpoint(Endpoint endpoint);
}
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/IndirectEndpointFactory.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/IndirectEndpointFactory.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/IndirectEndpointFactory.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/IndirectEndpointFactory.java Wed Mar 7 02:43:15 2007
@@ -45,7 +45,7 @@
IndirectEndpoint indirectEndpoint = new IndirectEndpoint();
String ref = epConfig.getAttributeValue(new QName("key"));
- indirectEndpoint.setRef(ref);
+ indirectEndpoint.setKey(ref);
return indirectEndpoint;
}
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/IndirectEndpointSerializer.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/IndirectEndpointSerializer.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/IndirectEndpointSerializer.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/IndirectEndpointSerializer.java Wed Mar 7 02:43:15 2007
@@ -41,7 +41,7 @@
OMElement endpointElement = fac.createOMElement("endpoint", Constants.SYNAPSE_OMNAMESPACE);
IndirectEndpoint indirectEndpoint = (IndirectEndpoint) endpoint;
- String ref = indirectEndpoint.getRef();
+ String ref = indirectEndpoint.getKey();
if (ref != null) {
endpointElement.addAttribute("ref", ref, null);
}
Added: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/XMLToEndpointMapper.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/XMLToEndpointMapper.java?view=auto&rev=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/XMLToEndpointMapper.java (added)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/XMLToEndpointMapper.java Wed Mar 7 02:43:15 2007
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.xml.endpoints;
+
+import org.apache.synapse.config.XMLToObjectMapper;
+import org.apache.synapse.SynapseException;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMElement;
+
+/**
+ * This is a generic XMLToObjectMapper implementation for all endpoint types. Use this if the endpoint
+ * type is not known at the where mapper is created. If the endpoint type is known use the EndpointFactory
+ * implementation for that specific endpoint.
+ */
+public class XMLToEndpointMapper implements XMLToObjectMapper {
+
+ private static XMLToEndpointMapper instance = new XMLToEndpointMapper();
+
+ private XMLToEndpointMapper() {}
+
+ public static XMLToEndpointMapper getInstance() {
+ return instance;
+ }
+
+ /**
+ * Constructs the Endpoint implementation for the given OMNode.
+ *
+ * @param om OMNode containig endpoint configuration. This should be an OMElement.
+ * @return Endpoint implementaiotn for the given OMNode.
+ */
+ public Object getObjectFromOMNode(OMNode om) {
+ if (om instanceof OMElement) {
+ OMElement epElement = (OMElement) om;
+ return EndpointAbstractFactory.
+ getEndpointFactroy(epElement).createEndpoint(epElement, false);
+ } else {
+ throw new SynapseException("Configuration is not in proper format.");
+ }
+ }
+}
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/SendConstants.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/SendConstants.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/SendConstants.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/SendConstants.java Wed Mar 7 02:43:15 2007
@@ -34,7 +34,7 @@
public static final String RETRY_INTERVAL = "retryInterval";
public static final String FAILOVER = "failover"; // failover attribute in the loadbalance element
public static final String SESSION_AFFINITY = "sessionAffinity";
- public static final String ALGORITHM_NAME = "algorithmName";
+ public static final String ALGORITHM_NAME = "policy";
public static final String FAILOVER_GROUP_ELEMENT = "failover"; // failover group element inside the loadbalance element
public static final String DISPATCH_MANAGER = "DISPATCH_MANAGER";
public static final String DISPATCHERS_ELEMENT = "dispatchers";
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/SendMediator.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/SendMediator.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/SendMediator.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/SendMediator.java Wed Mar 7 02:43:15 2007
@@ -27,12 +27,11 @@
import org.apache.synapse.mediators.AbstractMediator;
/**
- * The Send mediator sends the message using the following semantics.
- * <p/>
- * This is a leaf mediator (i.e. further processing halts after this mediator completes)
- * <p/>
- * TODO support loadbalancing and failover
- */
+ * SendMediator sends a message using specified semantics. If it contains an endpoint it will send the
+ * message to that endpoint. Once a message is sent to the endpoint further sending behaviors are completely
+ * governed by that endpoint. If there is no endpoint available, SendMediator will send the message to
+ * the implicitly stated destination.
+ * */
public class SendMediator extends AbstractMediator {
private static final Log log = LogFactory.getLog(SendMediator.class);
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/AddressEndpoint.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/AddressEndpoint.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/AddressEndpoint.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/AddressEndpoint.java Wed Mar 7 02:43:15 2007
@@ -23,7 +23,6 @@
import org.apache.synapse.Constants;
import org.apache.synapse.FaultHandler;
import org.apache.synapse.SynapseException;
-import org.apache.synapse.mediators.builtin.send.FailureListener;
import org.apache.synapse.statistics.impl.EndPointStatisticsStack;
import org.apache.synapse.config.EndpointDefinition;
import org.apache.axis2.addressing.EndpointReference;
@@ -66,15 +65,7 @@
public void setActive(boolean active) {
this.active = active;
- }
-
- public void setDynamic(boolean dynamic) {
- // TODO chathura
- }
-
- public void setRegistryKey(String registryKey) {
- // TODO chathura
- }
+ }
public void send(MessageContext synCtx) {
@@ -98,7 +89,7 @@
synCtx.setProperty(Constants.OUTFLOW_USE_SEPARATE_LISTENER, Boolean.TRUE);
}
- String endPointName = endpoint.getName();
+ String endPointName = this.getName();
// Setting Required property to collect the End Point statistics
boolean statisticsEnable = (org.apache.synapse.Constants.STATISTICS_ON == endpoint.getStatisticsEnable());
@@ -162,6 +153,6 @@
// perform retries here
// if this endpoint has actually failed, inform the parent.
- parentEndpoint.onChildEndpointFail(this, synCtx);
+ parentEndpoint.onChildEndpointFail(this, synCtx);
}
}
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/Endpoint.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/Endpoint.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/Endpoint.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/Endpoint.java Wed Mar 7 02:43:15 2007
@@ -21,23 +21,72 @@
import org.apache.synapse.MessageContext;
+/**
+ * Endpoint defines the bahavior common to all synapse endpoints. Synapse endpoints should be able
+ * to send the given synapse message context, rather than just providing the information for sending
+ * the message. The task a particuler endpoint does in its send(...) methis is specific to the endpoint.
+ * For example a loadbalance endpoint may choose another endpoint using its loadbalance policy and
+ * call its send(...) method while an address endpoint (leaf level) may send the message to a actual
+ * endpoint url. Endpoints may contain zero or more endpoints in them and build up a heirachycal
+ * structure of endpoints.
+ */
public interface Endpoint {
+ /**
+ * Sends the message context according to an endpoint specific behavior.
+ *
+ * @param synMessageContext MessageContext to be sent.
+ */
public void send(MessageContext synMessageContext);
+ /**
+ * Endpoints that contain other endpoints should implement this method. It will be called if a
+ * child endpoint causes an exception. Action to be taken on such failure is upto the implementation.
+ * But it is good practice to first try addressing the issue. If it can't be addressed propagate the
+ * exception to parent endpoint by calling parent endpoint's onChildEndpointFail(...) method.
+ *
+ * @param endpoint The child endpoint which caused the exception.
+ * @param synMessageContext MessageContext that was used in the failed attempt.
+ */
public void onChildEndpointFail(Endpoint endpoint, MessageContext synMessageContext);
+ /**
+ * Sets the parent endpoint for the current endpoint.
+ *
+ * @param parentEndpoint parent endpoint containing this endpoint. It should handle the onChildEndpointFail(...)
+ * callback.
+ */
public void setParentEndpoint(Endpoint parentEndpoint);
+ /**
+ * Returns the name of the endpoint.
+ *
+ * @return Endpoint name.
+ */
public String getName();
+ /**
+ * Sets the name of the endpoint. Local registry use this name as the key for storing the
+ * endpoint.
+ *
+ * @param name Name for the endpoint.
+ */
public void setName(String name);
+ /**
+ * Returns if the endpoint is currently active or not. Messages should not be sent to inactive
+ * endpoints.
+ *
+ * @return true if the endpoint is in active state. false otherwise.
+ */
public boolean isActive();
+ /**
+ * Sets the endpoint as active or inactive. If an endpoint is detected as failed, it should be
+ * set as inactive. But endpoints may be eventually set as active by the endpoint refresher to
+ * avoid ignoring endpoints forever.
+ *
+ * @param active true if active. false otherwise.
+ */
public void setActive(boolean active);
-
- public void setDynamic(boolean dynamic);
-
- public void setRegistryKey(String registryKey);
}
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/FailoverEndpoint.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/FailoverEndpoint.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/FailoverEndpoint.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/FailoverEndpoint.java Wed Mar 7 02:43:15 2007
@@ -71,15 +71,7 @@
public void setActive(boolean active) {
this.active = active;
- }
-
- public void setDynamic(boolean dynamic) {
- // TODO chathura
- }
-
- public void setRegistryKey(String registryKey) {
- // TODO chathura
- }
+ }
public ArrayList getEndpoints() {
return endpoints;
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/IndirectEndpoint.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/IndirectEndpoint.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/IndirectEndpoint.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/IndirectEndpoint.java Wed Mar 7 02:43:15 2007
@@ -24,13 +24,13 @@
public class IndirectEndpoint implements Endpoint {
private String name = null;
- private String ref = null;
+ private String key = null;
private boolean active = true;
private Endpoint parentEndpoint = null;
public void send(MessageContext synMessageContext) {
// get the actual endpoint and send
- Endpoint endpoint = synMessageContext.getEndpoint(ref);
+ Endpoint endpoint = synMessageContext.getEndpoint(key);
if (endpoint.isActive()) {
endpoint.send(synMessageContext);
@@ -47,12 +47,12 @@
this.name = name;
}
- public String getRef() {
- return ref;
+ public String getKey() {
+ return key;
}
- public void setRef(String ref) {
- this.ref = ref;
+ public void setKey(String key) {
+ this.key = key;
}
public boolean isActive() {
@@ -61,15 +61,7 @@
public void setActive(boolean active) {
this.active = active;
- }
-
- public void setDynamic(boolean dynamic) {
- // TODO chathura
- }
-
- public void setRegistryKey(String registryKey) {
- // TODO chathura
- }
+ }
public void setParentEndpoint(Endpoint parentEndpoint) {
this.parentEndpoint = parentEndpoint;
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/LoadbalanceEndpoint.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/LoadbalanceEndpoint.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/LoadbalanceEndpoint.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/LoadbalanceEndpoint.java Wed Mar 7 02:43:15 2007
@@ -81,14 +81,6 @@
this.active = active;
}
- public void setDynamic(boolean dynamic) {
- // TODO chathura
- }
-
- public void setRegistryKey(String registryKey) {
- // TODO chathura
- }
-
public ArrayList getEndpoints() {
return endpoints;
}
@@ -111,6 +103,6 @@
public void onChildEndpointFail(Endpoint endpoint, MessageContext synMessageContext) {
endpoint.setActive(false);
- send(synMessageContext);
+ send(synMessageContext);
}
}
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/WSDLEndpoint.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/WSDLEndpoint.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/WSDLEndpoint.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/builtin/send/endpoints/WSDLEndpoint.java Wed Mar 7 02:43:15 2007
@@ -51,15 +51,7 @@
public void setActive(boolean active) {
this.active = active;
- }
-
- public void setDynamic(boolean dynamic) {
- // TODO chathura
- }
-
- public void setRegistryKey(String registryKey) {
- // TODO chathura
- }
+ }
public void setParentEndpoint(Endpoint parentEndpoint) {
this.parentEndpoint = parentEndpoint;
Modified: webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/AbstractRegistry.java
URL: http://svn.apache.org/viewvc/webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/AbstractRegistry.java?view=diff&rev=515523&r1=515522&r2=515523
==============================================================================
--- webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/AbstractRegistry.java (original)
+++ webservices/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/registry/AbstractRegistry.java Wed Mar 7 02:43:15 2007
@@ -105,9 +105,7 @@
seq.setDynamic(true);
seq.setRegistryKey(entry.getKey());
} else if (entry.getValue() instanceof Endpoint) {
- Endpoint ep = (Endpoint) entry.getValue();
- ep.setDynamic(true);
- ep.setRegistryKey(entry.getKey());
+ Endpoint ep = (Endpoint) entry.getValue();
}
} else {
---------------------------------------------------------------------
To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: synapse-dev-help@ws.apache.org