tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lrese...@apache.org
Subject svn commit: r1186454 - in /tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc: ./ src/ src/main/ src/main/java/ src/main/java/launch/ src/main/java/services/ src/main/resources/ src/main/resources/uiservices/
Date Wed, 19 Oct 2011 20:24:45 GMT
Author: lresende
Date: Wed Oct 19 20:24:43 2011
New Revision: 1186454

URL: http://svn.apache.org/viewvc?rev=1186454&view=rev
Log:
Person service example

Added:
    tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/
    tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/pom.xml   (with props)
    tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/
    tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/
    tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/
    tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/launch/
    tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/launch/Launch.java
  (with props)
    tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/
    tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/Person.java
  (with props)
    tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/PersonService.java
  (with props)
    tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/PersonServiceImpl.java
  (with props)
    tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/resources/
    tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/resources/person.composite
  (with props)
    tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/resources/uiservices/
    tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/resources/uiservices/widget.html
  (with props)

Added: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/pom.xml
URL: http://svn.apache.org/viewvc/tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/pom.xml?rev=1186454&view=auto
==============================================================================
--- tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/pom.xml (added)
+++ tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/pom.xml Wed Oct 19 20:24:43 2011
@@ -0,0 +1,110 @@
+<?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>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.tuscany.sca</groupId>
+        <artifactId>tuscany-sca</artifactId>
+        <version>2.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+    <artifactId>sample-person-jsonrpc</artifactId>
+    <name>Apache Tuscany SCA Sample Getting Started Online Store</name>
+
+	<dependencies>
+		<dependency>
+			<groupId>org.apache.tuscany.sca</groupId>
+			<artifactId>tuscany-base-runtime-pom</artifactId>
+			<version>2.0-SNAPSHOT</version>
+            <type>pom</type>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.tuscany.sca</groupId>
+			<artifactId>tuscany-data-api</artifactId>
+			<version>2.0-SNAPSHOT</version>
+		</dependency>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-binding-http-runtime</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-binding-jsonrpc-runtime</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-widget-runtime</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-widget-runtime-dojo</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-web-javascript-dojo</artifactId>
+            <version>2.0-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.mortbay.jetty</groupId>
+            <artifactId>jetty</artifactId>
+            <version>6.1.19</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>net.sourceforge.htmlunit</groupId>
+            <artifactId>htmlunit</artifactId>
+            <version>2.6</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.8.1</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+       <finalName>${project.artifactId}</finalName>
+       <plugins>
+         <plugin>
+           <groupId>org.codehaus.mojo</groupId>
+           <artifactId>exec-maven-plugin</artifactId>
+           <version>1.1.1</version>
+           <executions>
+             <execution>
+               <goals>
+                 <goal>java</goal>
+               </goals>
+             </execution>
+           </executions>
+           <configuration>
+             <classpathScope>test</classpathScope>
+             <mainClass>store.StoreTestCase</mainClass>
+           </configuration>
+         </plugin>
+      </plugins>
+    </build>
+
+</project>

