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/08/19 07:50:17 UTC
svn commit: r686959 - in
/webservices/axis2/scratch/java/saminda/osgi_test/version.service: pom.xml
src/main/java/org/apache/axis2/osgi/service/Activator.java
src/main/java/org/apache/axis2/osgi/service/Calculator.java
Author: saminda
Date: Mon Aug 18 22:50:16 2008
New Revision: 686959
URL: http://svn.apache.org/viewvc?rev=686959&view=rev
Log:
Simple sample that demonstrate publishing of OSGi service as a WS
Added:
webservices/axis2/scratch/java/saminda/osgi_test/version.service/src/main/java/org/apache/axis2/osgi/service/Activator.java
webservices/axis2/scratch/java/saminda/osgi_test/version.service/src/main/java/org/apache/axis2/osgi/service/Calculator.java
Modified:
webservices/axis2/scratch/java/saminda/osgi_test/version.service/pom.xml
Modified: webservices/axis2/scratch/java/saminda/osgi_test/version.service/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/java/saminda/osgi_test/version.service/pom.xml?rev=686959&r1=686958&r2=686959&view=diff
==============================================================================
--- webservices/axis2/scratch/java/saminda/osgi_test/version.service/pom.xml (original)
+++ webservices/axis2/scratch/java/saminda/osgi_test/version.service/pom.xml Mon Aug 18 22:50:16 2008
@@ -53,6 +53,7 @@
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
<Require-Bundle>org.apache.axis2.osgi;visibility:=reexport</Require-Bundle>
<Private-Package>org.apache.axis2.osgi.service</Private-Package>
+ <Bundle-Activator>org.apache.axis2.osgi.service.Activator</Bundle-Activator>
<Bundle-RequiredExecutionEnvironment>
J2SE-1.5
</Bundle-RequiredExecutionEnvironment>
@@ -78,6 +79,13 @@
<version>SNAPSHOT</version>
</dependency>
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ <version>1.0.0</version>
+ <scope>provided</scope>
+ </dependency>
+
</dependencies>
Added: webservices/axis2/scratch/java/saminda/osgi_test/version.service/src/main/java/org/apache/axis2/osgi/service/Activator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/java/saminda/osgi_test/version.service/src/main/java/org/apache/axis2/osgi/service/Activator.java?rev=686959&view=auto
==============================================================================
--- webservices/axis2/scratch/java/saminda/osgi_test/version.service/src/main/java/org/apache/axis2/osgi/service/Activator.java (added)
+++ webservices/axis2/scratch/java/saminda/osgi_test/version.service/src/main/java/org/apache/axis2/osgi/service/Activator.java Mon Aug 18 22:50:16 2008
@@ -0,0 +1,39 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.osgi.service;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.apache.axis2.osgi.deployment.tracker.WSTracker;
+
+import java.util.Dictionary;
+import java.util.Properties;
+
+/*
+*
+*/
+public class Activator implements BundleActivator {
+
+ public void start(BundleContext context) throws Exception {
+ Dictionary prop = new Properties();
+ prop.put(WSTracker.AXIS2_WS, "myCal");
+ context.registerService(Calculator.class.getName(), new Calculator(), prop);
+ }
+
+ public void stop(BundleContext context) throws Exception {
+
+ }
+}
Added: webservices/axis2/scratch/java/saminda/osgi_test/version.service/src/main/java/org/apache/axis2/osgi/service/Calculator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/scratch/java/saminda/osgi_test/version.service/src/main/java/org/apache/axis2/osgi/service/Calculator.java?rev=686959&view=auto
==============================================================================
--- webservices/axis2/scratch/java/saminda/osgi_test/version.service/src/main/java/org/apache/axis2/osgi/service/Calculator.java (added)
+++ webservices/axis2/scratch/java/saminda/osgi_test/version.service/src/main/java/org/apache/axis2/osgi/service/Calculator.java Mon Aug 18 22:50:16 2008
@@ -0,0 +1,26 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.osgi.service;
+
+/*
+*
+*/
+public class Calculator {
+
+ public double add(double x, double y) {
+ return x + y;
+ }
+}