axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r628072 - in /webservices/axis2/trunk/java: ./ modules/osgi/ modules/osgi/src/ modules/osgi/src/org/ modules/osgi/src/org/apache/ modules/osgi/src/org/apache/axis2/ modules/osgi/src/org/apache/axis2/extensions/ modules/osgi/src/org/apache/a...
Date Fri, 15 Feb 2008 14:43:45 GMT
Author: dims
Date: Fri Feb 15 06:43:43 2008
New Revision: 628072

URL: http://svn.apache.org/viewvc?rev=628072&view=rev
Log:
Experimenting with OSGi

Added:
    webservices/axis2/trunk/java/modules/osgi/   (with props)
    webservices/axis2/trunk/java/modules/osgi/pom.xml
    webservices/axis2/trunk/java/modules/osgi/src/
    webservices/axis2/trunk/java/modules/osgi/src/org/
    webservices/axis2/trunk/java/modules/osgi/src/org/apache/
    webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/
    webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/
    webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/
    webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/Activator.java
    webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/OSGiAxis2Servlet.java
Modified:
    webservices/axis2/trunk/java/pom.xml

Propchange: webservices/axis2/trunk/java/modules/osgi/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri Feb 15 06:43:43 2008
@@ -0,0 +1,2 @@
+*.iml
+target

Added: webservices/axis2/trunk/java/modules/osgi/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/osgi/pom.xml?rev=628072&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/osgi/pom.xml (added)
+++ webservices/axis2/trunk/java/modules/osgi/pom.xml Fri Feb 15 06:43:43 2008
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements. See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership. The ASF licenses this file
+  ~ to you 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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <packaging>bundle</packaging>
+    <parent>
+        <groupId>org.apache.axis2</groupId>
+        <artifactId>axis2-parent</artifactId>
+        <version>SNAPSHOT</version>
+        <relativePath>../parent/pom.xml</relativePath>
+    </parent>
+    <artifactId>axis2-osgi</artifactId>
+    <name>Apache Axis 2.0 - OSGi</name>
+    <description>OSGi for Axis 2.0</description>
+    <build>
+        <sourceDirectory>src</sourceDirectory>
+        <plugins>
+            <plugin>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy-dependencies</id>
+                        <phase>package</phase>
+                        <goals>
+                            <goal>copy-dependencies</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <version>1.2.0</version>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-Version>1.4</Bundle-Version>
+                        <Bundle-Name>org.apache.axis2</Bundle-Name>
+                        <Bundle-Vendor>Apache Software Foundation</Bundle-Vendor>
+                        <Bundle-Author>Davanum Srinivas &lt;dims@apache.org&gt;</Bundle-Author>
+                        <Bundle-Description>OSGi Bundle for Axis2</Bundle-Description>
+                        <Bundle-SymbolicName>org.apache.axis2.osgi</Bundle-SymbolicName>
+                        <Bundle-Activator>org.apache.axis2.extensions.osgi.Activator</Bundle-Activator>
+                        <Export-Package>${bundle.namespace}.*;version="1.4"</Export-Package>
+                        <Import-Package>*;resolution:=optional</Import-Package>
+                        <Private-Package>org.apache.axis2.extensions.osgi.*</Private-Package>
+                        <Embed-Dependency>*;scope=compile|runtime;inline=false</Embed-Dependency>
+                        <Embed-Directory>target/dependency</Embed-Directory>
+                        <Embed-Transitive>true</Embed-Transitive>
+                        <Embed-StripGroup>true</Embed-StripGroup>
+                    </instructions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.axis2</groupId>
+            <artifactId>axis2-kernel</artifactId>
+            <version>${version}</version>
+            <exclusions>
+                <exclusion>
+                    <groupId>javax.servlet</groupId>
+                    <artifactId>servlet-api</artifactId>
+                </exclusion>
+            </exclusions>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.core</artifactId>
+            <version>1.1.0-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>org.osgi.compendium</artifactId>
+            <version>1.0.0</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.felix</groupId>
+            <artifactId>javax.servlet</artifactId>
+            <version>1.0.0</version>
+            <scope>provided</scope>
+        </dependency>
+    </dependencies>
+</project>

Added: webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/Activator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/Activator.java?rev=628072&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/Activator.java
(added)
+++ webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/Activator.java
Fri Feb 15 06:43:43 2008
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.extensions.osgi;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.http.HttpService;
+
+import javax.servlet.Servlet;
+
+public class Activator implements BundleActivator {
+
+    BundleContext context;
+
+    public void start(BundleContext context) throws Exception {
+        this.context = context;
+        doServletRegistration();
+    }
+
+
+    private void doServletRegistration() {
+        ServiceReference sr = context.getServiceReference(HttpService.class.getName());
+        if (sr != null) {
+            HttpService httpServ = (HttpService) context.getService(sr);
+
+            try {
+                Servlet servlet = new OSGiAxis2Servlet();
+                httpServ.registerServlet("/axis2",
+                        servlet, null, null);
+            } catch (Exception e) {
+                System.err.println("Exception registering Axis Servlet:"
+                        + e);
+            }
+        }
+    }
+
+    public void stop(BundleContext context) throws Exception {
+    }
+}

Added: webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/OSGiAxis2Servlet.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/OSGiAxis2Servlet.java?rev=628072&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/OSGiAxis2Servlet.java
(added)
+++ webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/OSGiAxis2Servlet.java
Fri Feb 15 06:43:43 2008
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.extensions.osgi;
+
+import org.apache.axis2.transport.http.AxisServlet;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+
+public class OSGiAxis2Servlet extends AxisServlet {
+    public void init(ServletConfig config) throws ServletException {
+        // Fix for a class loader issue in Felix
+        ClassLoader cl = Thread.currentThread().getContextClassLoader();
+        Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
+        try {
+            super.init(config);
+        } finally {
+            Thread.currentThread().setContextClassLoader(cl);
+        }
+    }
+
+    /**
+     * Set the context root if it is not set already. We are overriding AxisServlet's impl
to
+     * get past an issue in Felix.
+     *
+     * @param req
+     */
+    public void initContextRoot(HttpServletRequest req) {
+        if (contextRoot != null && contextRoot.trim().length() != 0) {
+            return;
+        }
+        String contextPath = req.getServletPath();
+
+        //handling ROOT scenario, for servlets in the default (root) context, this method
returns ""
+        if (contextPath != null && contextPath.length() == 0) {
+            contextPath = "/";
+        }
+        this.contextRoot = contextPath;
+
+        configContext.setContextRoot(contextRoot);
+    }
+}

Modified: webservices/axis2/trunk/java/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/pom.xml?rev=628072&r1=628071&r2=628072&view=diff
==============================================================================
--- webservices/axis2/trunk/java/pom.xml (original)
+++ webservices/axis2/trunk/java/pom.xml Fri Feb 15 06:43:43 2008
@@ -128,6 +128,7 @@
                 <module>modules/jaxws</module>
                 <module>modules/clustering</module>
                 <module>modules/corba</module>
+                <module>modules/osgi</module>
             </modules>
             <build>
                 <plugins>



---------------------------------------------------------------------
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