You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by fi...@apache.org on 2011/07/21 18:17:02 UTC

svn commit: r1149255 [1/2] - in /incubator/etch/branches/singlestack: ./ examples/ examples/signals/ examples/signals/src/ examples/signals/src/main/ examples/signals/src/main/c/ examples/signals/src/main/csharp/ examples/signals/src/main/csharp/Signal...

Author: fitzner
Date: Thu Jul 21 16:16:49 2011
New Revision: 1149255

URL: http://svn.apache.org/viewvc?rev=1149255&view=rev
Log:
ETCH-157 examples: add signals example for csharp, java and c

Single compile with:
ant build-java
ant build-csharp -Dbuild.target=Debug
ant build-c

Patch is from Armin Mueller <mu...@itestra.com>

Added:
    incubator/etch/branches/singlestack/examples/signals/
    incubator/etch/branches/singlestack/examples/signals/CMakeLists.txt
    incubator/etch/branches/singlestack/examples/signals/README.txt
    incubator/etch/branches/singlestack/examples/signals/build.xml
    incubator/etch/branches/singlestack/examples/signals/dist-build.xml
    incubator/etch/branches/singlestack/examples/signals/src/
    incubator/etch/branches/singlestack/examples/signals/src/main/
    incubator/etch/branches/singlestack/examples/signals/src/main/c/
    incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_client_impl.c
    incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_client_impl.h
    incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_client_main.c
    incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_client_main.h
    incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_listener_main.c
    incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_listener_main.h
    incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_server_impl.c
    incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_server_impl.h
    incubator/etch/branches/singlestack/examples/signals/src/main/csharp/
    incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsClientProj/
    incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsClientProj/Properties/
    incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsClientProj/Properties/AssemblyInfo.cs
    incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsClientProj/SignalsClientProj.csproj
    incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsListenerProj/
    incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsListenerProj/Properties/
    incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsListenerProj/Properties/AssemblyInfo.cs
    incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsListenerProj/SignalsListenerProj.csproj
    incubator/etch/branches/singlestack/examples/signals/src/main/csharp/org.apache.etch.examples.signals/
    incubator/etch/branches/singlestack/examples/signals/src/main/csharp/org.apache.etch.examples.signals/ImplSignalsClient.cs
    incubator/etch/branches/singlestack/examples/signals/src/main/csharp/org.apache.etch.examples.signals/ImplSignalsServer.cs
    incubator/etch/branches/singlestack/examples/signals/src/main/csharp/org.apache.etch.examples.signals/MainSignalsClient.cs
    incubator/etch/branches/singlestack/examples/signals/src/main/csharp/org.apache.etch.examples.signals/MainSignalsListener.cs
    incubator/etch/branches/singlestack/examples/signals/src/main/etch/
    incubator/etch/branches/singlestack/examples/signals/src/main/etch/Signals.etch
    incubator/etch/branches/singlestack/examples/signals/src/main/java/
    incubator/etch/branches/singlestack/examples/signals/src/main/java/org/
    incubator/etch/branches/singlestack/examples/signals/src/main/java/org/apache/
    incubator/etch/branches/singlestack/examples/signals/src/main/java/org/apache/etch/
    incubator/etch/branches/singlestack/examples/signals/src/main/java/org/apache/etch/examples/
    incubator/etch/branches/singlestack/examples/signals/src/main/java/org/apache/etch/examples/signals/
    incubator/etch/branches/singlestack/examples/signals/src/main/java/org/apache/etch/examples/signals/ImplSignalsClient.java
    incubator/etch/branches/singlestack/examples/signals/src/main/java/org/apache/etch/examples/signals/ImplSignalsServer.java
    incubator/etch/branches/singlestack/examples/signals/src/main/java/org/apache/etch/examples/signals/MainSignalsClient.java
    incubator/etch/branches/singlestack/examples/signals/src/main/java/org/apache/etch/examples/signals/MainSignalsListener.java
Modified:
    incubator/etch/branches/singlestack/.classpath
    incubator/etch/branches/singlestack/examples/build.xml

Modified: incubator/etch/branches/singlestack/.classpath
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/.classpath?rev=1149255&r1=1149254&r2=1149255&view=diff
==============================================================================
--- incubator/etch/branches/singlestack/.classpath (original)
+++ incubator/etch/branches/singlestack/.classpath Thu Jul 21 16:16:49 2011
@@ -38,6 +38,8 @@
 	<classpathentry kind="src" path="examples/perf/src/main/java"/>
 	<classpathentry kind="src" path="examples/perf/target/generated-sources/main/etch/java"/>
 	<classpathentry kind="src" path="examples/perf/src/test/java"/>
+	<classpathentry kind="src" path="examples/signals/src/main/java"/>
+	<classpathentry kind="src" path="examples/signals/target/generated-sources/main/etch/java"/>
 	<classpathentry kind="src" path="binding-c/compiler/src/main/java"/>
 	<classpathentry kind="src" path="binding-c/compiler/src/main/resources"/>
 	<classpathentry excluding="org/apache/etch/bindings/python/compiler/Compiler.java" kind="src" path="binding-python/compiler/src/main/java"/>

Modified: incubator/etch/branches/singlestack/examples/build.xml
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/examples/build.xml?rev=1149255&r1=1149254&r2=1149255&view=diff
==============================================================================
--- incubator/etch/branches/singlestack/examples/build.xml (original)
+++ incubator/etch/branches/singlestack/examples/build.xml Thu Jul 21 16:16:49 2011
@@ -46,6 +46,7 @@
         <build_example dir="example_mixin" logdir="${basedir}/target/logs" />
         <build_example dir="perf" logdir="${basedir}/target/logs" />
         <build_example dir="helloworld" logdir="${basedir}/target/logs" />
+        <build_example dir="signals" logdir="${basedir}/target/logs" />
     </target>
     
     <target name="do-postbuild">

