axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chinth...@apache.org
Subject svn commit: r442546 - in /webservices/axis2/trunk/java/modules: integration/test/org/apache/axis2/engine/ kernel/src/org/apache/axis2/description/ kernel/src/org/apache/axis2/transport/ kernel/src/org/apache/axis2/transport/http/ kernel/src/org/apache/...
Date Tue, 12 Sep 2006 09:44:03 GMT
Author: chinthaka
Date: Tue Sep 12 02:44:02 2006
New Revision: 442546

URL: http://svn.apache.org/viewvc?view=rev&rev=442546
Log:
Implementing the proposal forwarded in http://marc.theaimsgroup.com/?l=axis-dev&m=115804838119637&w=2.


TODO : I need to update the usages of getEPR method to properly use getEPRs method

Modified:
    webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/MessageContextInjectionTest.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportListener.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/SimpleHTTPServer.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/jms/SimpleJMSListener.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/njms/JMSListener.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/tcp/TCPServer.java

Modified: webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/MessageContextInjectionTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/MessageContextInjectionTest.java?view=diff&rev=442546&r1=442545&r2=442546
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/MessageContextInjectionTest.java
(original)
+++ webservices/axis2/trunk/java/modules/integration/test/org/apache/axis2/engine/MessageContextInjectionTest.java
Tue Sep 12 02:44:02 2006
@@ -22,6 +22,7 @@
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
 import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.Options;
@@ -101,8 +102,12 @@
                 //To change body of implemented methods use File | Settings | File Templates.
             }
 
