diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:07:19 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:07:19 +0000 |
commit | 6fadbc9cd1fcf03d0b3630f772d91df149b70428 (patch) | |
tree | 32752e491abb97fc8ef4f246455e3b5fd2814862 /branches/sca-java-1.0.1/samples/store | |
parent | 5559ef5edbf8d3616f7a4b497b2a459b0ee4082b (diff) |
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835123 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'branches/sca-java-1.0.1/samples/store')
19 files changed, 0 insertions, 1713 deletions
diff --git a/branches/sca-java-1.0.1/samples/store/DISCLAIMER b/branches/sca-java-1.0.1/samples/store/DISCLAIMER deleted file mode 100644 index d68a410903..0000000000 --- a/branches/sca-java-1.0.1/samples/store/DISCLAIMER +++ /dev/null @@ -1,8 +0,0 @@ -Apache Tuscany is an effort undergoing incubation at The Apache Software
-Foundation (ASF), sponsored by the Apache Web Services PMC. Incubation is
-required of all newly accepted projects until a further review indicates that
-the infrastructure, communications, and decision making process have stabilized
-in a manner consistent with other successful ASF projects. While incubation
-status is not necessarily a reflection of the completeness or stability of the
-code, it does indicate that the project has yet to be fully endorsed by the ASF.
-
diff --git a/branches/sca-java-1.0.1/samples/store/LICENSE b/branches/sca-java-1.0.1/samples/store/LICENSE deleted file mode 100644 index 8aa906c321..0000000000 --- a/branches/sca-java-1.0.1/samples/store/LICENSE +++ /dev/null @@ -1,205 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. - - - diff --git a/branches/sca-java-1.0.1/samples/store/NOTICE b/branches/sca-java-1.0.1/samples/store/NOTICE deleted file mode 100644 index 94481d6cfa..0000000000 --- a/branches/sca-java-1.0.1/samples/store/NOTICE +++ /dev/null @@ -1,6 +0,0 @@ -${pom.name} -Copyright (c) 2005 - 2007 The Apache Software Foundation - -This product includes software developed by -The Apache Software Foundation (http://www.apache.org/). - diff --git a/branches/sca-java-1.0.1/samples/store/README b/branches/sca-java-1.0.1/samples/store/README deleted file mode 100644 index 1cc5a40276..0000000000 --- a/branches/sca-java-1.0.1/samples/store/README +++ /dev/null @@ -1,5 +0,0 @@ -Store Sample -====================================== - -See getting-started-1.0.pdf - diff --git a/branches/sca-java-1.0.1/samples/store/build.xml b/branches/sca-java-1.0.1/samples/store/build.xml deleted file mode 100644 index 4f96edba35..0000000000 --- a/branches/sca-java-1.0.1/samples/store/build.xml +++ /dev/null @@ -1,72 +0,0 @@ -<!-- - * 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 name="store" default="compile"> - <property name="test.class" value="launch.Launch" /> - <property name="test.jar" value="sample-store.jar" /> - - <target name="init"> - <mkdir dir="target/classes"/> - </target> - - <target name="compile" depends="init"> - <javac srcdir="src/main/java" - destdir="target/classes" - debug="on" - source="1.5" - target="1.5"> - <classpath> - <pathelement location="../../lib/tuscany-sca-manifest.jar"/> - </classpath> - </javac> - <copy todir="target/classes"> - <fileset dir="src/main/resources"/> - </copy> - <jar destfile="target/${test.jar}" basedir="target/classes"> - <manifest> - <attribute name="Main-Class" value="${test.class}" /> - </manifest> - </jar> - </target> - - <target name="run-classes"> - <java classname="${test.class}" - fork="true"> - <classpath> - <pathelement path="target/classes"/> - <pathelement location="../../lib/tuscany-sca-manifest.jar"/> - </classpath> - </java> - </target> - - <target name="run"> - <java classname="${test.class}" - fork="true"> - <classpath> - <pathelement path="target/${test.jar}"/> - <pathelement location="../../lib/tuscany-sca-manifest.jar"/> - </classpath> - </java> - </target> - - <target name="clean"> - <delete quiet="true" includeemptydirs="true"> - <fileset dir="target"/> - </delete> - </target> -</project> diff --git a/branches/sca-java-1.0.1/samples/store/getting-started-1.0.pdf b/branches/sca-java-1.0.1/samples/store/getting-started-1.0.pdf Binary files differdeleted file mode 100644 index 950e4b12cd..0000000000 --- a/branches/sca-java-1.0.1/samples/store/getting-started-1.0.pdf +++ /dev/null diff --git a/branches/sca-java-1.0.1/samples/store/pom.xml b/branches/sca-java-1.0.1/samples/store/pom.xml deleted file mode 100644 index d774f0aa24..0000000000 --- a/branches/sca-java-1.0.1/samples/store/pom.xml +++ /dev/null @@ -1,99 +0,0 @@ -<?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>1.0.1-incubating-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> - </parent> - <artifactId>sample-store</artifactId> - <name>Apache Tuscany SCA Getting Started Online Store Sample</name> - - <repositories> - <repository> - <id>apache.incubator</id> - <url>http://people.apache.org/repo/m2-incubating-repository</url> - </repository> - </repositories> - - <dependencies> - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-host-embedded</artifactId> - <version>1.0.1-incubating-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-implementation-java-runtime</artifactId> - <version>1.0.1-incubating-SNAPSHOT</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-implementation-resource</artifactId> - <version>1.0.1-incubating-SNAPSHOT</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-binding-feed</artifactId> - <version>1.0.1-incubating-SNAPSHOT</version> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-binding-jsonrpc</artifactId> - <version>1.0.1-incubating-SNAPSHOT</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-binding-http</artifactId> - <version>1.0.1-incubating-SNAPSHOT</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>org.apache.tuscany.sca</groupId> - <artifactId>tuscany-host-tomcat</artifactId> - <version>1.0.1-incubating-SNAPSHOT</version> - <scope>runtime</scope> - </dependency> - - <dependency> - <groupId>junit</groupId> - <artifactId>junit</artifactId> - <version>4.2</version> - <scope>test</scope> - </dependency> - - </dependencies> - - <build> - <finalName>${artifactId}</finalName> - </build> - -</project> diff --git a/branches/sca-java-1.0.1/samples/store/src/main/java/launch/Launch.java b/branches/sca-java-1.0.1/samples/store/src/main/java/launch/Launch.java deleted file mode 100644 index 801697abea..0000000000 --- a/branches/sca-java-1.0.1/samples/store/src/main/java/launch/Launch.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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("store.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/branches/sca-java-1.0.1/samples/store/src/main/java/services/Catalog.java b/branches/sca-java-1.0.1/samples/store/src/main/java/services/Catalog.java deleted file mode 100644 index 9f784b0848..0000000000 --- a/branches/sca-java-1.0.1/samples/store/src/main/java/services/Catalog.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.osoa.sca.annotations.Remotable; - -@Remotable -public interface Catalog { - String[] get(); -} diff --git a/branches/sca-java-1.0.1/samples/store/src/main/java/services/CatalogImpl.java b/branches/sca-java-1.0.1/samples/store/src/main/java/services/CatalogImpl.java deleted file mode 100644 index fd44c66bf6..0000000000 --- a/branches/sca-java-1.0.1/samples/store/src/main/java/services/CatalogImpl.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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; - -import org.osoa.sca.annotations.Init; -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Reference; - -public class CatalogImpl implements Catalog { - @Property - public String currencyCode = "USD"; - @Reference - public CurrencyConverter currencyConverter; - private List<String> catalog = new ArrayList<String>(); - - @Init - public void init() { - String currencySymbol = currencyConverter.getCurrencySymbol(currencyCode); - catalog.add("Apple - " + currencySymbol + currencyConverter.getConversion("USD", currencyCode, 2.99f)); - catalog.add("Orange - " + currencySymbol + currencyConverter.getConversion("USD", currencyCode, 3.55f)); - catalog.add("Pear - " + currencySymbol + currencyConverter.getConversion("USD", currencyCode, 1.55f)); - } - - public String[] get() { - String[] catalogArray = new String[catalog.size()]; - catalog.toArray(catalogArray); - return catalogArray; - } -} diff --git a/branches/sca-java-1.0.1/samples/store/src/main/java/services/CurrencyConverter.java b/branches/sca-java-1.0.1/samples/store/src/main/java/services/CurrencyConverter.java deleted file mode 100644 index 8b0f70907d..0000000000 --- a/branches/sca-java-1.0.1/samples/store/src/main/java/services/CurrencyConverter.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.osoa.sca.annotations.Remotable; - -@Remotable -public interface CurrencyConverter { - public float getConversion(String fromCurrenycCode, String toCurrencyCode, float amount); - - public String getCurrencySymbol(String currencyCode); -} diff --git a/branches/sca-java-1.0.1/samples/store/src/main/java/services/CurrencyConverterImpl.java b/branches/sca-java-1.0.1/samples/store/src/main/java/services/CurrencyConverterImpl.java deleted file mode 100644 index 0ae8f345ce..0000000000 --- a/branches/sca-java-1.0.1/samples/store/src/main/java/services/CurrencyConverterImpl.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 CurrencyConverterImpl implements CurrencyConverter { - public float getConversion(String fromCurrencyCode, String toCurrencyCode, float amount) { - if (toCurrencyCode.equals("USD")) - return amount; - else if (toCurrencyCode.equals("EUR")) - return amount * 0.7256f; - return 0; - } - - public String getCurrencySymbol(String currencyCode) { - if (currencyCode.equals("USD")) - return "$"; - else if (currencyCode.equals("EUR")) - return "€"; - return "?"; - } -} diff --git a/branches/sca-java-1.0.1/samples/store/src/main/java/services/ShoppingCartImpl.java b/branches/sca-java-1.0.1/samples/store/src/main/java/services/ShoppingCartImpl.java deleted file mode 100644 index f3934717f8..0000000000 --- a/branches/sca-java-1.0.1/samples/store/src/main/java/services/ShoppingCartImpl.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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.Date; -import java.util.HashMap; -import java.util.Map; -import java.util.UUID; - -import org.apache.tuscany.sca.binding.feed.collection.Collection; -import org.apache.tuscany.sca.binding.feed.collection.NotFoundException; - -import com.sun.syndication.feed.atom.Content; -import com.sun.syndication.feed.atom.Entry; -import com.sun.syndication.feed.atom.Feed; -import com.sun.syndication.feed.atom.Link; - -public class ShoppingCartImpl implements Collection { - - private static Map<String, Entry> cart = new HashMap<String, Entry>(); - - public Feed getFeed() { - Feed feed = new Feed(); - feed.setTitle("shopping cart"); - Content subtitle = new Content(); - subtitle.setValue("Total : " + getTotal()); - feed.setSubtitle(subtitle); - feed.getEntries().addAll(cart.values()); - return feed; - } - - public Entry get(String id) throws NotFoundException { - return cart.get(id); - } - - public Entry post(Entry entry) { - System.out.println("post" + entry); - String id = "cart-" + UUID.randomUUID().toString(); - entry.setId(id); - - Link link = new Link(); - link.setRel("edit"); - link.setHref(id); - entry.getOtherLinks().add(link); - link = new Link(); - link.setRel("alternate"); - link.setHref(id); - entry.getAlternateLinks().add(link); - - entry.setCreated(new Date()); - - cart.put(id, entry); - return entry; - } - - public Entry put(String id, Entry entry) throws NotFoundException { - entry.setUpdated(new Date()); - cart.put(id, entry); - return entry; - } - - public void delete(String id) throws NotFoundException { - if (id.equals("")) - cart.clear(); - else - cart.remove(id); - } - - private String getTotal() { - float total = 0; - String currencySymbol = ""; - if (!cart.isEmpty()) { - String item = ((Content)cart.values().iterator().next().getContents().get(0)).getValue(); - currencySymbol = item.substring(item.indexOf("-") + 2, item.indexOf("-") + 3); - } - for (Entry entry : cart.values()) { - String item = ((Content)entry.getContents().get(0)).getValue(); - total += Float.valueOf(item.substring(item.indexOf("-") + 3)); - } - return currencySymbol + String.valueOf(total); - } -} diff --git a/branches/sca-java-1.0.1/samples/store/src/main/resources/store.composite b/branches/sca-java-1.0.1/samples/store/src/main/resources/store.composite deleted file mode 100644 index 1f04cb02ed..0000000000 --- a/branches/sca-java-1.0.1/samples/store/src/main/resources/store.composite +++ /dev/null @@ -1,52 +0,0 @@ -<?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"
- xmlns:t="http://tuscany.apache.org/xmlns/sca/1.0"
- xmlns:s="http://store"
- name="store">
-
- <component name="ufs">
- <t:implementation.resource location="ufservices"/>
- <service name="Resource">
- <t:binding.http/>
- </service>
- </component>
-
- <component name="Catalog">
- <implementation.java class="services.CatalogImpl"/>
- <property name="currencyCode">USD</property>
- <service name="Catalog">
- <t:binding.jsonrpc/>
- </service>
- <reference name="currencyConverter" target="CurrencyConverter"/>
- </component>
-
- <component name="ShoppingCart">
- <implementation.java class="services.ShoppingCartImpl"/>
- <service name="Collection">
- <t:binding.atom/>
- </service>
- </component>
-
- <component name="CurrencyConverter">
- <implementation.java class="services.CurrencyConverterImpl"/>
- </component>
-
-</composite>
diff --git a/branches/sca-java-1.0.1/samples/store/src/main/resources/ufservices/binding-atom.js b/branches/sca-java-1.0.1/samples/store/src/main/resources/ufservices/binding-atom.js deleted file mode 100644 index aacf864f14..0000000000 --- a/branches/sca-java-1.0.1/samples/store/src/main/resources/ufservices/binding-atom.js +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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. - */ - -function AtomClient(uri) { - - this.uri=uri; - - this.get = function(id, responseFunction) { - var xhr = this.createXMLHttpRequest(); - xhr.onreadystatechange = function() { - if (xhr.readyState == 4) { - if (xhr.status == 200) { - if (responseFunction != null) responseFunction(xhr.responseXML); - } else { - alert("get - Error getting data from the server"); - } - } - } - xhr.open("GET", uri + id, true); - xhr.send(null); - } - this.post = function (entry, responseFunction) { - var xhr = this.createXMLHttpRequest(); - xhr.onreadystatechange = function() { - if (xhr.readyState == 4) { - if (xhr.status == 201) { - if (responseFunction != null) responseFunction(xhr.responseXML); - } else { - alert("post - Error getting data from the server"); - } - } - } - xhr.open("POST", uri, true); - xhr.setRequestHeader("Content-Type", "application/atom+xml"); - xhr.send(entry); - } - this.put = function (id, entry, responseFunction) { - var xhr = this.createXMLHttpRequest(); - xhr.onreadystatechange = function() { - if (xhr.readyState == 4) { - if (xhr.status == 200) { - if (responseFunction != null) responseFunction(xhr.responseXML); - } else { - alert("put - Error getting data from the server"); - } - } - } - xhr.open("PUT", uri + id, true); - xhr.setRequestHeader("Content-Type", "application/atom+xml"); - xhr.send(entry); - } - this.delete = function (id, responseFunction) { - var xhr = this.createXMLHttpRequest(); - xhr.onreadystatechange = function() { - if (xhr.readyState == 4) { - if (xhr.status == 200) { - if (responseFunction != null) responseFunction(); - } else { - alert("delete - Error getting data from the server"); - } - } - } - xhr.open("DELETE", uri + id, true); - xhr.send(null); - } - - this.createXMLHttpRequest = function () { - try {return new XMLHttpRequest();} catch(e) {} - try {return new ActiveXObject("Msxml2.XMLHTTP");} catch(e) {} - try {return new ActiveXObject("Microsoft.XMLHTTP");} catch(e) {} - alert("XML http request not supported"); - return null; - } -} - -bindingatom = "loaded";
\ No newline at end of file diff --git a/branches/sca-java-1.0.1/samples/store/src/main/resources/ufservices/binding-jsonrpc.js b/branches/sca-java-1.0.1/samples/store/src/main/resources/ufservices/binding-jsonrpc.js deleted file mode 100644 index 7f4a092f71..0000000000 --- a/branches/sca-java-1.0.1/samples/store/src/main/resources/ufservices/binding-jsonrpc.js +++ /dev/null @@ -1,494 +0,0 @@ -/* - * JSON-RPC JavaScript client - * - * $Id: jsonrpc.js,v 1.36.2.3 2006/03/08 15:09:37 mclark Exp $ - * - * Copyright (c) 2003-2004 Jan-Klaas Kollhof - * Copyright (c) 2005 Michael Clark, Metaparadigm Pte Ltd - * - * This code is based on Jan-Klaas' JavaScript o lait library (jsolait). - * - * Licensed 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. - * - */ - -/* - * Modifications for Apache Tuscany: - * - JSONRpcClient_createMethod changed so callback is last arg - */ - -/* escape a character */ - -escapeJSONChar = -function escapeJSONChar(c) -{ - if(c == "\"" || c == "\\") return "\\" + c; - else if (c == "\b") return "\\b"; - else if (c == "\f") return "\\f"; - else if (c == "\n") return "\\n"; - else if (c == "\r") return "\\r"; - else if (c == "\t") return "\\t"; - var hex = c.charCodeAt(0).toString(16); - if(hex.length == 1) return "\\u000" + hex; - else if(hex.length == 2) return "\\u00" + hex; - else if(hex.length == 3) return "\\u0" + hex; - else return "\\u" + hex; -}; - - -/* encode a string into JSON format */ - -escapeJSONString = -function escapeJSONString(s) -{ - /* The following should suffice but Safari's regex is b0rken - (doesn't support callback substitutions) - return "\"" + s.replace(/([^\u0020-\u007f]|[\\\"])/g, - escapeJSONChar) + "\""; - */ - - /* Rather inefficient way to do it */ - var parts = s.split(""); - for(var i=0; i < parts.length; i++) { - var c =parts[i]; - if(c == '"' || - c == '\\' || - c.charCodeAt(0) < 32 || - c.charCodeAt(0) >= 128) - parts[i] = escapeJSONChar(parts[i]); - } - return "\"" + parts.join("") + "\""; -}; - - -/* Marshall objects to JSON format */ - -toJSON = function toJSON(o) -{ - if(o == null) { - return "null"; - } else if(o.constructor == String) { - return escapeJSONString(o); - } else if(o.constructor == Number) { - return o.toString(); - } else if(o.constructor == Boolean) { - return o.toString(); - } else if(o.constructor == Date) { - return '{javaClass: "java.util.Date", time: ' + o.valueOf() +'}'; - } else if(o.constructor == Array) { - var v = []; - for(var i = 0; i < o.length; i++) v.push(toJSON(o[i])); - return "[" + v.join(", ") + "]"; - } else { - var v = []; - for(attr in o) { - if(o[attr] == null) v.push("\"" + attr + "\": null"); - else if(typeof o[attr] == "function"); /* skip */ - else v.push(escapeJSONString(attr) + ": " + toJSON(o[attr])); - } - return "{" + v.join(", ") + "}"; - } -}; - - -/* JSONRpcClient constructor */ - -JSONRpcClient = -function JSONRpcClient_ctor(serverURL, user, pass, objectID) -{ - this.serverURL = serverURL; - this.user = user; - this.pass = pass; - this.objectID = objectID; - - /* Add standard methods */ - if(this.objectID) { - this._addMethods(["listMethods"]); - var req = this._makeRequest("listMethods", []); - } else { - this._addMethods(["system.listMethods"]); - var req = this._makeRequest("system.listMethods", []); - } - var m = this._sendRequest(req); - this._addMethods(m); -}; - - -/* JSONRpcCLient.Exception */ - -JSONRpcClient.Exception = -function JSONRpcClient_Exception_ctor(code, message, javaStack) -{ - this.code = code; - var name; - if(javaStack) { - this.javaStack = javaStack; - var m = javaStack.match(/^([^:]*)/); - if(m) name = m[0]; - } - if(name) this.name = name; - else this.name = "JSONRpcClientException"; - this.message = message; -}; - -JSONRpcClient.Exception.CODE_REMOTE_EXCEPTION = 490; -JSONRpcClient.Exception.CODE_ERR_CLIENT = 550; -JSONRpcClient.Exception.CODE_ERR_PARSE = 590; -JSONRpcClient.Exception.CODE_ERR_NOMETHOD = 591; -JSONRpcClient.Exception.CODE_ERR_UNMARSHALL = 592; -JSONRpcClient.Exception.CODE_ERR_MARSHALL = 593; - -JSONRpcClient.Exception.prototype = new Error(); - -JSONRpcClient.Exception.prototype.toString = -function JSONRpcClient_Exception_toString(code, msg) -{ - return this.name + ": " + this.message; -}; - - -/* Default top level exception handler */ - -JSONRpcClient.default_ex_handler = -function JSONRpcClient_default_ex_handler(e) { alert(e); }; - - -/* Client settable variables */ - -JSONRpcClient.toplevel_ex_handler = JSONRpcClient.default_ex_handler; -JSONRpcClient.profile_async = false; -JSONRpcClient.max_req_active = 1; -JSONRpcClient.requestId = 1; - - -/* JSONRpcClient implementation */ - -JSONRpcClient.prototype._createMethod = -function JSONRpcClient_createMethod(methodName) -{ - var fn=function() - { - var args = []; - var callback = null; - for(var i=0;i<arguments.length;i++) args.push(arguments[i]); - -/* TUSCANY change callback to be last arg instead of first to match binding.ajax - if(typeof args[0] == "function") callback = args.shift(); -*/ - if(typeof args[arguments.length-1] == "function") callback = args.pop(); - - var req = fn.client._makeRequest.call(fn.client, fn.methodName, - args, callback); - if(callback == null) { - return fn.client._sendRequest.call(fn.client, req); - } else { - JSONRpcClient.async_requests.push(req); - JSONRpcClient.kick_async(); - return req.requestId; - } - }; - fn.client = this; - fn.methodName = methodName; - return fn; -}; - -JSONRpcClient.prototype._addMethods = -function JSONRpcClient_addMethods(methodNames) -{ - for(var i=0; i<methodNames.length; i++) { - var obj = this; - var names = methodNames[i].split("."); - for(var n=0; n<names.length-1; n++) { - var name = names[n]; - if(obj[name]) { - obj = obj[name]; - } else { - obj[name] = new Object(); - obj = obj[name]; - } - } - var name = names[names.length-1]; - if(!obj[name]) { - var method = this._createMethod(methodNames[i]); - obj[name] = method; - } - } -}; - -JSONRpcClient._getCharsetFromHeaders = -function JSONRpcClient_getCharsetFromHeaders(http) -{ - try { - var contentType = http.getResponseHeader("Content-type"); - var parts = contentType.split(/\s*;\s*/); - for(var i =0; i < parts.length; i++) { - if(parts[i].substring(0, 8) == "charset=") - return parts[i].substring(8, parts[i].length); - } - } catch (e) {} - return "UTF-8"; /* default */ -}; - -/* Async queue globals */ -JSONRpcClient.async_requests = []; -JSONRpcClient.async_inflight = {}; -JSONRpcClient.async_responses = []; -JSONRpcClient.async_timeout = null; -JSONRpcClient.num_req_active = 0; - -JSONRpcClient._async_handler = -function JSONRpcClient_async_handler() -{ - JSONRpcClient.async_timeout = null; - - while(JSONRpcClient.async_responses.length > 0) { - var res = JSONRpcClient.async_responses.shift(); - if(res.canceled) continue; - if(res.profile) res.profile.dispatch = new Date(); - try { - res.cb(res.result, res.ex, res.profile); - } catch(e) { - JSONRpcClient.toplevel_ex_handler(e); - } - } - - while(JSONRpcClient.async_requests.length > 0 && - JSONRpcClient.num_req_active < JSONRpcClient.max_req_active) { - var req = JSONRpcClient.async_requests.shift(); - if(req.canceled) continue; - req.client._sendRequest.call(req.client, req); - } -}; - -JSONRpcClient.kick_async = -function JSONRpcClient_kick_async() -{ - if(JSONRpcClient.async_timeout == null) - JSONRpcClient.async_timeout = - setTimeout(JSONRpcClient._async_handler, 0); -}; - -JSONRpcClient.cancelRequest = -function JSONRpcClient_cancelRequest(requestId) -{ - /* If it is in flight then mark it as canceled in the inflight map - and the XMLHttpRequest callback will discard the reply. */ - if(JSONRpcClient.async_inflight[requestId]) { - JSONRpcClient.async_inflight[requestId].canceled = true; - return true; - } - - /* If its not in flight yet then we can just mark it as canceled in - the the request queue and it will get discarded before being sent. */ - for(var i in JSONRpcClient.async_requests) { - if(JSONRpcClient.async_requests[i].requestId == requestId) { - JSONRpcClient.async_requests[i].canceled = true; - return true; - } - } - - /* It may have returned from the network and be waiting for its callback - to be dispatched, so mark it as canceled in the response queue - and the response will get discarded before calling the callback. */ - for(var i in JSONRpcClient.async_responses) { - if(JSONRpcClient.async_responses[i].requestId == requestId) { - JSONRpcClient.async_responses[i].canceled = true; - return true; - } - } - - return false; -}; - -JSONRpcClient.prototype._makeRequest = -function JSONRpcClient_makeRequest(methodName, args, cb) -{ - var req = {}; - req.client = this; - req.requestId = JSONRpcClient.requestId++; - - var obj = {}; - obj.id = req.requestId; - if (this.objectID) - obj.method = ".obj#" + this.objectID + "." + methodName; - else - obj.method = methodName; - obj.params = args; - - if (cb) req.cb = cb; - if (JSONRpcClient.profile_async) - req.profile = { "submit": new Date() }; - req.data = toJSON(obj); - - return req; -}; - -JSONRpcClient.prototype._sendRequest = -function JSONRpcClient_sendRequest(req) -{ - if(req.profile) req.profile.start = new Date(); - - /* Get free http object from the pool */ - var http = JSONRpcClient.poolGetHTTPRequest(); - JSONRpcClient.num_req_active++; - - /* Send the request */ - if (typeof(this.user) == "undefined") { - http.open("POST", this.serverURL, (req.cb != null)); - } else { - http.open("POST", this.serverURL, (req.cb != null), this.user, this.pass); - } - - /* setRequestHeader is missing in Opera 8 Beta */ - try { http.setRequestHeader("Content-type", "text/plain"); } catch(e) {} - - /* Construct call back if we have one */ - if(req.cb) { - var self = this; - http.onreadystatechange = function() { - if(http.readyState == 4) { - http.onreadystatechange = function () {}; - var res = { "cb": req.cb, "result": null, "ex": null}; - if (req.profile) { - res.profile = req.profile; - res.profile.end = new Date(); - } - try { res.result = self._handleResponse(http); } - catch(e) { res.ex = e; } - if(!JSONRpcClient.async_inflight[req.requestId].canceled) - JSONRpcClient.async_responses.push(res); - delete JSONRpcClient.async_inflight[req.requestId]; - JSONRpcClient.kick_async(); - } - }; - } else { - http.onreadystatechange = function() {}; - } - - JSONRpcClient.async_inflight[req.requestId] = req; - - try { - http.send(req.data); - } catch(e) { - JSONRpcClient.poolReturnHTTPRequest(http); - JSONRpcClient.num_req_active--; - throw new JSONRpcClient.Exception - (JSONRpcClient.Exception.CODE_ERR_CLIENT, "Connection failed"); - } - - if(!req.cb) return this._handleResponse(http); -}; - -JSONRpcClient.prototype._handleResponse = -function JSONRpcClient_handleResponse(http) -{ - /* Get the charset */ - if(!this.charset) { - this.charset = JSONRpcClient._getCharsetFromHeaders(http); - } - - /* Get request results */ - var status, statusText, data; - try { - status = http.status; - statusText = http.statusText; - data = http.responseText; - } catch(e) { - JSONRpcClient.poolReturnHTTPRequest(http); - JSONRpcClient.num_req_active--; - JSONRpcClient.kick_async(); - throw new JSONRpcClient.Exception - (JSONRpcClient.Exception.CODE_ERR_CLIENT, "Connection failed"); - } - - /* Return http object to the pool; */ - JSONRpcClient.poolReturnHTTPRequest(http); - JSONRpcClient.num_req_active--; - - /* Unmarshall the response */ - if(status != 200) { - throw new JSONRpcClient.Exception(status, statusText); - } - var obj; - try { - eval("obj = " + data); - } catch(e) { - throw new JSONRpcClient.Exception(550, "error parsing result"); - } - if(obj.error) - throw new JSONRpcClient.Exception(obj.error.code, obj.error.msg, - obj.error.trace); - var res = obj.result; - - /* Handle CallableProxy */ - if(res && res.objectID && res.JSONRPCType == "CallableReference") - return new JSONRpcClient(this.serverURL, this.user, - this.pass, res.objectID); - - return res; -}; - - -/* XMLHttpRequest wrapper code */ - -/* XMLHttpRequest pool globals */ -JSONRpcClient.http_spare = []; -JSONRpcClient.http_max_spare = 8; - -JSONRpcClient.poolGetHTTPRequest = -function JSONRpcClient_pool_getHTTPRequest() -{ - if(JSONRpcClient.http_spare.length > 0) { - return JSONRpcClient.http_spare.pop(); - } - return JSONRpcClient.getHTTPRequest(); -}; - -JSONRpcClient.poolReturnHTTPRequest = -function JSONRpcClient_poolReturnHTTPRequest(http) -{ - if(JSONRpcClient.http_spare.length >= JSONRpcClient.http_max_spare) - delete http; - else - JSONRpcClient.http_spare.push(http); -}; - -JSONRpcClient.msxmlNames = [ "MSXML2.XMLHTTP.5.0", - "MSXML2.XMLHTTP.4.0", - "MSXML2.XMLHTTP.3.0", - "MSXML2.XMLHTTP", - "Microsoft.XMLHTTP" ]; - -JSONRpcClient.getHTTPRequest = -function JSONRpcClient_getHTTPRequest() -{ - /* Mozilla XMLHttpRequest */ - try { - JSONRpcClient.httpObjectName = "XMLHttpRequest"; - return new XMLHttpRequest(); - } catch(e) {} - - /* Microsoft MSXML ActiveX */ - for (var i=0;i < JSONRpcClient.msxmlNames.length; i++) { - try { - JSONRpcClient.httpObjectName = JSONRpcClient.msxmlNames[i]; - return new ActiveXObject(JSONRpcClient.msxmlNames[i]); - } catch (e) {} - } - - /* None found */ - JSONRpcClient.httpObjectName = null; - throw new JSONRpcClient.Exception(0, "Can't create XMLHttpRequest object"); -}; - -bindingjsonrpc = "loaded";
\ No newline at end of file diff --git a/branches/sca-java-1.0.1/samples/store/src/main/resources/ufservices/store.html b/branches/sca-java-1.0.1/samples/store/src/main/resources/ufservices/store.html deleted file mode 100644 index 337588aa2c..0000000000 --- a/branches/sca-java-1.0.1/samples/store/src/main/resources/ufservices/store.html +++ /dev/null @@ -1,118 +0,0 @@ -<!-- - * 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="binding-atom.js"></script>
-<script type="text/javascript" src="binding-jsonrpc.js"></script>
-<script language="JavaScript">
-
- //Reference
- catalog = (new JSONRpcClient("../Catalog")).Catalog;
- //Reference
- shoppingCart = new AtomClient("../ShoppingCart");
-
-
- function catalog_getResponse(items) {
- var catalog = "";
- for (var i=0; i<items.length; i++)
- catalog += '<input name="items" type="checkbox" value="' +
- items[i] + '">' + items[i]+ ' <br>';
- document.getElementById('catalog').innerHTML=catalog;
- }
-
- function shoppingCart_getResponse(feed) {
- if (feed != null) {
- var entries = feed.getElementsByTagName("entry");
- var list = "";
- for (var i=0; i<entries.length; i++) {
- var item = entries[i].getElementsByTagName("content")[0].firstChild.nodeValue;
- list += item + ' <br>';
- }
- document.getElementById("shoppingCart").innerHTML = list;
- document.getElementById('total').innerHTML = feed.getElementsByTagName("subtitle")[0].firstChild.nodeValue;
- }
- }
- function shoppingCart_postResponse(entry) {
- shoppingCart.get("", shoppingCart_getResponse);
- }
-
-
- function addToCart() {
- var items = document.catalogForm.items;
- var j = 0;
- for (var i=0; i<items.length; i++)
- if (items[i].checked) {
- var entry = '<entry xmlns="http://www.w3.org/2005/Atom"><title>cart-item</title><content type="text">'+items[i].value+'</content></entry>'
- shoppingCart.post(entry, shoppingCart_postResponse);
- items[i].checked = false;
- }
- }
- function checkoutCart() {
- document.getElementById('store').innerHTML='<h2>' +
- 'Thanks for Shopping With Us!</h2>'+
- '<h2>Your Order</h2>'+
- '<form name="orderForm" action="/ufs/store.html">'+
- document.getElementById('shoppingCart').innerHTML+
- '<br>'+
- document.getElementById('total').innerHTML+
- '<br>'+
- '<br>'+
- '<input type="submit" value="Continue Shopping">'+
- '</form>';
- shoppingCart.delete("", null);
- }
- function deleteCart() {
- shoppingCart.delete("", null);
- document.getElementById('shoppingCart').innerHTML = "";
- document.getElementById('total').innerHTML = "";
- }
-
- catalog.get(catalog_getResponse);
-</script>
-
-<link rel="stylesheet" type="text/css" href="style.css" />
-</head>
-
-<body>
-<h1>Store</h1>
- <div id="store">
- <h2>Catalog</h2>
- <form name="catalogForm">
- <div id="catalog" ></div>
- <br>
- <input type="button" onClick="addToCart()" value="Add to Cart">
- </form>
-
- <br>
-
- <h2>Your Shopping Cart</h2> - <form name="shoppingCartForm">
- <div id="shoppingCart"></div>
- <br>
- <div id="total"></div>
- <br>
- <input type="button" onClick="checkoutCart()" value="Checkout">
- <input type="button" onClick="deleteCart()" value="Empty">
- <a href="../ShoppingCart/">(feed)</a> - </form>
- </div>
-</body>
-</html>
diff --git a/branches/sca-java-1.0.1/samples/store/store.png b/branches/sca-java-1.0.1/samples/store/store.png Binary files differdeleted file mode 100644 index da413edeee..0000000000 --- a/branches/sca-java-1.0.1/samples/store/store.png +++ /dev/null diff --git a/branches/sca-java-1.0.1/samples/store/store.svg b/branches/sca-java-1.0.1/samples/store/store.svg deleted file mode 100644 index 31a3038696..0000000000 --- a/branches/sca-java-1.0.1/samples/store/store.svg +++ /dev/null @@ -1,286 +0,0 @@ -<?xml version="1.0" encoding="UTF-8" standalone="no"?> -<!-- Created with Inkscape (http://www.inkscape.org/) --> -<svg - xmlns:dc="http://purl.org/dc/elements/1.1/" - xmlns:cc="http://web.resource.org/cc/" - xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" - xmlns:svg="http://www.w3.org/2000/svg" - xmlns="http://www.w3.org/2000/svg" - xmlns:xlink="http://www.w3.org/1999/xlink" - xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" - xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" - width="1052.3622" - height="744.09448" - id="svg2" - sodipodi:version="0.32" - inkscape:version="0.45.1" - sodipodi:docbase="C:\simon\tuscany\java-head\sca\samples\store" - sodipodi:docname="store.svg" - version="1.0" - inkscape:output_extension="org.inkscape.output.svg.inkscape" - inkscape:export-filename="C:\simon\tuscany\java-head\sca\samples\store\store.png" - inkscape:export-xdpi="52.84" - inkscape:export-ydpi="52.84"> - <defs - id="defs4" /> - <sodipodi:namedview - id="base" - pagecolor="#ffffff" - bordercolor="#666666" - borderopacity="1.0" - gridtolerance="10000" - guidetolerance="10" - objecttolerance="10" - inkscape:pageopacity="0.0" - inkscape:pageshadow="2" - inkscape:zoom="1.4" - inkscape:cx="538.06165" - inkscape:cy="341.69129" - inkscape:document-units="px" - inkscape:current-layer="g2997" - inkscape:window-width="1466" - inkscape:window-height="831" - inkscape:window-x="117" - inkscape:window-y="80" /> - <metadata - id="metadata7"> - <rdf:RDF> - <cc:Work - rdf:about=""> - <dc:format>image/svg+xml</dc:format> - <dc:type - rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> - </cc:Work> - </rdf:RDF> - </metadata> - <g - inkscape:label="Layer 1" - inkscape:groupmode="layer" - id="layer1"> - <g - id="g2997"> - <rect - rx="14.335117" - ry="17.743465" - y="197.1973" - x="447.35422" - height="419.39099" - width="464.23727" - id="rect2067" - style="opacity:1;fill:#90baf4;fill-opacity:1;stroke:#060000;stroke-width:2.28840661;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" /> - <flowRoot - id="flowRoot2954" - xml:space="preserve" - transform="translate(189.90868,1.0101522)"><flowRegion - id="flowRegion2956"><rect - y="212.66591" - x="281.42856" - height="61.42857" - width="170" - id="rect2958" /></flowRegion><flowPara - id="flowPara2171">store</flowPara></flowRoot> <rect - style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2.30182266;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" - id="rect2175" - width="118.21779" - height="111.27543" - x="491.60019" - y="247.75989" - rx="7.1507306" - ry="9.2311935" /> - <flowRoot - xml:space="preserve" - id="flowRoot2177" - transform="translate(223.8585,41.670449)"><flowRegion - id="flowRegion2179"><rect - id="rect2181" - width="170" - height="61.42857" - x="281.42856" - y="212.66591" /></flowRegion><flowPara - id="flowPara2183">ufs</flowPara></flowRoot> <path - style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - d="M 474.29877,279.45598 L 507.63381,279.45598 L 513.69472,292.58796 L 506.62366,304.7098 L 474.29877,304.7098 L 481.87492,292.58796 L 474.29877,279.45598 z " - id="path2187" /> - <rect - style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" - id="rect2191" - width="115.66247" - height="85.862968" - x="493.07068" - y="503.27759" - rx="6.9961648" - ry="7.1230249" /> - <flowRoot - xml:space="preserve" - id="flowRoot2193" - transform="translate(225.47992,297.33908)"><flowRegion - id="flowRegion2195"><rect - id="rect2197" - width="170" - height="61.42857" - x="281.42856" - y="212.66591" /></flowRegion><flowPara - id="flowPara2199">ShoppingCart</flowPara></flowRoot> <path - style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - d="M 475.92019,535.12461 L 509.25523,535.12461 L 515.31614,548.25659 L 508.24508,560.37843 L 475.92019,560.37843 L 483.49634,548.25659 L 475.92019,535.12461 z " - id="path2203" /> - <rect - style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" - id="rect2207" - width="115.66247" - height="85.862968" - x="761.44415" - y="391.31604" - rx="6.9961648" - ry="7.1230249" /> - <flowRoot - xml:space="preserve" - id="flowRoot2209" - transform="translate(487.8534,185.37751)"><flowRegion - id="flowRegion2211"><rect - id="rect2213" - width="170" - height="61.42857" - x="281.42856" - y="212.66591" /></flowRegion><flowPara - id="flowPara2215">CurrencyConverter</flowPara></flowRoot> <path - style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - d="M 744.29367,423.16304 L 777.62871,423.16304 L 783.68962,436.29502 L 776.61856,448.41686 L 744.29367,448.41686 L 751.86982,436.29502 L 744.29367,423.16304 z " - id="path2219" /> - <rect - style="opacity:1;fill:#0064ff;fill-opacity:1;stroke:#000000;stroke-width:0.9612025;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" - id="rect2223" - width="104.08451" - height="113.17588" - x="138.37151" - y="350.1156" - rx="0" - ry="0.048917599" /> - <path - style="fill:#1a73fe;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;fill-opacity:1" - d="M 138.21429,462.66591 L 115.35714,479.80877 L 267.85714,479.80877 L 241.78571,463.02305 L 138.21429,462.66591 z " - id="path3197" /> - <rect - style="opacity:1;fill:#f1f4f8;fill-opacity:1;stroke:#000000;stroke-width:1;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" - id="rect3199" - width="92.5" - height="97.14286" - x="143.57143" - y="358.38019" - ry="3.6203461" - rx="3.9285715" /> - <image - y="366.6889" - x="156.24066" - id="image3323" - height="78.571434" - width="58.57143" - sodipodi:absref="C:\simon\tuscany\evangelism\whitepapers\shoppingcart.png" - xlink:href="C:\simon\tuscany\evangelism\whitepapers\shoppingcart.png" /> - <image - y="270.52304" - x="526.42859" - id="image3342" - height="78.571434" - width="58.57143" - sodipodi:absref="C:\simon\tuscany\evangelism\whitepapers\shoppingcart.png" - xlink:href="C:\simon\tuscany\evangelism\whitepapers\shoppingcart.png" /> - <path - style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - d="M 242.85714,374.80877 C 245.71429,374.80877 345.71429,374.80877 345.71429,374.80877 L 345.71429,291.95162 L 481.42858,291.95162" - id="path3348" - sodipodi:nodetypes="cccc" /> - <path - style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - d="M 210.71429,406.95163 L 345,406.95163 L 345,437.66591 L 481.42857,437.66591" - id="path3350" - sodipodi:nodetypes="cccc" /> - <path - style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - d="M 210.71429,439.09448 L 325.71429,439.09448 L 325.71429,548.3802 L 482.85714,548.3802" - id="path3352" - sodipodi:nodetypes="cccc" /> - <path - style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - d="M 626.42857,436.23734 C 750,437.66591 752.14286,436.23734 752.14286,436.23734" - id="path3354" - sodipodi:nodetypes="cc" /> - <flowRoot - xml:space="preserve" - id="flowRoot3356" - transform="translate(-94.285714,25)"><flowRegion - id="flowRegion3358"><rect - id="rect3360" - width="142.14285" - height="21.428572" - x="655" - y="349.80878" /></flowRegion><flowPara - id="flowPara3362">CurrenyCode</flowPara></flowRoot> <flowRoot - xml:space="preserve" - id="flowRoot3364" - transform="translate(-250.76562,-76.210859)"><flowRegion - id="flowRegion3366"><rect - id="rect3368" - width="142.14285" - height="21.428572" - x="655" - y="349.80878" /></flowRegion><flowPara - id="flowPara3370">HTTP</flowPara></flowRoot> <flowRoot - xml:space="preserve" - id="flowRoot3372" - transform="translate(-273.62277,70.931998)"><flowRegion - id="flowRegion3374"><rect - id="rect3376" - width="142.14285" - height="21.428572" - x="655" - y="349.80878" /></flowRegion><flowPara - id="flowPara3378">JSONRPC</flowPara></flowRoot> <flowRoot - xml:space="preserve" - id="flowRoot3380" - transform="translate(-243.62277,183.07485)"><flowRegion - id="flowRegion3382"><rect - id="rect3384" - width="142.14285" - height="21.428572" - x="655" - y="349.80878" /></flowRegion><flowPara - id="flowPara3386">Atom</flowPara></flowRoot> </g> - <rect - style="fill:#317fed;fill-opacity:1;stroke:#060000;stroke-width:2;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" - id="rect2988" - width="115.66247" - height="85.862968" - x="491.56897" - y="392.70135" - rx="6.9961648" - ry="7.1230249" /> - <flowRoot - xml:space="preserve" - id="flowRoot2966" - transform="translate(223.97819,186.76283)"><flowRegion - id="flowRegion2968"><rect - id="rect2970" - width="170" - height="61.42857" - x="281.42856" - y="212.66591" /></flowRegion><flowPara - id="flowPara2972">Catalog</flowPara></flowRoot> <rect - style="opacity:1;fill:#fff62c;fill-opacity:1;stroke:#060000;stroke-width:1;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1" - id="rect3006" - width="21.718224" - height="20.708065" - x="537.53094" - y="377.04398" - rx="10.859112" - ry="0" /> - <path - style="fill:#5b9d05;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - d="M 474.41846,424.54836 L 507.7535,424.54836 L 513.81441,437.68034 L 506.74335,449.80218 L 474.41846,449.80218 L 481.99461,437.68034 L 474.41846,424.54836 z " - id="path3017" /> - <path - style="fill:#ae62bf;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" - d="M 587.6709,422.71008 L 621.00594,422.71008 L 627.06685,435.84206 L 619.99579,447.9639 L 587.6709,447.9639 L 595.24705,435.84206 L 587.6709,422.71008 z " - id="path3019" /> - </g> -</svg> |