Added: incubator/etch/branches/singlestack/examples/signals/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/examples/signals/CMakeLists.txt?rev=1149255&view=auto
==============================================================================
--- incubator/etch/branches/singlestack/examples/signals/CMakeLists.txt (added)
+++ incubator/etch/branches/singlestack/examples/signals/CMakeLists.txt Thu Jul 21 16:16:49 2011
@@ -0,0 +1,119 @@
+#
+# 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. 
+#
+cmake_minimum_required (VERSION 2.6) 
+project (etch-c-signals)
+
+message(STATUS "using etch home ${ETCH_HOME}")
+
+#Etch Home
+IF (NOT ETCH_HOME)
+    MESSAGE(FATAL_ERROR "ETCH_HOME not set")
+ENDIF (NOT ETCH_HOME)
+
+# Set definitions
+IF (UNIX)
+    add_definitions(-D_GNU_SOURCE -D_REENTRANT -DLINUX=2 -D__LINUX__)
+ENDIF (UNIX)
+add_definitions(-D_UNICODE -DUNICODE)
+
+# ETCH library
+SET(ETCH ${ETCH_HOME}/binding-c)
+FIND_PATH(ETCH_INCLUDE_DIR etch.h ${ETCH}/include)
+FIND_LIBRARY(ETCH_LIBRARY NAMES etch.lib libetch.a PATHS ${ETCH}/lib)
+IF (ETCH_INCLUDE_DIR AND ETCH_LIBRARY)
+    SET(ETCH_FOUND TRUE)
+ENDIF (ETCH_INCLUDE_DIR AND ETCH_LIBRARY)
+IF (NOT ETCH_FOUND)
+    MESSAGE(FATAL_ERROR "Could not find libetch")
+ENDIF (NOT ETCH_FOUND)
+
+# APR library
+SET(APR ${ETCH_HOME}/binding-c/extern/apr)
+FIND_PATH(APR_INCLUDE_DIR apr.h ${APR}/include ${APR}/include/apr-1)
+FIND_LIBRARY(APR_LIBRARY NAMES libapr-1.lib libapr-1.so PATHS ${APR}/lib)
+IF (APR_INCLUDE_DIR AND APR_LIBRARY)
+    SET(APR_FOUND TRUE)
+ENDIF (APR_INCLUDE_DIR AND APR_LIBRARY)
+IF (NOT APR_FOUND)
+    MESSAGE(FATAL_ERROR "Could not find libapr")
+ENDIF (NOT APR_FOUND)
+
+# APR-ICONV library
+SET(APR ${ETCH_HOME}/binding-c/extern/apr)
+FIND_PATH(APR-ICONV_INCLUDE_DIR apr_iconv.h ${APR}/include ${APR}/include/apr-1)
+FIND_LIBRARY(APR-ICONV_LIBRARY NAMES libapriconv-1.lib libapriconv-1.so PATHS ${APR}/lib)
+IF (APR-ICONV_INCLUDE_DIR AND APR-ICONV_LIBRARY)
+    SET(APR-ICONV_FOUND TRUE)
+ENDIF (APR-ICONV_INCLUDE_DIR AND APR-ICONV_LIBRARY)
+IF (NOT APR-ICONV_FOUND)
+    MESSAGE(FATAL_ERROR "Could not find libapriconv")
+ENDIF (NOT APR-ICONV_FOUND)
+
+# set include dirs
+include_directories (${APR_INCLUDE_DIR})
+include_directories (${APR-ICONV_INCLUDE_DIR})
+include_directories (${ETCH_INCLUDE_DIR})
+include_directories (${PROJECT_SOURCE_DIR}/src/main/c)
+include_directories (${PROJECT_SOURCE_DIR}/target/generated-sources/main/etch/c)
+
+add_executable(etch-c-signals-server
+ src/main/c/signals_server_impl.c
+ src/main/c/signals_listener_main.c
+ target/generated-sources/main/etch/c/signals_client.c
+ target/generated-sources/main/etch/c/signals_client_stub.c
+ target/generated-sources/main/etch/c/signals_helper.c
+ target/generated-sources/main/etch/c/signals_interface.c
+ target/generated-sources/main/etch/c/signals_remote.c
+ target/generated-sources/main/etch/c/signals_remote_client.c
+ target/generated-sources/main/etch/c/signals_remote_server.c
+ target/generated-sources/main/etch/c/signals_server.c
+ target/generated-sources/main/etch/c/signals_server_implx.c
+ target/generated-sources/main/etch/c/signals_server_stub.c
+ target/generated-sources/main/etch/c/signals_valufact.c
+)
+
+add_executable(etch-c-signals-client
+ src/main/c/signals_client_impl.c
+ src/main/c/signals_client_main.c
+ target/generated-sources/main/etch/c/signals_client.c
+ target/generated-sources/main/etch/c/signals_client_implx.c
+ target/generated-sources/main/etch/c/signals_client_stub.c
+ target/generated-sources/main/etch/c/signals_helper.c
+ target/generated-sources/main/etch/c/signals_interface.c
+ target/generated-sources/main/etch/c/signals_remote.c
+ target/generated-sources/main/etch/c/signals_remote_client.c
+ target/generated-sources/main/etch/c/signals_remote_server.c
+ target/generated-sources/main/etch/c/signals_server.c
+ target/generated-sources/main/etch/c/signals_server_stub.c
+ target/generated-sources/main/etch/c/signals_valufact.c
+)
+
+target_link_libraries(etch-c-signals-server "${APR_LIBRARY}")
+target_link_libraries(etch-c-signals-server "${APR-ICONV_LIBRARY}")
+target_link_libraries(etch-c-signals-server "${ETCH_LIBRARY}")
+IF (UNIX)
+set_target_properties(etch-c-signals-server PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
+ENDIF (UNIX)
+set_target_properties(etch-c-signals-server PROPERTIES OUTPUT_NAME "signals-server")
+
+target_link_libraries(etch-c-signals-client "${APR_LIBRARY}")
+target_link_libraries(etch-c-signals-client "${APR-ICONV_LIBRARY}")
+target_link_libraries(etch-c-signals-client "${ETCH_LIBRARY}")
+IF (UNIX)
+set_target_properties(etch-c-signals-client PROPERTIES COMPILE_FLAGS "-m32" LINK_FLAGS "-m32")
+ENDIF (UNIX)
+set_target_properties(etch-c-signals-client PROPERTIES OUTPUT_NAME "signals-client")

Added: incubator/etch/branches/singlestack/examples/signals/README.txt
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/examples/signals/README.txt?rev=1149255&view=auto
==============================================================================
--- incubator/etch/branches/singlestack/examples/signals/README.txt (added)
+++ incubator/etch/branches/singlestack/examples/signals/README.txt Thu Jul 21 16:16:49 2011
@@ -0,0 +1,59 @@
+This example demonstrate basic @Signal usage
+
+To generate sources, build and run tests execute:
+
+cd $ETCH_HOME
+.\scripts\antSetup.bat
+cd examples
+cd signals
+ant Debug
+
+This will generate sources for all csharp, java and c. It will also build the csharp and java sources. See below
+regarding the build of the C binding sources.
+
+JAVA INSTRUCTIONS:
+******************
+To run java Signals example for java, run these commands:
+
+> cd target\bin
+> start java -cp signals.jar org.apache.etch.examples.signals.MainSignalsListener
+> start java -cp signals.jar org.apache.etch.examples.signals.MainSignalsClient
+
+CSHARP INSTRUCTIONS:
+********************
+To run csharp example:
+
+> cd target\bin
+> start SignalsListener.exe
+> start SignalsClient.exe
+
+C INSTRUCTIONS:
+***************
+To run the c example:
+> build using cmake (see below)
+> on windows using visual studio: build the generated solution and execute server and client targets
+> on linux: use make to build using generated makefiles, execute signals-client 
+            and signals-server executables.
+
+To build the C sources, use cmake. Start cmake-gui, set source to example/signals folder and "build" to a subfolder (e.g. "ctarget").
+You have to set the following variable in CMake:
+- ETCH_HOME must point to your Etch directory (this is were you installed Etch, or target/Installers/dist if building from trunk)
+
+on the shell, you could do this using
+cd examples/signals/target
+cmake .. -DETCH_HOME:string=<YOUR ETCH INSTALLATION DIR>
+make (or open visual studio on win32...)
+
+You also have to set the following environment variable:
+- APR_ICONV_PATH to <YOUR ETCH INSTALLATION DIR>/binding-c/extern/apr/iconv/
+
+To run c example:
+
+> cd target\bin
+> start signals-server.exe
+> start signals-client.exe
+
+
+
+
+You can mix and match the various clients and listeners.

Added: incubator/etch/branches/singlestack/examples/signals/build.xml
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/examples/signals/build.xml?rev=1149255&view=auto
==============================================================================
--- incubator/etch/branches/singlestack/examples/signals/build.xml (added)
+++ incubator/etch/branches/singlestack/examples/signals/build.xml Thu Jul 21 16:16:49 2011
@@ -0,0 +1,320 @@
+<?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 name="etch-Signals-example" basedir="." default="help" >
+    <description>Signals Example</description>
+    <property name="Etch.basedir" location="${basedir}/../.." />
+    <import file="${Etch.basedir}/build-support/etch.includes.xml" />
+
+    <!-- TODO better computation of etch.home, etch.version -->
+    <property environment="env" />
+
+    <!-- compute ETCH_HOME -->
+    <property name="build.ETCH_HOME" location="${basedir}/../../target/Installers/dist" />
+    <condition property="etch.home" value="${env.ETCH_HOME}" >
+        <isset property="${env.ETCH_HOME}" />
+    </condition>
+    <condition property="etch.home" value="${build.ETCH_HOME}" >
+        <not><isset property="etch.home" /></not>
+    </condition>
+
+    <property name="Etch.dependency.junit.jar"
+        location="${default.junit.lib}/junit-4.3.1.jar" />
+
+    <property name="Etch.buildSupportDirectory" location="../../build-support" />
+
+    <!-- compute etch.version -->
+    <condition property="etch.version" value="${Etch.version}" >
+        <not><isset property="etch.version" /></not>
+    </condition>
+
+    <condition property="etch.longversion" value="${Etch.longversion}" >
+        <not><isset property="etch.longversion" /></not>
+    </condition>
+
+    <!-- Csharp Support -->
+    <condition property="USE.dotnet" >
+        <and>
+            <os family="windows" />
+            <available file="${env.DOTNET_HOME}/msbuild.exe" />
+            <available file="${build.ant-dotnet.lib}/ant-dotnet-1.0.jar" />
+            <available file="${env.NUNIT_HOME}/bin/net-2.0/nunit.exe" />
+        </and>
+    </condition>
+    <condition property="USE.mono" >
+        <and>
+            <not><os family="windows" /></not>
+            <available file="${build.mono.home}/bin/xbuild" />
+        </and>
+    </condition>
+    <condition property="BUILD.csharp" >
+        <or>
+            <isset property="USE.dotnet" />
+            <isset property="USE.mono" />
+        </or>
+    </condition>
+	<property name="tool.xbuild" value="${build.mono.home}/bin/xbuild" />
+
+    <!-- import etch task -->
+    <taskdef onerror="report" resource="org/apache/etch/tools/ant/etch.xml" classpath="${etch.home}/lib/apache-etch-ant-plugin-${etch.longversion}.jar" />
+
+    <!-- import dotnet task -->
+    <condition property="ant.dotnet.jar" value="ant-dotnet-1.0.jar" >
+        <not><isset property="ant.dotnet.jar" /></not>
+    </condition>
+
+    <taskdef
+        onerror="report"
+        resource="org/apache/ant/dotnet/antlib.xml"
+        classpath="${ant.dotnet.jar}" />
+
+    <macrodef name="xbuild">
+        <attribute name="dir"         default="." />
+        <attribute name="failonerror" default="false" />
+        <attribute name="project"     default="" />
+        <attribute name="target"      default="${build.target}" />
+        <sequential>
+            <exec executable="${tool.xbuild}" dir="@{dir}" failonerror="@{failonerror}" >
+                <arg value="/property:Configuration=@{target}" />
+                <arg value="@{project}" />
+            </exec>
+        </sequential>
+    </macrodef>
+
+    <!-- set properties -->
+    <property name="src"               location="${basedir}/src" />
+    <property name="main-src-java"     location="${src}/main/java" />
+    <property name="target"            location="${basedir}/target" />
+    <property name="dist-src"          location="${target}/dist-src" />
+    <property name="generated-sources" location="${target}/generated-sources" />
+    <property name="gen-src-java"      location="${generated-sources}/main/etch/java" />
+    <property name="gen-src-csharp"    location="${generated-sources}/main/etch/csharp" />
+    <property name="gen-src-c"         location="${generated-sources}/main/etch/c" />
+    <property name="bin"               location="${target}/bin" />
+    <property name="classes"           location="${target}/classes" />
+    <property name="dist"              location="${basedir}/../../target/Installers/dist" />
+
+    <!-- initialize -->
+    <target name="init" >
+        <mkdir dir="${target}" />
+        <mkdir dir="${dist-src}" />
+        <mkdir dir="${generated-sources}" />
+        <mkdir dir="${gen-src-java}" />
+        <mkdir dir="${gen-src-csharp}" />
+        <mkdir dir="${bin}" />
+        <mkdir dir="${classes}" />
+    </target>
+
+    <!-- build the server -->
+    <target name="generate-sources" depends="init" >
+        <!-- generate sources -->
+
+        <etch home="${etch.home}"
+              file="${src}/main/etch/Signals.etch"
+              binding="java"
+              outputDir="${gen-src-java}" />
+
+        <etch home="${etch.home}"
+              file="${src}/main/etch/Signals.etch"
+              binding="csharp"
+              outputDir="${gen-src-csharp}" />
+
+        <etch home="${etch.home}"
+              file="${src}/main/etch/Signals.etch"
+              binding="c"
+              what="INTF,MAIN,IMPL,BOTH"
+              outputDir="${gen-src-c}" />
+    </target>
+
+    <property name="etch-java-runtime-name" value="apache-etch-java-runtime-${etch.longversion}.jar" />
+    <property name="Etch.dependency.java.runtime" location="${etch.home}/binding-java/lib/${etch-java-runtime-name}" />
+
+    <target name="build-java" depends="generate-sources" >
+        <!-- compile sources -->
+
+        <javac target="1.5" destdir="${classes}" >
+            <src path="${gen-src-java}" />
+            <src path="${main-src-java}" />
+            <classpath>
+                <pathelement location="${Etch.dependency.java.runtime}" />
+            </classpath>
+        </javac>
+
+        <!-- Create Jar -->
+        <jar jarfile="${bin}/signals.jar" >
+            <manifest>
+                <attribute name="Class-Path" value="${etch-java-runtime-name}" />
+            </manifest>
+            <fileset dir="${classes}" >
+                <include name="**/*" />
+            </fileset>
+        </jar>
+
+        <!-- copy in dependencies -->
+        <copy todir="${bin}" file="${Etch.dependency.java.runtime}" />
+    </target>
+
+    <target name="build-csharp-with-mono" depends="generate-sources" if="USE.mono" >
+        <xbuild dir="${src}/main/csharp/SignalsClientProj" project="SignalsClientProj.csproj" />
+        <xbuild dir="${src}/main/csharp/SignalsListenerProj" project="SignalsListenerProj.csproj" />
+    </target>
+
+    <target name="build-csharp-with-dotnet" depends="generate-sources" if="USE.dotnet" >
+        <echo>build target: ${build.target}</echo>
+        <msbuild buildfile="${src}/main/csharp/SignalsListenerProj/SignalsListenerProj.csproj" >
+            <property name="Configuration" value="${build.target}" />
+        </msbuild>
+        <msbuild buildfile="${src}/main/csharp/SignalsClientProj/SignalsClientProj.csproj" >
+            <property name="Configuration" value="${build.target}" />
+        </msbuild>
+    </target>
+    
+    <target name="copy-csharp-result" depends="build-csharp-with-mono,build-csharp-with-dotnet" >
+        <copy todir="${bin}" >
+            <fileset dir="${src}/main/csharp/SignalsListenerProj/bin/${build.target}" >
+                <include name="*" />
+            </fileset>
+            <fileset dir="${src}/main/csharp/SignalsClientProj/bin/${build.target}" >
+                <include name="*" />
+            </fileset>
+        </copy>
+    </target>
+
+    <target name="build-csharp" depends="copy-csharp-result"/>
+
+	<target name="build-c" depends="generate-sources" if="USE.cmake">
+		 <cmake srcdir="${basedir}" bindir="${basedir}/target" buildtype="Debug" >
+		           	<variable name="ETCH_HOME" type="PATH" value="${etch.home}" />
+  		 </cmake>
+                 <copy todir="${bin}" flatten="true">
+                    <fileset dir="${basedir}/target/" >
+                         <include name="signals-client" />
+                         <include name="signals-server" />
+                         <include name="Debug/signals-client.exe" />
+                         <include name="Debug/signals-server.exe" />
+                    </fileset>
+                 </copy>
+                 <chmod perm="u+x">
+                     <fileset dir="${bin}" includes="signals-client signals-server"/>
+                 </chmod>
+                 <copy todir="${bin}" flatten="true">
+                    <fileset dir="${etch.home}/binding-c/extern/apr/bin" >
+                         <include name="libapr-1.dll" />
+                         <include name="libapriconv-1.dll" />
+                    </fileset>
+                 </copy>
+                
+	</target>
+	
+    <target name="build" depends="build-java,build-csharp,build-c" />
+
+    <target name="done" depends="build" >
+        <echo>
+
+Build Complete!
+
+To run java Signals example, open a cmd window and run these
+commands:
+
+> cd target\bin
+> start java -cp signals.jar org.apache.etch.examples.signals.MainSignalsListener
+> start java -cp signals.jar org.apache.etch.examples.signals.MainSignalsClient
+
+To run csharp example:
+
+> cd target\bin
+> start SignalsListener.exe
+> start SignalsClient.exe
+
+To run the c example:
+
+> build using cmake (see README.txt) (if you are not building from trunk, 
+  e.g. if you have an official release)
+> cd target\bin
+> start signals-server.exe
+> start signals-client.exe
+
+You can mix and match the various clients and listeners.
+
+        </echo>
+    </target>
+
+    <!-- build everything -->
+    <target name="init-debug" >
+        <property name="build.target" value="Debug" />
+    </target>
+
+    <target name="init-release" >
+        <property name="build.target" value="Release" />
+    </target>
+
+   <target name="dist-src" >
+       <copy file="dist-build.xml" tofile="${dist-src}/build.xml" overwrite="true" >
+           <filterset refid="Etch.buildTokens" />
+       </copy>    
+        <copy file="CMakeLists.txt" tofile="${dist-src}/CMakeLists.txt" overwrite="true" />
+        <copy file="README.txt" tofile="${dist-src}/README.txt" overwrite="true" />
+        
+        <copy todir="${dist-src}/src/main/etch" overwrite="true" >
+            <fileset dir="${src}/main/etch" >
+                <exclude name="**/.svn/**" />
+                <include name="**/*.etch" />
+            </fileset>
+        </copy>
+        
+        <copy todir="${dist-src}/src/main/java" overwrite="true" >
+            <fileset dir="${src}/main/java" >
+                <exclude name="**/.svn/**" />
+                <include name="**/*.java" />
+            </fileset>
+        </copy>
+        
+        <copy todir="${dist-src}/src/main/csharp" overwrite="true" >
+            <fileset dir="${src}/main/csharp" >
+                <exclude name="**/.svn/**" />
+                <include name="**/*.cs" />
+            </fileset>
+        </copy>
+
+        <copy todir="${dist-src}/src/main/c" overwrite="true" >
+            <fileset dir="${src}/main/c" >
+                <exclude name="**/.svn/**" />
+                <include name="**/*.c" />
+                <include name="**/*.h" />
+                <include name="**/CMakeLists.txt" />
+            </fileset>
+        </copy>
+        
+        <copy todir="${dist}/examples/signals" overwrite="true" >
+            <fileset dir="${dist-src}" />
+        </copy>
+    </target>
+
+    <target name="debug" depends="dist-src,init-debug,build,done" />
+    <target name="release" depends="dist-src,init-release,build,done" />
+
+    <!-- clean -->
+    <target name="clean" >
+        <delete dir="${target}" quiet="true" />
+        <delete dir="${src}/main/csharp/SignalsClientProj/bin" quiet="true" />
+        <delete dir="${src}/main/csharp/SignalsClientProj/obj" quiet="true" />
+        <delete dir="${src}/main/csharp/SignalsListenerProj/bin" quiet="true" />
+        <delete dir="${src}/main/csharp/SignalsListenerProj/obj" quiet="true" />
+    </target>
+</project>

Added: incubator/etch/branches/singlestack/examples/signals/dist-build.xml
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/examples/signals/dist-build.xml?rev=1149255&view=auto
==============================================================================
--- incubator/etch/branches/singlestack/examples/signals/dist-build.xml (added)
+++ incubator/etch/branches/singlestack/examples/signals/dist-build.xml Thu Jul 21 16:16:49 2011
@@ -0,0 +1,164 @@
+<?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 name="etch-Signals-example" basedir="." default="build">
+    <description>Signals Example</description>
+
+    <property name="etch.home" location="${basedir}/../.."/>
+    <property name="etch.version" value="@EtchVersion@"/>
+    <property name="etch.longversion" value="@EtchLongVersion@"/>
+    <!-- todo clean up variables etch-java-runtime.jar, etch-csharp-runtime.dll -->
+    <property name="etch-java-runtime-name" value="apache-etch-java-runtime-${etch.longversion}.jar"/>
+    <property name="etch-csharp-runtime-name" value="ApacheEtchCsharpIncubating.dll"/>
+
+    <property name="etch-ant-plugin.jar"     location="${etch.home}/lib/apache-etch-ant-plugin-${etch.longversion}.jar"/>
+    <property name="etch-java-runtime.jar"   location="${etch.home}/binding-java/lib/${etch-java-runtime-name}"/>
+    <property name="etch-csharp-runtime.dll" location="${etch.home}/binding-csharp/lib/${etch-csharp-runtime-name}"/>
+
+    <property name="src"               location="${basedir}/src"/>
+    <property name="src-main-etch"     location="${src}/main/etch"/>
+    <property name="src-main-java"     location="${src}/main/java"/>
+    <property name="src-main-csharp"   location="${src}/main/csharp"/>
+    <property name="target"            location="${basedir}/target"/>
+    <property name="generated-sources" location="${target}/generated-sources"/>
+    <property name="gensrc-main-etch-java" location="${generated-sources}/main/etch/java"/>
+    <property name="gensrc-main-etch-csharp" location="${generated-sources}/main/etch/csharp"/>
+    <property name="gensrc-main-etch-c" location="${generated-sources}/main/etch/c"/>
+    <property name="classes"           location="${target}/classes"/>
+    <property name="bin"               location="${target}/bin"/>
+
+    <condition property="BUILD.csharp" >
+        <os family="windows" />
+    </condition>
+
+    <taskdef resource="org/apache/etch/tools/ant/etch.xml" classpath="${etch-ant-plugin.jar}"/>
+
+    <target name="build" depends="build-java, build-csharp, build-c, done"/>
+
+    <target name="build-java" depends="gensrc-java">
+        <javac destdir="${classes}" source="1.5" debug="true">
+            <classpath>
+                <pathelement location="${etch-java-runtime.jar}"/>
+            </classpath>
+            <src path="${src-main-java}"/>
+            <src path="${gensrc-main-etch-java}"/>
+        </javac>
+
+        <jar jarfile="${bin}/signals.jar">
+            <manifest>
+                <attribute name="Class-Path" value="${etch-java-runtime-name}"/>
+            </manifest>
+            <fileset dir="${classes}"/>
+        </jar>
+
+        <copy todir="${bin}" file="${etch-java-runtime.jar}"/>
+    </target>
+
+    <target name="done">
+        <echo>
+
+To run java Signals example, open a cmd window and run these
+commands:
+
+> cd target\bin
+> start java -cp signals.jar org.apache.etch.examples.signals.MainSignalsListener
+> start java -cp signals.jar org.apache.etch.examples.signals.MainSignalsClient
+
+To run csharp example:
+
+> cd target\bin
+> start SignalsListener.exe
+> start SignalsClient.exe
+
+To run the c example:
+> first build using cmake (see below)
+
+You have to set the following variable in CMake:
+- ETCH_HOME must point to your Etch directory (this is were you installed Etch, or target/Installers/dist if building from trunk)
+
+on the shell, you could do this using:
+
+cd examples/signals/target
+cmake .. -DETCH_HOME:string=[YOUR ETCH INSTALLATION DIR]
+make (or open visual studio on win32...)
+
+You also have to set the following environment variable:
+- APR_ICONV_PATH to [YOUR ETCH INSTALLATION DIR]/binding-c/extern/apr/iconv/
+
+To run c example:
+
+> cd target\bin
+> start signals-server.exe
+> start signals-client.exe
+
+
+You can mix and match the various clients and listeners.
+
+        </echo>
+    </target>
+
+    <target name="build-csharp" depends="gensrc-csharp" if="BUILD.csharp" >
+        <echo message="csharp binding sources can be built with Visual Studio or Mono!"/>
+    </target>
+
+    <target name="build-c" depends="gensrc-c">
+       <echo message="c binding sources can be built with cmake!"/>
+    </target>
+
+    <target name="gensrc-java" depends="init">
+        <etch
+            home="${etch.home}"
+            binding="java"
+            quiet="true"
+            outputDir="${gensrc-main-etch-java}"
+            file="${src-main-etch}/Signals.etch"/>
+    </target>
+
+    <target name="gensrc-csharp" depends="init">
+        <etch
+            home="${etch.home}"
+            binding="csharp"
+            quiet="true"
+            outputDir="${gensrc-main-etch-csharp}"
+            file="${src-main-etch}/Signals.etch"/>
+    </target>
+
+    <target name="gensrc-c" depends="init">
+        <etch
+            home="${etch.home}"
+            binding="c"
+            quiet="true"
+            outputDir="${gensrc-main-etch-c}"
+            file="${src-main-etch}/Signals.etch"/>
+    </target>
+
+    <target name="init">
+        <mkdir dir="${target}"/>
+        <mkdir dir="${generated-sources}"/>
+        <mkdir dir="${gensrc-main-etch-java}"/>
+        <mkdir dir="${gensrc-main-etch-csharp}"/>
+        <mkdir dir="${gensrc-main-etch-c}"/>
+        <mkdir dir="${classes}"/>
+        <mkdir dir="${bin}"/>
+    </target>
+
+    <target name="clean">
+        <delete dir="${target}"/>
+    </target>
+</project>

Added: incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_client_impl.c
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_client_impl.c?rev=1149255&view=auto
==============================================================================
--- incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_client_impl.c (added)
+++ incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_client_impl.c Thu Jul 21 16:16:49 2011
@@ -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.
+ *
+ */
+
+#include "signals_client_impl.h"
+#include "signals_valufact.h"
+#include "etch_url.h"
+#include "etch_arrayval.h"
+#include "etch_binary_tdo.h"
+#include "etch_exception.h"
+#include "etch_general.h"
+#include "etch_log.h"
+#include "etch_map.h"
+#include <stdio.h>
+
+unsigned short CLASSID_SIGNALS_CLIENT_IMPL;
+
+char* SIGNALS_ETCHCIMP = "CIMP";
+static char *client_name = "";
+
+int destroy_signals_client_implx(void*);
+void* example_signal_impl(void* thisx, etch_int32* count);
+
+signals_client_impl* init_signals_client_impl(struct signals_remote_server*, etch_object_destructor);
+
+void set_signals_client_name(char *name) {
+	client_name = name;
+}
+
+/**
+ * signals_client_impl constructor.
+ */
+signals_client_impl* new_signals_client_impl(struct signals_remote_server* server)
+{
+	signals_client_impl* pclient = init_signals_client_impl(server, destroy_signals_client_implx);
+	i_signals_client* pclient_base = pclient->signals_client_base;
+	/* virtual method overrides */
+  etchmap_insertxw(pclient_base->virtuals, signals_valufact_get_static()->str_signals_example_signal, example_signal_impl, FALSE);
+
+	return pclient;
+}
+
+/**
+ * destructor for any user allocated memory.
+ */
+int destroy_signals_client_implx(void* data) {
+	return 0;
+}
+
+/**
+ * implementation method to handle signals from server
+ */
+void* example_signal_impl(void* thisx, etch_int32* count) {
+	printf("%s: example signal, count = %d\n", client_name, count->value);
+	etch_object_destroy(count);
+	return NULL;
+}

Added: incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_client_impl.h
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_client_impl.h?rev=1149255&view=auto
==============================================================================
--- incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_client_impl.h (added)
+++ incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_client_impl.h Thu Jul 21 16:16:49 2011
@@ -0,0 +1,71 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+
+#ifndef SIGNALS_CLIENT_IMPL_H
+#define SIGNALS_CLIENT_IMPL_H
+
+#include "signals_client.h"
+#include "etch_transport.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern unsigned short CLASSID_SIGNALS_CLIENT_IMPL;
+
+//typedef struct signals_remote_server signals_remote_server;
+
+/**
+ * signals_client_impl
+ */
+typedef struct signals_client_impl
+{
+	etch_object object;
+
+	i_signals_client* signals_client_base; /* owned */
+	i_signals* isignals; /* not owned */
+	struct signals_remote_server* server; /* not owned */
+
+	int (*destroyex) (void*);  /* user memory destructor */
+
+	/* - - - - - - - - - - - -
+	 * objsession
+	 * - - - - - - - - - - - -
+	 */
+	i_objsession* iobjsession;  /* owned by base */
+	/* note that iobjsession->thisx is set to this signals_client_impl* */
+	etch_session_control _session_control;
+	etch_session_notify  _session_notify;
+	etch_session_query   _session_query;
+
+} signals_client_impl;
+
+void set_signals_client_name(char *name);
+
+/* constructor */
+signals_client_impl* new_signals_client_impl (struct signals_remote_server*);
+
+#ifdef __cplusplus
+} //extern "C"
+#endif
+
+#endif /* SIGNALS_CLIENT_IMPL_H */

