From 1aba7b831e19fa8f9b718f42c1a0c4d09f6d52ad Mon Sep 17 00:00:00 2001 From: lresende Date: Tue, 23 Sep 2008 23:24:24 +0000 Subject: Porting customer-dojo to J2EE WebApp git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@698399 13f79535-47bb-0310-9956-ffa450edef68 --- java/sca/samples/customer-dojo-webapp/README | 104 +++++++++ .../samples/customer-dojo-webapp/build-dojo.xml | 92 ++++++++ java/sca/samples/customer-dojo-webapp/build.xml | 70 +++++++ .../customer-dojo-webapp/customer-dojo-jsonrpc.png | Bin 0 -> 9947 bytes .../customer-dojo-webapp/customer-dojo-jsonrpc.svg | 177 ++++++++++++++++ java/sca/samples/customer-dojo-webapp/customer.sql | 33 +++ java/sca/samples/customer-dojo-webapp/pom.xml | 233 +++++++++++++++++++++ .../src/main/java/customer/Customer.java | 93 ++++++++ .../src/main/java/customer/CustomerCollection.java | 26 +++ .../main/java/customer/CustomerCollectionImpl.java | 101 +++++++++ .../src/main/java/customer/CustomerService.java | 31 +++ .../main/java/customer/CustomerServiceImpl.java | 117 +++++++++++ .../src/main/java/launch/Launch.java | 34 +++ .../src/main/resources/META-INF/orm.xml | 51 +++++ .../src/main/resources/META-INF/persistence.xml | 40 ++++ .../main/resources/META-INF/sca-contribution.xml | 26 +++ .../src/main/resources/customer.composite | 37 ++++ .../src/main/webapp/META-INF/sca-contribution.xml | 24 +++ .../src/main/webapp/WEB-INF/geronimo-web.xml | 34 +++ .../src/main/webapp/WEB-INF/web.xml | 41 ++++ .../src/main/webapp/customer.jsp | 80 +++++++ java/sca/samples/pom.xml | 1 + 22 files changed, 1445 insertions(+) create mode 100644 java/sca/samples/customer-dojo-webapp/README create mode 100644 java/sca/samples/customer-dojo-webapp/build-dojo.xml create mode 100644 java/sca/samples/customer-dojo-webapp/build.xml create mode 100644 java/sca/samples/customer-dojo-webapp/customer-dojo-jsonrpc.png create mode 100644 java/sca/samples/customer-dojo-webapp/customer-dojo-jsonrpc.svg create mode 100644 java/sca/samples/customer-dojo-webapp/customer.sql create mode 100644 java/sca/samples/customer-dojo-webapp/pom.xml create mode 100644 java/sca/samples/customer-dojo-webapp/src/main/java/customer/Customer.java create mode 100644 java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollection.java create mode 100644 java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollectionImpl.java create mode 100644 java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerService.java create mode 100644 java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerServiceImpl.java create mode 100644 java/sca/samples/customer-dojo-webapp/src/main/java/launch/Launch.java create mode 100644 java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/orm.xml create mode 100644 java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/persistence.xml create mode 100644 java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/sca-contribution.xml create mode 100644 java/sca/samples/customer-dojo-webapp/src/main/resources/customer.composite create mode 100644 java/sca/samples/customer-dojo-webapp/src/main/webapp/META-INF/sca-contribution.xml create mode 100644 java/sca/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/geronimo-web.xml create mode 100644 java/sca/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/web.xml create mode 100644 java/sca/samples/customer-dojo-webapp/src/main/webapp/customer.jsp (limited to 'java/sca') diff --git a/java/sca/samples/customer-dojo-webapp/README b/java/sca/samples/customer-dojo-webapp/README new file mode 100644 index 0000000000..9c1729123f --- /dev/null +++ b/java/sca/samples/customer-dojo-webapp/README @@ -0,0 +1,104 @@ +Customer Dojo RPC Sample +=========================== + +Note. This sample is currently not working correctly on WebSphere - see TUSCANY-1990 + +This sample demostrates the SCA JSONRPC binding using a simple web app that +uses the RPC support of the Dojo Toolkit to an SCA service. + +The README in the samples directory (the directory above this) provides +general instructions about building and running samples. Take a look there +first. + +As this sample provides a web app there is a manual step where the WAR file +that contains the sample is copied to your web app container. If you just want +to give this sample a go deploy the WAR file (target/sample-helloworld-dojo-webapp.war) +to you web application server. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-helloworld-dojo-webapp + +The port and hostname will of course vary depending on your local installation. + +See also the similar helloworld-jsonrpc-webapp sample which also uses the SCA JSONRPC binding +but uses SCA scaDomain.js script on the client instead of the Dojo Toolkit. + +Sample Overview +--------------- +The sample provides a single service with an operation that reflects +a greeting back to the caller. The service is exposed using the JSONRPC +binding. The web app provided shows how the Dojo Toolkit JSON-RPC support can be +used to invoke the SCA service. + +The web app provided shows how the service can be called by using the DOJO toolkit. + +helloworld-dojo-webapp/ + build-dojo.xml - This file is an Ant script used by the + sample build process to download the Dojo Toolkit + and get it included in the WAR file + for use by the sample. + src/ + main/ + java/ + helloworldjsonrpc/ + HelloWorldService.java - service interface + HelloWorldServiceImpl.java - service implementation + resources/ + jsonrpc.composite - the SCA assembly for this sample + webapp + dojo/ - the Dojo toolkit (this directory is created only + when you build the samples from the source distribution) + META-INF/ + sca-contribution.xml - specifies the composite to be deployed + WEB-INF/ + web.xml - defines the listener that starts up the + Tuscany SCA runtime + HelloWorldJSONRPC.html - the web application that calls the + SCA service via JSONRPC + style.css - style sheet + + helloworld-jsonrpc-webapp.png - a pictorial representation of the + sample .composite file + build.xml - the Ant build file that unpacks the + dojo installation + pom.xml - the Maven build file + +Building And Running The Sample Using Ant +----------------------------------------- +With the binary distribution the sample can be built using Ant as +follows + +cd helloworld-dojo-webapp +ant package + +This should result in a war file (sample-helloworld-dojo-webapp.war) in the target +directory. Copy this war file to your web app deployment directory in your +web app container. + +The process for getting the web app running will depend on which web app container +you are using. For example, if you are using Tomcat then it is simply a matter +of copying the WAR file to the webapps directory. + +Once the web app is deployed use your browser to visit the following URL; + +http://localhost:8080/sample-helloworld-dojo-webapp + +The port and hostname will of course vary depending on your local installation. + +You should see a web page that allows you to send messages, via JSONRPC, to the +application running in the Tuscany SCA Runtime + +Building And Running The Sample Using Maven +------------------------------------------- +With either the binary or source distributions the sample can be built and run +using Maven as follows. + +cd helloworld-dojo-webapp +mvn + +Again this should result in a war file (sample-helloworld-dojo-webapp.war) in the target +directory. Follow the steps described in the previous section for running the web +app and for the expected results. + + diff --git a/java/sca/samples/customer-dojo-webapp/build-dojo.xml b/java/sca/samples/customer-dojo-webapp/build-dojo.xml new file mode 100644 index 0000000000..534a1dacd9 --- /dev/null +++ b/java/sca/samples/customer-dojo-webapp/build-dojo.xml @@ -0,0 +1,92 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/samples/customer-dojo-webapp/build.xml b/java/sca/samples/customer-dojo-webapp/build.xml new file mode 100644 index 0000000000..95813af65a --- /dev/null +++ b/java/sca/samples/customer-dojo-webapp/build.xml @@ -0,0 +1,70 @@ + + +]> + + + + &buildDependency; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/java/sca/samples/customer-dojo-webapp/customer-dojo-jsonrpc.png b/java/sca/samples/customer-dojo-webapp/customer-dojo-jsonrpc.png new file mode 100644 index 0000000000..57f90aed01 Binary files /dev/null and b/java/sca/samples/customer-dojo-webapp/customer-dojo-jsonrpc.png differ diff --git a/java/sca/samples/customer-dojo-webapp/customer-dojo-jsonrpc.svg b/java/sca/samples/customer-dojo-webapp/customer-dojo-jsonrpc.svg new file mode 100644 index 0000000000..d5c3bc5d3e --- /dev/null +++ b/java/sca/samples/customer-dojo-webapp/customer-dojo-jsonrpc.svg @@ -0,0 +1,177 @@ + + + + + + + + + + image/svg+xml + + + + + + + + helloworldjsonrpc + + HelloWorldJSONServiceComponent + HelloWorldService + WebApp + DOJO + + diff --git a/java/sca/samples/customer-dojo-webapp/customer.sql b/java/sca/samples/customer-dojo-webapp/customer.sql new file mode 100644 index 0000000000..a3caf8e050 --- /dev/null +++ b/java/sca/samples/customer-dojo-webapp/customer.sql @@ -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. +-- + +DROP TABLE CUSTOMER; + +CREATE TABLE CUSTOMER ( + ID INT PRIMARY KEY NOT NULL GENERATED ALWAYS AS IDENTITY, + NAME VARCHAR(30), + PHONE VARCHAR(10), + ADDRESS VARCHAR(25), + CITY VARCHAR(15), + STATE VARCHAR(2), + ZIP VARCHAR(5)); + +INSERT INTO CUSTOMER (NAME, PHONE, ADDRESS, CITY, STATE, ZIP ) VALUES('Joe Smith', '4081234567', '1440 N 1st ST', 'SAN JOSE', 'CA', '95134'); +INSERT INTO CUSTOMER (NAME, PHONE, ADDRESS, CITY, STATE, ZIP ) VALUES('Erik Johnson', '4081230987', '1440 N 1st ST', 'SAN JOSE', 'CA', '95134'); +INSERT INTO CUSTOMER (NAME, PHONE, ADDRESS, CITY, STATE, ZIP ) VALUES('Mark Pensacola', '4085679988', '1440 N 1st ST', 'SAN JOSE', 'CA', '95134'); \ No newline at end of file diff --git a/java/sca/samples/customer-dojo-webapp/pom.xml b/java/sca/samples/customer-dojo-webapp/pom.xml new file mode 100644 index 0000000000..4f5117e556 --- /dev/null +++ b/java/sca/samples/customer-dojo-webapp/pom.xml @@ -0,0 +1,233 @@ + + + + 4.0.0 + + org.apache.tuscany.sca + tuscany-sca + 1.4-SNAPSHOT + ../../pom.xml + + sample-customer-dojo-webapp + war + Apache Tuscany SCA Customer DOJO Sample WebApp + + + + apache.incubator + http://people.apache.org/repo/m2-incubating-repository + + + + + + org.apache.tuscany.sca + tuscany-host-webapp + 1.4-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-implementation-java-runtime + 1.4-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-data-api + 1.4-SNAPSHOT + + + + org.apache.tuscany.sca + tuscany-binding-jsonrpc-runtime + 1.4-SNAPSHOT + runtime + + + + org.apache.tuscany.sca + tuscany-implementation-resource-runtime + 1.4-SNAPSHOT + runtime + + + + org.apache.geronimo.specs + geronimo-jpa_3.0_spec + 1.1 + + + + org.apache.openjpa + openjpa + 1.0.0 + + + javax.xml.bind + jaxb-api + + + + + + org.apache.derby + derby + 10.3.1.4 + + + + junit + junit + 4.5 + test + + + + + + ${artifactId} + + + org.apache.maven.plugins + maven-antrun-plugin + + + + ant + ant-trax + 1.6.5 + + + + + install-dojo + validate + + run + + + + + + + + + + + copy-dojo-files + generate-resources + + run + + + + + + + + + + + + clean-dojo-files + clean + + run + + + + + + + + + + + + + + org.apache.tuscany.sca + tuscany-maven-ant-generator + 1.4-SNAPSHOT + + + + true + + + generate + + + + + + org.codehaus.mojo + sql-maven-plugin + + 1.1-SNAPSHOT + + + + org.apache.derby + derby + 10.3.1.4 + + + + + + create-db + generate-resources + + execute + + + org.apache.derby.jdbc.EmbeddedDriver + jdbc:derby:${pom.basedir}/target/classes/customer-db;create=true + true + continue + skip + ; + + ${pom.basedir}/customer.sql + + + + + + + shutdown-database-sothat-test-can-run + process-test-resources + + execute + + + org.apache.derby.jdbc.EmbeddedDriver + jdbc:derby:${pom.basedir}/target/classes/customer-db;shutdown=true + true + + + + + + + diff --git a/java/sca/samples/customer-dojo-webapp/src/main/java/customer/Customer.java b/java/sca/samples/customer-dojo-webapp/src/main/java/customer/Customer.java new file mode 100644 index 0000000000..6d207ea2ef --- /dev/null +++ b/java/sca/samples/customer-dojo-webapp/src/main/java/customer/Customer.java @@ -0,0 +1,93 @@ +/* + * 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 customer; + +import javax.persistence.Basic; +import javax.persistence.Entity; +import javax.persistence.Id; + +@Entity +public class Customer { + + @Id protected int id; + @Basic protected String name; + @Basic protected String phone; + @Basic protected String address; + @Basic protected String city; + @Basic protected String state; + @Basic protected String zip; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPhone() { + return phone; + } + + public void setPhone(String phone) { + this.phone = phone; + } + + public String getAddress() { + return address; + } + + public void setAddress(String address) { + this.address = address; + } + + public String getCity() { + return city; + } + + public void setCity(String city) { + this.city = city; + } + + public String getState() { + return state; + } + + public void setState(String state) { + this.state = state; + } + + public String getZip() { + return zip; + } + + public void setZip(String zip) { + this.zip = zip; + } + +} diff --git a/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollection.java b/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollection.java new file mode 100644 index 0000000000..5ad39aad5c --- /dev/null +++ b/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollection.java @@ -0,0 +1,26 @@ +/* + * 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 customer; + +import org.apache.tuscany.sca.data.collection.Collection; + + +public interface CustomerCollection extends Collection { + +} diff --git a/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollectionImpl.java b/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollectionImpl.java new file mode 100644 index 0000000000..c0a2f25f15 --- /dev/null +++ b/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerCollectionImpl.java @@ -0,0 +1,101 @@ +/* + * 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 customer; + +import java.util.Iterator; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.EntityTransaction; +import javax.persistence.Persistence; +import javax.persistence.Query; + +import org.apache.tuscany.sca.data.collection.Entry; +import org.apache.tuscany.sca.data.collection.NotFoundException; + + +public class CustomerCollectionImpl implements CustomerCollection { + EntityManagerFactory emf = null; + EntityManager em = null; + + public CustomerCollectionImpl() { + System.out.println(">>>"); + try { + emf = Persistence.createEntityManagerFactory("customer-openJPA"); + em = emf.createEntityManager(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + public void delete(String arg0) throws NotFoundException { + // TODO Auto-generated method stub + + } + + public Customer get(String arg0) throws NotFoundException { + // TODO Auto-generated method stub + return null; + } + + public Entry[] getAll() { + EntityTransaction tx = em.getTransaction(); + try { + tx.begin(); + + Query q = em.createQuery("SELECT c FROM customer c"); + List results = q.getResultList(); + Iterator iter = results.iterator(); + while (iter.hasNext()) { + Customer customer = (Customer)iter.next(); + + System.out.println(customer); + } + + tx.commit(); + } catch(Exception e) { + e.printStackTrace(); + } finally { + if (tx.isActive()) { + tx.rollback(); + } + + em.close(); + } + + return null; + } + + public String post(String arg0, Customer arg1) { + // TODO Auto-generated method stub + return null; + } + + public void put(String arg0, Customer arg1) throws NotFoundException { + // TODO Auto-generated method stub + + } + + public Entry[] query(String arg0) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerService.java b/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerService.java new file mode 100644 index 0000000000..7915cc6e77 --- /dev/null +++ b/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerService.java @@ -0,0 +1,31 @@ +/* + * 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 customer; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface CustomerService { + + Customer[] get(); + + Customer findCustomerByName(String name); + +} diff --git a/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerServiceImpl.java b/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerServiceImpl.java new file mode 100644 index 0000000000..0cba7d8bc1 --- /dev/null +++ b/java/sca/samples/customer-dojo-webapp/src/main/java/customer/CustomerServiceImpl.java @@ -0,0 +1,117 @@ +/* + * 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 customer; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; + +import javax.persistence.EntityManager; +import javax.persistence.EntityManagerFactory; +import javax.persistence.EntityTransaction; +import javax.persistence.Persistence; +import javax.persistence.Query; + +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.Init; + +public class CustomerServiceImpl implements CustomerService { + EntityManagerFactory emf = null; + EntityManager em = null; + + public CustomerServiceImpl() { + + } + + @Init + public void init() { + System.out.println(">>> Initializing JPA"); + try { + emf = Persistence.createEntityManagerFactory("customer-openJPA"); + em = emf.createEntityManager(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + @Destroy + public void destroy() { + emf.close(); + } + + public Customer[] get() { + EntityTransaction tx = em.getTransaction(); + List customers = new ArrayList(); + try { + tx.begin(); + + Query q = em.createQuery("SELECT c FROM customer c"); + List results = q.getResultList(); + Iterator iter = results.iterator(); + while (iter.hasNext()) { + Customer customer = (Customer)iter.next(); + customers.add(customer); + } + + tx.commit(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (tx.isActive()) { + tx.rollback(); + } + + em.close(); + } + + Customer[] customerArray = new Customer[customers.size()]; + customers.toArray(customerArray); + return customerArray; + } + + public Customer findCustomerByName(String name) { + EntityTransaction tx = em.getTransaction(); + Customer customer = null; + + try { + tx.begin(); + + Query q = em.createQuery("SELECT c FROM customer c WHERE c.name = '" + name + "'"); + List results = q.getResultList(); + Iterator iter = results.iterator(); + while (iter.hasNext()) { + customer = (Customer)iter.next(); + } + + tx.commit(); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (tx.isActive()) { + tx.rollback(); + } + + em.close(); + } + + return customer; + } + +} diff --git a/java/sca/samples/customer-dojo-webapp/src/main/java/launch/Launch.java b/java/sca/samples/customer-dojo-webapp/src/main/java/launch/Launch.java new file mode 100644 index 0000000000..d7f88b8dd4 --- /dev/null +++ b/java/sca/samples/customer-dojo-webapp/src/main/java/launch/Launch.java @@ -0,0 +1,34 @@ +/* + * 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.host.embedded.SCADomain; + +public class Launch { + public static void main(String[] args) throws Exception { + System.out.println("Starting ..."); + SCADomain scaDomain = SCADomain.newInstance("customer.composite"); + System.out.println("store.composite ready for big business !!!"); + System.in.read(); + System.out.println("Stopping ..."); + scaDomain.close(); + System.out.println(); + } +} diff --git a/java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/orm.xml b/java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/orm.xml new file mode 100644 index 0000000000..64be295302 --- /dev/null +++ b/java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/orm.xml @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/persistence.xml b/java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/persistence.xml new file mode 100644 index 0000000000..5674dede06 --- /dev/null +++ b/java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/persistence.xml @@ -0,0 +1,40 @@ + + + + + + + orm.xml + customer.Customer + + + + + + + + + + + + \ No newline at end of file diff --git a/java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/sca-contribution.xml b/java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..136326d1d3 --- /dev/null +++ b/java/sca/samples/customer-dojo-webapp/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,26 @@ + + + + + + + diff --git a/java/sca/samples/customer-dojo-webapp/src/main/resources/customer.composite b/java/sca/samples/customer-dojo-webapp/src/main/resources/customer.composite new file mode 100644 index 0000000000..8b8a413499 --- /dev/null +++ b/java/sca/samples/customer-dojo-webapp/src/main/resources/customer.composite @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + diff --git a/java/sca/samples/customer-dojo-webapp/src/main/webapp/META-INF/sca-contribution.xml b/java/sca/samples/customer-dojo-webapp/src/main/webapp/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..32f11ab9d0 --- /dev/null +++ b/java/sca/samples/customer-dojo-webapp/src/main/webapp/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ + + + + + \ No newline at end of file diff --git a/java/sca/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/geronimo-web.xml b/java/sca/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/geronimo-web.xml new file mode 100644 index 0000000000..ca61ed1d63 --- /dev/null +++ b/java/sca/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/geronimo-web.xml @@ -0,0 +1,34 @@ + + + + + + + org.apache.tuscany.sca + sample-customer-dojo-webapp + 1.4-SNAPSHOT + war + + + + + + diff --git a/java/sca/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/web.xml b/java/sca/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..d90b4a7d62 --- /dev/null +++ b/java/sca/samples/customer-dojo-webapp/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,41 @@ + + + + + + + Apache Tuscany Customer dojo web application sample + + + tuscany + org.apache.tuscany.sca.host.webapp.TuscanyServletFilter + + + + tuscany + /* + + + + customer.jsp + + + diff --git a/java/sca/samples/customer-dojo-webapp/src/main/webapp/customer.jsp b/java/sca/samples/customer-dojo-webapp/src/main/webapp/customer.jsp new file mode 100644 index 0000000000..f7e864053e --- /dev/null +++ b/java/sca/samples/customer-dojo-webapp/src/main/webapp/customer.jsp @@ -0,0 +1,80 @@ +<%-- + * 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. +--%> + +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + + + + Tuscany Dojo JSON-RPC Customer Example + + + + + + + + + + + + + + + +

Tuscany Dojo JSON-RPC Customer Sample

+ +Customer Name :
+ + + + + + + + diff --git a/java/sca/samples/pom.xml b/java/sca/samples/pom.xml index 5176eab59f..d4b47b6fd6 100644 --- a/java/sca/samples/pom.xml +++ b/java/sca/samples/pom.xml @@ -62,6 +62,7 @@ callback-ws-servicechat-webappcustomer-dojo + customer-dojo-webappdatabinding-echodomain-management -- cgit v1.2.3