incubator-etch-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dix...@apache.org
Subject svn commit: r752721 [1/2] - in /incubator/etch/trunk/binding-python/compiler/src/main: java/org/apache/etch/bindings/python/compiler/ resources/org/apache/etch/bindings/python/compiler/
Date Thu, 12 Mar 2009 00:27:18 GMT
Author: dixson
Date: Thu Mar 12 00:27:18 2009
New Revision: 752721

URL: http://svn.apache.org/viewvc?rev=752721&view=rev
Log:
updating python binding compiler

Modified:
    incubator/etch/trunk/binding-python/compiler/src/main/java/org/apache/etch/bindings/python/compiler/Compiler.java
    incubator/etch/trunk/binding-python/compiler/src/main/java/org/apache/etch/bindings/python/compiler/CompilerVersion.java.tmpl
    incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/base.vm
    incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/helper.vm
    incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/impl.vm
    incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/intf.vm
    incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/main.vm
    incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/readme.vm
    incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/remote.vm
    incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/stub.vm
    incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/vf.vm

Modified: incubator/etch/trunk/binding-python/compiler/src/main/java/org/apache/etch/bindings/python/compiler/Compiler.java
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/compiler/src/main/java/org/apache/etch/bindings/python/compiler/Compiler.java?rev=752721&r1=752720&r2=752721&view=diff
==============================================================================
--- incubator/etch/trunk/binding-python/compiler/src/main/java/org/apache/etch/bindings/python/compiler/Compiler.java (original)
+++ incubator/etch/trunk/binding-python/compiler/src/main/java/org/apache/etch/bindings/python/compiler/Compiler.java Thu Mar 12 00:27:18 2009
@@ -1,21 +1,5 @@
-/* $Id: Compiler.java 1 2008-07-29 06:31:55Z jadixson $
- *
- * Copyright 2007-2008 Cisco Systems Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy
- * of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
+package org.apache.etch.bindings.python.compiler;
 
-package etch.bindings.csharp.compiler;
 
 import java.io.File;
 import java.io.IOException;
@@ -36,34 +20,34 @@
 import org.apache.velocity.runtime.RuntimeServices;
 import org.apache.velocity.runtime.log.LogChute;
 
-import etch.compiler.Backend;
-import etch.compiler.CmdLineOptions;
-import etch.compiler.EtchGrammarConstants;
-import etch.compiler.LogHandler;
-import etch.compiler.ParseException;
-import etch.compiler.Token;
-import etch.compiler.Version;
-import etch.compiler.ast.Builtin;
-import etch.compiler.ast.Except;
-import etch.compiler.ast.Item;
-import etch.compiler.ast.Message;
-import etch.compiler.ast.MessageDirection;
-import etch.compiler.ast.Module;
-import etch.compiler.ast.MsgDirHelper;
-import etch.compiler.ast.Name;
-import etch.compiler.ast.Named;
-import etch.compiler.ast.ParamList;
-import etch.compiler.ast.Parameter;
-import etch.compiler.ast.ReservedWordChecker;
-import etch.compiler.ast.Service;
-import etch.compiler.ast.Struct;
-import etch.compiler.ast.Thrown;
-import etch.compiler.ast.TypeRef;
-import etch.compiler.opt.ToString;
-import etch.compiler.opt.ToString.FieldItem;
-import etch.compiler.opt.ToString.FmtItem;
-import etch.compiler.opt.ToString.StringItem;
-import etch.util.Assertion;
+import org.apache.etch.compiler.Backend;
+import org.apache.etch.compiler.CmdLineOptions;
+import org.apache.etch.compiler.EtchGrammarConstants;
+import org.apache.etch.compiler.LogHandler;
+import org.apache.etch.compiler.ParseException;
+import org.apache.etch.compiler.Token;
+import org.apache.etch.compiler.Version;
+import org.apache.etch.compiler.ast.Builtin;
+import org.apache.etch.compiler.ast.Except;
+import org.apache.etch.compiler.ast.Item;
+import org.apache.etch.compiler.ast.Message;
+import org.apache.etch.compiler.ast.MessageDirection;
+import org.apache.etch.compiler.ast.Module;
+import org.apache.etch.compiler.ast.MsgDirHelper;
+import org.apache.etch.compiler.ast.Name;
+import org.apache.etch.compiler.ast.Named;
+import org.apache.etch.compiler.ast.ParamList;
+import org.apache.etch.compiler.ast.Parameter;
+import org.apache.etch.compiler.ast.ReservedWordChecker;
+import org.apache.etch.compiler.ast.Service;
+import org.apache.etch.compiler.ast.Struct;
+import org.apache.etch.compiler.ast.Thrown;
+import org.apache.etch.compiler.ast.TypeRef;
+import org.apache.etch.compiler.opt.ToString;
+import org.apache.etch.compiler.opt.ToString.FieldItem;
+import org.apache.etch.compiler.opt.ToString.FmtItem;
+import org.apache.etch.compiler.opt.ToString.StringItem;
+import org.apache.etch.util.Assertion;
 
 /**
  * Compiler is a helper class not only for Backend, but also for the templates.
@@ -71,9 +55,9 @@
  */
 public class Compiler extends Backend
 {
-	private final static String tmplPath1 = "etch/bindings/python/compiler/";
+	private final static String tmplPath1 = "org/apache/etch/bindings/python/compiler/";
 
-	private final static String tmplPath2 = "resources/etch/bindings/python/compiler/";
+	private final static String tmplPath2 = "resources/org/apache/etch/bindings/python/compiler/";
 
 	private final static String fnSuffix = ".py";
 
@@ -940,14 +924,13 @@
 		}
 
 		StringBuffer sb = new StringBuffer();
-		sb.append( "String.Format( " );
 		sb.append( "\"" );
 		int j = 0;
 		for (FmtItem i : list)
 		{
 			if (i instanceof FieldItem)
 			{
-				sb.append( "{" + j + "}" );
+				sb.append( "%s" );
 				j++;
 			}
 			else
@@ -957,13 +940,14 @@
 		}
 		j = 0;
 
-		sb.append( "\"" );
+		sb.append( "\" % ( " );
 		for (FmtItem i : list)
 		{
 			if (i instanceof FieldItem)
 			{
-				sb.append( ", " );
+				sb.append( ", repr( " );
 				sb.append( ((FieldItem) i).value() );
+                sb.append( " )" );
 			}
 		}
 		sb.append( " )" );
@@ -1113,7 +1097,7 @@
 		if (named instanceof Item)
 			return "Validator_boolean.Get( 0 )";
 
-		return "null";
+		return "None";
 	}
 
 
@@ -1145,9 +1129,9 @@
 				list.remove( i );
 				list.add(i, new FieldItem(  "base.GetMessage()" ) );
 			}
-			if (item.value().contains( "super.toString()" )) {
+			if (item.value().contains( "super.__repr__()" )) {
 				list.remove( i );
-				list.add(i, new FieldItem(  "base.ToString()" ) );
+				list.add(i, new FieldItem(  "base.__repr__()" ) );
 			}
 		}
 	}

Modified: incubator/etch/trunk/binding-python/compiler/src/main/java/org/apache/etch/bindings/python/compiler/CompilerVersion.java.tmpl
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/compiler/src/main/java/org/apache/etch/bindings/python/compiler/CompilerVersion.java.tmpl?rev=752721&r1=752720&r2=752721&view=diff
==============================================================================
--- incubator/etch/trunk/binding-python/compiler/src/main/java/org/apache/etch/bindings/python/compiler/CompilerVersion.java.tmpl (original)
+++ incubator/etch/trunk/binding-python/compiler/src/main/java/org/apache/etch/bindings/python/compiler/CompilerVersion.java.tmpl Thu Mar 12 00:27:18 2009
@@ -1,21 +1,4 @@
-/* $Id: CompilerVersion.java.tmpl 1 2008-07-29 06:31:55Z jadixson $
- *
- * Copyright 2007-2008 Cisco Systems Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License"); you may not
- * use this file except in compliance with the License. You may obtain a copy
- * of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * License for the specific language governing permissions and limitations
- * under the License.
- */
-
-package etch.bindings.csharp.compiler;
+package org.apache.etch.bindings.python.compiler;
 
 /**
  * The version info of this Etch backend (compiler).
@@ -26,5 +9,5 @@
 	// of VERSION below with whatever it wants the version string to actually be.
 	
 	/** The version of this Etch backend (compiler) */
-	public String VERSION = "python @EtchVersion@ (@EtchBuildTag@)";
+	public String VERSION = "python @EtchLongVersion@ (@EtchBuildTag@)";
 }

Modified: incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/base.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/base.vm?rev=752721&r1=752720&r2=752721&view=diff
==============================================================================
--- incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/base.vm (original)
+++ incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/base.vm Thu Mar 12 00:27:18 2009
@@ -11,260 +11,100 @@
 ## WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 ## License for the specific language governing permissions and limitations
 ## under the License.
-// This file automatically generated by:
-//   $version
-//   $now
-// This file is automatically created and should not be edited!
-// Re-implement these methods by overriding them in Impl$intf.name()$suffix
-// or by making appropriate assignments to the delegates.
+"""
+This file automatically generated by:
+   $version
+   $now
+This file is automatically created and should not be edited!
+Re-implement these methods by overriding them in Impl$intf.name()$suffix.
 #set($i = $intf.name())
-#set($vfname = "ValueFactory$i")
 #set($intfname = "$i$suffix")
 #set($clname = "Base$intfname")
 #if ($helper.isServer($mc))
 #set($peer = "client")
-#set($peerclass = "Remote${i}Client")
 #else
 #set($peer = "server")
-#set($peerclass = "Remote${i}Server")
 #end
 
-using System;
+module $intf.parent().name();
+"""
+
+from etch.bindings.java.support import ObjSession;
 
 #foreach( $n in $intf.iterator() )
 #if ($n.isExtern())
 #if ($n.hasImport( $helper ))