Added: incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_client_main.c
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_client_main.c?rev=1149255&view=auto
==============================================================================
--- incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_client_main.c (added)
+++ incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_client_main.c Thu Jul 21 16:16:49 2011
@@ -0,0 +1,112 @@
+/*
+ *
+ * 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.
+ *
+ */
+ 
+#include "signals_client_main.h"
+#include "etch_objecttypes.h"
+#include "etch_runtime.h"
+#include "etch_arrayval.h"
+#include "etch_nativearray.h"
+#include "etch_binary_tdo.h"
+#include "etch_general.h"
+
+#define WAIT_UP_MS 4000
+
+static signals_client_impl *signals_client = NULL;
+
+/**
+ * callback constructor for client implementation object.
+ */
+static i_signals_client* signals_client_create(void* factory_thisx, signals_remote_server* server)
+{
+	signals_client = new_signals_client_impl(server);
+	return signals_client ? signals_client->signals_client_base:NULL;
+}
+
+
+/**
+ * main()
+ */
+int main(int argc, char* argv[])
+{
+	etch_status_t etch_status = ETCH_SUCCESS;
+	signals_remote_server* remote = NULL;
+	char *signals_client_name = NULL;
+
+	wchar_t* uri = L"udp://127.0.0.1:4001";
+
+	// init etch
+	etch_config_t* config = NULL;
+	etch_config_create(&config);
+
+	etch_status = etch_runtime_initialize(config);
+	if(etch_status != ETCH_SUCCESS) {
+		return 1;
+	}
+
+	// init etch client
+	etch_status = signals_helper_remote_server_create(&remote, uri, NULL, (main_client_create_func)signals_client_create);
+	if(etch_status != ETCH_SUCCESS) {
+		// error
+	}
+
+	etch_status = signals_helper_remote_server_start_wait(remote, WAIT_UP_MS);
+	if(etch_status != ETCH_SUCCESS) {
+		// error
+	}
+
+	// client implementation
+	{
+		etch_string *_signals_client_name = remote->get_free_client_name(remote);
+		if (is_etch_exception(_signals_client_name)) {
+			printf("Error retrieving client name. Is server running?\n");
+			return 1;
+		}
+		etch_encoding_transcode_wchar(&signals_client_name, ETCH_ENCODING_UTF8, _signals_client_name->v.valw, NULL);
+		set_signals_client_name(signals_client_name);
+		printf("Got client name: %s\n", signals_client_name);
+		etch_object_destroy(_signals_client_name);
+	}
+
+	printf("%s: Subscribing to example signal ...\n", signals_client_name);
+	remote->_SubscribeExampleSignal(remote);
+
+	printf("Press enter to unsubscribe\n" );
+	waitkey();
+	remote->_UnsubscribeExampleSignal(remote);
+
+	printf("%s: Press enter to disconnect\n", signals_client_name);
+	waitkey();
+
+	// shutdown client
+	etch_free(signals_client_name);
+
+	etch_status = signals_helper_remote_server_stop_wait(remote, WAIT_UP_MS);
+	if(etch_status != ETCH_SUCCESS) {
+		// error
+	}
+
+	etch_status = signals_helper_remote_server_destroy(remote);
+	if(etch_status != ETCH_SUCCESS) {
+		// error
+	}
+	etch_config_destroy(config);
+	return 0;
+}

