diff options
Diffstat (limited to 'tags/java-stable-20060304/samples/helloworld/helloworldmc/src')
7 files changed, 0 insertions, 301 deletions
diff --git a/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/GreetingPortionProvider.java b/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/GreetingPortionProvider.java deleted file mode 100644 index d023b3023b..0000000000 --- a/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/GreetingPortionProvider.java +++ /dev/null @@ -1,22 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.samples.helloworldmc; - -public interface GreetingPortionProvider { - - public String getGreetingPortion(); -} diff --git a/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/GreetingPortionProviderImpl.java b/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/GreetingPortionProviderImpl.java deleted file mode 100644 index a881a17dae..0000000000 --- a/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/GreetingPortionProviderImpl.java +++ /dev/null @@ -1,32 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.samples.helloworldmc; - -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Service; - -@Service(GreetingPortionProvider.class) -public class GreetingPortionProviderImpl implements GreetingPortionProvider { - - @Property - public String greetingPortion; - - public String getGreetingPortion() { - return greetingPortion; - } - -} diff --git a/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/HelloWorldClient.java b/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/HelloWorldClient.java deleted file mode 100644 index 36d7e3eb03..0000000000 --- a/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/HelloWorldClient.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.samples.helloworldmc; - -import org.osoa.sca.CurrentModuleContext; -import org.osoa.sca.ModuleContext; - -import org.apache.tuscany.core.client.TuscanyRuntime; - -/** - * This client program shows how to create an SCA runtime, start it, locate a simple HelloWorld service component - * and invoke it. - */ -public class HelloWorldClient { - - public static final void main(String[] args) throws Exception { - - // Obtain Tuscany runtime - TuscanyRuntime tuscany = new TuscanyRuntime("hello", null); - - // Start the runtime - tuscany.start(); - - // Obtain SCA module context. - ModuleContext moduleContext = CurrentModuleContext.getContext(); - - // Locate the HelloWorld service component and invoke it - HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorldServiceComponent"); - - String value = helloworldService.getGreetings(); - - System.out.println(value); - - // Stop the runtime - tuscany.stop(); - } -} diff --git a/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/HelloWorldService.java b/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/HelloWorldService.java deleted file mode 100644 index 3d455aca68..0000000000 --- a/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/HelloWorldService.java +++ /dev/null @@ -1,26 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.samples.helloworldmc; - -/** - * This is the business interface of the HelloWorld service component. - */ -public interface HelloWorldService { - - public String getGreetings(); - -} diff --git a/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/HelloWorldServiceComponentImpl.java b/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/HelloWorldServiceComponentImpl.java deleted file mode 100644 index 664c6343d3..0000000000 --- a/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/java/org/apache/tuscany/samples/helloworldmc/HelloWorldServiceComponentImpl.java +++ /dev/null @@ -1,51 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.samples.helloworldmc; - -import org.osoa.sca.annotations.Property; -import org.osoa.sca.annotations.Reference; -import org.osoa.sca.annotations.Service; - -/** - * This class implements the HelloWorld service component. - */ -@Service(HelloWorldService.class) -public class HelloWorldServiceComponentImpl implements HelloWorldService { - - @Property - public String greetingMiddle; - - @Reference - public GreetingPortionProvider greetingPrefix; - - @Reference - public GreetingPortionProvider greetingSuffix; - - /** - * @return - */ - public String getGreetings() { - String middle; - if (greetingMiddle == null) - middle = ""; - else - middle = greetingMiddle; - - return greetingPrefix.getGreetingPortion() + " " + middle + " " + greetingSuffix.getGreetingPortion(); - } - -} diff --git a/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/resources/sca.module b/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/resources/sca.module deleted file mode 100644 index 13892eff7b..0000000000 --- a/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/main/resources/sca.module +++ /dev/null @@ -1,45 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?>
-<!--
- Copyright (c) 2005 BEA Sytems Inc.
- Copyright (c) 2005 International Business Machines
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
- -->
-<module xmlns="http://www.osoa.org/xmlns/sca/0.9" xmlns:v="http://www.osoa.org/xmlns/sca/values/0.9"
- name="sampleHelloworld">
-
- <component name="HelloWorldServiceComponent">
- <implementation.java class="org.apache.tuscany.samples.helloworldmc.HelloWorldServiceComponentImpl"/>
- <references>
- <v:greetingPrefix>GreetingPrefixComponent</v:greetingPrefix>
- <v:greetingSuffix>GreetingSuffixComponent</v:greetingSuffix>
- </references>
- <properties>
- <v:greetingMiddle>SCA</v:greetingMiddle>
- </properties>
- </component>
-
- <component name="GreetingPrefixComponent">
- <implementation.java class="org.apache.tuscany.samples.helloworldmc.GreetingPortionProviderImpl"/>
- <properties>
- <v:greetingPortion>Hello</v:greetingPortion>
- </properties>
- </component>
-
- <component name="GreetingSuffixComponent">
- <implementation.java class="org.apache.tuscany.samples.helloworldmc.GreetingPortionProviderImpl"/>
- <properties>
- <v:greetingPortion>World</v:greetingPortion>
- </properties>
- </component>
-</module>
diff --git a/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/test/java/org/apache/tuscany/samples/helloworldmc/HelloWorldServiceComponentTestCase.java b/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/test/java/org/apache/tuscany/samples/helloworldmc/HelloWorldServiceComponentTestCase.java deleted file mode 100644 index a53973b9ed..0000000000 --- a/tags/java-stable-20060304/samples/helloworld/helloworldmc/src/test/java/org/apache/tuscany/samples/helloworldmc/HelloWorldServiceComponentTestCase.java +++ /dev/null @@ -1,74 +0,0 @@ -/** - * - * Copyright 2005 The Apache Software Foundation or its licensors, as applicable. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.apache.tuscany.samples.helloworldmc; - -import junit.framework.TestCase; -import org.osoa.sca.CurrentModuleContext; -import org.osoa.sca.ModuleContext; - -import org.apache.tuscany.core.client.TuscanyRuntime; - -public class HelloWorldServiceComponentTestCase extends TestCase { - public boolean verbose = true; - - public void testGeetings() throws Exception { - - if (verbose) - System.out.println("starting test.."); - System.out.flush(); - - TuscanyRuntime tuscany = new TuscanyRuntime("test", null); - tuscany.start(); - ModuleContext moduleContext = CurrentModuleContext.getContext(); - - assertNotNull(moduleContext); - System.out.println("module context name '" - + moduleContext.getName() + "'"); - System.out.println("module context uri '" + moduleContext.getURI() - + "'"); - HelloWorldService helloworldService = - (HelloWorldService) moduleContext.locateService - ("HelloWorldServiceComponent"); - - assertNotNull(helloworldService); - - String value = helloworldService.getGreetings(); - - if (verbose) - System.out.println("Value = '" + value + "'"); - - assertEquals("Hello SCA World", value); - - tuscany.stop(); - } - - public final static void main(String[] args) throws Exception { - HelloWorldServiceComponentTestCase hwc = - new HelloWorldServiceComponentTestCase(); - hwc.setVerbose(true); - hwc.testGeetings(); - } - - public boolean isVerbose() { - return verbose; - } - - public void setVerbose(boolean verbose) { - this.verbose = verbose; - } - -} |