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 2006/10/10 11:33:40 UTC

svn commit: r454670 - in /incubator/tuscany/sandbox/ant/sample.php: ./ src/ src/main/ src/main/java/ src/main/java/helloworld/ src/main/resources/ src/main/resources/META-INF/ src/main/resources/META-INF/sca/ src/test/ src/test/java/ src/test/java/hell...

Author: antelder
Date: Tue Oct 10 02:33:39 2006
New Revision: 454670

URL: http://svn.apache.org/viewvc?view=rev&rev=454670
Log:
Left this out with the previous jsr223 commit - add the sample

Added:
    incubator/tuscany/sandbox/ant/sample.php/   (with props)
    incubator/tuscany/sandbox/ant/sample.php/pom.xml
    incubator/tuscany/sandbox/ant/sample.php/src/   (with props)
    incubator/tuscany/sandbox/ant/sample.php/src/main/   (with props)
    incubator/tuscany/sandbox/ant/sample.php/src/main/java/   (with props)
    incubator/tuscany/sandbox/ant/sample.php/src/main/java/helloworld/   (with props)
    incubator/tuscany/sandbox/ant/sample.php/src/main/java/helloworld/HelloWorldClient.java
    incubator/tuscany/sandbox/ant/sample.php/src/main/java/helloworld/HelloWorldService.java
    incubator/tuscany/sandbox/ant/sample.php/src/main/resources/   (with props)
    incubator/tuscany/sandbox/ant/sample.php/src/main/resources/HelloWorld.componentType
    incubator/tuscany/sandbox/ant/sample.php/src/main/resources/HelloWorld.php
    incubator/tuscany/sandbox/ant/sample.php/src/main/resources/META-INF/   (with props)
    incubator/tuscany/sandbox/ant/sample.php/src/main/resources/META-INF/sca/   (with props)
    incubator/tuscany/sandbox/ant/sample.php/src/main/resources/META-INF/sca/default.scdl
    incubator/tuscany/sandbox/ant/sample.php/src/test/   (with props)
    incubator/tuscany/sandbox/ant/sample.php/src/test/java/   (with props)
    incubator/tuscany/sandbox/ant/sample.php/src/test/java/helloworld/   (with props)
    incubator/tuscany/sandbox/ant/sample.php/src/test/java/helloworld/HelloWorldTestCase.java
    incubator/tuscany/sandbox/ant/sample.php/src/test/resources/   (with props)

Propchange: incubator/tuscany/sandbox/ant/sample.php/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 10 02:33:39 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Added: incubator/tuscany/sandbox/ant/sample.php/pom.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/ant/sample.php/pom.xml?view=auto&rev=454670
==============================================================================
--- incubator/tuscany/sandbox/ant/sample.php/pom.xml (added)
+++ incubator/tuscany/sandbox/ant/sample.php/pom.xml Tue Oct 10 02:33:39 2006
@@ -0,0 +1,74 @@
+<?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.    
+-->
+<project>
+
+    <parent>
+        <groupId>org.apache.tuscany.samples.sca</groupId>
+        <artifactId>parent</artifactId>
+        <version>1.0-incubator-M2-SNAPSHOT</version>
+    </parent>
+
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>sample-php-helloworld</artifactId>
+    <packaging>jar</packaging>
+    <name>Tuscany helloworld Sample using PHP</name>
+    <description>A helloworld sample using a single SCA PHP component</description>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.osoa</groupId>
+            <artifactId>sca-api-r0.95</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tuscany.sca.services.containers</groupId>
+            <artifactId>container-jsr223</artifactId>
+            <version>1.0-incubator-M2-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency> <!-- Strangely, the JSR223 PHP engine has a dependency on the servlet API -->
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+            <version>2.3</version>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>test</artifactId>
+            <version>1.0-incubator-M2-SNAPSHOT</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                <configuration>
+                    <archive>
+                        <manifest>
+                            <mainClass>helloworld.HelloWorldClient</mainClass>
+                        </manifest>
+                    </archive>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Propchange: incubator/tuscany/sandbox/ant/sample.php/src/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 10 02:33:39 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Propchange: incubator/tuscany/sandbox/ant/sample.php/src/main/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 10 02:33:39 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Propchange: incubator/tuscany/sandbox/ant/sample.php/src/main/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 10 02:33:39 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Propchange: incubator/tuscany/sandbox/ant/sample.php/src/main/java/helloworld/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 10 02:33:39 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Added: incubator/tuscany/sandbox/ant/sample.php/src/main/java/helloworld/HelloWorldClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/ant/sample.php/src/main/java/helloworld/HelloWorldClient.java?view=auto&rev=454670
==============================================================================
--- incubator/tuscany/sandbox/ant/sample.php/src/main/java/helloworld/HelloWorldClient.java (added)
+++ incubator/tuscany/sandbox/ant/sample.php/src/main/java/helloworld/HelloWorldClient.java Tue Oct 10 02:33:39 2006
@@ -0,0 +1,35 @@
+/*
+ * 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 helloworld;
+
+import org.osoa.sca.CurrentCompositeContext;
+
+/**
+ * This client program shows how to create an SCA runtime, start it, locate the HelloWorld service and invoke it.
+ */
+public class HelloWorldClient {
+    public static void main(String[] args) throws Exception {
+
+        HelloWorldService helloWorldService = CurrentCompositeContext.getContext().
+            locateService(HelloWorldService.class, "HelloWorldComponent");
+
+        System.out.println(helloWorldService.sayHello(args.length < 1 ? "world" : args[0]));
+
+    }
+}

