You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by de...@apache.org on 2006/03/09 06:50:20 UTC

svn commit: r384440 - in /webservices/axis2/trunk/java/modules: common/src/org/apache/axis2/i18n/resource.properties core/src/org/apache/axis2/context/ServiceContext.java core/src/org/apache/axis2/engine/ListenerManager.java

Author: deepal
Date: Wed Mar  8 21:50:19 2006
New Revision: 384440

URL: http://svn.apache.org/viewcvs?rev=384440&view=rev
Log:
- sc.getMyERP

Modified:
    webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceContext.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/ListenerManager.java

Modified: webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties?rev=384440&r1=384439&r2=384440&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties (original)
+++ webservices/axis2/trunk/java/modules/common/src/org/apache/axis2/i18n/resource.properties Wed Mar  8 21:50:19 2006
@@ -218,3 +218,4 @@
 unabletofindservice=Service not found operation terminated !!
 invalidservicegrouoid=Invalid Service Group Id {0}
 servicenotfoundinthesystem=Invalid service {0}, not found in the system
+transportnotfound=Transport Not found {0}

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceContext.java?rev=384440&r1=384439&r2=384440&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceContext.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/ServiceContext.java Wed Mar  8 21:50:19 2006
@@ -21,7 +21,9 @@
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.TransportInDescription;
 import org.apache.axis2.engine.ListenerManager;
+import org.apache.axis2.i18n.Messages;
 
 import javax.xml.namespace.QName;
 
@@ -84,11 +86,30 @@
         return serviceGroupContext;
     }
 
+    /**
+     *  To get the ERP for a given service , if the transport is present and not
+     * running then it will add as a listener to ListenerManager , there it will
+     * init that and start the listener , and finally ask the EPR from tarnsport
+     * for a given service
+     * @param transport : Name of the transport
+     * @return
+     * @throws AxisFault
+     */
     public EndpointReference getMyEPR(String transport) throws AxisFault {
         axisService.isEnableAllTransport();
         ConfigurationContext configctx = getConfigurationContext();
         if (configctx != null) {
             ListenerManager lm = configctx.getListenerManager();
+            if (!lm.isListenerRunning(transport)) {
+                TransportInDescription trsin = configctx.getAxisConfiguration().
+                        getTransportIn(new QName(transport));
+                if (trsin != null) {
+                    lm.addListener(trsin, false);
+                } else {
+                    throw new AxisFault(Messages.getMessage("transportnotfound",
+                            transport));
+                }
+            }
             if (!lm.isStopped()) {
                 return lm.getERPforService(axisService.getName(), null, transport);
             }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/ListenerManager.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/ListenerManager.java?rev=384440&r1=384439&r2=384440&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/ListenerManager.java (original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/ListenerManager.java Wed Mar  8 21:50:19 2006
@@ -37,7 +37,7 @@
 
     private ConfigurationContext configctx;
     private HashMap startedTranports = new HashMap();
-    private boolean stopped;
+    private boolean stopped = true;
 
     public void init(ConfigurationContext configCtx) {
         configCtx.setTransportManager(this);
@@ -131,14 +131,20 @@
         stopped = true;
     }
 
-    public void addListener(TransportInDescription trsIn, boolean start) throws AxisFault {
+    /**
+     * @param trsIn   : Transport in description (which contains Transport Listener)
+     * @param started : whether transport Listener running or not
+     * @throws AxisFault : will throw AxisFault if something goes wrong
+     */
+    public void addListener(TransportInDescription trsIn, boolean started) throws AxisFault {
         configctx.getAxisConfiguration().addTransportIn(trsIn);
         TransportListener transportListener = trsIn.getReceiver();
         if (transportListener != null) {
-            if (!start) {
-                transportListener.init(configctx,trsIn);
+            if (!started) {
+                transportListener.init(configctx, trsIn);
                 transportListener.start();
             }
+            stopped = false;
             startedTranports.put(trsIn.getName().getLocalPart(), transportListener);
         }
     }