-using $n.getImport( $helper );
-#end
-#end
-#end
-using Etch.Support;
-
-/// <summary>
-/// Base Implementation of $intfname, with default method implementations
-/// which throw NotSupportedException. Either implement the delegates or extend
-/// this class to provide implementations of messages from the $peer 
-/// </summary>
-
-namespace $intf.parent().name()
-{
-
-	///<summary>Call to message translator for $intfname.</summary>
-	public class $clname : $intfname, ObjSession
-	{	
-#set( $delegateTypeHeader = "_delegate_type_" )
-#set( $delegateVarHeader = "_delegate_" )
-#set( $sep = "" )
-#foreach ($mthd in $intf.iterator())
-#if ($mthd.isMsgDir($mc) || $mthd.isMsgDirBoth())
-#if (!$mthd.isHidden())
-#if(!$methodList.contains("$delegateVarHeader$mthd.name().name()"))
-#set ( $addMethodListStatus = $methodList.add("$delegateVarHeader$mthd.name().name()") )
-		/// <summary>
-    	/// Delegate Definition; Please do not modify
-    	/// </summary>
-		public delegate $helper.getTypeName( $mthd.type() ) $delegateTypeHeader$mthd.name()	(
-#set( $sep = "" )
-#foreach( $param in $mthd.iterator() )
-									$sep$helper.getTypeName( $param.type() ) $param.name()
-#set( $sep = ", " )
-#end
-									);
-		/// <summary>
-    	/// Add your implementation method to this variable
-    	/// </summary>							
-		public $delegateTypeHeader$mthd.name()  $delegateVarHeader$mthd.name();
-
-#end
-#end
-#end	
-#end
-#foreach( $x in $intf.iterator() )
-#if( $x.isMixin() )
-
-#set( $m = $x.getModule() )
-#set( $z = $m.iterator().next() )
-
-#foreach( $n in $z.messages( true ) )
-#if($n.isMsgDir($mc) || $n.isMsgDirBoth() )
-#if(!$n.isHidden())
-#if(!$methodList.contains("$delegateVarHeader$n.name().name()"))
-#set ( $addMethodListStatus = $methodList.add("$delegateVarHeader$n.name().name()") )
-#if($n.isOneway())
-		/// <summary>
-    	/// Delegate Definition; Please do not modify
-    	/// </summary>
-		public delegate $helper.getTypeName( $n.type() ) $delegateTypeHeader$n.name()(
-#set( $sep = "" )
-#foreach( $p in $n.iterator() )
-			$sep$helper.getTypeName( $p.type() ) $p.name()
-#set( $sep = ", " )
-#end
-			);
-		
-		/// <summary>
-    	/// Add your implementation method to this variable
-    	/// </summary>							
-		public $delegateTypeHeader$n.name()  $delegateVarHeader$n.name();
-	
-#else
-		/// <summary>
-    	/// Delegate Definition; Please do not modify
-    	/// </summary>
-		public delegate $helper.getTypeName( $n.type() ) $delegateTypeHeader$n.name()(
-#set( $sep = "" )
-#foreach( $p in $n.iterator() )
-			$sep$helper.getTypeName( $p.type() ) $p.name()
-#set( $sep = ", " )
-#end
-		);
-	
-		/// <summary>
-    	/// Add your implementation method to this variable
-    	/// </summary>							
-		public $delegateTypeHeader$n.name()  $delegateVarHeader$n.name();
-	
-#end
-#end
-#end
-#end
+import $n.getImport( $helper );
 #end
 #end
 #end
 
-	
-		///<summary>Constructs the $clname.</summary>
-		public $clname() 
-		{
-		}
+class $clname($intfname, ObjSession):
+    """
+    Base implementation of $intfname, with default method implementations
+    which throw UnsupportedOperationException. Extend this class to provide
+    implementations of messages from the $peer.
+    
+    @see Impl$intfname
+    """
 
-		public virtual object _SessionQuery(Object query)
-		{
-			throw new NotSupportedException( "unknown query: " + query);
-		}
+	def _sessionQuery( query ):
+		raise UnsupportedOperationException, "unknown query: %s" % query
 
-		public virtual void _SessionControl(Object control, Object value)
-		{
-			throw new NotSupportedException( "unknown control: " + control);
-		}
-
-		public virtual void _SessionNotify( Object eventObj)
-		{
-			if (eventObj is Exception)
-				Console.WriteLine((Exception) eventObj);
-		}  
+	def _sessionControl( control, value ):
+		raise UnsupportedOperationException, "unknown control: %s" % control
 
+	def _sessionNotify( event ):
+		if instanceof(event,Exception):
+			event.printStackTrace()
 
 #foreach ($mthd in $intf.iterator())
 #if ($mthd.isMsgDir($mc) || $mthd.isMsgDirBoth())
 #if (!$mthd.isHidden())
 #if(!$methodList.contains($mthd.name().name()))
 #set ( $addMethodListStatus = $methodList.add($mthd.name().name()) )
-		public virtual $helper.getTypeName( $mthd.type() ) $mthd.name() (
+
+	def $mthd.name() (
 #set( $sep = "" )
 #foreach( $param in $mthd.iterator() )
-				$sep$helper.getTypeName( $param.type() ) $param.name()
+		$param.name()
 #set( $sep = ", " )
 #end
-		)
-		{
-		if ($delegateVarHeader$mthd.name() != null)
-		#if($helper.getTypeName( $mthd.type() ).equals("void"))
-				$delegateVarHeader$mthd.name()( 
-		#set( $sep = "" )
-			#foreach( $param in $mthd.iterator() )
-			$sep$param.name()
-		#set( $sep = "," )
-			#end
-			);
-		#else
-				return $delegateVarHeader$mthd.name()( 
-		#set( $sep = "" )
-			#foreach( $param in $mthd.iterator() )
-			$sep$param.name()
-		#set( $sep = "," )
-			#end
-			);
-		#end
-			else 
-				throw new NotSupportedException( "$mthd.name()" );
-		}
+	):
+		raise UnsupportedOperationException, "$mthd.name()"
 #end
 #end
 #end
 #end
 #foreach( $x in $intf.iterator() )
 #if( $x.isMixin() )
-
 #set( $m = $x.getModule() )
 #set( $z = $m.iterator().next() )
-
 #foreach( $n in $z.messages( true ) )
 #if($n.isMsgDir($mc) || $n.isMsgDirBoth() )
 #if(!$n.isHidden())
 #if(!$methodList.contains($n.name().name()))
 #set ( $addMethodListStatus = $methodList.add($n.name().name()) )
 #if($n.isOneway())
-		public virtual $helper.getTypeName( $n.type() ) $n.name()(
+
+	def $n.name() (
 #set( $sep = "" )
 #foreach( $p in $n.iterator() )
-			$sep$helper.getTypeName( $p.type() ) $p.name()
+		$p.name()
 #set( $sep = ", " )
 #end
-		)
-		{
-				if ($delegateVarHeader$n.name() != null)
-			#if($helper.getTypeName( $n.type() ).equals("void"))
-				$delegateVarHeader$n.name()( 
-		#set( $sep = "" )
-			#foreach( $p in $n.iterator() )
-			$sep$p.name()
-		#set( $sep = "," )
-			#end
-			);
-			#else
-				return $delegateVarHeader$n.name()( 
-		#set( $sep = "" )
-			#foreach( $p in $n.iterator() )
-			$sep$p.name()
-		#set( $sep = "," )
-			#end
-			);
-		#end
-			else 
-				throw new NotSupportedException( "$n.name()" );
-		
-	}
+	):
+		raise UnsupportedOperationException, "$n.name()"
 #else
-		public virtual $helper.getTypeName( $n.type() ) $n.name()(
+
+	def $n.name() (
 #set( $sep = "" )
 #foreach( $p in $n.iterator() )
-			$sep$helper.getTypeName( $p.type() ) $p.name()
+		$p.name()
 #set( $sep = ", " )
 #end
-		)
-		{
-			if ($delegateVarHeader$n.name() != null)
-		#if($helper.getTypeName( $n.type() ).equals("void"))
-		 	$delegateVarHeader$n.name()( 
-		#set( $sep = "" )
-			#foreach( $p in $n.iterator() )
-			$sep$p.name()
-		#set( $sep = "," )
-			#end
-			);
-		#else
-				return $delegateVarHeader$n.name()( 
-		#set( $sep = "" )
-			#foreach( $p in $n.iterator() )
-			$sep$p.name()
-		#set( $sep = "," )
-			#end
-			);
-		#end
-			else 
-				throw new NotSupportedException( "$n.name()" );
-		}
+	):
+		raise UnsupportedOperationException, "$n.name()"
 #end
 #end
 #end
@@ -272,5 +112,3 @@
 #end
 #end
 #end
-	}
-}
\ No newline at end of file