Added: incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_client_main.h
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_client_main.h?rev=1149255&view=auto
==============================================================================
--- incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_client_main.h (added)
+++ incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_client_main.h Thu Jul 21 16:16:49 2011
@@ -0,0 +1,50 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+#ifndef SIGNALS_CLIENT_MAIN_H
+#define SIGNALS_CLIENT_MAIN_H
+
+#include "etch_runtime.h"
+#include "signals_helper.h"
+#include "signals_client_impl.h"
+#include "signals_remote_server.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Start the listener at the given uri, waiting waitupms microseconds for listener startup.
+ * The created listener is saved at address pointed to by pplistener.
+ */
+extern etch_status_t signals_listener_start(i_sessionlistener** pplistener, wchar_t* uri, int waitupms);
+
+/*
+ * signals_listener_stop(plistener, waitupms)
+ * Stop the listener given by plistener, waiting waitupms microseconds to stop.
+ */
+extern etch_status_t signals_listener_stop(i_sessionlistener* plistener, int waitupms);
+
+#ifdef __cplusplus
+} //extern "C"
+#endif
+
+#endif /* SIGNALS_CLIENT_MAIN.H */

Added: incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_listener_main.c
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_listener_main.c?rev=1149255&view=auto
==============================================================================
--- incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_listener_main.c (added)
+++ incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_listener_main.c Thu Jul 21 16:16:49 2011
@@ -0,0 +1,110 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+#include "signals_listener_main.h"
+#include "etch_objecttypes.h"
+#include "etch_runtime.h"
+#include "etch_arrayval.h"
+#include "etch_nativearray.h"
+#include "etch_binary_tdo.h"
+#include "etch_general.h"
+
+#define WAIT_UP_MS 4000
+
+static void* signals_server_create(void* factoryData, void* sessionData)
+{
+	etch_session* session = (etch_session*)sessionData;
+	signals_remote_client* client  = (signals_remote_client*) session->client;
+
+	signals_server_impl* newserver = new_signals_server_impl(client);
+
+	return newserver->signals_server_base;
+}
+
+etch_status_t signals_listener_start(i_sessionlistener** pplistener, wchar_t* uri, int waitupms)
+{
+	etch_status_t etch_status = ETCH_SUCCESS;
+
+	etch_status = signals_helper_listener_create(pplistener, uri, NULL, signals_server_create);
+	if(etch_status == ETCH_SUCCESS) 
+	{
+		etch_status = signals_helper_listener_start_wait(*pplistener, waitupms);
+	}
+
+	return etch_status;
+}
+
+etch_status_t signals_listener_stop(i_sessionlistener* plistener, int waitupms)
+{
+	etch_status_t etch_status = ETCH_SUCCESS;
+
+	etch_status = signals_helper_listener_stop_wait(plistener, waitupms);
+	if(etch_status == ETCH_SUCCESS) 
+	{
+		signals_helper_listener_destroy(plistener);
+	}
+
+	return etch_status;
+}
+
+/**
+ * main()
+ */
+int main(int argc, char* argv[])
+{
+	etch_status_t etch_status = ETCH_SUCCESS;
+	i_sessionlistener* listener = NULL;
+
+	wchar_t* uri = L"udp://127.0.0.1:4001?UdpListener.singleSession=true";
+
+	etch_config_t* config = NULL;
+	etch_config_create(&config);
+
+	etch_status = etch_runtime_initialize(config);
+	if(etch_status != ETCH_SUCCESS) {
+		// error
+		return 1;
+	}
+
+	etch_status = signals_listener_start(&listener, uri, WAIT_UP_MS);
+	if(etch_status != ETCH_SUCCESS) {
+		// error
+	}
+
+	printf("Server started\n");
+	printf("Press enter to stop server\n");
+	// wait for keypress
+	waitkey();
+
+	etch_status = signals_listener_stop(listener, WAIT_UP_MS);
+	if(etch_status != ETCH_SUCCESS) {
+		// error
+	}
+
+	etch_status = etch_runtime_shutdown();
+	if(etch_status != ETCH_SUCCESS) {
+		// error
+		return 1;
+	}
+	etch_config_destroy(config);
+
+	return 0;
+}

