qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From raj...@apache.org
Subject svn commit: r561976 - in /incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/impl: ClientSession.java SessionDelegate.java StreamingListenerAdapter.java
Date Wed, 01 Aug 2007 22:22:56 GMT
Author: rajith
Date: Wed Aug  1 15:22:54 2007
New Revision: 561976

URL: http://svn.apache.org/viewvc?view=rev&rev=561976
Log:
StreamingListenerAdapter - was added to adapt the StreamingMessageListener into a MessageListener
by assembling the message parts underneath and then when the message is complete it will call
onMessage() in the MessageListener



Added:
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/impl/StreamingListenerAdapter.java
Removed:
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/impl/SessionDelegate.java
Modified:
    incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/impl/ClientSession.java

Modified: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/impl/ClientSession.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/impl/ClientSession.java?view=diff&rev=561976&r1=561975&r2=561976
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/impl/ClientSession.java
(original)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/impl/ClientSession.java
Wed Aug  1 15:22:54 2007
@@ -1,63 +1,22 @@
 package org.apache.qpid.nclient.impl;
 
-import org.apache.qpid.nclient.api.Message;
-import org.apache.qpid.nclient.api.MessageReceiver;
-import org.apache.qpidity.Header;
+import java.util.Map;
+
+import org.apache.qpid.nclient.api.MessageListener;
 import org.apache.qpidity.Option;
 import org.apache.qpidity.QpidException;
 import org.apache.qpidity.Session;
 
 public class ClientSession extends Session implements org.apache.qpid.nclient.api.Session
 {	
-	/**
-	 * ---------------------------------------------------
-	 * Message methods
-	 * ---------------------------------------------------
-	 */
-	/*public MessageSender createSender(String queueName) throws QpidException
-	{
-		return null;
-	}*/
-
-	public MessageReceiver createReceiver(String queueName, Option... options) throws QpidException
-	{
-		// TODO Auto-generated method stub
-		return null;
-	}
-
-	public void setTransacted() throws QpidException, IllegalStateException
-	{
-		// TODO Auto-generated method stub
-		
-	}
-
-	public void messageBody(byte[] src) throws QpidException
+	public void addMessageListener(String destination,MessageListener listener)
 	{
-		// TODO Auto-generated method stub
-		
+		super.addMessageListener(destination, new StreamingListenerAdapter(listener));
 	}
-
-	public void messageClose() throws QpidException
+	
+	//temproary until rafi updates the xml when the new message stuff is voted in.
+	public void messageSubscribe(String queue, String destination, Map<String, ?> filter,
Option... _options) throws QpidException
 	{
-		// TODO Auto-generated method stub
-		
+		// TODO Auto-generated method stub		
 	}
-
-	public void messageHeaders(Header... headers) throws QpidException
-	{
-		// TODO Auto-generated method stub
-		
-	}
-
-	public void messageTransfer(String destination, Message msg) throws QpidException
-	{
-		// TODO Auto-generated method stub
-		
-	}
-
-	public void messageTransfer(Option... options) throws QpidException
-	{
-		// TODO Auto-generated method stub
-		
-	}	
 }

Added: incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/impl/StreamingListenerAdapter.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/impl/StreamingListenerAdapter.java?view=auto&rev=561976
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/impl/StreamingListenerAdapter.java
(added)
+++ incubator/qpid/trunk/qpid/java/client/src/main/java/org/apache/qpid/nclient/impl/StreamingListenerAdapter.java
Wed Aug  1 15:22:54 2007
@@ -0,0 +1,38 @@
+package org.apache.qpid.nclient.impl;
+
+import org.apache.qpid.nclient.api.MessageListener;
+import org.apache.qpidity.Header;
+import org.apache.qpidity.Option;
+import org.apache.qpidity.api.Message;
+import org.apache.qpidity.api.StreamingMessageListener;
+
+public class StreamingListenerAdapter implements StreamingMessageListener
+{
+	MessageListener _adaptee;
+	Message _currentMsg;
+	
+	public StreamingListenerAdapter(MessageListener l)
+	{
+		_adaptee = l;
+	}
+
+	public void data(byte[] src)
+	{
+		_currentMsg.appendData(src);
+	}
+
+	public void endData()
+	{
+		_adaptee.onMessage(_currentMsg);
+	}
+
+	public void messageHeaders(Header... headers)
+	{
+		//_currentMsg add the headers
+	}
+
+	public void messageTransfer(String destination, Option... options)
+	{
+		// _currentMsg create message from factory
+	}
+}



Mime
View raw message