activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r565003 [9/17] - in /activemq/trunk: activemq-fileserver/src/main/java/org/apache/activemq/util/ activemq-fileserver/src/test/java/org/apache/activemq/util/ activemq-jaas/src/main/java/org/apache/activemq/jaas/ activemq-jaas/src/test/java/o...
Date Sun, 12 Aug 2007 05:27:34 GMT
Modified: activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransport.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransport.java (original)
+++ activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransport.java Sat Aug 11 22:27:21 2007
@@ -40,12 +40,15 @@
  * @version $Revision$
  */
 public class HttpTransport extends HttpTransportSupport {
-    private static final Log log = LogFactory.getLog(HttpTransport.class);
+    
+    private static final Log LOG = LogFactory.getLog(HttpTransport.class);
+    
     private HttpURLConnection sendConnection;
     private HttpURLConnection receiveConnection;
     private URL url;
     private String clientID;
-//    private String sessionID;
+
+    // private String sessionID;
 
     public HttpTransport(TextWireFormat wireFormat, URI remoteUrl) throws MalformedURLException {
         super(wireFormat, remoteUrl);
@@ -53,12 +56,12 @@
     }
 
     public void oneway(Object o) throws IOException {
-    	final Command command = (Command) o;
+        final Command command = (Command)o;
         try {
-            if (command.getDataStructureType()==ConnectionInfo.DATA_STRUCTURE_TYPE) {
-                boolean startGetThread = clientID==null;
-                clientID=((ConnectionInfo)command).getClientId();
-                if( startGetThread && isStarted() ) {
+            if (command.getDataStructureType() == ConnectionInfo.DATA_STRUCTURE_TYPE) {
+                boolean startGetThread = clientID == null;
+                clientID = ((ConnectionInfo)command).getClientId();
+                if (startGetThread && isStarted()) {
                     try {
                         super.doStart();
                     } catch (Exception e) {
@@ -66,7 +69,7 @@
                     }
                 }
             }
-            
+
             HttpURLConnection connection = getSendConnection();
             String text = getTextWireFormat().marshalText(command);
             Writer writer = new OutputStreamWriter(connection.getOutputStream());
@@ -76,15 +79,14 @@
             if (answer != HttpURLConnection.HTTP_OK) {
                 throw new IOException("Failed to post command: " + command + " as response was: " + answer);
             }
-//            checkSession(connection);
-        }
-        catch (IOException e) {
+            // checkSession(connection);
+        } catch (IOException e) {
             throw IOExceptionSupport.create("Could not post command: " + command + " due to: " + e, e);
         }
     }
 
     public void run() {
-        log.trace("HTTP GET consumer thread starting for transport: " + this);
+        LOG.trace("HTTP GET consumer thread starting for transport: " + this);
         URI remoteUrl = getRemoteUrl();
         while (!isStopped()) {
             try {
@@ -92,54 +94,48 @@
                 int answer = connection.getResponseCode();
                 if (answer != HttpURLConnection.HTTP_OK) {
                     if (answer == HttpURLConnection.HTTP_CLIENT_TIMEOUT) {
-                        log.trace("GET timed out");
+                        LOG.trace("GET timed out");
+                    } else {
+                        LOG.warn("Failed to perform GET on: " + remoteUrl + " as response was: " + answer);
                     }
-                    else {
-                        log.warn("Failed to perform GET on: " + remoteUrl + " as response was: " + answer);
+                } else {
+                    // checkSession(connection);
+
+                    // Create a String for the UTF content
+                    InputStream is = connection.getInputStream();
+                    ByteArrayOutputStream baos = new ByteArrayOutputStream(connection.getContentLength() > 0 ? connection.getContentLength() : 1024);
+                    int c = 0;
+                    while ((c = is.read()) >= 0) {
+                        baos.write(c);
                     }
-                }
-                else {
-//                    checkSession(connection);
-                	
-                	// Create a String for the UTF content
-                	InputStream is = connection.getInputStream();
-                	ByteArrayOutputStream baos = new ByteArrayOutputStream(connection.getContentLength()>0?connection.getContentLength():1024);
-                	int c=0;
-                	while( (c=is.read())>= 0 ) {
-                		baos.write(c);
-                	}
-                	ByteSequence sequence = baos.toByteSequence();
-                	String data = new String(sequence.data, sequence.offset, sequence.length, "UTF-8");
-                	
-                    Command command = (Command) getTextWireFormat().unmarshalText(data);
-                    
+                    ByteSequence sequence = baos.toByteSequence();
+                    String data = new String(sequence.data, sequence.offset, sequence.length, "UTF-8");
+
+                    Command command = (Command)getTextWireFormat().unmarshalText(data);
+
                     if (command == null) {
-                        log.warn("Received null packet from url: " + remoteUrl);
-                    }
-                    else {
+                        LOG.warn("Received null packet from url: " + remoteUrl);
+                    } else {
                         doConsume(command);
                     }
                 }
-            }
-            catch (Throwable e) {
+            } catch (Throwable e) {
                 if (!isStopped()) {
-                    log.error("Failed to perform GET on: " + remoteUrl + " due to: " + e, e);
-                }
-                else {
-                    log.trace("Caught error after closed: " + e, e);
+                    LOG.error("Failed to perform GET on: " + remoteUrl + " due to: " + e, e);
+                } else {
+                    LOG.trace("Caught error after closed: " + e, e);
                 }
             } finally {
                 safeClose(receiveConnection);
-                receiveConnection=null;
+                receiveConnection = null;
             }
         }
     }
- 
 
     // Implementation methods
     // -------------------------------------------------------------------------
     protected HttpURLConnection createSendConnection() throws IOException {
-        HttpURLConnection conn = (HttpURLConnection) getRemoteURL().openConnection();
+        HttpURLConnection conn = (HttpURLConnection)getRemoteURL().openConnection();
         conn.setDoOutput(true);
         conn.setRequestMethod("POST");
         configureConnection(conn);
@@ -148,7 +144,7 @@
     }
 
     protected HttpURLConnection createReceiveConnection() throws IOException {
-        HttpURLConnection conn = (HttpURLConnection) getRemoteURL().openConnection();
+        HttpURLConnection conn = (HttpURLConnection)getRemoteURL().openConnection();
         conn.setDoOutput(false);
         conn.setDoInput(true);
         conn.setRequestMethod("GET");
@@ -157,21 +153,21 @@
         return conn;
     }
 
-//    protected void checkSession(HttpURLConnection connection)
-//    {
-//        String set_cookie=connection.getHeaderField("Set-Cookie");
-//        if (set_cookie!=null && set_cookie.startsWith("JSESSIONID="))
-//        {
-//            String[] bits=set_cookie.split("[=;]");
-//            sessionID=bits[1];
-//        }
-//    }
-    
+    // protected void checkSession(HttpURLConnection connection)
+    // {
+    // String set_cookie=connection.getHeaderField("Set-Cookie");
+    // if (set_cookie!=null && set_cookie.startsWith("JSESSIONID="))
+    // {
+    // String[] bits=set_cookie.split("[=;]");
+    // sessionID=bits[1];
+    // }
+    // }
+
     protected void configureConnection(HttpURLConnection connection) {
-//        if (sessionID !=null) {
-//            connection.addRequestProperty("Cookie", "JSESSIONID="+sessionID);
-//        }
-//        else
+        // if (sessionID !=null) {
+        // connection.addRequestProperty("Cookie", "JSESSIONID="+sessionID);
+        // }
+        // else
         if (clientID != null) {
             connection.setRequestProperty("clientID", clientID);
         }
@@ -202,12 +198,13 @@
     }
 
     protected void doStart() throws Exception {
-        // Don't start the background thread until the clientId has been established.
-        if( clientID != null ) {
+        // Don't start the background thread until the clientId has been
+        // established.
+        if (clientID != null) {
             super.doStart();
         }
     }
-    
+
     protected void doStop(ServiceStopper stopper) throws Exception {
         stopper.run(new Callback() {
             public void execute() throws Exception {
@@ -221,13 +218,12 @@
             }
         });
     }
-    
+
     /**
      * @param connection TODO
-     * 
      */
     private void safeClose(HttpURLConnection connection) {
-        if( connection!=null ) {
+        if (connection != null) {
             connection.disconnect();
         }
     }

Modified: activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportFactory.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportFactory.java (original)
+++ activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportFactory.java Sat Aug 11 22:27:21 2007
@@ -34,7 +34,8 @@
  * @version $Revision$
  */
 public class HttpTransportFactory extends TransportFactory {
-    private static final Log log = LogFactory.getLog(HttpTransportFactory.class);
+    
+    private static final Log LOG = LogFactory.getLog(HttpTransportFactory.class);
 
     public TransportServer doBind(String brokerId, URI location) throws IOException {
         return new HttpTransportServer(location);
@@ -42,9 +43,9 @@
 
     protected TextWireFormat asTextWireFormat(WireFormat wireFormat) {
         if (wireFormat instanceof TextWireFormat) {
-            return (TextWireFormat) wireFormat;
+            return (TextWireFormat)wireFormat;
         }
-        log.trace("Not created with a TextWireFormat: " + wireFormat);
+        LOG.trace("Not created with a TextWireFormat: " + wireFormat);
         return new XStreamWireFormat();
     }
 
@@ -53,17 +54,17 @@
     }
 
     protected Transport createTransport(URI location, WireFormat wf) throws IOException {
-		TextWireFormat textWireFormat = asTextWireFormat(wf);
-		return new HttpClientTransport(textWireFormat, location);
+        TextWireFormat textWireFormat = asTextWireFormat(wf);
+        return new HttpClientTransport(textWireFormat, location);
     }
-    
+
     public Transport compositeConfigure(Transport transport, WireFormat format, Map options) {
-    	HttpClientTransport httpTransport = (HttpClientTransport) super.compositeConfigure(transport, format, options);
-		transport = httpTransport;
-    	if( httpTransport.isTrace() ) {
-			transport = new TransportLogger(httpTransport);
-    	}
-		return transport;
+        HttpClientTransport httpTransport = (HttpClientTransport)super.compositeConfigure(transport, format, options);
+        transport = httpTransport;
+        if (httpTransport.isTrace()) {
+            transport = new TransportLogger(httpTransport);
+        }
+        return transport;
     }
 
 }

Modified: activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java (original)
+++ activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportServer.java Sat Aug 11 22:27:21 2007
@@ -16,6 +16,9 @@
  */
 package org.apache.activemq.transport.http;
 
+import java.net.InetSocketAddress;
+import java.net.URI;
+
 import org.apache.activemq.command.BrokerInfo;
 import org.apache.activemq.transport.TransportServerSupport;
 import org.apache.activemq.transport.util.TextWireFormat;
@@ -30,9 +33,6 @@
 import org.mortbay.jetty.servlet.ServletMapping;
 import org.mortbay.jetty.servlet.SessionHandler;
 
-import java.net.InetSocketAddress;
-import java.net.URI;
-
 /**
  * @version $Revision$
  */
@@ -72,39 +72,46 @@
     protected void setConnector(Connector connector) {
         this.connector = connector;
     }
-    
+
     protected void doStart() throws Exception {
         server = new Server();
-        if (connector==null)
+        if (connector == null) {
             connector = new SocketConnector();
+        }
         connector.setHost(bindAddress.getHost());
         connector.setPort(bindAddress.getPort());
         connector.setServer(server);
-        server.setConnectors(new Connector[] { connector });
+        server.setConnectors(new Connector[] {
+            connector
+        });
+
+        ContextHandler contextHandler = new ContextHandler();
+        contextHandler.setContextPath("/");
+        contextHandler.setServer(server);
+        server.setHandler(contextHandler);
+
+        SessionHandler sessionHandler = new SessionHandler();
+        contextHandler.setHandler(sessionHandler);
 
-        ContextHandler context_handler = new ContextHandler();
-        context_handler.setContextPath("/");
-        context_handler.setServer(server);
-        server.setHandler(context_handler);
-
-        SessionHandler session_handler = new SessionHandler();
-        context_handler.setHandler(session_handler);
-        
-        ServletHandler servlet_handler = new ServletHandler();
-        session_handler.setHandler(servlet_handler);
+        ServletHandler servletHandler = new ServletHandler();
+        sessionHandler.setHandler(servletHandler);
 
         ServletHolder holder = new ServletHolder();
         holder.setName("httpTunnel");
         holder.setClassName(HttpTunnelServlet.class.getName());
-        servlet_handler.setServlets(new ServletHolder[] { holder });
+        servletHandler.setServlets(new ServletHolder[] {
+            holder
+        });
 
         ServletMapping mapping = new ServletMapping();
         mapping.setServletName("httpTunnel");
         mapping.setPathSpec("/*");
-        servlet_handler.setServletMappings(new ServletMapping[] { mapping });
+        servletHandler.setServletMappings(new ServletMapping[] {
+            mapping
+        });
 
-        context_handler.setAttribute("acceptListener", getAcceptListener());
-        context_handler.setAttribute("wireFormat", getWireFormat());
+        contextHandler.setAttribute("acceptListener", getAcceptListener());
+        contextHandler.setAttribute("wireFormat", getWireFormat());
         server.start();
     }
 
@@ -116,7 +123,7 @@
         }
     }
 
-    public InetSocketAddress getSocketAddress() {        
+    public InetSocketAddress getSocketAddress() {
         return null;
     }
 

Modified: activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportSupport.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportSupport.java (original)
+++ activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTransportSupport.java Sat Aug 11 22:27:21 2007
@@ -16,10 +16,10 @@
  */
 package org.apache.activemq.transport.http;
 
+import java.net.URI;
+
 import org.apache.activemq.transport.TransportThreadSupport;
 import org.apache.activemq.transport.util.TextWireFormat;
-
-import java.net.URI;
 
 /**
  * A useful base class for HTTP Transport implementations.

Modified: activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTunnelServlet.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTunnelServlet.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTunnelServlet.java (original)
+++ activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/http/HttpTunnelServlet.java Sat Aug 11 22:27:21 2007
@@ -21,6 +21,8 @@
 import java.io.IOException;
 import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.TimeUnit;
 
 import javax.servlet.ServletException;
 import javax.servlet.http.HttpServlet;
@@ -35,9 +37,6 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import java.util.concurrent.ArrayBlockingQueue;
-import java.util.concurrent.TimeUnit;
-
 /**
  * A servlet which handles server side HTTP transport, delegating to the
  * ActiveMQ broker. This servlet is designed for being embedded inside an
@@ -47,46 +46,48 @@
  */
 public class HttpTunnelServlet extends HttpServlet {
     private static final long serialVersionUID = -3826714430767484333L;
-    private static final Log log = LogFactory.getLog(HttpTunnelServlet.class);
+    private static final Log LOG = LogFactory.getLog(HttpTunnelServlet.class);
 
     private TransportAcceptListener listener;
     private TextWireFormat wireFormat;
-    private Map clients = new HashMap();
+    private Map<String, BlockingQueueTransport> clients = new HashMap<String, BlockingQueueTransport>();
     private long requestTimeout = 30000L;
 
     public void init() throws ServletException {
         super.init();
-        listener = (TransportAcceptListener) getServletContext().getAttribute("acceptListener");
+        listener = (TransportAcceptListener)getServletContext().getAttribute("acceptListener");
         if (listener == null) {
             throw new ServletException("No such attribute 'acceptListener' available in the ServletContext");
         }
-        wireFormat = (TextWireFormat) getServletContext().getAttribute("wireFormat");
+        wireFormat = (TextWireFormat)getServletContext().getAttribute("wireFormat");
         if (wireFormat == null) {
             wireFormat = createWireFormat();
         }
     }
-    
+
     protected void doHead(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
         createTransportChannel(request, response);
     }
-    
+
     protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
         // lets return the next response
         Command packet = null;
-        int count=0;
+        int count = 0;
         try {
             BlockingQueueTransport transportChannel = getTransportChannel(request, response);
-            if (transportChannel == null)
+            if (transportChannel == null) {
                 return;
-            
-            packet = (Command) transportChannel.getQueue().poll(requestTimeout, TimeUnit.MILLISECONDS);
-            
+            }
+
+            packet = (Command)transportChannel.getQueue().poll(requestTimeout, TimeUnit.MILLISECONDS);
+
             DataOutputStream stream = new DataOutputStream(response.getOutputStream());
-//            while( packet !=null ) {
-            	wireFormat.marshal(packet, stream);
-            	count++;
-//            	packet = (Command) transportChannel.getQueue().poll(0, TimeUnit.MILLISECONDS);
-//            }
+            // while( packet !=null ) {
+            wireFormat.marshal(packet, stream);
+            count++;
+            // packet = (Command) transportChannel.getQueue().poll(0,
+            // TimeUnit.MILLISECONDS);
+            // }
 
         } catch (InterruptedException ignore) {
         }
@@ -98,10 +99,10 @@
     protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
 
         // Read the command directly from the reader
-        Command command = (Command) wireFormat.unmarshalText(request.getReader());
+        Command command = (Command)wireFormat.unmarshalText(request.getReader());
 
         if (command instanceof WireFormatInfo) {
-            WireFormatInfo info = (WireFormatInfo) command;
+            WireFormatInfo info = (WireFormatInfo)command;
             if (!canProcessWireFormatVersion(info.getVersion())) {
                 response.sendError(HttpServletResponse.SC_NOT_FOUND, "Cannot process wire format of version: " + info.getVersion());
             }
@@ -109,9 +110,10 @@
         } else {
 
             BlockingQueueTransport transport = getTransportChannel(request, response);
-            if (transport == null)
+            if (transport == null) {
                 return;
-            
+            }
+
             transport.doConsume(command);
         }
     }
@@ -128,8 +130,7 @@
             String line = reader.readLine();
             if (line == null) {
                 break;
-            }
-            else {
+            } else {
                 buffer.append(line);
                 buffer.append("\n");
             }
@@ -141,39 +142,39 @@
         String clientID = request.getHeader("clientID");
         if (clientID == null) {
             response.sendError(HttpServletResponse.SC_BAD_REQUEST, "No clientID header specified");
-            log.warn("No clientID header specified");
+            LOG.warn("No clientID header specified");
             return null;
         }
         synchronized (this) {
-            BlockingQueueTransport answer = (BlockingQueueTransport) clients.get(clientID);
+            BlockingQueueTransport answer = clients.get(clientID);
             if (answer == null) {
-                log.warn("The clientID header specified is invalid. Client sesion has not yet been established for it: "+clientID);
+                LOG.warn("The clientID header specified is invalid. Client sesion has not yet been established for it: " + clientID);
                 return null;
             }
             return answer;
         }
     }
-    
+
     protected BlockingQueueTransport createTransportChannel(HttpServletRequest request, HttpServletResponse response) throws IOException {
         String clientID = request.getHeader("clientID");
-        
+
         if (clientID == null) {
             response.sendError(HttpServletResponse.SC_BAD_REQUEST, "No clientID header specified");
-            log.warn("No clientID header specified");
+            LOG.warn("No clientID header specified");
             return null;
         }
-        
+
         synchronized (this) {
-            BlockingQueueTransport answer = (BlockingQueueTransport) clients.get(clientID);
+            BlockingQueueTransport answer = clients.get(clientID);
             if (answer != null) {
-                response.sendError(HttpServletResponse.SC_BAD_REQUEST, "A session for clientID '"+clientID+"' has allready been established");
-                log.warn("A session for clientID '"+clientID+"' has allready been established");
+                response.sendError(HttpServletResponse.SC_BAD_REQUEST, "A session for clientID '" + clientID + "' has allready been established");
+                LOG.warn("A session for clientID '" + clientID + "' has allready been established");
                 return null;
             }
-            
+
             answer = createTransportChannel();
             clients.put(clientID, answer);
-            listener.onAccept(answer);            
+            listener.onAccept(answer);
             return answer;
         }
     }

Modified: activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/https/HttpsTransport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/https/HttpsTransport.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/https/HttpsTransport.java (original)
+++ activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/https/HttpsTransport.java Sat Aug 11 22:27:21 2007
@@ -16,15 +16,15 @@
  */
 package org.apache.activemq.transport.https;
 
-import org.apache.activemq.transport.http.HttpTransport;
-import org.apache.activemq.transport.util.TextWireFormat;
-
-import javax.net.ssl.HttpsURLConnection;
-
 import java.io.IOException;
 import java.net.HttpURLConnection;
 import java.net.MalformedURLException;
 import java.net.URI;
+
+import javax.net.ssl.HttpsURLConnection;
+
+import org.apache.activemq.transport.http.HttpTransport;
+import org.apache.activemq.transport.util.TextWireFormat;
 
 public class HttpsTransport extends HttpTransport {
 

Modified: activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/https/HttpsTransportServer.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/https/HttpsTransportServer.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/https/HttpsTransportServer.java (original)
+++ activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/https/HttpsTransportServer.java Sat Aug 11 22:27:21 2007
@@ -16,121 +16,121 @@
  */
 package org.apache.activemq.transport.https;
 
+import java.net.URI;
+
 import org.apache.activemq.transport.http.HttpTransportServer;
 import org.mortbay.jetty.security.SslSocketConnector;
 
-import java.net.URI;
-
 public class HttpsTransportServer extends HttpTransportServer {
 
-	private String keyPassword = System.getProperty( "javax.net.ssl.keyPassword" );
-	private String keyStorePassword = System.getProperty( "javax.net.ssl.keyStorePassword" );
-	private String keyStore = System.getProperty( "javax.net.ssl.keyStore" );
-	private String keyStoreType = null;
-	private String secureRandomCertficateAlgorithm = null;
-	private String trustCertificateAlgorithm = null;
-	private String keyCertificateAlgorithm = null;
-	private String protocol = null;
-	
-	public HttpsTransportServer( URI uri ) {
-		super( uri );
-	}
-
-	public void doStart() throws Exception {
-		SslSocketConnector sslConnector = new SslSocketConnector();
-		sslConnector.setKeystore( keyStore );
-		sslConnector.setPassword( keyStorePassword );
-		// if the keyPassword hasn't been set, default it to the
-		// key store password
-		if ( keyPassword == null ) {
-			sslConnector.setKeyPassword( keyStorePassword );	
-		}
-		if ( keyStoreType != null ) {
-			sslConnector.setKeystoreType( keyStoreType );
-		}
-		if ( secureRandomCertficateAlgorithm != null ) {
-			sslConnector.setSecureRandomAlgorithm( secureRandomCertficateAlgorithm );
-		}
-		if ( keyCertificateAlgorithm != null ) {
-			sslConnector.setSslKeyManagerFactoryAlgorithm( keyCertificateAlgorithm );
-		}
-		if ( trustCertificateAlgorithm != null ) {
-			sslConnector.setSslTrustManagerFactoryAlgorithm( trustCertificateAlgorithm );
-		}
-		if ( protocol != null ) {
-			sslConnector.setProtocol( protocol );
-		}
-		
+    private String keyPassword = System.getProperty("javax.net.ssl.keyPassword");
+    private String keyStorePassword = System.getProperty("javax.net.ssl.keyStorePassword");
+    private String keyStore = System.getProperty("javax.net.ssl.keyStore");
+    private String keyStoreType;
+    private String secureRandomCertficateAlgorithm;
+    private String trustCertificateAlgorithm;
+    private String keyCertificateAlgorithm;
+    private String protocol;
+
+    public HttpsTransportServer(URI uri) {
+        super(uri);
+    }
+
+    public void doStart() throws Exception {
+        SslSocketConnector sslConnector = new SslSocketConnector();
+        sslConnector.setKeystore(keyStore);
+        sslConnector.setPassword(keyStorePassword);
+        // if the keyPassword hasn't been set, default it to the
+        // key store password
+        if (keyPassword == null) {
+            sslConnector.setKeyPassword(keyStorePassword);
+        }
+        if (keyStoreType != null) {
+            sslConnector.setKeystoreType(keyStoreType);
+        }
+        if (secureRandomCertficateAlgorithm != null) {
+            sslConnector.setSecureRandomAlgorithm(secureRandomCertficateAlgorithm);
+        }
+        if (keyCertificateAlgorithm != null) {
+            sslConnector.setSslKeyManagerFactoryAlgorithm(keyCertificateAlgorithm);
+        }
+        if (trustCertificateAlgorithm != null) {
+            sslConnector.setSslTrustManagerFactoryAlgorithm(trustCertificateAlgorithm);
+        }
+        if (protocol != null) {
+            sslConnector.setProtocol(protocol);
+        }
+
         setConnector(sslConnector);
-		
-		super.doStart();
-	}
-	
-	// Properties
-	//--------------------------------------------------------------------------------
-	
-	public String getKeyStore() {
-		return keyStore;
-	}
-
-	public void setKeyStore( String keyStore ) {
-		this.keyStore = keyStore;
-	}
-
-	public String getKeyPassword() {
-		return keyPassword;
-	}
-
-	public void setKeyPassword( String keyPassword ) {
-		this.keyPassword = keyPassword;
-	}
-
-	public String getKeyStoreType() {
-		return keyStoreType;
-	}
-
-	public void setKeyStoreType( String keyStoreType ) {
-		this.keyStoreType = keyStoreType;
-	}
-
-	public String getKeyStorePassword() {
-		return keyStorePassword;
-	}
-
-	public void setKeyStorePassword( String keyStorePassword ) {
-		this.keyStorePassword = keyStorePassword;
-	}
-
-	public String getProtocol() {
-		return protocol;
-	}
-
-	public void setProtocol( String protocol ) {
-		this.protocol = protocol;
-	}
-
-	public String getSecureRandomCertficateAlgorithm() {
-		return secureRandomCertficateAlgorithm;
-	}
-
-	public void setSecureRandomCertficateAlgorithm(String secureRandomCertficateAlgorithm) {
-		this.secureRandomCertficateAlgorithm = secureRandomCertficateAlgorithm;
-	}
-
-	public String getKeyCertificateAlgorithm() {
-		return keyCertificateAlgorithm;
-	}
-
-	public void setKeyCertificateAlgorithm(String keyCertificateAlgorithm) {
-		this.keyCertificateAlgorithm = keyCertificateAlgorithm;
-	}
-
-	public String getTrustCertificateAlgorithm() {
-		return trustCertificateAlgorithm;
-	}
-
-	public void setTrustCertificateAlgorithm(String trustCertificateAlgorithm) {
-		this.trustCertificateAlgorithm = trustCertificateAlgorithm;
-	}
+
+        super.doStart();
+    }
+
+    // Properties
+    // --------------------------------------------------------------------------------
+
+    public String getKeyStore() {
+        return keyStore;
+    }
+
+    public void setKeyStore(String keyStore) {
+        this.keyStore = keyStore;
+    }
+
+    public String getKeyPassword() {
+        return keyPassword;
+    }
+
+    public void setKeyPassword(String keyPassword) {
+        this.keyPassword = keyPassword;
+    }
+
+    public String getKeyStoreType() {
+        return keyStoreType;
+    }
+
+    public void setKeyStoreType(String keyStoreType) {
+        this.keyStoreType = keyStoreType;
+    }
+
+    public String getKeyStorePassword() {
+        return keyStorePassword;
+    }
+
+    public void setKeyStorePassword(String keyStorePassword) {
+        this.keyStorePassword = keyStorePassword;
+    }
+
+    public String getProtocol() {
+        return protocol;
+    }
+
+    public void setProtocol(String protocol) {
+        this.protocol = protocol;
+    }
+
+    public String getSecureRandomCertficateAlgorithm() {
+        return secureRandomCertficateAlgorithm;
+    }
+
+    public void setSecureRandomCertficateAlgorithm(String secureRandomCertficateAlgorithm) {
+        this.secureRandomCertficateAlgorithm = secureRandomCertficateAlgorithm;
+    }
+
+    public String getKeyCertificateAlgorithm() {
+        return keyCertificateAlgorithm;
+    }
+
+    public void setKeyCertificateAlgorithm(String keyCertificateAlgorithm) {
+        this.keyCertificateAlgorithm = keyCertificateAlgorithm;
+    }
+
+    public String getTrustCertificateAlgorithm() {
+        return trustCertificateAlgorithm;
+    }
+
+    public void setTrustCertificateAlgorithm(String trustCertificateAlgorithm) {
+        this.trustCertificateAlgorithm = trustCertificateAlgorithm;
+    }
 
 }

Modified: activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/util/TextWireFormat.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/util/TextWireFormat.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/util/TextWireFormat.java (original)
+++ activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/util/TextWireFormat.java Sat Aug 11 22:27:21 2007
@@ -34,8 +34,10 @@
  */
 public abstract class TextWireFormat implements WireFormat {
 
-    public abstract Object unmarshalText(String text);    
+    public abstract Object unmarshalText(String text);
+
     public abstract Object unmarshalText(Reader reader);
+
     public abstract String marshalText(Object command);
 
     public void marshal(Object command, DataOutput out) throws IOException {
@@ -45,9 +47,9 @@
     public Object unmarshal(DataInput in) throws IOException {
         String text = in.readUTF();
         return unmarshalText(text);
-	}
-    
-	public ByteSequence marshal(Object command) throws IOException {
+    }
+
+    public ByteSequence marshal(Object command) throws IOException {
         ByteArrayOutputStream baos = new ByteArrayOutputStream();
         DataOutputStream dos = new DataOutputStream(baos);
         marshal(command, dos);

Modified: activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/xstream/XStreamWireFormat.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/xstream/XStreamWireFormat.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/xstream/XStreamWireFormat.java (original)
+++ activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/transport/xstream/XStreamWireFormat.java Sat Aug 11 22:27:21 2007
@@ -18,12 +18,12 @@
 
 import java.io.Reader;
 
+import com.thoughtworks.xstream.XStream;
+
 import org.apache.activemq.command.Command;
 import org.apache.activemq.transport.util.TextWireFormat;
 import org.apache.activemq.wireformat.WireFormat;
 
-import com.thoughtworks.xstream.XStream;
-
 /**
  * A {@link WireFormat} implementation which uses the <a
  * href="http://xstream.codehaus.org/>XStream</a> library to marshall commands
@@ -43,29 +43,26 @@
         this.version = version;
     }
 
-
     public WireFormat copy() {
         return new XStreamWireFormat();
     }
 
-
     public Object unmarshalText(String text) {
-        return (Command) getXStream().fromXML(text);
+        return (Command)getXStream().fromXML(text);
     }
-    
+
     public Object unmarshalText(Reader reader) {
-        return (Command) getXStream().fromXML(reader);
+        return (Command)getXStream().fromXML(reader);
     }
 
-	public String marshalText(Object command) {
+    public String marshalText(Object command) {
         return getXStream().toXML(command);
     }
 
     /**
      * Can this wireformat process packets of this version
      * 
-     * @param version
-     *            the version number to test
+     * @param version the version number to test
      * @return true if can accept the version
      */
     public boolean canProcessWireFormatVersion(int version) {
@@ -98,5 +95,4 @@
         return new XStream();
     }
 
-	
 }

Modified: activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/util/JmsLogAppender.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/util/JmsLogAppender.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/util/JmsLogAppender.java (original)
+++ activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/util/JmsLogAppender.java Sat Aug 11 22:27:21 2007
@@ -18,15 +18,15 @@
 
 import java.net.URISyntaxException;
 
-import org.apache.activemq.ActiveMQConnection;
-
 import javax.jms.Connection;
 import javax.jms.JMSException;
 
+import org.apache.activemq.ActiveMQConnection;
+
 /**
- * A JMS 1.1 log4j appender which uses ActiveMQ by default and does not require any JNDI
- * configurations
- *
+ * A JMS 1.1 log4j appender which uses ActiveMQ by default and does not require
+ * any JNDI configurations
+ * 
  * @version $Revision$
  */
 public class JmsLogAppender extends JmsLogAppenderSupport {
@@ -66,20 +66,13 @@
             try {
                 return ActiveMQConnection.makeConnection(userName, password, uri);
             } catch (URISyntaxException e) {
-                throw new JMSException("Unable to connect to a broker using " + 
-                        "userName: \'" + userName + 
-                        "\' password \'" + password + 
-                        "\' uri \'" + uri + "\' :: error - " +
-                        e.getMessage());
+                throw new JMSException("Unable to connect to a broker using " + "userName: \'" + userName + "\' password \'" + password + "\' uri \'" + uri + "\' :: error - " + e.getMessage());
             }
-        }
-        else {
+        } else {
             try {
                 return ActiveMQConnection.makeConnection(uri);
             } catch (URISyntaxException e) {
-                throw new JMSException("Unable to connect to a broker using " + 
-                        "uri \'" + uri + "\' :: error - " +
-                        e.getMessage());
+                throw new JMSException("Unable to connect to a broker using " + "uri \'" + uri + "\' :: error - " + e.getMessage());
             }
         }
     }

Modified: activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/util/JmsLogAppenderSupport.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/util/JmsLogAppenderSupport.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/util/JmsLogAppenderSupport.java (original)
+++ activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/util/JmsLogAppenderSupport.java Sat Aug 11 22:27:21 2007
@@ -16,8 +16,10 @@
  */
 package org.apache.activemq.util;
 
-import org.apache.log4j.AppenderSkeleton;
-import org.apache.log4j.spi.LoggingEvent;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
 
 import javax.jms.Connection;
 import javax.jms.Destination;
@@ -26,14 +28,14 @@
 import javax.jms.MessageProducer;
 import javax.jms.Session;
 import javax.naming.NamingException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
+
+import org.apache.log4j.AppenderSkeleton;
+import org.apache.log4j.spi.LoggingEvent;
 
 /**
- * An abstract base class for implementation inheritence for a log4j JMS appender
- *
+ * An abstract base class for implementation inheritence for a log4j JMS
+ * appender
+ * 
  * @version $Revision$
  */
 public abstract class JmsLogAppenderSupport extends AppenderSkeleton {
@@ -83,33 +85,30 @@
     }
 
     public void close() {
-        List errors = new ArrayList();
+        List<JMSException> errors = new ArrayList<JMSException>();
         if (producer != null) {
             try {
                 producer.close();
-            }
-            catch (JMSException e) {
+            } catch (JMSException e) {
                 errors.add(e);
             }
         }
         if (session != null) {
             try {
                 session.close();
-            }
-            catch (JMSException e) {
+            } catch (JMSException e) {
                 errors.add(e);
             }
         }
         if (connection != null) {
             try {
                 connection.close();
-            }
-            catch (JMSException e) {
+            } catch (JMSException e) {
                 errors.add(e);
             }
         }
-        for (Iterator iter = errors.iterator(); iter.hasNext();) {
-            JMSException e = (JMSException) iter.next();
+        for (Iterator<JMSException> iter = errors.iterator(); iter.hasNext();) {
+            JMSException e = iter.next();
             getErrorHandler().error("Error closing JMS resources: " + e, e, JMS_PUBLISH_ERROR_CODE);
         }
     }
@@ -122,15 +121,13 @@
         try {
             // lets ensure we're all created
             getProducer();
-        }
-        catch (Exception e) {
+        } catch (Exception e) {
             getErrorHandler().error("Could not create JMS resources: " + e, e, JMS_PUBLISH_ERROR_CODE);
         }
     }
 
-
     // Implementation methods
-    //-------------------------------------------------------------------------
+    // -------------------------------------------------------------------------
     protected abstract Connection createConnection() throws JMSException, NamingException;
 
     protected Session createSession() throws JMSException, NamingException {
@@ -146,8 +143,7 @@
             Message message = createMessage(event);
             Destination destination = getDestination(event);
             getProducer().send(destination, message);
-        }
-        catch (Exception e) {
+        } catch (Exception e) {
             getErrorHandler().error("Could not send message due to: " + e, e, JMS_PUBLISH_ERROR_CODE, event);
         }
     }
@@ -156,10 +152,9 @@
         Message answer = null;
         Object value = event.getMessage();
         if (allowTextMessages && value instanceof String) {
-            answer = getSession().createTextMessage((String) value);
-        }
-        else {
-            answer = getSession().createObjectMessage((Serializable) value);
+            answer = getSession().createTextMessage((String)value);
+        } else {
+            answer = getSession().createObjectMessage((Serializable)value);
         }
         answer.setStringProperty("level", event.getLevel().toString());
         answer.setIntProperty("levelInt", event.getLevel().toInt());

Modified: activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/util/JndiJmsLogAppender.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/util/JndiJmsLogAppender.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/util/JndiJmsLogAppender.java (original)
+++ activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/util/JndiJmsLogAppender.java Sat Aug 11 22:27:21 2007
@@ -16,7 +16,7 @@
  */
 package org.apache.activemq.util;
 
-import org.apache.log4j.helpers.LogLog;
+import java.util.Hashtable;
 
 import javax.jms.Connection;
 import javax.jms.ConnectionFactory;
@@ -24,12 +24,13 @@
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
-import java.util.Hashtable;
+
+import org.apache.log4j.helpers.LogLog;
 
 /**
- * A JMS 1.1 log4j appender which uses JNDI to locate a JMS ConnectionFactory
- * to use for logging events.
- *
+ * A JMS 1.1 log4j appender which uses JNDI to locate a JMS ConnectionFactory to
+ * use for logging events.
+ * 
  * @version $Revision$
  */
 public class JndiJmsLogAppender extends JmsLogAppenderSupport {
@@ -71,9 +72,8 @@
         this.password = password;
     }
 
-
     // to customize the JNDI context
-    //-------------------------------------------------------------------------
+    // -------------------------------------------------------------------------
     public String getInitialContextFactoryName() {
         return initialContextFactoryName;
     }
@@ -115,18 +115,17 @@
     }
 
     // Implementation methods
-    //-------------------------------------------------------------------------
+    // -------------------------------------------------------------------------
     protected Connection createConnection() throws JMSException, NamingException {
         InitialContext context = createInitialContext();
         LogLog.debug("Looking up ConnectionFactory with jndiName: " + jndiName);
-        ConnectionFactory factory = (ConnectionFactory) context.lookup(jndiName);
+        ConnectionFactory factory = (ConnectionFactory)context.lookup(jndiName);
         if (factory == null) {
             throw new JMSException("No such ConnectionFactory for name: " + jndiName);
         }
         if (userName != null) {
             return factory.createConnection(userName, password);
-        }
-        else {
+        } else {
             return factory.createConnection();
         }
     }
@@ -134,16 +133,13 @@
     protected InitialContext createInitialContext() throws NamingException {
         if (initialContextFactoryName == null) {
             return new InitialContext();
-        }
-        else {
+        } else {
             Hashtable<String, String> env = new Hashtable<String, String>();
             env.put(Context.INITIAL_CONTEXT_FACTORY, initialContextFactoryName);
             if (providerURL != null) {
                 env.put(Context.PROVIDER_URL, providerURL);
-            }
-            else {
-                LogLog.warn("You have set InitialContextFactoryName option but not the "
-                        + "ProviderURL. This is likely to cause problems.");
+            } else {
+                LogLog.warn("You have set InitialContextFactoryName option but not the " + "ProviderURL. This is likely to cause problems.");
             }
             if (urlPkgPrefixes != null) {
                 env.put(Context.URL_PKG_PREFIXES, urlPkgPrefixes);
@@ -153,10 +149,8 @@
                 env.put(Context.SECURITY_PRINCIPAL, securityPrincipalName);
                 if (securityCredentials != null) {
                     env.put(Context.SECURITY_CREDENTIALS, securityCredentials);
-                }
-                else {
-                    LogLog.warn("You have set SecurityPrincipalName option but not the "
-                            + "SecurityCredentials. This is likely to cause problems.");
+                } else {
+                    LogLog.warn("You have set SecurityPrincipalName option but not the " + "SecurityCredentials. This is likely to cause problems.");
                 }
             }
             LogLog.debug("Looking up JNDI context with environment: " + env);

Modified: activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/util/xstream/XStreamMessageTransformer.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/util/xstream/XStreamMessageTransformer.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/util/xstream/XStreamMessageTransformer.java (original)
+++ activemq/trunk/activemq-optional/src/main/java/org/apache/activemq/util/xstream/XStreamMessageTransformer.java Sat Aug 11 22:27:21 2007
@@ -16,12 +16,9 @@
  */
 package org.apache.activemq.util.xstream;
 
-import com.thoughtworks.xstream.XStream;
-import com.thoughtworks.xstream.io.HierarchicalStreamReader;
-import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
-import com.thoughtworks.xstream.io.xml.PrettyPrintWriter;
-import com.thoughtworks.xstream.io.xml.XppReader;
-import org.apache.activemq.MessageTransformerSupport;
+import java.io.Serializable;
+import java.io.StringReader;
+import java.io.StringWriter;
 
 import javax.jms.JMSException;
 import javax.jms.Message;
@@ -30,83 +27,74 @@
 import javax.jms.ObjectMessage;
 import javax.jms.Session;
 import javax.jms.TextMessage;
-import java.io.Serializable;
-import java.io.StringReader;
-import java.io.StringWriter;
+
+import com.thoughtworks.xstream.XStream;
+import com.thoughtworks.xstream.io.HierarchicalStreamReader;
+import com.thoughtworks.xstream.io.HierarchicalStreamWriter;
+import com.thoughtworks.xstream.io.xml.PrettyPrintWriter;
+import com.thoughtworks.xstream.io.xml.XppReader;
+
+import org.apache.activemq.MessageTransformerSupport;
 
 /**
- * Transforms object messages to text messages and vice versa using {@link XStream}
- *
+ * Transforms object messages to text messages and vice versa using
+ * {@link XStream}
+ * 
  * @version $Revision$
  */
 public class XStreamMessageTransformer extends MessageTransformerSupport {
+
+    protected MessageTransform transformType;
     private XStream xStream;
 
     /**
-     * Defines the type of transformation.
-     * If XML (default),
-     *  - producer transformation transforms from Object to XML.
-     *  - consumer transformation transforms from XML to Object.
-     * If OBJECT,
-     *  - producer transformation transforms from XML to Object.
-     *  - consumer transformation transforms from Object to XML.
-     * If ADAPTIVE,
-     *  - producer transformation transforms from Object to XML, or XML to Object
-     *    depending on the type of the original message
-     *  - consumer transformation transforms from XML to Object, or Object to XML
-     *    depending on the type of the original message
-	 */
-	public enum MessageTransform {XML, OBJECT, ADAPTIVE};
+     * Defines the type of transformation. If XML (default), - producer
+     * transformation transforms from Object to XML. - consumer transformation
+     * transforms from XML to Object. If OBJECT, - producer transformation
+     * transforms from XML to Object. - consumer transformation transforms from
+     * Object to XML. If ADAPTIVE, - producer transformation transforms from
+     * Object to XML, or XML to Object depending on the type of the original
+     * message - consumer transformation transforms from XML to Object, or
+     * Object to XML depending on the type of the original message
+     */
+    public enum MessageTransform {
+        XML, OBJECT, ADAPTIVE
+    };
 
-    protected MessageTransform transformType;
 
     public XStreamMessageTransformer() {
-		this(MessageTransform.XML);
-	}
+        this(MessageTransform.XML);
+    }
 
-	public XStreamMessageTransformer(MessageTransform transformType) {
-		this.transformType = transformType;
-	}
+    public XStreamMessageTransformer(MessageTransform transformType) {
+        this.transformType = transformType;
+    }
 
     public Message consumerTransform(Session session, MessageConsumer consumer, Message message) throws JMSException {
-		switch (transformType) {
-            case XML:
-                return (message instanceof TextMessage) ?
-                        textToObject(session, (TextMessage)message) :
-                        message;
-            case OBJECT:
-                return (message instanceof ObjectMessage) ?
-                        objectToText(session, (ObjectMessage)message) :
-                        message;
-            case ADAPTIVE:
-                return (message instanceof TextMessage) ?
-                        textToObject(session, (TextMessage)message) :
-                       (message instanceof ObjectMessage) ?
-                        objectToText(session, (ObjectMessage)message) :
-                        message;
+        switch (transformType) {
+        case XML:
+            return (message instanceof TextMessage) ? textToObject(session, (TextMessage)message) : message;
+        case OBJECT:
+            return (message instanceof ObjectMessage) ? objectToText(session, (ObjectMessage)message) : message;
+        case ADAPTIVE:
+            return (message instanceof TextMessage) ? textToObject(session, (TextMessage)message) : (message instanceof ObjectMessage) ? objectToText(session, (ObjectMessage)message) : message;
+        default:
         }
         return message;
     }
 
-	public Message producerTransform(Session session, MessageProducer producer, Message message) throws JMSException {
-		switch (transformType) {
-            case XML:
-                return (message instanceof ObjectMessage) ?
-                        objectToText(session, (ObjectMessage)message) :
-                        message;
-            case OBJECT:
-                return (message instanceof TextMessage) ?
-                        textToObject(session, (TextMessage)message) :
-                        message;
-            case ADAPTIVE:
-                return (message instanceof TextMessage) ?
-                        textToObject(session, (TextMessage)message) :
-                       (message instanceof ObjectMessage) ?
-                        objectToText(session, (ObjectMessage)message) :
-                        message;
+    public Message producerTransform(Session session, MessageProducer producer, Message message) throws JMSException {
+        switch (transformType) {
+        case XML:
+            return (message instanceof ObjectMessage) ? objectToText(session, (ObjectMessage)message) : message;
+        case OBJECT:
+            return (message instanceof TextMessage) ? textToObject(session, (TextMessage)message) : message;
+        case ADAPTIVE:
+            return (message instanceof TextMessage) ? textToObject(session, (TextMessage)message) : (message instanceof ObjectMessage) ? objectToText(session, (ObjectMessage)message) : message;
+        default:
         }
         return message;
-	}
+    }
 
     // Properties
     // -------------------------------------------------------------------------
@@ -136,7 +124,9 @@
     }
 
     /**
-     * Transforms an incoming XML encoded {@link TextMessage} to an {@link ObjectMessage}
+     * Transforms an incoming XML encoded {@link TextMessage} to an
+     * {@link ObjectMessage}
+     * 
      * @param session - JMS session currently being used
      * @param textMessage - text message to transform to object message
      * @return ObjectMessage
@@ -145,17 +135,18 @@
     protected ObjectMessage textToObject(Session session, TextMessage textMessage) throws JMSException {
         Object object = unmarshall(session, textMessage);
         if (object instanceof Serializable) {
-            ObjectMessage answer = session.createObjectMessage((Serializable) object);
+            ObjectMessage answer = session.createObjectMessage((Serializable)object);
             copyProperties(textMessage, answer);
             return answer;
-        }
-        else {
+        } else {
             throw new JMSException("Object is not serializable: " + object);
         }
-	}
+    }
 
     /**
-     * Transforms an incoming {@link ObjectMessage} to an XML encoded {@link TextMessage}
+     * Transforms an incoming {@link ObjectMessage} to an XML encoded
+     * {@link TextMessage}
+     * 
      * @param session - JMS session currently being used
      * @param objectMessage - object message to transform to text message
      * @return XML encoded TextMessage
@@ -165,10 +156,11 @@
         TextMessage answer = session.createTextMessage(marshall(session, objectMessage));
         copyProperties(objectMessage, answer);
         return answer;
-	}
+    }
 
     /**
-     * Marshalls the Object in the {@link ObjectMessage} to a string using XML encoding
+     * Marshalls the Object in the {@link ObjectMessage} to a string using XML
+     * encoding
      */
     protected String marshall(Session session, ObjectMessage objectMessage) throws JMSException {
         Serializable object = objectMessage.getObject();
@@ -178,9 +170,9 @@
         return buffer.toString();
     }
 
-
-	/**
-     * Unmarshalls the XML encoded message in the {@link TextMessage} to an Object
+    /**
+     * Unmarshalls the XML encoded message in the {@link TextMessage} to an
+     * Object
      */
     protected Object unmarshall(Session session, TextMessage textMessage) throws JMSException {
         HierarchicalStreamReader in = new XppReader(new StringReader(textMessage.getText()));

Modified: activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpJmsDurableTopicSendReceiveTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpJmsDurableTopicSendReceiveTest.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpJmsDurableTopicSendReceiveTest.java (original)
+++ activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpJmsDurableTopicSendReceiveTest.java Sat Aug 11 22:27:21 2007
@@ -16,8 +16,8 @@
  */
 package org.apache.activemq.transport.http;
 
-import org.apache.activemq.JmsDurableTopicSendReceiveTest;
 import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.JmsDurableTopicSendReceiveTest;
 import org.apache.activemq.broker.BrokerService;
 
 public class HttpJmsDurableTopicSendReceiveTest extends JmsDurableTopicSendReceiveTest {

Modified: activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpPersistentSendAndReceiveTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpPersistentSendAndReceiveTest.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpPersistentSendAndReceiveTest.java (original)
+++ activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpPersistentSendAndReceiveTest.java Sat Aug 11 22:27:21 2007
@@ -16,9 +16,9 @@
  */
 package org.apache.activemq.transport.http;
 
-import org.apache.activemq.broker.BrokerService;
-
 import javax.jms.DeliveryMode;
+
+import org.apache.activemq.broker.BrokerService;
 
 public class HttpPersistentSendAndReceiveTest extends HttpJmsSendAndReceiveTest {
     protected BrokerService broker;

Modified: activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpTransportBrokerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpTransportBrokerTest.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpTransportBrokerTest.java (original)
+++ activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/http/HttpTransportBrokerTest.java Sat Aug 11 22:27:21 2007
@@ -16,10 +16,9 @@
  */
 package org.apache.activemq.transport.http;
 
-import org.apache.activemq.transport.TransportBrokerTestSupport;
-
 import junit.framework.Test;
 import junit.textui.TestRunner;
+import org.apache.activemq.transport.TransportBrokerTestSupport;
 
 public class HttpTransportBrokerTest extends TransportBrokerTestSupport {
 

Modified: activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/https/HttpsTransportBrokerTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/https/HttpsTransportBrokerTest.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/https/HttpsTransportBrokerTest.java (original)
+++ activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/https/HttpsTransportBrokerTest.java Sat Aug 11 22:27:21 2007
@@ -16,10 +16,9 @@
  */
 package org.apache.activemq.transport.https;
 
-import org.apache.activemq.transport.http.HttpTransportBrokerTest;
-
 import junit.framework.Test;
 import junit.textui.TestRunner;
+import org.apache.activemq.transport.http.HttpTransportBrokerTest;
 
 public class HttpsTransportBrokerTest extends HttpTransportBrokerTest {
 

Modified: activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/xstream/XStreamWireFormatTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/xstream/XStreamWireFormatTest.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/xstream/XStreamWireFormatTest.java (original)
+++ activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/transport/xstream/XStreamWireFormatTest.java Sat Aug 11 22:27:21 2007
@@ -16,26 +16,26 @@
  */
 package org.apache.activemq.transport.xstream;
 
+import java.io.IOException;
+
 import org.apache.activemq.command.Command;
 import org.apache.activemq.command.MessageTest;
 import org.apache.activemq.wireformat.WireFormat;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import java.io.IOException;
-
 /**
  * @version $Revision$
  */
 public class XStreamWireFormatTest extends MessageTest {
-    private static final Log log = LogFactory.getLog(XStreamWireFormatTest.class);
+    private static final Log LOG = LogFactory.getLog(XStreamWireFormatTest.class);
 
     public void assertBeanMarshalls(Object original) throws IOException {
         super.assertBeanMarshalls(original);
 
         String xml = getXStreamWireFormat().marshalText((Command) original);
-        log.info(original.getClass().getName() + " as XML is:");
-        log.info(xml);
+        LOG.info(original.getClass().getName() + " as XML is:");
+        LOG.info(xml);
     }
 
     protected XStreamWireFormat getXStreamWireFormat() {

Modified: activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/util/JmsLogAppenderTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/util/JmsLogAppenderTest.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/util/JmsLogAppenderTest.java (original)
+++ activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/util/JmsLogAppenderTest.java Sat Aug 11 22:27:21 2007
@@ -16,36 +16,37 @@
  */
 package org.apache.activemq.util;
 
-import junit.framework.TestCase;
-
 import java.io.IOException;
 import java.util.Properties;
 
-import org.apache.log4j.Logger;
-import org.apache.log4j.PropertyConfigurator;
-import org.apache.log4j.Level;
-import org.apache.activemq.ActiveMQConnectionFactory;
-import org.apache.activemq.broker.BrokerService;
-import org.apache.activemq.command.ActiveMQTopic;
-
-import javax.jms.JMSException;
 import javax.jms.Connection;
+import javax.jms.JMSException;
 import javax.jms.MessageConsumer;
 import javax.jms.Session;
 import javax.jms.TextMessage;
 
+import junit.framework.TestCase;
+import org.apache.activemq.ActiveMQConnectionFactory;
+import org.apache.activemq.broker.BrokerService;
+import org.apache.activemq.command.ActiveMQTopic;
+import org.apache.log4j.Level;
+import org.apache.log4j.Logger;
+import org.apache.log4j.PropertyConfigurator;
+
 public class JmsLogAppenderTest extends TestCase {
     protected BrokerService broker;
 
     public void testLoggingWithJMS() throws IOException, JMSException {
         // Setup the consumers
-        MessageConsumer info, debug, warn;
+        MessageConsumer info;
+        MessageConsumer debug;
+        MessageConsumer warn;
         ActiveMQConnectionFactory factory = new ActiveMQConnectionFactory("vm://localhost");
         Connection conn = factory.createConnection();
         conn.start();
 
-        warn  = conn.createSession(false, Session.AUTO_ACKNOWLEDGE).createConsumer(new ActiveMQTopic("log4j.MAIN.WARN"));
-        info  = conn.createSession(false, Session.AUTO_ACKNOWLEDGE).createConsumer(new ActiveMQTopic("log4j.MAIN.INFO"));
+        warn = conn.createSession(false, Session.AUTO_ACKNOWLEDGE).createConsumer(new ActiveMQTopic("log4j.MAIN.WARN"));
+        info = conn.createSession(false, Session.AUTO_ACKNOWLEDGE).createConsumer(new ActiveMQTopic("log4j.MAIN.INFO"));
         debug = conn.createSession(false, Session.AUTO_ACKNOWLEDGE).createConsumer(new ActiveMQTopic("log4j.MAIN.DEBUG"));
 
         // lets try configure log4j
@@ -53,7 +54,9 @@
         properties.load(getClass().getResourceAsStream("test-log4j.properties"));
         PropertyConfigurator.configure(properties);
 
-        Logger warnLog, infoLog, debugLog;
+        Logger warnLog;
+        Logger infoLog;
+        Logger debugLog;
 
         warnLog = Logger.getLogger("MAIN.WARN");
         warnLog.setLevel(Level.WARN);
@@ -81,7 +84,8 @@
         assertEquals("Warn Message", msg.getText());
 
         msg = (TextMessage)warn.receive(1000);
-        assertNull(msg); // We should not receive anymore message because our level is warning only
+        assertNull(msg); // We should not receive anymore message because our
+                            // level is warning only
 
         // Test info level
         msg = (TextMessage)info.receive(1000);

Modified: activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/util/xstream/XStreamTransformTest.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/util/xstream/XStreamTransformTest.java?view=diff&rev=565003&r1=565002&r2=565003
==============================================================================
--- activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/util/xstream/XStreamTransformTest.java (original)
+++ activemq/trunk/activemq-optional/src/test/java/org/apache/activemq/util/xstream/XStreamTransformTest.java Sat Aug 11 22:27:21 2007
@@ -52,9 +52,9 @@
 
         Session textSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
         MessageConsumer textConsumer = textSession.createConsumer(destination);
-        // lets clear the transformer on this consumer so we see the message as it really is
-        ((ActiveMQMessageConsumer) textConsumer).setTransformer(null);
-
+        // lets clear the transformer on this consumer so we see the message as
+        // it really is
+        ((ActiveMQMessageConsumer)textConsumer).setTransformer(null);
 
         // send a message
         Session producerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -63,24 +63,22 @@
         ObjectMessage request = producerSession.createObjectMessage(new SamplePojo("James", "London"));
         producer.send(request);
 
-
         // lets consume it as an object message
         Message message = objectConsumer.receive(timeout);
         assertNotNull("Should have received a message!", message);
         assertTrue("Should be an ObjectMessage but was: " + message, message instanceof ObjectMessage);
-        ObjectMessage objectMessage = (ObjectMessage) message;
+        ObjectMessage objectMessage = (ObjectMessage)message;
         Object object = objectMessage.getObject();
         assertTrue("object payload of wrong type: " + object, object instanceof SamplePojo);
-        SamplePojo body = (SamplePojo) object;
+        SamplePojo body = (SamplePojo)object;
         assertEquals("name", "James", body.getName());
         assertEquals("city", "London", body.getCity());
 
-
         // lets consume it as a text message
         message = textConsumer.receive(timeout);
         assertNotNull("Should have received a message!", message);
         assertTrue("Should be a TextMessage but was: " + message, message instanceof TextMessage);
-        TextMessage textMessage = (TextMessage) message;
+        TextMessage textMessage = (TextMessage)message;
         String text = textMessage.getText();
         assertTrue("Text should be non-empty!", text != null && text.length() > 0);
         System.out.println("Received XML...");
@@ -99,19 +97,18 @@
 
         Session objectSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
         MessageConsumer objectConsumer = objectSession.createConsumer(destination);
-        // lets clear the transformer on this consumer so we see the message as it really is
-        ((ActiveMQMessageConsumer) objectConsumer).setTransformer(null);
-
+        // lets clear the transformer on this consumer so we see the message as
+        // it really is
+        ((ActiveMQMessageConsumer)objectConsumer).setTransformer(null);
 
         // send a message
         Session producerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
         MessageProducer producer = producerSession.createProducer(destination);
 
-        String xmlText =
-                "<org.apache.activemq.util.xstream.SamplePojo>" +
-                "<name>James</name>" +
-                "<city>London</city>" +
-                "</org.apache.activemq.util.xstream.SamplePojo>";
+        String xmlText = "<org.apache.activemq.util.xstream.SamplePojo>" 
+            + "<name>James</name>" 
+            + "<city>London</city>" 
+            + "</org.apache.activemq.util.xstream.SamplePojo>";
 
         TextMessage request = producerSession.createTextMessage(xmlText);
         producer.send(request);
@@ -121,7 +118,7 @@
         message = textConsumer.receive(timeout);
         assertNotNull("Should have received a message!", message);
         assertTrue("Should be a TextMessage but was: " + message, message instanceof TextMessage);
-        TextMessage textMessage = (TextMessage) message;
+        TextMessage textMessage = (TextMessage)message;
         String text = textMessage.getText();
         assertTrue("Text should be non-empty!", text != null && text.length() > 0);
 
@@ -129,10 +126,10 @@
         message = objectConsumer.receive(timeout);
         assertNotNull("Should have received a message!", message);
         assertTrue("Should be an ObjectMessage but was: " + message, message instanceof ObjectMessage);
-        ObjectMessage objectMessage = (ObjectMessage) message;
+        ObjectMessage objectMessage = (ObjectMessage)message;
         Object object = objectMessage.getObject();
         assertTrue("object payload of wrong type: " + object, object instanceof SamplePojo);
-        SamplePojo body = (SamplePojo) object;
+        SamplePojo body = (SamplePojo)object;
         assertEquals("name", "James", body.getName());
         assertEquals("city", "London", body.getCity());
 
@@ -150,8 +147,9 @@
 
         Session origSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
         MessageConsumer origConsumer = origSession.createConsumer(destination);
-        // lets clear the transformer on this consumer so we see the message as it really is
-        ((ActiveMQMessageConsumer) origConsumer).setTransformer(null);
+        // lets clear the transformer on this consumer so we see the message as
+        // it really is
+        ((ActiveMQMessageConsumer)origConsumer).setTransformer(null);
 
         // Create producer
         Session producerSession = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
@@ -165,11 +163,10 @@
         String text;
 
         // Send a text message
-        String xmlText =
-                "<org.apache.activemq.util.xstream.SamplePojo>" +
-                "<name>James</name>" +
-                "<city>London</city>" +
-                "</org.apache.activemq.util.xstream.SamplePojo>";
+        String xmlText = "<org.apache.activemq.util.xstream.SamplePojo>" 
+            + "<name>James</name>" 
+            + "<city>London</city>" 
+            + "</org.apache.activemq.util.xstream.SamplePojo>";
 
         TextMessage txtRequest = producerSession.createTextMessage(xmlText);
         producer.send(txtRequest);
@@ -178,7 +175,7 @@
         message = adaptiveConsumer.receive(timeout);
         assertNotNull("Should have received a message!", message);
         assertTrue("Should be a TextMessage but was: " + message, message instanceof TextMessage);
-        textMessage = (TextMessage) message;
+        textMessage = (TextMessage)message;
         text = textMessage.getText();
         assertTrue("Text should be non-empty!", text != null && text.length() > 0);
 
@@ -186,10 +183,10 @@
         message = origConsumer.receive(timeout);
         assertNotNull("Should have received a message!", message);
         assertTrue("Should be an ObjectMessage but was: " + message, message instanceof ObjectMessage);
-        objectMessage = (ObjectMessage) message;
+        objectMessage = (ObjectMessage)message;
         object = objectMessage.getObject();
         assertTrue("object payload of wrong type: " + object, object instanceof SamplePojo);
-        body = (SamplePojo) object;
+        body = (SamplePojo)object;
         assertEquals("name", "James", body.getName());
         assertEquals("city", "London", body.getCity());
 
@@ -201,19 +198,18 @@
         message = adaptiveConsumer.receive(timeout);
         assertNotNull("Should have received a message!", message);
         assertTrue("Should be an ObjectMessage but was: " + message, message instanceof ObjectMessage);
-        objectMessage = (ObjectMessage) message;
+        objectMessage = (ObjectMessage)message;
         object = objectMessage.getObject();
         assertTrue("object payload of wrong type: " + object, object instanceof SamplePojo);
-        body = (SamplePojo) object;
+        body = (SamplePojo)object;
         assertEquals("name", "James", body.getName());
         assertEquals("city", "London", body.getCity());
 
-
         // lets consume it as a text message
         message = origConsumer.receive(timeout);
         assertNotNull("Should have received a message!", message);
         assertTrue("Should be a TextMessage but was: " + message, message instanceof TextMessage);
-        textMessage = (TextMessage) message;
+        textMessage = (TextMessage)message;
         text = textMessage.getText();
         assertTrue("Text should be non-empty!", text != null && text.length() > 0);
         System.out.println("Received XML...");



Mime
View raw message