You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by lr...@apache.org on 2013/09/01 14:03:36 UTC

svn commit: r1519261 - in /tuscany/sandbox/lresende/sca-2.x/samples/helloworld-spring: ./ pom.xml src/main/java/sample/Helloworld.java src/main/resources/helloworld.composite

Author: lresende
Date: Sun Sep  1 12:03:36 2013
New Revision: 1519261

URL: http://svn.apache.org/r1519261
Log:
Spring sample using REST Binding

Added:
    tuscany/sandbox/lresende/sca-2.x/samples/helloworld-spring/
      - copied from r1519259, tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-spring/
Modified:
    tuscany/sandbox/lresende/sca-2.x/samples/helloworld-spring/pom.xml
    tuscany/sandbox/lresende/sca-2.x/samples/helloworld-spring/src/main/java/sample/Helloworld.java
    tuscany/sandbox/lresende/sca-2.x/samples/helloworld-spring/src/main/resources/helloworld.composite

Modified: tuscany/sandbox/lresende/sca-2.x/samples/helloworld-spring/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sandbox/lresende/sca-2.x/samples/helloworld-spring/pom.xml?rev=1519261&r1=1519259&r2=1519261&view=diff
==============================================================================
--- tuscany/sandbox/lresende/sca-2.x/samples/helloworld-spring/pom.xml (original)
+++ tuscany/sandbox/lresende/sca-2.x/samples/helloworld-spring/pom.xml Sun Sep  1 12:03:36 2013
@@ -18,89 +18,128 @@
  * 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>
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
 
-   <parent>
-      <groupId>org.apache.tuscany.sca.samples</groupId>
-      <artifactId>tuscany-samples</artifactId>
-      <version>2.5-SNAPSHOT</version>
-      <relativePath />
-   </parent>
-   <artifactId>helloworld-spring</artifactId>
-   <version>2.5-SNAPSHOT</version>
-
-   <name>Apache Tuscany SCA Samples Helloworld Spring</name>
-
-   <properties>
-      <tuscany.version>${project.version}</tuscany.version>
-   </properties>
-
-   <!-- ASF repositories so sample can be built from SVN without building trunk-->
-   <repositories><repository>
-       <id>apache.snapshots</id>
-       <name>Apache Snapshot Repository</name>
-       <url>http://repository.apache.org/snapshots</url>
-       <releases><enabled>false</enabled></releases>
-   </repository></repositories>
-   <pluginRepositories><pluginRepository>
-       <id>apache.snapshots</id>
-       <name>Apache Snapshot Repository</name>
-       <url>http://repository.apache.org/snapshots</url>
-       <releases><enabled>false</enabled></releases>
-   </pluginRepository></pluginRepositories>
-
-   <dependencies>
-
-      <dependency>
-         <groupId>org.apache.tuscany.sca</groupId>
-         <artifactId>tuscany-sca-api</artifactId>
-         <version>${tuscany.version}</version>
-         <scope>provided</scope>
-      </dependency>
-
-      <dependency>
-         <groupId>junit</groupId>
-         <artifactId>junit</artifactId>
-         <version>4.8.1</version>
-         <scope>test</scope>
-      </dependency>
-
-      <dependency>
-         <groupId>org.apache.tuscany.sca</groupId>
-         <artifactId>tuscany-base-runtime</artifactId>
-         <version>${tuscany.version}</version>
-         <scope>test</scope>
-      </dependency>
-
-      <dependency>
-         <groupId>org.apache.tuscany.sca</groupId>
-         <artifactId>tuscany-implementation-spring-runtime</artifactId>
-         <version>${tuscany.version}</version>
-         <scope>test</scope>
-      </dependency>
-
-   </dependencies>
-
-   <build>
-
-      <plugins>
-
-         <!-- to support running the composite with mvn tuscany:run -->
-         <plugin>
-            <groupId>org.apache.tuscany.sca</groupId>
-            <artifactId>tuscany-maven-plugin</artifactId>
-            <version>${tuscany.version}</version>
-            <dependencies>
-               <dependency>
-                  <groupId>org.apache.tuscany.sca</groupId>
-                  <artifactId>tuscany-implementation-spring-runtime</artifactId>
-                  <version>${tuscany.version}</version>
-               </dependency>
-            </dependencies>
-         </plugin>
-      </plugins>
+	<parent>
+		<groupId>org.apache.tuscany.sca.samples</groupId>
+		<artifactId>tuscany-samples</artifactId>
+		<version>2.5-SNAPSHOT</version>
+		<relativePath />
+	</parent>
+	<artifactId>helloworld-spring</artifactId>
+	<version>2.5-SNAPSHOT</version>
+
+	<name>Apache Tuscany SCA Samples Helloworld Spring</name>
+
+	<properties>
+		<tuscany.version>${project.version}</tuscany.version>
+	</properties>
+
+	<!-- ASF repositories so sample can be built from SVN without building trunk -->
+	<repositories>
+		<repository>
+			<id>apache.snapshots</id>
+			<name>Apache Snapshot Repository</name>
+			<url>http://repository.apache.org/snapshots</url>
+			<releases>
+				<enabled>false</enabled>
+			</releases>
+		</repository>
+	</repositories>
+	<pluginRepositories>
+		<pluginRepository>
+			<id>apache.snapshots</id>
+			<name>Apache Snapshot Repository</name>
+			<url>http://repository.apache.org/snapshots</url>
+			<releases>
+				<enabled>false</enabled>
+			</releases>
+		</pluginRepository>
+	</pluginRepositories>
+
+	<dependencies>
+
+		<dependency>
+			<groupId>org.apache.tuscany.sca</groupId>
+			<artifactId>tuscany-sca-api</artifactId>
+			<version>${tuscany.version}</version>
+			<scope>provided</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.tuscany.sca</groupId>
+			<artifactId>tuscany-base-runtime</artifactId>
+			<version>${tuscany.version}</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.tuscany.sca</groupId>
+			<artifactId>tuscany-implementation-spring-runtime</artifactId>
+			<version>${tuscany.version}</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.tuscany.sca</groupId>
+			<artifactId>tuscany-binding-rest-runtime</artifactId>
+			<version>${tuscany.version}</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.tuscany.sca</groupId>
+			<artifactId>tuscany-host-jetty</artifactId>
+			<version>2.5-SNAPSHOT</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>4.8.1</version>
+			<scope>test</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>httpunit</groupId>
+			<artifactId>httpunit</artifactId>
+			<version>1.7</version>
+			<scope>test</scope>
+		</dependency>
+
+	</dependencies>
+
+	<build>
+
+		<plugins>
+
+			<!-- to support running the composite with mvn tuscany:run -->
+			<plugin>
+				<groupId>org.apache.tuscany.sca</groupId>
+				<artifactId>tuscany-maven-plugin</artifactId>
+				<version>${tuscany.version}</version>
+				<dependencies>
+					<dependency>
+						<groupId>org.apache.tuscany.sca</groupId>
+						<artifactId>tuscany-implementation-spring-runtime</artifactId>
+						<version>${tuscany.version}</version>
+					</dependency>
+					<dependency>
+						<groupId>org.apache.tuscany.sca</groupId>
+						<artifactId>tuscany-binding-rest-runtime</artifactId>
+						<version>${tuscany.version}</version>
+					</dependency>
+					<dependency>
+						<groupId>org.apache.tuscany.sca</groupId>
+						<artifactId>tuscany-host-jetty</artifactId>
+						<version>2.5-SNAPSHOT</version>
+					</dependency>
+				</dependencies>
+			</plugin>
+		</plugins>
 
