You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by an...@apache.org on 2011/04/19 15:26:15 UTC

svn commit: r1095081 - in /tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-spring: ./ README pom.xml src/main/resources/helloworld-context.xml src/main/resources/helloworld.composite

Author: antelder
Date: Tue Apr 19 13:26:15 2011
New Revision: 1095081

URL: http://svn.apache.org/viewvc?rev=1095081&view=rev
Log:
Add a Spring version of the helloworld sample

Added:
    tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-spring/
      - copied from r1094917, tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld/
    tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-spring/src/main/resources/helloworld-context.xml
Modified:
    tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-spring/README
    tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-spring/pom.xml
    tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-spring/src/main/resources/helloworld.composite

Modified: tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-spring/README
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-spring/README?rev=1095081&r1=1094917&r2=1095081&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-spring/README (original)
+++ tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-spring/README Tue Apr 19 13:26:15 2011
@@ -1,43 +1,18 @@
-Tuscany - Getting Started - Helloworld Sample
----------------------------------------------
+Tuscany - Getting Started - Helloworld Spring Sample
+----------------------------------------------------
 
-This sample demonstrates a simple helloworld style SCA application and how to run that with Tuscany.
+This sample is an alternative version of the helloworld sample which uses the Spring Framework instead of an SCA Java component.
 
-See the README in the top-level samples folder for general information on the Tuscany samples.
+The changes to the helloworld sample are:
+- update the pom.xml with the additional Spring dependencies
+- add a Spring context xml file
+- update the composite to use <implementation.spring>
 
-This project creates an SCA contribution with a deployable composite named helloworld.composite.
-The composite defines an SCA component, HelloworldComponent, which provides a Helloworld service, 
-the component is implemented by a Java class. 
-
-You can use the contribution by starting the composite in the Tuscany Shell. To do that run the 
-following command in the helloworld folder:
+As with all the getting-started samples you can run this sample with:
 
    mvn tuscany:run 
 
-Alternatively, the Tuscany Shell can be started with the scripts in the Tuscany binary distribution 
-bin folder. To do that run the following command at the root of a Tuscany binary distribution:
-
-   bin\tuscany.bat samples\getting-started\helloworld
-
-Once the Shell has been started with one of those methods you can use Shell commands to explore
-the SCA domain, for example, use the "installed" command to get the status of installed contributions, 
-"services" to see the available component services, and you may test calling the helloworld service by 
-using the "invoke" command:
+And then as with the original helloworld sample you may test the service by using the Shell "invoke" command:
 
    invoke HelloworldComponent sayHello yourName
 
----
- 
-This sample was created by the Tuscany contribution-jar Maven archetype. You can use that archetype to 
-create your own SCA contribution projects by running the following Maven command:
-
-   mvn archetype:generate -DarchetypeCatalog=http://tuscany.apache.org
-
-then at the prompt select 1 to choose the contribution-jar archetype and then answer the questions. 
-This project used the following answers:
-
-   Define value for property 'groupId': : org.apache.tuscany.sca.samples
-   Define value for property 'artifactId': : helloworld-contribution
-   Define value for property 'version': 1.0-SNAPSHOT: 2.0-SNAPSHOT
-   Define value for property 'package': org.apache.tuscany.sca.samples: sample  
-

Modified: tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-spring/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-spring/pom.xml?rev=1095081&r1=1094917&r2=1095081&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-spring/pom.xml (original)
+++ tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-spring/pom.xml Tue Apr 19 13:26:15 2011
@@ -27,10 +27,10 @@
       <version>2.0-SNAPSHOT</version>
       <relativePath>../../pom.xml</relativePath>
    </parent>
-   <artifactId>helloworld</artifactId>
+   <artifactId>helloworld-spring</artifactId>
    <version>2.0-SNAPSHOT</version>
 
-   <name>Apache Tuscany SCA Samples Helloworld</name>
+   <name>Apache Tuscany SCA Samples Helloworld Spring</name>
 
    <properties>
       <tuscany.version>${project.version}</tuscany.version>
@@ -59,6 +59,13 @@
          <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>
@@ -70,6 +77,13 @@
             <groupId>org.apache.tuscany.maven.plugins</groupId>
             <artifactId>maven-tuscany-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>
 

Added: tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-spring/src/main/resources/helloworld-context.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-spring/src/main/resources/helloworld-context.xml?rev=1095081&view=auto
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-spring/src/main/resources/helloworld-context.xml (added)
+++ tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-spring/src/main/resources/helloworld-context.xml Tue Apr 19 13:26:15 2011
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    * 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.    
+-->
+<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca-j/spring/200810" xsi:schemaLocation="        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd        http://www.springframework.org/schema/sca http://www.osoa.org/xmlns/sca/1.0/spring-sca.xsd">
+
+    <sca:service name="HelloworldService" target="HelloworldBean"/>
+
+    <bean id="HelloworldBean" class="sample.HelloworldImpl">
+    </bean>
+
+</beans>
\ No newline at end of file

Modified: tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-spring/src/main/resources/helloworld.composite
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-spring/src/main/resources/helloworld.composite?rev=1095081&r1=1094917&r2=1095081&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-spring/src/main/resources/helloworld.composite (original)
+++ tuscany/sca-java-2.x/trunk/samples/getting-started/helloworld-spring/src/main/resources/helloworld.composite Tue Apr 19 13:26:15 2011
@@ -23,7 +23,7 @@
            name="helloworld-contribution">
 
     <component name="HelloworldComponent">
-        <implementation.java class="sample.HelloworldImpl"/>
+       <implementation.spring location="helloworld-context.xml"/>
     </component>
 
 </composite>