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 2011/12/30 11:44:21 UTC

svn commit: r1225793 - in /cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi: ./ src/ src/main/ src/main/assembly/ src/main/config/ src/main/java/ src/main/java/minimalosgi/ src/main/resources/ src/main/resources/META-INF/

Author: sergeyb
Date: Fri Dec 30 10:44:20 2011
New Revision: 1225793

URL: http://svn.apache.org/viewvc?rev=1225793&view=rev
Log:
[CXF-3859] JAX-RS Minimal OSGI demo, applying a patch on behalf of Ka-Lok Fung

Added:
    cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/
    cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/README   (with props)
    cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/pom.xml   (with props)
    cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/
    cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/
    cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/assembly/
    cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/assembly/descriptor.xml   (with props)
    cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/config/
    cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/config/config.ini
    cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/
    cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/
    cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/Activator.java   (with props)
    cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleApplication.java   (with props)
    cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleResource.java   (with props)
    cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleServlet.java   (with props)
    cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/resources/
    cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/resources/META-INF/
    cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/resources/META-INF/MANIFEST.MF

Added: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/README
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/README?rev=1225793&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/README (added)
+++ cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/README Fri Dec 30 10:44:20 2011
@@ -0,0 +1,118 @@
+Minimal OSGI Sample Documentation
+=================================
+
+Introduction
+-------------
+
+You may not know it but CXF actually has an OSGI bundle for JAX-RS. Unfortunately, documentation on how to use it is very hard to come by.
+This sample demonstrates the minimal amount of bundles necessary and code tweaks required to get a sample that uses CXF's JAX-RS
+implementation to work correctly in an OSGI environment.
+
+This is not necessarily the best way to achieve the above. In particular, use of CXF-specific syntax (as much as possible). However, I believe it's a
+good balance between code readability and simplicity.
+
+Introduction
+Pre-requisites
+Sample walkthrough
+ Code walkthrough
+ Deployment notes
+Running the sample
+Bundles
+
+Pre-requisites
+--------------
+
+To take advantage of this sample, you should have a working knowledge of the following:
+
+JSR-311 JAX-RS
+* Maven
+* OSGI
+* Servlet
+
+Sample walkthrough
+------------------
+
+Code walkthrough
+
+Let's start off with a basic JSR-311 JAX-RS application that you would like to deploy in an OSGI environment:
+* SampleResource
+* SampleApplication
+
+With this sample application, if you go to a URL that looks like the following, you should get a "My Sample Text" in the browser:
+	http://<host>:<port>/
+
+To get this application running in an OSGi environment, when the HTTP OSGI service starts up, CXFNonSpringJaxrsServlet needs to be
+registered. This is accomplished in the code found inside the Activator. We use ServiceTracker to take care of the hard work of monitoring
+when the HTTP OSGI service comes up and registering ourselves to it.
+
+The big gotcha here though is our application is in one bundle but CXF is contained within another bundle. Because OSGI creates one
+classloader for each bundle and CXF uses reflection to discover applications, this discovery won't work in an OSGI environment. To get around
+this limitation, we subclass CXFNonSpringJaxrsServlet with our own SampleServlet that refers directly to our SampleApplication
+class. With the necessary imports inside the MANIFEST.MF, OSGI will set up the correct bundle linkage at runtime and we won't get the dreaded
+ClassNotFound exception.
+
+Deployment notes
+
+By default, CXF's default OSGI bundle includes a whack of dependencies that aren't necessary to get the core JAX-RS running. This sample
+strips away all the fluff and only includes the necessary JARs. You can check the pom.xml accompanying this example to see many of the
+dependencies that have been excluded.
+
+To ease deployment in different OSGI environments, we take advantage of Apache Felix's File Install bundle to use a directory-based deployment
+structure.
+
+With a few tweaks here and there, you can configure this sample to run in different OSGI environments. By default, it works in Eclipse Equinox but
+it runs sufficiently well in Apache Felix as well.
+
+Running the sample
+------------------
+
+You can run it directly from maven using the following command
+	
+	mvn integration-test
+
+Note that when you run the sample this way, your input to the OSGI console will not echo. No worries, it'll still be processed!
+
+If you want to run it manually, do the following
+
+  1) mvn package
+  2) cd target/deliver/jax_rs_minimal_osgi-<version>-equinox/jax_rs_minimal_osgi-<version>/
+  3) java -jar org.eclipse.osgi-3.6.2.R36x_v20110210.jar
+
+If all goes well, the Eclipse Equinox environment will start up and File Install will install all the necessary bundles.
+
+If you visit the following URL in your favorite browser on the machine, you should find it returns some text from SampleApplication:
+
+	http://localhost:8080/
+
+Bundles
+-------
+
+If you're using Java 6, here is a listing of the bundles that are running inside Eclipse Equinox to make this example run successfully:
+
+id      State       Bundle
+0       ACTIVE      org.eclipse.osgi_3.6.2.R36x_v20110210                  ; OSGI system runtime
+1       ACTIVE      org.apache.felix.fileinstall_3.1.10                    ; Bundle deployment system - may be removed if you have some other way to deploy
+2       ACTIVE      org.codehaus.jettison.jettison_1.3.0                   ; CXF JAX-RS dependency for JSON
+3       ACTIVE      org.mortbay.jetty.util_6.1.24                          ; HTTP OSGI service dependency
+4       ACTIVE      org.apache.cxf.bundle-jaxrs_2.5.0.SNAPSHOT             ; CXF JAX-RS bundle
+5       ACTIVE      org.apache.neethi_3.0.1                                ; CXF JAX-RS dependency
+6       ACTIVE      org.eclipse.osgi.services_3.2.100.v20100503            ; CXF JAX-RS dependency / HTTP OSGI service dependency
+7       ACTIVE      org.apache.felix.http.whiteboard_2.2.0                 ; HTTP OSGI service dependency
+8       ACTIVE      org.mortbay.jetty.security_6.1.24                      ; HTTP OSGI service dependency
+9       ACTIVE      org.mortbay.jetty.server_6.1.24                        ; HTTP OSGI service dependency
+10      ACTIVE      org.apache.felix.http.bundle_2.2.0                     ; HTTP OSGI service dependency
+11      ACTIVE      org.apache.felix.http.base_2.2.0                       ; HTTP OSGI service dependency
+12      ACTIVE      org.apache.servicemix.specs.jsr311-api-1.1_1.8.0       ; CXF JAX-RS dependency
+13      ACTIVE      org.apache.felix.http.bridge_2.2.0                     ; HTTP OSGI service dependency
+14      ACTIVE      minimalosgi_0.0.0                                      ; Sample application
+15      ACTIVE      org.apache.felix.http.api_2.2.0                        ; HTTP OSGI service dependency
+16      ACTIVE      org.apache.felix.http.jetty_2.2.0                      ; HTTP OSGI service dependency
+
+If you're using Java 5, there's a few more bundles that are added to make things run successfully
+
+id      State       Bundle
+17      ACTIVE      org.apache.geronimo.specs.geronimo-activation_1.1_spec_1.1.0    ; CXF JAX-RS dependency
+18      ACTIVE      org.apache.servicemix.specs.stax-api-1.0_1.9.0                  ; CXF JAX-RS dependency
+19      ACTIVE      org.apache.servicemix.specs.activation-api-1.1_1.9.0            ; CXF JAX-RS dependency
+20      ACTIVE      org.apache.servicemix.specs.jaxb-api-2.2_1.9.0                  ; CXF JAX-RS dependency
+21      ACTIVE      org.apache.geronimo.specs.geronimo-annotation_1.0_spec_1.1.1    ; CXF JAX-RS dependency

