activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r515284 - in /activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp: StompFrame.java StompSslTransportFactory.java StompTransportFactory.java StompTransportFilter.java
Date Tue, 06 Mar 2007 20:24:12 GMT
Author: chirino
Date: Tue Mar  6 12:24:12 2007
New Revision: 515284

URL: http://svn.apache.org/viewvc?view=rev&rev=515284
Log:
Merged rev 515282 from 4.1 branch which add enhanced stomp tracing support

Modified:
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompFrame.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompSslTransportFactory.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompTransportFactory.java
    activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompTransportFilter.java

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompFrame.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompFrame.java?view=diff&rev=515284&r1=515283&r2=515284
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompFrame.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompFrame.java
Tue Mar  6 12:24:12 2007
@@ -17,8 +17,10 @@
  */
 package org.apache.activemq.transport.stomp;
 
+import java.util.Arrays;
 import java.util.Collections;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.Map;
 
 import org.apache.activemq.command.Command;
@@ -147,4 +149,26 @@
 		return false;
 	}
 
+	public String toString() {
+		StringBuffer buffer = new StringBuffer();
+		buffer.append(getAction());
+		buffer.append("\n");
+		Map headers = getHeaders();
+		for (Iterator iter = headers.entrySet().iterator(); iter.hasNext();) {
+			Map.Entry entry = (Map.Entry) iter.next();
+			buffer.append(entry.getKey());
+			buffer.append(":");
+			buffer.append(entry.getValue());
+			buffer.append("\n");
+		}
+		buffer.append("\n");
+		if( getContent()!=null ) {
+			try {
+				buffer.append(new String(getContent()));
+			} catch (Throwable e) {
+				buffer.append(Arrays.toString(getContent()));
+			}
+		}
+		return buffer.toString();
+	}
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompSslTransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompSslTransportFactory.java?view=diff&rev=515284&r1=515283&r2=515284
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompSslTransportFactory.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompSslTransportFactory.java
Tue Mar  6 12:24:12 2007
@@ -17,13 +17,13 @@
  */
 package org.apache.activemq.transport.stomp;
 
-import org.apache.activemq.transport.tcp.TcpTransportFactory;
-import org.apache.activemq.transport.tcp.SslTransportFactory;
+import java.util.Map;
+
 import org.apache.activemq.transport.Transport;
+import org.apache.activemq.transport.tcp.SslTransportFactory;
+import org.apache.activemq.util.IntrospectionSupport;
 import org.apache.activemq.wireformat.WireFormat;
 
-import java.util.Map;
-
 /**
  * A <a href="http://stomp.codehaus.org/">STOMP</a> over SSL transport factory
  *
@@ -37,6 +37,7 @@
 
     public Transport compositeConfigure(Transport transport, WireFormat format, Map options)
{
     	transport = new StompTransportFilter(transport, new LegacyFrameTranslator());
+    	IntrospectionSupport.setProperties(transport, options);
     	return super.compositeConfigure(transport, format, options);
     }
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompTransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompTransportFactory.java?view=diff&rev=515284&r1=515283&r2=515284
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompTransportFactory.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompTransportFactory.java
Tue Mar  6 12:24:12 2007
@@ -21,6 +21,7 @@
 
 import org.apache.activemq.transport.Transport;
 import org.apache.activemq.transport.tcp.TcpTransportFactory;
+import org.apache.activemq.util.IntrospectionSupport;
 import org.apache.activemq.wireformat.WireFormat;
 
 /**
@@ -36,6 +37,7 @@
 
     public Transport compositeConfigure(Transport transport, WireFormat format, Map options)
{
     	transport = new StompTransportFilter(transport, new LegacyFrameTranslator());
+    	IntrospectionSupport.setProperties(transport, options);
     	return super.compositeConfigure(transport, format, options);
     }
 

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompTransportFilter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompTransportFilter.java?view=diff&rev=515284&r1=515283&r2=515284
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompTransportFilter.java
(original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/transport/stomp/StompTransportFilter.java
Tue Mar  6 12:24:12 2007
@@ -25,6 +25,8 @@
 import org.apache.activemq.transport.Transport;
 import org.apache.activemq.transport.TransportFilter;
 import org.apache.activemq.util.IOExceptionSupport;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 
 /**
  * The StompTransportFilter normally sits on top of a TcpTransport
@@ -36,7 +38,7 @@
  * @author <a href="http://hiramchirino.com">chirino</a>
  */
 public class StompTransportFilter extends TransportFilter {
-
+	static final private Log log = LogFactory.getLog(StompTransportFilter.class);
     private final ProtocolConverter protocolConverter;
 
     private final Object sendToActiveMQMutex = new Object();
@@ -44,6 +46,8 @@
 
     private final FrameTranslator frameTranslator;
 
+    private boolean trace;
+    
     public StompTransportFilter(Transport next, FrameTranslator translator) {
 		super(next);
         this.frameTranslator = translator;
@@ -61,6 +65,9 @@
 
 	public void onCommand(Object command) {
         try {
+    		if( trace ) {
+    			log.trace("Received: \n"+command);
+    		}
         	protocolConverter.onStompCommad((StompFrame) command);
 		} catch (IOException e) {
 			onException(e);
@@ -76,6 +83,9 @@
 	}
 
 	public void sendToStomp(StompFrame command) throws IOException {
+		if( trace ) {
+			log.trace("Sending: \n"+command);
+		}
 		synchronized(sendToStompMutex) {
 			next.oneway(command);
 		}
@@ -85,4 +95,12 @@
     {
         return frameTranslator;
     }
+
+	public boolean isTrace() {
+		return trace;
+	}
+
+	public void setTrace(boolean trace) {
+		this.trace = trace;
+	}
 }



Mime
View raw message