You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sa...@apache.org on 2008/07/05 14:19:37 UTC

svn commit: r674188 - /webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/osgi/deployment/OSGiConfigurationContextFactory.java

Author: saminda
Date: Sat Jul  5 05:19:37 2008
New Revision: 674188

URL: http://svn.apache.org/viewvc?rev=674188&view=rev
Log:
Added the ability to add AxisObserver(s) as OSGi services 

Modified:
    webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/osgi/deployment/OSGiConfigurationContextFactory.java

Modified: webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/osgi/deployment/OSGiConfigurationContextFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/osgi/deployment/OSGiConfigurationContextFactory.java?rev=674188&r1=674187&r2=674188&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/osgi/deployment/OSGiConfigurationContextFactory.java (original)
+++ webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/osgi/deployment/OSGiConfigurationContextFactory.java Sat Jul  5 05:19:37 2008
@@ -24,10 +24,7 @@
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.Parameter;
 import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.engine.AxisConfigurator;
-import org.apache.axis2.engine.ListenerManager;
-import org.apache.axis2.engine.AxisConfiguration;
-import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.engine.*;
 import static org.apache.axis2.osgi.deployment.OSGiAxis2Constants.*;
 import org.apache.axis2.osgi.tx.HttpListener;
 import org.apache.axis2.transport.TransportListener;
@@ -202,10 +199,8 @@
                         lock.unlock();
                     }
                 }
-            } else if (service instanceof Deployer) {
-                // TODO: TBD, there is no Axis2 API yet available to add deployers.
             } else if (service instanceof MessageReceiver) {
-                String mep = (String)reference.getProperty(MEP);
+                String mep = (String) reference.getProperty(MEP);
                 if (mep == null || mep.length() == 0) {
                     throw new RuntimeException(MEP + " is missing from message receiver object");
                 }
@@ -219,8 +214,22 @@
                         lock.unlock();
                     }
                 }
+            } else if (service instanceof AxisObserver) {
+                if (event.getType() == ServiceEvent.REGISTERED || event.getType() ==
+                                                                  ServiceEvent.MODIFIED) {
+                    AxisObserver axisObserver = (AxisObserver) service;
+                    lock.lock();
+                    try {
+                        axisObserver.init(axisConfig);
+                        axisConfig.addObservers(axisObserver);
+                    } finally {
+                        lock.unlock();
+                    }
+                }
             } else if (service instanceof TransportSender) {
                 //TODO: TBD
+            } else if (service instanceof Deployer) {
+                // TODO: TBD, there is no Axis2 API yet available to add deployers.
             }
         }
     }