qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject svn commit: r561981 - in /incubator/qpid/trunk/qpid/java/common: generate src/main/java/org/apache/qpidity/CommonSessionDelegate.java src/main/java/org/apache/qpidity/HeaderHandler.java src/main/java/org/apache/qpidity/Session.java
Date Wed, 01 Aug 2007 22:28:00 GMT
Author: rajith
Date: Wed Aug  1 15:27:55 2007
New Revision: 561981

URL: http://svn.apache.org/viewvc?view=rev&rev=561981
Log:
added wiring to Rafi's comm stack

Modified:
    incubator/qpid/trunk/qpid/java/common/generate
    incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/CommonSessionDelegate.java
    incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/HeaderHandler.java
    incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/Session.java

Modified: incubator/qpid/trunk/qpid/java/common/generate
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/generate?view=diff&rev=561981&r1=561980&r2=561981
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/generate (original)
+++ incubator/qpid/trunk/qpid/java/common/generate Wed Aug  1 15:27:55 2007
@@ -286,3 +286,4 @@
   hdrs = Output(out_dir, out_pkg, pset)
   hdrs.line("public interface %s extends Header {}" % pset)
   hdrs.write()
+

Modified: incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/CommonSessionDelegate.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/CommonSessionDelegate.java?view=diff&rev=561981&r1=561980&r2=561981
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/CommonSessionDelegate.java
(original)
+++ incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/CommonSessionDelegate.java
Wed Aug  1 15:27:55 2007
@@ -20,6 +20,8 @@
  */
 package org.apache.qpidity;
 
+import org.apache.qpidity.api.StreamingMessageListener;
+
 
 /**
  * CommonSessionDelegate
@@ -48,4 +50,35 @@
 
     @Override public void sessionDetached(Session session, SessionDetached struct) {}
 
+	@Override
+	public void messageTransfer(Session context, MessageTransfer struct)
+	{
+		StreamingMessageListener l = context.messagListeners.get(struct.getDestination());
+		l.messageTransfer(struct.getDestination(),new Option[0]);
+	}
+
+	// ---------------------------------------------------------------
+	//  Non generated methods - but would like if they are also generated.
+	//  These methods should be called from Body and Header Handlers.
+	//  If these methods are generated as part of the delegate then
+	//  I can call these methods from the BodyHandler and HeaderHandler
+	//  in a generic way
+	// ----------------------------------------------------------------
+	public void data(Session context,String destination,byte[] src) throws QpidException
+	{
+		StreamingMessageListener l = context.messagListeners.get(destination);
+		l.data(src);
+	}
+
+	public void endData(Session context,String destination) throws QpidException
+	{
+		StreamingMessageListener l = context.messagListeners.get(destination);
+		l.endData();
+	}
+
+	public void messageHeaders(Session context,String destination,Header... headers) throws
QpidException
+	{
+		StreamingMessageListener l = context.messagListeners.get(destination);
+		l.endData();		
+	}
 }

Modified: incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/HeaderHandler.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/HeaderHandler.java?view=diff&rev=561981&r1=561980&r2=561981
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/HeaderHandler.java
(original)
+++ incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/HeaderHandler.java
Wed Aug  1 15:27:55 2007
@@ -33,6 +33,7 @@
     public void handle(Event<C,Segment> event)
     {
         System.out.println("got header segment:\n  " + event.target);
+        
     }
 
 }

Modified: incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/Session.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/Session.java?view=diff&rev=561981&r1=561980&r2=561981
==============================================================================
--- incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/Session.java (original)
+++ incubator/qpid/trunk/qpid/java/common/src/main/java/org/apache/qpidity/Session.java Wed
Aug  1 15:27:55 2007
@@ -23,6 +23,9 @@
 import java.util.HashMap;
 import java.util.Map;
 
+import org.apache.qpidity.api.Message;
+import org.apache.qpidity.api.StreamingMessageListener;
+
 /**
  * Session
  *
@@ -37,6 +40,8 @@
     private int command_id = 0;
     // XXX
     final Map<Integer,Handler<Struct>> handlers = new HashMap<Integer,Handler<Struct>>();
+    
+    Map<String,StreamingMessageListener> messagListeners = new HashMap<String,StreamingMessageListener>();
   
 
     public void attach(Channel channel)
     {
@@ -61,4 +66,63 @@
         return channel.getFactory();
     }
 
+    // -----------------------------------------
+    //          Messaging Methods
+    // ------------------------------------------
+    public void messageTransfer(String destination, Message msg) throws QpidException
+	{
+				
+	}
+    
+	public void data(byte[] src) throws QpidException
+	{
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void endData() throws QpidException
+	{
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void messageHeaders(Header... headers) throws QpidException
+	{
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void messageTransfer(String destination,Option... options) throws QpidException
+	{
+		// TODO Auto-generated method stub
+		
+	}
+	
+	public void messageAcknowledge() throws QpidException
+	{
+		// TODO Auto-generated method stub		
+	}
+
+	public boolean messageAcquire() throws QpidException
+	{
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public void messageReject() throws QpidException
+	{
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void messageRelease() throws QpidException
+	{
+		// TODO Auto-generated method stub		
+	}	
+	
+    public void addMessageListener(String destination,StreamingMessageListener listener)
+    {
+    	messagListeners.put(destination, listener);
+    }    
+    
 }



Mime
View raw message