diff options
author | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:07:45 +0000 |
---|---|---|
committer | lresende <lresende@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-11 23:07:45 +0000 |
commit | 6a3ca6736c808c1647854e405ef379b609f276db (patch) | |
tree | 67670193d3511b227100419589d0f2ec0bb02cc0 /sca-java-1.x/branches/sca-java-1.2.1/tutorial | |
parent | 9f395ebf3ec27f89c8dc63137bc99c8d6b0cff6d (diff) |
Moving 1.x branches
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@835126 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-1.x/branches/sca-java-1.2.1/tutorial')
88 files changed, 5406 insertions, 0 deletions
diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/README b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/README new file mode 100644 index 0000000000..f22aaa8108 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/README @@ -0,0 +1,29 @@ +Store Tutorial +====================================== + +This is a tutorial that shows how to use SCA and Tuscany to build multiple +variations of an online Store application. + +For an overview of the scenarios covered here, please refer to Tutorial.pdf. + +For more detailed information, please see: + +http://incubator.apache.org/tuscany/sca-java-tutorial.html + + +Running The Tutorial Application +-------------------------------- + +Start the SCA Domain Manager: + cd domain + java -jar ../../modules/tuscany-node2-launcher-1.2.1-incubating.jar domain + +To access the SCA Manager application, point your Web browser to: + http://localhost:9990/ui/cloud/ + +Select the node you want to start (e.g StoreNode), then click the Start button. + +You should now be able to access the online Store application. Point your Web +browser to: + http://localhost:8100/ui/ + diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/Tutorial.pdf b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/Tutorial.pdf Binary files differnew file mode 100644 index 0000000000..e22f1b4c9d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/Tutorial.pdf diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..07e5cebab8 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ +<?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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0"> + <export.java package="services"/> + <export.java package="services.merger"/> + <export.java package="services.db"/> + <export.resource uri="uiservices/store.html"/> +</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/pom.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/pom.xml new file mode 100644 index 0000000000..c8392fcf85 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/pom.xml @@ -0,0 +1,88 @@ +<?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-tutorial</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>tutorial-assets</artifactId> + <name>Apache Tuscany SCA Tutorial Reusable Assets</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-sca-api</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-data-api</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <version>10.1.2.1</version> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <sourceDirectory>${basedir}</sourceDirectory> + <resources> + <resource> + <directory>${basedir}</directory> + <excludes> + <exclude>**/*.java</exclude> + <exclude>**/.*/**</exclude> + <exclude>pom.xml</exclude> + <exclude>build.xml</exclude> + </excludes> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-maven-ant-generator</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <executions> + <execution> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/Cart.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/Cart.java new file mode 100644 index 0000000000..916b8b46d2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/Cart.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services; + +import org.apache.tuscany.sca.implementation.data.collection.Collection; +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface Cart extends Collection<String, Item> { + +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/Catalog.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/Catalog.java new file mode 100644 index 0000000000..2c3b19f579 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/Catalog.java @@ -0,0 +1,27 @@ +/* + * 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 { + Item[] get(); +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/CurrencyConverter.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/CurrencyConverter.java new file mode 100644 index 0000000000..e104a0423a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/CurrencyConverter.java @@ -0,0 +1,29 @@ +/* + * 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 double getConversion(String fromCurrenycCode, String toCurrencyCode, double amount); + + public String getCurrencySymbol(String currencyCode); +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/CurrencyConverterImpl.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/CurrencyConverterImpl.java new file mode 100644 index 0000000000..c354aed447 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/CurrencyConverterImpl.java @@ -0,0 +1,38 @@ +/* + * 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 double getConversion(String fromCurrencyCode, String toCurrencyCode, double amount) { + if (toCurrencyCode.equals("USD")) + return amount; + else if (toCurrencyCode.equals("EUR")) + return ((double)Math.round(amount * 0.7256 * 100)) /100; + return 0; + } + + public String getCurrencySymbol(String currencyCode) { + if (currencyCode.equals("USD")) + return "$"; + else if (currencyCode.equals("EUR")) + return "E"; //"€"; + return "?"; + } +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/FruitsCatalogImpl.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/FruitsCatalogImpl.java new file mode 100644 index 0000000000..377b3d7e59 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/FruitsCatalogImpl.java @@ -0,0 +1,52 @@ +/* + * 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 FruitsCatalogImpl implements Catalog { + + @Property + public String currencyCode = "USD"; + + @Reference + public CurrencyConverter currencyConverter; + + private List<Item> catalog = new ArrayList<Item>(); + + @Init + public void init() { + String currencySymbol = currencyConverter.getCurrencySymbol(currencyCode); + catalog.add(new Item("Apple", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 2.99))); + catalog.add(new Item("Orange", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 3.55))); + catalog.add(new Item("Pear", currencySymbol + currencyConverter.getConversion("USD", currencyCode, 1.55))); + } + + public Item[] get() { + Item[] catalogArray = new Item[catalog.size()]; + catalog.toArray(catalogArray); + return catalogArray; + } +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/Item.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/Item.java new file mode 100644 index 0000000000..27abd4f016 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/Item.java @@ -0,0 +1,51 @@ +/* + * 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 Item { + private String name; + private String price; + + public Item() { + } + + public Item(String name, String price) { + this.name = name; + this.price = price; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPrice() { + return price; + } + + public void setPrice(String price) { + this.price = price; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/ShoppingCartImpl.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/ShoppingCartImpl.java new file mode 100644 index 0000000000..d04fffe6f1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/ShoppingCartImpl.java @@ -0,0 +1,112 @@ +/* + * 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.HashMap; +import java.util.List; +import java.util.Map; +import java.util.UUID; + +import org.apache.tuscany.sca.implementation.data.collection.Entry; +import org.apache.tuscany.sca.implementation.data.collection.NotFoundException; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; + +@Scope("COMPOSITE") +public class ShoppingCartImpl implements Cart, Total { + + private Map<String, Item> cart; + + @Init + protected void init() { + cart = new HashMap<String, Item>(); + } + + public Entry<String, Item>[] getAll() { + Entry<String, Item>[] entries = new Entry[cart.size()]; + int i = 0; + for (Map.Entry<String, Item> e: cart.entrySet()) { + entries[i++] = new Entry<String, Item>(e.getKey(), e.getValue()); + } + return entries; + } + + public Item get(String key) throws NotFoundException { + Item item = cart.get(key); + if (item == null) { + throw new NotFoundException(key); + } else { + return item; + } + } + + public String post(String key, Item item) { + if (key == null) { + key ="cart-" + UUID.randomUUID().toString(); + } + cart.put(key, item); + return key; + } + + public void put(String key, Item item) throws NotFoundException { + if (!cart.containsKey(key)) { + throw new NotFoundException(key); + } + cart.put(key, item); + } + + public void delete(String key) throws NotFoundException { + if (key == null || key.equals("")) { + cart.clear(); + } else { + Item item = cart.remove(key); + if (item == null) + throw new NotFoundException(key); + } + } + + public Entry<String, Item>[] query(String queryString) { + List<Entry<String, Item>> entries = new ArrayList<Entry<String,Item>>(); + if (queryString.startsWith("name=")) { + String name = queryString.substring(5); + for (Map.Entry<String, Item> e: cart.entrySet()) { + Item item = e.getValue(); + if (item.getName().equals(name)) { + entries.add(new Entry<String, Item>(e.getKey(), e.getValue())); + } + } + } + return entries.toArray(new Entry[entries.size()]); + } + + public String getTotal() { + double total = 0; + String currencySymbol = ""; + if (!cart.isEmpty()) { + Item item = cart.values().iterator().next(); + currencySymbol = item.getPrice().substring(0, 1); + } + for (Item item : cart.values()) { + total += Double.valueOf(item.getPrice().substring(1)); + } + return currencySymbol + String.valueOf(total); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/Total.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/Total.java new file mode 100644 index 0000000000..8f464e526f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/Total.java @@ -0,0 +1,29 @@ +/* + * 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 Total { + + String getTotal(); + +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/VegetablesCatalogImpl.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/VegetablesCatalogImpl.java new file mode 100644 index 0000000000..8bfbc757db --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/VegetablesCatalogImpl.java @@ -0,0 +1,42 @@ +/* + * 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; + +public class VegetablesCatalogImpl implements Catalog { + private List<Item> catalog = new ArrayList<Item>(); + + @Init + public void init() { + catalog.add(new Item("Broccoli", "$2.99")); + catalog.add(new Item("Asparagus", "$3.55")); + catalog.add(new Item("Cauliflower", "$1.55")); + } + + public Item[] get() { + Item[] catalogArray = new Item[catalog.size()]; + catalog.toArray(catalogArray); + return catalogArray; + } +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/db/ShoppingCartTableImpl.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/db/ShoppingCartTableImpl.java new file mode 100644 index 0000000000..7b81d1d32f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/db/ShoppingCartTableImpl.java @@ -0,0 +1,159 @@ +/* + * 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.db; + +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; +import java.util.UUID; + +import org.apache.tuscany.sca.implementation.data.collection.Entry; +import org.apache.tuscany.sca.implementation.data.collection.NotFoundException; +import org.osoa.sca.ServiceRuntimeException; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Property; + +import services.Cart; +import services.Item; +import services.Total; + +public class ShoppingCartTableImpl implements Cart, Total { + + @Property + public String database; + + private Connection connection; + + @Init + public void init() throws Exception { + Class.forName("org.apache.derby.jdbc.EmbeddedDriver", true, getClass().getClassLoader()); + connection = DriverManager.getConnection("jdbc:derby:" + database, "", ""); + } + + public Entry<String, Item>[] getAll() { + try { + Statement statement = connection.createStatement(); + ResultSet results = statement.executeQuery("select * from Cart"); + List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>(); + while (results.next()) { + Item item = new Item(results.getString("name"), results.getString("price")); + entries.add(new Entry<String, Item>(results.getString("id"), item)); + } + return entries.toArray(new Entry[entries.size()]); + } catch (SQLException e) { + throw new ServiceRuntimeException(e); + } + } + + public Item get(String key) throws NotFoundException { + try { + Statement statement = connection.createStatement(); + ResultSet results = statement.executeQuery("select * from Cart where id = '" + key + "'"); + if (results.next()) { + return new Item(results.getString("name"), results.getString("price")); + } else { + throw new NotFoundException(key); + } + } catch (SQLException e) { + throw new ServiceRuntimeException(e); + } + } + + public String post(String key, Item item) { + if (key == null) { + key = "cart-" + UUID.randomUUID().toString(); + } + try { + Statement statement = connection.createStatement(); + String query = "insert into Cart values ('" + key + "', '" + item.getName() + "', '" + item.getPrice() + "')"; + System.out.println(query); + statement.executeUpdate(query); + } catch (SQLException e) { + throw new ServiceRuntimeException(e); + } + return key; + } + + public void put(String key, Item item) throws NotFoundException { + try { + Statement statement = connection.createStatement(); + String query = "update into Cart set name = '" + item.getName() + "', price = '" + item.getPrice() + "' where id = '" + key + "'"; + System.out.println(query); + int count = statement.executeUpdate(query); + if (count == 0) + throw new NotFoundException(key); + } catch (SQLException e) { + throw new ServiceRuntimeException(e); + } + } + + public void delete(String key) throws NotFoundException { + try { + Statement statement = connection.createStatement(); + if (key == null || key.equals("")) { + String query = "delete from Cart"; + System.out.println(query); + statement.executeUpdate(query); + } else { + String query = "delete from Cart where id = '" + key + "'"; + System.out.println(query); + int count = statement.executeUpdate(query); + if (count == 0) + throw new NotFoundException(key); + } + } catch (SQLException e) { + throw new ServiceRuntimeException(e); + } + } + + public Entry<String, Item>[] query(String queryString) { + try { + Statement statement = connection.createStatement(); + ResultSet results = statement.executeQuery("select * from Cart where " + queryString); + List<Entry<String, Item>> entries = new ArrayList<Entry<String, Item>>(); + while (results.next()) { + Item item = new Item(results.getString("name"), results.getString("price")); + entries.add(new Entry<String, Item>(results.getString("id"), item)); + } + return entries.toArray(new Entry[entries.size()]); + } catch (SQLException e) { + throw new ServiceRuntimeException(e); + } + } + + public String getTotal() { + Entry<String, Item>[] entries = getAll(); + double total = 0; + String currencySymbol = ""; + if (entries.length > 0) { + Item item = entries[0].getData(); + currencySymbol = item.getPrice().substring(0, 1); + } + for (Entry<String, Item> entry : entries) { + Item item = entry.getData(); + total += Double.valueOf(item.getPrice().substring(1)); + } + return currencySymbol + total; + } +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/db/cart.sql b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/db/cart.sql new file mode 100644 index 0000000000..25f16cb36b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/db/cart.sql @@ -0,0 +1,27 @@ +--
+-- 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 CART;
+
+CREATE TABLE CART(
+ id VARCHAR(50) NOT NULL,
+ name VARCHAR(50),
+ price VARCHAR(10),
+ primary key (id)
+);
diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/merger/MergedCatalogImpl.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/merger/MergedCatalogImpl.java new file mode 100644 index 0000000000..c02b4e821e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/services/merger/MergedCatalogImpl.java @@ -0,0 +1,66 @@ +/* + * 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.merger; + +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; + +import services.Catalog; +import services.CurrencyConverter; +import services.Item; + +public class MergedCatalogImpl implements Catalog { + + @Property + public String currencyCode = "USD"; + + @Reference + public CurrencyConverter currencyConverter; + + @Reference + public Catalog fruitsCatalog; + + @Reference + public Catalog vegetablesCatalog; + + public Item[] get() { + String currencySymbol = currencyConverter.getCurrencySymbol(currencyCode); + + Item[] fruits = fruitsCatalog.get(); + Item[] vegetables = vegetablesCatalog.get(); + + Item[] catalog = new Item[fruits.length + vegetables.length]; + int i =0; + for (Item item: fruits) { + double price = Double.valueOf(item.getPrice().substring(1)); + price = currencyConverter.getConversion("USD", currencyCode, price); + catalog[i++] = new Item(item.getName(), currencySymbol + price); + } + + for (Item item: vegetables) { + double price = Double.valueOf(item.getPrice().substring(1)); + price = currencyConverter.getConversion("USD", currencyCode, price); + catalog[i++] = new Item(item.getName(), currencySymbol + price); + } + + return catalog; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/tutorial.html b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/tutorial.html new file mode 100644 index 0000000000..0b5fcadc71 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/tutorial.html @@ -0,0 +1,35 @@ +<html> +<!-- + * 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. + --> +<head> +<title>Apache Tuscany - Online Store Tutorial</title> +</head> + +<body> +<h1>Apache Tuscany - Online Store Tutorial +<h2><a href="http://localhost:9990/ui/home">Online Store - SCA Domain</a> +<h2><a href="http://localhost:8100/ui/store.html">Online Store - Fruits</a> +<h2><a href="http://localhost:8200/VegetablesCatalogWebService?wsdl">Vegetables Catalog Web Service</a> +<h2><a href="http://localhost:8101/ui/store.html">Merger - Fruits and Vegetables</a> +<h2><a href="http://localhost:8102/ui/store.html">Online Store - Cart Database</a> +<h2><a href="http://localhost:8103/ui/store.html">Online Store - Supplier</a> +<h2><a href="http://localhost:8333/CatalogWebService?wsdl">Merged Catalog Web Service</a> +<h2><a href="http://localhost:8104/ui/store-eu.html">EU Online Store</a> +</body> +</html>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/uiservices/store.html b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/uiservices/store.html new file mode 100644 index 0000000000..095570f949 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/assets/uiservices/store.html @@ -0,0 +1,141 @@ +<!-- + * 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="store.js"></script> + +<script language="JavaScript"> + + //@Reference + var catalog = new Reference("catalog"); + + //@Reference + var shoppingCart = new Reference("shoppingCart"); + + //@Reference + var shoppingTotal = new Reference("shoppingTotal"); + + var catalogItems; + + function catalog_getResponse(items) { + var catalog = ""; + for (var i=0; i<items.length; i++) { + var item = items[i].name + ' - ' + items[i].price; + catalog += '<input name="items" type="checkbox" value="' + + item + '">' + item + ' <br>'; + } + document.getElementById('catalog').innerHTML=catalog; + catalogItems = items; + } + + function shoppingCart_getResponse(feed) { + if (feed != null) { + var entries = feed.getElementsByTagName("entry"); + var list = ""; + for (var i=0; i<entries.length; i++) { + var content = entries[i].getElementsByTagName("content")[0]; + var name = content.getElementsByTagName("name")[0].firstChild.nodeValue; + var price = content.getElementsByTagName("price")[0].firstChild.nodeValue; + list += name + ' - ' + price + ' <br>'; + } + document.getElementById("shoppingCart").innerHTML = list; + + if (entries.length != 0) { + shoppingTotal.getTotal(shoppingTotal_getTotalResponse); + } + } + } + + function shoppingTotal_getTotalResponse(total) { + document.getElementById('total').innerHTML = total; + } + + 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>item</title><content type="text/xml">' + + '<Item xmlns="http://services/">' + + '<name xmlns="">' + catalogItems[i].name + '</name>' + '<price xmlns="">' + catalogItems[i].price + '</price>' + + '</Item>' + '</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">'+ + document.getElementById('shoppingCart').innerHTML+ + '<br>'+ + document.getElementById('total').innerHTML+ + '<br>'+ + '<br>'+ + '<input type="submit" value="Continue Shopping">'+ + '</form>'; + shoppingCart.del("", null); + } + function deleteCart() { + shoppingCart.del("", null); + document.getElementById('shoppingCart').innerHTML = ""; + document.getElementById('total').innerHTML = ""; + } + + function init() { + catalog.get(catalog_getResponse); + shoppingCart.get("", shoppingCart_getResponse); + } + +</script> + +</head> + +<body onload="init()"> +<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/Cart/">(feed)</a> + </form> + </div> +</body> +</html> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/pom.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/pom.xml new file mode 100644 index 0000000000..f4f69c05c3 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/pom.xml @@ -0,0 +1,106 @@ +<?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 xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-tutorial</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + + <artifactId>tutorial-catalog-ejb</artifactId> + <name>Apache Tuscany SCA Tutorial Catalog EJB</name> + <packaging>jar</packaging> + + <dependencies> + <dependency> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-ejb_3.0_spec</artifactId> + <version>1.0</version> + <scope>provided</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.2</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.geronimo.modules</groupId> + <artifactId>geronimo-openejb</artifactId> + <version>2.0.2</version> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>org.apache.geronimo.modules</groupId> + <artifactId>geronimo-connector</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.geronimo.modules</groupId> + <artifactId>geronimo-persistence-jpa10</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.openejb</groupId> + <artifactId>openejb-ejbd</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.openejb</groupId> + <artifactId>openejb-server</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.openejb</groupId> + <artifactId>openejb-loader</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.openejb</groupId> + <artifactId>openejb-jee</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.openejb</groupId> + <artifactId>openejb-ejbd</artifactId> + </exclusion> + <exclusion> + <groupId>org.apache.openejb</groupId> + <artifactId>openejb-javaagent</artifactId> + </exclusion> + </exclusions> + </dependency> + + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <resources> + <resource> + <directory>${pom.basedir}/src/main/resources</directory> + <filtering>true</filtering> + </resource> + </resources> + </build> + +</project> + diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBHome.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBHome.java new file mode 100644 index 0000000000..c7ad31b682 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBHome.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services.ejb; + +import javax.ejb.EJBHome; + +public interface CatalogEJBHome extends EJBHome { + + CatalogEJBRemote create() throws javax.ejb.CreateException, java.rmi.RemoteException; + +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBRemote.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBRemote.java new file mode 100644 index 0000000000..7e79fc8b9d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/java/services/ejb/CatalogEJBRemote.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package services.ejb; + +import java.rmi.RemoteException; + +import javax.ejb.EJBObject; + +public interface CatalogEJBRemote extends EJBObject { + Vegetable[] get() throws RemoteException; +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/java/services/ejb/Vegetable.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/java/services/ejb/Vegetable.java new file mode 100644 index 0000000000..aab567a82e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/java/services/ejb/Vegetable.java @@ -0,0 +1,54 @@ +/* + * 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.ejb; + +import java.io.Serializable; + +public class Vegetable implements Serializable { + private static final long serialVersionUID = -5847326138627338217L; + + private String name; + private String price; + + public Vegetable() { + } + + public Vegetable(String name, String price) { + this.name = name; + this.price = price; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getPrice() { + return price; + } + + public void setPrice(String price) { + this.price = price; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/java/services/ejb/VegetablesCatalogEJBSessionBean.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/java/services/ejb/VegetablesCatalogEJBSessionBean.java new file mode 100644 index 0000000000..74b7e407ef --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/java/services/ejb/VegetablesCatalogEJBSessionBean.java @@ -0,0 +1,58 @@ +/* + * 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.ejb; + +import java.rmi.RemoteException; +import java.util.ArrayList; +import java.util.List; + +import javax.ejb.EJBException; +import javax.ejb.SessionBean; +import javax.ejb.SessionContext; + +public class VegetablesCatalogEJBSessionBean implements SessionBean { + private static final long serialVersionUID = -7421020241291271838L; + + private List<Vegetable> catalog = new ArrayList<Vegetable>(); + + public VegetablesCatalogEJBSessionBean() { + catalog.add(new Vegetable("Broccoli", "$2.99")); + catalog.add(new Vegetable("Asparagus", "$3.55")); + catalog.add(new Vegetable("Cauliflower", "$1.55")); + } + + public Vegetable[] get() { + Vegetable[] catalogArray = new Vegetable[catalog.size()]; + catalog.toArray(catalogArray); + return catalogArray; + } + + public void ejbActivate() throws EJBException, RemoteException { + } + + public void ejbPassivate() throws EJBException, RemoteException { + } + + public void ejbRemove() throws EJBException, RemoteException { + } + + public void setSessionContext(SessionContext arg0) throws EJBException, RemoteException { + } +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/resources/META-INF/ejb-jar.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/resources/META-INF/ejb-jar.xml new file mode 100644 index 0000000000..a0a7adf6fa --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/resources/META-INF/ejb-jar.xml @@ -0,0 +1,35 @@ +<?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. +--> +<ejb-jar xmlns="http://java.sun.com/xml/ns/j2ee" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee + http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd" + version="2.1"> + + <display-name>Apache Tuscany SCA Tutorial Catalog EJB</display-name> + <enterprise-beans> + <session id="VegetablesCatalogEJB"> + <ejb-name>VegetablesCatalogEJB</ejb-name> + <home>services.ejb.CatalogEJBHome</home> + <remote>services.ejb.CatalogEJBRemote</remote> + <ejb-class>services.ejb.VegetablesCatalogEJBSessionBean</ejb-class> + <session-type>Stateless</session-type> + <transaction-type>Container</transaction-type> + </session> + </enterprise-beans> +</ejb-jar> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/resources/META-INF/openejb-jar.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/resources/META-INF/openejb-jar.xml new file mode 100644 index 0000000000..bc1c3d5fce --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/resources/META-INF/openejb-jar.xml @@ -0,0 +1,78 @@ +<?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. +--> +<openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1" + xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2"> + <sys:environment> + <sys:moduleId> + <sys:groupId>${pom.groupId}</sys:groupId> + <sys:artifactId>${pom.artifactId}</sys:artifactId> + <sys:version>${version}</sys:version> + <sys:type>jar</sys:type> + </sys:moduleId> + <sys:dependencies> + <sys:dependency> + <sys:groupId>org.apache.geronimo.configs</sys:groupId> + <sys:artifactId>j2ee-corba-yoko</sys:artifactId> + <!-- + <sys:version>2.0.2</sys:version> + --> + <sys:type>car</sys:type> + </sys:dependency> + </sys:dependencies> + <sys:hidden-classes /> + <sys:non-overridable-classes /> + </sys:environment> + + <enterprise-beans> + <session> + <ejb-name>VegetablesCatalogEJB</ejb-name> + <jndi-name>VegetablesCatalogEJB</jndi-name> + <tss-link>IdentityTokenNoSecurity</tss-link> + </session> + </enterprise-beans> + + <!-- + NOTE: for geronimo 2.0.2, please make sure the following system module is started + before the deployment of the EJB jar + org.apache.geronimo.configs/openejb-corba-deployer/2.0.2/car + --> + <gbean name="IdentityTokenNoSecurity" class="org.apache.geronimo.corba.TSSBean"> + <attribute name="POAName">IdentityTokenNoSecurity</attribute> + <reference name="Server"> + <name>UnprotectedServer</name> + </reference> + <xml-attribute name="tssConfig"> + <tss:tss xmlns:tss="http://openejb.apache.org/xml/ns/corba-tss-config-2.1" + xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.2"> + <tss:compoundSecMechTypeList> + <tss:compoundSecMech> + <tss:sasMech> + <tss:identityTokenTypes> + <tss:ITTAnonymous /> + <tss:ITTPrincipalNameGSSUP + principal-class="org.apache.geronimo.security.realm.providers.GeronimoUserPrincipal" /> + <tss:ITTDistinguishedName /> + <tss:ITTX509CertChain /> + </tss:identityTokenTypes> + </tss:sasMech> + </tss:compoundSecMech> + </tss:compoundSecMechTypeList> + </tss:tss> + </xml-attribute> + </gbean> +</openejb-jar> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/resources/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/resources/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..85e14d652c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/resources/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:c="http://catalog"> + <export.java package="services.ejb"/> + <deployable composite="c:catalog-ejb"/> +</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/resources/VegetablesCatalogEJB.componentType b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/resources/VegetablesCatalogEJB.componentType new file mode 100644 index 0000000000..bc57b35e79 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/resources/VegetablesCatalogEJB.componentType @@ -0,0 +1,26 @@ +<?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. +--> +<componentType xmlns="http://www.osoa.org/xmlns/sca/1.0"> + + <service name="CatalogEJB"> + <interface.java interface="services.ejb.CatalogEJBRemote"/> + </service> + +</componentType> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/resources/catalog-ejb.composite b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/resources/catalog-ejb.composite new file mode 100644 index 0000000000..d8ca5c87e4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/main/resources/catalog-ejb.composite @@ -0,0 +1,31 @@ +<?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" + targetNamespace="http://catalog" + name="catalog-ejb"> + + <component name="VegetablesCatalogEJB"> + <implementation.ejb ejb-link="tutorial-catalog-ejb.jar#VegetablesCatalogEJB"/> + <service name="CatalogEJB"> + <binding.ejb uri="corbaname:iiop:1.2@localhost:1050#VegetablesCatalogEJB"/> + </service> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/test/java/client/CatalogEJBClientTestCase.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/test/java/client/CatalogEJBClientTestCase.java new file mode 100644 index 0000000000..f9bd16f050 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/test/java/client/CatalogEJBClientTestCase.java @@ -0,0 +1,67 @@ +/* + * 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 client; + +import javax.naming.InitialContext; +import javax.rmi.PortableRemoteObject; + +import org.junit.Ignore; +import org.junit.Test; + +import services.ejb.CatalogEJBHome; +import services.ejb.CatalogEJBRemote; +import services.ejb.Vegetable; + +/** + * A test client for the catalog EJB. + * + * @version $Rev$ $Date$ + */ +public class CatalogEJBClientTestCase { + + @Test + @Ignore // Ignore the test case for maven build, remove it if you want to run + public void testCatalogEJB() throws Exception { + InitialContext context = new InitialContext(); + + Object o = context.lookup("corbaname:iiop:1.2@localhost:1050#VegetablesCatalogEJB"); + + // The narrow(...) call requires generated EJB stubs. Tuscany binding.ejb doesn't the stubs + CatalogEJBHome home = (CatalogEJBHome)PortableRemoteObject.narrow(o, CatalogEJBHome.class); + + // The following call will hang with SUN jdk1.6.0_05, please use SUN or IBM jdk 1.5.x instead + CatalogEJBRemote catalog = home.create(); + + Vegetable items[] = catalog.get(); + for (Vegetable item : items) { + System.out.println(item.getName() + " " + item.getPrice()); + } + } + + public static void main(String args[]) throws Exception { + String javaVersion = System.getProperty("java.version"); + String javaVendor = System.getProperty("java.vendor"); + + if (javaVendor.toUpperCase().contains("SUN") && javaVersion.startsWith("1.6.")) { + System.err.println("The EJB invocation may hang due to a bug in " + javaVendor + ":" + javaVersion); + } + new CatalogEJBClientTestCase().testCatalogEJB(); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_EJBHome_Stub.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_EJBHome_Stub.java new file mode 100644 index 0000000000..6930093042 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_EJBHome_Stub.java @@ -0,0 +1,223 @@ +/* + * 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. + */ +// Stub class generated by rmic, do not edit. +// Contents subject to change without notice. + +package org.omg.stub.javax.ejb; + +import java.rmi.RemoteException; +import java.rmi.UnexpectedException; + +import javax.ejb.EJBHome; +import javax.ejb.EJBMetaData; +import javax.ejb.Handle; +import javax.ejb.HomeHandle; +import javax.ejb.RemoveException; +import javax.rmi.CORBA.Stub; +import javax.rmi.CORBA.Util; + +import org.omg.CORBA.SystemException; +import org.omg.CORBA.portable.ApplicationException; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.RemarshalException; +import org.omg.CORBA.portable.ServantObject; +import org.omg.CORBA_2_3.portable.InputStream; + +public class _EJBHome_Stub extends Stub implements EJBHome { + + private static final String[] _type_ids = { + "RMI:javax.ejb.EJBHome:0000000000000000" + }; + + public String[] _ids() { + return _type_ids; + } + + public EJBMetaData getEJBMetaData() throws RemoteException { + while(true) { + if (!Util.isLocal(this)) { + InputStream in = null; + try { + try { + OutputStream out = _request("_get_EJBMetaData", true); + in = (InputStream)_invoke(out); + return (EJBMetaData) in.read_value(EJBMetaData.class); + } catch (ApplicationException ex) { + in = (InputStream) ex.getInputStream(); + String id = in.read_string(); + throw new UnexpectedException(id); + } catch (RemarshalException ex) { + continue; + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } finally { + _releaseReply(in); + } + } else { + ServantObject so = _servant_preinvoke("_get_EJBMetaData",javax.ejb.EJBHome.class); + if (so == null) { + continue; + } + try { + EJBMetaData result = ((javax.ejb.EJBHome)so.servant).getEJBMetaData(); + return (EJBMetaData)Util.copyObject(result,_orb()); + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + } + + public HomeHandle getHomeHandle() throws RemoteException { + while(true) { + if (!Util.isLocal(this)) { + InputStream in = null; + try { + try { + OutputStream out = _request("_get_homeHandle", true); + in = (InputStream)_invoke(out); + return (HomeHandle) in.read_abstract_interface(HomeHandle.class); + } catch (ApplicationException ex) { + in = (InputStream) ex.getInputStream(); + String id = in.read_string(); + throw new UnexpectedException(id); + } catch (RemarshalException ex) { + continue; + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } finally { + _releaseReply(in); + } + } else { + ServantObject so = _servant_preinvoke("_get_homeHandle",javax.ejb.EJBHome.class); + if (so == null) { + continue; + } + try { + HomeHandle result = ((javax.ejb.EJBHome)so.servant).getHomeHandle(); + return (HomeHandle)Util.copyObject(result,_orb()); + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + } + + public void remove(Handle arg0) throws RemoteException, RemoveException { + while(true) { + if (!Util.isLocal(this)) { + InputStream in = null; + try { + try { + OutputStream out = _request("remove__javax_ejb_Handle", true); + Util.writeAbstractObject(out,arg0); + _invoke(out); + return; + } catch (ApplicationException ex) { + in = (InputStream) ex.getInputStream(); + String id = in.read_string(); + if (id.equals("IDL:javax/ejb/RemoveEx:1.0")) { + throw (RemoveException) in.read_value(RemoveException.class); + } + throw new UnexpectedException(id); + } catch (RemarshalException ex) { + continue; + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } finally { + _releaseReply(in); + } + } else { + ServantObject so = _servant_preinvoke("remove__javax_ejb_Handle",javax.ejb.EJBHome.class); + if (so == null) { + continue; + } + try { + Handle arg0Copy = (Handle) Util.copyObject(arg0,_orb()); + ((javax.ejb.EJBHome)so.servant).remove(arg0Copy); + return; + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + if (exCopy instanceof RemoveException) { + throw (RemoveException)exCopy; + } + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + } + + public void remove(Object arg0) throws RemoteException, RemoveException { + while(true) { + if (!Util.isLocal(this)) { + InputStream in = null; + try { + try { + OutputStream out = _request("remove__java_lang_Object", true); + Util.writeAny(out,arg0); + _invoke(out); + return; + } catch (ApplicationException ex) { + in = (InputStream) ex.getInputStream(); + String id = in.read_string(); + if (id.equals("IDL:javax/ejb/RemoveEx:1.0")) { + throw (RemoveException) in.read_value(RemoveException.class); + } + throw new UnexpectedException(id); + } catch (RemarshalException ex) { + continue; + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } finally { + _releaseReply(in); + } + } else { + ServantObject so = _servant_preinvoke("remove__java_lang_Object",javax.ejb.EJBHome.class); + if (so == null) { + continue; + } + try { + Object arg0Copy = (Object) Util.copyObject(arg0,_orb()); + ((javax.ejb.EJBHome)so.servant).remove(arg0Copy); + return; + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + if (exCopy instanceof RemoveException) { + throw (RemoveException)exCopy; + } + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + } +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_EJBObject_Stub.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_EJBObject_Stub.java new file mode 100644 index 0000000000..3482ebb9ec --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_EJBObject_Stub.java @@ -0,0 +1,252 @@ +/* + * 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. + */ +// Stub class generated by rmic, do not edit. +// Contents subject to change without notice. + +package org.omg.stub.javax.ejb; + +import java.rmi.RemoteException; +import java.rmi.UnexpectedException; + +import javax.ejb.EJBHome; +import javax.ejb.EJBObject; +import javax.ejb.Handle; +import javax.ejb.RemoveException; +import javax.rmi.CORBA.Stub; +import javax.rmi.CORBA.Util; + +import org.omg.CORBA.SystemException; +import org.omg.CORBA.portable.ApplicationException; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.RemarshalException; +import org.omg.CORBA.portable.ServantObject; + +public class _EJBObject_Stub extends Stub implements EJBObject { + + private static final String[] _type_ids = { + "RMI:javax.ejb.EJBObject:0000000000000000" + }; + + public String[] _ids() { + return _type_ids; + } + + public EJBHome getEJBHome() throws RemoteException { + while(true) { + if (!Util.isLocal(this)) { + InputStream in = null; + try { + try { + OutputStream out = _request("_get_EJBHome", true); + in = _invoke(out); + return (EJBHome) in.read_Object(EJBHome.class); + } catch (ApplicationException ex) { + in = ex.getInputStream(); + String id = in.read_string(); + throw new UnexpectedException(id); + } catch (RemarshalException ex) { + continue; + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } finally { + _releaseReply(in); + } + } else { + ServantObject so = _servant_preinvoke("_get_EJBHome",javax.ejb.EJBObject.class); + if (so == null) { + continue; + } + try { + EJBHome result = ((javax.ejb.EJBObject)so.servant).getEJBHome(); + return (EJBHome)Util.copyObject(result,_orb()); + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + } + + public Handle getHandle() throws RemoteException { + while(true) { + if (!Util.isLocal(this)) { + org.omg.CORBA_2_3.portable.InputStream in = null; + try { + try { + OutputStream out = _request("_get_handle", true); + in = (org.omg.CORBA_2_3.portable.InputStream)_invoke(out); + return (Handle) in.read_abstract_interface(Handle.class); + } catch (ApplicationException ex) { + in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream(); + String id = in.read_string(); + throw new UnexpectedException(id); + } catch (RemarshalException ex) { + continue; + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } finally { + _releaseReply(in); + } + } else { + ServantObject so = _servant_preinvoke("_get_handle",javax.ejb.EJBObject.class); + if (so == null) { + continue; + } + try { + Handle result = ((javax.ejb.EJBObject)so.servant).getHandle(); + return (Handle)Util.copyObject(result,_orb()); + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + } + + public Object getPrimaryKey() throws RemoteException { + while(true) { + if (!Util.isLocal(this)) { + InputStream in = null; + try { + try { + OutputStream out = _request("_get_primaryKey", true); + in = _invoke(out); + return Util.readAny(in); + } catch (ApplicationException ex) { + in = ex.getInputStream(); + String id = in.read_string(); + throw new UnexpectedException(id); + } catch (RemarshalException ex) { + continue; + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } finally { + _releaseReply(in); + } + } else { + ServantObject so = _servant_preinvoke("_get_primaryKey",javax.ejb.EJBObject.class); + if (so == null) { + continue; + } + try { + Object result = ((javax.ejb.EJBObject)so.servant).getPrimaryKey(); + return (Object)Util.copyObject(result,_orb()); + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + } + + public boolean isIdentical(EJBObject arg0) throws RemoteException { + while(true) { + if (!Util.isLocal(this)) { + InputStream in = null; + try { + try { + OutputStream out = _request("isIdentical", true); + Util.writeRemoteObject(out,arg0); + in = _invoke(out); + return in.read_boolean(); + } catch (ApplicationException ex) { + in = ex.getInputStream(); + String id = in.read_string(); + throw new UnexpectedException(id); + } catch (RemarshalException ex) { + continue; + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } finally { + _releaseReply(in); + } + } else { + ServantObject so = _servant_preinvoke("isIdentical",javax.ejb.EJBObject.class); + if (so == null) { + continue; + } + try { + EJBObject arg0Copy = (EJBObject) Util.copyObject(arg0,_orb()); + return ((javax.ejb.EJBObject)so.servant).isIdentical(arg0Copy); + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + } + + public void remove() throws RemoteException, RemoveException { + while(true) { + if (!Util.isLocal(this)) { + org.omg.CORBA_2_3.portable.InputStream in = null; + try { + try { + OutputStream out = _request("remove", true); + _invoke(out); + return; + } catch (ApplicationException ex) { + in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream(); + String id = in.read_string(); + if (id.equals("IDL:javax/ejb/RemoveEx:1.0")) { + throw (RemoveException) in.read_value(RemoveException.class); + } + throw new UnexpectedException(id); + } catch (RemarshalException ex) { + continue; + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } finally { + _releaseReply(in); + } + } else { + ServantObject so = _servant_preinvoke("remove",javax.ejb.EJBObject.class); + if (so == null) { + continue; + } + try { + ((javax.ejb.EJBObject)so.servant).remove(); + return; + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + if (exCopy instanceof RemoveException) { + throw (RemoveException)exCopy; + } + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + } +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_Handle_Stub.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_Handle_Stub.java new file mode 100644 index 0000000000..d848fbb280 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_Handle_Stub.java @@ -0,0 +1,89 @@ +/* + * 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. + */ +// Stub class generated by rmic, do not edit. +// Contents subject to change without notice. + +package org.omg.stub.javax.ejb; + +import java.rmi.Remote; +import java.rmi.RemoteException; +import java.rmi.UnexpectedException; + +import javax.ejb.EJBObject; +import javax.ejb.Handle; +import javax.rmi.CORBA.Stub; +import javax.rmi.CORBA.Util; + +import org.omg.CORBA.SystemException; +import org.omg.CORBA.portable.ApplicationException; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.RemarshalException; +import org.omg.CORBA.portable.ServantObject; + +public class _Handle_Stub extends Stub implements Handle, +Remote { + + private static final String[] _type_ids = { + "RMI:javax.ejb.Handle:0000000000000000" + }; + + public String[] _ids() { + return _type_ids; + } + + public EJBObject getEJBObject() throws RemoteException { + while(true) { + if (!Util.isLocal(this)) { + InputStream in = null; + try { + try { + OutputStream out = _request("_get_EJBObject", true); + in = _invoke(out); + return (EJBObject) in.read_Object(EJBObject.class); + } catch (ApplicationException ex) { + in = ex.getInputStream(); + String id = in.read_string(); + throw new UnexpectedException(id); + } catch (RemarshalException ex) { + continue; + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } finally { + _releaseReply(in); + } + } else { + ServantObject so = _servant_preinvoke("_get_EJBObject",javax.ejb.Handle.class); + if (so == null) { + continue; + } + try { + EJBObject result = ((javax.ejb.Handle)so.servant).getEJBObject(); + return (EJBObject)Util.copyObject(result,_orb()); + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + } +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_HomeHandle_Stub.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_HomeHandle_Stub.java new file mode 100644 index 0000000000..6efc86b608 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/test/java/org/omg/stub/javax/ejb/_HomeHandle_Stub.java @@ -0,0 +1,89 @@ +/* + * 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. + */ +// Stub class generated by rmic, do not edit. +// Contents subject to change without notice. + +package org.omg.stub.javax.ejb; + +import java.rmi.Remote; +import java.rmi.RemoteException; +import java.rmi.UnexpectedException; + +import javax.ejb.EJBHome; +import javax.ejb.HomeHandle; +import javax.rmi.CORBA.Stub; +import javax.rmi.CORBA.Util; + +import org.omg.CORBA.SystemException; +import org.omg.CORBA.portable.ApplicationException; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.RemarshalException; +import org.omg.CORBA.portable.ServantObject; + +public class _HomeHandle_Stub extends Stub implements HomeHandle, +Remote { + + private static final String[] _type_ids = { + "RMI:javax.ejb.HomeHandle:0000000000000000" + }; + + public String[] _ids() { + return _type_ids; + } + + public EJBHome getEJBHome() throws RemoteException { + while(true) { + if (!Util.isLocal(this)) { + InputStream in = null; + try { + try { + OutputStream out = _request("_get_EJBHome", true); + in = _invoke(out); + return (EJBHome) in.read_Object(EJBHome.class); + } catch (ApplicationException ex) { + in = ex.getInputStream(); + String id = in.read_string(); + throw new UnexpectedException(id); + } catch (RemarshalException ex) { + continue; + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } finally { + _releaseReply(in); + } + } else { + ServantObject so = _servant_preinvoke("_get_EJBHome",javax.ejb.HomeHandle.class); + if (so == null) { + continue; + } + try { + EJBHome result = ((javax.ejb.HomeHandle)so.servant).getEJBHome(); + return (EJBHome)Util.copyObject(result,_orb()); + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + } +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/test/java/services/ejb/_CatalogEJBHome_Stub.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/test/java/services/ejb/_CatalogEJBHome_Stub.java new file mode 100644 index 0000000000..bdc1a5cfd5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/test/java/services/ejb/_CatalogEJBHome_Stub.java @@ -0,0 +1,269 @@ +/* + * 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. + */ +// Stub class generated by rmic, do not edit. +// Contents subject to change without notice. + +package services.ejb; + +import java.rmi.RemoteException; +import java.rmi.UnexpectedException; + +import javax.ejb.CreateException; +import javax.ejb.EJBMetaData; +import javax.ejb.Handle; +import javax.ejb.HomeHandle; +import javax.ejb.RemoveException; +import javax.rmi.CORBA.Stub; +import javax.rmi.CORBA.Util; + +import org.omg.CORBA.SystemException; +import org.omg.CORBA.portable.ApplicationException; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.RemarshalException; +import org.omg.CORBA.portable.ServantObject; +import org.omg.CORBA_2_3.portable.InputStream; + +public class _CatalogEJBHome_Stub extends Stub implements CatalogEJBHome { + + private static final String[] _type_ids = { + "RMI:services.ejb.CatalogEJBHome:0000000000000000", + "RMI:javax.ejb.EJBHome:0000000000000000" + }; + + public String[] _ids() { + return _type_ids; + } + + public EJBMetaData getEJBMetaData() throws RemoteException { + while(true) { + if (!Util.isLocal(this)) { + InputStream in = null; + try { + try { + OutputStream out = _request("_get_EJBMetaData", true); + in = (InputStream)_invoke(out); + return (EJBMetaData) in.read_value(EJBMetaData.class); + } catch (ApplicationException ex) { + in = (InputStream) ex.getInputStream(); + String id = in.read_string(); + throw new UnexpectedException(id); + } catch (RemarshalException ex) { + continue; + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } finally { + _releaseReply(in); + } + } else { + ServantObject so = _servant_preinvoke("_get_EJBMetaData",javax.ejb.EJBHome.class); + if (so == null) { + continue; + } + try { + EJBMetaData result = ((javax.ejb.EJBHome)so.servant).getEJBMetaData(); + return (EJBMetaData)Util.copyObject(result,_orb()); + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + } + + public HomeHandle getHomeHandle() throws RemoteException { + while(true) { + if (!Util.isLocal(this)) { + InputStream in = null; + try { + try { + OutputStream out = _request("_get_homeHandle", true); + in = (InputStream)_invoke(out); + return (HomeHandle) in.read_abstract_interface(HomeHandle.class); + } catch (ApplicationException ex) { + in = (InputStream) ex.getInputStream(); + String id = in.read_string(); + throw new UnexpectedException(id); + } catch (RemarshalException ex) { + continue; + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } finally { + _releaseReply(in); + } + } else { + ServantObject so = _servant_preinvoke("_get_homeHandle",javax.ejb.EJBHome.class); + if (so == null) { + continue; + } + try { + HomeHandle result = ((javax.ejb.EJBHome)so.servant).getHomeHandle(); + return (HomeHandle)Util.copyObject(result,_orb()); + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + } + + public void remove(Handle arg0) throws RemoteException, RemoveException { + while(true) { + if (!Util.isLocal(this)) { + InputStream in = null; + try { + try { + OutputStream out = _request("remove__javax_ejb_Handle", true); + Util.writeAbstractObject(out,arg0); + _invoke(out); + return; + } catch (ApplicationException ex) { + in = (InputStream) ex.getInputStream(); + String id = in.read_string(); + if (id.equals("IDL:javax/ejb/RemoveEx:1.0")) { + throw (RemoveException) in.read_value(RemoveException.class); + } + throw new UnexpectedException(id); + } catch (RemarshalException ex) { + continue; + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } finally { + _releaseReply(in); + } + } else { + ServantObject so = _servant_preinvoke("remove__javax_ejb_Handle",javax.ejb.EJBHome.class); + if (so == null) { + continue; + } + try { + Handle arg0Copy = (Handle) Util.copyObject(arg0,_orb()); + ((javax.ejb.EJBHome)so.servant).remove(arg0Copy); + return; + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + if (exCopy instanceof RemoveException) { + throw (RemoveException)exCopy; + } + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + } + + public void remove(Object arg0) throws RemoteException, RemoveException { + while(true) { + if (!Util.isLocal(this)) { + InputStream in = null; + try { + try { + OutputStream out = _request("remove__java_lang_Object", true); + Util.writeAny(out,arg0); + _invoke(out); + return; + } catch (ApplicationException ex) { + in = (InputStream) ex.getInputStream(); + String id = in.read_string(); + if (id.equals("IDL:javax/ejb/RemoveEx:1.0")) { + throw (RemoveException) in.read_value(RemoveException.class); + } + throw new UnexpectedException(id); + } catch (RemarshalException ex) { + continue; + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } finally { + _releaseReply(in); + } + } else { + ServantObject so = _servant_preinvoke("remove__java_lang_Object",javax.ejb.EJBHome.class); + if (so == null) { + continue; + } + try { + Object arg0Copy = (Object) Util.copyObject(arg0,_orb()); + ((javax.ejb.EJBHome)so.servant).remove(arg0Copy); + return; + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + if (exCopy instanceof RemoveException) { + throw (RemoveException)exCopy; + } + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + } + + public CatalogEJBRemote create() throws CreateException, RemoteException { + while(true) { + if (!Util.isLocal(this)) { + InputStream in = null; + try { + try { + OutputStream out = _request("create", true); + in = (InputStream)_invoke(out); + return (CatalogEJBRemote) in.read_Object(CatalogEJBRemote.class); + } catch (ApplicationException ex) { + in = (InputStream) ex.getInputStream(); + String id = in.read_string(); + if (id.equals("IDL:javax/ejb/CreateEx:1.0")) { + throw (CreateException) in.read_value(CreateException.class); + } + throw new UnexpectedException(id); + } catch (RemarshalException ex) { + continue; + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } finally { + _releaseReply(in); + } + } else { + ServantObject so = _servant_preinvoke("create",services.ejb.CatalogEJBHome.class); + if (so == null) { + continue; + } + try { + CatalogEJBRemote result = ((services.ejb.CatalogEJBHome)so.servant).create(); + return (CatalogEJBRemote)Util.copyObject(result,_orb()); + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + if (exCopy instanceof CreateException) { + throw (CreateException)exCopy; + } + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + } +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/test/java/services/ejb/_CatalogEJBRemote_Stub.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/test/java/services/ejb/_CatalogEJBRemote_Stub.java new file mode 100644 index 0000000000..a24108714e --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-ejb/src/test/java/services/ejb/_CatalogEJBRemote_Stub.java @@ -0,0 +1,292 @@ +/* + * 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. + */ +// Stub class generated by rmic, do not edit. +// Contents subject to change without notice. + +package services.ejb; + +import java.rmi.RemoteException; +import java.rmi.UnexpectedException; + +import javax.ejb.EJBHome; +import javax.ejb.EJBObject; +import javax.ejb.Handle; +import javax.ejb.RemoveException; +import javax.rmi.CORBA.Stub; +import javax.rmi.CORBA.Util; + +import org.omg.CORBA.SystemException; +import org.omg.CORBA.portable.ApplicationException; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.RemarshalException; +import org.omg.CORBA.portable.ServantObject; + +public class _CatalogEJBRemote_Stub extends Stub implements CatalogEJBRemote { + + private static final String[] _type_ids = { + "RMI:services.ejb.CatalogEJBRemote:0000000000000000", + "RMI:javax.ejb.EJBObject:0000000000000000" + }; + + public String[] _ids() { + return _type_ids; + } + + public EJBHome getEJBHome() throws RemoteException { + while(true) { + if (!Util.isLocal(this)) { + InputStream in = null; + try { + try { + OutputStream out = _request("_get_EJBHome", true); + in = _invoke(out); + return (EJBHome) in.read_Object(EJBHome.class); + } catch (ApplicationException ex) { + in = ex.getInputStream(); + String id = in.read_string(); + throw new UnexpectedException(id); + } catch (RemarshalException ex) { + continue; + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } finally { + _releaseReply(in); + } + } else { + ServantObject so = _servant_preinvoke("_get_EJBHome",javax.ejb.EJBObject.class); + if (so == null) { + continue; + } + try { + EJBHome result = ((javax.ejb.EJBObject)so.servant).getEJBHome(); + return (EJBHome)Util.copyObject(result,_orb()); + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + } + + public Handle getHandle() throws RemoteException { + while(true) { + if (!Util.isLocal(this)) { + org.omg.CORBA_2_3.portable.InputStream in = null; + try { + try { + OutputStream out = _request("_get_handle", true); + in = (org.omg.CORBA_2_3.portable.InputStream)_invoke(out); + return (Handle) in.read_abstract_interface(Handle.class); + } catch (ApplicationException ex) { + in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream(); + String id = in.read_string(); + throw new UnexpectedException(id); + } catch (RemarshalException ex) { + continue; + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } finally { + _releaseReply(in); + } + } else { + ServantObject so = _servant_preinvoke("_get_handle",javax.ejb.EJBObject.class); + if (so == null) { + continue; + } + try { + Handle result = ((javax.ejb.EJBObject)so.servant).getHandle(); + return (Handle)Util.copyObject(result,_orb()); + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + } + + public Object getPrimaryKey() throws RemoteException { + while(true) { + if (!Util.isLocal(this)) { + InputStream in = null; + try { + try { + OutputStream out = _request("_get_primaryKey", true); + in = _invoke(out); + return Util.readAny(in); + } catch (ApplicationException ex) { + in = ex.getInputStream(); + String id = in.read_string(); + throw new UnexpectedException(id); + } catch (RemarshalException ex) { + continue; + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } finally { + _releaseReply(in); + } + } else { + ServantObject so = _servant_preinvoke("_get_primaryKey",javax.ejb.EJBObject.class); + if (so == null) { + continue; + } + try { + Object result = ((javax.ejb.EJBObject)so.servant).getPrimaryKey(); + return (Object)Util.copyObject(result,_orb()); + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + } + + public boolean isIdentical(EJBObject arg0) throws RemoteException { + while(true) { + if (!Util.isLocal(this)) { + InputStream in = null; + try { + try { + OutputStream out = _request("isIdentical", true); + Util.writeRemoteObject(out,arg0); + in = _invoke(out); + return in.read_boolean(); + } catch (ApplicationException ex) { + in = ex.getInputStream(); + String id = in.read_string(); + throw new UnexpectedException(id); + } catch (RemarshalException ex) { + continue; + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } finally { + _releaseReply(in); + } + } else { + ServantObject so = _servant_preinvoke("isIdentical",javax.ejb.EJBObject.class); + if (so == null) { + continue; + } + try { + EJBObject arg0Copy = (EJBObject) Util.copyObject(arg0,_orb()); + return ((javax.ejb.EJBObject)so.servant).isIdentical(arg0Copy); + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + } + + public void remove() throws RemoteException, RemoveException { + while(true) { + if (!Util.isLocal(this)) { + org.omg.CORBA_2_3.portable.InputStream in = null; + try { + try { + OutputStream out = _request("remove", true); + _invoke(out); + return; + } catch (ApplicationException ex) { + in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream(); + String id = in.read_string(); + if (id.equals("IDL:javax/ejb/RemoveEx:1.0")) { + throw (RemoveException) in.read_value(RemoveException.class); + } + throw new UnexpectedException(id); + } catch (RemarshalException ex) { + continue; + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } finally { + _releaseReply(in); + } + } else { + ServantObject so = _servant_preinvoke("remove",javax.ejb.EJBObject.class); + if (so == null) { + continue; + } + try { + ((javax.ejb.EJBObject)so.servant).remove(); + return; + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + if (exCopy instanceof RemoveException) { + throw (RemoveException)exCopy; + } + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + } + + public Vegetable[] get() throws RemoteException { + while(true) { + if (!Util.isLocal(this)) { + org.omg.CORBA_2_3.portable.InputStream in = null; + try { + try { + OutputStream out = _request("get", true); + in = (org.omg.CORBA_2_3.portable.InputStream)_invoke(out); + return (Vegetable[]) in.read_value(Vegetable[].class); + } catch (ApplicationException ex) { + in = (org.omg.CORBA_2_3.portable.InputStream) ex.getInputStream(); + String id = in.read_string(); + throw new UnexpectedException(id); + } catch (RemarshalException ex) { + continue; + } + } catch (SystemException ex) { + throw Util.mapSystemException(ex); + } finally { + _releaseReply(in); + } + } else { + ServantObject so = _servant_preinvoke("get",services.ejb.CatalogEJBRemote.class); + if (so == null) { + continue; + } + try { + Vegetable[] result = ((services.ejb.CatalogEJBRemote)so.servant).get(); + return (Vegetable[])Util.copyObject(result,_orb()); + } catch (Throwable ex) { + Throwable exCopy = (Throwable)Util.copyObject(ex,_orb()); + throw Util.wrapException(exCopy); + } finally { + _servant_postinvoke(so); + } + } + } + } +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-mediation/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-mediation/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..6a3673f04a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-mediation/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ +<?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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:c="http://catalog"> + <import.java package="services"/> + <import.java package="services.ejb"/> + <deployable composite="c:catalog-mediation"/> +</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-mediation/catalog-mediation.composite b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-mediation/catalog-mediation.composite new file mode 100644 index 0000000000..d832e88acc --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-mediation/catalog-mediation.composite @@ -0,0 +1,34 @@ +<?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" + targetNamespace="http://catalog" + name="catalog-mediation"> + + <component name="MediatedVegetablesCatalog"> + <implementation.java class="services.mediation.VegetablesCatalogMediationImpl"/> + <service name="Catalog"> + <binding.ws/> + </service> + <reference name="catalog" target="VegetablesCatalogEJB"> + <binding.ejb/> + </reference> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-mediation/pom.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-mediation/pom.xml new file mode 100644 index 0000000000..775d6e5b7f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-mediation/pom.xml @@ -0,0 +1,90 @@ +<?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-tutorial</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>tutorial-catalog-mediation</artifactId> + <name>Apache Tuscany SCA Tutorial Catalog Mediation</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>tutorial-assets</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tutorial-catalog-ejb</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.geronimo.specs</groupId> + <artifactId>geronimo-ejb_3.0_spec</artifactId> + <version>1.0</version> + <scope>provided</scope> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <sourceDirectory>${basedir}</sourceDirectory> + <resources> + <resource> + <directory>${basedir}</directory> + <excludes> + <exclude>**/*.java</exclude> + <exclude>**/.*/**</exclude> + <exclude>pom.xml</exclude> + <exclude>build.xml</exclude> + </excludes> + </resource> + </resources> + + <plugins> + <plugin> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-maven-ant-generator</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <executions> + <execution> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-mediation/services/mediation/VegetablesCatalogMediationImpl.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-mediation/services/mediation/VegetablesCatalogMediationImpl.java new file mode 100644 index 0000000000..6cfa54e9de --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-mediation/services/mediation/VegetablesCatalogMediationImpl.java @@ -0,0 +1,51 @@ +/* + * 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.mediation; + +import java.rmi.RemoteException; + +import org.osoa.sca.ServiceRuntimeException; +import org.osoa.sca.annotations.Reference; + +import services.Catalog; +import services.Item; +import services.ejb.CatalogEJBRemote; +import services.ejb.Vegetable; + +public class VegetablesCatalogMediationImpl implements Catalog { + + @Reference + public CatalogEJBRemote catalog; + + public Item[] get() { + Vegetable[] vegetables; + try { + vegetables = catalog.get(); + } catch (RemoteException e) { + throw new ServiceRuntimeException(e); + } + Item[] items = new Item[vegetables.length]; + for (int i = 0; i < vegetables.length; i++) { + items[i] = new Item(vegetables[i].getName(), vegetables[i].getPrice()); + } + return items; + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-webapp/catalog-web.composite b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-webapp/catalog-web.composite new file mode 100644 index 0000000000..3ba76da078 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-webapp/catalog-web.composite @@ -0,0 +1,43 @@ +<?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" + targetNamespace="http://catalog" + name="catalog-web"> + + <component name="WebFruitsCatalog"> + <implementation.java class="services.FruitsCatalogImpl"/> + <service name="Catalog"> + <binding.ws/> + </service> + <property name="currencyCode">USD</property> + <reference name="currencyConverter" target="CurrencyConverterWebService"> + <binding.ws/> + </reference> + </component> + + <component name="LocalFruitsCatalog"> + <implementation.java class="services.FruitsCatalogImpl"/> + <property name="currencyCode">USD</property> + <reference name="currencyConverter" target="CurrencyConverterWebService"> + <binding.ws/> + </reference> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-webapp/pom.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-webapp/pom.xml new file mode 100644 index 0000000000..9ac1977700 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-webapp/pom.xml @@ -0,0 +1,109 @@ +<?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-tutorial</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>tutorial-catalog-webapp</artifactId> + <name>Apache Tuscany SCA Tutorial Catalog WAR Contribution</name> + <packaging>war</packaging> + + <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-sca-api</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node2-api</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tutorial-assets</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node2-launcher</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <sourceDirectory>${basedir}</sourceDirectory> + <resources> + <resource> + <directory>${basedir}</directory> + <excludes> + <exclude>**/*.java</exclude> + <exclude>**/.*/**</exclude> + <exclude>pom.xml</exclude> + <exclude>build.xml</exclude> + <exclude>target/**</exclude> + <exclude>webapp/**</exclude> + </excludes> + </resource> + </resources> + + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-war-plugin</artifactId> + <configuration> + <warSourceDirectory>webapp</warSourceDirectory> + </configuration> + </plugin> + <plugin> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-maven-ant-generator</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <executions> + <execution> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-webapp/webapp/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-webapp/webapp/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..71e7b8d511 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-webapp/webapp/META-INF/sca-contribution.xml @@ -0,0 +1,24 @@ +<?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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:c="http://catalog"> + <import.java package="services"/> + <deployable composite="c:catalog-web"/> +</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-webapp/webapp/WEB-INF/web.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-webapp/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..1a4d84909c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-webapp/webapp/WEB-INF/web.xml @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="ISO-8859-1"?> +<!-- + * 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. +--> + +<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web +Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd"> +<web-app> + + <display-name>Fruit Catalog</display-name> + + <filter> + <filter-name>tuscany</filter-name> + <filter-class>org.apache.tuscany.sca.node.launcher.NodeServletFilter</filter-class> + </filter> + + <filter-mapping> + <filter-name>tuscany</filter-name> + <url-pattern>/*</url-pattern> + </filter-mapping> + + <welcome-file-list id="WelcomeFileList"> + <welcome-file>catalog.jsp</welcome-file> + </welcome-file-list> + +</web-app> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-webapp/webapp/catalog.jsp b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-webapp/webapp/catalog.jsp new file mode 100644 index 0000000000..fe51e854a5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/catalog-webapp/webapp/catalog.jsp @@ -0,0 +1,52 @@ +<%-- + * 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 import="org.apache.tuscany.sca.node.SCAClient"%> +<%@ page import="services.Catalog" %> +<%@page import="services.Item"%> + +<%@ page contentType="text/html;charset=UTF-8" language="java" %> + +<% + + SCAClient client = (SCAClient) application.getAttribute("org.apache.tuscany.sca.node.SCAClient"); + + Catalog catalog = (Catalog)client.getService(Catalog.class, "LocalFruitsCatalog"); + Item[] items = catalog.get(); + +%> + +<html> +<head><title>Catalog</title></head> + +<body> +<h1>Catalog</h1> + +<table border="0"> + +<% for (int i = 0, n = items.length; i < n; i++) { %> + + <tr><td><%=items[i].getName() %></td><td><%=items[i].getPrice() %></td></tr> + +<% } %> + +</table> + +</body> +</html> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud.composite b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud.composite new file mode 100644 index 0000000000..993b634c9f --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud.composite @@ -0,0 +1,33 @@ +<?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 name="cloud" + targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0/" + xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:ns1="http://www.osoa.org/xmlns/sca/1.0"> + <include name="ns2:CurrencyNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/> + <include name="ns2:CatalogsNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/> + <include name="ns2:StoreNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/> + <include name="ns2:StoreMergerNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/> + <include name="ns2:StoreDBNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/> + <include name="ns2:StoreSupplierNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/> + <include name="ns2:StoreEUNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/> + <include name="ns2:CatalogWebAppNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/> + <include name="ns2:CatalogMediationNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/> + <include name="ns2:CatalogEJBNode" uri="http://tuscany.apache.org/cloud" xmlns:ns2="http://tuscany.apache.org/cloud"/> +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/CatalogEJBNode.composite b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/CatalogEJBNode.composite new file mode 100644 index 0000000000..b495b45ebd --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/CatalogEJBNode.composite @@ -0,0 +1,33 @@ +<?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" + targetNamespace="http://tuscany.apache.org/cloud" + xmlns:c="http://catalog" + name="CatalogEJBNode"> + + <component name="CatalogEJBNode"> + <t:implementation.node uri="catalog-ejb" composite="c:catalog-ejb"/> + <service name="Node"> + <t:binding.http uri="http://localhost:8080"/> + </service> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/CatalogMediationNode.composite b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/CatalogMediationNode.composite new file mode 100644 index 0000000000..bac96d9781 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/CatalogMediationNode.composite @@ -0,0 +1,33 @@ +<?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" + targetNamespace="http://tuscany.apache.org/cloud" + xmlns:c="http://catalog" + name="CatalogMediationNode"> + + <component name="CatalogMediationNode"> + <t:implementation.node uri="catalog-mediation" composite="c:catalog-mediation"/> + <service name="Node"> + <binding.ws uri="http://localhost:8105"/> + </service> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/CatalogWebAppNode.composite b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/CatalogWebAppNode.composite new file mode 100644 index 0000000000..f3ed2dfdd5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/CatalogWebAppNode.composite @@ -0,0 +1,36 @@ +<?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:c="http://catalog" + targetNamespace="http://tuscany.apache.org/cloud" + name="CatalogWebAppNode"> + + <component name="CatalogWebAppNode"> + <t:implementation.node uri="catalog-webapp" composite="c:catalog-web" /> + <service name="Node"> + <binding.ws uri="http://localhost:8080/CatalogWebAppNode" /> + <t:binding.http uri="http://localhost:8080/CatalogWebAppNode" /> + <t:binding.jsonrpc uri="http://localhost:8080/CatalogWebAppNode" /> + <t:binding.atom uri="http://localhost:8080/CatalogWebAppNode" /> + </service> + </component> + +</composite>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/CatalogsNode.composite b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/CatalogsNode.composite new file mode 100644 index 0000000000..3a5ec770cb --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/CatalogsNode.composite @@ -0,0 +1,33 @@ +<?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" + targetNamespace="http://tuscany.apache.org/cloud" + xmlns:c="http://services" + name="CatalogsNode"> + + <component name="CatalogsNode"> + <t:implementation.node uri="web-services" composite="c:catalogs"/> + <service name="Node"> + <binding.ws uri="http://localhost:8200"/> + </service> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/CurrencyNode.composite b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/CurrencyNode.composite new file mode 100644 index 0000000000..ed80268f22 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/CurrencyNode.composite @@ -0,0 +1,33 @@ +<?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" + targetNamespace="http://tuscany.apache.org/cloud" + xmlns:c="http://services" + name="CurrencyNode"> + + <component name="CurrencyNode"> + <t:implementation.node uri="web-services" composite="c:currency"/> + <service name="Node"> + <binding.ws uri="http://localhost:8201"/> + </service> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/StoreDBNode.composite b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/StoreDBNode.composite new file mode 100644 index 0000000000..9b09bd7344 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/StoreDBNode.composite @@ -0,0 +1,35 @@ +<?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" + targetNamespace="http://tuscany.apache.org/cloud" + xmlns:s="http://store" + name="StoreDBNode"> + + <component name="StoreDBNode"> + <t:implementation.node uri="store-db" composite="s:store-db"/> + <service name="Node"> + <t:binding.http uri="http://localhost:8102"/> + <t:binding.jsonrpc uri="http://localhost:8102"/> + <t:binding.atom uri="http://localhost:8102"/> + </service> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/StoreEUNode.composite b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/StoreEUNode.composite new file mode 100644 index 0000000000..6a50de56d5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/StoreEUNode.composite @@ -0,0 +1,36 @@ +<?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" + targetNamespace="http://tuscany.apache.org/cloud" + xmlns:s="http://store" + name="StoreEUNode"> + + <component name="StoreEUNode"> + <t:implementation.node uri="store-eu" composite="s:store-eu"/> + <service name="Node"> + <t:binding.http uri="http://localhost:8104"/> + <t:binding.jsonrpc uri="http://localhost:8104"/> + <t:binding.atom uri="http://localhost:8104"/> + <binding.ws uri="http://localhost:8444"/> + </service> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/StoreMergerNode.composite b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/StoreMergerNode.composite new file mode 100644 index 0000000000..0ce6e6a231 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/StoreMergerNode.composite @@ -0,0 +1,35 @@ +<?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" + targetNamespace="http://tuscany.apache.org/cloud" + xmlns:s="http://store" + name="StoreMergerNode"> + + <component name="StoreMergerNode"> + <t:implementation.node uri="store-merger" composite="s:store-merger"/> + <service name="Node"> + <t:binding.http uri="http://localhost:8101"/> + <t:binding.jsonrpc uri="http://localhost:8101"/> + <t:binding.atom uri="http://localhost:8101"/> + </service> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/StoreNode.composite b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/StoreNode.composite new file mode 100644 index 0000000000..e2b61a98e1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/StoreNode.composite @@ -0,0 +1,35 @@ +<?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" + targetNamespace="http://tuscany.apache.org/cloud" + xmlns:s="http://store" + name="StoreNode"> + + <component name="StoreNode"> + <t:implementation.node uri="store" composite="s:store"/> + <service name="Node"> + <t:binding.http uri="http://localhost:8100"/> + <t:binding.jsonrpc uri="http://localhost:8100"/> + <t:binding.atom uri="http://localhost:8100"/> + </service> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/StoreSupplierNode.composite b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/StoreSupplierNode.composite new file mode 100644 index 0000000000..df46bb8813 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/cloud/StoreSupplierNode.composite @@ -0,0 +1,36 @@ +<?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" + targetNamespace="http://tuscany.apache.org/cloud" + xmlns:s="http://store" + name="StoreSupplierNode"> + + <component name="StoreSupplierNode"> + <t:implementation.node uri="store-supplier" composite="s:store-supplier"/> + <service name="Node"> + <t:binding.http uri="http://localhost:8103"/> + <t:binding.jsonrpc uri="http://localhost:8103"/> + <t:binding.atom uri="http://localhost:8103"/> + <binding.ws uri="http://localhost:8333"/> + </service> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/domain.composite b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/domain.composite new file mode 100644 index 0000000000..ff4dde969c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/domain.composite @@ -0,0 +1,33 @@ +<?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 name="domain" + targetNamespace="http://tuscany.apache.org/xmlns/sca/1.0" + xmlns="http://www.osoa.org/xmlns/sca/1.0" xmlns:ns1="http://www.osoa.org/xmlns/sca/1.0"> + <include name="ns2:store" uri="store" xmlns:ns2="http://store"/> + <include name="ns2:store-merger" uri="store-merger" xmlns:ns2="http://store"/> + <include name="ns2:store-db" uri="store-db" xmlns:ns2="http://store"/> + <include name="ns2:store-supplier" uri="store-supplier" xmlns:ns2="http://store"/> + <include name="ns2:store-eu" uri="store-eu" xmlns:ns2="http://store"/> + <include name="ns2:catalogs" uri="web-services" xmlns:ns2="http://services"/> + <include name="ns2:currency" uri="web-services" xmlns:ns2="http://services"/> + <include name="ns2:catalog-web" uri="catalog-webapp" xmlns:ns2="http://catalog"/> + <include name="ns2:catalog-mediation" uri="catalog-mediation" xmlns:ns2="http://catalog"/> + <include name="ns2:catalog-ejb" uri="catalog-ejb" xmlns:ns2="http://catalog"/> +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchCatalogMediationNode.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchCatalogMediationNode.java new file mode 100644 index 0000000000..442b1b6a05 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchCatalogMediationNode.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package launch; + +import org.apache.tuscany.sca.node.launcher.NodeLauncher; + +public class LaunchCatalogMediationNode { + public static void main(String[] args) throws Exception { + NodeLauncher.main(new String[] {"http://localhost:9990/node-image/CatalogMediationNode"}); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchCatalogsNode.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchCatalogsNode.java new file mode 100644 index 0000000000..8a23433012 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchCatalogsNode.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package launch; + +import org.apache.tuscany.sca.node.launcher.NodeLauncher; + +public class LaunchCatalogsNode { + public static void main(String[] args) throws Exception { + NodeLauncher.main(new String[] {"http://localhost:9990/node-image/CatalogsNode"}); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchCurrencyNode.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchCurrencyNode.java new file mode 100644 index 0000000000..fae521547d --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchCurrencyNode.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package launch; + +import org.apache.tuscany.sca.node.launcher.NodeLauncher; + +public class LaunchCurrencyNode { + public static void main(String[] args) throws Exception { + NodeLauncher.main(new String[] {"http://localhost:9990/node-image/CurrencyNode"}); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchStoreDBNode.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchStoreDBNode.java new file mode 100644 index 0000000000..480088b46a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchStoreDBNode.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package launch; + +import org.apache.tuscany.sca.node.launcher.NodeLauncher; + +public class LaunchStoreDBNode { + public static void main(String[] args) throws Exception { + NodeLauncher.main(new String[] {"http://localhost:9990/node-image/StoreDBNode"}); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchStoreEUNode.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchStoreEUNode.java new file mode 100644 index 0000000000..cdc7eb824b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchStoreEUNode.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package launch; + +import org.apache.tuscany.sca.node.launcher.NodeLauncher; + +public class LaunchStoreEUNode { + public static void main(String[] args) throws Exception { + NodeLauncher.main(new String[] {"http://localhost:9990/node-image/StoreEUNode"}); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchStoreMergerNode.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchStoreMergerNode.java new file mode 100644 index 0000000000..26452b231b --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchStoreMergerNode.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package launch; + +import org.apache.tuscany.sca.node.launcher.NodeLauncher; + +public class LaunchStoreMergerNode { + public static void main(String[] args) throws Exception { + NodeLauncher.main(new String[] {"http://localhost:9990/node-image/StoreMergerNode"}); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchStoreNode.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchStoreNode.java new file mode 100644 index 0000000000..d15ee0e9d2 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchStoreNode.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package launch; + +import org.apache.tuscany.sca.node.launcher.NodeLauncher; + +public class LaunchStoreNode { + public static void main(String[] args) throws Exception { + NodeLauncher.main(new String[] {"http://localhost:9990/node-image/StoreNode"}); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchStoreSupplierNode.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchStoreSupplierNode.java new file mode 100644 index 0000000000..4210108aa5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchStoreSupplierNode.java @@ -0,0 +1,28 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package launch; + +import org.apache.tuscany.sca.node.launcher.NodeLauncher; + +public class LaunchStoreSupplierNode { + public static void main(String[] args) throws Exception { + NodeLauncher.main(new String[] {"http://localhost:9990/node-image/StoreSupplierNode"}); + } +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchTutorialDomainManager.java b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchTutorialDomainManager.java new file mode 100644 index 0000000000..7408e99c63 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/launch/LaunchTutorialDomainManager.java @@ -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. + */ + +package launch; + +/** + * Launches the domain manager from this module. + * + * @version $Rev$ $Date$ + */ +public class LaunchTutorialDomainManager { + + public static void main(String[] args) throws Exception { + org.apache.tuscany.sca.node.launcher.DomainManagerLauncher.main(args); + } + +} diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/pom.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/pom.xml new file mode 100644 index 0000000000..2265c33bd0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/pom.xml @@ -0,0 +1,164 @@ +<?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-tutorial</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>tutorial-domain</artifactId> + <name>Apache Tuscany SCA Tutorial Domain</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-node2-launcher</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-workspace-admin</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-node-runtime</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-widget</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-atom-abdera</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-jsonrpc</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-http</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-sca-axis2</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ejb</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-ejb-xml</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <version>10.1.2.1</version> + <scope>runtime</scope> + </dependency> + + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <sourceDirectory>${basedir}</sourceDirectory> + <resources> + <resource> + <directory>${basedir}</directory> + <excludes> + <exclude>**/*.java</exclude> + <exclude>**/.*/**</exclude> + <exclude>pom.xml</exclude> + <exclude>build.xml</exclude> + </excludes> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-maven-ant-generator</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <executions> + <execution> + <configuration> + <mainClass>launch.LaunchTutorialAdmin</mainClass> + </configuration> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/workspace.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/workspace.xml new file mode 100644 index 0000000000..e405dea03a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/domain/workspace.xml @@ -0,0 +1,32 @@ +<?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. +--> +<workspace xmlns="http://tuscany.apache.org/xmlns/sca/1.0" xmlns:ns1="http://tuscany.apache.org/xmlns/sca/1.0"> + <contribution location="file:../assets/target/tutorial-assets.jar" uri="assets"/> + <contribution location="file:../store/target/tutorial-store.jar" uri="store"/> + <contribution location="file:../store-merger/target/tutorial-store-merger.jar" uri="store-merger"/> + <contribution location="file:../store-db/target/tutorial-store-db.jar" uri="store-db"/> + <contribution location="file:../store-supplier/target/tutorial-store-supplier.jar" uri="store-supplier"/> + <contribution location="file:../store-eu/target/tutorial-store-eu.jar" uri="store-eu"/> + <contribution location="file:../web-services/target/tutorial-web-services.jar" uri="web-services"/> + <contribution location="file:../catalog-webapp/target/tutorial-catalog-webapp.war" uri="catalog-webapp"/> + <contribution location="file:../catalog-mediation/target/tutorial-catalog-mediation.jar" uri="catalog-mediation"/> + <contribution location="file:../catalog-ejb/target/tutorial-catalog-ejb.jar" uri="catalog-ejb"/> + <contribution location="file:../domain/cloud" uri="http://tuscany.apache.org/cloud"/> +</workspace> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/pom.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/pom.xml new file mode 100644 index 0000000000..d792623dcf --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/pom.xml @@ -0,0 +1,55 @@ +<?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.2.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>tuscany-tutorial</artifactId> + <packaging>pom</packaging> + <name>Apache Tuscany SCA Tutorial</name> + + <profiles> + <profile> + <id>default</id> + <activation> + <activeByDefault>true</activeByDefault> + </activation> + <modules> + <module>domain</module> + <module>assets</module> + <module>store</module> + <module>store-merger</module> + <module>store-db</module> + <module>store-supplier</module> + <module>store-eu</module> + <module>web-services</module> + <module>catalog-webapp</module> + <module>catalog-ejb</module> + <module>catalog-mediation</module> + </modules> + </profile> + + </profiles> + +</project> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-db/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-db/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..7a5d5613be --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-db/META-INF/sca-contribution.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:s="http://store"> + <import.java package="services"/> + <import.java package="services.merger"/> + <import.java package="services.db"/> + <import.resource uri="uiservices/store.html"/> + <deployable composite="s:store-db"/> +</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-db/pom.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-db/pom.xml new file mode 100644 index 0000000000..dd4750c2d0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-db/pom.xml @@ -0,0 +1,110 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-tutorial</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>tutorial-store-db</artifactId> + <name>Apache Tuscany SCA Tutorial Online Store Using DB</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-sca-api</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <sourceDirectory>${basedir}</sourceDirectory> + <resources> + <resource> + <directory>${basedir}</directory> + <excludes> + <exclude>**/*.java</exclude> + <exclude>**/.*/**</exclude> + <exclude>pom.xml</exclude> + <exclude>build.xml</exclude> + </excludes> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-maven-ant-generator</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <executions> + <execution> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>sql-maven-plugin</artifactId> + <version>1.0</version> + + <dependencies> + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <version>10.1.2.1</version> + </dependency> + </dependencies> + + <executions> + <execution> + <id>create-db</id> + <phase>generate-resources</phase> + <goals> + <goal>execute</goal> + </goals> + <configuration> + <driver>org.apache.derby.jdbc.EmbeddedDriver</driver> + <url>jdbc:derby:${basedir}/target/cart-db;create=true</url> + <autocommit>true</autocommit> + <onError>continue</onError> + <delimiter>;</delimiter> + <srcFiles> + <srcFile>${basedir}/../assets/services/db/cart.sql</srcFile> + </srcFiles> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-db/store-db.composite b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-db/store-db.composite new file mode 100644 index 0000000000..03094be5ad --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-db/store-db.composite @@ -0,0 +1,75 @@ +<?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" + targetNamespace="http://store" + name="store-db"> + + <component name="StoreDB"> + <t:implementation.widget location="uiservices/store.html"/> + <service name="Widget"> + <t:binding.http uri="/ui"/> + </service> + <reference name="catalog" target="StoreDBCatalog"> + <t:binding.jsonrpc/> + </reference> + <reference name="shoppingCart" target="StoreDBShoppingCart/Cart"> + <t:binding.atom/> + </reference> + <reference name="shoppingTotal" target="StoreDBShoppingCart/Total"> + <t:binding.jsonrpc/> + </reference> + </component> + + <component name="StoreDBCatalog"> + <implementation.java class="services.merger.MergedCatalogImpl"/> + <property name="currencyCode">USD</property> + <service name="Catalog"> + <t:binding.jsonrpc/> + </service> + <reference name="fruitsCatalog" target="StoreDBFruitsCatalog"/> + <reference name="vegetablesCatalog" target="VegetablesCatalogWebService"> + <binding.ws/> + </reference> + <reference name="currencyConverter" target="StoreDBCurrencyConverter"/> + </component> + + <component name="StoreDBFruitsCatalog"> + <implementation.java class="services.FruitsCatalogImpl"/> + <property name="currencyCode">USD</property> + <reference name="currencyConverter" target="StoreDBCurrencyConverter"/> + </component> + + <component name="StoreDBShoppingCart"> + <implementation.java class="services.db.ShoppingCartTableImpl"/> + <property name="database">../store-db/target/cart-db</property> + <service name="Cart"> + <t:binding.atom uri="/ShoppingCart/Cart"/> + </service> + <service name="Total"> + <t:binding.jsonrpc/> + </service> + </component> + + <component name="StoreDBCurrencyConverter"> + <implementation.java class="services.CurrencyConverterImpl"/> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-eu/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-eu/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..552932b0e7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-eu/META-INF/sca-contribution.xml @@ -0,0 +1,26 @@ +<?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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:s="http://store"> + <import.java package="services"/> + <import.java package="services.merger"/> + <import.java package="services.db"/> + <deployable composite="s:store-eu"/> +</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-eu/pom.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-eu/pom.xml new file mode 100644 index 0000000000..5cd956abf5 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-eu/pom.xml @@ -0,0 +1,110 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-tutorial</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>tutorial-store-eu</artifactId> + <name>Apache Tuscany SCA Tutorial EU Online Store</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-sca-api</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <sourceDirectory>${basedir}</sourceDirectory> + <resources> + <resource> + <directory>${basedir}</directory> + <excludes> + <exclude>**/*.java</exclude> + <exclude>**/.*/**</exclude> + <exclude>pom.xml</exclude> + <exclude>build.xml</exclude> + </excludes> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-maven-ant-generator</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <executions> + <execution> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>sql-maven-plugin</artifactId> + <version>1.0</version> + + <dependencies> + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <version>10.1.2.1</version> + </dependency> + </dependencies> + + <executions> + <execution> + <id>create-db</id> + <phase>generate-resources</phase> + <goals> + <goal>execute</goal> + </goals> + <configuration> + <driver>org.apache.derby.jdbc.EmbeddedDriver</driver> + <url>jdbc:derby:${basedir}/target/cart-eu-db;create=true</url> + <autocommit>true</autocommit> + <onError>continue</onError> + <delimiter>;</delimiter> + <srcFiles> + <srcFile>${basedir}/../assets/services/db/cart.sql</srcFile> + </srcFiles> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-eu/store-eu.composite b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-eu/store-eu.composite new file mode 100644 index 0000000000..a0b8b50975 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-eu/store-eu.composite @@ -0,0 +1,70 @@ +<?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" + targetNamespace="http://store" + name="store-eu"> + + <component name="StoreEU"> + <t:implementation.widget location="uiservices/store-eu.html"/> + <service name="Widget"> + <t:binding.http uri="/ui"/> + </service> + <reference name="catalog" target="StoreEUCatalog"> + <t:binding.jsonrpc/> + </reference> + <reference name="shoppingCart" target="StoreEUShoppingCart/Cart"> + <t:binding.atom/> + </reference> + <reference name="shoppingTotal" target="StoreEUShoppingCart/Total"> + <t:binding.jsonrpc/> + </reference> + </component> + + <component name="StoreEUCatalog"> + <implementation.java class="services.merger.MergedCatalogImpl"/> + <property name="currencyCode">EUR</property> + <service name="Catalog"> + <t:binding.jsonrpc/> + <binding.ws uri="/CatalogWebService"/> + </service> + <reference name="fruitsCatalog" target="FruitsCatalogWebService"> + <binding.ws/> + </reference> + <reference name="vegetablesCatalog" target="VegetablesCatalogWebService"> + <binding.ws/> + </reference> + <reference name="currencyConverter" target="CurrencyConverterWebService"> + <binding.ws/> + </reference> + </component> + + <component name="StoreEUShoppingCart"> + <implementation.java class="services.db.ShoppingCartTableImpl"/> + <property name="database">../store-eu/target/cart-eu-db</property> + <service name="Cart"> + <t:binding.atom uri="/ShoppingCart/Cart"/> + </service> + <service name="Total"> + <t:binding.jsonrpc/> + </service> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-eu/uiservices/store-eu.html b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-eu/uiservices/store-eu.html new file mode 100644 index 0000000000..ec72d9b2a7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-eu/uiservices/store-eu.html @@ -0,0 +1,142 @@ +<!-- + * 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>EU Store</title> + +<script type="text/javascript" src="store-eu.js"></script> + +<script language="JavaScript"> + + //@Reference + var catalog = new Reference("catalog"); + + //@Reference + var shoppingCart = new Reference("shoppingCart"); + + //@Reference + var shoppingTotal = new Reference("shoppingTotal"); + + var catalogItems; + + function catalog_getResponse(items) { + var catalog = ""; + for (var i=0; i<items.length; i++) { + var item = items[i].name + ' - ' + items[i].price; + catalog += '<input name="items" type="checkbox" value="' + + item + '">' + item + ' <br>'; + } + document.getElementById('catalog').innerHTML=catalog; + catalogItems = items; + } + + function shoppingCart_getResponse(feed) { + if (feed != null) { + var entries = feed.getElementsByTagName("entry"); + var list = ""; + for (var i=0; i<entries.length; i++) { + var content = entries[i].getElementsByTagName("content")[0]; + var name = content.getElementsByTagName("name")[0].firstChild.nodeValue; + var price = content.getElementsByTagName("price")[0].firstChild.nodeValue; + list += name + ' - ' + price + ' <br>'; + } + document.getElementById("shoppingCart").innerHTML = list; + + if (entries.length != 0) { + shoppingTotal.getTotal(shoppingTotal_getTotalResponse); + } + } + } + + function shoppingTotal_getTotalResponse(total) { + document.getElementById('total').innerHTML = total; + } + + 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>item</title><content type="text/xml">' + + '<Item xmlns="http://services/">' + + '<name xmlns="">' + catalogItems[i].name + '</name>' + '<price xmlns="">' + catalogItems[i].price + '</price>' + + '</Item>' + '</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">'+ + document.getElementById('shoppingCart').innerHTML+ + '<br>'+ + document.getElementById('total').innerHTML+ + '<br>'+ + '<br>'+ + '<input type="submit" value="Continue Shopping">'+ + '</form>'; + shoppingCart.del("", null); + } + function deleteCart() { + shoppingCart.del("", null); + document.getElementById('shoppingCart').innerHTML = ""; + document.getElementById('total').innerHTML = ""; + } + + function init() { + catalog.get(catalog_getResponse); + shoppingCart.get("", shoppingCart_getResponse); + } + +</script> + +</head> + +<body onload="init()"> +<h1>Store</h1> + <p>Fruits and Vegetables - Fruits et Legumes - Obst und Gemuese + <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/Cart/">(feed)</a> + </form> + </div> +</body> +</html> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-merger/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-merger/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..700a84736c --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-merger/META-INF/sca-contribution.xml @@ -0,0 +1,26 @@ +<?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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:s="http://store"> + <import.java package="services" /> + <import.java package="services.merger" /> + <import.resource uri="uiservices/store.html"/> + <deployable composite="s:store-merger" /> +</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-merger/pom.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-merger/pom.xml new file mode 100644 index 0000000000..3931b754f4 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-merger/pom.xml @@ -0,0 +1,76 @@ +<?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-tutorial</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>tutorial-store-merger</artifactId> + <name>Apache Tuscany SCA Tutorial Merger Online Store</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-sca-api</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <sourceDirectory>${basedir}</sourceDirectory> + <resources> + <resource> + <directory>${basedir}</directory> + <excludes> + <exclude>**/*.java</exclude> + <exclude>**/.*/**</exclude> + <exclude>pom.xml</exclude> + <exclude>build.xml</exclude> + </excludes> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-maven-ant-generator</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <executions> + <execution> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-merger/store-merger.composite b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-merger/store-merger.composite new file mode 100644 index 0000000000..76d77dc693 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-merger/store-merger.composite @@ -0,0 +1,75 @@ +<?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" + targetNamespace="http://store" + name="store-merger"> + + <component name="StoreMerger"> + <t:implementation.widget location="uiservices/store.html"/> + <service name="Widget"> + <t:binding.http uri="/ui"/> + </service> + <reference name="catalog" target="StoreMergerCatalog"> + <t:binding.jsonrpc/> + </reference> + <reference name="shoppingCart" target="StoreMergerShoppingCart/Cart"> + <t:binding.atom/> + </reference> + <reference name="shoppingTotal" target="StoreMergerShoppingCart/Total"> + <t:binding.jsonrpc/> + </reference> + </component> + + <component name="StoreMergerCatalog"> + <implementation.java class="services.merger.MergedCatalogImpl"/> + <property name="currencyCode">USD</property> + <service name="Catalog"> + <t:binding.jsonrpc/> + </service> + <reference name="currencyConverter" target="StoreMergerCurrencyConverter"/> + <reference name="fruitsCatalog" target="StoreMergerFruitsCatalog"/> + <!-- <reference name="vegetablesCatalog" target="MediatedVegetablesCatalog"> --> + <reference name="vegetablesCatalog" target="VegetablesCatalogWebService"> + <binding.ws/> + </reference> + </component> + + <component name="StoreMergerFruitsCatalog"> + <implementation.java class="services.FruitsCatalogImpl"/> + <property name="currencyCode">USD</property> + <reference name="currencyConverter" target="StoreMergerCurrencyConverter"/> + </component> + + <component name="StoreMergerShoppingCart"> + <implementation.java class="services.ShoppingCartImpl"/> + <service name="Cart"> + <t:binding.atom uri="/ShoppingCart/Cart"/> + </service> + <service name="Total"> + <t:binding.jsonrpc/> + </service> + </component> + + <component name="StoreMergerCurrencyConverter"> + <implementation.java class="services.CurrencyConverterImpl"/> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-supplier/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-supplier/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..a75087aca1 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-supplier/META-INF/sca-contribution.xml @@ -0,0 +1,27 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:s="http://store"> + <import.java package="services"/> + <import.java package="services.merger"/> + <import.java package="services.db"/> + <import.resource uri="uiservices/store.html"/> + <deployable composite="s:store-supplier"/> +</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-supplier/pom.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-supplier/pom.xml new file mode 100644 index 0000000000..b84dfb326a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-supplier/pom.xml @@ -0,0 +1,110 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-tutorial</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>tutorial-store-supplier</artifactId> + <name>Apache Tuscany SCA Tutorial Supplier Online Store</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-sca-api</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <sourceDirectory>${basedir}</sourceDirectory> + <resources> + <resource> + <directory>${basedir}</directory> + <excludes> + <exclude>**/*.java</exclude> + <exclude>**/.*/**</exclude> + <exclude>pom.xml</exclude> + <exclude>build.xml</exclude> + </excludes> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-maven-ant-generator</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <executions> + <execution> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>sql-maven-plugin</artifactId> + <version>1.0</version> + + <dependencies> + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <version>10.1.2.1</version> + </dependency> + </dependencies> + + <executions> + <execution> + <id>create-db</id> + <phase>generate-resources</phase> + <goals> + <goal>execute</goal> + </goals> + <configuration> + <driver>org.apache.derby.jdbc.EmbeddedDriver</driver> + <url>jdbc:derby:${basedir}/target/cart-db;create=true</url> + <autocommit>true</autocommit> + <onError>continue</onError> + <delimiter>;</delimiter> + <srcFiles> + <srcFile>${basedir}/../assets/services/db/cart.sql</srcFile> + </srcFiles> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-supplier/store-supplier.composite b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-supplier/store-supplier.composite new file mode 100644 index 0000000000..eedae3bf7a --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store-supplier/store-supplier.composite @@ -0,0 +1,76 @@ +<?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" + targetNamespace="http://store" + name="store-supplier"> + + <component name="StoreSupplier"> + <t:implementation.widget location="uiservices/store.html"/> + <service name="Widget"> + <t:binding.http uri="/ui"/> + </service> + <reference name="catalog" target="StoreSupplierCatalog"> + <t:binding.jsonrpc/> + </reference> + <reference name="shoppingCart" target="StoreSupplierShoppingCart/Cart"> + <t:binding.atom/> + </reference> + <reference name="shoppingTotal" target="StoreSupplierShoppingCart/Total"> + <t:binding.jsonrpc/> + </reference> + </component> + + <component name="StoreSupplierCatalog"> + <implementation.java class="services.merger.MergedCatalogImpl"/> + <property name="currencyCode">USD</property> + <service name="Catalog"> + <t:binding.jsonrpc/> + <binding.ws uri="/CatalogWebService"/> + </service> + <reference name="fruitsCatalog" target="StoreSupplierFruitsCatalog"/> + <reference name="vegetablesCatalog" target="VegetablesCatalogWebService"> + <binding.ws/> + </reference> + <reference name="currencyConverter" target="StoreSupplierCurrencyConverter"/> + </component> + + <component name="StoreSupplierFruitsCatalog"> + <implementation.java class="services.FruitsCatalogImpl"/> + <property name="currencyCode">USD</property> + <reference name="currencyConverter" target="StoreSupplierCurrencyConverter"/> + </component> + + <component name="StoreSupplierShoppingCart"> + <implementation.java class="services.db.ShoppingCartTableImpl"/> + <property name="database">../store-supplier/target/cart-db</property> + <service name="Cart"> + <t:binding.atom uri="/ShoppingCart/Cart"/> + </service> + <service name="Total"> + <t:binding.jsonrpc/> + </service> + </component> + + <component name="StoreSupplierCurrencyConverter"> + <implementation.java class="services.CurrencyConverterImpl"/> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..3ed6e4a4ef --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ +<?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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:s="http://store"> + <import.java package="services"/> + <import.resource uri="uiservices/store.html"/> + <deployable composite="s:store"/> +</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store/pom.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store/pom.xml new file mode 100644 index 0000000000..4f28a69873 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store/pom.xml @@ -0,0 +1,76 @@ +<?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-tutorial</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>tutorial-store</artifactId> + <name>Apache Tuscany SCA Tutorial Online Store</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-sca-api</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <sourceDirectory>${basedir}</sourceDirectory> + <resources> + <resource> + <directory>${basedir}</directory> + <excludes> + <exclude>**/*.java</exclude> + <exclude>**/.*/**</exclude> + <exclude>pom.xml</exclude> + <exclude>build.xml</exclude> + </excludes> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-maven-ant-generator</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <executions> + <execution> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store/store.composite b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store/store.composite new file mode 100644 index 0000000000..95f61b57c0 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/store/store.composite @@ -0,0 +1,64 @@ +<?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" + targetNamespace="http://store" + name="store"> + + <component name="Store"> + <t:implementation.widget location="uiservices/store.html"/> + <service name="Widget"> + <t:binding.http uri="/ui"/> + </service> + <reference name="catalog" target="Catalog"> + <t:binding.jsonrpc/> + </reference> + <reference name="shoppingCart" target="ShoppingCart/Cart"> + <t:binding.atom/> + </reference> + <reference name="shoppingTotal" target="ShoppingCart/Total"> + <t:binding.jsonrpc/> + </reference> + </component> + + <component name="Catalog">
+ <implementation.java class="services.FruitsCatalogImpl"/>
+ <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="Cart">
+ <t:binding.atom uri="/ShoppingCart/Cart"/>
+ </service>
+ <service name="Total"> + <t:binding.jsonrpc/> + </service> + </component>
+
+ <component name="CurrencyConverter">
+ <implementation.java class="services.CurrencyConverterImpl"/>
+ </component>
+ +</composite>
diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/web-services/META-INF/sca-contribution.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/web-services/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..8f773f0f21 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/web-services/META-INF/sca-contribution.xml @@ -0,0 +1,25 @@ +<?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. +--> +<contribution xmlns="http://www.osoa.org/xmlns/sca/1.0" + xmlns:c="http://services"> + <import.java package="services"/> + <deployable composite="c:catalogs"/> + <deployable composite="c:currency"/> +</contribution>
\ No newline at end of file diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/web-services/catalogs.composite b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/web-services/catalogs.composite new file mode 100644 index 0000000000..154d475165 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/web-services/catalogs.composite @@ -0,0 +1,43 @@ +<?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" + targetNamespace="http://services" + name="catalogs"> + + <component name="FruitsCatalogWebService"> + <implementation.java class="services.FruitsCatalogImpl"/> + <service name="Catalog"> + <binding.ws/> + </service> + <property name="currencyCode">USD</property> + <reference name="currencyConverter" target="CurrencyConverterWebService"> + <binding.ws/> + </reference> + </component> + + <component name="VegetablesCatalogWebService"> + <implementation.java class="services.VegetablesCatalogImpl"/> + <service name="Catalog"> + <binding.ws/> + </service> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/web-services/currency.composite b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/web-services/currency.composite new file mode 100644 index 0000000000..7a3f70e299 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/web-services/currency.composite @@ -0,0 +1,32 @@ +<?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" + targetNamespace="http://services" + name="currency"> + + <component name="CurrencyConverterWebService"> + <implementation.java class="services.CurrencyConverterImpl"/> + <service name="CurrencyConverter"> + <binding.ws/> + </service> + </component> + +</composite> diff --git a/sca-java-1.x/branches/sca-java-1.2.1/tutorial/web-services/pom.xml b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/web-services/pom.xml new file mode 100644 index 0000000000..7bf9f671c7 --- /dev/null +++ b/sca-java-1.x/branches/sca-java-1.2.1/tutorial/web-services/pom.xml @@ -0,0 +1,76 @@ +<?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-tutorial</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <relativePath>../pom.xml</relativePath> + </parent> + <artifactId>tutorial-web-services</artifactId> + <name>Apache Tuscany SCA Tutorial Web Services</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-sca-api</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + </dependency> + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <sourceDirectory>${basedir}</sourceDirectory> + <resources> + <resource> + <directory>${basedir}</directory> + <excludes> + <exclude>**/*.java</exclude> + <exclude>**/.*/**</exclude> + <exclude>pom.xml</exclude> + <exclude>build.xml</exclude> + </excludes> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-maven-ant-generator</artifactId> + <version>1.2.1-incubating-SNAPSHOT</version> + <executions> + <execution> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> + +</project> |