-            public EndpointReference getEPRForService(String serviceName, String ip) {
+            public EndpointReference getEPRForService(String serviceName, String ip) throws
AxisFault {
                 return null;  //To change body of implemented methods use File | Settings
| File Templates.
+            }
+
+            public EndpointReference[] getEPRsForService(String serviceName, String ip){
+                return null;
             }
         });
         config.addTransportIn(tIn);

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java?view=diff&rev=442546&r1=442545&r2=442546
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
Tue Sep 12 02:44:02 2006
@@ -571,9 +571,9 @@
                 TransportListener listener = transportIn.getReceiver();
                 if (listener != null) {
                     try {
-                        if (listener.getEPRForService(getName(), requestIP) != null) {
-                            String address =
-                                    listener.getEPRForService(getName(), requestIP).getAddress();
+                        EndpointReference eprForService = listener.getEPRForService(getName(),
requestIP);
+                        if (eprForService != null) {
+                            String address = eprForService.getAddress();
                             if (address != null) {
                                 eprList.add(address);
                             }
@@ -593,11 +593,9 @@
                     TransportListener listener = transportIn.getReceiver();
                     if (listener != null) {
                         try {
-                            if (listener.getEPRForService(getName(), requestIP)
-                                    != null) {
-                                String address =
-                                        listener.getEPRForService(getName(),
-                                                requestIP).getAddress();
+                            EndpointReference eprForService = listener.getEPRForService(getName(),
requestIP);
+                            if (eprForService != null) {
+                                String address = eprForService.getAddress();
                                 if (address != null) {
                                     eprList.add(address);
                                 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportListener.java?view=diff&rev=442546&r1=442545&r2=442546
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportListener.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/TransportListener.java
Tue Sep 12 02:44:02 2006
@@ -37,5 +37,15 @@
 
     void stop() throws AxisFault;
 
+    /**
+     * @deprecated Transport listener can expose more than EPRs. So this method should return
an array of EPRs.
+     * Deprecating this method for now and please use getEPRsForServices instead.
+     * @param serviceName
+     * @param ip
+     * @return
+     * @throws AxisFault
+     */
     EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault;
+
+    public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault;
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java?view=diff&rev=442546&r1=442545&r2=442546
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/AxisServlet.java
Tue Sep 12 02:44:02 2006
@@ -137,7 +137,8 @@
         if ((query != null) && (query.indexOf("wsdl2") >= 0 ||
                 query.indexOf("wsdl") >= 0 || query.indexOf("xsd") >= 0)) { // handling
meta data exchange stuff
             agent.processListService(req, resp);
-        } else if (requestURI.endsWith(LIST_SERVICES_SUFIX) || requestURI.endsWith(LIST_FAUKT_SERVICES_SUFIX))
{ // handling list services request
+        } else if (requestURI.endsWith(LIST_SERVICES_SUFIX) || requestURI.endsWith(LIST_FAUKT_SERVICES_SUFIX))
+        { // handling list services request
             try {
                 agent.handle(req, resp);
             } catch (Exception e) {
@@ -402,12 +403,15 @@
     }
 
     public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault
{
-        //RUNNING_PORT
+        return getEPRsForService(serviceName, ip)[0];
+    }
+
+    public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault
{
+       //RUNNING_PORT
         String port = (String) configContext.getProperty(ListingAgent.RUNNING_PORT);
         if (port == null) {
             port = "8080";
         }
-
         if (ip == null) {
             try {
                 ip = HttpUtils.getIpAddress();
@@ -415,9 +419,10 @@
                 throw new AxisFault(e);
             }
         }
-
-        return new EndpointReference("http://" + ip + ":" + port + '/' +
+        EndpointReference soapEndpoint = new EndpointReference("http://" + ip + ":" + port
+ '/' +
                 configContext.getServiceContextPath() + "/" + serviceName);
+        
+        return new EndpointReference[] {soapEndpoint};
     }
 
     protected MessageContext createMessageContext(HttpServletRequest req,

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java?view=diff&rev=442546&r1=442545&r2=442546
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/ListingAgent.java
Tue Sep 12 02:44:02 2006
@@ -261,9 +261,15 @@
         public void stop() throws AxisFault {
         }
 
+        public EndpointReference[] getEPRsForService(String serviceName, String ip) throws
AxisFault {
+            return new EndpointReference[]{new EndpointReference(schema + "://" + ip + ":"
+ port + "/" + axisConf.getServiceContextPath() + "/" + serviceName)};  //To change body of
implemented methods use File | Settings | File Templates.
+        }
+
         public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault
{
-            return new EndpointReference(schema + "://" + ip + ":" + port + "/" + axisConf.getServiceContextPath()
+ "/" + serviceName);
+            return getEPRsForService(serviceName, ip)[0];
         }
+
+
     }
 
 }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/SimpleHTTPServer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/SimpleHTTPServer.java?view=diff&rev=442546&r1=442545&r2=442546
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/SimpleHTTPServer.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/http/SimpleHTTPServer.java
Tue Sep 12 02:44:02 2006
@@ -199,37 +199,21 @@
     }
 
     /**
-     * Getter for httpFactory
-     */
-    public HttpFactory getHttpFactory() {
-        return httpFactory;
-    }
-
-    /**
-     * Method getConfigurationContext
-     *
-     * @return the system context
-     */
-    public ConfigurationContext getConfigurationContext() {
-        return configurationContext;
-    }
-
-    /**
      * replyToEPR
      * If the user has given host address paramter then it gets the high priority and
      * ERP will be creatd using that
-     * N:B - hostAddress should be a complte url (http://www.myApp.com/ws)
+     * N:B - hostAddress should be a complete url (http://www.myApp.com/ws)
      *
      * @param serviceName
      * @param ip
      * @return an EndpointReference
      * @see org.apache.axis2.transport.TransportListener#getEPRForService(String,String)
      */
-    public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault
{
+    public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault
{
         //if host address is present
         if (hostAddress != null) {
             if (embedded != null) {
-                return new EndpointReference(hostAddress + "/" + configurationContext.getServiceContextPath()
+ "/" + serviceName);
+                return new EndpointReference[] {new EndpointReference(hostAddress + "/" +
configurationContext.getServiceContextPath() + "/" + serviceName)};
             } else {
                 throw new AxisFault("Unable to generate EPR for the transport : http");
             }
@@ -249,12 +233,43 @@
             }
         }
         if (embedded != null) {
-            return new EndpointReference("http://" + localAddress + ":" +
+            return new EndpointReference[] {new EndpointReference("http://" + localAddress
+ ":" +
                     (embedded.getPort())
-                    + "/" + configurationContext.getServiceContextPath() + "/" + serviceName);
+                    + "/" + configurationContext.getServiceContextPath() + "/" + serviceName)};
         } else {
             throw new AxisFault("Unable to generate EPR for the transport : http");
         }
+    }
+
+    /**
+     * Getter for httpFactory
+     */
+    public HttpFactory getHttpFactory() {
+        return httpFactory;
+    }
+
+    /**
+     * Method getConfigurationContext
+     *
+     * @return the system context
+     */
+    public ConfigurationContext getConfigurationContext() {
+        return configurationContext;
+    }
+
+    /**
+     * replyToEPR
+     * If the user has given host address paramter then it gets the high priority and
+     * ERP will be creatd using that
+     * N:B - hostAddress should be a complte url (http://www.myApp.com/ws)
+     *
+     * @param serviceName
+     * @param ip
+     * @return an EndpointReference
+     * @see org.apache.axis2.transport.TransportListener#getEPRForService(String,String)
+     */
+    public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault
{
+        return getEPRsForService(serviceName, ip)[0];
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/jms/SimpleJMSListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/jms/SimpleJMSListener.java?view=diff&rev=442546&r1=442545&r2=442546
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/jms/SimpleJMSListener.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/jms/SimpleJMSListener.java
Tue Sep 12 02:44:02 2006
@@ -31,7 +31,6 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import javax.jms.BytesMessage;
 import javax.jms.MessageListener;
 import javax.xml.namespace.QName;
 import java.io.BufferedInputStream;
@@ -254,11 +253,16 @@
     }
 
     public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault
{
+        EndpointReference[] epRsForService = getEPRsForService(serviceName, ip);
+        return epRsForService != null ? epRsForService[0] : null;
+    }
+
+    public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault
{
         try {
             JMSURLHelper url = new JMSURLHelper("jms:/" + destination);
             if (url != null && url.getProperties() != null && properties
!= null) {
                 url.getProperties().putAll(properties);
-                return new EndpointReference(url.getURLString());
+                return new EndpointReference[] {new EndpointReference(url.getURLString())};
             } else {
                 return null;
             }

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java?view=diff&rev=442546&r1=442545&r2=442546
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/mail/SimpleMailListener.java
Tue Sep 12 02:44:02 2006
@@ -272,7 +272,11 @@
      * @see org.apache.axis2.transport.TransportListener#replyToEPR(java.lang.String)
      */
     public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault
{
-        return new EndpointReference(Constants.TRANSPORT_MAIL + ":" + replyTo + configurationContext.getServiceContextPath()
+ "/" + serviceName);//Constants.TRANSPORT_MAIL +
+        return getEPRsForService(serviceName, ip)[0];
+    }
+
+    public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault
{
+        return new EndpointReference[] {new EndpointReference(Constants.TRANSPORT_MAIL +
":" + replyTo + configurationContext.getServiceContextPath() + "/" + serviceName)};  //To
change body of implemented methods use File | Settings | File Templates.
     }
 
     public void setDoThreads(boolean value) {

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/njms/JMSListener.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/njms/JMSListener.java?view=diff&rev=442546&r1=442545&r2=442546
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/njms/JMSListener.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/njms/JMSListener.java
Tue Sep 12 02:44:02 2006
@@ -315,6 +315,18 @@
     }
 
     /**
+     * Returns EPRs for the given service and IP. (Picks up precomputed EPR)
+     *
+     * @param serviceName service name
+     * @param ip          ignored
+     * @return the EPR for the service
+     * @throws AxisFault not used
+     */
+    public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault
{
+          return new EndpointReference[]{new EndpointReference((String) serviceNameToEprMap.get(serviceName))};
+    }
+
+    /**
      * Returns the EPR for the given service and IP. (Picks up precomputed EPR)
      *
      * @param serviceName service name
@@ -323,7 +335,7 @@
      * @throws AxisFault not used
      */
     public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault
{
-        return new EndpointReference((String) serviceNameToEprMap.get(serviceName));
+        return getEPRsForService(serviceName, ip)[0];
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/tcp/TCPServer.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/tcp/TCPServer.java?view=diff&rev=442546&r1=442545&r2=442546
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/tcp/TCPServer.java
(original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/transport/tcp/TCPServer.java
Tue Sep 12 02:44:02 2006
@@ -184,11 +184,16 @@
      * @see org.apache.axis2.transport.TransportListener#getEPRForService(String, String)
      */
     public EndpointReference getEPRForService(String serviceName, String ip) throws AxisFault
{
+        EndpointReference[] epRsForService = getEPRsForService(serviceName, ip);
+        return epRsForService != null ? epRsForService[0] : null;
+    }
+
+    public EndpointReference[] getEPRsForService(String serviceName, String ip) throws AxisFault
{
         //if host address is present
         if (hostAddress != null) {
             if (serversocket != null) {
                 // todo this has to fix
-                return new EndpointReference(hostAddress + "/" + contextPath + serviceName);
+                return new EndpointReference[] {new EndpointReference(hostAddress + "/" +
contextPath + serviceName)};
             } else {
                 log.debug("Unable to generate EPR for the transport tcp");
                 return null;
@@ -203,8 +208,8 @@
         }
         if (serversocket != null) {
             // todo this has to fix
-            return new EndpointReference("tcp://" + ip + ":" + (serversocket.getLocalPort())
-                    + "/" + contextPath + "/" + serviceName);
+            return new EndpointReference[] {new EndpointReference("tcp://" + ip + ":" + (serversocket.getLocalPort())
+                    + "/" + contextPath + "/" + serviceName)};
         } else {
             log.debug("Unable to generate EPR for the transport tcp");
             return null;



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message