Propchange: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/launch/Launch.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/launch/Launch.java?rev=1186454&view=auto
==============================================================================
--- tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/launch/Launch.java
(added)
+++ tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/launch/Launch.java
Wed Oct 19 20:24:43 2011
@@ -0,0 +1,39 @@
+/*
+ * 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 launch;
+
+import org.apache.tuscany.sca.node.Contribution;
+import org.apache.tuscany.sca.node.ContributionLocationHelper;
+import org.apache.tuscany.sca.node.Node;
+import org.apache.tuscany.sca.node.NodeFactory;
+
+public class Launch {
+    public static void main(String[] args) throws Exception {
+        System.out.println("Starting ...");
+        String contribution = ContributionLocationHelper.getContributionLocation(Launch.class);
+        Node node = NodeFactory.newInstance().createNode("person.composite", new Contribution("test",
contribution));
+        node.start();
+        System.out.println("person.composite ready for big business !!!");
+        System.in.read();
+        System.out.println("Stopping ...");
+        node.stop();
+        System.out.println();
+    }
+}

Propchange: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/launch/Launch.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/launch/Launch.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/Person.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/Person.java?rev=1186454&view=auto
==============================================================================
--- tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/Person.java
(added)
+++ tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/Person.java
Wed Oct 19 20:24:43 2011
@@ -0,0 +1,82 @@
+/*
+ * 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 services;
+
+public class Person implements java.io.Serializable {
+
+    private Integer id;
+    private String firstName;
+    private String lastName;
+    private String longitude;
+    private String latitude;
+    private String description;
+
+    public Person() {
+    }
+
+    public void setFirstName(String firstName) {
+        this.firstName = firstName;
+    }
+
+    public String getFirstName() {
+        return this.firstName;
+    }
+
+    public String getLastName() {
+        return this.lastName;
+    }
+
+    public void setLastName(String lastName) {
+        this.lastName = lastName;
+    }
+
+    public String getLongatude() {
+        return this.longitude;
+    }
+
+    public void setLongatude(String longatude) {
+        this.longitude = longatude;
+    }
+
+    public String getLatitude() {
+        return this.latitude;
+    }
+
+    public void setLatitude(String latitude) {
+        this.latitude = latitude;
+    }
+
+    public Integer getID() {
+        return this.id;
+    }
+
+    public void setID(Integer id) {
+        this.id = id;
+    }
+
+    public String getDescription() {
+        return this.description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+}

Propchange: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/Person.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/Person.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/PersonService.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/PersonService.java?rev=1186454&view=auto
==============================================================================
--- tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/PersonService.java
(added)
+++ tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/PersonService.java
Wed Oct 19 20:24:43 2011
@@ -0,0 +1,28 @@
+/*
+ * 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 services;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface PersonService {
+    void createPerson(Person person);
+    Person[] get();
+}

Propchange: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/PersonService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/PersonService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/PersonServiceImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/PersonServiceImpl.java?rev=1186454&view=auto
==============================================================================
--- tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/PersonServiceImpl.java
(added)
+++ tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/PersonServiceImpl.java
Wed Oct 19 20:24:43 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 services;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class PersonServiceImpl implements PersonService {
+    private List<Person> persons = new ArrayList<Person>();
+
+    @Override
+    public void createPerson(Person person) {
+        System.out.println("adding person " + person.getFirstName());
+        persons.add(person);
+
+    }
+
+    public Person[] get() {
+        Person[] catalogArray = new Person[persons.size()];
+        persons.toArray(catalogArray);
+        return catalogArray;
+    }
+}

Propchange: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/PersonServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/java/services/PersonServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/resources/person.composite
URL: http://svn.apache.org/viewvc/tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/resources/person.composite?rev=1186454&view=auto
==============================================================================
--- tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/resources/person.composite
(added)
+++ tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/resources/person.composite
Wed Oct 19 20:24:43 2011
@@ -0,0 +1,39 @@
+<?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://docs.oasis-open.org/ns/opencsa/sca/200912"
+		xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+		targetNamespace="http://person"
+		name="person">
+		
+    <component name="widget">
+        <tuscany:implementation.widget location="uiservices/widget.html"/>
+        <service name="Widget">
+        	<tuscany:binding.http uri="/ui"/>
+        </service>
+		<reference name="personService" target="PersonComponent/PersonService"/>
+    </component>
+    
+	<component name="PersonComponent">
+		<implementation.java class="services.PersonServiceImpl"/> 
+		<service name="PersonService">
+			<tuscany:binding.jsonrpc uri="/PersonService"/>
+   		</service>	
+	</component> 
+</composite>

Propchange: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/resources/person.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/resources/person.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/resources/person.composite
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/resources/uiservices/widget.html
URL: http://svn.apache.org/viewvc/tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/resources/uiservices/widget.html?rev=1186454&view=auto
==============================================================================
--- tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/resources/uiservices/widget.html
(added)
+++ tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/resources/uiservices/widget.html
Wed Oct 19 20:24:43 2011
@@ -0,0 +1,84 @@
+<!--
+    * 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.    
+-->
+<html>
+<head>
+<title>Store</title>
+
+<script type="text/javascript" src="../dojo/dojo.js"></script>
+<script type="text/javascript" src="widget.js"></script>
+
+<script language="JavaScript">
+
+	//@Reference
+	var personService = new tuscany.sca.Reference("personService");
+
+	function personService_getResponse(items,exception) {
+		if(exception){
+			alert(exception.message);
+			return;
+		}
+		var persons = "";
+		
+		for (var i=0; i<items.length; i++) {
+			var person = items[i].firstName + ' - ' + items[i].lastName;
+			persons += '<input name="items" type="checkbox" value="' + 
+						item + '">' + item + ' <br>';
+		}
+		document.getElementById('persons').innerHTML=catalog;
+	}
+	
+	function addNewPerson() {
+		var person = new Object();
+		person.id = "001"
+		person.firstName = "Luciano";
+		person.lastName = "R";
+		
+		personService.createPerson(person).addCallback(addPerson_getResponse);
+	}
+	
+	function addPerson_getResponse(something) {
+		personService.get().addCallback(personService_getResponse);
+	}
+
+	function init() {
+		try	{
+			personService.get().addCallback(personService_getResponse);
+		}
+		catch(e){
+			alert(e);
+		}
+	}
+	
+</script>
+
+</head>
+
+<body onload="init()">
+<h1>Store</h1>
+  <div id="application">
+   	<h2>Persons</h2>
+   	<form name="personsForm">
+		<div id="persons" ></div>
+		<br>
+		<input type="button" onClick="addNewPerson()"  value="Add new person">
+   	</form>
+ 	<br>  
+  </div>
+</body>
+</html>

Propchange: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/resources/uiservices/widget.html
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/resources/uiservices/widget.html
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/sandbox/lresende/sca-2.x/samples/person-jsonrpc/src/main/resources/uiservices/widget.html
------------------------------------------------------------------------------
    svn:mime-type = text/html



Mime
View raw message