-   </build>
+	</build>
 
 </project>

Modified: tuscany/sandbox/lresende/sca-2.x/samples/helloworld-spring/src/main/java/sample/Helloworld.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/lresende/sca-2.x/samples/helloworld-spring/src/main/java/sample/Helloworld.java?rev=1519261&r1=1519259&r2=1519261&view=diff
==============================================================================
--- tuscany/sandbox/lresende/sca-2.x/samples/helloworld-spring/src/main/java/sample/Helloworld.java (original)
+++ tuscany/sandbox/lresende/sca-2.x/samples/helloworld-spring/src/main/java/sample/Helloworld.java Sun Sep  1 12:03:36 2013
@@ -18,11 +18,20 @@
  */
 package sample;
 
+import javax.ws.rs.Consumes;
+import javax.ws.rs.GET;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.MediaType;
+
 import org.oasisopen.sca.annotation.Remotable;
 
 @Remotable
 public interface Helloworld {
 
-    String sayHello(String name);
+    @GET
+    @Consumes(MediaType.WILDCARD)
+    @Produces(MediaType.TEXT_PLAIN)
+    String sayHello(@QueryParam("name") String name);
 
 }

Modified: tuscany/sandbox/lresende/sca-2.x/samples/helloworld-spring/src/main/resources/helloworld.composite
URL: http://svn.apache.org/viewvc/tuscany/sandbox/lresende/sca-2.x/samples/helloworld-spring/src/main/resources/helloworld.composite?rev=1519261&r1=1519259&r2=1519261&view=diff
==============================================================================
--- tuscany/sandbox/lresende/sca-2.x/samples/helloworld-spring/src/main/resources/helloworld.composite (original)
+++ tuscany/sandbox/lresende/sca-2.x/samples/helloworld-spring/src/main/resources/helloworld.composite Sun Sep  1 12:03:36 2013
@@ -24,6 +24,9 @@
 
     <component name="HelloworldComponent">
        <implementation.spring location="helloworld-context.xml"/>
+       <service name="HelloworldService">
+       	<tuscany:binding.rest uri="http://localhost:8085/hello" />
+       </service>
     </component>
 
 </composite>