Added: incubator/tuscany/sandbox/ant/sample.php/src/main/java/helloworld/HelloWorldService.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/ant/sample.php/src/main/java/helloworld/HelloWorldService.java?view=auto&rev=454670
==============================================================================
--- incubator/tuscany/sandbox/ant/sample.php/src/main/java/helloworld/HelloWorldService.java (added)
+++ incubator/tuscany/sandbox/ant/sample.php/src/main/java/helloworld/HelloWorldService.java Tue Oct 10 02:33:39 2006
@@ -0,0 +1,25 @@
+/*
+ * 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 helloworld;
+
+public interface HelloWorldService {
+
+	String sayHello(String s);
+
+}

Propchange: incubator/tuscany/sandbox/ant/sample.php/src/main/resources/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 10 02:33:39 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Added: incubator/tuscany/sandbox/ant/sample.php/src/main/resources/HelloWorld.componentType
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/ant/sample.php/src/main/resources/HelloWorld.componentType?view=auto&rev=454670
==============================================================================
--- incubator/tuscany/sandbox/ant/sample.php/src/main/resources/HelloWorld.componentType (added)
+++ incubator/tuscany/sandbox/ant/sample.php/src/main/resources/HelloWorld.componentType Tue Oct 10 02:33:39 2006
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="ASCII"?>
+
+<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+
+    <service name="HelloWorldService">
+        <interface.java interface="helloworld.HelloWorldService"/>
+    </service>
+
+</componentType>

Added: incubator/tuscany/sandbox/ant/sample.php/src/main/resources/HelloWorld.php
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/ant/sample.php/src/main/resources/HelloWorld.php?view=auto&rev=454670
==============================================================================
--- incubator/tuscany/sandbox/ant/sample.php/src/main/resources/HelloWorld.php (added)
+++ incubator/tuscany/sandbox/ant/sample.php/src/main/resources/HelloWorld.php Tue Oct 10 02:33:39 2006
@@ -0,0 +1,7 @@
+<?
+
+function sayHello($value) {
+	return "Hello " . $value;
+}
+
+?>

Propchange: incubator/tuscany/sandbox/ant/sample.php/src/main/resources/META-INF/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 10 02:33:39 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Propchange: incubator/tuscany/sandbox/ant/sample.php/src/main/resources/META-INF/sca/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 10 02:33:39 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Added: incubator/tuscany/sandbox/ant/sample.php/src/main/resources/META-INF/sca/default.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/ant/sample.php/src/main/resources/META-INF/sca/default.scdl?view=auto&rev=454670
==============================================================================
--- incubator/tuscany/sandbox/ant/sample.php/src/main/resources/META-INF/sca/default.scdl (added)
+++ incubator/tuscany/sandbox/ant/sample.php/src/main/resources/META-INF/sca/default.scdl Tue Oct 10 02:33:39 2006
@@ -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.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0"
+    name="HelloWorldComposite">
+
+   <component name="HelloWorldComponent">
+      <implementation.script script="HelloWorld.php"/>
+    </component>
+
+</composite>

Propchange: incubator/tuscany/sandbox/ant/sample.php/src/test/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 10 02:33:39 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Propchange: incubator/tuscany/sandbox/ant/sample.php/src/test/java/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 10 02:33:39 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Propchange: incubator/tuscany/sandbox/ant/sample.php/src/test/java/helloworld/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 10 02:33:39 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+

Added: incubator/tuscany/sandbox/ant/sample.php/src/test/java/helloworld/HelloWorldTestCase.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/ant/sample.php/src/test/java/helloworld/HelloWorldTestCase.java?view=auto&rev=454670
==============================================================================
--- incubator/tuscany/sandbox/ant/sample.php/src/test/java/helloworld/HelloWorldTestCase.java (added)
+++ incubator/tuscany/sandbox/ant/sample.php/src/test/java/helloworld/HelloWorldTestCase.java Tue Oct 10 02:33:39 2006
@@ -0,0 +1,56 @@
+/*
+ * 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 helloworld;
+
+import java.io.FileReader;
+import java.net.URL;
+
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineManager;
+
+import org.apache.tuscany.test.SCATestCase;
+import org.osoa.sca.CompositeContext;
+import org.osoa.sca.CurrentCompositeContext;
+
+/**
+ * This shows how to test the HelloWorld service component.
+ */
+public class HelloWorldTestCase extends SCATestCase {
+
+    private CompositeContext context;
+
+    protected void setUp() throws Exception {
+        URL scdl = getClass().getClassLoader().getResource("META-INF/sca/script.system.scdl");
+        addExtension("ScriptContainer", scdl);
+        setApplicationSCDL(HelloWorldClient.class, "META-INF/sca/default.scdl");
+        super.setUp();
+
+        context = CurrentCompositeContext.getContext();
+    }
+
+    protected void tearDown() throws Exception {
+    }
+
+    public void testHelloWorld() throws Exception {
+
+        HelloWorldService helloWorldService = context.locateService(HelloWorldService.class, "HelloWorldComponent");
+        assertEquals(helloWorldService.sayHello("petra"), "Hello petra");
+    }
+
+}

Propchange: incubator/tuscany/sandbox/ant/sample.php/src/test/resources/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Tue Oct 10 02:33:39 2006
@@ -0,0 +1,14 @@
+target
+*.iws
+*.ipr
+*.iml
+.project
+.classpath
+maven.log
+velocity.log*
+junit*.properties
+surefire*.properties
+.settings
+.deployables
+.wtpmodules
+



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org