Propchange: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/README
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/README
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: 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=1225793&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/pom.xml (added)
+++ cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/pom.xml Fri Dec 30 10:44:20 2011
@@ -0,0 +1,410 @@
+<!--
+  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>
+	<groupId>org.apache.cxf.samples</groupId>
+	<artifactId>jax_rs_minimal_osgi</artifactId>
+	<name>JAX-RS Minimal OSGI Demo</name>
+	<description>JAX-RS Minimal OSGI Demo</description>
+	<version>2.5.2-SNAPSHOT</version>
+
+	<parent>
+	    <groupId>org.apache.cxf.samples</groupId>
+	    <artifactId>cxf-samples</artifactId>
+	    <version>2.5.2-SNAPSHOT</version>
+	    <relativePath>../..</relativePath>
+	</parent>
+
+	<properties>
+		<cxf.version>${project.version}</cxf.version>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+	</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>
+        <artifactId>maven-compiler-plugin</artifactId>
+        <version>2.3.2</version>
+        <configuration>
+          <source>1.5</source>
+          <target>1.5</target>
+        </configuration>
+      </plugin>
+			<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>
+				<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>
+          <executions>
+              <execution>
+                  <phase>integration-test</phase>
+                  <goals>
+                      <goal>exec</goal>
+                  </goals>
+                  <configuration>
+                      <executable>java</executable>
+                      <arguments>
+                      	<!--
+												<argument>-Xdebug</argument>
+												<argument>-Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=1044</argument>
+												-->
+                      	<argument>-jar</argument>
+                      	<argument>org.eclipse.osgi-3.6.2.R36x_v20110210.jar</argument>
+                      	<argument>-console</argument>
+                      </arguments>
+                      <workingDirectory>${project.build.directory}/delivery/${project.artifactId}-${project.version}-equinox/${project.artifactId}-${project.version}/</workingDirectory>
+                  </configuration>
+              </execution>
+          </executions>
+      </plugin>
+		</plugins>
+	</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>${cxf.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.geronimo.specs</groupId>
+			<artifactId>geronimo-annotation_1.0_spec</artifactId>
+			<version>1.1.1</version>
+		</dependency>
+
+		<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>
+
+	<!--  
+  <repositories>
+    <repository>
+      <id>apache-snapshots</id>
+      <name>Apache SNAPSHOT Repository</name>
+      <url>http://repository.apache.org/snapshots</url>
+      <snapshots>
+      	<enabled>true</enabled>
+      </snapshots>
+    </repository>
+  </repositories>
+  -->
+
+ </project>

Propchange: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/assembly/descriptor.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/assembly/descriptor.xml?rev=1225793&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/assembly/descriptor.xml (added)
+++ cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/assembly/descriptor.xml Fri Dec 30 10:44:20 2011
@@ -0,0 +1,62 @@
+<!--
+/**
+ * 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.
+ */
+-->
+<assembly>
+  
+  <id>equinox</id>
+  
+  <formats>
+    <format>dir</format>
+  </formats>  
+  
+  <fileSets>
+  	<fileSet>
+  		<directory>${project.build.directory}</directory>
+  		<includes>
+				<include>*.jar</include>
+  		</includes>
+  		<outputDirectory>load</outputDirectory>
+  	</fileSet>
+		<!-- TODO: Instead of using fileSets, use dependencySets to populate load -->
+ 		<fileSet>
+			<directory>${project.build.directory}/dependencies</directory>
+			<outputDirectory>load</outputDirectory>
+		</fileSet>
+  	<fileSet>
+  		<directory>src/main/config</directory>
+  		<includes>
+  			<include>config.ini</include>
+  		</includes>
+  		<outputDirectory>configuration</outputDirectory>
+  	</fileSet>
+  </fileSets>  
+
+  <dependencySets>
+    <dependencySet>
+      <outputDirectory></outputDirectory>
+      <scope>provided</scope>
+      <excludes>
+      	<exclude>org.apache.cxf.samples:jax_rs_minimal_osgi</exclude>
+      </excludes>
+      <useTransitiveDependencies>false</useTransitiveDependencies>
+    </dependencySet>
+  </dependencySets>
+  
+</assembly>
\ No newline at end of file

Propchange: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/assembly/descriptor.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/assembly/descriptor.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/assembly/descriptor.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/config/config.ini
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/config/config.ini?rev=1225793&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/config/config.ini (added)
+++ cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/config/config.ini Fri Dec 30 10:44:20 2011
@@ -0,0 +1,22 @@
+# 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.
+
+# http://wiki.restlet.org/docs_2.0/13-restlet/24-restlet/238-restlet.html
+osgi.bundles=org.apache.felix.fileinstall-3.1.10.jar@start 
+osgi.clean=true
+eclipse.ignoreApp=true
+

Added: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/Activator.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/Activator.java?rev=1225793&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/Activator.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/Activator.java Fri Dec 30 10:44:20 2011
@@ -0,0 +1,83 @@
+/**
+ * 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 minimalosgi;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.http.HttpService;
+import org.osgi.util.tracker.ServiceTracker;
+import org.osgi.util.tracker.ServiceTrackerCustomizer;
+
+import java.util.Hashtable;
+
+public class Activator implements BundleActivator {
+
+    private final String _path = "/";
+    private BundleContext _context;
+    private ServiceTracker _tracker;
+
+    public void start(BundleContext context) throws Exception {
+
+        _context = context;
+
+        // Use _tracker to capture when a HttpService comes and goes.
+        //
+        // When this bundle is started, a HttpService may not be alive. Thus, we use
+        // ServiceTracker to automatically monitor when a HttpService comes alive and
+        // then register this our CXF-based JAX-RS service with it.
+        //
+        _tracker = new ServiceTracker(
+            _context,
+            HttpService.class.getName(),
+            new ServiceTrackerCustomizer() {
+                public Object addingService(ServiceReference serviceReference) {
+                    try {
+                        HttpService service = (HttpService)_context.getService(serviceReference);
+                        Hashtable<String, String> initParams = new Hashtable<String, String>();
+                        initParams.put("javax.ws.rs.Application", SampleApplication.class.getName());
+                        service.registerServlet(_path, new SampleServlet(), initParams, null);
+                        return service;
+                    } catch (Exception ex) {
+                        ex.printStackTrace();
+                        throw new RuntimeException(ex);
+                    }
+                }
+
+                public void modifiedService(ServiceReference serviceReference, Object o) {
+                    // do nothing
+                }
+
+                public void removedService(ServiceReference serviceReference, Object o) {
+                    HttpService service = (HttpService)_context.getService(serviceReference);
+                    if (service != null)
+                        service.unregister(_path);
+                }
+            }
+        );
+        _tracker.open();
+
+    }
+
+    public void stop(BundleContext bundleContext) throws Exception {
+        _tracker.remove(_tracker.getServiceReference());
+    }
+
+}

Propchange: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/Activator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/Activator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 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=1225793&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleApplication.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleApplication.java Fri Dec 30 10:44:20 2011
@@ -0,0 +1,33 @@
+/**
+ * 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 minimalosgi;
+
+import javax.ws.rs.core.Application;
+import java.util.HashSet;
+import java.util.Set;
+
+public class SampleApplication extends Application {
+    @Override
+    public Set<Class<?>> getClasses() {
+        HashSet<Class<?>> s = new HashSet<Class<?>>();
+        s.add(SampleResource.class);
+        return s;
+    }
+}

Propchange: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleApplication.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleApplication.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleResource.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleResource.java?rev=1225793&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleResource.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleResource.java Fri Dec 30 10:44:20 2011
@@ -0,0 +1,36 @@
+/**
+ * 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 minimalosgi;
+
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.MediaType;
+
+public class SampleResource {
+
+    @GET
+    @Path("/")
+    @Produces(MediaType.TEXT_PLAIN)
+    public String getSampleText() {
+        return "My Sample Text";
+    }
+
+}

Propchange: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleResource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleResource.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 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=1225793&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleServlet.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleServlet.java Fri Dec 30 10:44:20 2011
@@ -0,0 +1,40 @@
+/**
+ * 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 minimalosgi;
+
+import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet;
+import org.apache.cxf.jaxrs.utils.ResourceUtils;
+
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+
+public class SampleServlet extends CXFNonSpringJaxrsServlet {
+
+    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();
+    }
+
+}

Propchange: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleServlet.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/java/minimalosgi/SampleServlet.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/resources/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/resources/META-INF/MANIFEST.MF?rev=1225793&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/resources/META-INF/MANIFEST.MF (added)
+++ cxf/trunk/distribution/src/main/release/samples/jax_rs/minimal_osgi/src/main/resources/META-INF/MANIFEST.MF Fri Dec 30 10:44:20 2011
@@ -0,0 +1,31 @@
+Manifest-Version: 1.0
+Bundle-Activator: minimalosgi.Activator
+Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
+Bundle-Name: minimalosgi
+Bundle-SymbolicName: minimalosgi
+Import-Package: javax.activation,
+ javax.annotation,
+ javax.management,
+ javax.naming,
+ javax.servlet,
+ javax.servlet.http,
+ javax.xml.bind,
+ javax.xml.bind.attachment,
+ javax.xml.namespace,
+ javax.xml.parsers,
+ javax.xml.stream,
+ javax.xml.transform,
+ javax.xml.validation,
+ javax.ws.rs,
+ javax.ws.rs.core,
+ org.apache.cxf.jaxrs,
+ org.apache.cxf.jaxrs.servlet,
+ org.apache.cxf.jaxrs.utils,
+ org.apache.cxf.message,
+ org.osgi.framework,
+ org.osgi.service.http,
+ org.osgi.util.tracker,
+ org.w3c.dom,
+ org.w3c.dom.ls
+
+