Added: incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_listener_main.h
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_listener_main.h?rev=1149255&view=auto
==============================================================================
--- incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_listener_main.h (added)
+++ incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_listener_main.h Thu Jul 21 16:16:49 2011
@@ -0,0 +1,50 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+
+#ifndef SIGNALS_LISTENER_MAIN_H
+#define SIGNALS_LISTENER_MAIN_H
+
+#include "etch_runtime.h"
+#include "signals_helper.h"
+#include "signals_server_impl.h"
+#include "signals_remote_client.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*
+ * Start the listener at the given uri, waiting waitupms microseconds for listener startup.
+ * The created listener is saved at address pointed to by pplistener.
+ */
+extern etch_status_t signals_listener_start(i_sessionlistener** pplistener, wchar_t* uri, int waitupms);
+
+/*
+ * Stop the listener given by plistener, waiting waitupms microseconds to stop.
+ */
+extern etch_status_t signals_listener_stop(i_sessionlistener* plistener, int waitupms);
+
+#ifdef __cplusplus
+} //extern "C"
+#endif
+
+#endif /* SIGNALS_LISTENER_MAIN.H */

Added: incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_server_impl.c
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_server_impl.c?rev=1149255&view=auto
==============================================================================
--- incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_server_impl.c (added)
+++ incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_server_impl.c Thu Jul 21 16:16:49 2011
@@ -0,0 +1,165 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+
+#include "signals_server_impl.h"
+#include "signals_valufact.h"
+#include "signals_remote_client.h"
+#include "etch_url.h"
+#include "etch_arrayval.h"
+#include "etch_binary_tdo.h"
+#include "etch_exception.h"
+#include "etch_general.h"
+#include "etch_log.h"
+#include "etch_map.h"
+#include <stdio.h>
+
+#if defined(_MSC_VER)
+#define snprintf _snprintf
+#endif
+
+unsigned short CLASSID_SIGNALS_SERVER_IMPL;
+
+char* SIGNALS_ETCHSIMP = "SIMP";
+
+/* generated signatures */
+int destroy_signals_server_implx(void*);
+signals_server_impl* init_signals_server_impl(struct signals_remote_client*, etch_object_destructor);
+
+static etch_string* get_free_client_name_impl(void* thisx);
+static void* _SubscribeExampleSignal_impl(void* thisx, etch_who* subscriber);
+static void* _UnsubscribeExampleSignal_impl(void* thisx, etch_who* subscriber);
+
+/**
+ * signals_server_impl constructor.
+ */
+signals_server_impl* new_signals_server_impl(struct signals_remote_client* client) 
+{
+	signals_server_impl* pserver = init_signals_server_impl(client, destroy_signals_server_implx);
+	i_signals_server* pserver_base = pserver->signals_server_base;
+	((etch_object*)pserver_base)->class_id = get_dynamic_classid_unique(&CLASSID_SIGNALS_SERVER_IMPL);
+	/* virtual method overrides */
+	etchmap_insertxw(pserver_base->virtuals, signals_valufact_get_static()->str_signals_get_free_client_name, get_free_client_name_impl, FALSE);
+	etchmap_insertxw(pserver_base->virtuals, signals_valufact_get_static()->str_signals__SubscribeExampleSignal, _SubscribeExampleSignal_impl, FALSE);
+	etchmap_insertxw(pserver_base->virtuals, signals_valufact_get_static()->str_signals__UnsubscribeExampleSignal, _UnsubscribeExampleSignal_impl, FALSE);
+
+	return pserver;
+}
+
+/**
+ * destructor for any user allocated memory.
+ */
+int destroy_signals_server_implx(void* data)
+{
+	return 0;
+}
+
+/***
+ * server implementation
+ */
+
+#define MAX_CLIENT_NAME_LENGTH 25
+static etch_string* get_free_client_name_impl(void* thisx) {
+	static int client_count = 0;
+	
+	char client_name[MAX_CLIENT_NAME_LENGTH];
+	wchar_t *client_nameW;
+	etch_string *result;
+
+	snprintf(client_name, MAX_CLIENT_NAME_LENGTH, "client%d", client_count++);
+	printf("Allocated client name: %s\n", client_name);
+
+	etch_encoding_transcode_to_wchar(&client_nameW, client_name, ETCH_ENCODING_DEFAULT, (unsigned int)strlen(client_name), NULL);
+	result = new_stringw(client_nameW);
+	etch_free(client_nameW);
+
+	return result;
+}
+
+static apr_pool_t *memory_pool = NULL;
+static apr_thread_t *notification_thread = NULL;
+
+static void* APR_THREAD_FUNC notify_subscribers(apr_thread_t *thd, void *thisx)
+{
+	static int notify_count = 0;
+	signals_server_impl* server = (signals_server_impl*)thisx;
+
+	for (;; notify_count++) {
+		int subscribers_count = etchmap_count(server->client->Example_subscribers);
+
+		if (subscribers_count < 1) {
+			printf("No subscribers, stopping notification thread\n");
+			notification_thread = NULL;
+			apr_thread_exit(thd, APR_SUCCESS);
+		}
+
+		printf("Sending event to %d subscribers (%d)\n", subscribers_count, notify_count);
+		server->client->example_signal(server->client, new_int32(notify_count));
+
+		apr_sleep(1000000);
+	}
+
+	return NULL;
+}
+
+static void* _SubscribeExampleSignal_impl(void* thisx, etch_who* subscriber)
+{
+	signals_server_impl* server = (signals_server_impl*)thisx;
+	void* result;
+
+	printf("Subscribing new client\n");
+	result = signals_ex_def__SubscribeExampleSignal(thisx, subscriber);
+	if (!result) {
+		printf("succeeded\n");
+
+		if (!memory_pool)
+			apr_pool_create(&memory_pool, NULL);
+
+		if (!notification_thread && memory_pool) {
+			apr_threadattr_t *thd_attr;
+
+			apr_threadattr_create(&thd_attr, memory_pool);
+			if (apr_thread_create(&notification_thread, thd_attr, notify_subscribers, thisx, memory_pool) != APR_SUCCESS)
+				printf("Unable to create notification thread!\n");
+			printf("Notification thread started\n");
+		}
+	} else {
+		printf("failed\n");
+	}
+
+	return result;
+}
+
+static void* _UnsubscribeExampleSignal_impl(void* thisx, etch_who* subscriber)
+{
+	signals_server_impl* server = (signals_server_impl*)thisx;
+	void* result;
+
+	printf("Unsubscribing one client\n");
+	result = signals_ex_def__UnsubscribeExampleSignal(thisx, subscriber);
+	if (!result)
+		printf("succeeded\n");
+	else
+		printf("failed\n");
+
+	return result;
+}
+

