axis-java-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From veit...@apache.org
Subject svn commit: r1577347 - in /axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi: OSGiAxisServlet.java internal/Activator.java
Date Thu, 13 Mar 2014 22:18:06 GMT
Author: veithen
Date: Thu Mar 13 22:18:06 2014
New Revision: 1577347

URL: http://svn.apache.org/r1577347
Log:
No need to get the service reference for the ConfigurationContext multiple times.

Modified:
    axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/OSGiAxisServlet.java
    axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/internal/Activator.java

Modified: axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/OSGiAxisServlet.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/OSGiAxisServlet.java?rev=1577347&r1=1577346&r2=1577347&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/OSGiAxisServlet.java
(original)
+++ axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/OSGiAxisServlet.java
Thu Mar 13 22:18:06 2014
@@ -18,8 +18,6 @@ package org.apache.axis2.osgi;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.transport.http.AxisServlet;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
 
 import javax.servlet.ServletConfig;
 import javax.servlet.ServletContext;
@@ -31,26 +29,15 @@ import javax.servlet.ServletException;
  */
 public class OSGiAxisServlet extends AxisServlet {
 
-    private BundleContext context;
+    private ConfigurationContext configurationContext;
 
-    /**
-     * OSGiAxisServlet needs an referenc to OSGi environmentb
-     *
-     * @param context BundleContext
-     */
-    public OSGiAxisServlet(BundleContext context) {
-        this.context = context;
+    public OSGiAxisServlet(ConfigurationContext configurationContext) {
+        this.configurationContext = configurationContext;
     }
 
     @Override
     protected ConfigurationContext initConfigContext(ServletConfig config) throws ServletException
{
-        ServiceReference reference =
-                context.getServiceReference(ConfigurationContext.class.getName());
-        if (reference == null) {
-            throw new ServletException(
-                    "An instance of ConfigurationContext is not available to continue the
proccess.");
-        }
-        return (ConfigurationContext) context.getService(reference);
+        return configurationContext;
     }
 
     @Override

Modified: axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/internal/Activator.java
URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/internal/Activator.java?rev=1577347&r1=1577346&r2=1577347&view=diff
==============================================================================
--- axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/internal/Activator.java
(original)
+++ axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/internal/Activator.java
Thu Mar 13 22:18:06 2014
@@ -73,11 +73,11 @@ public class Activator implements Bundle
 
             HttpService httpService = (HttpService) context.getService(serviceReference);
             try {
-                OSGiAxisServlet axisServlet = new OSGiAxisServlet(context);
                 ServiceReference configCtxRef =
                         context.getServiceReference(ConfigurationContext.class.getName());
                 ConfigurationContext configCtx =
                         (ConfigurationContext) context.getService(configCtxRef);
+                OSGiAxisServlet axisServlet = new OSGiAxisServlet(configCtx);
                 String propServiceContextRoot = context.getProperty(AXIS2_OSGi_ROOT_CONTEXT);
                 String serviceContextRoot = "services";
                 if (propServiceContextRoot != null && propServiceContextRoot.length()
!= 0) {



Mime
View raw message