You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@etch.apache.org by sc...@apache.org on 2009/02/26 19:09:48 UTC

svn commit: r748251 - in /incubator/etch/trunk: binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/ binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/ binding-csharp/runtime/src/main/csharp/...

Author: sccomer
Date: Thu Feb 26 18:09:47 2009
New Revision: 748251

URL: http://svn.apache.org/viewvc?rev=748251&view=rev
Log:
more fiddlings with the listener newServer api. the api is now more consistent and everything that might vary and is needed to finish the construction of the transport comes in the method call.

Modified:
    incubator/etch/trunk/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/helper.vm
    incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/DefaultServerFactory.cs
    incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/ServerFactory.cs
    incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/TcpTransportFactory.cs
    incubator/etch/trunk/binding-java/compiler/src/main/resources/org/apache/etch/bindings/java/compiler/helper.vm
    incubator/etch/trunk/binding-java/runtime/src/main/java/org/apache/etch/bindings/java/support/ServerFactory.java
    incubator/etch/trunk/binding-java/runtime/src/main/java/org/apache/etch/bindings/java/transport/Tcp2TransportFactory.java
    incubator/etch/trunk/binding-java/runtime/src/main/java/org/apache/etch/bindings/java/transport/TcpTransportFactory.java
    incubator/etch/trunk/tests/src/main/csharp/etch.tests/MyCuaeHelper.cs
    incubator/etch/trunk/tests/src/main/java/org/apache/etch/tests/MyCuaeHelper.java

Modified: incubator/etch/trunk/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/helper.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/helper.vm?rev=748251&r1=748250&r2=748251&view=diff
==============================================================================
--- incubator/etch/trunk/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/helper.vm (original)
+++ incubator/etch/trunk/binding-csharp/compiler/src/main/resources/org/apache/etch/bindings/csharp/compiler/helper.vm Thu Feb 26 18:09:47 2009
@@ -48,31 +48,27 @@
 		{
 			Resources res = InitResources(resources);
 			Transport<ServerFactory> listener = TransportFactory.GetListener(uri, res);
-			return new MyServerFactory(listener, uri, implFactory);
+			return new MyServerFactory(listener, implFactory);
 		}
 		
 		public class MyServerFactory : DefaultServerFactory
 		{
-			public MyServerFactory(Transport<ServerFactory> listener, string uri, ${i}ServerFactory implFactory )
+			public MyServerFactory(Transport<ServerFactory> listener, ${i}ServerFactory implFactory )
 				: base(listener, implFactory)
 			{
 				_listener = listener;
-				_uri = uri;
 				_implFactory = implFactory;
 			}
 
 		    private readonly Transport<ServerFactory> _listener;
 
-            private readonly string _uri;
-
             private readonly ${i}ServerFactory _implFactory;
 
-            public override void NewServer(string uri, Resources resources, TransportMessage m)
+            public override void NewServer(TransportMessage m, string uri, Resources resources)
 			{
                 ValueFactory vf = (ValueFactory)resources.Get(TransportConsts.VALUE_FACTORY);
-                URL u = new URL(uri);
-                MailboxManager r = new PlainMailboxManager(m, u, resources);
-                DeliveryService d = new DefaultDeliveryService(r, u, resources);
+                MailboxManager r = new PlainMailboxManager(m, uri, resources);
+                DeliveryService d = new DefaultDeliveryService(r, uri, resources);
 				Remote${i}Client client = new Remote${i}Client(d, vf);
 				${i}Server server = _implFactory.New${i}Server(client);
                 Pool qp = (Pool)resources[QUEUED_POOL];
@@ -81,9 +77,9 @@
 				client._Start();
 			}
 
-            public override ValueFactory NewValueFactory()
+            public override ValueFactory NewValueFactory(string uri)
             {
-                return new ValueFactory${i}(_uri);
+                return new ValueFactory${i}(uri);
             }
 
             public override string ToString()

Modified: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/DefaultServerFactory.cs
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/DefaultServerFactory.cs?rev=748251&r1=748250&r2=748251&view=diff
==============================================================================
--- incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/DefaultServerFactory.cs (original)
+++ incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/DefaultServerFactory.cs Thu Feb 26 18:09:47 2009
@@ -94,9 +94,9 @@
 
         #region ServerFactory Members
 
-        abstract public void NewServer(string uri, Resources resources, TransportMessage transport);
+        abstract public void NewServer(TransportMessage transport, string uri, Resources resources);
 
-        abstract public ValueFactory NewValueFactory();
+        abstract public ValueFactory NewValueFactory(string uri);
 
         #endregion
     }

