You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by is...@apache.org on 2007/09/14 16:37:40 UTC

svn commit: r575701 - in /incubator/tuscany/java/sca/samples/binding-notification-producer: README build.xml src/main/java/notification/producer/TrafficAdvisoryServer.java

Author: isilval
Date: Fri Sep 14 07:37:40 2007
New Revision: 575701

URL: http://svn.apache.org/viewvc?rev=575701&view=rev
Log:
Add ant script

Added:
    incubator/tuscany/java/sca/samples/binding-notification-producer/build.xml
Modified:
    incubator/tuscany/java/sca/samples/binding-notification-producer/README
    incubator/tuscany/java/sca/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryServer.java

Modified: incubator/tuscany/java/sca/samples/binding-notification-producer/README
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-notification-producer/README?rev=575701&r1=575700&r2=575701&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/binding-notification-producer/README (original)
+++ incubator/tuscany/java/sca/samples/binding-notification-producer/README Fri Sep 14 07:37:40 2007
@@ -26,6 +26,23 @@
 component's <implementation.notification/>. This allows messages sent and received
 via <binding.notification/> to be transported as literal xml over http.
 
+Building And Running The Sample Using Ant
+-----------------------------------------
+With the binary distribution the sample can be built and run using Ant as 
+follows
+
+cd binding-notification-producer
+ant compile
+ant run
+
+You should see the following output from the run target.
+
+run:
+     [java] Sep 14, 2007 10:31:45 AM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping
+     [java] INFO: Added Servlet mapping: http://localhost:8083/ntm/trafficAdvisory
+     [java] Sep 14, 2007 10:31:45 AM org.apache.tuscany.sca.http.jetty.JettyServer addServletMapping
+     [java] INFO: Added Servlet mapping: http://localhost:8083/producer/trafficAdvisory
+     
 Building And Running The Sample Using Maven 
 -------------------------------------------
 With either the binary or source distributions the sample can be built and run 

Added: incubator/tuscany/java/sca/samples/binding-notification-producer/build.xml
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-notification-producer/build.xml?rev=575701&view=auto
==============================================================================
--- incubator/tuscany/java/sca/samples/binding-notification-producer/build.xml (added)
+++ incubator/tuscany/java/sca/samples/binding-notification-producer/build.xml Fri Sep 14 07:37:40 2007
@@ -0,0 +1,74 @@
+<!--
+ * 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="binding-notification-producer" default="compile">
+    <property name="test.class" value="notification.producer.TrafficAdvisoryServer" />
+	<property name="test.jar"   value="sample-binding-notification-producer.jar" />
+	
+    <target name="init">
+        <mkdir dir="target/classes"/>
+    </target>
+	
+    <target name="compile" depends="init">
+        <javac srcdir="src/main/java"
+               destdir="target/classes"
+               debug="on"
+               source="1.5"
+               target="1.5">
+            <classpath>
+            	<pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+            </classpath>
+        </javac> 
+        <copy todir="target/classes">
+            <fileset dir="src/main/resources"/>
+        </copy>
+        <jar destfile="target/${test.jar}" basedir="target/classes">
+            <manifest>
+                <attribute name="Main-Class" value="${test.class}" /> 
+            </manifest>
+        </jar>    	
+    </target>	
+	
+    <target name="run-classes">
+        <java classname="${test.class}"
+              fork="true">
+            <classpath>
+                <pathelement path="target/classes"/>
+            	<pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+            </classpath>
+        </java>
+    </target>
+	
+    <target name="run">
+        <java classname="${test.class}"
+              fork="true">
+            <classpath>
+                <pathelement path="target/${test.jar}"/>
+            	<pathelement location="../../lib/tuscany-sca-manifest.jar"/>
+            </classpath>
+        	<sysproperty key="notification.httpPort" value="8083"/>
+        	<arg value="end"/>
+        </java>    	
+    </target>
+	
+    <target name="clean">
+        <delete quiet="true" includeemptydirs="true">
+            <fileset dir="target"/>
+        </delete>
+    </target>
+</project>

Modified: incubator/tuscany/java/sca/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryServer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryServer.java?rev=575701&r1=575700&r2=575701&view=diff
==============================================================================
--- incubator/tuscany/java/sca/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryServer.java (original)
+++ incubator/tuscany/java/sca/samples/binding-notification-producer/src/main/java/notification/producer/TrafficAdvisoryServer.java Fri Sep 14 07:37:40 2007
@@ -31,16 +31,19 @@
             SCADomain domain = SCADomain.newInstance("TrafficAdvisoryNotification.composite");
             TestCaseProducer testCaseProducer = domain.getService(TestCaseProducer.class, "TrafficAdvisoryProducer");
             BufferedReader reader = new BufferedReader(new InputStreamReader(System.in));
-            String value = null;
+            String value = "";
+            if (args.length == 1) {
+                value = args[0];
+            }
             do {
+                if(value == null || value.equals("end")) {
+                    break;
+                }
                 try {
                     System.out.println("Send a report value, ^C or <end> to end");
                     value = reader.readLine();
                 } catch (IOException e) {
                     e.printStackTrace();
-                }
-                if(value == null || value.equals("end")) {
-                    break;
                 }
                 testCaseProducer.produceTrafficNotification("Report value [" + value + "]");
             }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org