You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by ru...@apache.org on 2010/02/26 02:58:31 UTC
svn commit: r916533 -
/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointFactory.java
Author: ruwan
Date: Fri Feb 26 01:58:31 2010
New Revision: 916533
URL: http://svn.apache.org/viewvc?rev=916533&view=rev
Log:
Fixing the issue SYNAPSE-579
Modified:
synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointFactory.java
Modified: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointFactory.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointFactory.java?rev=916533&r1=916532&r2=916533&view=diff
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointFactory.java (original)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/config/xml/endpoints/EndpointFactory.java Fri Feb 26 01:58:31 2010
@@ -31,6 +31,7 @@
import org.apache.synapse.endpoints.Endpoint;
import org.apache.synapse.endpoints.IndirectEndpoint;
import org.apache.synapse.endpoints.EndpointDefinition;
+import org.apache.synapse.util.UUIDGenerator;
import javax.xml.namespace.QName;
import java.util.ArrayList;
@@ -55,6 +56,8 @@
log = LogFactory.getLog(this.getClass());
}
+ private static final String ENDPOINT_NAME_PREFIX = "endpoint_";
+
/**
* Core method which is exposed for the external use, and this will find the proper
* {@link EndpointFactory} and create the endpoint which is of the format {@link Endpoint}.
@@ -64,7 +67,7 @@
* @return created endpoint
*/
public static Endpoint getEndpointFromElement(OMElement elem, boolean isAnonymous) {
- return getEndpointFactory(elem).createEndpoint(elem, isAnonymous);
+ return getEndpointFactory(elem).createEndpointWithName(elem, isAnonymous);
}
/**
@@ -75,7 +78,7 @@
*/
public Object getObjectFromOMNode(OMNode om) {
if (om instanceof OMElement) {
- return createEndpoint((OMElement) om, false);
+ return createEndpointWithName((OMElement) om, false);
} else {
handleException("Invalid XML configuration for an Endpoint. OMElement expected");
}
@@ -95,6 +98,25 @@
protected abstract Endpoint createEndpoint(OMElement epConfig, boolean anonymousEndpoint);
/**
+ * Make sure that the endpoints created by the factory has a name
+ *
+ * @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.
+ */
+ private Endpoint createEndpointWithName(OMElement epConfig, boolean anonymousEndpoint) {
+
+ Endpoint ep = createEndpoint(epConfig, anonymousEndpoint);
+ // if the endpoint doesn't have a name we will generate a unique name.
+ if (ep.getName() == null) {
+ String uuid = UUIDGenerator.getUUID();
+ uuid = uuid.replace(':', '_');
+ ep.setName(ENDPOINT_NAME_PREFIX + uuid);
+ }
+ return ep;
+ }
+
+ /**
* Extracts the QoS information from the XML which represents a WSDL/Address/Default endpoints
*
* @param definition to be filled with the extracted information