diff options
author | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2008-07-28 08:10:57 +0000 |
---|---|---|
committer | slaws <slaws@13f79535-47bb-0310-9956-ffa450edef68> | 2008-07-28 08:10:57 +0000 |
commit | a85d1c91a07b63250cee696081f3b0c59029eeff (patch) | |
tree | c02983c4a536a7116e34ac50325a6048fdacfb63 /sandbox/travelsample | |
parent | bc0919b6fea37a236748fd1f7a480b6aad3baf46 (diff) |
More modules for the travel sample
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@680283 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/travelsample')
36 files changed, 2290 insertions, 10 deletions
diff --git a/sandbox/travelsample/calendar-contribution/META-INF/sca-contribution.xml b/sandbox/travelsample/calendar-contribution/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..327ce07643 --- /dev/null +++ b/sandbox/travelsample/calendar-contribution/META-INF/sca-contribution.xml @@ -0,0 +1,22 @@ +<?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="scatours.calendar"/> +</contribution>
\ No newline at end of file diff --git a/sandbox/travelsample/calendar-contribution/pom.xml b/sandbox/travelsample/calendar-contribution/pom.xml new file mode 100644 index 0000000000..2610706329 --- /dev/null +++ b/sandbox/travelsample/calendar-contribution/pom.xml @@ -0,0 +1,57 @@ +<?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.4-SNAPSHOT</version> + <!--relativePath>../../pom.xml</relativePath--> + </parent> + <artifactId>scatours-calendar-contribution</artifactId> + <name>Apache Tuscany SCA Tours Calendar Contribution</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.4-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.4-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.2</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + </build> +</project> diff --git a/sandbox/travelsample/calendar-contribution/src/main/java/calendar/Calendar.java b/sandbox/travelsample/calendar-contribution/src/main/java/calendar/Calendar.java new file mode 100644 index 0000000000..90736b92b4 --- /dev/null +++ b/sandbox/travelsample/calendar-contribution/src/main/java/calendar/Calendar.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 calendar; + +/** + * The Add service interface + */ +public interface Calendar { + + String getEndDate(String startDate, int duration); + +} diff --git a/sandbox/travelsample/calendar-contribution/src/main/java/calendar/CalendarImpl.java b/sandbox/travelsample/calendar-contribution/src/main/java/calendar/CalendarImpl.java new file mode 100644 index 0000000000..343926da65 --- /dev/null +++ b/sandbox/travelsample/calendar-contribution/src/main/java/calendar/CalendarImpl.java @@ -0,0 +1,48 @@ +/* + * 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 calendar; + +import java.text.DateFormat; +import java.util.Date; +import java.util.TimeZone; +import java.util.logging.Level; +import java.util.logging.Logger; + +/** + * An implementation of the Add service + */ +public class CalendarImpl implements Calendar { + + public String getEndDate(String startDate, int duration){ + String returnDate = "Invalid Date"; + + try { + Date date = DateFormat.getInstance().parse(startDate); + java.util.Calendar calendar = java.util.Calendar.getInstance(); + calendar.setTime(date); + calendar.add(java.util.Calendar.DATE, duration); + returnDate = DateFormat.getInstance().format(calendar.getTime()); + } catch (Exception ex){ + // do nothing + System.out.println(ex.toString()); + } + + return returnDate; + } +} diff --git a/sandbox/travelsample/calendar-contribution/src/main/resources/calendar.composite b/sandbox/travelsample/calendar-contribution/src/main/resources/calendar.composite new file mode 100644 index 0000000000..b72c450446 --- /dev/null +++ b/sandbox/travelsample/calendar-contribution/src/main/resources/calendar.composite @@ -0,0 +1,29 @@ +<?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://travel" + xmlns:sample="http://travel" + name="calendar"> + + <component name="CalendarComponent"> + <implementation.java class="calendar.CalendarImpl"/> + </component> + +</composite> diff --git a/sandbox/travelsample/calendar-contribution/src/test/java/calendar/CalendarTestCase.java b/sandbox/travelsample/calendar-contribution/src/test/java/calendar/CalendarTestCase.java new file mode 100644 index 0000000000..fee00fbb0a --- /dev/null +++ b/sandbox/travelsample/calendar-contribution/src/test/java/calendar/CalendarTestCase.java @@ -0,0 +1,47 @@ +/* + * 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 calendar; + +import junit.framework.TestCase; + +import org.apache.tuscany.sca.host.embedded.SCADomain; + +/** + * This shows how to test the Calculator service component. + */ +public class CalendarTestCase extends TestCase { + + private Calendar calendar; + private SCADomain scaDomain; + + @Override + protected void setUp() throws Exception { + scaDomain = SCADomain.newInstance("calendar.composite"); + calendar = scaDomain.getService(Calendar.class, "CalendarComponent"); + } + + @Override + protected void tearDown() throws Exception { + scaDomain.close(); + } + + public void testCalculator() throws Exception { + System.out.println(calendar.getEndDate("07/10/96 04:05", 3)); + } +} diff --git a/sandbox/travelsample/calendar-contribution/src/test/resources/calendar.composite b/sandbox/travelsample/calendar-contribution/src/test/resources/calendar.composite new file mode 100644 index 0000000000..b72c450446 --- /dev/null +++ b/sandbox/travelsample/calendar-contribution/src/test/resources/calendar.composite @@ -0,0 +1,29 @@ +<?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://travel" + xmlns:sample="http://travel" + name="calendar"> + + <component name="CalendarComponent"> + <implementation.java class="calendar.CalendarImpl"/> + </component> + +</composite> diff --git a/sandbox/travelsample/common-contribution/META-INF/sca-contribution.xml b/sandbox/travelsample/common-contribution/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..c2b9fd12c7 --- /dev/null +++ b/sandbox/travelsample/common-contribution/META-INF/sca-contribution.xml @@ -0,0 +1,22 @@ +<?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="scatours.common"/> +</contribution>
\ No newline at end of file diff --git a/sandbox/travelsample/common-contribution/build.xml b/sandbox/travelsample/common-contribution/build.xml new file mode 100644 index 0000000000..b4fbc726cf --- /dev/null +++ b/sandbox/travelsample/common-contribution/build.xml @@ -0,0 +1,61 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project name="gettingstarted" default="compile"> + <property environment="env"/> + + <target name="compile"> + <mkdir dir="target/classes"/> + <javac srcdir="src" destdir="target/classes" + debug="on" source="1.5" target="1.5"> + <classpath> + <pathelement location="${env.TUSCANY}/lib/tuscany-sca-manifest.jar"/> + </classpath> + </javac> + </target> + + <target name="run"> + <java classname="client.CurrencyConverterClient" fork="true"> + <classpath> + <pathelement path="src"/> + <pathelement path="target/classes"/> + <pathelement location="${env.TUSCANY}/lib/tuscany-sca-manifest.jar"/> + </classpath> + </java> + </target> + + <target name="runtrip"> + <java classname="client.TripClient" fork="true"> + <classpath> + <pathelement path="src"/> + <pathelement path="target/classes"/> + <pathelement location="${env.TUSCANY}/lib/tuscany-sca-manifest.jar"/> + </classpath> + </java> + </target> + + <target name="runtripws"> + <java classname="client.TripWsClient" fork="true"> + <classpath> + <pathelement path="src"/> + <pathelement path="target/classes"/> + <pathelement location="${env.TUSCANY}/lib/tuscany-sca-manifest.jar"/> + </classpath> + </java> + </target> +</project> diff --git a/sandbox/travelsample/common-contribution/pom.xml b/sandbox/travelsample/common-contribution/pom.xml new file mode 100644 index 0000000000..a170b3d80b --- /dev/null +++ b/sandbox/travelsample/common-contribution/pom.xml @@ -0,0 +1,57 @@ +<?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.4-SNAPSHOT</version> + <!--relativePath>../../pom.xml</relativePath--> + </parent> + <artifactId>scatours-common-contribution</artifactId> + <name>Apache Tuscany SCA Tours Common Artefacts Contribution</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca-api</artifactId> + <version>1.4-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-data-api</artifactId> + <version>1.4-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.2</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <sourceDirectory>${basedir}/src</sourceDirectory> + </build> +</project> diff --git a/sandbox/travelsample/common-contribution/src/scatours/common/Search.java b/sandbox/travelsample/common-contribution/src/scatours/common/Search.java new file mode 100644 index 0000000000..4686e9306b --- /dev/null +++ b/sandbox/travelsample/common-contribution/src/scatours/common/Search.java @@ -0,0 +1,35 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ + +package scatours.common; + +import java.util.List; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.OneWay; +import org.osoa.sca.annotations.Remotable; + +@Remotable +@Callback(SearchCallback.class) +public interface Search { + TripItem[] searchSynch(TripLeg tripLeg); + + // TODO - Use to run searches in parallel @OneWay + void searchAsynch(TripLeg tripLeg); +} diff --git a/sandbox/travelsample/common-contribution/src/scatours/common/SearchCallback.java b/sandbox/travelsample/common-contribution/src/scatours/common/SearchCallback.java new file mode 100644 index 0000000000..4bc88fd623 --- /dev/null +++ b/sandbox/travelsample/common-contribution/src/scatours/common/SearchCallback.java @@ -0,0 +1,30 @@ +/* + * 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 scatours.common; + +import java.util.List; + +import org.apache.tuscany.sca.data.collection.Item; +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface SearchCallback { + void searchResults(TripItem[] items); +} diff --git a/sandbox/travelsample/common-contribution/src/scatours/common/TripItem.java b/sandbox/travelsample/common-contribution/src/scatours/common/TripItem.java new file mode 100644 index 0000000000..8f264c7f1d --- /dev/null +++ b/sandbox/travelsample/common-contribution/src/scatours/common/TripItem.java @@ -0,0 +1,96 @@ +/* + * 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 scatours.common; + + +public class TripItem { + + private String id; + private String type; + private String name; + private String description; + private String location; + private String link; + + public TripItem() { + } + + public TripItem(String id, + String type, + String name, + String description, + String location, + String link) { + this.id = id; + this.type = type; + this.name = name; + this.description = description; + this.location = location; + this.link = link; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getLink() { + return link; + } + + public void setLink(String link) { + this.link = link; + } +} diff --git a/sandbox/travelsample/common-contribution/src/scatours/common/TripLeg.java b/sandbox/travelsample/common-contribution/src/scatours/common/TripLeg.java new file mode 100644 index 0000000000..1af33aa6f9 --- /dev/null +++ b/sandbox/travelsample/common-contribution/src/scatours/common/TripLeg.java @@ -0,0 +1,97 @@ +/* + * 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 scatours.common; + + +public class TripLeg { + + private String id; + private String fromLocation; + private String toLocation; + private String fromDate; + private String toDate; + private String noOfPeople; + + + public TripLeg() { + } + + public TripLeg(String id, + String fromLocation, + String toLocation, + String fromDate, + String toDate, + String noOfPeople) { + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getFromLocation() { + return fromLocation; + } + + public void setFromLocation(String fromLocation) { + this.fromLocation = fromLocation; + } + + public String getToLocation() { + return toLocation; + } + + public void setToLocation(String toLocation) { + this.toLocation = toLocation; + } + + public String getFromDate() { + return fromDate; + } + + public void setFromDate(String fromDate) { + this.fromDate = fromDate; + } + + public String getToDate() { + return toDate; + } + + public void setToDate(String toDate) { + this.toDate = toDate; + } + + public String getNoOfPeople() { + return noOfPeople; + } + + public void setNoOfPeople(String noOfPeople) { + this.noOfPeople = noOfPeople; + } + + + + + + +} diff --git a/sandbox/travelsample/gettingstarted/pom.xml b/sandbox/travelsample/gettingstarted/pom.xml index fd538c2d0e..91012e3f6e 100644 --- a/sandbox/travelsample/gettingstarted/pom.xml +++ b/sandbox/travelsample/gettingstarted/pom.xml @@ -22,8 +22,8 @@ <parent> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-sca</artifactId> - <version>2.0-incubating-SNAPSHOT</version> - <relativePath>../../pom.xml</relativePath> + <version>1.4-SNAPSHOT</version> + <!--relativePath>../../pom.xml</relativePath--> </parent> <artifactId>scatours-gettingstarted</artifactId> <name>Apache Tuscany SCA Tours Getting Started</name> @@ -32,27 +32,27 @@ <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-host-embedded</artifactId> - <version>2.0-incubating-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> </dependency> <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-implementation-java-runtime</artifactId> - <version>2.0-incubating-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-binding-ws-axis2</artifactId> - <version>2.0-incubating-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> <scope>test</scope> </dependency> <dependency> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-host-tomcat</artifactId> - <version>2.0-incubating-SNAPSHOT</version> + <version>1.4-SNAPSHOT</version> <scope>test</scope> </dependency> diff --git a/sandbox/travelsample/hotel-contribution/META-INF/sca-contribution.xml b/sandbox/travelsample/hotel-contribution/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..765c8d1cc3 --- /dev/null +++ b/sandbox/travelsample/hotel-contribution/META-INF/sca-contribution.xml @@ -0,0 +1,23 @@ +<?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"> + <import.java package="scatours.common"/> + <export.java package="scatours.hotel"/> +</contribution>
\ No newline at end of file diff --git a/sandbox/travelsample/hotel-contribution/pom.xml b/sandbox/travelsample/hotel-contribution/pom.xml new file mode 100644 index 0000000000..7746f91c26 --- /dev/null +++ b/sandbox/travelsample/hotel-contribution/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-sca</artifactId> + <version>1.4-SNAPSHOT</version> + <!--relativePath>../../pom.xml</relativePath--> + </parent> + <artifactId>scatours-hotel-contribution</artifactId> + <name>Apache Tuscany SCA Tours Hotel Contribution</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca-api</artifactId> + <version>1.4-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-data-api</artifactId> + <version>1.4-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-common-contribution</artifactId> + <version>1.4-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.2</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <sourceDirectory>${basedir}/src</sourceDirectory> + <resources> + <resource> + <directory>${basedir}</directory> + <excludes> + <exclude>**/*.java</exclude> + <exclude>**/.*/**</exclude> + <exclude>pom.xml</exclude> + <exclude>build.xml</exclude> + <exclude>target/**</exclude> + <exclude>src/**</exclude> + </excludes> + </resource> + </resources> + </build> +</project> diff --git a/sandbox/travelsample/hotel-contribution/src/scatours/hotel/HotelImpl.java b/sandbox/travelsample/hotel-contribution/src/scatours/hotel/HotelImpl.java new file mode 100644 index 0000000000..769cbcaed7 --- /dev/null +++ b/sandbox/travelsample/hotel-contribution/src/scatours/hotel/HotelImpl.java @@ -0,0 +1,90 @@ +/* + * 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 scatours.hotel; + +import java.util.ArrayList; +import java.util.List; + +import org.osoa.sca.annotations.Callback; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import scatours.common.Search; +import scatours.common.SearchCallback; +import scatours.common.TripItem; +import scatours.common.TripLeg; + +/** + * An implementation of the Hotel service + */ +@Scope("STATELESS") +@Service(interfaces={Search.class}) +public class HotelImpl implements Search { + + private List<HotelInfo> hotels = new ArrayList<HotelInfo>(); + + @Callback + protected SearchCallback searchCallback; + + @Init + public void init() { + hotels.add(new HotelInfo("Deep Bay Hotel", + "Wonderful sea views and a relaxed atmosphere", + "ANU", + "http://localhost:8085/tbd" )); + hotels.add(new HotelInfo("Long Bay Hotel", + "Friendly staff and an ocean breeze", + "ANU", + "http://localhost:8085/tbd" )); + hotels.add(new HotelInfo("City Hotel", + "Smart rooms and early breakfasts", + "NY", + "http://localhost:8085/tbd" )); + hotels.add(new HotelInfo("County Hotel", + "The smell of the open country", + "SOU", + "http://localhost:8085/tbd" )); + } + + public TripItem[] searchSynch(TripLeg tripLeg) { + List<TripItem> items = new ArrayList<TripItem>(); + + // find available hotels + for(HotelInfo hotel : hotels){ + if (hotel.getLocation().equals(tripLeg.getToLocation())){ + TripItem item = new TripItem("1", + "Hotel", + hotel.getName(), + hotel.getDescription(), + hotel.getLocation(), + hotel.getLink()); + items.add(item); + } + } + + return items.toArray(new TripItem[items.size()]); + } + + public void searchAsynch(TripLeg tripLeg) { + + // return available hotels + searchCallback.searchResults(searchSynch(tripLeg)); + } +} diff --git a/sandbox/travelsample/hotel-contribution/src/scatours/hotel/HotelInfo.java b/sandbox/travelsample/hotel-contribution/src/scatours/hotel/HotelInfo.java new file mode 100644 index 0000000000..6c8471ebb4 --- /dev/null +++ b/sandbox/travelsample/hotel-contribution/src/scatours/hotel/HotelInfo.java @@ -0,0 +1,76 @@ +/* + * 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 scatours.hotel; + + +public class HotelInfo { + + private String name; + private String description; + private String location; + private String link; + + public HotelInfo() { + } + + public HotelInfo(String name, + String description, + String location, + String link) { + + this.name = name; + this.description = description; + this.location = location; + this.link = link; + } + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getLocation() { + return location; + } + + public void setLocation(String location) { + this.location = location; + } + + public String getLink() { + return link; + } + + public void setLink(String link) { + this.link = link; + } +} diff --git a/sandbox/travelsample/node/build.xml b/sandbox/travelsample/node/build.xml new file mode 100644 index 0000000000..9280cccb97 --- /dev/null +++ b/sandbox/travelsample/node/build.xml @@ -0,0 +1,206 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<project name="scatours-node" default="compile"> + + <target name="compile"> + <mkdir dir="target/classes"/> + <javac destdir="target/classes" debug="on" source="1.5" target="1.5"> + <src path="src"/> + <classpath> + <fileset refid="tuscany.jars"/> + <fileset refid="3rdparty.jars"/> + </classpath> + </javac> + <copy todir="target/classes"> + <fileset dir="." excludes="**/*.java, pom.xml, build.xml, target"/> + </copy> + <jar destfile="target/scatours-node.jar" basedir="target/classes"> + <manifest> + <attribute name="Main-Class" value="launch.LaunchTutorialAdmin"/> + </manifest> + </jar> + </target> + + <target name="package" depends="compile"/> + + <target name="run"> + <java classname="launch.LaunchTutorialAdmin" fork="true"> + <classpath> + <pathelement location="target/scatours-node.jar"/> + <fileset refid="tuscany.jars"/> + <fileset refid="3rdparty.jars"/> + </classpath> + </java> + </target> + + <target name="clean"> + <delete includeemptydirs="true"> + <fileset dir="target"/> + </delete> + </target> + + <fileset id="tuscany.jars" dir="../../modules"> + <include name="tuscany-assembly-1.4-SNAPSHOT.jar"/> + <include name="tuscany-assembly-xml-1.4-SNAPSHOT.jar"/> + <include name="tuscany-assembly-xsd-1.4-SNAPSHOT.jar"/> + <include name="tuscany-binding-atom-1.4-SNAPSHOT.jar"/> + <include name="tuscany-binding-atom-abdera-1.4-SNAPSHOT.jar"/> + <include name="tuscany-binding-ejb-1.4-SNAPSHOT.jar"/> + <include name="tuscany-binding-ejb-runtime-1.4-SNAPSHOT.jar"/> + <include name="tuscany-binding-http-1.4-SNAPSHOT.jar"/> + <include name="tuscany-binding-http-runtime-1.4-SNAPSHOT.jar"/> + <include name="tuscany-binding-jsonrpc-1.4-SNAPSHOT.jar"/> + <include name="tuscany-binding-jsonrpc-runtime-1.4-SNAPSHOT.jar"/> + <include name="tuscany-binding-sca-1.4-SNAPSHOT.jar"/> + <include name="tuscany-binding-sca-axis2-1.4-SNAPSHOT.jar"/> + <include name="tuscany-binding-sca-xml-1.4-SNAPSHOT.jar"/> + <include name="tuscany-binding-ws-1.4-SNAPSHOT.jar"/> + <include name="tuscany-binding-ws-axis2-1.4-SNAPSHOT.jar"/> + <include name="tuscany-binding-ws-wsdlgen-1.4-SNAPSHOT.jar"/> + <include name="tuscany-binding-ws-xml-1.4-SNAPSHOT.jar"/> + <include name="tuscany-contribution-1.4-SNAPSHOT.jar"/> + <include name="tuscany-contribution-impl-1.4-SNAPSHOT.jar"/> + <include name="tuscany-contribution-java-1.4-SNAPSHOT.jar"/> + <include name="tuscany-contribution-namespace-1.4-SNAPSHOT.jar"/> + <include name="tuscany-contribution-resource-1.4-SNAPSHOT.jar"/> + <include name="tuscany-contribution-xml-1.4-SNAPSHOT.jar"/> + <include name="tuscany-core-1.4-SNAPSHOT.jar"/> + <include name="tuscany-core-databinding-1.4-SNAPSHOT.jar"/> + <include name="tuscany-core-spi-1.4-SNAPSHOT.jar"/> + <include name="tuscany-data-api-1.4-SNAPSHOT.jar"/> + <include name="tuscany-databinding-1.4-SNAPSHOT.jar"/> + <include name="tuscany-databinding-axiom-1.4-SNAPSHOT.jar"/> + <include name="tuscany-databinding-jaxb-1.4-SNAPSHOT.jar"/> + <include name="tuscany-databinding-jaxb-axiom-1.4-SNAPSHOT.jar"/> + <include name="tuscany-databinding-json-1.4-SNAPSHOT.jar"/> + <include name="tuscany-definitions-1.4-SNAPSHOT.jar"/> + <include name="tuscany-definitions-xml-1.4-SNAPSHOT.jar"/> + <include name="tuscany-domain-manager-1.4-SNAPSHOT.jar"/> + <include name="tuscany-endpoint-1.4-SNAPSHOT.jar"/> + <include name="tuscany-extensibility-1.4-SNAPSHOT.jar"/> + <include name="tuscany-host-embedded-1.4-SNAPSHOT.jar"/> + <include name="tuscany-host-http-1.4-SNAPSHOT.jar"/> + <include name="tuscany-host-jetty-1.4-SNAPSHOT.jar"/> + <include name="tuscany-implementation-ejb-1.4-SNAPSHOT.jar"/> + <include name="tuscany-implementation-java-1.4-SNAPSHOT.jar"/> + <include name="tuscany-implementation-java-runtime-1.4-SNAPSHOT.jar"/> + <include name="tuscany-implementation-java-xml-1.4-SNAPSHOT.jar"/> + <include name="tuscany-implementation-node-1.4-SNAPSHOT.jar"/> + <include name="tuscany-implementation-node-runtime-1.4-SNAPSHOT.jar"/> + <include name="tuscany-implementation-resource-1.4-SNAPSHOT.jar"/> + <include name="tuscany-implementation-resource-runtime-1.4-SNAPSHOT.jar"/> + <include name="tuscany-implementation-widget-1.4-SNAPSHOT.jar"/> + <include name="tuscany-implementation-widget-runtime-1.4-SNAPSHOT.jar"/> + <include name="tuscany-interface-1.4-SNAPSHOT.jar"/> + <include name="tuscany-interface-java-1.4-SNAPSHOT.jar"/> + <include name="tuscany-interface-java-jaxws-1.4-SNAPSHOT.jar"/> + <include name="tuscany-interface-java-xml-1.4-SNAPSHOT.jar"/> + <include name="tuscany-interface-wsdl-1.4-SNAPSHOT.jar"/> + <include name="tuscany-interface-wsdl-xml-1.4-SNAPSHOT.jar"/> + <include name="tuscany-monitor-1.4-SNAPSHOT.jar"/> + <include name="tuscany-monitor-logging-1.4-SNAPSHOT.jar"/> + <include name="tuscany-node-manager-1.4-SNAPSHOT.jar"/> + <include name="tuscany-node2-api-1.4-SNAPSHOT.jar"/> + <include name="tuscany-node2-impl-1.4-SNAPSHOT.jar"/> + <include name="tuscany-node2-launcher-1.4-SNAPSHOT.jar"/> + <include name="tuscany-policy-1.4-SNAPSHOT.jar"/> + <include name="tuscany-policy-security-1.4-SNAPSHOT.jar"/> + <include name="tuscany-policy-security-ws-1.4-SNAPSHOT.jar"/> + <include name="tuscany-policy-xml-1.4-SNAPSHOT.jar"/> + <include name="tuscany-policy-xml-ws-1.4-SNAPSHOT.jar"/> + <include name="tuscany-sca-api-1.4-SNAPSHOT.jar"/> + <include name="tuscany-workspace-1.4-SNAPSHOT.jar"/> + <include name="tuscany-workspace-impl-1.4-SNAPSHOT.jar"/> + <include name="tuscany-workspace-xml-1.4-SNAPSHOT.jar"/> + <include name="tuscany-xsd-1.4-SNAPSHOT.jar"/> + <include name="tuscany-xsd-xml-1.4-SNAPSHOT.jar"/> + </fileset> + <fileset id="3rdparty.jars" dir="../../lib"> + <include name="XmlSchema-1.3.2.jar"/> + <include name="abdera-core-0.3.0-incubating.jar"/> + <include name="abdera-i18n-0.3.0-incubating.jar"/> + <include name="abdera-parser-0.3.0-incubating.jar"/> + <include name="activation-1.1.jar"/> + <include name="annogen-0.1.0.jar"/> + <include name="asm-all-3.1.jar"/> + <include name="axiom-api-1.2.5.jar"/> + <include name="axiom-dom-1.2.5.jar"/> + <include name="axiom-impl-1.2.5.jar"/> + <include name="axis2-adb-1.3.jar"/> + <include name="axis2-adb-codegen-1.3.jar"/> + <include name="axis2-codegen-1.3.jar"/> + <include name="axis2-java2wsdl-1.3.jar"/> + <include name="axis2-kernel-1.3.jar"/> + <include name="axis2-mtompolicy-1.3.jar"/> + <include name="backport-util-concurrent-3.0.jar"/> + <include name="bcprov-jdk15-132.jar"/> + <include name="cglib-nodep-2.1_3.jar"/> + <include name="commons-codec-1.3.jar"/> + <include name="commons-collections-3.1.jar"/> + <include name="commons-discovery-0.2.jar"/> + <include name="commons-fileupload-1.1.1.jar"/> + <include name="commons-httpclient-3.0.1.jar"/> + <include name="commons-io-1.1.jar"/> + <include name="commons-logging-1.1.jar"/> + <include name="derby-10.3.1.4.jar"/> + <include name="dom4j-1.6.1.jar"/> + <include name="geronimo-activation_1.0.2_spec-1.1.jar"/> + <include name="geronimo-activation_1.1_spec-1.0-M1.jar"/> + <include name="geronimo-commonj_1.1_spec-1.0.jar"/> + <include name="geronimo-ejb_3.0_spec-1.0.jar"/> + <include name="geronimo-javamail_1.4_spec-1.0-M1.jar"/> + <include name="geronimo-jms_1.1_spec-1.1.jar"/> + <include name="httpcore-4.0-alpha5.jar"/> + <include name="httpcore-nio-4.0-alpha5.jar"/> + <include name="httpcore-niossl-4.0-alpha5.jar"/> + <include name="jaxb-api-2.1.jar"/> + <include name="jaxb-impl-2.1.7.jar"/> + <include name="jaxen-1.1.1.jar"/> + <include name="jaxws-api-2.1.jar"/> + <include name="jdom-1.0.jar"/> + <include name="jettison-1.0.jar"/> + <include name="jetty-6.1.7.jar"/> + <include name="jetty-util-6.1.7.jar"/> + <include name="json-rpc-1.0.jar"/> + <include name="jsr181-api-1.0-MR1.jar"/> + <include name="jsr250-api-1.0.jar"/> + <include name="junit-3.8.1.jar"/> + <include name="log4j-1.2.12.jar"/> + <include name="logkit-1.0.1.jar"/> + <include name="mail-1.4.jar"/> + <include name="neethi-2.0.2.jar"/> + <include name="opensaml-1.1.jar"/> + <include name="rampart-core-1.3.jar"/> + <include name="rampart-policy-1.3.jar"/> + <include name="rampart-trust-1.3.jar"/> + <include name="servlet-api-2.5.jar"/> + <include name="stax-api-1.0-2.jar"/> + <include name="stax-api-1.0.1.jar"/> + <include name="woden-1.0-incubating-M7b.jar"/> + <include name="wsdl4j-1.6.2.jar"/> + <include name="wss4j-1.5.3.jar"/> + <include name="wstx-asl-3.2.1.jar"/> + <include name="xalan-2.7.0.jar"/> + <include name="xercesImpl-2.8.1.jar"/> + <include name="xml-apis-1.3.03.jar"/> + <include name="xmlsec-1.4.0.jar"/> + </fileset> + +</project> diff --git a/sandbox/travelsample/node/pom.xml b/sandbox/travelsample/node/pom.xml new file mode 100644 index 0000000000..8674b0c060 --- /dev/null +++ b/sandbox/travelsample/node/pom.xml @@ -0,0 +1,171 @@ +<?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.4-SNAPSHOT</version> + <!--relativePath>../../pom.xml</relativePath--> + </parent> + <artifactId>scatours-node</artifactId> + <name>Apache Tuscany SCA Tours Node</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node2-api</artifactId> + <version>1.4-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-node2-launcher</artifactId> + <version>1.4-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-domain-manager</artifactId> + <version>1.4-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-node-runtime</artifactId> + <version>1.4-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.4-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-widget-runtime</artifactId> + <version>1.4-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-resource-runtime</artifactId> + <version>1.4-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-atom-abdera</artifactId> + <version>1.4-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-jsonrpc-runtime</artifactId> + <version>1.4-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-http-runtime</artifactId> + <version>1.4-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>1.4-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-sca-axis2</artifactId> + <version>1.4-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ejb-runtime</artifactId> + <version>1.4-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-ejb</artifactId> + <version>1.4-SNAPSHOT</version> + <scope>runtime</scope> + </dependency> + + <dependency> + <groupId>org.apache.derby</groupId> + <artifactId>derby</artifactId> + <version>10.3.1.4</version> + <scope>runtime</scope> + </dependency> + + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <sourceDirectory>${basedir}/src</sourceDirectory> + <resources> + <resource> + <directory>${basedir}</directory> + <excludes> + <exclude>**/*.java</exclude> + <exclude>**/.*/**</exclude> + <exclude>pom.xml</exclude> + <exclude>build.xml</exclude> + <exclude>target/**</exclude> + <exclude>src/**</exclude> + </excludes> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-maven-ant-generator</artifactId> + <version>1.4-SNAPSHOT</version> + <executions> + <execution> + <configuration> + <mainClass>launch.LaunchTutorialAdmin</mainClass> + </configuration> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/sandbox/travelsample/node/src/scatours/LaunchNode.java b/sandbox/travelsample/node/src/scatours/LaunchNode.java new file mode 100644 index 0000000000..61f4fa27f8 --- /dev/null +++ b/sandbox/travelsample/node/src/scatours/LaunchNode.java @@ -0,0 +1,109 @@ +/* + * 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 scatours; + +import java.io.IOException; + +import org.apache.tuscany.sca.node.SCAContribution; +import org.apache.tuscany.sca.node.SCANode2; +import org.apache.tuscany.sca.node.SCANode2Factory; +import org.apache.tuscany.sca.node.launcher.NodeLauncher; + +public class LaunchNode { + public static void main(String[] args) throws Exception { + LaunchNode.launchFromFileSystemDir(); + } + + // OK for development but you must launch the node from this module + public static void launchFromFileSystemJar(){ + SCANode2 node = null; + + try { + node = SCANode2Factory.newInstance().createSCANode("scatours.composite", + new SCAContribution("common", "../common-contribution/target/scatours-common-contribution.jar"), + new SCAContribution("currency", "../currency-contribution/target/scatours-currency-contribution.jar"), + new SCAContribution("hotel", "../hotel-contribution/target/scatours-hotel-contribution.jar"), + new SCAContribution("trip", "../trip-contribution/target/scatours-trip-contribution.jar"), + new SCAContribution("ui", "../ui-contribution/target/scatours-ui-contribution.jar")); + + node.start(); + + System.out.println("Node started - Press enter to shutdown."); + try { + System.in.read(); + } catch (IOException e) {} + + node.stop(); + + } catch (Exception ex) { + System.out.println(ex.toString()); + } + } + + // OK for development but you must launch the node from this module + public static void launchFromFileSystemDir(){ + SCANode2 node = null; + + try { + node = SCANode2Factory.newInstance().createSCANode("scatours.composite", + new SCAContribution("common", "../common-contribution/target/classes"), + new SCAContribution("currency", "../currency-contribution/target/classes"), + new SCAContribution("hotel", "../hotel-contribution/target/classes"), + new SCAContribution("trip", "../trip-contribution/target/classes"), + new SCAContribution("ui", "../ui-contribution/target/classes")); + node.start(); + + System.out.println("Node started - Press enter to shutdown."); + try { + System.in.read(); + } catch (IOException e) {} + + node.stop(); + + } catch (Exception ex) { + System.out.println(ex.toString()); + } + } + + // OK for samples but you can only load one contribution + public static void launchFromClasspath(){ + SCANode2 node = null; + + try { + node = SCANode2Factory.newInstance().createSCANodeFromClassLoader("scatours.composite", null); + node.start(); + + System.out.println("Node started - Press enter to shutdown."); + try { + System.in.read(); + } catch (IOException e) {} + + node.stop(); + + } catch (Exception ex) { + System.out.println(ex.toString()); + } + } + + // have to be running the domain in this case + public static void launchFromDomain()throws Exception { + NodeLauncher.main(new String[] {"http://localhost:9990/node-config/SCAToursNode"}); + } +} diff --git a/sandbox/travelsample/pom.xml b/sandbox/travelsample/pom.xml index 6568384acb..bab8add34f 100644 --- a/sandbox/travelsample/pom.xml +++ b/sandbox/travelsample/pom.xml @@ -22,8 +22,8 @@ <parent> <groupId>org.apache.tuscany.sca</groupId> <artifactId>tuscany-sca</artifactId> - <version>2.0-incubating-SNAPSHOT</version> - <relativePath>../pom.xml</relativePath> + <version>1.4-SNAPSHOT</version> + <!--relativePath>../pom.xml</relativePath--> </parent> <artifactId>tuscany-scatours</artifactId> <packaging>pom</packaging> @@ -36,8 +36,17 @@ <activeByDefault>true</activeByDefault> </activation> <modules> - <module>calendar</module> - <module>currencyconverter</module> + <module>calendar-contribution</module> + <module>common-contribution</module> + <module>currency-contribution</module> + <module>hotel-contribution</module> + <module>payment-contribution</module> + <module>trip-contribution</module> + <module>ui-contribution</module> + + <module>domain</module> + <module>node</module> + <module>gettingstarted</module> </modules> </profile> diff --git a/sandbox/travelsample/trip-contribution/META-INF/sca-contribution.xml b/sandbox/travelsample/trip-contribution/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..6f55d961fd --- /dev/null +++ b/sandbox/travelsample/trip-contribution/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"> + <import.java package="scatours.common"/> + <import.java package="scatours.currencyconverter"/> + <export.java package="scatours.trip"/> +</contribution>
\ No newline at end of file diff --git a/sandbox/travelsample/trip-contribution/build.xml b/sandbox/travelsample/trip-contribution/build.xml new file mode 100644 index 0000000000..b4fbc726cf --- /dev/null +++ b/sandbox/travelsample/trip-contribution/build.xml @@ -0,0 +1,61 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> +<project name="gettingstarted" default="compile"> + <property environment="env"/> + + <target name="compile"> + <mkdir dir="target/classes"/> + <javac srcdir="src" destdir="target/classes" + debug="on" source="1.5" target="1.5"> + <classpath> + <pathelement location="${env.TUSCANY}/lib/tuscany-sca-manifest.jar"/> + </classpath> + </javac> + </target> + + <target name="run"> + <java classname="client.CurrencyConverterClient" fork="true"> + <classpath> + <pathelement path="src"/> + <pathelement path="target/classes"/> + <pathelement location="${env.TUSCANY}/lib/tuscany-sca-manifest.jar"/> + </classpath> + </java> + </target> + + <target name="runtrip"> + <java classname="client.TripClient" fork="true"> + <classpath> + <pathelement path="src"/> + <pathelement path="target/classes"/> + <pathelement location="${env.TUSCANY}/lib/tuscany-sca-manifest.jar"/> + </classpath> + </java> + </target> + + <target name="runtripws"> + <java classname="client.TripWsClient" fork="true"> + <classpath> + <pathelement path="src"/> + <pathelement path="target/classes"/> + <pathelement location="${env.TUSCANY}/lib/tuscany-sca-manifest.jar"/> + </classpath> + </java> + </target> +</project> diff --git a/sandbox/travelsample/trip-contribution/pom.xml b/sandbox/travelsample/trip-contribution/pom.xml new file mode 100644 index 0000000000..c56964f3a1 --- /dev/null +++ b/sandbox/travelsample/trip-contribution/pom.xml @@ -0,0 +1,82 @@ +<?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.4-SNAPSHOT</version> + <!--relativePath>../../pom.xml</relativePath--> + </parent> + <artifactId>scatours-trip-contribution</artifactId> + <name>Apache Tuscany SCA Tours Trip Contribution</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-sca-api</artifactId> + <version>1.4-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-data-api</artifactId> + <version>1.4-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-common-contribution</artifactId> + <version>1.4-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>scatours-currency-contribution</artifactId> + <version>1.4-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.2</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <sourceDirectory>${basedir}/src</sourceDirectory> + <resources> + <resource> + <directory>${basedir}</directory> + <excludes> + <exclude>**/*.java</exclude> + <exclude>**/.*/**</exclude> + <exclude>pom.xml</exclude> + <exclude>build.xml</exclude> + <exclude>target/**</exclude> + <exclude>src/**</exclude> + </excludes> + </resource> + </resources> + </build> +</project> diff --git a/sandbox/travelsample/trip-contribution/src/scatours/trip/Trip.java b/sandbox/travelsample/trip-contribution/src/scatours/trip/Trip.java new file mode 100644 index 0000000000..8ec0dbad67 --- /dev/null +++ b/sandbox/travelsample/trip-contribution/src/scatours/trip/Trip.java @@ -0,0 +1,34 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package scatours.trip; + +import org.apache.tuscany.sca.data.collection.Item; +import org.osoa.sca.annotations.Remotable; + +import scatours.common.TripItem; +import scatours.common.TripLeg; + +/** + * The Trip service interface + */ +@Remotable +public interface Trip { + TripItem[] search(TripLeg tripLeg); + double getTotalPrice(); +} diff --git a/sandbox/travelsample/trip-contribution/src/scatours/trip/TripImpl.java b/sandbox/travelsample/trip-contribution/src/scatours/trip/TripImpl.java new file mode 100644 index 0000000000..568b88c102 --- /dev/null +++ b/sandbox/travelsample/trip-contribution/src/scatours/trip/TripImpl.java @@ -0,0 +1,81 @@ +/* + * 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 scatours.trip; + +import java.util.ArrayList; +import java.util.List; + +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Scope; +import org.osoa.sca.annotations.Service; + +import scatours.common.Search; +import scatours.common.SearchCallback; +import scatours.common.TripItem; +import scatours.common.TripLeg; +import scatours.currencyconverter.CurrencyConverter; + +/** + * An implementation of the Trip service + */ +@Scope("COMPOSITE") +@Service(interfaces={Trip.class}) +public class TripImpl implements Trip, SearchCallback { + + @Reference + protected CurrencyConverter currencyConverter; + + @Reference + protected Search hotelSearch; + + @Property + public String quoteCurrencyCode = "USD"; + + private List<TripItem> searchResults = new ArrayList<TripItem>(); + + public TripItem[] search(TripLeg tripLeg) { + + hotelSearch.searchAsynch(tripLeg); + //flightSearch.searchAsynch(tripLeg); + //carSearch.searchAsynch(tripLeg); + + // TODO - extend this to have the three searches run in parallel + + TripItem[] tripItemArray = searchResults.toArray(new TripItem[searchResults.size()]); + searchResults.clear(); + + return tripItemArray; + } + + public double getTotalPrice(){ + String supplierCurrencyCode = "USD"; + double price = 100.00; + + return currencyConverter.convert(supplierCurrencyCode, + quoteCurrencyCode, + price); + } + + public void searchResults(TripItem[] items){ + for(int i = 0; i < items.length; i++ ){ + searchResults.add(items[i]); + } + } +} diff --git a/sandbox/travelsample/ui-contribution/META-INF/sca-contribution.xml b/sandbox/travelsample/ui-contribution/META-INF/sca-contribution.xml new file mode 100644 index 0000000000..ca5bb4bc3e --- /dev/null +++ b/sandbox/travelsample/ui-contribution/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:scatours="http://scatours"> + <import.java package="scatours.common"/> + <import.java package="scatours.currencyconverter"/> + <import.java package="scatours.hotel"/> + <import.java package="scatours.trip"/> + <deployable composite="scatours:scatours"/> +</contribution>
\ No newline at end of file diff --git a/sandbox/travelsample/ui-contribution/build.xml b/sandbox/travelsample/ui-contribution/build.xml new file mode 100644 index 0000000000..924456228e --- /dev/null +++ b/sandbox/travelsample/ui-contribution/build.xml @@ -0,0 +1,106 @@ +<!-- + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. +--> + +<project name="scatours-ui-contribution" default="compile"> + + <target name="compile"> + <mkdir dir="target/classes"/> + <javac destdir="target/classes" debug="on" source="1.5" target="1.5"> + <src path="src"/> + <classpath> + <fileset refid="tuscany.jars"/> + <fileset refid="3rdparty.jars"/> + </classpath> + </javac> + <copy todir="target/classes"> + <fileset dir="." excludes="**/*.java, pom.xml, build.xml, target"/> + </copy> + <jar destfile="target/scatours-ui-contribution.jar" basedir="target/classes"> + <manifest> + <attribute name="Main-Class" value="launch.LaunchTutorialAdmin"/> + </manifest> + </jar> + </target> + + <target name="package" depends="compile"/> + + <target name="run"> + <java classname="launch.LaunchTutorialAdmin" fork="true"> + <classpath> + <pathelement location="target/scatours-ui-contribution.jar"/> + <fileset refid="tuscany.jars"/> + <fileset refid="3rdparty.jars"/> + </classpath> + </java> + </target> + + <target name="clean"> + <delete includeemptydirs="true"> + <fileset dir="target"/> + </delete> + </target> + + <fileset id="tuscany.jars" dir="../../modules"> + <include name="tuscany-assembly-1.4-SNAPSHOT.jar"/> + <include name="tuscany-assembly-xml-1.4-SNAPSHOT.jar"/> + <include name="tuscany-assembly-xsd-1.4-SNAPSHOT.jar"/> + <include name="tuscany-binding-sca-1.4-SNAPSHOT.jar"/> + <include name="tuscany-binding-sca-xml-1.4-SNAPSHOT.jar"/> + <include name="tuscany-contribution-1.4-SNAPSHOT.jar"/> + <include name="tuscany-contribution-impl-1.4-SNAPSHOT.jar"/> + <include name="tuscany-contribution-java-1.4-SNAPSHOT.jar"/> + <include name="tuscany-contribution-namespace-1.4-SNAPSHOT.jar"/> + <include name="tuscany-contribution-xml-1.4-SNAPSHOT.jar"/> + <include name="tuscany-core-1.4-SNAPSHOT.jar"/> + <include name="tuscany-core-databinding-1.4-SNAPSHOT.jar"/> + <include name="tuscany-core-spi-1.4-SNAPSHOT.jar"/> + <include name="tuscany-databinding-1.4-SNAPSHOT.jar"/> + <include name="tuscany-databinding-jaxb-1.4-SNAPSHOT.jar"/> + <include name="tuscany-definitions-1.4-SNAPSHOT.jar"/> + <include name="tuscany-definitions-xml-1.4-SNAPSHOT.jar"/> + <include name="tuscany-endpoint-1.4-SNAPSHOT.jar"/> + <include name="tuscany-extensibility-1.4-SNAPSHOT.jar"/> + <include name="tuscany-host-embedded-1.4-SNAPSHOT.jar"/> + <include name="tuscany-interface-1.4-SNAPSHOT.jar"/> + <include name="tuscany-interface-java-1.4-SNAPSHOT.jar"/> + <include name="tuscany-interface-java-jaxws-1.4-SNAPSHOT.jar"/> + <include name="tuscany-interface-java-xml-1.4-SNAPSHOT.jar"/> + <include name="tuscany-monitor-1.4-SNAPSHOT.jar"/> + <include name="tuscany-policy-1.4-SNAPSHOT.jar"/> + <include name="tuscany-policy-xml-1.4-SNAPSHOT.jar"/> + <include name="tuscany-sca-api-1.4-SNAPSHOT.jar"/> + <include name="tuscany-xsd-1.4-SNAPSHOT.jar"/> + </fileset> + <fileset id="3rdparty.jars" dir="../../lib"> + <include name="XmlSchema-1.3.1.jar"/> + <include name="activation-1.1.jar"/> + <include name="asm-all-3.1.jar"/> + <include name="cglib-nodep-2.1_3.jar"/> + <include name="geronimo-commonj_1.1_spec-1.0.jar"/> + <include name="jaxb-api-2.1.jar"/> + <include name="jaxb-impl-2.1.7.jar"/> + <include name="jaxws-api-2.1.jar"/> + <include name="jsr181-api-1.0-MR1.jar"/> + <include name="jsr250-api-1.0.jar"/> + <include name="stax-api-1.0-2.jar"/> + <include name="wstx-asl-3.2.1.jar"/> + <include name="xml-apis-1.3.03.jar"/> + </fileset> + +</project> diff --git a/sandbox/travelsample/ui-contribution/pom.xml b/sandbox/travelsample/ui-contribution/pom.xml new file mode 100644 index 0000000000..dc8b6176d4 --- /dev/null +++ b/sandbox/travelsample/ui-contribution/pom.xml @@ -0,0 +1,102 @@ +<?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.4-SNAPSHOT</version> + <!--relativePath>../../pom.xml</relativePath--> + </parent> + <artifactId>scatours-ui-contribution</artifactId> + <name>Apache Tuscany SCA Tours User Interface Contribution</name> + + <dependencies> + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-embedded</artifactId> + <version>1.4-SNAPSHOT</version> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-implementation-java-runtime</artifactId> + <version>1.4-SNAPSHOT</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-binding-ws-axis2</artifactId> + <version>1.4-SNAPSHOT</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-host-tomcat</artifactId> + <version>1.4-SNAPSHOT</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>4.2</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <build> + <finalName>${artifactId}</finalName> + <sourceDirectory>${basedir}/src</sourceDirectory> + <resources> + <resource> + <directory>${basedir}</directory> + <excludes> + <exclude>**/*.java</exclude> + <exclude>**/.*/**</exclude> + <exclude>pom.xml</exclude> + <exclude>build.xml</exclude> + <exclude>target/**</exclude> + <exclude>src/**</exclude> + </excludes> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.apache.tuscany.sca</groupId> + <artifactId>tuscany-maven-ant-generator</artifactId> + <version>1.4-SNAPSHOT</version> + <executions> + <execution> + <configuration> + <mainClass>launch.LaunchTutorialAdmin</mainClass> + </configuration> + <goals> + <goal>generate</goal> + </goals> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> diff --git a/sandbox/travelsample/ui-contribution/scatours.composite b/sandbox/travelsample/ui-contribution/scatours.composite new file mode 100644 index 0000000000..7d340bebba --- /dev/null +++ b/sandbox/travelsample/ui-contribution/scatours.composite @@ -0,0 +1,65 @@ +<?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://scatours" + xmlns:scatours="http://scatours" + xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0" + name="scatours"> + + <component name="SCATours"> + <tuscany:implementation.widget location="scatours.html"/> + <service name="Widget"> + <tuscany:binding.http uri="/scatours"/> + </service> + <reference name="hotel" target="HotelComponent"> + <tuscany:binding.jsonrpc/> + </reference> + <reference name="trip" target="TripComponent"> + <tuscany:binding.jsonrpc/> + </reference> + </component> + + <component name="TripComponent"> + <implementation.java class="scatours.trip.TripImpl"/> + <service name="Trip"> + <tuscany:binding.jsonrpc/> + </service> + <reference name="hotelSearch" target="HotelComponent"> + <binding.sca/> + </reference> + <reference name="currencyConverter" target="CurrencyConverterComponent"> + </reference> + </component> + + <component name="HotelComponent"> + <implementation.java class="scatours.hotel.HotelImpl"/> + <service name="Search"> + <binding.sca/> + <tuscany:binding.jsonrpc/> + </service> + </component> + + <component name="CurrencyConverterComponent"> + <implementation.java class="scatours.currencyconverter.CurrencyConverterImpl"/> + <service name="CurrencyConverter"> + </service> + </component> + +</composite> diff --git a/sandbox/travelsample/ui-contribution/scatours.html b/sandbox/travelsample/ui-contribution/scatours.html new file mode 100644 index 0000000000..88bad8ed1f --- /dev/null +++ b/sandbox/travelsample/ui-contribution/scatours.html @@ -0,0 +1,145 @@ +<!-- + * 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>SCA Tours</title> + +<link rel="stylesheet" type="text/css" href="style.css" /> + +<script type="text/javascript" src="scatours.js"></script> + +<script language="JavaScript"> + + //@Reference + var hotel = new Reference("hotel"); + + //@Reference + var trip = new Reference("trip"); + + //local state + var hotels; + var flights; + var cars; + + //the constructor for trip leg beans + function TripLegType(id, + fromLocation, + toLocation, + fromDate, + toDate, + noOfPeople) { + this.id = id; + this.fromLocation = fromLocation; + this.toLocation = toLocation; + this.fromDate = fromDate; + this.toDate = toDate; + this.noOfPeople = noOfPeople; + } + + function getTripLeg(){ + return new TripLegType("X", + document.searchForm.fromLocation.value, + document.searchForm.toLocation.value, + document.searchForm.fromDate.value, + document.searchForm.toDate.value, + document.searchForm.noOfPeople.value); + } + + function init() { + try { + + } + catch(e) { + alert(e); + } + } + + function searchHotels() { + hotel.searchSynch(getTripLeg(), search_response); + } + + function searchTrip() { + trip.search(getTripLeg(), search_response); + } + + function search_response(items, exception) { + if(exception){ + alert(exception.javaStack); + return; + } + var hotelsHTML = ""; + for (var i=0; i<items.length; i++) { + var item = items[i].name + ' - ' + items[i].description; + hotelsHTML += '<input name="items" type="checkbox" value="' + + item + '">' + item + ' <br>'; + } + document.getElementById('searchResponse').innerHTML = hotelsHTML; + hotels = items; + } + +</script> + +</head> + +<body onload="init()" background=""> + <img src="scatours.png" border="0" /> + <div id="scatours"> + <br> + <form name="searchForm"> + <table border="0"> + <tr> + <td>From Location:</td> + <td><input type="text" name="fromLocation" value="LGW"></td> + <td>To Location:</td> + <td><input type="text" name="toLocation" value="ANU"></td> + </tr> + <tr> + <td>Start Date:</td> + <td><input type="text" name="fromDate" value="06/12/08"></td> + <td>End Date:</td> + <td><input type="text" name="toDate" value="06/12/08"></td> + </tr> + <tr> + <td>Number of people:</td> + <td><select name="noOfPeople"> + <option>1 + <option selected>2 + <option>3 + <option>4 + </select></td> + <td/> + <td/> + </tr> + </table> + <input type="button" onClick="searchHotels()" value="SearchHotels"> + <input type="button" onClick="searchTrip()" value="SearchTrip"> + </form> + <div id="searchResponse"></div> + <br> + <form name="tripForm"> + <input type="button" onClick="bookTrip()" value="BookTrip"> + </form> + <br> + <div id="trip"></div> + <br> + <div id="total"></div> + </div> + +</body> +</html> diff --git a/sandbox/travelsample/ui-contribution/scatours.odg b/sandbox/travelsample/ui-contribution/scatours.odg Binary files differnew file mode 100644 index 0000000000..8ca8fbf133 --- /dev/null +++ b/sandbox/travelsample/ui-contribution/scatours.odg diff --git a/sandbox/travelsample/ui-contribution/scatours.png b/sandbox/travelsample/ui-contribution/scatours.png Binary files differnew file mode 100644 index 0000000000..f68cd84704 --- /dev/null +++ b/sandbox/travelsample/ui-contribution/scatours.png diff --git a/sandbox/travelsample/ui-contribution/style.css b/sandbox/travelsample/ui-contribution/style.css new file mode 100644 index 0000000000..6e17c2747b --- /dev/null +++ b/sandbox/travelsample/ui-contribution/style.css @@ -0,0 +1,135 @@ +/* + * 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. + */ + + + +/*******************************************/ + +p,table,li,h1,h2,h3 +{ +font-family: verdana, arial, 'sans serif'; +} + +p, h1, h2, h3, table, li, hr +{ +margin-left: 10pt; +} + +table +{ +border-color: black; +border-collapse: separate; +border-spacing: 0px 1px; + +margin-right: 10pt; +margin-left: 10pt; +width: 800px; +} + +.sourceDetailsTable +{ +width: 600px; +} + +tr, td +{ +margin-left: 0pt; +margin-right: 0pt; +padding-left: 10pt; +font-size: 90%; +} + +p,li,th +{ +font-size: 90%; +margin-left: 10pt; +} + +pre +{ +margin-left: 10pt; +} + +body +{ +#ffffff; +} + +h1,h2,h3,hr +{ +color: firebrick; +} + +a:link {COLOR: firebrick;} +a:visited {COLOR: firebrick;} +a:active {COLOR: navy;} + +.link +{ +COLOR: firebrick; +text-decoration: underline; +} + +.clickable +{ +cursor: pointer +} + +.unread_title +{ +font-weight: bold; +} + +.read_title +{ +font-weight: normal; +} + +.summary +{ +color: DimGrey; +} + +.hidden +{ +display: none; +} + +.source_name +{ +width: 600px; +} + +.alert_text +{ +width: 600px; +} + +.alert_data +{ +margin-left: 10px; +width: 800px; +height: 800px; +} + +.source_0 +{ +background-color: LightGreen; +} + |