Modified: incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/helper.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/helper.vm?rev=752721&r1=752720&r2=752721&view=diff
==============================================================================
--- incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/helper.vm (original)
+++ incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/helper.vm Thu Mar 12 00:27:18 2009
@@ -1,149 +1,99 @@
-## Copyright 2007-2008 Cisco Systems Inc.
-##
-## Licensed under the Apache License, Version 2.0 (the "License"); you may not
-## use this file except in compliance with the License. You may obtain a copy
-## of the License at
-##
-##      http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-## WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-## License for the specific language governing permissions and limitations
-## under the License.
-// This file automatically generated by:
-//   $version
-//   $now
-// This file is automatically created and should not be edited!
-#set($i = $intf.name())
-
-using Etch.Msg;
-using Etch.Support;
-using Etch.Util;
-
-/// <summary>
-/// Transport helper for ${i}.
-/// </summary>
-namespace $intf.parent().name()
-{
-    public class ${i}Helper : TransportHelper
-    {
-#if ( $helper.isServer($mc) || $helper.isBoth($mc) )
-
-		/// <summary>Constructs a new server session listener per specifications
-		/// in uri and resources.</summary>
-		/// <param name="uri"> contains specifications for the server session
-		/// listener and for the server session transport stack.</param>
-		/// <param name="resources"> additional resources to aid in constructing
-		/// new server sessions.</param>
-		/// <param name="implFactory"> called upon accepting a new server session to
-		/// construct a new server implementation to handle messages
-		/// from the client during the session.</param>
-		/// <returns> an out-of-band source that may be used to control
-		/// the listener.</returns>
-
-		public static Transport<ServerFactory> NewListener( string uri,		
-			Resources resources, ${i}ServerFactory implFactory )
-		{
-			Resources res = InitResources( resources );
-			return TransportFactory.GetListener( uri, res,
-				new MyServerFactory( uri, res, implFactory ) );
-		}
-		
-		public class MyServerFactory : DefaultServerFactory
-		{
-			private readonly string _uri;
-			private readonly Resources _resources;
-			private readonly ${i}ServerFactory _implFactory;
-			
-			public MyServerFactory( string uri, Resources resources, ${i}ServerFactory implFactory )
-				: base(implFactory)
-			{
-				_uri = uri;
-				_resources = resources;
-				_implFactory = implFactory;
-			}
-		
-			public override void NewServer( DeliveryService d, ValueFactory vf )
-			{
-				Remote${i}Client client = new Remote${i}Client( d, vf );
-				${i}Server server = _implFactory.New${i}Server( client );
-				Pool qp = (Pool) _resources[ QUEUED_POOL ];
-				Pool fp = (Pool) _resources[ FREE_POOL ];
-				new Stub${i}Server( d, server, qp, fp );
-			}
-
-            public override ValueFactory NewValueFactory()
-            {
-                return new ValueFactory${i}(_uri);
-            }
-		}
-		
-		/// <summary>
-		/// Factory for a Listener to use to create new instances of ${i}Server.
-		/// </summary>
-		
-		public interface ${i}ServerFactory
-		{
-			/// <param name="client"> an Remote${i}Client instance for server implementation
-			/// to use to call back to the client.</param>
-			/// <returns> an instance of ${i}Server (e.g., Impl${i}Server) to
-			/// handle messages which arrive from the client.</returns>
-			
-			${i}Server New${i}Server( Remote${i}Client client );
-		}		
+## Copyright 2009 Apache Software Foundation
+"""
+This file automatically generated by:
+  $version
+  $now
+This file is automatically created and should not be edited!
+
+#set($i = $intf.name()) 
+module $intf.parent().name();
+"""
+
+from etch.binding.support import *
+#if($helper.isServer($mc) || $helper.isBoth($mc))
+from etch.binding.msg import ValueFactory
 #end
-#if ( $helper.isClient($mc) || $helper.isBoth($mc) )
+from etch.util.core.io import Transport
+from etch.util import Resources
 
-		/// <summary>Constructs a new client session per specifications in uri
-		/// and resources.</summary>
-		/// <param name="uri"> contains specifications for the client session
-		/// transport stack.</param>
-		/// <param name="resources"> additional resources to aid in constructing
-		/// new sessions.</param>
-		/// <param name="implFactory">factory used to construct a new instance implementing
-		/// ${i}Client. The new instance will receive and process messages from the
-		///	server session.</param>
-		/// <returns> new remote server instance initialized by uri
-		/// and resources which may be used to send messages to the
-		/// server session.</returns>
-		
-		public static Remote${i}Server NewServer( string uri,
-			Resources resources, ${i}ClientFactory implFactory )
-		{
-			resources = InitResources( resources );
-			ValueFactory${i} vf= new ValueFactory${i}(uri);
-			resources.Add( TransportConsts.VALUE_FACTORY, vf );
-			DeliveryService d = TransportFactory.GetTransport( uri, resources );
-			Remote${i}Server server = new Remote${i}Server( d, vf );
-			${i}Client client = implFactory.New${i}Client( server );			
-			 new Stub${i}Client( d,
-					client,
-					(Pool) resources[ QUEUED_POOL ],
-					(Pool) resources[ FREE_POOL ] );
-	
-			return server;
-		}
-		
-		///<summary>
-		///Factory used by
-		///{@link ${i}Helper#new${i}Server(String, Resources, ${i}ClientFactory)}
-		///to construct a new instance implementing {@link ${i}Client}. The new
-		///instance will receive and process messages from the server session.
-		///</summary>
-		
-		public interface ${i}ClientFactory
-		{
-			///<summary>
-			///Constructs a new instance implementing ${i}Client. The new
-			///instance will receive and process messages from the server session.</summary>
-		 	///<param name=server> an instance of Remote${i}Server which may be used to
-			/// send messages to the server session. </param>
-			///<returns> new instance implementing ${i}Client (typically
-			///Impl${i}Client). </returns>
-			
-			${i}Client New${i}Client( Remote${i}Server server );			
-		}
+class ${i}ServerFactory(DefaultServerFactory):
+    
+    def newServer(self, d, vf):
+        # TODO: resolve 'res', 'implFactory'
+        client = Remote${i}Client(d,vf)
+        server = self.implFactory.new${i}Server(client)
+        # TODO: resolve QUEUED_POOL, FREE_POOL
+        qp = self.res[ QUEUED_POOL ]
+        fp = self.res[ FREE_POOL ]
+        return Stub${i}Server(d, server, qp, fp)
+
+    def newValueFactory(self):
+        return ValueFactory${i}(self.uri)
+
+class ${i}Helper(TransportHelper):
+    """
+    Transport helper for ${i}. All Methods ar static.
+    """
+
+#if($helper.isServer($mc) || $helper.isBoth($mc))
+
+    @staticmethod
+    def newListener(uri, resources, implFactory):
+        """
+	    Constructs a new server session listener per specifications in uri and
+	    resources. This listener will accept requests from clients for new server
+	    sessions.
+	    
+	    @param uri contains specifications for the server session listener and
+	    for the server session transport stack.
+	    
+	    @param resources additional resources to aid in constructing new server
+	    sessions.
+	    
+	    @param implFactory factory used to construct a new instance implementing
+	    ${i}Server. The new instance will receive and process messages from
+	    the client session.
+	    
+	    @return a server session listener.
+	    
+	    @throws Exception
+        """
+		res = ${i}Helper.initResources( resources )
+
+		return TransportFactory.getListener( uri, res, ${i}ServerFactory(implFactory))
+#end
+#if($helper.isClient($mc) || $helper.isBoth($mc))
+
+	@staticmethod
+    def newServer(uri, resources, implFactory):
+        """
+	    Constructs a new client session per specifications in uri and resources.
+	    
+	    @param uri contains specifications for the client session transport
+	    stack.
+	     
+	    @param resources additional resources to aid in constructing new client
+	    sessions.
+	    
+	    @param implFactory factory used to construct a new instance implementing
+	    ${i}Client. The new instance will receive and process messages from
+	    the server session.
+	    
+	    @return an instance of Remote${i}Server initialized by uri and
+	    resources which may be used to send messages to the server session.
+	    
+	    @throws Exception
+	    """
+		res = initResources( resources );
+		vf  = ValueFactory${i}( uri );
+		res.put( Transport.VALUE_FACTORY, vf );
+
+		d = TransportFactory.getTransport( uri, res );
+		server = Remote${i}Server( d, vf );
+		client = implFactory.new${i}Client( server );
+		qp = res.get( QUEUED_POOL );
+		fp = res.get( FREE_POOL );
+		# new Stub${i}Client( d, client, qp, fp );
+
+		return server
 #end
-	}
-}

Modified: incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/impl.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/impl.vm?rev=752721&r1=752720&r2=752721&view=diff
==============================================================================
--- incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/impl.vm (original)
+++ incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/impl.vm Thu Mar 12 00:27:18 2009
@@ -1,27 +1,16 @@
+## Copyright 2009 Apache Software Foundation
 ## Copyright 2007-2008 Cisco Systems Inc.
-##
-## Licensed under the Apache License, Version 2.0 (the "License"); you may not
-## use this file except in compliance with the License. You may obtain a copy
-## of the License at
-##
-##      http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-## WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-## License for the specific language governing permissions and limitations
-## under the License.
-// This file automatically generated by:
-//   $version
-//   $now
-// This file is automatically created for your convenience and will not be
-// overwritten once it exists! Please edit this file as necessary to implement
-// your service logic.
+"""
+This file automatically generated by:
+   $version
+   $now
+This file is automatically created for your convenience and will not be
+overwritten once it exists! Please edit this file as necessary to implement
+your service logic.
 #set($i = $intf.name())
-#set($vfname = "ValueFactory$i")
 #set($intfname = "$i$suffix")
+#set($baseclname = "Base$intfname")
 #set($clname = "Impl$intfname")
-#set($baseclname = "Base$i$suffix")
 #if ($helper.isServer($mc))
 #set($peer = "client")
 #set($peerclass = "Remote${i}Client")
@@ -30,46 +19,23 @@
 #set($peerclass = "Remote${i}Server")
 #end
 
-using System;
+module $intf.parent().name();
+"""
 
-#foreach( $n in $intf.iterator() )
-#if ($n.isExtern())
-#if ($n.hasImport( $helper ))
-using $n.getImport( $helper );
-#end
-#end
-#end
-
-#foreach( $x in $intf.iterator() )
-#if( $x.isMixin() )
-#set( $m = $x.getModule() )
-#set( $z = $m.iterator().next() )
-using ${m.name()}.types.$z.name();
-#end
-#end
-
-using ${intf.parent().name()}.types.${i};
-
-///<summary>Your custom implementation of $baseclname. Add methods here to provide
-///implementation of messages from the $peer. </summary>
-namespace $intf.parent().name()
-{
-	///<summary>Implementation for $clname</summary>
-	public class $clname : $baseclname
-	{
-		/// <summary>Constructs the $clname.</summary>
- 		/// <param name="$peer">a connection to the $peer session. Use this to
- 		/// send a message to the $peer.</param>
-		public $clname($peerclass $peer)
-		{
-			this.$peer = $peer;
-		}
-		
-		/// <summary>A connection to the $peer session. Use this to
- 		/// send a message to the $peer.</summary>
-		private readonly $peerclass $peer;
+class $clname ( $baseclname ):
+    """
+    Your custom implementation of $baseclname. Add methods here to provide
+    implementations of messages from the $peer.
+    """
+	
+    def __init__ ( self, $peer ):
+        """
+	    Constructs the $clname.
+	    
+	    @param $peer a connection to the $peer session. Use this to send a
+	    message to the $peer.
+        """
+		self.$peer = $peer
 	
-		// TODO: Implement delegates or provide implementation of $intfname
-		// messages from the $peer	
-	}
-}
\ No newline at end of file
+	# TODO insert methods here to provide implementations of $intfname
+	# messages from the $peer.

Modified: incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/intf.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/intf.vm?rev=752721&r1=752720&r2=752721&view=diff
==============================================================================
--- incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/intf.vm (original)
+++ incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/intf.vm Thu Mar 12 00:27:18 2009
@@ -1,297 +1,241 @@
+## Copyright 2009 Apache Software Foundation
 ## Copyright 2007-2008 Cisco Systems Inc.
