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/06/18 10:29:24 UTC
svn commit: r669109 - in /webservices/axis2/trunk/java/modules/osgi: ./
resources/WEB-INF/ resources/org/ resources/org/apache/
resources/org/apache/axis2/ resources/org/apache/axis2/osgi/
resources/org/apache/axis2/osgi/deployment/ src/org/apache/axis...
Author: saminda
Date: Wed Jun 18 01:29:19 2008
New Revision: 669109
URL: http://svn.apache.org/viewvc?rev=669109&view=rev
Log: (empty)
Added:
webservices/axis2/trunk/java/modules/osgi/resources/org/
webservices/axis2/trunk/java/modules/osgi/resources/org/apache/
webservices/axis2/trunk/java/modules/osgi/resources/org/apache/axis2/
webservices/axis2/trunk/java/modules/osgi/resources/org/apache/axis2/osgi/
webservices/axis2/trunk/java/modules/osgi/resources/org/apache/axis2/osgi/deployment/
webservices/axis2/trunk/java/modules/osgi/resources/org/apache/axis2/osgi/deployment/axis2.xml
- copied, changed from r668626, webservices/axis2/trunk/java/modules/osgi/resources/WEB-INF/axis2.xml
webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/osgi/deployment/OSGiServerConfigurator.java
webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/osgi/util/BundleClassLoader.java
Removed:
webservices/axis2/trunk/java/modules/osgi/resources/WEB-INF/axis2.xml
webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/extensions/osgi/util/BundleClassLoader.java
webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/osgi/engine/
Modified:
webservices/axis2/trunk/java/modules/osgi/pom.xml
Modified: webservices/axis2/trunk/java/modules/osgi/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/osgi/pom.xml?rev=669109&r1=669108&r2=669109&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/osgi/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/osgi/pom.xml Wed Jun 18 01:29:19 2008
@@ -59,18 +59,24 @@
<Export-Package>
!org.apache.axis2.osgi.internal,
org.apache.axis2.osgi.*; version=1.0.0,
- org.apache.axis2.*;-split-package:=merge-last,
+ org.apache.axis2.*;-split-package:=merge-last; version=1.5,
</Export-Package>
<Import-Package>
!org.apache.axis2.*,
javax.servlet; version=2.4.0,
javax.servlet.http; version=2.4.0,
+ org.osgi.framework;version=1.3.0,
*;resolution:=optional
</Import-Package>
<Private-Package>
org.apache.axis2.osgi.internal,
</Private-Package>
- <Bundle-Activator>org.apache.axis2.osgi.internal.Activator</Bundle-Activator>
+ <Bundle-Activator>
+ org.apache.axis2.osgi.internal.Activator
+ </Bundle-Activator>
+ <Export-Service>
+ org.apache.axis2.engine.AxisConfiguration
+ </Export-Service>
</instructions>
</configuration>
</plugin>
Copied: webservices/axis2/trunk/java/modules/osgi/resources/org/apache/axis2/osgi/deployment/axis2.xml (from r668626, webservices/axis2/trunk/java/modules/osgi/resources/WEB-INF/axis2.xml)
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/osgi/resources/org/apache/axis2/osgi/deployment/axis2.xml?p2=webservices/axis2/trunk/java/modules/osgi/resources/org/apache/axis2/osgi/deployment/axis2.xml&p1=webservices/axis2/trunk/java/modules/osgi/resources/WEB-INF/axis2.xml&r1=668626&r2=669109&rev=669109&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/osgi/resources/WEB-INF/axis2.xml (original)
+++ webservices/axis2/trunk/java/modules/osgi/resources/org/apache/axis2/osgi/deployment/axis2.xml Wed Jun 18 01:29:19 2008
@@ -83,7 +83,7 @@
<parameter name="disableSOAP12" locked="true">false</parameter>
<!--POJO deployer , this will alow users to drop .class file and make that into a service-->
- <deployer extension=".class" directory="pojo" class="org.apache.axis2.deployment.POJODeployer"/>
+ <!--<deployer extension=".class" directory="pojo" class="org.apache.axis2.deployment.POJODeployer"/>-->
<!--<deployer extension=".jsa" directory="rmiservices" class="org.apache.axis2.rmi.deploy.RMIServiceDeployer"/>-->
@@ -155,9 +155,9 @@
<!-- ================================================= -->
<!-- Transport Ins -->
<!-- ================================================= -->
- <transportReceiver name="http"
+ <!--<transportReceiver name="http"
class="org.apache.axis2.transport.http.SimpleHTTPServer">
- <parameter name="port">8080</parameter>
+ <parameter name="port">8080</parameter>-->
<!-- Here is the complete list of supported parameters (see example settings further below):
port: the port to listen on (default 6060)
hostname: if non-null, url prefix used in reply-to endpoint references (default null)
@@ -180,7 +180,7 @@
<!-- <parameter name="requestMaxThreadPoolSize">100</parameter> -->
<!-- <parameter name="threadKeepAliveTime">240000</parameter> -->
<!-- <parameter name="threadKeepAliveTimeUnit">MILLISECONDS</parameter> -->
- </transportReceiver>
+ <!--</transportReceiver>-->
<!--Uncomment if you want to have TCP transport support-->
<!--transportReceiver name="tcp"
Added: webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/osgi/deployment/OSGiServerConfigurator.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/osgi/deployment/OSGiServerConfigurator.java?rev=669109&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/osgi/deployment/OSGiServerConfigurator.java (added)
+++ webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/osgi/deployment/OSGiServerConfigurator.java Wed Jun 18 01:29:19 2008
@@ -0,0 +1,92 @@
+/*
+ * 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.deployment;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.deployment.DeploymentEngine;
+import org.apache.axis2.deployment.DeploymentException;
+import org.apache.axis2.deployment.AxisConfigBuilder;
+import org.apache.axis2.engine.AxisConfiguration;
+import org.apache.axis2.engine.AxisConfigurator;
+import org.osgi.framework.BundleContext;
+
+import java.io.InputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.Enumeration;
+
+/**
+ * This is the heart of the OSGi deployment.
+ * TODO: TBD
+ */
+public class OSGiServerConfigurator extends DeploymentEngine implements AxisConfigurator {
+
+ private BundleContext context;
+
+ private URL axis2XmlUrl;
+
+ public OSGiServerConfigurator(BundleContext context) {
+ this.context = context;
+ Enumeration entries = this.context.getBundle()
+ .findEntries("org/apache/axis2.osgi/deployment", "axis2.xml", false);
+ if (entries != null && entries.hasMoreElements()) {
+ axis2XmlUrl = (URL)entries.nextElement();
+ }
+ }
+
+ /**
+ * OSGiServerConfigurator will create an specifict AxisConfiguration based on axis2.xml which
+ * is available in org/apache/axis2.osgi/deployment directory. This axis2.xml doesn't contain
+ * any listeners. Listeners should be added as services to AxisConfiguration service.
+ *
+ * @return AxisConfiguration; an instance of AxisConfiguration is return
+ * @throws AxisFault; AxisFault will be thrown wrapping any of IOException
+ */
+ public AxisConfiguration getAxisConfiguration() throws AxisFault {
+ try {
+ InputStream inputStream = axis2XmlUrl.openStream();
+ populateAxisConfiguration(inputStream);
+ return axisConfig;
+ } catch (IOException e) {
+ String msg = "Error occured while creating axisConfiguration";
+ throw new AxisFault(msg, e);
+ }
+ }
+
+
+ public void engageGlobalModules() throws AxisFault {
+ //TODO; TBD
+ }
+
+ public AxisConfiguration populateAxisConfiguration(InputStream in) throws DeploymentException {
+ axisConfig = new AxisConfiguration();
+ AxisConfigBuilder builder =
+ new AxisConfigBuilder(in, axisConfig, this);
+ builder.populateConfig();
+ try {
+ if (in != null) {
+ in.close();
+ }
+ } catch (IOException e) {
+ String msg = "Error in closing input stream";
+ throw new DeploymentException(msg, e);
+ }
+ //TODO: if module deployer neede to set it should be set here.
+ //set the AxisConfiguration as a service.
+ context.registerService(AxisConfiguration.class.getName(), axisConfig, null);
+ return axisConfig;
+ }
+}
Added: webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/osgi/util/BundleClassLoader.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/osgi/util/BundleClassLoader.java?rev=669109&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/osgi/util/BundleClassLoader.java (added)
+++ webservices/axis2/trunk/java/modules/osgi/src/org/apache/axis2/osgi/util/BundleClassLoader.java Wed Jun 18 01:29:19 2008
@@ -0,0 +1,86 @@
+/*
+ * 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.util;
+
+import org.osgi.framework.Bundle;
+
+import java.net.URL;
+import java.util.Enumeration;
+import java.io.IOException;
+
+/**
+ * This classloader will be used with AxisService, AxisModule etc
+ */
+public class BundleClassLoader extends ClassLoader {
+
+ private final Bundle bundle;
+
+ public BundleClassLoader(Bundle bundle, ClassLoader parent) {
+ super(parent);
+ this.bundle = bundle;
+ }
+
+ protected Class findClass(String name) throws ClassNotFoundException {
+ try {
+ return bundle.loadClass(name);
+ } catch (ClassNotFoundException e) {
+ //TODO: add the proper logging
+ e.printStackTrace();
+ throw e;
+ }
+ }
+
+ public URL findResource(String name) {
+ return bundle.getResource(name);
+ }
+
+ public Enumeration findResources(String name) throws IOException {
+ return bundle.getResources(name);
+ }
+
+ public URL getResource(String name) {
+ return findResource(name);
+ }
+
+ protected Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
+ Class clazz;
+ try {
+ clazz = findClass(name);
+ }
+ catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ throw e;
+ }
+ if (resolve) {
+ resolveClass(clazz);
+ }
+ return clazz;
+ }
+
+ public Class loadClass(String name) throws ClassNotFoundException {
+ Class clazz;
+ try {
+ clazz = findClass(name);
+ }
+ catch (ClassNotFoundException e) {
+ e.printStackTrace();
+ throw e;
+ }
+ return clazz;
+ }
+}
+
+