Modified: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/ServerFactory.cs
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/ServerFactory.cs?rev=748251&r1=748250&r2=748251&view=diff
==============================================================================
--- incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/ServerFactory.cs (original)
+++ incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Support/ServerFactory.cs Thu Feb 26 18:09:47 2009
@@ -32,15 +32,16 @@
         /// <summary>
         /// Constructs a new server session.
         /// </summary>
-        /// <param name="uri"></param>
-        /// <param name="resources"></param>
-        /// <param name="transport"> the TransportMessage to be used with the new session</param>
-        void NewServer(string uri, Resources resources, TransportMessage transport);
+        /// <param name="transport">the TransportMessage to use with the new server instance.</param>
+        /// <param name="uri">the uri to use to configure the new server instance.</param>
+        /// <param name="resources">the resources to use for the new server instance.</param>
+        void NewServer(TransportMessage transport, string uri, Resources resources);
 
         /// <summary>
         /// Constructs a new instance of value factory for this session.
         /// </summary>
+        /// <param name="uri">the uri to use to configure the new value factory.</param>
         /// <returns>a new instance of value factory for this session.</returns>
-        ValueFactory NewValueFactory();
+        ValueFactory NewValueFactory(string uri);
     }
 }

Modified: incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/TcpTransportFactory.cs
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/TcpTransportFactory.cs?rev=748251&r1=748250&r2=748251&view=diff
==============================================================================
--- incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/TcpTransportFactory.cs (original)
+++ incubator/etch/trunk/binding-csharp/runtime/src/main/csharp/Org.Apache.Etch.Bindings.Csharp/Transport/TcpTransportFactory.cs Thu Feb 26 18:09:47 2009
@@ -108,12 +108,12 @@
                 Resources r = new Resources(resources);
                 r.Add(SOCKET, socket);
 
-                ValueFactory vf = session.NewValueFactory();
+                ValueFactory vf = session.NewValueFactory(uri);
                 r.Add(TransportConsts.VALUE_FACTORY, vf);
 
                 TransportMessage t = ttf.NewTransport(uri, r);
 
-                session.NewServer(uri, r, t);
+                session.NewServer(t, uri, r);
             }
 
             #region Transport<ServerFactory> Members