-##
-## Licensed under the Apache License, Version 2.0 (the "License"); you may not
-## use this file except in compliance with the License. You may obtain a copy
-## of the License at
-##
-##      http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-## WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-## License for the specific language governing permissions and limitations
-## under the License.
-// This file automatically generated by:
-//   $version
-//   $now
-// This file is automatically created and should not be edited!
+"""
+This file automatically generated by:
+   $version
+   $now
+ This file is automatically created and should not be edited!
 
-using System;
-
-namespace $intf.parent().name()
-{
+module $intf.parent().name();
+"""
 
 #foreach( $n in $intf.iterator() )
 #if ($n.isExtern())
 #if ($n.hasImport( $helper ))
-	using $n.getImport( $helper );
+# ??import $n.getImport( $helper );
 #end
 #end
 #end
-#if( $intf.hasDescr() )
-	///<summary>
+
+#if ($intf.hasDescr())
+"""
 #foreach( $s in $intf.descr() )
-	///$s
+ $s
 #end
-	///</summary>
+"""
 #end
-#set($sep = ":")
+#set ($sep = "extends")
 #if ($hasBaseClass)
-	public interface $intf.name()$suffix $sep $intf.name()
+class $intf.name()$suffix($intf.name()) :
 #set ($sep = ",")
 #else
-	public interface $intf.name()$suffix
+class $intf.name()$suffix :
 #end
 #foreach( $n in $intf.iterator() )
 #if ($n.isMixin())
-	$sep $n.fqname()$suffix
-#set($sep = ",")
+	# $sep $n.fqname()$suffix
+#set ($sep = ",")
 #end
 #end
-	{
+#if (!$intf.hasMessageDirection($mc))
+	# no $mc direction items defined.
+#end
+
+
 #foreach( $n in $intf.iterator() )
 #if ($n.isMessage())
 #if ($n.isMsgDir($mc))
-#if (!$n.isHidden())
-#if ($n.hasDescr())
-		///<summary>
-#foreach($s in $n.descr())
-		///$s
+	def $n.name() (self, 
+#set( $sep = "" )
+#foreach( $p in $n.iterator() )
+		$sep$helper.getTypeName( $p.type() ) $p.name()
+#set( $sep = ", " )
 #end
-		///</summary>
+	    ):
+#if (!$n.isHidden())
+	    """
+#foreach( $s in $n.descr() )
+	    $s
 #end
 #foreach( $p in $n.iterator() )
 #set($first = true)
-#set ($count = 0)
 #foreach( $s in $p.descr() )
 #if ($first)
-#set($count = $count + 1)
 #set($first = false)
-		///<param name="$p.name()">$s
+	    @param $p.name() $s
 #else
-		///$s
+	    $s
 #end
 #end
-#if ($count > 0)
-		///</param>
-#end		
 #end
 #if ($n.hasReturn())
 #set($first = true)
 #foreach( $s in $n.returnDescr() )
 #if ($first)
 #set($first = false)
-		///<returns>$s
+	    @return $s
 #else
-		///$s
+	    $s
 #end
 #end
-		///</returns>
 #end
-#if ($n.hasThrown())
-#if ($n.hasDescr())
 #foreach($t in $n.thrown().iterator())
-		///<Exception cref="$t.name().name()"> throws $t.name().name()</Exception>
+#set($first = true)
+#foreach( $s in $t.descr() )
+#if ($first)
+#set($first = false)
+	    @throws $t.name() $s
+#else
+	    $s
 #end
 #end
 #end
-		$helper.getTypeName( $n.type() ) $n.name()(
-#set( $sep = "" )
-#foreach( $p in $n.iterator() )
-			$sep$helper.getTypeName( $p.type() ) $p.name()
-#set( $sep = ", " )
-#end
-			);
+	    """
+        raise AbstractMethodException
 #end
 #end
 #elseif ($n.isConstant())
-#elseif ($n.isEnumx())
-#elseif ($n.isStruct() || $n.isExcept())
-#elseif ($n.isExtern())
-## ignore extern
-#elseif ($n.isMixin())
-## ignore mixin
-#else
-
-#end
-#end
-	}
 #if (!$hasBaseClass)
-	namespace types 
-	{
-		namespace $intf.name()$suffix
-		{
-			public static class Consts$intf.name()$suffix 
-			{
-#foreach( $n in $intf.iterator() )
-#if ($n.isConstant())
+	$n.name() = $helper.getTypeValue( $n.type(), $n.value() )
 #if ($n.hasDescr())
-				///<summary>
+    """
 #foreach( $s in $n.descr() )
-				///$s
-#end
-				///</summary>
-#end
-				public static $helper.getNativeTypeName( $n.type() ) $n.name() = $helper.getTypeValue( $n.type(), $n.value() );
+	$s
 #end
+    """
+#end    
 #end
-			}
-#foreach( $n in $intf.iterator() )
-#if ($n.isEnumx())
+
+#elseif ($n.isEnumx())
 #if (!$hasBaseClass)
 #if ($n.hasDescr())
-			///<summary>
 #foreach( $s in $n.descr() )
-			///$s
+	# $s
 #end
-			///</summary>
 #end
-			public enum $n.name()
-			{
-#set( $sep = "" )						
+	$n.name() = {
+#set( $sep = "" )
 #foreach( $i in $n.iterator() )
-#if ($i.hasDescr())
-				///<summary>
 #foreach( $s in $i.descr() )
-				///$s
-#end
-				///</summary>
+		# $s
 #end
-				$sep$i.name()
+		$sep$i.name() : r'$i.name()'
 #set( $sep = ", " )
 #end
-			}	
+	}
 #end
+
+#elseif ($n.isExtern())
+## ignore extern
+#elseif ($n.isMixin())
+## ignore mixin
 #elseif ($n.isStruct() || $n.isExcept())
 #if (!$hasBaseClass)
-#if ($n.hasDescr())
-			///<summary>
-#foreach( $s in $n.descr() )
-			///$s
-#end
-			///</summary>
-#end
+#set( $sep = "_"  )    
+class $intf.name()$sep$n.name(
+#set( $sep = ", " )
 #if( $n.hasExtends() )
-			public class $n.name()	: $n.getExtends().name()
+    $n.getExtends().name()
 #else
 #if( $n.isExcept() )
 #if( $n.isUnchecked() )
-			public class $n.name() : Exception
-#else
-			public class $n.name() : Exception
-#end
+	$sep RuntimeException
 #else
-			[Serializable]
-			public class $n.name()
+	$sep Exception
 #end
 #end
-			{
-			
-				/// <summary>Constructs the $n.name(). Don't init anything.</summary>
-				public $n.name()()
-				{
-					// don't init anything.
-				}
-
-#if ($n.hasAnyParameters())
-				///<summary>Constructs the $n.name().</summary>
-#foreach( $i in $n.getAllParameters() )
-#if ($i.hasDescr())
-				///<param name="$i.name()">
-#foreach( $s in $i.descr() )
-				///$s
 #end
-				///</param>
+	):
+#if ($n.hasDescr())
+	"""
+#foreach( $s in $n.descr() )
+	$s
 #end
+	"""
 #end
-				public $n.name()
-				(
+
+#if (!$n.hasAnyParameters())
+    def __init__(self):
+        """
+		Constructs the $n.name(). Don't init any fields.
+		"""
+        pass
+
+#else ($n.hasAnyParameters())
+	def __init__(self, 
 #set( $sep = "" )
 #foreach( $i in $n.getAllParameters() )
-					$sep$helper.getTypeName( $i.type() ) $i.name()
+			$sep$i.name() = None
 #set( $sep = ", " )
 #end
-				)		
+		):
+        """
+		Constructs the $n.name().
+#foreach( $i in $n.getAllParameters() )
+#set( $sep = "@param " )
+#foreach( $s in $i.descr() )
+		$sep$i.name() $s
+#set( $sep = "" )
+#end
+#end
+		"""
 #if( $n.hasExtends() )
-			 	: base(
+		# TODO: fix SUPER
+        super(
 #set( $sep = "" )
 #foreach( $i in $n.getExtends().getAllParameters() )
-				$sep$i.name()
+		    $sep$i.name()
 #set( $sep = ", " )
 #end
-				)
-				{
-#else
-				{
+		)
 #end
 #foreach( $i in $n.getParameters() )
-					this.$i.name() = $i.name();
+			self.$i.name() = $i.name()
 #end
-				}
 #end
-
 #if( $n.isExcept() )
-#if ($n.hasExtends())
-				public new String GetMessage()
-#else
-				public String GetMessage()
-#end
-				{
-					return $helper.formatString( $n, true );
-				}
+
+    def getMessage(self):
+	    return $helper.formatString( $n, true )
 #else
-				public override String ToString()
-				{
-					return $helper.formatString( $n, false );
-				}
+
+	def __repr__(self):
+		return $helper.formatString( $n, false )
 #end
-	
 #foreach( $i in $n.iterator() )
-#if ($i.hasDescr())
-				///<summary>
+
+#if( $i.hasDescr())
 #foreach( $s in $i.descr() )
-				///$s
+	# $s
 #end
-				///</summary>
 #end
-				public $helper.getTypeName( $i.type() ) $i.name();
-#if ($i.hasDescr())				
-				///<summary>Gets
+		
+    def $helper.getGetterName( $i.name() ) (self):
+        """
+		Gets the value.
 #foreach( $s in $i.descr() )
-		 		///$s
+		$s
 #end
-				///</summary>
-#else
-				///<summary>Gets Value</summary>
-#end
-				/// <returns>return the value.</returns>
-		 		public $helper.getTypeName( $i.type() ) $helper.getGetterName( $i.name() )()
-				{					
-						return $i.name();
-				}
-#if ($i.hasDescr())					
-				///<summary>Sets
+        @return the value.
+		"""
+		return self.$i.name()
+
+	def $helper.getSetterName($i.name()) (self, value):
+        """
+	    Sets the value.
 #foreach( $s in $i.descr() )
-		 		///$s
-#end
-				///</summary>
-#else
-				///<summary>Sets Value</summary>
+		$s
 #end
-				///<param name="value">the value</param>
-				public void $helper.getSetterName( $i.name() )( $helper.getTypeName( $i.type() ) value )
-				{
-					this.$i.name() = value;
-				}
+		    
+        @param value the value.
+		"""
+		self.$i.name() = value;
 #end
-			}	
+
 #end
 #elseif ($n.isBuiltin())
 ## nothing to do.
-#else	
-#end
+#else
+# *** intf.vm: don't know what to do with $n ***
 #end
-		}
-	}
 #end
-}
\ No newline at end of file

