svn commit: r1577055 - /axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/deployment/OSGiServerConfigurator.java
Author: veithen Date: Thu Mar 13 07:53:57 2014 New Revision: 1577055 URL: http://svn.apache.org/r1577055 Log: Fixed a class loading issue in the OSGi bundle. Modified: axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/deployment/OSGiServerConfigurator.java Modified: axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/deployment/OSGiServerConfigurator.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/deployment/OSGiServerConfigurator.java?rev=1577055&r1=1577054&r2=1577055&view=diff == --- axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/deployment/OSGiServerConfigurator.java (original) +++ axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/deployment/OSGiServerConfigurator.java Thu Mar 13 07:53:57 2014 @@ -73,20 +73,32 @@ public class OSGiServerConfigurator exte } public AxisConfiguration populateAxisConfiguration(InputStream in) throws DeploymentException { -axisConfig = new AxisConfiguration(); -AxisConfigBuilder builder = -new AxisConfigBuilder(in, axisConfig, this); -builder.populateConfig(); +// Dirty hack necessary because class loading in AxisConfigBuilder is completely broken: +// although it is possible to configure the class loaders explicitly in the AxisConfiguration, +// the AxisConfigBuilder will still use the thread context class loader in some places. +// On the other hand, in an OSGi environment, the TCCL is not well defined. To avoid problems, +// we set it to the class loader of the Axis2 OSGi bundle. +Thread currentThread = Thread.currentThread(); +ClassLoader savedTCCL = currentThread.getContextClassLoader(); + currentThread.setContextClassLoader(OSGiServerConfigurator.class.getClassLoader()); try { -if (in != null) { -in.close(); +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); } -} 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. +return axisConfig; +} finally { +currentThread.setContextClassLoader(savedTCCL); } -//TODO: if module deployer neede to set it should be set here. -return axisConfig; } public void loadServices() {
svn commit: r1577119 - in /axis/axis2/java/core/trunk/modules/osgi-tests: pom.xml src/test/java/OSGiTest.java src/test/java/org/ src/test/resources/
Author: veithen Date: Thu Mar 13 11:47:42 2014 New Revision: 1577119 URL: http://svn.apache.org/r1577119 Log: Integrated Saminda's original test service into the OSGi integration test. Added: axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/org/ - copied from r1577116, axis/axis2/java/core/scratch/java/saminda/osgi_test/version.service/src/main/java/org/ axis/axis2/java/core/trunk/modules/osgi-tests/src/test/resources/ - copied from r1577116, axis/axis2/java/core/scratch/java/saminda/osgi_test/version.service/src/main/resources/ Modified: axis/axis2/java/core/trunk/modules/osgi-tests/pom.xml axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java Modified: axis/axis2/java/core/trunk/modules/osgi-tests/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/osgi-tests/pom.xml?rev=1577119&r1=1577118&r2=1577119&view=diff == --- axis/axis2/java/core/trunk/modules/osgi-tests/pom.xml (original) +++ axis/axis2/java/core/trunk/modules/osgi-tests/pom.xml Thu Mar 13 11:47:42 2014 @@ -39,7 +39,7 @@ ${project.groupId} -axis2-kernel +org.apache.axis2.osgi ${project.version} test @@ -126,11 +126,6 @@ -${project.groupId} - org.apache.axis2.osgi -${project.version} - - org.apache.servicemix.bundles org.apache.servicemix.bundles.wsdl4j 1.6.2_6 Modified: axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java?rev=1577119&r1=1577118&r2=1577119&view=diff == --- axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java (original) +++ axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java Thu Mar 13 11:47:42 2014 @@ -19,10 +19,15 @@ import static org.junit.Assert.assertTrue; import static org.ops4j.pax.exam.CoreOptions.junitBundles; import static org.ops4j.pax.exam.CoreOptions.options; +import static org.ops4j.pax.exam.CoreOptions.provision; import static org.ops4j.pax.exam.CoreOptions.url; +import static org.ops4j.pax.tinybundles.core.TinyBundles.bundle; import javax.inject.Inject; +import org.apache.axis2.osgi.service.Activator; +import org.apache.axis2.osgi.service.Calculator; +import org.apache.axis2.osgi.service.Version; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; @@ -33,6 +38,7 @@ import org.ops4j.pax.exam.spi.reactors.E import org.ops4j.pax.exam.spi.reactors.PerClass; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; @RunWith(PaxExam.class) @ExamReactorStrategy(PerClass.class) @@ -63,6 +69,15 @@ public class OSGiTest { url("link:classpath:org.apache.woden.core.link"), url("link:classpath:org.apache.ws.xmlschema.core.link"), url("link:classpath:org.apache.axis2.osgi.link"), +provision(bundle() +.add(Activator.class) +.add(Calculator.class) +.add(Version.class) +.add("META-INF/services.xml", OSGiTest.class.getResource("/META-INF/services.xml")) +.set(Constants.BUNDLE_SYMBOLICNAME, "version.service") +.set(Constants.BUNDLE_ACTIVATOR, Activator.class.getName()) +.set(Constants.DYNAMICIMPORT_PACKAGE, "*") +.build()), junitBundles()); }
svn commit: r1577125 - in /axis/axis2/java/core/trunk/modules/osgi-tests/src/test: java/OSGiTest.java java/org/apache/axis2/osgi/module/ resources/META-INF/module.xml
Author: veithen Date: Thu Mar 13 12:03:58 2014 New Revision: 1577125 URL: http://svn.apache.org/r1577125 Log: Also added Saminda's test module. Added: axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/org/apache/axis2/osgi/module/ - copied from r1577121, axis/axis2/java/core/scratch/java/saminda/osgi_test/simple.module/src/main/java/org/apache/axis2/osgi/module/ axis/axis2/java/core/trunk/modules/osgi-tests/src/test/resources/META-INF/module.xml - copied unchanged from r1577121, axis/axis2/java/core/scratch/java/saminda/osgi_test/simple.module/src/main/resources/META-INF/module.xml Modified: axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java Modified: axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java?rev=1577125&r1=1577124&r2=1577125&view=diff == --- axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java (original) +++ axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java Thu Mar 13 12:03:58 2014 @@ -25,6 +25,9 @@ import static org.ops4j.pax.tinybundles. import javax.inject.Inject; +import org.apache.axis2.osgi.module.Handler1; +import org.apache.axis2.osgi.module.Handler2; +import org.apache.axis2.osgi.module.SimpleModule; import org.apache.axis2.osgi.service.Activator; import org.apache.axis2.osgi.service.Calculator; import org.apache.axis2.osgi.service.Version; @@ -70,6 +73,14 @@ public class OSGiTest { url("link:classpath:org.apache.ws.xmlschema.core.link"), url("link:classpath:org.apache.axis2.osgi.link"), provision(bundle() +.add(Handler1.class) +.add(Handler2.class) +.add(SimpleModule.class) +.add("META-INF/module.xml", OSGiTest.class.getResource("/META-INF/module.xml")) +.set(Constants.BUNDLE_SYMBOLICNAME, "simple.module") +.set(Constants.DYNAMICIMPORT_PACKAGE, "*") +.build()), +provision(bundle() .add(Activator.class) .add(Calculator.class) .add(Version.class)
svn commit: r1577191 - in /axis/axis2/java/core/trunk/modules/osgi-tests: pom.xml src/test/java/OSGiTest.java
Author: veithen Date: Thu Mar 13 15:20:31 2014 New Revision: 1577191 URL: http://svn.apache.org/r1577191 Log: Refactored the OSGi test: the test code itself doesn't need to run in the OSGi container and we don't need to install a probe. Instead, we just need to run the container and send SOAP requests to the services deployed in the container. Modified: axis/axis2/java/core/trunk/modules/osgi-tests/pom.xml axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java Modified: axis/axis2/java/core/trunk/modules/osgi-tests/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/osgi-tests/pom.xml?rev=1577191&r1=1577190&r2=1577191&view=diff == --- axis/axis2/java/core/trunk/modules/osgi-tests/pom.xml (original) +++ axis/axis2/java/core/trunk/modules/osgi-tests/pom.xml Thu Mar 13 15:20:31 2014 @@ -76,21 +76,8 @@ test -org.ops4j.pax.exam -pax-exam-junit4 -${exam.version} -test - - junit junit -4.11 -test - - -org.apache.geronimo.specs -geronimo-atinject_1.0_spec -1.0 test Modified: axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java?rev=1577191&r1=1577190&r2=1577191&view=diff == --- axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java (original) +++ axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java Thu Mar 13 15:20:31 2014 @@ -17,38 +17,33 @@ * under the License. */ import static org.junit.Assert.assertTrue; -import static org.ops4j.pax.exam.CoreOptions.junitBundles; import static org.ops4j.pax.exam.CoreOptions.options; import static org.ops4j.pax.exam.CoreOptions.provision; import static org.ops4j.pax.exam.CoreOptions.url; import static org.ops4j.pax.tinybundles.core.TinyBundles.bundle; -import javax.inject.Inject; - import org.apache.axis2.osgi.module.Handler1; import org.apache.axis2.osgi.module.Handler2; import org.apache.axis2.osgi.module.SimpleModule; import org.apache.axis2.osgi.service.Activator; import org.apache.axis2.osgi.service.Calculator; import org.apache.axis2.osgi.service.Version; +import org.apache.felix.framework.FrameworkFactory; import org.junit.Assert; import org.junit.Test; -import org.junit.runner.RunWith; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.junit.PaxExam; -import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; -import org.ops4j.pax.exam.spi.reactors.PerClass; +import org.ops4j.pax.exam.ExamSystem; +import org.ops4j.pax.exam.nat.internal.NativeTestContainer; +import org.ops4j.pax.exam.spi.DefaultExamSystem; import org.osgi.framework.Bundle; import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; -@RunWith(PaxExam.class) -@ExamReactorStrategy(PerClass.class) public class OSGiTest { -@Configuration -public static Option[] configuration() { -return options( +@Test +public void test() throws Exception { +ExamSystem system = DefaultExamSystem.create(options( + url("link:classpath:META-INF/links/org.ops4j.pax.logging.api.link"), +url("link:classpath:META-INF/links/org.osgi.compendium.link"), url("link:classpath:org.apache.servicemix.bundles.wsdl4j.link"), url("link:classpath:org.apache.geronimo.specs.geronimo-activation_1.1_spec.link"), // TODO: should not be necessary on Java 6 url("link:classpath:org.apache.geronimo.specs.geronimo-jms_1.1_spec.link"), // TODO: why the heck is this required??? @@ -88,23 +83,22 @@ public class OSGiTest { .set(Constants.BUNDLE_SYMBOLICNAME, "version.service") .set(Constants.BUNDLE_ACTIVATOR, Activator.class.getName()) .set(Constants.DYNAMICIMPORT_PACKAGE, "*") -.build()), -junitBundles()); -} - -@Inject -private BundleContext context; - -@Test -public void test() { -boolean found = false; -for (Bundle bundle : context.getBundles()) { -if (bundle.getSymbolicName().equals("org.apache.axis2.osgi")) { -found = true; -Assert.assertEquals(Bundle.ACTIVE, bundle.getState()); -break; +.build(; +NativeTestContainer container = new NativeTestContainer(system, new FrameworkFactory()); +container.start(); +try { +BundleContext context = container.getSystemBundle().getBundleContext(
svn commit: r1577342 - in /axis/axis2/java/core/trunk/modules/osgi-tests: pom.xml src/test/java/OSGiTest.java
Author: veithen Date: Thu Mar 13 22:17:41 2014 New Revision: 1577342 URL: http://svn.apache.org/r1577342 Log: Enable HTTP in the OSGi tests. Modified: axis/axis2/java/core/trunk/modules/osgi-tests/pom.xml axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java Modified: axis/axis2/java/core/trunk/modules/osgi-tests/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/osgi-tests/pom.xml?rev=1577342&r1=1577341&r2=1577342&view=diff == --- axis/axis2/java/core/trunk/modules/osgi-tests/pom.xml (original) +++ axis/axis2/java/core/trunk/modules/osgi-tests/pom.xml Thu Mar 13 22:17:41 2014 @@ -80,6 +80,11 @@ junit test + +${project.groupId} +axis2-testutils +${project.version} + @@ -113,6 +118,11 @@ +org.apache.felix + org.apache.felix.http.jetty +2.2.2 + + org.apache.servicemix.bundles org.apache.servicemix.bundles.wsdl4j 1.6.2_6 Modified: axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java?rev=1577342&r1=1577341&r2=1577342&view=diff == --- axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java (original) +++ axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java Thu Mar 13 22:17:41 2014 @@ -17,6 +17,7 @@ * under the License. */ import static org.junit.Assert.assertTrue; +import static org.ops4j.pax.exam.CoreOptions.frameworkProperty; import static org.ops4j.pax.exam.CoreOptions.options; import static org.ops4j.pax.exam.CoreOptions.provision; import static org.ops4j.pax.exam.CoreOptions.url; @@ -28,6 +29,7 @@ import org.apache.axis2.osgi.module.Simp import org.apache.axis2.osgi.service.Activator; import org.apache.axis2.osgi.service.Calculator; import org.apache.axis2.osgi.service.Version; +import org.apache.axis2.testutils.PortAllocator; import org.apache.felix.framework.FrameworkFactory; import org.junit.Assert; import org.junit.Test; @@ -41,6 +43,7 @@ import org.osgi.framework.Constants; public class OSGiTest { @Test public void test() throws Exception { +int httpPort = PortAllocator.allocatePort(); ExamSystem system = DefaultExamSystem.create(options( url("link:classpath:META-INF/links/org.ops4j.pax.logging.api.link"), url("link:classpath:META-INF/links/org.osgi.compendium.link"), @@ -66,6 +69,7 @@ public class OSGiTest { url("link:classpath:org.apache.neethi.link"), url("link:classpath:org.apache.woden.core.link"), url("link:classpath:org.apache.ws.xmlschema.core.link"), +url("link:classpath:org.apache.felix.http.jetty.link"), url("link:classpath:org.apache.axis2.osgi.link"), provision(bundle() .add(Handler1.class) @@ -83,7 +87,8 @@ public class OSGiTest { .set(Constants.BUNDLE_SYMBOLICNAME, "version.service") .set(Constants.BUNDLE_ACTIVATOR, Activator.class.getName()) .set(Constants.DYNAMICIMPORT_PACKAGE, "*") -.build(; +.build()), + frameworkProperty("org.osgi.service.http.port").value(String.valueOf(httpPort; NativeTestContainer container = new NativeTestContainer(system, new FrameworkFactory()); container.start(); try {
svn commit: r1577343 - in /axis/axis2/java/core/trunk: modules/osgi-tests/src/test/java/OSGiTest.java pom.xml
Author: veithen Date: Thu Mar 13 22:17:46 2014 New Revision: 1577343 URL: http://svn.apache.org/r1577343 Log: * Completed the OSGi test: it now sends a SOAP request to a service deployed with OSGi. * Added the OSGi test to the build. Modified: axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java axis/axis2/java/core/trunk/pom.xml Modified: axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java?rev=1577343&r1=1577342&r2=1577343&view=diff == --- axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java (original) +++ axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java Thu Mar 13 22:17:46 2014 @@ -16,13 +16,19 @@ * specific language governing permissions and limitations * under the License. */ -import static org.junit.Assert.assertTrue; +import static org.junit.Assert.assertEquals; import static org.ops4j.pax.exam.CoreOptions.frameworkProperty; import static org.ops4j.pax.exam.CoreOptions.options; import static org.ops4j.pax.exam.CoreOptions.provision; import static org.ops4j.pax.exam.CoreOptions.url; import static org.ops4j.pax.tinybundles.core.TinyBundles.bundle; +import org.apache.axiom.om.OMAbstractFactory; +import org.apache.axiom.om.OMElement; +import org.apache.axiom.om.OMFactory; +import org.apache.axis2.addressing.EndpointReference; +import org.apache.axis2.client.Options; +import org.apache.axis2.client.ServiceClient; import org.apache.axis2.osgi.module.Handler1; import org.apache.axis2.osgi.module.Handler2; import org.apache.axis2.osgi.module.SimpleModule; @@ -31,13 +37,10 @@ import org.apache.axis2.osgi.service.Cal import org.apache.axis2.osgi.service.Version; import org.apache.axis2.testutils.PortAllocator; import org.apache.felix.framework.FrameworkFactory; -import org.junit.Assert; import org.junit.Test; import org.ops4j.pax.exam.ExamSystem; import org.ops4j.pax.exam.nat.internal.NativeTestContainer; import org.ops4j.pax.exam.spi.DefaultExamSystem; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; import org.osgi.framework.Constants; public class OSGiTest { @@ -92,16 +95,14 @@ public class OSGiTest { NativeTestContainer container = new NativeTestContainer(system, new FrameworkFactory()); container.start(); try { -BundleContext context = container.getSystemBundle().getBundleContext(); -boolean found = false; -for (Bundle bundle : context.getBundles()) { -if (bundle.getSymbolicName().equals("org.apache.axis2.osgi")) { -found = true; -Assert.assertEquals(Bundle.ACTIVE, bundle.getState()); -break; -} -} -assertTrue(found); +OMFactory factory = OMAbstractFactory.getOMFactory(); +OMElement payload = factory.createOMElement("getVersion", factory.createOMNamespace("http://service.osgi.axis2.apache.org";, "ns")); +Options options = new Options(); +options.setTo(new EndpointReference("http://localhost:"; + httpPort + "/services/Version")); +ServiceClient serviceClient = new ServiceClient(); +serviceClient.setOptions(options); +OMElement result = serviceClient.sendReceive(payload); +assertEquals("getVersionResponse", result.getLocalName()); } finally { container.stop(); } Modified: axis/axis2/java/core/trunk/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/pom.xml?rev=1577343&r1=1577342&r2=1577343&view=diff == --- axis/axis2/java/core/trunk/pom.xml (original) +++ axis/axis2/java/core/trunk/pom.xml Thu Mar 13 22:17:46 2014 @@ -83,6 +83,7 @@ modules/clustering modules/corba modules/osgi +modules/osgi-tests modules/transport/local modules/transport/http modules/transport/base
svn commit: r1577344 - /axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/OSGiAxisServlet.java
Author: veithen Date: Thu Mar 13 22:17:51 2014 New Revision: 1577344 URL: http://svn.apache.org/r1577344 Log: Removed unused imports. Modified: axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/OSGiAxisServlet.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=1577344&r1=1577343&r2=1577344&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:17:51 2014 @@ -15,10 +15,7 @@ */ package org.apache.axis2.osgi; -import org.apache.axis2.AxisFault; import org.apache.axis2.context.ConfigurationContext; -import org.apache.axis2.engine.AxisConfigurator; -import org.apache.axis2.osgi.deployment.OSGiConfigurationContextFactory; import org.apache.axis2.transport.http.AxisServlet; import org.apache.axis2.transport.http.ListingAgent; import org.osgi.framework.BundleContext;
svn commit: r1577348 - in /axis/axis2/java/core/trunk/modules: osgi-tests/pom.xml osgi-tests/src/test/java/OSGiTest.java osgi/src/org/apache/axis2/osgi/internal/Activator.java
Author: veithen Date: Thu Mar 13 22:18:12 2014 New Revision: 1577348 URL: http://svn.apache.org/r1577348 Log: AXIS2-5329: * Remove the explicit invocation of OSGiConfigurationContextFactory#update and instead let the config admin service do its job. * Correctly handle the simultaneous dependency on ConfigurationContext and HttpService for the registration of the OSGiAxisServlet: instead of tracking the HttpService, we track the ConfigurationContext and register the servlet via the HTTP whiteboard service. Modified: axis/axis2/java/core/trunk/modules/osgi-tests/pom.xml axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/internal/Activator.java Modified: axis/axis2/java/core/trunk/modules/osgi-tests/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/osgi-tests/pom.xml?rev=1577348&r1=1577347&r2=1577348&view=diff == --- axis/axis2/java/core/trunk/modules/osgi-tests/pom.xml (original) +++ axis/axis2/java/core/trunk/modules/osgi-tests/pom.xml Thu Mar 13 22:18:12 2014 @@ -123,6 +123,16 @@ 2.2.2 +org.apache.felix + org.apache.felix.http.whiteboard +2.2.2 + + +org.apache.felix + org.apache.felix.configadmin +1.8.0 + + org.apache.servicemix.bundles org.apache.servicemix.bundles.wsdl4j 1.6.2_6 Modified: axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java?rev=1577348&r1=1577347&r2=1577348&view=diff == --- axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java (original) +++ axis/axis2/java/core/trunk/modules/osgi-tests/src/test/java/OSGiTest.java Thu Mar 13 22:18:12 2014 @@ -50,6 +50,7 @@ public class OSGiTest { ExamSystem system = DefaultExamSystem.create(options( url("link:classpath:META-INF/links/org.ops4j.pax.logging.api.link"), url("link:classpath:META-INF/links/org.osgi.compendium.link"), +url("link:classpath:org.apache.felix.configadmin.link"), url("link:classpath:org.apache.servicemix.bundles.wsdl4j.link"), url("link:classpath:org.apache.geronimo.specs.geronimo-activation_1.1_spec.link"), // TODO: should not be necessary on Java 6 url("link:classpath:org.apache.geronimo.specs.geronimo-jms_1.1_spec.link"), // TODO: why the heck is this required??? @@ -73,6 +74,7 @@ public class OSGiTest { url("link:classpath:org.apache.woden.core.link"), url("link:classpath:org.apache.ws.xmlschema.core.link"), url("link:classpath:org.apache.felix.http.jetty.link"), +url("link:classpath:org.apache.felix.http.whiteboard.link"), url("link:classpath:org.apache.axis2.osgi.link"), provision(bundle() .add(Handler1.class) 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=1577348&r1=1577347&r2=1577348&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:12 2014 @@ -15,18 +15,20 @@ */ package org.apache.axis2.osgi.internal; +import java.util.Hashtable; + import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.osgi.OSGiAxisServlet; + import static org.apache.axis2.osgi.deployment.OSGiAxis2Constants.AXIS2_OSGi_ROOT_CONTEXT; + import org.apache.axis2.osgi.deployment.OSGiConfigurationContextFactory; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.*; -import org.osgi.service.http.HttpService; -import org.osgi.service.http.NamespaceException; import org.osgi.util.tracker.ServiceTracker; -import javax.servlet.ServletException; +import javax.servlet.Servlet; /** * Activator will set the necessar
svn commit: r1577347 - in /axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi: OSGiAxisServlet.java internal/Activator.java
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) {
svn commit: r1577346 - /axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java
Author: veithen Date: Thu Mar 13 22:18:01 2014 New Revision: 1577346 URL: http://svn.apache.org/r1577346 Log: Removed the hack for AXIS2-3710. It is reasonable to require code running with a new major Axis2 release to conform to the Java EE specs (i.e. to override the GenericServlet#init(ServletConfig) method in a correct way). Modified: axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java Modified: axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java?rev=1577346&r1=1577345&r2=1577346&view=diff == --- axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java (original) +++ axis/axis2/java/core/trunk/modules/transport/http/src/org/apache/axis2/transport/http/AxisServlet.java Thu Mar 13 22:18:01 2014 @@ -744,13 +744,9 @@ public class AxisServlet extends HttpSer msgContext.setProperty(MessageContext.TRANSPORT_HEADERS, getTransportHeaders(request)); msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST, request); msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETRESPONSE, response); -try { -ServletContext context = getServletContext(); -if(context != null) { -msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT, context); -} -} catch (Exception e){ -log.debug(e.getMessage(), e); +ServletContext context = getServletContext(); +if(context != null) { +msgContext.setProperty(HTTPConstants.MC_HTTP_SERVLETCONTEXT, context); } //setting the RequestResponseTransport object
svn commit: r1577345 - /axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/OSGiAxisServlet.java
Author: veithen Date: Thu Mar 13 22:17:56 2014 New Revision: 1577345 URL: http://svn.apache.org/r1577345 Log: Correctly override the AxisServlet init method to avoid the issue described in AXIS2-3710. Modified: axis/axis2/java/core/trunk/modules/osgi/src/org/apache/axis2/osgi/OSGiAxisServlet.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=1577345&r1=1577344&r2=1577345&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:17:56 2014 @@ -15,9 +15,9 @@ */ 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.apache.axis2.transport.http.ListingAgent; import org.osgi.framework.BundleContext; import org.osgi.framework.ServiceReference; @@ -42,19 +42,25 @@ public class OSGiAxisServlet extends Axi this.context = context; } - -public void init(ServletConfig servletConfig) throws ServletException { -this.servletConfig = servletConfig; +@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."); } -configContext = (ConfigurationContext) context.getService(reference); -axisConfiguration = configContext.getAxisConfiguration(); -agent = new ListingAgent(configContext); -initParams(); +return (ConfigurationContext) context.getService(reference); +} + +@Override +protected void initTransports() throws AxisFault { +// Not sure if this is correct, but the original OSGiAxisServlet code effectively skipped +// the invocation of the initTransports method. +} + +public void init(ServletConfig servletConfig) throws ServletException { +super.init(servletConfig); ServletContext servletContext = servletConfig.getServletContext(); if (servletContext != null) { servletContext.setAttribute(this.getClass().getName(), this);