Modified: incubator/etch/trunk/binding-java/compiler/src/main/resources/org/apache/etch/bindings/java/compiler/helper.vm
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-java/compiler/src/main/resources/org/apache/etch/bindings/java/compiler/helper.vm?rev=748251&r1=748250&r2=748251&view=diff
==============================================================================
--- incubator/etch/trunk/binding-java/compiler/src/main/resources/org/apache/etch/bindings/java/compiler/helper.vm (original)
+++ incubator/etch/trunk/binding-java/compiler/src/main/resources/org/apache/etch/bindings/java/compiler/helper.vm Thu Feb 26 18:09:47 2009
@@ -63,31 +63,30 @@
 	 * @throws Exception
 	 */
 	public static ServerFactory newListener( final String uri,
-		Resources resources, final ${i}ServerFactory implFactory )
+		final Resources resources, final ${i}ServerFactory implFactory )
 		throws Exception
 	{
 		final Resources res = initResources( resources );
-		final URL u = new URL( uri );
 		
 		final Transport<ServerFactory> listener = TransportFactory.getListener( uri, res );
 		
 		return new DefaultServerFactory( listener, implFactory )
 		{
-			public void newServer( String uri, Resources resources,
-				TransportMessage transport ) throws Exception
+			public void newServer( TransportMessage t, String uri, Resources r )
+				throws Exception
 			{
-				ValueFactory vf = (ValueFactory) resources.get( Transport.VALUE_FACTORY );
-				MailboxManager x = new PlainMailboxManager( transport, u, res );
-				DeliveryService d = new DefaultDeliveryService( x, u, res );
+				ValueFactory vf = (ValueFactory) r.get( Transport.VALUE_FACTORY );
+				MailboxManager x = new PlainMailboxManager( t, uri, r );
+				DeliveryService d = new DefaultDeliveryService( x, uri, r );
 				Remote${i}Client client = new Remote${i}Client( d, vf );
 				${i}Server server = implFactory.new${i}Server( client );
-				Pool qp = (Pool) res.get( QUEUED_POOL );
-				Pool fp = (Pool) res.get( FREE_POOL );
+				Pool qp = (Pool) r.get( QUEUED_POOL );
+				Pool fp = (Pool) r.get( FREE_POOL );
 				new Stub${i}Server( d, server, qp, fp );
 				client._start();
 			}
 
-			public ValueFactory newValueFactory()
+			public ValueFactory newValueFactory( String uri )
 			{
 				return new ValueFactory${i}( uri );
 			}

Modified: incubator/etch/trunk/binding-java/runtime/src/main/java/org/apache/etch/bindings/java/support/ServerFactory.java
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-java/runtime/src/main/java/org/apache/etch/bindings/java/support/ServerFactory.java?rev=748251&r1=748250&r2=748251&view=diff
==============================================================================
--- incubator/etch/trunk/binding-java/runtime/src/main/java/org/apache/etch/bindings/java/support/ServerFactory.java (original)
+++ incubator/etch/trunk/binding-java/runtime/src/main/java/org/apache/etch/bindings/java/support/ServerFactory.java Thu Feb 26 18:09:47 2009
@@ -34,16 +34,17 @@
 public interface ServerFactory extends Session, Transport<Session>
 {
 	/**
-	 * @param uri 
-	 * @param resources 
-	 * @param transport the TransportMessage to use with the new server.
+	 * @param transport the TransportMessage to use with the new server instance.
+	 * @param uri the uri to use to configure the new server instance.
+	 * @param resources the resources to use for the new server instance.
 	 * @throws Exception
 	 */
-	public void newServer( String uri, Resources resources,
-		TransportMessage transport ) throws Exception;
+	public void newServer( TransportMessage transport, String uri,
+		Resources resources ) throws Exception;
 	
 	/**
+	 * @param uri the uri to use to configure the new value factory.
 	 * @return a new instance of value factory for this connection.
 	 */
-	public ValueFactory newValueFactory();
+	public ValueFactory newValueFactory( String uri );
 }

Modified: incubator/etch/trunk/binding-java/runtime/src/main/java/org/apache/etch/bindings/java/transport/Tcp2TransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-java/runtime/src/main/java/org/apache/etch/bindings/java/transport/Tcp2TransportFactory.java?rev=748251&r1=748250&r2=748251&view=diff
==============================================================================
--- incubator/etch/trunk/binding-java/runtime/src/main/java/org/apache/etch/bindings/java/transport/Tcp2TransportFactory.java (original)
+++ incubator/etch/trunk/binding-java/runtime/src/main/java/org/apache/etch/bindings/java/transport/Tcp2TransportFactory.java Thu Feb 26 18:09:47 2009
@@ -164,12 +164,12 @@
 			Resources r = new Resources( resources );
 			r.put( "connection", connection );
 			
-			ValueFactory vf = session.newValueFactory();
+			ValueFactory vf = session.newValueFactory( uri );
 			r.put( Transport.VALUE_FACTORY, vf );
 			
-			TransportMessage transport = newTransport( uri, r );
+			TransportMessage t = newTransport( uri, r );
 			
-			session.newServer( uri, r, transport );
+			session.newServer( t, uri, r );
 		}
 
 		public Object sessionQuery( Object query ) throws Exception

Modified: incubator/etch/trunk/binding-java/runtime/src/main/java/org/apache/etch/bindings/java/transport/TcpTransportFactory.java
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/binding-java/runtime/src/main/java/org/apache/etch/bindings/java/transport/TcpTransportFactory.java?rev=748251&r1=748250&r2=748251&view=diff
==============================================================================
--- incubator/etch/trunk/binding-java/runtime/src/main/java/org/apache/etch/bindings/java/transport/TcpTransportFactory.java (original)
+++ incubator/etch/trunk/binding-java/runtime/src/main/java/org/apache/etch/bindings/java/transport/TcpTransportFactory.java Thu Feb 26 18:09:47 2009
@@ -117,7 +117,8 @@
 		 * @param uri
 		 * @param resources
 		 */
-		public MySessionListener( Transport<SessionListener<Socket>> transport, String uri, Resources resources )
+		public MySessionListener( Transport<SessionListener<Socket>> transport,
+			String uri, Resources resources )
 		{
 			this.transport = transport;
 			this.uri = uri;
@@ -172,12 +173,12 @@
 			Resources r = new Resources( resources );
 			r.put( SOCKET, socket );
 			
-			ValueFactory vf = session.newValueFactory();
+			ValueFactory vf = session.newValueFactory( uri );
 			r.put( Transport.VALUE_FACTORY, vf );
 			
 			TransportMessage t = newTransport( uri, r );
 			
-			session.newServer( uri, r, t );
+			session.newServer( t, uri, r );
 		}
 
 		public Object sessionQuery( Object query ) throws Exception

Modified: incubator/etch/trunk/tests/src/main/csharp/etch.tests/MyCuaeHelper.cs
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/tests/src/main/csharp/etch.tests/MyCuaeHelper.cs?rev=748251&r1=748250&r2=748251&view=diff
==============================================================================
--- incubator/etch/trunk/tests/src/main/csharp/etch.tests/MyCuaeHelper.cs (original)
+++ incubator/etch/trunk/tests/src/main/csharp/etch.tests/MyCuaeHelper.cs Thu Feb 26 18:09:47 2009
@@ -32,37 +32,41 @@
         {
             Resources res = InitResources(resources);
             Transport<ServerFactory> listener = TransportFactory.GetListener(uri, res);
-            return new MyServerFactory(listener, uri, implFactory);
+            return new MyServerFactory(listener, implFactory);
         }
 
         public new class MyServerFactory : DefaultServerFactory
         {
-            public MyServerFactory(Transport<ServerFactory> listener, string uri, MyCuaeServerFactory implFactory)
+            public MyServerFactory(Transport<ServerFactory> listener, MyCuaeServerFactory implFactory)
                 : base(listener, implFactory)
             {
-                _uri = uri;
+                _listener = listener;
                 _implFactory = implFactory;
             }
 
-            private readonly string _uri;
+            private readonly Transport<ServerFactory> _listener;
 
             private readonly MyCuaeServerFactory _implFactory;
 
-            public override void NewServer(string uri, Resources resources, TransportMessage m)
+            public override void NewServer(TransportMessage m, string uri, Resources resources)
             {
                 ValueFactory vf = (ValueFactory)resources.Get(TransportConsts.VALUE_FACTORY);
-                URL u = new URL(uri);
-                MailboxManager x = new PlainMailboxManager(m, u, resources);
-                DeliveryService d = new DefaultDeliveryService(x, u, resources);
+                MailboxManager x = new PlainMailboxManager(m, uri, resources);
+                DeliveryService d = new DefaultDeliveryService(x, uri, resources);
                 Pool qp = (Pool)resources[QUEUED_POOL];
                 Pool fp = (Pool)resources[FREE_POOL];
                 _implFactory.NewMyCuaeServer(d, qp, fp, (MyValueFactoryCuae)vf);
                 d.TransportControl(TransportConsts.START, null);
             }
 
-            public override ValueFactory NewValueFactory()
+            public override ValueFactory NewValueFactory(string uri)
             {
-                return new ValueFactoryCuae(_uri);
+                return new ValueFactoryCuae(uri);
+            }
+
+            public override string ToString()
+            {
+                return "MyCuaeHelper.ServerFactory/" + _listener;
             }
         }
 

Modified: incubator/etch/trunk/tests/src/main/java/org/apache/etch/tests/MyCuaeHelper.java
URL: http://svn.apache.org/viewvc/incubator/etch/trunk/tests/src/main/java/org/apache/etch/tests/MyCuaeHelper.java?rev=748251&r1=748250&r2=748251&view=diff
==============================================================================
--- incubator/etch/trunk/tests/src/main/java/org/apache/etch/tests/MyCuaeHelper.java (original)
+++ incubator/etch/trunk/tests/src/main/java/org/apache/etch/tests/MyCuaeHelper.java Thu Feb 26 18:09:47 2009
@@ -32,7 +32,6 @@
 import org.apache.etch.bindings.java.transport.SessionMessage;
 import org.apache.etch.bindings.java.transport.TransportMessage;
 import org.apache.etch.util.Resources;
-import org.apache.etch.util.URL;
 import org.apache.etch.util.core.io.Transport;
 
 
@@ -70,20 +69,18 @@
 		
 		return new DefaultServerFactory( listener, implFactory )
 		{
-			public void newServer( String uri, Resources resources,
-				TransportMessage transport ) throws Exception
+			public void newServer( TransportMessage t, String uri, Resources r ) throws Exception
 			{
-				ValueFactory vf = (ValueFactory) resources.get( Transport.VALUE_FACTORY );
-				URL u = new URL( uri );
-				MailboxManager x = new PlainMailboxManager( transport, u, resources );
-				DeliveryService d = new DefaultDeliveryService( x, u, resources );
-				Pool qp = (Pool) resources.get( QUEUED_POOL );
-				Pool fp = (Pool) resources.get( FREE_POOL );
+				ValueFactory vf = (ValueFactory) r.get( Transport.VALUE_FACTORY );
+				MailboxManager x = new PlainMailboxManager( t, uri, r );
+				DeliveryService d = new DefaultDeliveryService( x, uri, r );
+				Pool qp = (Pool) r.get( QUEUED_POOL );
+				Pool fp = (Pool) r.get( FREE_POOL );
 				implFactory.newMyCuaeServer( d, qp, fp, (MyValueFactoryCuae) vf );
 				d.transportControl( START, null );
 			}
 
-			public ValueFactory newValueFactory()
+			public ValueFactory newValueFactory( String uri )
 			{
 				return new MyValueFactoryCuae( uri );
 			}