Modified: incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/main.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/main.vm?rev=752721&r1=752720&r2=752721&view=diff
==============================================================================
--- incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/main.vm (original)
+++ incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/main.vm Thu Mar 12 00:27:18 2009
@@ -1,22 +1,12 @@
+## Copyright 2009 Apache Software Foundation
 ## Copyright 2007-2008 Cisco Systems Inc.
-##
-## Licensed under the Apache License, Version 2.0 (the "License"); you may not
-## use this file except in compliance with the License. You may obtain a copy
-## of the License at
-##
-##      http://www.apache.org/licenses/LICENSE-2.0
-##
-## Unless required by applicable law or agreed to in writing, software
-## distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
-## WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
-## License for the specific language governing permissions and limitations
-## under the License.
-// This file automatically generated by:
-//   $version
-//   $now
-// This file is automatically created for your convenience and will not be
-// overwritten once it exists! Please edit this file as necessary to implement
-// your service logic.
+"""
+This file automatically generated by:
+  $version
+  $now
+This file is automatically created for your convenience and will not be
+overwritten once it exists! Please edit this file as necessary to implement
+your service logic.
 #set($i = $intf.name())
 #set($intfname = "$i$suffix")
 #set($baseclname = "Base$intfname")
@@ -29,76 +19,49 @@
 #set($peerclass = "Remote${i}Server")
 #end
 
-using System;
-#if ($helper.isServer($mc))
-
-using Etch.Support;
-using Etch.Util;
+module $intf.parent().name();
+"""
+# import ${i}Helper ??
+#if ($helper.isServer($mc))
+from etch.util.core.io.Transport import *
+
+class Main${i}Listener(${i}Helper.${i}ServerFactory):
+    """
+    New ${i} Server Factory
+    """
+    @staticmethod
+    def new${i}Server( client ):
+        return Impl${i}Server(client)
+
+if __name__=='__main__':
+    # TODO Change to correct URI
+	uri = "tcp://0.0.0.0:4001";
+		
+	listener = ${i}Helper.newListener( uri, None, Main${i}Listener() )
+    listener.transportControl( Transport.START_AND_WAIT_UP, 4000 )
 
-using ${intf.parent().name()}.types.${i};
 #else
 
-using ${intf.parent().name()}.types.${i};
-#end 
-
-namespace $intf.parent().name()
-{
-#if ($helper.isServer($mc))
-	///<summary>Main implementation for ${i}Listener.</summary>
-#else
-	///<summary>Main implementation for $i$suffix.</summary>
-#end
-#if ($helper.isServer($mc))
-	public class Main${i}Listener : ${i}Helper.${i}ServerFactory
-#else
-	public class Main${i}Client : ${i}Helper.${i}ClientFactory
-#end
-	{
-#if ($helper.isServer($mc))
- 		///<summary>Main for ${i}Listener.</summary>
-#else
-		///<summary>Main for ${i}Client</summary>
-#end
-		///<param name="args">Command Line Arguments</param>
-		public static void Main(String[] args)
-		{
-			// TODO: Change to correct URI
-			string uri = "tcp://localhost:4001";
-			
-#if ($helper.isServer($mc))
-			Transport<ServerFactory> listener = ${i}Helper.NewListener( uri, null, new Main${i}Listener());
-			
-			// Start the Listener
-			listener.TransportControl( TransportConsts.START_AND_WAIT_UP, 4000 );
-#else
-			Remote${i}Server server = ${i}Helper.NewServer( uri, null, new Main${i}Client());
+class Main${i}Client(${i}Helper.${i}ClientFactory):
+    """
+    New ${i} Client Factory
+    """
+	
+    @staticmethod
+    def new${i}Client( server ):
+        return Impl${i}Client(server)
+
+if __name__=='__main__':
+    # TODO Change to correct URI
+	uri = "tcp://localhost:4001";
 		
-			// Connect to the service
-			server._StartAndWaitUp( 4000 );
+	server = ${i}Helper.newServer( uri, null, Main${i}Client() );
 
-			// TODO: Insert Your Code Here
+    # Connect to the service
+	server._startAndWaitUp( 4000 );
 
-			// Disconnect from the service
-			server._StopAndWaitDown( 4000 );			
-#end
-		}
+	# TODO Insert Your Code Here
 
-#if ($helper.isServer($mc))
-		///<summary>Return a new instance of ${i}Server.</summary>
-		///<param name="client">Reference to remote service</param>
-		///<returns>Server Implementation</returns>
-		public ${i}Server New${i}Server( Remote${i}Client client )
-		{
-			return new Impl${i}Server( client );
-		}
-#else
-		///<summary>Return a new instance of ${i}Client.</summary>
-		///<param name="server">Reference to remote service</param>
-		///<returns>Client Implementation</returns>
-		public ${i}Client New${i}Client( Remote${i}Server server )
-		{
-			return new Impl${i}Client( server );
-		}
+	# Disconnect from the service
+	server._stopAndWaitDown( 4000 );
 #end
-	}
-}
\ No newline at end of file

Modified: incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/readme.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/readme.vm?rev=752721&r1=752720&r2=752721&view=diff
==============================================================================
--- incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/readme.vm (original)
+++ incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/readme.vm Thu Mar 12 00:27:18 2009
@@ -24,49 +24,33 @@
 
 In the directory where the etch file is located, execute the following command:
 
-etch -q -d . -I . -b csharp -w all Blah.etch
+etch -q -d . -I . -b python -w all Blah.etch
 
-This would compile the service description Blah.etch, generating all csharp files,
-into csharp namespaces rooted in the current directory (-d .), resolving includes
+This would compile the service description Blah.etch, generating all python files,
+into python packages rooted in the current directory (-d .), resolving includes
 and mixins from the current directory (-I .) and being quiet about it (-q).
 
