You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by js...@apache.org on 2006/05/08 10:10:51 UTC

svn commit: r404955 - in /incubator/tuscany/java/sca/samples/helloworldwsclient/src/main: java/helloworld/ java/helloworld/HelloWorldClient.java java/helloworld/HelloWorldService.java java/org/ resources/logging.properties resources/sca.module

Author: jsdelfino
Date: Mon May  8 01:10:48 2006
New Revision: 404955

URL: http://svn.apache.org/viewcvs?rev=404955&view=rev
Log:
Fix for TUSCANY-159 - shortened sample package names

Added:
    incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/java/helloworld/
    incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/java/helloworld/HelloWorldClient.java   (with props)
    incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java   (with props)
    incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/resources/logging.properties   (with props)
Removed:
    incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/java/org/
Modified:
    incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/resources/sca.module

Added: incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/java/helloworld/HelloWorldClient.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/java/helloworld/HelloWorldClient.java?rev=404955&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/java/helloworld/HelloWorldClient.java (added)
+++ incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/java/helloworld/HelloWorldClient.java Mon May  8 01:10:48 2006
@@ -0,0 +1,67 @@
+/**
+ *
+ *  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 helloworld;
+
+import java.util.logging.Level;
+import java.util.logging.LogManager;
+import java.util.Properties;
+
+import org.osoa.sca.CurrentModuleContext;
+import org.osoa.sca.ModuleContext;
+
+import org.apache.tuscany.core.client.TuscanyRuntime;
+import org.apache.tuscany.common.monitor.MonitorFactory;
+import org.apache.tuscany.common.monitor.impl.JavaLoggingMonitorFactory;
+
+/**
+ * This client program shows how to create an SCA runtime, start it,
+ * locate the HelloWorld service and invoke it.
+ */
+public class HelloWorldClient {
+
+    public static final void main(String[] args) throws Exception {
+        
+        // Setup Tuscany monitoring to use java.util.logging
+        LogManager.getLogManager().readConfiguration(HelloWorldClient.class.getResourceAsStream("/logging.properties"));
+        Properties levels = new Properties();
+        MonitorFactory monitorFactory = new JavaLoggingMonitorFactory(levels, Level.FINEST, "MonitorMessages");
+
+        // Create a Tuscany runtime for the sample module component
+        TuscanyRuntime tuscany = new TuscanyRuntime("HelloWorldModuleComponent", null, monitorFactory);
+
+        // Start the Tuscany runtime and associate it with this thread
+        tuscany.start();
+
+        // Get the SCA module context.
+        ModuleContext moduleContext = CurrentModuleContext.getContext();
+
+        // Locate the HelloWorld service
+        HelloWorldService helloworldService = (HelloWorldService) moduleContext.locateService("HelloWorldService");
+        
+        // Invoke the HelloWorld service
+        String value = helloworldService.getGreetings("World");
+        
+        System.out.println(value);
+        System.out.flush();
+
+        // Disassociate the application module component
+        tuscany.stop();
+
+        // Shut down the runtime
+        tuscany.shutdown();
+    }
+}

Propchange: incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/java/helloworld/HelloWorldClient.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/java/helloworld/HelloWorldClient.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java?rev=404955&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java (added)
+++ incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java Mon May  8 01:10:48 2006
@@ -0,0 +1,26 @@
+/**
+ *
+ *  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 helloworld;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+public interface HelloWorldService {
+
+    public String getGreetings(String name);
+
+}

Propchange: incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/java/helloworld/HelloWorldService.java
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Added: incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/resources/logging.properties
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/resources/logging.properties?rev=404955&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/resources/logging.properties (added)
+++ incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/resources/logging.properties Mon May  8 01:10:48 2006
@@ -0,0 +1,27 @@
+#  Copyright (c) 2006 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.
+#
+#  $Rev$ $Date$
+#
+
+# Custom logging configuration for Tuscany samples
+# By default, only INFO level logging is enabled and ALL messages get sent to the console
+# For more messages from the runtime, uncomment specific settings at the end of this file
+handlers = java.util.logging.ConsoleHandler
+java.util.logging.ConsoleHandler.level = ALL
+java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter
+.level=INFO
+
+# Uncomment the next setting to get all Tuscany messages (this will be a lot)
+#org.apache.tuscany.level=FINEST
\ No newline at end of file

Propchange: incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/resources/logging.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/resources/logging.properties
------------------------------------------------------------------------------
    svn:keywords = Rev,Date

Modified: incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/resources/sca.module
URL: http://svn.apache.org/viewcvs/incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/resources/sca.module?rev=404955&r1=404954&r2=404955&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/resources/sca.module (original)
+++ incubator/tuscany/java/sca/samples/helloworldwsclient/src/main/resources/sca.module Mon May  8 01:10:48 2006
@@ -20,22 +20,10 @@
     <import.sdo wsdlLocation="wsdl/helloworld.wsdl"/>
     <import.wsdl location="wsdl/helloworld.wsdl" namespace="http://helloworldaxis.samples.tuscany.apache.org"/>
 
-    <component name="HelloWorldServiceComponent">
-        <implementation.java class="org.apache.tuscany.samples.helloworldwsclient.HelloWorldServiceComponentImpl"/>
-        <references>
-            <v:helloWorldService>
-            HelloWorldService
-            </v:helloWorldService>
-        </references>
-    </component>
-
     <externalService name="HelloWorldService">
-        <interface.wsdl interface="http://helloworldaxis.samples.tuscany.apache.org#HelloWorldServiceImpl"/>
+        <interface.java interface="helloworld.HelloWorldService"/>
+        <!-- <interface.wsdl interface="http://helloworldaxis.samples.tuscany.apache.org#HelloWorldServiceImpl"/> -->
         <binding.ws port="http://helloworldaxis.samples.tuscany.apache.org#helloworld"/>
-        <!-- 
-        <interface.java interface="org.apache.tuscany.samples.helloworldwsclient.HelloWorldServiceComponent"/>
-        <binding.ws port="http://helloworldaxis.samples.tuscany.apache.org#wsdl.endpoint(HelloWorldServiceImplService/helloworldws)"/>
-        -->
     </externalService>
     
 </module>