You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by se...@apache.org on 2013/09/03 13:20:48 UTC
svn commit: r1519651 - in
/cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi:
pom.xml src/main/java/minimalosgi/SampleApplication.java
src/main/java/minimalosgi/SampleServlet.java
Author: sergeyb
Date: Tue Sep 3 11:20:48 2013
New Revision: 1519651
URL: http://svn.apache.org/r1519651
Log:
Fixing minimal_osgi demo
Modified:
cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/pom.xml
cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleApplication.java
cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleServlet.java
Modified: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/pom.xml?rev=1519651&r1=1519650&r2=1519651&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/pom.xml (original)
+++ cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/pom.xml Tue Sep 3 11:20:48 2013
@@ -32,76 +32,152 @@
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <equinox.version>3.7.0.v20110613</equinox.version>
</properties>
+
- <build>
- <!-- http://maven.apache.org/plugins/maven-dependency-plugin/ -->
- <!-- I'm using the dependency plugin to build a dependency list that would get placed in FileInstall's
- load folder; I couldn't get maven-assembly-plugin's dependencySet to work as I had desired -->
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-jar-plugin</artifactId>
- <version>2.3.1</version>
- <configuration>
- <archive>
- <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
- </archive>
- </configuration>
- </plugin>
- <plugin>
+ <dependencies>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.enterprise</artifactId>
+ <version>4.2.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.tycho</groupId>
+ <artifactId>org.eclipse.osgi</artifactId>
+ <version>${equinox.version}</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.osgi</groupId>
+ <artifactId>org.eclipse.osgi.services</artifactId>
+ <version>3.2.100.v20100503</version>
+ <scope>compile</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.fileinstall</artifactId>
+ <version>3.1.10</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>org.apache.felix.http.bundle</artifactId>
+ <version>2.2.0</version>
+ <scope>compile</scope> <!-- using compile instead of test so we don't need to import geronimo-servlet_3.0_spec -->
+ <exclusions>
+ <exclusion>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>servlet-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.servicemix.specs</groupId>
+ <artifactId>org.apache.servicemix.specs.jsr339-api-2.0</artifactId>
+ <version>2.3-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.cxf</groupId>
+ <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>javax.ws.rs</groupId>
+ <artifactId>javax.ws.rs-api</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>woodstox-core-asl</artifactId>
+ </exclusion>
+ <exclusion>
+ <groupId>org.codehaus.woodstox</groupId>
+ <artifactId>stax2-api</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-jar-plugin</artifactId>
+ <version>2.3.1</version>
+ <configuration>
+ <archive>
+ <manifestFile>src/main/resources/META-INF/MANIFEST.MF</manifestFile>
+ </archive>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.10</version>
<configuration>
<skipTests>true</skipTests>
</configuration>
- </plugin>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-dependency-plugin</artifactId>
- <version>2.2</version>
- <executions>
- <execution>
- <id>copy-dependencies</id>
- <phase>package</phase>
- <goals>
- <goal>copy-dependencies</goal>
- </goals>
- <configuration>
- <outputDirectory>${project.build.directory}/dependencies</outputDirectory>
- <excludeScope>provided</excludeScope>
- <excludeGroupIds>org.osgi,org.slf4j</excludeGroupIds>
- <excludeArtifactIds>geronimo-servlet_2.5_spec,org.eclipse.osgi,org.osgi.foundation</excludeArtifactIds>
- <overWriteReleases>false</overWriteReleases>
- <overWriteSnapshots>false</overWriteSnapshots>
- <overWriteIfNewer>true</overWriteIfNewer>
- </configuration>
- </execution>
- </executions>
- </plugin>
- <plugin>
- <!-- http://maven.apache.org/plugins/maven-assembly-plugin/howto.html -->
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-assembly-plugin</artifactId>
- <version>2.2.1</version>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <version>2.2</version>
+ <executions>
+ <execution>
+ <id>copy-dependencies</id>
+ <phase>package</phase>
+ <goals>
+ <goal>copy-dependencies</goal>
+ </goals>
<configuration>
- <descriptors>
- <descriptor>src/main/assembly/descriptor.xml</descriptor>
- </descriptors>
- <outputDirectory>target/delivery</outputDirectory>
- <workDirectory>target/assembly/work</workDirectory>
+ <outputDirectory>${project.build.directory}/dependencies</outputDirectory>
+ <excludeScope>provided</excludeScope>
+ <excludeGroupIds>org.slf4j</excludeGroupIds>
+ <excludeArtifactIds>geronimo-servlet_2.5_spec,org.eclipse.osgi,org.osgi.foundation</excludeArtifactIds>
+ <overWriteReleases>false</overWriteReleases>
+ <overWriteSnapshots>false</overWriteSnapshots>
+ <overWriteIfNewer>true</overWriteIfNewer>
</configuration>
- <executions>
- <execution>
- <id>make-assembly</id>
- <phase>package</phase>
- <goals>
- <goal>single</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <version>2.2.1</version>
+ <configuration>
+ <descriptors>
+ <descriptor>src/main/assembly/descriptor.xml</descriptor>
+ </descriptors>
+ <outputDirectory>target/delivery</outputDirectory>
+ <workDirectory>target/assembly/work</workDirectory>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
@@ -116,19 +192,19 @@
<executable>java</executable>
<arguments>
<!--
- <argument>-Xdebug</argument>
- <argument>-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044</argument>
- -->
+ <argument>-Xdebug</argument>
+ <argument>-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005</argument>
+ -->
<argument>-jar</argument>
- <argument>org.eclipse.osgi-3.6.2.R36x_v20110210.jar</argument>
+ <argument>org.eclipse.osgi-${equinox.version}.jar</argument>
<argument>-console</argument>
</arguments>
<workingDirectory>${project.build.directory}/delivery/${project.artifactId}-${project.version}-equinox/${project.artifactId}-${project.version}/</workingDirectory>
</configuration>
</plugin>
- </plugins>
- <pluginManagement>
- <plugins>
+ </plugins>
+ <pluginManagement>
+ <plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
@@ -160,256 +236,8 @@
</plugin>
</plugins>
</pluginManagement>
- </build>
-
- <dependencies>
-
- <!-- for OSGI ServiceTracker & ConfigurationAdmin (needed in CXF 2.5) -->
-
- <dependency>
- <groupId>org.eclipse.osgi</groupId>
- <artifactId>org.eclipse.osgi.services</artifactId>
- <version>3.2.100.v20100503</version>
- <scope>compile</scope>
- <exclusions>
- <exclusion>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- for CXF's JAX-RS implementation -->
-
- <dependency>
- <groupId>org.apache.cxf</groupId>
- <artifactId>cxf-bundle-jaxrs</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <!-- CXF's dependency tree includes JARs that are not OSGI bundles; we'll import the correct lines later -->
- <exclusion>
- <groupId>aopalliance</groupId>
- <artifactId>aopalliance</artifactId>
- </exclusion>
- <exclusion>
- <groupId>com.sun.xml.bind</groupId>
- <artifactId>jaxb-impl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javax.activation</groupId>
- <artifactId>activation</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javax.ws.rs</groupId>
- <artifactId>jsr311-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-activation_1.1_spec</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-annotation_1.0_spec</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-javamail_1.4_spec</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-servlet_3.0_spec</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-stax-api_1.0_spec</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.ws.xmlschema</groupId>
- <artifactId>xmlschema-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>woodstox-core-asl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>wstx-asl</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.codehaus.woodstox</groupId>
- <artifactId>stax2-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-continuation</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-http</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-io</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-security</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-server</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.eclipse.jetty</groupId>
- <artifactId>jetty-util</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-aop</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-asm</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-beans</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-context</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-core</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-expression</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.springframework</groupId>
- <artifactId>spring-web</artifactId>
- </exclusion>
- <exclusion>
- <groupId>stax</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>wsdl4j</groupId>
- <artifactId>wsdl4j</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- special OSGI friendly version of jsr311-api -->
-
- <dependency>
- <groupId>org.apache.servicemix.specs</groupId>
- <artifactId>org.apache.servicemix.specs.jsr311-api-1.1.1</artifactId>
- <version>1.9.0</version>
- <exclusions>
- <exclusion>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <!-- BEGIN Java 1.5 dependencies -->
- <!-- If you are using Java 1.6, you may comment out these dependencies -->
-
- <dependency>
- <groupId>org.apache.servicemix.specs</groupId>
- <artifactId>org.apache.servicemix.specs.activation-api-1.1</artifactId>
- <version>1.9.0</version>
- </dependency>
-
- <dependency>
- <groupId>org.apache.servicemix.specs</groupId>
- <artifactId>org.apache.servicemix.specs.jaxb-api-2.2</artifactId>
- <version>1.9.0</version>
- <exclusions>
- <exclusion>
- <groupId>javax.activation</groupId>
- <artifactId>activation</artifactId>
- </exclusion>
- <exclusion>
- <groupId>javax.xml.stream</groupId>
- <artifactId>stax-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.apache.geronimo.specs</groupId>
- <artifactId>geronimo-activation_1.1_spec</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- <dependency>
- <groupId>org.apache.servicemix.specs</groupId>
- <artifactId>org.apache.servicemix.specs.stax-api-1.0</artifactId>
- <version>1.9.0</version>
- </dependency>
-
- <!-- END Java 1.5 dependencies -->
-
- <!-- we're using FileInstall to automatically deploy our bundles -->
- <!-- see http://wiki.restlet.org/docs_2.0/13-restlet/24-restlet/238-restlet.html -->
-
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.fileinstall</artifactId>
- <version>3.1.10</version>
- <scope>provided</scope>
- </dependency>
-
- <!-- runtime dependencies for Eclipse Equinox OSGI container -->
-
- <dependency>
- <groupId>org.sonatype.tycho</groupId>
- <artifactId>org.eclipse.osgi</artifactId>
- <version>3.6.2.R36x_v20110210</version>
- <scope>provided</scope>
- </dependency>
-
- <!-- provide an implementation of the OSGI HttpService; I would use Equinox's but it's not in Maven Central :( -->
-
- <dependency>
- <groupId>org.apache.felix</groupId>
- <artifactId>org.apache.felix.http.bundle</artifactId>
- <version>2.2.0</version>
- <scope>compile</scope> <!-- using compile instead of test so we don't need to import geronimo-servlet_3.0_spec -->
- <exclusions>
- <exclusion>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.mortbay.jetty</groupId>
- <artifactId>servlet-api</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
- </dependencies>
+ </build>
- <!--
<repositories>
<repository>
<id>apache-snapshots</id>
@@ -420,6 +248,5 @@
</snapshots>
</repository>
</repositories>
- -->
- </project>
+</project>
Modified: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleApplication.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleApplication.java?rev=1519651&r1=1519650&r2=1519651&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleApplication.java (original)
+++ cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleApplication.java Tue Sep 3 11:20:48 2013
@@ -21,8 +21,10 @@ package minimalosgi;
import java.util.HashSet;
import java.util.Set;
+import javax.ws.rs.ApplicationPath;
import javax.ws.rs.core.Application;
+@ApplicationPath("/app")
public class SampleApplication extends Application {
@Override
public Set<Class<?>> getClasses() {
Modified: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleServlet.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleServlet.java?rev=1519651&r1=1519650&r2=1519651&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleServlet.java (original)
+++ cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleServlet.java Tue Sep 3 11:20:48 2013
@@ -19,25 +19,16 @@
package minimalosgi;
-import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
-
-import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
import org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet;
-import org.apache.cxf.jaxrs.utils.ResourceUtils;
public class SampleServlet extends CXFNonSpringJaxrsServlet {
private static final long serialVersionUID = -1531317723099896635L;
- protected void createServerFromApplication(String cName, ServletConfig servletConfig)
- throws ServletException {
- // technically, you should look up the application name from ServletConfig's init parameters
- // but creating the actual application object is slower via reflection than actually
- // instantiating it
- SampleApplication app = new SampleApplication();
- JAXRSServerFactoryBean bean = ResourceUtils.createApplication(app, true);
- bean.create();
+ @Override
+ protected Class<?> loadApplicationClass(String cName) throws ServletException {
+ return SampleApplication.class;
}
}