Added: incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_server_impl.h
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_server_impl.h?rev=1149255&view=auto
==============================================================================
--- incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_server_impl.h (added)
+++ incubator/etch/branches/singlestack/examples/signals/src/main/c/signals_server_impl.h Thu Jul 21 16:16:49 2011
@@ -0,0 +1,69 @@
+/*
+ *
+ * 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.
+ *
+ */
+
+
+#ifndef SIGNALS_SERVER_IMPL_H
+#define SIGNALS_SERVER_IMPL_H
+
+#include "signals_server.h"
+#include "etch_transport.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern unsigned short CLASSID_SIGNALS_SERVER_IMPL;
+
+//typedef struct signals_remote_client signals_remote_client;
+
+/**
+ * signals_server_impl
+ */
+typedef struct signals_server_impl
+{
+    etch_object object;  
+
+    i_signals_server* signals_server_base; /* owned */
+    i_signals* isignals; /* not owned */
+    struct signals_remote_client* client; /* not owned */
+
+    int (*destroyex) (void*);  /* user memory destructor */
+
+    /* - - - - - - - - - - - -
+     * objsession
+     * - - - - - - - - - - - -
+     */
+    i_objsession* iobjsession;  /* owned by base */
+    /* note that iobjsession->thisx is set to this signals_server_impl* */
+    etch_session_control _session_control;
+    etch_session_notify  _session_notify;
+    etch_session_query   _session_query;
+
+} signals_server_impl;
+
+/* constructor */
+signals_server_impl* new_signals_server_impl (struct signals_remote_client*);
+
+#ifdef __cplusplus
+} //extern "C"
+#endif
+
+#endif /* SIGNALS_SERVER_IMPL_H */

