summaryrefslogtreecommitdiffstats
path: root/sandbox/travelsample/contributions/calendar
diff options
context:
space:
mode:
authornash <nash@13f79535-47bb-0310-9956-ffa450edef68>2009-09-09 09:26:32 +0000
committernash <nash@13f79535-47bb-0310-9956-ffa450edef68>2009-09-09 09:26:32 +0000
commit5a35f1df3c77ebedd6503dc27002175964db2802 (patch)
tree7612336edc8b65323bbe1430692ff727a326ffd2 /sandbox/travelsample/contributions/calendar
parent9cdd9bbb48bc0b03db61cb3b71d7dc55fae241d3 (diff)
Update interaction-* and calendar contributions and launcher to new naming convention
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@812852 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/travelsample/contributions/calendar')
-rw-r--r--sandbox/travelsample/contributions/calendar/pom.xml57
-rw-r--r--sandbox/travelsample/contributions/calendar/src/main/java/com/tuscanyscatours/calendar/Calendar.java25
-rw-r--r--sandbox/travelsample/contributions/calendar/src/main/java/com/tuscanyscatours/calendar/impl/CalendarImpl.java47
-rw-r--r--sandbox/travelsample/contributions/calendar/src/main/resources/META-INF/sca-contribution.xml23
-rw-r--r--sandbox/travelsample/contributions/calendar/src/test/java/scatours/calendar/CalendarTestCase.java49
-rw-r--r--sandbox/travelsample/contributions/calendar/src/test/resources/calendar.composite28
6 files changed, 229 insertions, 0 deletions
diff --git a/sandbox/travelsample/contributions/calendar/pom.xml b/sandbox/travelsample/contributions/calendar/pom.xml
new file mode 100644
index 0000000000..bb80429680
--- /dev/null
+++ b/sandbox/travelsample/contributions/calendar/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.6-SNAPSHOT</version>
+ <!--relativePath>../../pom.xml</relativePath-->
+ </parent><version>1.0-SNAPSHOT</version>
+ <artifactId>scatours-contribution-calendar</artifactId>
+ <name>Apache Tuscany SCA Tours Calendar Contribution</name>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-host-embedded</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.tuscany.sca</groupId>
+ <artifactId>tuscany-implementation-java-runtime</artifactId>
+ <version>1.6-SNAPSHOT</version>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>4.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>${artifactId}</finalName>
+ </build>
+</project>
diff --git a/sandbox/travelsample/contributions/calendar/src/main/java/com/tuscanyscatours/calendar/Calendar.java b/sandbox/travelsample/contributions/calendar/src/main/java/com/tuscanyscatours/calendar/Calendar.java
new file mode 100644
index 0000000000..daa5127511
--- /dev/null
+++ b/sandbox/travelsample/contributions/calendar/src/main/java/com/tuscanyscatours/calendar/Calendar.java
@@ -0,0 +1,25 @@
+/*
+ * 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 com.tuscanyscatours.calendar;
+
+public interface Calendar {
+
+ String getEndDate(String startDate, int duration);
+
+}
diff --git a/sandbox/travelsample/contributions/calendar/src/main/java/com/tuscanyscatours/calendar/impl/CalendarImpl.java b/sandbox/travelsample/contributions/calendar/src/main/java/com/tuscanyscatours/calendar/impl/CalendarImpl.java
new file mode 100644
index 0000000000..27982093ff
--- /dev/null
+++ b/sandbox/travelsample/contributions/calendar/src/main/java/com/tuscanyscatours/calendar/impl/CalendarImpl.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 com.tuscanyscatours.calendar.impl;
+
+import java.text.DateFormat;
+import java.util.Date;
+
+import com.tuscanyscatours.calendar.Calendar;
+
+/**
+ * An implementation of the Calendar 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/contributions/calendar/src/main/resources/META-INF/sca-contribution.xml b/sandbox/travelsample/contributions/calendar/src/main/resources/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..86f28d7423
--- /dev/null
+++ b/sandbox/travelsample/contributions/calendar/src/main/resources/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">
+ <export.java package="com.tuscanyscatours.calendar" />
+ <export.java package="com.tuscanyscatours.calendar.impl" />
+</contribution>
diff --git a/sandbox/travelsample/contributions/calendar/src/test/java/scatours/calendar/CalendarTestCase.java b/sandbox/travelsample/contributions/calendar/src/test/java/scatours/calendar/CalendarTestCase.java
new file mode 100644
index 0000000000..571e7b4b4a
--- /dev/null
+++ b/sandbox/travelsample/contributions/calendar/src/test/java/scatours/calendar/CalendarTestCase.java
@@ -0,0 +1,49 @@
+/*
+ * 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.calendar;
+
+import junit.framework.TestCase;
+
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+
+import com.tuscanyscatours.calendar.Calendar;
+
+/**
+ * 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, "Calendar");
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ scaDomain.close();
+ }
+
+ public void testCalendar() throws Exception {
+ System.out.println(calendar.getEndDate("07/10/96 04:05", 3));
+ }
+}
diff --git a/sandbox/travelsample/contributions/calendar/src/test/resources/calendar.composite b/sandbox/travelsample/contributions/calendar/src/test/resources/calendar.composite
new file mode 100644
index 0000000000..076eed15b2
--- /dev/null
+++ b/sandbox/travelsample/contributions/calendar/src/test/resources/calendar.composite
@@ -0,0 +1,28 @@
+<?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://tuscanyscatours.com/"
+ name="calendar">
+
+ <component name="Calendar">
+ <implementation.java class="com.tuscanyscatours.calendar.impl.CalendarImpl"/>
+ </component>
+
+</composite>