-Assuming the Blah.etch specified a module of "demo" and a service of "Blah",
-the csharp files would be generated into a sub-directory demo of the current
-directory. you may now change to that directory and compile the resulting files:
-
-cd demo
-csc "/reference:%ETCH_HOME%\lib\Etch4CS.dll" /main:demo.MainBlahListener *.cs
-csc "/reference:%ETCH_HOME%\lib\Etch4CS.dll" /main:demo.MainBlahClient *.cs
-
-(Assuming windows; for unix, read the mono directions.)
-
-Depending upon how etch was installed, you may need to install the Etch4CS.dll
-into the system global assembly cache. This command will do the trick:
-
-copy /y "%ETCH_HOME%\lib\Etch4CS.dll" %windir%\assembly
-
-You only need to do this once after each installation of etch. And once the
-installer is fixed, you won't need to do it at all.
+Assuming the Blah.etch specified a module of 'demo' and a service of 'Blah',
+the python files would be generated into a sub-directory 'demo' of the current
+directory. 
 
 To run the service (which initially won't do anything but make a connection and
-then close it, use the following two commands in separate shells (again, from
-the demo directory):
+then close it, use the following two commands in separate shells:
 
-MainBlahListener
+  > python demo/MainBlahListener.py
 
-MainBlahClient
+  > python demo/MainBlahClient.py
 
-The first command (MainBlahListener) starts the service listener which accepts
-connections. The second command (MainBlahClient) runs a sample client, which
-makes a connection to the running listener and then closes it again.
+The first command, 'python demo/MainBlahListener.py', starts the service listener
+which accepts connections. The second command, 'python demo/MainBlahClient.py' runs a
+sample client, which makes a connection to the running listener and then closes it again.
 
-Once you've compiled the service and tested the result, you may implement your
+Once you've executed the service and tested the result, you may implement your
 service by adding content to the etch file, adding implementation details to the
-Impl*.cs and Main*.cs files, and recompiling using the above steps. You may also
-load these files into an IDE such as visual studio, or use a build management
-system such as msbuild or nant. Remember, whenever you change the etch file, you
-must re-etch the service description and then re-csc all the cs
-files.
+Impl*.py and Main*.py files, and re-executing using the above steps. You may
+also load these files into an IDE such as eclipse or intellij, or use a build
+management system such as maven or ant. Remember, whenever you change the etch
+file, you must re-etch the service description.
 
 -------------------
 - Generated Files -
@@ -74,66 +58,66 @@
 
 Here is a description of the generated files for a service named Blah.
 
-Blah.cs
-BlahClient.cs
-BlahServer.cs
+Blah.py
+BlahClient.py
+BlahServer.py
 
 These three files are the generated interface classes. Service defined constants
-and types are in Blah.cs, as well as direction "both" messages, which are
-messages which are shared between client and server. BlahClient.cs and
-BlahServer.cs are respectively the messages for just the direction client or
+and types are in Blah.py, as well as direction "both" messages, which are
+messages which are shared between client and server. BlahClient.py and
+BlahServer.py are respectively the messages for just the direction client or
 server. You should not edit these files.
 
-RemoteBlah.cs
-RemoteBlahClient.cs
-RemoteBlahServer.cs
+RemoteBlah.py
+RemoteBlahClient.py
+RemoteBlahServer.py
 
-RemoteBlah*.cs are the generated classes which implement the interfaces,
+RemoteBlah*.py are the generated classes which implement the interfaces,
 with message implementations which encode the message type and arguments for
 transport to the connection peer and then receive and decode any response. You
 should not edit these files.
 
-StubBlah.cs
-StubBlahClient.cs
-StubBlahServer.cs
+StubBlah.py
+StubBlahClient.py
+StubBlahServer.py
 
-StubBlah*.cs are the generated classes which receive messages encoded by
-RemoteBlah*.cs and decode them, calling the appropriate message implementation
+StubBlah*.py are the generated classes which receive messages encoded by
+RemoteBlah*.py and decode them, calling the appropriate message implementation
 and then encoding and sending any result. You should not edit these files.
 
-ValueFactoryBlah.cs
+ValueFactoryBlah.py
 
-ValueFactoryBlah.cs is a generated class which contains helper code to
+ValueFactoryBlah.py is a generated class which contains helper code to
 serialize service defined types and also the meta data which describes the
 messages and fields, field types, timeouts, etc. You should not edit this file.
 
-BaseBlah.cs
-BaseBlahClient.cs
-BaseBlahServer.cs
+BaseBlah.py
+BaseBlahClient.py
+BaseBlahServer.py
 
-BaseBlah*.cs are generated classes which implement the interfaces, with
+BaseBlah*.py are generated classes which implement the interfaces, with
 message implementations which do nothing but throw UnsupportedOperationException.
 They can be used to supply an implementation when you don't want to immediately
 implement all the messages. You should not edit these files.
 
-ImplBlahClient.cs
-ImplBlahServer.cs
+ImplBlahClient.py
+ImplBlahServer.py
 
-ImplBlah*.cs are the generated sample client and server implementation
+ImplBlah*.py are the generated sample client and server implementation
 classes. They extend the generated base classes. These are used by the sample
 main programs to provide implementations of the client or server messages. Edit
 these files as you wish to implement your service (overriding the default
 implementations from the generated base classes).
 
-BlahHelper.cs
+BlahHelper.py
 
-BlahHelper.cs is a generated class which includes static methods to help
+BlahHelper.py is a generated class which includes static methods to help
 construct transports for client and listener. You should not edit this file.
 
-MainBlahClient.cs
-MainBlahListener.cs
+MainBlahClient.py
+MainBlahListener.py
 
-MainBlah*.cs are the generated sample client and server main programs.
+MainBlah*.py are the generated sample client and server main programs.
 They show how to setup a transport and start it and how to create a session.
 Edit these files as you wish to implement your service, or just copy the code
 into your own application.

Modified: incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/remote.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/remote.vm?rev=752721&r1=752720&r2=752721&view=diff
==============================================================================
--- incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/remote.vm (original)
+++ incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/remote.vm Thu Mar 12 00:27:18 2009
@@ -20,53 +20,35 @@
 #set($intfname = "$i$suffix")
 #set($clname = "Remote$intfname")
 
-using System;
+package $intf.parent().name();
 
-namespace $intf.parent().name()
-{
-
-#if (!$hasBaseClass)
-#end
 #foreach( $n in $intf.iterator() )
-#if ($n.isExtern())
-#if ($n.hasImport( $helper ))
-	using $n.getImport( $helper );
+#if($n.isExtern())
+#if($n.hasImport( $helper ))
+import $n.getImport( $helper );
 #end
 #end
 #end
-	///<summary>Call to message translator for $intfname.</summary>
-#if ($hasBaseClass)
-	public class $clname : Remote$i, $intfname
+
+/**
+ * Call to message translator for $intfname.
+ */
+@SuppressWarnings("unused")
+#if($hasBaseClass)
+public final class $clname extends Remote$i implements $intfname
 #else
-	public class $clname : Etch.Support.RemoteBase, $intfname
+public class $clname extends org.apache.etch.bindings.java.support.RemoteBase implements $intfname
 #end
+{
+	/**
+	 * Constructs the $clname.
+	 *
+	 * @param svc
+	 * @param vf
+	 */
+	public $clname( org.apache.etch.bindings.java.support.DeliveryService svc, org.apache.etch.bindings.java.msg.ValueFactory vf )
 	{
-#if ($hasBaseClass)
-		///<summary>Class Instance used to hide synchronous message 
-		///implementation. Use this to invoke the asynchronous message
-		///implementation</summary> 
-		public new readonly _Async _async;
-		
-		///<summary>Deprecated.</summary>
-		public new readonly _Async _inner;
-#else
-		///<summary>Class Instance used to hide synchronous message 
-		///implementation. Use this to invoke the asynchronous message
-		///implementation</summary> 
-		public readonly _Async _async;
-		
-		///<summary>Deprecated.</summary>
-		public readonly _Async _inner;
-#end
-
-		/// <summary>Constructs the $clname.</summary>
-		/// <param name="svc"></param>
-		/// <param name="vf"></param>
-		public $clname( Etch.Support.DeliveryService svc, Etch.Msg.ValueFactory vf )
-			: base( svc, vf )
-		{
-			_async = new _Async(this);
-			_inner = _async;
+		super( svc, vf );
 #set( $k = 0 )
 #foreach( $x in $intf.iterator() )
 #if( $x.isMixin() )
@@ -74,155 +56,84 @@
 #set( $v = "_mixin$k" )
 #set( $m = $x.getModule() )
 #set( $z = $m.iterator().next() )
-			$v = new ${m.name()}.Remote$z.name()${suffix}( svc, vf );
+		$v = new ${m.name()}.Remote$z.name()${suffix}( svc, vf );
 #end
 #end
-		}
+	}
 
-#foreach ($n in $intf.iterator())
-#if ($n.isMsgDir($mc))
-#if (!$n.isHidden())
+	/**
+	 * {@link _Async} class instance used to hide asynchronous message
+	 * implementation. Use this to invoke the asynchronous message
+	 * implementations.
+	 */
+	public final _Async _async = new _Async();
+
+	/**
+	 * {@link _Async} class instance used to hide asynchronous message
+	 * implementation. This is here for backwards compatibility only, use
+	 * {@link #_async} instead.
+	 * @deprecated
+	 */
+	@Deprecated
+	public final _Async _inner = _async;
+#foreach($n in $intf.iterator())
+#if($n.isMsgDir($mc))
+#if(!$n.isHidden())
 #if(!$methodList.contains($n.name().name()))
 #set ( $addMethodListStatus = $methodList.add($n.name().name()))
-#if ($n.isOneway())
-#if ($n.hasDescr())
-		///<summary>
-#foreach($s in $n.descr())
-		///$s
-#end
-		///</summary>
-#end
-#foreach( $p in $n.iterator() )
-#set($first = true)
-#set ($count = 0)
-#if ($p.hasDescr())
-#foreach( $s in $p.descr() )
-#if ($first)
-#set($count = $count + 1)
-#set($first = false)
-		///<param name="$p.name()">$s
-#else
-		///$s
-#end
-#end
-#if ($count > 0)
-		///</param>
-#end
-#end
-#end
-#if ($n.hasReturn())
-#set($first = true)
-#set ($retCount = 0)
-#if ($n.hasDescr())
-#foreach( $s in $n.returnDescr() )
-#if ($first)
-#set($retCount = $retCount + 1)
-#set($first = false)
-		///<returns>$s
-#else
-		///$s
-#end
-#end
-#if ($retCount > 0)
-		///</returns>
-#end
-#end
-#end
-#if ($n.hasThrown())
-#if ($n.hasDescr())
-#foreach($t in $n.thrown().iterator())
-		///<Exception cref="$t.name().name()"> throws $t.name().name()</Exception>
-#end
-#end
-#end
-		public $helper.getTypeName( $n.type() ) $n.name()(
+#if($n.isOneway())
+
+	public final $helper.getTypeName( $n.type() ) $n.name()(
 #set( $sep = "" )
 #foreach( $p in $n.iterator() )
-			$sep$helper.getTypeName( $p.type() ) $p.name()
+		$sep$helper.getTypeName( $p.type() ) $p.name()
 #set( $sep = ", " )
 #end
-		)
-		{
-			Etch.Msg.Message _msg = _NewMessage( $vfname.$n.vname( $helper ) );
+	)
+	{
+		org.apache.etch.bindings.java.msg.Message _msg = _newMessage( $vfname.$n.vname( $helper ) );
 #foreach( $p in $n.iterator() )
-			_msg.Add( $vfname.$p.vname( $helper ), $p.name() );
+		_msg.put( $vfname.$p.vname( $helper ), $p.name() );
 #end
-			try
-			{
-				_Send( _msg );
-			}
-			catch ( Exception _e )
-			{
-				throw new Exception( "unexpected", _e );
-			}
+		try
+		{
+			_send( _msg );
+		}
+		catch ( Exception _e )
+		{
+			if (_e instanceof RuntimeException) throw (RuntimeException) _e;
+			throw new RuntimeException( "unexpected exception from peer: "+_e, _e );
 		}
+	}
 #else
-#if($n.hasDescr())
-		///<summary>
-#foreach($s in $n.descr())
-		///$s
-#end
-		///</summary>
-#end
+
+	public final $helper.getTypeName( $n.type() ) $n.name()(
+#set( $sep = "" )
 #foreach( $p in $n.iterator() )
-#set($first = true)
-#if ($p.hasDescr())
-#foreach( $s in $p.descr() )
-#if ($first)
-#set($first = false)
-		///<param name="$p.name()">$s
-#else
-		///$s
-#end
-#end
-		///</param>
-#end
-#end
-#if ($n.hasReturn())
-#set($first = true)
-#set($retCount = 0)
-#if ($n.hasDescr())
-#foreach( $s in $n.returnDescr() )
-#if ($first)
-#set($first = false)
-#set($retCount = $retCount + 1)
-		///<returns>$s
-#else
-		///$s
-#end
-#end
-#if ($retCount > 0)
-		///</returns>
-#end
-#end
-#end
-#if ($n.hasThrown())
-#if ($n.hasDescr())
-#foreach($t in $n.thrown().iterator())
-		///<Exception cref="$t.name().name()"> throws $t.name().name()</Exception>
-#end
-#end
+		$sep$helper.getTypeName( $p.type() ) $p.name()
+#set( $sep = ", " )
 #end
-		public $helper.getTypeName( $n.type() ) $n.name()(
+	)
+#if($n.thrown().iterator().hasNext())
+	throws
 #set( $sep = "" )
-#foreach( $p in $n.iterator() )
-			$sep$helper.getTypeName( $p.type() ) $p.name()
+#foreach($t in $n.thrown().iterator())
+		$sep$t.getNamed().fqname()
 #set( $sep = ", " )
 #end
-		)
-		{
-#if ($n.hasReturn())
-			return
 #end
-			_async._end_${n.name()}( _async._begin_${n.name()}(
+	{
+#if($n.hasReturn())
+		return
+#end
+		_async._end_${n.name()}( _async._begin_${n.name()}(
 #set( $sep = "" )
 #foreach( $p in $n.iterator() )
-				$sep$p.name()
+			$sep$p.name()
 #set( $sep = ", " )
 #end
-			) );
-		}
-		
+		) );
+	}
 #end
 #end
 #end
@@ -232,57 +143,65 @@
 #foreach( $x in $intf.iterator() )
 #if( $x.isMixin() )
 
-		// ----- mixin $x.name() ----- //
+	// ----- mixin $x.name() ----- //
 #set( $k = $k + 1 )
 #set( $v = "_mixin$k" )
 #set( $m = $x.getModule() )
 #set( $z = $m.iterator().next() )
-		private ${m.name()}.Remote$z.name()$suffix $v;
-		
+
+	private final ${m.name()}.Remote$z.name()$suffix $v;
 #foreach( $n in $z.messages( true ) )
 #if($n.isMsgDir($mc))
 #if(!$n.isHidden())
 #if(!$methodList.contains($n.name().name()))
 #set ( $addMethodListStatus = $methodList.add($n.name().name()) )
-		// --- generated methods for $n.name() --- //
+	// --- generated methods for $n.name() --- //
+
 #if($n.isOneway())
-		public $helper.getTypeName( $n.type() ) $n.name()(
+	public final $helper.getTypeName( $n.type() ) $n.name()(
 #set( $sep = "" )
 #foreach( $p in $n.iterator() )
-			$sep$helper.getTypeName( $p.type() ) $p.name()
+		$sep$helper.getTypeName( $p.type() ) $p.name()
 #set( $sep = ", " )
 #end
-		)
-		{
-			${v}.$n.name()(
+	)
+	{
+		${v}.$n.name()(
 #set( $sep = "" )
 #foreach( $p in $n.iterator() )
-				$sep$p.name()
+			$sep$p.name()
 #set( $sep = ", " )
 #end
-			);
-		}
+		);
+	}
 #else
-		public $helper.getTypeName( $n.type() ) $n.name()(
+	public final $helper.getTypeName( $n.type() ) $n.name()(
 #set( $sep = "" )
 #foreach( $p in $n.iterator() )
-			$sep$helper.getTypeName( $p.type() ) $p.name()
+		$sep$helper.getTypeName( $p.type() ) $p.name()
 #set( $sep = ", " )
 #end
-		)
-		{
+	)
+#if($n.thrown().iterator().hasNext())
+	throws
+#set( $sep = "" )
+#foreach($t in $n.thrown().iterator())
+		$sep$t.getNamed().fqname()
+#set( $sep = ", " )
+#end
+#end
+	{
 #if($n.hasReturn())
-			return
+		return
 #end
-			${v}.$n.name()(
+		${v}.$n.name()(
 #set( $sep = "" )
 #foreach( $p in $n.iterator() )
-				$sep$p.name()
+			$sep$p.name()
 #set( $sep = ", " )
 #end
-			);
-		}
-		
+		);
+	}
 #end
 #end
 #end
@@ -291,95 +210,118 @@
 #end
 #end
 
-		///<summary>Asynchronous Implementation of service methods</summary>
-#if ($hasBaseClass)
-		public new class _Async : Remote${i}._Async
-#else
-		public class _Async
-#end
-		{
-#if ($hasBaseClass)
-			public new $clname _parent;
+	/**
+	 * Asynchronous implementation of service methods.
+	 */
+#if($hasBaseClass)
+	public final class _Async extends Remote${i}._Async
 #else
-			public $clname _parent;
+	public class _Async
 #end
-			
-			public _Async()
-			{
-			}
-
-			public _Async($clname parent)
-			{
-				_parent = parent;
-			}
-			
-#foreach ($n in $intf.iterator())
-#if ($n.isMsgDir($mc))
-#if (!$n.isHidden())
+	{
+#foreach($n in $intf.iterator())
+#if($n.isMsgDir($mc))
+#if(!$n.isHidden())
 #if(!$methodList.contains("_begin_end_$n.name().name()"))
 #set ( $addMethodListStatus = $methodList.add("_begin_end_$n.name().name()") )
-#if (!$n.isOneway())
-			///<summary>Begins the call to ${n.name()}.</summary>
+#if(!$n.isOneway())
+
+		/**
+		 * Begins a call to ${n.name()}.
+		 *
+#foreach( $s in $n.descr() )
+		 * $s
+#end
 #foreach( $p in $n.iterator() )
-#if ($p.hasDescr())
-#set($first = true)
+#set($sep = "@param $p.name() ")
 #foreach( $s in $p.descr() )
-#if ($first)
-#set($first = false)
-			///<param name = $p.name()>$s
-#else
-			///$s
+		 * $sep$s
+#set($sep = "")
 #end
 #end
-			///</param>
-#end
-#end
-			///<returns>mailbox to use to retrieve the result using _end_${n.name()}.</returns>			
-			public Etch.Support.Mailbox _begin_${n.name()}(
+		 * @return mailbox used to retrieve the result using _end_${n.name()}.
+		 * @see $clname#${n.name()}
+		 * @see #_end_${n.name()}
+		 */
+		public final org.apache.etch.bindings.java.support.Mailbox _begin_${n.name()}(
 #set( $sep = "" )
 #foreach( $p in $n.iterator() )
-				$sep$helper.getTypeName( $p.type() ) $p.name()
+			$sep$helper.getTypeName( $p.type() ) $p.name()
 #set( $sep = ", " )
 #end
-			)
-			{
-				Etch.Msg.Message _msg = _parent._NewMessage( $vfname.$n.vname( $helper ) );
+		)
+		{
+			org.apache.etch.bindings.java.msg.Message _msg = _newMessage( $vfname.$n.vname( $helper ) );
 #foreach( $p in $n.iterator() )
-				_msg.Add( $vfname.$p.vname( $helper ), $p.name() );
+			_msg.put( $vfname.$p.vname( $helper ), $p.name() );
 #end
-				return _parent._BeginCall( _msg );
-			}
-	 
-			/// <summary>Waits for the call to end and returns the result.</summary>
-			/// <param name="_mb">mailbox returned by _begin_${n.name()}.</param>
-			public $helper.getTypeName( $n.type() ) _end_${n.name()}( Etch.Support.Mailbox _mb )
+			return _begincall( _msg );
+		}
+		
+		/**
+		 * Ends a call to ${n.name()}.
+		 *
+#foreach( $s in $n.descr() )
+		 * $s
+#end
+		 * @param mb mailbox returned by _begin_${n.name()}.
+#if($n.hasReturn())
+#set($sep = "@return ")
+#foreach( $s in $n.returnDescr() )
+		 * $sep$s
+#set($sep = "")
+#end
+#end
+#foreach($t in $n.thrown().iterator())
+#set($sep = "@throws $t.name() ")
+#foreach( $s in $t.descr() )
+		 * $sep$s
+#set($sep = "")
+#end
+#end
+		 *
+		 * @see $clname#${n.name()}
+		 * @see #_begin_${n.name()}
+		 */
+		public final $helper.getTypeName( $n.type() ) _end_${n.name()}( org.apache.etch.bindings.java.support.Mailbox mb )
+#if($n.thrown().iterator().hasNext())
+			throws
+#set( $sep = "" )
+#foreach($t in $n.thrown().iterator())
+				$sep$t.getNamed().fqname()
+#set( $sep = ", " )
+#end
+#end
+		{
+			try
 			{
-#if ($n.hasReturn())
+#if($n.hasReturn())
 				return
-				($helper.getTypeName( $n.type() ))
-#if ($n.type().dim() > 0)
-					// ValueFactory${i}.to_$n.type().type()(
-					//	typeof( ${helper.getTypeName( $n.type() )} ),
-#end
-					_parent._EndCall( _mb,
-						$vfname.$n.getResultMessage().vname( $helper ) )
-#if ($n.type().dim() > 0)
-					//)
-#end
-				;
+					($helper.getTypeName( $n.type() ))
+						_endcall( mb,
+							$vfname.$n.getResultMessage().vname( $helper ) );
 #else
-			
-				_parent._EndCall( _mb,
-				$vfname.$n.getResultMessage().vname( $helper ) );
+				_endcall( mb,
+					$vfname.$n.getResultMessage().vname( $helper )  );
 #end
-
 			}
-
+			catch ( Exception e )
+			{
+#foreach($t in $n.thrown().iterator())
+				if (e instanceof ${t.getNamed().fqname()})
+					throw ($t.getNamed().fqname()) e;
 #end
+				if (e instanceof RuntimeException) throw (RuntimeException) e;
+				throw new RuntimeException( "unexpected exception from peer: "+e, e );
+			}
+		}
 #end
 #end
 #end
+#end 
 #end
+
+		// Mixin Methods
 #set( $k = 0 )
 #foreach( $x in $intf.iterator() )
 #if( $x.isMixin() )
@@ -387,64 +329,94 @@
 #set( $v = "_mixin$k" )
 #set( $m = $x.getModule() )
 #set( $z = $m.iterator().next() )
-	
 #foreach( $n in $z.messages( true ) )
 #if($n.isMsgDir($mc))
 #if(!$n.isHidden())
 #if(!$methodList.contains("_begin_end_$n.name().name()"))
 #set ( $addMethodListStatus = $methodList.add("_begin_end_$n.name().name()") )
-			// --- generated methods for $n.name() --- //
+		// --- generated methods for $n.name() --- //
 
-#if(! $n.isOneway())
-			///<summary>Begins a call to ${n.name()}.</summary>
+#if(!$n.isOneway())
+		/**
+		 * Begins a call to ${n.name()}.
+		 *
+#foreach( $s in $n.descr() )
+		 * $s
+#end
 #foreach( $p in $n.iterator() )
-#if ($p.hasDescr())
-#set($first = true)
+#set( $sep = "@param $p.name() " )
 #foreach( $s in $p.descr() )
-#if ($first)
-#set($first = false)
-			///<param name = $p.name()>$s
-#else
-			///$s
-#end
-#end
-			///</param>
+		 * $sep$s
+#set( $sep = "" )
 #end
 #end
-
-			public Etch.Support.Mailbox _begin_${n.name()}(
+		 * @return mailbox used to retrieve the result using _end_${n.name()}.
+		 * @see $clname#${n.name()}
+		 * @see #_end_${n.name()}
+		 */
+		public final org.apache.etch.bindings.java.support.Mailbox _begin_${n.name()}(
 #set( $sep = "" )
 #foreach( $p in $n.iterator() )
-				$sep$helper.getTypeName( $p.type() ) $p.name()
+			$sep$helper.getTypeName( $p.type() ) $p.name()
 #set( $sep = ", " )
 #end
-			)
-			{
-				return _parent.${v}._async._begin_${n.name()}(
+		)
+		{
+			return ${v}._async._begin_${n.name()}(
 #set( $sep = "" )
 #foreach( $p in $n.iterator() )
-					$sep$p.name()
+				$sep$p.name()
 #set( $sep = ", " )
 #end
-				);
-			}
-			
-			///<summary>Ends a call to ${n.name()}</summary>
-			///<param name = mb> mailbox returned by _begin_${n.name()}. </param>
-			public $helper.getTypeName( $n.type() ) _end_${n.name()}( Etch.Support.Mailbox _mb )
-			{
-#if($n.hasReturn())
-				return
+			);
+		}
+		
+		/**
+		 * Ends a call to ${n.name()}.
+		 *
+#foreach( $s in $n.descr() )
+		 * $s
+#end
+		 * @param mb mailbox returned by _begin_${n.name()}.
+#if( $n.hasReturn() )
+#set( $sep = "@return " )
+#foreach( $s in $n.returnDescr() )
+		 * $sep$s
+#set( $sep = "" )
 #end
-				_parent.${v}._async._end_${n.name()}( _mb );
-			}
 #end
+#foreach( $t in $n.thrown().iterator() )
+#set( $sep = "@throws $t.name() " )
+#foreach( $s in $t.descr() )
+		 * $sep$s
+#set( $sep = "" )
 #end
 #end
+		 *
+		 * @see $clname#${n.name()}
+		 * @see #_begin_${n.name()}
+		 */
+		public final $helper.getTypeName( $n.type() ) _end_${n.name()}( org.apache.etch.bindings.java.support.Mailbox mb )
+#if($n.thrown().iterator().hasNext())
+			throws
+#set( $sep = "" )
+#foreach($t in $n.thrown().iterator())
+				$sep$t.getNamed().fqname()
+#set( $sep = ", " )
 #end
 #end
+		{
+#if($n.hasReturn())
+			return
 #end
-#end	
+			${v}._async._end_${n.name()}( mb );
 		}
+#end
+#end
+#end
+#end
+#end
+#end
+#end
 	}
 }

Modified: incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/stub.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/stub.vm?rev=752721&r1=752720&r2=752721&view=diff
==============================================================================
--- incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/stub.vm (original)
+++ incubator/etch/trunk/binding-python/compiler/src/main/resources/org/apache/etch/bindings/python/compiler/stub.vm Thu Mar 12 00:27:18 2009
@@ -17,138 +17,154 @@
 // This file is automatically created and should not be edited!
 #set($i = $intf.name())
 
-using System;
-	
-using Etch.Msg;
-using Etch.Support;
-using Etch.Util;
+package $intf.parent().name();
 
-namespace $intf.parent().name()
-{	
+import org.apache.etch.util.core.Who;
+import org.apache.etch.bindings.java.msg.Message;
+import org.apache.etch.bindings.java.support.DeliveryService;
+import org.apache.etch.bindings.java.support.Pool;
+import org.apache.etch.bindings.java.support.StubHelper;
+import org.apache.etch.bindings.java.support._Etch_AuthException;
+#if (!$hasBaseClass)
+import org.apache.etch.bindings.java.support.StubBase;
+#end
+import org.apache.etch.bindings.java.support.Pool.PoolRunnable;
 #foreach( $n in $intf.iterator() )
 #if ($n.isExtern())
 #if ($n.hasImport( $helper ))
-#set($x = $n.getImport( $helper ))
-#if (!$x.equals("Etch.Util"))
-	using $x;
-#end
+import $n.getImport( $helper );
 #end
 #end
 #end
 
-	///<summary> Message to call translator for $i$suffix. </summary>
-	
 #if ($hasBaseClass)
-	public class Stub$i$suffix : Stub$i
+/**
+ * Message to call translator for $i$suffix.
+ */
+@SuppressWarnings("unused")
+public class Stub$i$suffix extends Stub$i<$i$suffix>
+#set( $T = "$i$suffix" )
 #else
-	public class Stub$i$suffix : StubBase
-#end
+/**
+ * Message to call translator for $i$suffix.
+ * @param <T> $i$suffix or a subclass thereof.
+ */
+@SuppressWarnings("unused")
+public class Stub$i$suffix<T extends $i$suffix> extends StubBase<T>
+#set( $T = "T" )
+#end
+{
+	/**
+	 * Stub for $i$suffix.
+	 * @param svc the delivery service.
+	 * @param obj the implementation of $i$suffix responsive to requests.
+	 * @param queued thread pool used to run AsyncMode.QUEUED methods.
+	 * @param free thread pool used to run AsyncMode.FREE methods.
+	 */
+	public Stub$i$suffix( DeliveryService svc, $T obj, Pool queued, Pool free )
+	{
+		super( svc, obj, queued, free );
+	}
+	
+	static
 	{
-		/// <summary>Stub for $i$suffix.</summary>
-		/// <param name="src">the delivery service to use.</param>
-		/// <param name="obj"> the implementation of $i$suffix responsive to requests.</param>
-		/// <param name="queued"> thread pool used to run AsyncReceiverMode.QUEUED methods.</param>
-		/// <param name="free"> thread pool used to run AsyncReceiverMode.FREE methods.</param>		
-		public Stub$i$suffix( DeliveryService src, object obj, Pool queued, Pool free )
-			: base( src, obj, queued, free )
-		{	
-			// nothing to do.
-		}
-		
-#if (!$hasBaseClass)
-		public static void init()
-#else
-		public static new void init()
-#end
-		{
-			// nothing to do.
-		}
-
-		static Stub$i$suffix()
-		{
 #foreach( $n in $intf.iterator() )
 #if( $n.isMixin() )
 #set( $m = $n.getModule() )
 #set( $z = $m.iterator().next() )
-			${m.name()}.Stub${z.name()}${suffix}.init();
+		${m.name()}.Stub${z.name()}${suffix}.init();
 #end
 #end
-#set( $stubHelperCount=0 )
+	}
+
+	/**
+	 * Method used to force static initialization.
+	 */
+	public static void init()
+	{
+		// nothing to do.
+	}
+	
+	static
+	{
 #foreach( $mthd in $intf.iterator() )
 #if ($mthd.isMsgDir($mc))
 #if (!$mthd.isHidden())
-#set($stubHelperCount = $stubHelperCount + 1)
-			StubHelperRun helper$stubHelperCount = delegate( DeliveryService _src, object _obj, Who _sender, Message _msg ) 
+		ValueFactory$i.${mthd.vname( $helper )}.setStubHelper( new StubHelper<$i$suffix>()
+		{
+			public final void run( DeliveryService _svc, $i$suffix _obj, Who _sender, Message _msg ) throws Exception
+			{
+#if (!$mthd.isOneway())
+				final Message _rmsg = _msg.reply();
+#end
+				try
 				{
-					try {
+#if ($mthd.hasAuth())
 #foreach ($param in $mthd.iterator())
-							$helper.getTypeName( $param.type() ) $param.name() = 
-								($helper.getTypeName( $param.type() ))
-								_msg.Get( ValueFactory$i.$param.vname( $helper ) );
+					$helper.getTypeName( $param.type() ) $param.name() = ($helper.getTypeName( $param.type() )) _msg.get( ValueFactory$i.$param.vname( $helper ) );
+#end
 #end
-
 #if ($mthd.hasAuth())
 #set( $auth = $mthd.getAuth() )
 #if ($auth.isMethodFalse())
-							if (true)
+					if (true)
 #else
-							if ((bool)!(($i$suffix)_obj).${auth.method()}(
+					if (!_obj.${auth.method()}(
 #set( $sep = "" )
 #foreach($arg in $auth.args())
 #if ($arg.isLiteralConstant())
-								($helper.getNativeTypeName( $arg.type() )) $sep$helper.getTypeValue( $arg.type(), $arg.value() )
+						($helper.getNativeTypeName( $arg.type() )) ${sep}$helper.getTypeValue( $arg.type(), $arg.value() )
 #elseif ($arg.isParameter( $mthd ))
-								$sep$helper.qualifyParameterName( $arg.value() )
+						${sep}$helper.qualifyParameterName( $arg.value() )
 #elseif ($arg.isConstant( $intf ))
-								$sep$helper.qualifyConstantName( $intf, $arg.value() )
+						${sep}$helper.qualifyConstantName( $intf, $arg.value() )
 #elseif ($arg.isEnum( $intf ))
-								$sep$helper.qualifyEnumName( $intf, $arg.value() )
+						${sep}$helper.qualifyEnumName( $intf, $arg.value() )
 #else
-								${sep}null
+						${sep}null
 #end
 #set( $sep = ", " )
 #end
-							)) 
+					))
 #end
-							throw new _Etch_AuthException( "$mthd.name()" );
+					throw new _Etch_AuthException( "stub could not authorize $mthd.name() using $auth.method()" );
 #end
-
 #if ($mthd.hasReturn())
-							Object _result =
+					_rmsg.put( ValueFactory$i._mf_result,
 #end
-								(($i$suffix)_obj).$mthd.name()(
+					_obj.$mthd.name()(
 #set( $sep = "" )
 #foreach ($param in $mthd.iterator())
-								$sep$param.name()
+#if ($mthd.hasAuth())
+						${sep}$param.name()
+#else
+						${sep}($helper.getTypeName( $param.type() )) _msg.get( ValueFactory$i.$param.vname( $helper ) )
+#end
 #set( $sep = ", " )
 #end
-								);
-								
-#if (!$mthd.isOneway())
-							Message _rmsg = _msg.Reply();
 #if ($mthd.hasReturn())
-							_rmsg.Add( ValueFactory$i._mf_result, _result );
+					)
 #end
-							_src.TransportMessage( _sender, _rmsg );
+					);
+				}
+				catch ( Exception e )
+				{
+					sessionNotify( _obj, e );
+#if ($mthd.isOneway())
+					Message _rmsg = _msg.reply( _msg.vf().get_mt__exception() );
+#end
+					_rmsg.put( ValueFactory$i._mf_result, e );
+#if ($mthd.isOneway())
+					_svc.transportMessage( _sender, _rmsg );
 #end
-						}
-						catch ( Exception e )
-						{
+				}
 #if (!$mthd.isOneway())
-							Message _rmsg = _msg.Reply();
-#else
-							Message _rmsg = _msg.Reply( _msg.Vf.get_mt__exception() );
+				_svc.transportMessage( _sender, _rmsg );
 #end
-							_rmsg.Add( ValueFactory$i._mf_result, e );
-							_src.TransportMessage( _sender, _rmsg );
-						}
-					};
-			ValueFactory$i.${mthd.vname( $helper )}.SetStubHelper( helper$stubHelperCount);		
+			}
+		} );
 #end
 #end
 #end
-		}
 	}
 }
-
-	
\ No newline at end of file



Mime
View raw message