Author: veithen
Date: Mon May 24 22:13:48 2010
New Revision: 947834
URL: http://svn.apache.org/viewvc?rev=947834&view=rev
Log:
Fixed AbstractTransportListenerEx so that EPRs can be generated for protocol
endpoints configured at the transport level. Individual transports still need
to be updated to generate EPRs that allow dispatching.
Modified:
axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/transport/base/AbstractTransportListenerEx.java
axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/transport/base/ProtocolEndpoint.java
axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/transport/base/datagram/AbstractDatagramTransportListener.java
axis/axis2/java/transports/trunk/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSEndpoint.java
axis/axis2/java/transports/trunk/modules/mail/src/main/java/org/apache/axis2/transport/mail/PollTableEntry.java
axis/axis2/java/transports/trunk/modules/udp/src/main/java/org/apache/axis2/transport/udp/Endpoint.java
Modified:
axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/transport/base/AbstractTransportListenerEx.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/transport/base/AbstractTransportListenerEx.java?rev=947834&r1=947833&r2=947834&view=diff
==============================================================================
---
axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/transport/base/AbstractTransportListenerEx.java
(original)
+++
axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/transport/base/AbstractTransportListenerEx.java
Mon May 24 22:13:48 2010
@@ -44,10 +44,15 @@ public abstract class AbstractTransportL
/**
* The collection of protocol specific endpoints managed by this transport.
+ * This includes endpoints configured at the transport level.
*/
private List<E> endpoints = new ArrayList<E>();
- private boolean useGlobalListener;
+ /**
+ * The endpoint configured at the transport level. <code>null</code> if no
+ * such endpoint is configured.
+ */
+ private E globalEndpoint;
@Override
public final void init(ConfigurationContext cfgCtx,
@@ -63,7 +68,7 @@ public abstract class AbstractTransportL
if (endpoint.loadConfiguration(transportIn)) {
startEndpoint(endpoint);
endpoints.add(endpoint);
- useGlobalListener = true;
+ globalEndpoint = endpoint;
}
}
@@ -106,13 +111,25 @@ public abstract class AbstractTransportL
}
for (E endpoint : endpoints) {
AxisService service = endpoint.getService();
- if (service != null) {
- if (service.getName().equals(serviceName)) {
- return endpoint.getEndpointReferences(ip);
- }
+ if (service != null && service.getName().equals(serviceName)) {
+ return endpoint.getEndpointReferences(service, ip);
}
}
- return null;
+ // If we get here, this means that the service is not explicitly
configured
+ // with a specific protocol endpoint. However, it is still exposed
over the
+ // transport. In this case, we build the EPR using the endpoint
configured
+ // at the transport level, if there is one.
+ if (globalEndpoint != null) {
+ AxisService service =
cfgCtx.getAxisConfiguration().getService(serviceName);
+ if (service == null) {
+ // Oops, something strange is happening here
+ return null;
+ } else {
+ return globalEndpoint.getEndpointReferences(service, ip);
+ }
+ } else {
+ return null;
+ }
}
public final Collection<E> getEndpoints() {
@@ -128,7 +145,7 @@ public abstract class AbstractTransportL
if (endpoint.loadConfiguration(service)) {
startEndpoint(endpoint);
endpoints.add(endpoint);
- } else if (useGlobalListener) {
+ } else if (globalEndpoint != null) {
return;
} else {
throw new AxisFault("Service doesn't have configuration
information for transport " +
@@ -147,7 +164,7 @@ public abstract class AbstractTransportL
return;
}
}
- if (!useGlobalListener) {
+ if (globalEndpoint == null) {
log.error("Unable to stop service : " + service.getName() +
" - unable to find the corresponding protocol endpoint");
}
Modified:
axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/transport/base/ProtocolEndpoint.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/transport/base/ProtocolEndpoint.java?rev=947834&r1=947833&r2=947834&view=diff
==============================================================================
---
axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/transport/base/ProtocolEndpoint.java
(original)
+++
axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/transport/base/ProtocolEndpoint.java
Mon May 24 22:13:48 2010
@@ -77,7 +77,10 @@ public abstract class ProtocolEndpoint {
/**
* Get the endpoint references for this protocol endpoint.
- *
+ *
+ * @param service The service to build the EPR for. If {...@link
#getService()} returns
+ * a non null value, then it has the same value as this
parameter, which
+ * is never null.
* @param ip The host name or IP address of the local host. The
implementation should use
* this information instead of {...@link
java.net.InetAddress#getLocalHost()}.
* The value of this parameter may be <code>null</code>, in
which case the
@@ -88,7 +91,7 @@ public abstract class ProtocolEndpoint {
*
* @see
org.apache.axis2.transport.TransportListener#getEPRsForService(String, String)
*/
- public abstract EndpointReference[] getEndpointReferences(String ip)
throws AxisFault;
+ public abstract EndpointReference[] getEndpointReferences(AxisService
service, String ip) throws AxisFault;
public MessageContext createMessageContext() throws AxisFault {
MessageContext msgContext = listener.createMessageContext();
Modified:
axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/transport/base/datagram/AbstractDatagramTransportListener.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/transport/base/datagram/AbstractDatagramTransportListener.java?rev=947834&r1=947833&r2=947834&view=diff
==============================================================================
---
axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/transport/base/datagram/AbstractDatagramTransportListener.java
(original)
+++
axis/axis2/java/transports/trunk/modules/base/src/main/java/org/apache/axis2/transport/base/datagram/AbstractDatagramTransportListener.java
Mon May 24 22:13:48 2010
@@ -69,12 +69,13 @@ public abstract class AbstractDatagramTr
try {
dispatcher.addEndpoint(endpoint);
} catch (IOException ex) {
+ // TODO: passing endpoint.getService() is not correct because it
may be null
throw new AxisFault("Unable to listen on endpoint "
- + endpoint.getEndpointReferences(defaultIp)[0], ex);
+ + endpoint.getEndpointReferences(endpoint.getService(),
defaultIp)[0], ex);
}
if (log.isDebugEnabled()) {
log.debug("Started listening on endpoint " +
- endpoint.getEndpointReferences(defaultIp)[0] +
+ endpoint.getEndpointReferences(endpoint.getService(),
defaultIp)[0] +
" [contentType=" + endpoint.getContentType() +
"; service=" + endpoint.getServiceName() + "]");
}
Modified:
axis/axis2/java/transports/trunk/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSEndpoint.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/transports/trunk/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSEndpoint.java?rev=947834&r1=947833&r2=947834&view=diff
==============================================================================
---
axis/axis2/java/transports/trunk/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSEndpoint.java
(original)
+++
axis/axis2/java/transports/trunk/modules/jms/src/main/java/org/apache/axis2/transport/jms/JMSEndpoint.java
Mon May 24 22:13:48 2010
@@ -99,7 +99,7 @@ public class JMSEndpoint extends Protoco
}
@Override
- public EndpointReference[] getEndpointReferences(String ip) {
+ public EndpointReference[] getEndpointReferences(AxisService service,
String ip) {
return endpointReferences.toArray(new
EndpointReference[endpointReferences.size()]);
}
Modified:
axis/axis2/java/transports/trunk/modules/mail/src/main/java/org/apache/axis2/transport/mail/PollTableEntry.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/transports/trunk/modules/mail/src/main/java/org/apache/axis2/transport/mail/PollTableEntry.java?rev=947834&r1=947833&r2=947834&view=diff
==============================================================================
---
axis/axis2/java/transports/trunk/modules/mail/src/main/java/org/apache/axis2/transport/mail/PollTableEntry.java
(original)
+++
axis/axis2/java/transports/trunk/modules/mail/src/main/java/org/apache/axis2/transport/mail/PollTableEntry.java
Mon May 24 22:13:48 2010
@@ -31,6 +31,7 @@ import javax.mail.internet.InternetAddre
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.Parameter;
import org.apache.axis2.description.ParameterInclude;
import org.apache.axis2.transport.base.AbstractPollTableEntry;
@@ -98,7 +99,7 @@ public class PollTableEntry extends Abst
}
@Override
- public EndpointReference[] getEndpointReferences(String ip) {
+ public EndpointReference[] getEndpointReferences(AxisService service,
String ip) {
return new EndpointReference[] { new
EndpointReference(MailConstants.TRANSPORT_PREFIX
+ emailAddress) };
}
Modified:
axis/axis2/java/transports/trunk/modules/udp/src/main/java/org/apache/axis2/transport/udp/Endpoint.java
URL:
http://svn.apache.org/viewvc/axis/axis2/java/transports/trunk/modules/udp/src/main/java/org/apache/axis2/transport/udp/Endpoint.java?rev=947834&r1=947833&r2=947834&view=diff
==============================================================================
---
axis/axis2/java/transports/trunk/modules/udp/src/main/java/org/apache/axis2/transport/udp/Endpoint.java
(original)
+++
axis/axis2/java/transports/trunk/modules/udp/src/main/java/org/apache/axis2/transport/udp/Endpoint.java
Mon May 24 22:13:48 2010
@@ -22,6 +22,7 @@ import java.net.SocketException;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.description.AxisService;
import org.apache.axis2.description.ParameterInclude;
import org.apache.axis2.transport.base.ParamUtils;
import org.apache.axis2.transport.base.datagram.DatagramEndpoint;
@@ -54,7 +55,7 @@ public class Endpoint extends DatagramEn
}
@Override
- public EndpointReference[] getEndpointReferences(String ip) throws
AxisFault {
+ public EndpointReference[] getEndpointReferences(AxisService service,
String ip) throws AxisFault {
if (ip == null) {
try {
ip =
Utils.getIpAddress(getListener().getConfigurationContext().getAxisConfiguration());