Added: incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsClientProj/Properties/AssemblyInfo.cs
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsClientProj/Properties/AssemblyInfo.cs?rev=1149255&view=auto
==============================================================================
--- incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsClientProj/Properties/AssemblyInfo.cs (added)
+++ incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsClientProj/Properties/AssemblyInfo.cs Thu Jul 21 16:16:49 2011
@@ -0,0 +1,48 @@
+// 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.                                           *
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Signals Client")]
+[assembly: AssemblyDescription("Signals Client Executable")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Apache Software Foundation")]
+[assembly: AssemblyProduct("Apache Etch (incubating)")]
+[assembly: AssemblyCopyright("Copyright ? Apache Software Foundation 2011")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("899b573b-6bd5-4364-a61c-451ad3f9d3c8")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+[assembly: AssemblyVersion("0.0.0.1")]
+[assembly: AssemblyFileVersion("0.0.0.1")]

Added: incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsClientProj/SignalsClientProj.csproj
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsClientProj/SignalsClientProj.csproj?rev=1149255&view=auto
==============================================================================
--- incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsClientProj/SignalsClientProj.csproj (added)
+++ incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsClientProj/SignalsClientProj.csproj Thu Jul 21 16:16:49 2011
@@ -0,0 +1,114 @@
+<?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 DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{93439201-A146-4B61-AA17-7807F485D3EA}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>org.apache.etch.examples.signals</RootNamespace>
+    <AssemblyName>SignalsClient</AssemblyName>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\BaseSignalsClient.cs">
+      <Link>generated-sources\BaseSignalsClient.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\BaseSignalsServer.cs">
+      <Link>generated-sources\BaseSignalsServer.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\Signals.cs">
+      <Link>generated-sources\Signals.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\SignalsClient.cs">
+      <Link>generated-sources\SignalsClient.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\SignalsHelper.cs">
+      <Link>generated-sources\SignalsHelper.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\SignalsServer.cs">
+      <Link>generated-sources\SignalsServer.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\RemoteSignals.cs">
+      <Link>generated-sources\RemoteSignals.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\RemoteSignalsClient.cs">
+      <Link>generated-sources\RemoteSignalsClient.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\RemoteSignalsServer.cs">
+      <Link>generated-sources\RemoteSignalsServer.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\StubSignals.cs">
+      <Link>generated-sources\StubSignals.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\StubSignalsClient.cs">
+      <Link>generated-sources\StubSignalsClient.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\StubSignalsServer.cs">
+      <Link>generated-sources\StubSignalsServer.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\ValueFactorySignals.cs">
+      <Link>generated-sources\ValueFactorySignals.cs</Link>
+    </Compile>
+    <Compile Include="..\org.apache.etch.examples.signals\ImplSignalsClient.cs">
+      <Link>ImplSignalsClient.cs</Link>
+    </Compile>
+    <Compile Include="..\org.apache.etch.examples.signals\MainSignalsClient.cs">
+      <Link>MainSignalsClient.cs</Link>
+    </Compile>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\..\..\..\binding-csharp\runtime\src\main\csharp\EtchProj.csproj">
+      <Project>{0E518F2A-3016-4C2F-A21B-9BD52B2DC846}</Project>
+      <Name>EtchProj</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file

Added: incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsListenerProj/Properties/AssemblyInfo.cs
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsListenerProj/Properties/AssemblyInfo.cs?rev=1149255&view=auto
==============================================================================
--- incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsListenerProj/Properties/AssemblyInfo.cs (added)
+++ incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsListenerProj/Properties/AssemblyInfo.cs Thu Jul 21 16:16:49 2011
@@ -0,0 +1,48 @@
+// 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.                                           *
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following 
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("Signals Listener")]
+[assembly: AssemblyDescription("Signals Listener Executable")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Apache Software Foundation")]
+[assembly: AssemblyProduct("Apache Etch (incubating)")]
+[assembly: AssemblyCopyright("Copyright ? Apache Software Foundation 2009")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible 
+// to COM components.  If you need to access a type in this assembly from 
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("793348DC-FF01-4A01-88CB-4BB6BA65CBC9")]
+
+// Version information for an assembly consists of the following four values:
+//
+//      Major Version
+//      Minor Version 
+//      Build Number
+//      Revision
+//
+[assembly: AssemblyVersion("0.0.0.1")]
+[assembly: AssemblyFileVersion("0.0.0.1")]

Added: incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsListenerProj/SignalsListenerProj.csproj
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsListenerProj/SignalsListenerProj.csproj?rev=1149255&view=auto
==============================================================================
--- incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsListenerProj/SignalsListenerProj.csproj (added)
+++ incubator/etch/branches/singlestack/examples/signals/src/main/csharp/SignalsListenerProj/SignalsListenerProj.csproj Thu Jul 21 16:16:49 2011
@@ -0,0 +1,114 @@
+<?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 DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
+  <PropertyGroup>
+    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+    <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+    <ProductVersion>8.0.50727</ProductVersion>
+    <SchemaVersion>2.0</SchemaVersion>
+    <ProjectGuid>{793348DC-FF01-4A01-88CB-4BB6BA65CBC9}</ProjectGuid>
+    <OutputType>Exe</OutputType>
+    <AppDesignerFolder>Properties</AppDesignerFolder>
+    <RootNamespace>etch.examples.signals</RootNamespace>
+    <AssemblyName>SignalsListener</AssemblyName>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+    <DebugSymbols>true</DebugSymbols>
+    <DebugType>full</DebugType>
+    <Optimize>false</Optimize>
+    <OutputPath>bin\Debug\</OutputPath>
+    <DefineConstants>DEBUG;TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+    <DebugType>pdbonly</DebugType>
+    <Optimize>true</Optimize>
+    <OutputPath>bin\Release\</OutputPath>
+    <DefineConstants>TRACE</DefineConstants>
+    <ErrorReport>prompt</ErrorReport>
+    <WarningLevel>4</WarningLevel>
+  </PropertyGroup>
+  <ItemGroup>
+    <Reference Include="System" />
+  </ItemGroup>
+  <ItemGroup>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\BaseSignalsClient.cs">
+      <Link>generated-sources\BaseSignalsClient.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\BaseSignalsServer.cs">
+      <Link>generated-sources\BaseSignalsServer.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\Signals.cs">
+      <Link>generated-sources\Signals.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\SignalsClient.cs">
+      <Link>generated-sources\SignalsClient.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\SignalsHelper.cs">
+      <Link>generated-sources\SignalsHelper.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\SignalsServer.cs">
+      <Link>generated-sources\SignalsServer.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\RemoteSignals.cs">
+      <Link>generated-sources\RemoteSignals.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\RemoteSignalsClient.cs">
+      <Link>generated-sources\RemoteSignalsClient.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\RemoteSignalsServer.cs">
+      <Link>generated-sources\RemoteSignalsServer.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\StubSignals.cs">
+      <Link>generated-sources\StubSignals.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\StubSignalsClient.cs">
+      <Link>generated-sources\StubSignalsClient.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\StubSignalsServer.cs">
+      <Link>generated-sources\StubSignalsServer.cs</Link>
+    </Compile>
+    <Compile Include="..\..\..\..\target\generated-sources\main\etch\csharp\org.apache.etch.examples.signals\ValueFactorySignals.cs">
+      <Link>generated-sources\ValueFactorySignals.cs</Link>
+    </Compile>
+    <Compile Include="..\org.apache.etch.examples.signals\ImplSignalsServer.cs">
+      <Link>ImplSignalsServer.cs</Link>
+    </Compile>
+    <Compile Include="..\org.apache.etch.examples.signals\MainSignalsListener.cs">
+      <Link>MainSignalsListener.cs</Link>
+    </Compile>
+    <Compile Include="Properties\AssemblyInfo.cs" />
+  </ItemGroup>
+  <ItemGroup>
+    <ProjectReference Include="..\..\..\..\..\..\binding-csharp\runtime\src\main\csharp\EtchProj.csproj">
+      <Project>{0E518F2A-3016-4C2F-A21B-9BD52B2DC846}</Project>
+      <Name>EtchProj</Name>
+    </ProjectReference>
+  </ItemGroup>
+  <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+  <!-- To modify your build process, add your task inside one of the targets below and uncomment it. 
+       Other similar extension points exist, see Microsoft.Common.targets.
+  <Target Name="BeforeBuild">
+  </Target>
+  <Target Name="AfterBuild">
+  </Target>
+  -->
+</Project>
\ No newline at end of file

Added: incubator/etch/branches/singlestack/examples/signals/src/main/csharp/org.apache.etch.examples.signals/ImplSignalsClient.cs
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/examples/signals/src/main/csharp/org.apache.etch.examples.signals/ImplSignalsClient.cs?rev=1149255&view=auto
==============================================================================
--- incubator/etch/branches/singlestack/examples/signals/src/main/csharp/org.apache.etch.examples.signals/ImplSignalsClient.cs (added)
+++ incubator/etch/branches/singlestack/examples/signals/src/main/csharp/org.apache.etch.examples.signals/ImplSignalsClient.cs Thu Jul 21 16:16:49 2011
@@ -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.
+// 
+
+using System;
+
+using org.apache.etch.examples.signals.types.Signals;
+
+///<summary>Your custom implementation of BaseSignalsClient. Add methods here to provide
+///implementation of messages from the server. </summary>
+namespace org.apache.etch.examples.signals
+{
+	///<summary>Implementation for ImplSignalsClient</summary>
+	public class ImplSignalsClient : BaseSignalsClient
+	{
+		/// <summary>Constructs the ImplSignalsClient.</summary>
+		/// <param name="server">a connection to the server session. Use this to
+		/// send a message to the server.</param>
+		public ImplSignalsClient(RemoteSignalsServer server)
+		{
+			this.server = server;
+		}
+		
+		/// <summary>A connection to the server session. Use this to
+		/// send a message to the server.</summary>
+		private readonly RemoteSignalsServer server;
+
+		public override void example_signal( int? count )
+		{
+			Console.WriteLine( MainSignalsClient.ClientName + ": example signal, count = " + count );
+		}
+	}
+}
\ No newline at end of file

Added: incubator/etch/branches/singlestack/examples/signals/src/main/csharp/org.apache.etch.examples.signals/ImplSignalsServer.cs
URL: http://svn.apache.org/viewvc/incubator/etch/branches/singlestack/examples/signals/src/main/csharp/org.apache.etch.examples.signals/ImplSignalsServer.cs?rev=1149255&view=auto
==============================================================================
--- incubator/etch/branches/singlestack/examples/signals/src/main/csharp/org.apache.etch.examples.signals/ImplSignalsServer.cs (added)
+++ incubator/etch/branches/singlestack/examples/signals/src/main/csharp/org.apache.etch.examples.signals/ImplSignalsServer.cs Thu Jul 21 16:16:49 2011
@@ -0,0 +1,113 @@
+// 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.
+//
+
+using System;
+
+using org.apache.etch.examples.signals.types.Signals;
+using Org.Apache.Etch.Bindings.Csharp.Util;
+using System.Timers;
+
+///<summary>Your custom implementation of BaseSignalsServer. Add methods here to provide
+///implementation of messages from the client. </summary>
+namespace org.apache.etch.examples.signals
+{
+  ///<summary>Implementation for ImplSignalsServer</summary>
+  public class ImplSignalsServer : BaseSignalsServer
+  {
+    private static int clientCount;
+
+    System.Timers.Timer signalTimer;
+    private int signalCount;
+
+    /// <summary>Constructs the ImplSignalsServer.</summary>
+    /// <param name="client">a connection to the client session. Use this to
+    /// send a message to the client.</param>
+    public ImplSignalsServer( RemoteSignalsClient client )
+      : base( client )
+    {
+    }
+
+    public override string get_free_client_name()
+    {
+      string clientName = "client" + clientCount;
+
+      clientCount++;
+
+      Console.WriteLine( "Allocated client name: " + clientName );
+      return clientName;
+    }
+
+    public override void _SubscribeExampleSignal( Who sender )
+    {
+      base._SubscribeExampleSignal( sender );
+      Console.WriteLine( "Subscribed " + sender );
+
+      if ( signalTimer == null )
+      {
+        Console.WriteLine( "Starting timer" );
+
+        signalTimer = new System.Timers.Timer();
+        signalTimer.Interval = 1000;
+        signalTimer.Elapsed += TimerElapsedHandler;
+        signalTimer.Enabled = true;
+      }
+    }
+
+    public override void _UnsubscribeExampleSignal( Who sender )
+    {
+      base._UnsubscribeExampleSignal( sender );
+      Console.WriteLine( "Unsubscribed " + sender );
+
+      if ( client.ExampleSubscribers.Length < 1 )
+      {
+        Console.WriteLine( "No subscribers, stopping timer" );
+
+        DisposeTimer();
+      }
+    }
+
+    public override void _SessionNotify( object eventObj )
+    {
+      if ( eventObj.Equals( SessionConsts.DOWN ) )
+      {
+        Console.WriteLine( "Session DOWN, stopping timer" );
+        DisposeTimer();
+      }
+    }
+
+    private void DisposeTimer()
+    {
+      if ( signalTimer != null )
+      {
+        signalTimer.Enabled = false;
+        signalTimer.Dispose();
+        signalTimer = null;
+      }
+    }
+
+    private void TimerElapsedHandler( object sender, ElapsedEventArgs e )
+    {
+      if ( signalTimer != null )
+      {
+        signalCount++;
+        Console.WriteLine( "Sending event to " + client.ExampleSubscribers.Length + " subscribers (" + signalCount + ")" );
+        client.example_signal( signalCount );
+      }
+    }
+  }
+}
\ No newline at end of file