From bdd0a41aed7edf21ec2a65cfa17a86af2ef8c48a Mon Sep 17 00:00:00 2001 From: dims Date: Tue, 17 Jun 2008 00:23:01 +0000 Subject: Move Tuscany from Incubator to top level. git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@668359 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/test/spec/ComponentContextTester.java | 45 ++++++++ .../sca/test/spec/ComponentContextTesterImpl.java | 56 ++++++++++ .../sca/test/spec/IdentifiableComponent.java | 34 ++++++ .../tuscany/sca/test/spec/IdentityService.java | 26 +++++ .../tuscany/sca/test/spec/MyListService.java | 28 +++++ .../tuscany/sca/test/spec/MyListServiceByYear.java | 26 +++++ .../apache/tuscany/sca/test/spec/MyService.java | 29 +++++ .../tuscany/sca/test/spec/MyServiceByDate.java | 28 +++++ .../tuscany/sca/test/spec/MyTotalService.java | 23 ++++ .../tuscany/sca/test/spec/SCAComponentService.java | 28 +++++ .../sca/test/spec/impl/MyListServiceImpl.java | 73 ++++++++++++ .../tuscany/sca/test/spec/impl/MyServiceImpl.java | 122 +++++++++++++++++++++ .../sca/test/spec/impl/MyTotalServiceImpl.java | 83 ++++++++++++++ .../src/main/resources/META-INF/sca/default.scdl | 43 ++++++++ .../main/resources/META-INF/sca/myListService.scdl | 34 ++++++ .../META-INF/sca/myServiceInComposite.scdl | 49 +++++++++ .../META-INF/sca/myServiceInRecursive.scdl | 53 +++++++++ .../resources/META-INF/sca/mySimpleService.scdl | 34 ++++++ .../META-INF/sca/mySimpleServiceInRecursive.scdl | 44 ++++++++ .../META-INF/sca/mySimpleServiceInRecursive2.scdl | 47 ++++++++ .../resources/META-INF/sca/myTotalService.scdl | 32 ++++++ .../META-INF/sca/myTotalServiceInComposite.scdl | 43 ++++++++ ...otalServiceInCompositeForReferenceOverride.scdl | 81 ++++++++++++++ .../META-INF/sca/myTotalServiceInRecursive.scdl | 60 ++++++++++ ...otalServiceInRecursiveForReferenceOverride.scdl | 52 +++++++++ .../src/main/resources/META-INF/sca/myservice.scdl | 51 +++++++++ 26 files changed, 1224 insertions(+) create mode 100644 sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTester.java create mode 100644 sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTesterImpl.java create mode 100644 sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/IdentifiableComponent.java create mode 100644 sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/IdentityService.java create mode 100644 sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java create mode 100644 sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java create mode 100644 sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java create mode 100644 sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java create mode 100644 sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java create mode 100644 sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java create mode 100644 sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java create mode 100644 sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java create mode 100644 sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java create mode 100644 sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/default.scdl create mode 100644 sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myListService.scdl create mode 100644 sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myServiceInComposite.scdl create mode 100644 sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myServiceInRecursive.scdl create mode 100644 sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleService.scdl create mode 100644 sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleServiceInRecursive.scdl create mode 100644 sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleServiceInRecursive2.scdl create mode 100644 sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalService.scdl create mode 100644 sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInComposite.scdl create mode 100644 sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInCompositeForReferenceOverride.scdl create mode 100644 sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInRecursive.scdl create mode 100644 sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInRecursiveForReferenceOverride.scdl create mode 100644 sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myservice.scdl (limited to 'sandbox/old/contrib/itest/specTest/src/main') diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTester.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTester.java new file mode 100644 index 0000000000..6e1b8dc612 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTester.java @@ -0,0 +1,45 @@ +/* + * 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 org.apache.tuscany.sca.test.spec; + +/** + * @version $Rev$ $Date$ + */ +public interface ComponentContextTester extends IdentityService { + /** + * Returns true if the ComponentContext was injected + * @return true if the ComponentContext was injected + */ + boolean isContextInjected(); + + /** + * Looks up a reference with the supplied name and returns the identity of the referenced component. + * @param name the name of a reference + * @return the identity of the referenced component + */ + String getServiceIdentity(String name); + + /** + * Looks up a reference with the supplied name using a ServiceReference + * and returns the identity of the referenced component. + * @param name the name of a reference + * @return the identity of the referenced component + */ + String getServiceReferenceIdentity(String name); +} diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTesterImpl.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTesterImpl.java new file mode 100644 index 0000000000..df6366dbef --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/ComponentContextTesterImpl.java @@ -0,0 +1,56 @@ +/* + * 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 org.apache.tuscany.sca.test.spec; + +import org.osoa.sca.ComponentContext; +import org.osoa.sca.ServiceReference; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Reference; + +/** + * Component that tests ComponentContext functions. + * + * @version $Rev$ $Date$ + */ +public class ComponentContextTesterImpl implements ComponentContextTester { + @Context + public ComponentContext context; + + @Reference + public IdentityService getServiceTest; + + public boolean isContextInjected() { + return context != null; + } + + public String getURI() { + return context.getURI(); + } + + public String getServiceIdentity(String name) { + IdentityService service = context.getService(IdentityService.class, name); + return service.getURI(); + } + + public String getServiceReferenceIdentity(String name) { + ServiceReference ref = context.getServiceReference(IdentityService.class, name); + IdentityService service = ref.getService(); + return service.getURI(); + } +} diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/IdentifiableComponent.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/IdentifiableComponent.java new file mode 100644 index 0000000000..cab690eafd --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/IdentifiableComponent.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 org.apache.tuscany.sca.test.spec; + +import org.osoa.sca.annotations.Context; +import org.osoa.sca.ComponentContext; + +/** + * @version $Rev$ $Date$ + */ +public class IdentifiableComponent implements IdentityService { + @Context + public ComponentContext context; + + public String getURI() { + return context.getURI(); + } +} diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/IdentityService.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/IdentityService.java new file mode 100644 index 0000000000..25435a3cc4 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/IdentityService.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.test.spec; + +/** + * @version $Rev$ $Date$ + */ +public interface IdentityService { + String getURI(); +} diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.java new file mode 100644 index 0000000000..7fe9fa4909 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyListService.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 org.apache.tuscany.sca.test.spec; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface MyListService { + String[] getHolidays(); + + String getYear(); +} diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java new file mode 100644 index 0000000000..28a26dddde --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyListServiceByYear.java @@ -0,0 +1,26 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.test.spec; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface MyListServiceByYear { + String[] getHolidays(int year); +} diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java new file mode 100644 index 0000000000..fbb2161df3 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyService.java @@ -0,0 +1,29 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.tuscany.sca.test.spec; + +import java.util.Date; + +public interface MyService extends SCAComponentService { + Date nextHoliday(); + + String getLocation(); + + String getYear(); +} diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.java new file mode 100644 index 0000000000..892b36e1a1 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyServiceByDate.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 org.apache.tuscany.sca.test.spec; + +import java.util.Date; + +import org.osoa.sca.annotations.Remotable; + +@Remotable +public interface MyServiceByDate { + Date nextHoliday(Date date); +} diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java new file mode 100644 index 0000000000..6a4cfc1f79 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/MyTotalService.java @@ -0,0 +1,23 @@ +/* + * 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 org.apache.tuscany.sca.test.spec; + +public interface MyTotalService extends MyListService, MyListServiceByYear, MyService, MyServiceByDate { + +} diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.java new file mode 100644 index 0000000000..2ba1cb41cb --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/SCAComponentService.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 org.apache.tuscany.sca.test.spec; + +import org.osoa.sca.ComponentContext; + +public interface SCAComponentService { + String getComponentName(); + + ComponentContext getContext(); + +} diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java new file mode 100644 index 0000000000..6f3f761432 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyListServiceImpl.java @@ -0,0 +1,73 @@ +/* + * 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 org.apache.tuscany.sca.test.spec.impl; + +import java.util.List; + +import org.apache.tuscany.sca.test.spec.MyListService; +import org.apache.tuscany.sca.test.spec.MyListServiceByYear; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + + +@Service(interfaces = {MyListService.class, MyListServiceByYear.class}) +public class MyListServiceImpl implements MyListService, MyListServiceByYear { + + // This is multiplicity=1:n + @Reference(name = "myListServiceList", required = false) + public List myListServicesList; + + // This is multiplicity=0:n + @Reference(name = "myListServiceArray", required = false) + public MyListService[] myListServicesArray; + + @Property(name = "serviceYear") + protected String year = "2006"; + + public String[] getHolidays() { + return getHolidays(Integer.parseInt(year)); + } + + public String[] getHolidays(int year) { + MyListService myService; + if (myListServicesList != null) { + for (MyListService aMyListServicesList : myListServicesList) { + myService = aMyListServicesList; + if (Integer.parseInt(myService.getYear()) == year) { + return myService.getHolidays(); + } + } + } + if (myListServicesArray != null) { + for (MyListService aMyListServicesArray : myListServicesArray) { + myService = aMyListServicesArray; + if (Integer.parseInt(myService.getYear()) == year) { + return myService.getHolidays(); + } + } + } + return null; + } + + public String getYear() { + return year; + } + +} diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java new file mode 100644 index 0000000000..3aa2c2a136 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyServiceImpl.java @@ -0,0 +1,122 @@ +/* + * 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 org.apache.tuscany.sca.test.spec.impl; + +import java.util.Date; + +import org.apache.tuscany.sca.test.spec.MyListService; +import org.apache.tuscany.sca.test.spec.MyListServiceByYear; +import org.apache.tuscany.sca.test.spec.MyService; +import org.apache.tuscany.sca.test.spec.MyServiceByDate; +import org.osoa.sca.ComponentContext; +import org.osoa.sca.annotations.ComponentName; +import org.osoa.sca.annotations.Context; +import org.osoa.sca.annotations.Destroy; +import org.osoa.sca.annotations.Init; +import org.osoa.sca.annotations.Property; +import org.osoa.sca.annotations.Service; + + +@Service(interfaces = {MyService.class, MyServiceByDate.class, MyListService.class, MyListServiceByYear.class}) +public class MyServiceImpl implements MyService, MyServiceByDate, MyListService, MyListServiceByYear { + static String[][] holidays = + { + {"2006/01/02", "2006/05/29", "2006/07/03", "2006/07/04", "2006/09/04", "2006/11/23", "2006/11/23", + "2006/11/24", "2006/12/25"}, + {"2007/01/01", "2007/05/28", "2007/07/04", "2007/09/03", "2007/11/22", "2007/11/23", "2007/12/25"}}; + + @Property(name = "location") + protected String location = "RTP"; + + @Property(name = "year") + protected String year = "2006"; + + @ComponentName + protected String componentName; + + @Context + protected ComponentContext context; + + public MyServiceImpl() { + System.out.println("creating service instance..."); + } + + public Date nextHoliday() { + + return nextHoliday(new Date()); + } + + @SuppressWarnings("deprecation") + public Date nextHoliday(Date today) { + Date d1; + String[] days = getHolidays(); + for (String day : days) { + d1 = new Date(day); + if (d1.after(today)) + return d1; + } + return null; + } + + public String[] getHolidays(int year) { + int index = year - 2006; + if (index >= 0 && index < holidays.length) + return holidays[index]; + return null; + } + + public String[] getHolidays() { + + Integer theYear; + if (year == null || year.length() == 0) + theYear = new Integer("2006"); + else + theYear = new Integer(year); + + return getHolidays(theYear.intValue()); + } + + @Init + public void start() { + System.out.println("Start service.."); + } + + @Destroy + public void stop() { + System.out.println("Stop service.."); + + } + + public String getComponentName() { + return componentName; + } + + public ComponentContext getContext() { + return context; + } + + public String getLocation() { + return location; + } + + public String getYear() { + return year; + } + +} diff --git a/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java new file mode 100644 index 0000000000..d56e9aede4 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/java/org/apache/tuscany/sca/test/spec/impl/MyTotalServiceImpl.java @@ -0,0 +1,83 @@ +/* + * 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 org.apache.tuscany.sca.test.spec.impl; + +import java.util.Date; + +import org.apache.tuscany.sca.test.spec.MyListService; +import org.apache.tuscany.sca.test.spec.MyListServiceByYear; +import org.apache.tuscany.sca.test.spec.MyService; +import org.apache.tuscany.sca.test.spec.MyServiceByDate; +import org.apache.tuscany.sca.test.spec.MyTotalService; +import org.osoa.sca.ComponentContext; +import org.osoa.sca.annotations.Reference; +import org.osoa.sca.annotations.Service; + + +@Service(MyTotalService.class) +public class MyTotalServiceImpl implements MyTotalService { + + // This is multiplicity=1:1 + @Reference(required = true) + public MyListService myListService; + + // default required==true so it is 1:1 + @Reference + public MyListServiceByYear myListServiceByYear = new MyServiceImpl(); + + // default required==true so it is 1:1 + @Reference + public MyService myService; + + // This is multiplicity=0:1 + @Reference(required = false) + public MyServiceByDate myServiceByDate = new MyServiceImpl(); + + public String[] getHolidays() { + return myListService.getHolidays(); + } + + public String[] getHolidays(int year) { + return myListServiceByYear.getHolidays(year); + } + + public String getComponentName() { + return myService.getComponentName(); + } + + public ComponentContext getContext() { + return myService.getContext(); + } + + public Date nextHoliday(Date date) { + return myServiceByDate.nextHoliday(date); + } + + public String getLocation() { + return myService.getLocation(); + } + + public String getYear() { + return myService.getYear(); + } + + public Date nextHoliday() { + return myService.nextHoliday(); + } +} diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/default.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/default.scdl new file mode 100644 index 0000000000..0f09f102b9 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/default.scdl @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myListService.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myListService.scdl new file mode 100644 index 0000000000..55293b00f1 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myListService.scdl @@ -0,0 +1,34 @@ + + + + + + + + 2007 + + + + diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myServiceInComposite.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myServiceInComposite.scdl new file mode 100644 index 0000000000..14b1261604 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myServiceInComposite.scdl @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + CARY + 2007 + + + diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myServiceInRecursive.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myServiceInRecursive.scdl new file mode 100644 index 0000000000..5d13f75970 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myServiceInRecursive.scdl @@ -0,0 +1,53 @@ + + + + + + + MyServiceInRecursive/MyService + + + + + + MyServiceInRecursive/MyListService + + + + + + MyServiceInRecursive/MyListServiceByYear + + + + + + MyServiceInRecursive/MyServiceByDate + + + + + + + + + diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleService.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleService.scdl new file mode 100644 index 0000000000..700ae21b25 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleService.scdl @@ -0,0 +1,34 @@ + + + + + + + + + + + CARY + 2007 + + + diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleServiceInRecursive.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleServiceInRecursive.scdl new file mode 100644 index 0000000000..1354fc2ba4 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleServiceInRecursive.scdl @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleServiceInRecursive2.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleServiceInRecursive2.scdl new file mode 100644 index 0000000000..79287745b7 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/mySimpleServiceInRecursive2.scdl @@ -0,0 +1,47 @@ + + + + + + + MySimpleServiceInRecursiveComponent/MySimpleService + + + + + MySimpleServiceInRecursiveComponent/MySimpleServiceNo + + + + + MySimpleServiceInRecursiveComponent/MySimpleServiceMay + + + + + MySimpleServiceInRecursiveComponent/MySimpleServiceMust + + + + + + diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalService.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalService.scdl new file mode 100644 index 0000000000..8e676fedf8 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalService.scdl @@ -0,0 +1,32 @@ + + + + + + + + + + + + + diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInComposite.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInComposite.scdl new file mode 100644 index 0000000000..825e3777b6 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInComposite.scdl @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInCompositeForReferenceOverride.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInCompositeForReferenceOverride.scdl new file mode 100644 index 0000000000..29bfa3cd23 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInCompositeForReferenceOverride.scdl @@ -0,0 +1,81 @@ + + + + + + + MyTotalServiceComponentNo + + + + + + + + + + + + + + + + + + + MyTotalServiceComponentMay + + + + + + + + + + + + + + + + + + + MyTotalServiceComponentMust + + + + + + + + + + + + + + + + + diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInRecursive.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInRecursive.scdl new file mode 100644 index 0000000000..98c19b6116 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInRecursive.scdl @@ -0,0 +1,60 @@ + + + + + + + + + + + + MyServiceInComposite/MyListService + + + + + + + + + + + + + + + + + + + + + + + + + CARY + 2007 + + + diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInRecursiveForReferenceOverride.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInRecursiveForReferenceOverride.scdl new file mode 100644 index 0000000000..51cd181b00 --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myTotalServiceInRecursiveForReferenceOverride.scdl @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + CARY + 2007 + + + diff --git a/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myservice.scdl b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myservice.scdl new file mode 100644 index 0000000000..845cbbf9fd --- /dev/null +++ b/sandbox/old/contrib/itest/specTest/src/main/resources/META-INF/sca/myservice.scdl @@ -0,0 +1,51 @@ + + + + + + + + + + + NC + 2007 + + + + + + + + + + + + + 2006 + + + + + + + -- cgit v1.2.3