activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chir...@apache.org
Subject svn commit: r563982 [14/32] - in /activemq/trunk/activemq-core/src: main/java/org/apache/activemq/ main/java/org/apache/activemq/advisory/ main/java/org/apache/activemq/blob/ main/java/org/apache/activemq/broker/ main/java/org/apache/activemq/broker/jm...
Date Wed, 08 Aug 2007 18:58:13 GMT
Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/pool/PooledConnection.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/pool/PooledConnection.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/pool/PooledConnection.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/pool/PooledConnection.java Wed Aug  8 11:56:59 2007
@@ -41,10 +41,9 @@
  * itself to the sessionPool.
  * 
  * <b>NOTE</b> this implementation is only intended for use when sending
- * messages.
- * It does not deal with pooling of consumers; for that look at a library like 
- * <a href="http://jencks.org/">Jencks</a> such as in
- * <a href="http://jencks.org/Message+Driven+POJOs">this example</a>
+ * messages. It does not deal with pooling of consumers; for that look at a
+ * library like <a href="http://jencks.org/">Jencks</a> such as in <a
+ * href="http://jencks.org/Message+Driven+POJOs">this example</a>
  * 
  * @version $Revision: 1.1.1.1 $
  */
@@ -66,10 +65,10 @@
     }
 
     public void close() throws JMSException {
-    	if( this.pool!=null ) {
-	        this.pool.decrementReferenceCount();
-	        this.pool = null;
-    	}
+        if (this.pool != null) {
+            this.pool.decrementReferenceCount();
+            this.pool = null;
+        }
     }
 
     public void start() throws JMSException {
@@ -81,17 +80,22 @@
         stopped = true;
     }
 
-    public ConnectionConsumer createConnectionConsumer(Destination destination, String selector, ServerSessionPool serverSessionPool, int maxMessages)
-            throws JMSException {
-        return getConnection().createConnectionConsumer(destination, selector, serverSessionPool, maxMessages);
+    public ConnectionConsumer createConnectionConsumer(Destination destination, String selector,
+                                                       ServerSessionPool serverSessionPool, int maxMessages)
+        throws JMSException {
+        return getConnection()
+            .createConnectionConsumer(destination, selector, serverSessionPool, maxMessages);
     }
 
-    public ConnectionConsumer createConnectionConsumer(Topic topic, String s, ServerSessionPool serverSessionPool, int maxMessages) throws JMSException {
+    public ConnectionConsumer createConnectionConsumer(Topic topic, String s,
+                                                       ServerSessionPool serverSessionPool, int maxMessages)
+        throws JMSException {
         return getConnection().createConnectionConsumer(topic, s, serverSessionPool, maxMessages);
     }
 
-    public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String selector, String s1, ServerSessionPool serverSessionPool, int i)
-            throws JMSException {
+    public ConnectionConsumer createDurableConnectionConsumer(Topic topic, String selector, String s1,
+                                                              ServerSessionPool serverSessionPool, int i)
+        throws JMSException {
         return getConnection().createDurableConnectionConsumer(topic, selector, s1, serverSessionPool, i);
     }
 
@@ -115,18 +119,20 @@
         getConnection().setClientID(clientID);
     }
 
-    public ConnectionConsumer createConnectionConsumer(Queue queue, String selector, ServerSessionPool serverSessionPool, int maxMessages) throws JMSException {
+    public ConnectionConsumer createConnectionConsumer(Queue queue, String selector,
+                                                       ServerSessionPool serverSessionPool, int maxMessages)
+        throws JMSException {
         return getConnection().createConnectionConsumer(queue, selector, serverSessionPool, maxMessages);
     }
 
     // Session factory methods
     // -------------------------------------------------------------------------
     public QueueSession createQueueSession(boolean transacted, int ackMode) throws JMSException {
-        return (QueueSession) createSession(transacted, ackMode);
+        return (QueueSession)createSession(transacted, ackMode);
     }
 
     public TopicSession createTopicSession(boolean transacted, int ackMode) throws JMSException {
-        return (TopicSession) createSession(transacted, ackMode);
+        return (TopicSession)createSession(transacted, ackMode);
     }
 
     public Session createSession(boolean transacted, int ackMode) throws JMSException {
@@ -148,11 +154,11 @@
     }
 
     protected ActiveMQSession createSession(SessionKey key) throws JMSException {
-        return (ActiveMQSession) getConnection().createSession(key.isTransacted(), key.getAckMode());
+        return (ActiveMQSession)getConnection().createSession(key.isTransacted(), key.getAckMode());
     }
-    
+
     public String toString() {
-        return "PooledConnection { "+pool+" }";
+        return "PooledConnection { " + pool + " }";
     }
 
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/pool/PooledConnectionFactory.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/pool/PooledConnectionFactory.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/pool/PooledConnectionFactory.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/pool/PooledConnectionFactory.java Wed Aug  8 11:56:59 2007
@@ -87,24 +87,24 @@
 
     public synchronized Connection createConnection(String userName, String password) throws JMSException {
         ConnectionKey key = new ConnectionKey(userName, password);
-        LinkedList pools = (LinkedList) cache.get(key);
-        
-        if (pools ==  null) {
+        LinkedList pools = (LinkedList)cache.get(key);
+
+        if (pools == null) {
             pools = new LinkedList();
             cache.put(key, pools);
         }
 
         ConnectionPool connection = null;
         if (pools.size() == maxConnections) {
-            connection = (ConnectionPool) pools.removeFirst();
+            connection = (ConnectionPool)pools.removeFirst();
         }
-        
-        // Now.. we might get a connection, but it might be that we need to 
+
+        // Now.. we might get a connection, but it might be that we need to
         // dump it..
-        if( connection!=null && connection.expiredCheck() ) {
-        	connection=null;
+        if (connection != null && connection.expiredCheck()) {
+            connection = null;
         }
-        
+
         if (connection == null) {
             ActiveMQConnection delegate = createConnection(key);
             connection = createConnectionPool(delegate);
@@ -112,17 +112,17 @@
         pools.add(connection);
         return new PooledConnection(connection);
     }
-    
+
     protected ConnectionPool createConnectionPool(ActiveMQConnection connection) {
         return new ConnectionPool(connection, getPoolFactory(), transactionManager);
     }
 
     protected ActiveMQConnection createConnection(ConnectionKey key) throws JMSException {
         if (key.getUserName() == null && key.getPassword() == null) {
-            return (ActiveMQConnection) connectionFactory.createConnection();
-        }
-        else {
-            return (ActiveMQConnection) connectionFactory.createConnection(key.getUserName(), key.getPassword());
+            return (ActiveMQConnection)connectionFactory.createConnection();
+        } else {
+            return (ActiveMQConnection)connectionFactory.createConnection(key.getUserName(), key
+                .getPassword());
         }
     }
 
@@ -132,17 +132,16 @@
     public void start() {
         try {
             createConnection();
-        }
-        catch (JMSException e) {
+        } catch (JMSException e) {
             IOExceptionSupport.create(e);
         }
     }
 
-    public void stop() throws Exception{
-        for(Iterator iter=cache.values().iterator();iter.hasNext();){
-            LinkedList list=(LinkedList)iter.next();
-            for(Iterator i=list.iterator();i.hasNext();){
-                ConnectionPool connection=(ConnectionPool)i.next();
+    public void stop() throws Exception {
+        for (Iterator iter = cache.values().iterator(); iter.hasNext();) {
+            LinkedList list = (LinkedList)iter.next();
+            for (Iterator i = list.iterator(); i.hasNext();) {
+                ConnectionPool connection = (ConnectionPool)i.next();
                 connection.close();
             }
         }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/proxy/ProxyConnector.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/proxy/ProxyConnector.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/proxy/ProxyConnector.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/proxy/ProxyConnector.java Wed Aug  8 11:56:59 2007
@@ -47,20 +47,19 @@
     private URI remote;
     private URI localUri;
     private String name;
-    
+
     CopyOnWriteArrayList connections = new CopyOnWriteArrayList();
-       
+
     public void start() throws Exception {
-        
+
         this.getServer().setAcceptListener(new TransportAcceptListener() {
             public void onAccept(Transport localTransport) {
                 try {
                     Transport remoteTransport = createRemoteTransport();
                     ProxyConnection connection = new ProxyConnection(localTransport, remoteTransport);
                     connections.add(connection);
-                    connection.start();                    
-                }
-                catch (Exception e) {
+                    connection.start();
+                } catch (Exception e) {
                     onAcceptError(e);
                 }
             }
@@ -70,7 +69,7 @@
             }
         });
         getServer().start();
-        log.info("Proxy Connector "+getName()+" Started");
+        log.info("Proxy Connector " + getName() + " Started");
 
     }
 
@@ -81,15 +80,15 @@
         }
         for (Iterator iter = connections.iterator(); iter.hasNext();) {
             log.info("Connector stopped: Stopping proxy.");
-            ss.stop((Service) iter.next());
+            ss.stop((Service)iter.next());
         }
         ss.throwFirstException();
         log.info("Proxy Connector " + getName() + " Stopped");
     }
-    
+
     // Properties
     // -------------------------------------------------------------------------
-    
+
     public URI getLocalUri() {
         return localUri;
     }
@@ -120,7 +119,7 @@
         }
         return server;
     }
-    
+
     public void setServer(TransportServer server) {
         this.server = server;
     }
@@ -134,25 +133,25 @@
 
     private Transport createRemoteTransport() throws Exception {
         Transport transport = TransportFactory.compositeConnect(remote);
-        CompositeTransport ct = (CompositeTransport) transport.narrow(CompositeTransport.class);
-        if( ct !=null && localUri!=null ) {
-            ct.add(new URI[]{localUri});
+        CompositeTransport ct = (CompositeTransport)transport.narrow(CompositeTransport.class);
+        if (ct != null && localUri != null) {
+            ct.add(new URI[] {localUri});
         }
-        
+
         // Add a transport filter so that can track the transport life cycle
         transport = new TransportFilter(transport) {
-        	public void stop() throws Exception {
-        		log.info("Stopping proxy.");
-        		super.stop();
-        		connections.remove(this);
-        	}
+            public void stop() throws Exception {
+                log.info("Stopping proxy.");
+                super.stop();
+                connections.remove(this);
+            }
         };
         return transport;
     }
 
     public String getName() {
-        if( name == null ) {
-            if( server!=null ) {
+        if (name == null) {
+            if (server != null) {
                 name = server.getConnectURI().toString();
             } else {
                 name = "proxy";

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthenticationUser.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthenticationUser.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthenticationUser.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthenticationUser.java Wed Aug  8 11:56:59 2007
@@ -16,48 +16,47 @@
  */
 package org.apache.activemq.security;
 
-
 /**
  * A helper object used to configure simple authentiaction plugin
- *  
+ * 
  * @org.apache.xbean.XBean
  * 
  * @version $Revision
  */
 public class AuthenticationUser {
 
-	String username;
-	String password;
-	String groups;
-	
-	
-	
-	public AuthenticationUser(String username, String password, String groups) {
-		this.username = username;
-		this.password = password;
-		this.groups = groups;
-	}
-	
-	
-	public String getGroups() {
-		return groups;
-	}
-	public void setGroups(String groups) {
-		this.groups = groups;
-	}
-	public String getPassword() {
-		return password;
-	}
-	public void setPassword(String password) {
-		this.password = password;
-	}
-	public String getUsername() {
-		return username;
-	}
-	public void setUsername(String username) {
-		this.username = username;
-	}
-	
-	
-	
+    String username;
+    String password;
+    String groups;
+
+    public AuthenticationUser(String username, String password, String groups) {
+        this.username = username;
+        this.password = password;
+        this.groups = groups;
+    }
+
+    public String getGroups() {
+        return groups;
+    }
+
+    public void setGroups(String groups) {
+        this.groups = groups;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationBroker.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationBroker.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationBroker.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationBroker.java Wed Aug  8 11:56:59 2007
@@ -16,6 +16,8 @@
  */
 package org.apache.activemq.security;
 
+import java.util.Set;
+
 import org.apache.activemq.broker.Broker;
 import org.apache.activemq.broker.BrokerFilter;
 import org.apache.activemq.broker.ConnectionContext;
@@ -24,170 +26,158 @@
 import org.apache.activemq.broker.region.Subscription;
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.command.ActiveMQQueue;
-import org.apache.activemq.command.ActiveMQTempDestination;
 import org.apache.activemq.command.ActiveMQTopic;
 import org.apache.activemq.command.ConsumerInfo;
 import org.apache.activemq.command.Message;
 import org.apache.activemq.command.ProducerInfo;
-import org.apache.activemq.filter.BooleanExpression;
-import org.apache.activemq.filter.MessageEvaluationContext;
-
-import javax.jms.JMSException;
-
-import java.util.Set;
-
 
 /**
- * Verifies if a authenticated user can do an operation against the broker using an authorization map.
+ * Verifies if a authenticated user can do an operation against the broker using
+ * an authorization map.
  * 
  * @version $Revision$
  */
 public class AuthorizationBroker extends BrokerFilter implements SecurityAdminMBean {
-    
+
     private final AuthorizationMap authorizationMap;
 
     public AuthorizationBroker(Broker next, AuthorizationMap authorizationMap) {
         super(next);
         this.authorizationMap = authorizationMap;
     }
-    
+
     public Destination addDestination(ConnectionContext context, ActiveMQDestination destination) throws Exception {
-        final SecurityContext securityContext = (SecurityContext) context.getSecurityContext();
-        if( securityContext == null )
+        final SecurityContext securityContext = (SecurityContext)context.getSecurityContext();
+        if (securityContext == null) {
             throw new SecurityException("User is not authenticated.");
-
-
-        //if(!((ActiveMQTempDestination)destination).getConnectionId().equals(context.getConnectionId().getValue()) ) {
+        }
+        // if(!((ActiveMQTempDestination)destination).getConnectionId().equals(context.getConnectionId().getValue())
+        // ) {
         if (!securityContext.isBrokerContext()) {
             Set allowedACLs = null;
-            if(!destination.isTemporary()) {
+            if (!destination.isTemporary()) {
                 allowedACLs = authorizationMap.getAdminACLs(destination);
             } else {
                 allowedACLs = authorizationMap.getTempDestinationAdminACLs();
             }
-         
-            if(allowedACLs!=null && !securityContext.isInOneOf(allowedACLs))
-                throw new SecurityException("User "+securityContext.getUserName()+" is not authorized to create: "+destination);
+
+            if (allowedACLs != null && !securityContext.isInOneOf(allowedACLs)) {
+                throw new SecurityException("User " + securityContext.getUserName() + " is not authorized to create: " + destination);
+            }
 
         }
         // }
 
         return super.addDestination(context, destination);
     }
-    
+
     public void removeDestination(ConnectionContext context, ActiveMQDestination destination, long timeout) throws Exception {
-        
-        final SecurityContext securityContext = (SecurityContext) context.getSecurityContext();
-        if( securityContext == null )
-            throw new SecurityException("User is not authenticated.");
 
+        final SecurityContext securityContext = (SecurityContext)context.getSecurityContext();
+        if (securityContext == null) {
+            throw new SecurityException("User is not authenticated.");
+        }
         Set allowedACLs = null;
-        if(!destination.isTemporary()) {
+        if (!destination.isTemporary()) {
             allowedACLs = authorizationMap.getAdminACLs(destination);
         } else {
-        	allowedACLs = authorizationMap.getTempDestinationAdminACLs();
+            allowedACLs = authorizationMap.getTempDestinationAdminACLs();
         }
-        
-    	if(allowedACLs!=null && !securityContext.isInOneOf(allowedACLs))
-            throw new SecurityException("User "+securityContext.getUserName()+" is not authorized to remove: "+destination);
 
+        if (allowedACLs != null && !securityContext.isInOneOf(allowedACLs)) {
+            throw new SecurityException("User " + securityContext.getUserName() + " is not authorized to remove: " + destination);
+        }
         super.removeDestination(context, destination, timeout);
     }
-    
+
     public Subscription addConsumer(ConnectionContext context, ConsumerInfo info) throws Exception {
-        
-        final SecurityContext subject = (SecurityContext) context.getSecurityContext();
-        if( subject == null )
+
+        final SecurityContext subject = (SecurityContext)context.getSecurityContext();
+        if (subject == null) {
             throw new SecurityException("User is not authenticated.");
-        
+        }
         Set allowedACLs = null;
-        if(!info.getDestination().isTemporary()) {
+        if (!info.getDestination().isTemporary()) {
             allowedACLs = authorizationMap.getReadACLs(info.getDestination());
-        }else {
-        	allowedACLs = authorizationMap.getTempDestinationReadACLs();
+        } else {
+            allowedACLs = authorizationMap.getTempDestinationReadACLs();
         }
 
-        if(allowedACLs!=null && !subject.isInOneOf(allowedACLs))
-            throw new SecurityException("User "+subject.getUserName()+" is not authorized to read from: "+info.getDestination());
-        
+        if (allowedACLs != null && !subject.isInOneOf(allowedACLs)) {
+            throw new SecurityException("User " + subject.getUserName() + " is not authorized to read from: " + info.getDestination());
+        }
         subject.getAuthorizedReadDests().put(info.getDestination(), info.getDestination());
-        
-        /* 
-         * Need to think about this a little more.  We could do per message security checking
-         * to implement finer grained security checking. For example a user can only see messages
-         * with price>1000 .  Perhaps this should just be another additional broker filter that installs 
-         * this type of feature.
-         * 
-         * If we did want to do that, then we would install a predicate.  We should be careful since
-         * there may be an existing predicate already assigned and the consumer info may be sent to a remote 
-         * broker, so it also needs to support being marshaled.
-         * 
-            info.setAdditionalPredicate(new BooleanExpression() {
-                public boolean matches(MessageEvaluationContext message) throws JMSException {
-                    if( !subject.getAuthorizedReadDests().contains(message.getDestination()) ) {
-                        Set allowedACLs = authorizationMap.getReadACLs(message.getDestination());
-                        if(allowedACLs!=null && !subject.isInOneOf(allowedACLs))
-                            return false;
-                        subject.getAuthorizedReadDests().put(message.getDestination(), message.getDestination());
-                    }
-                    return true;
-                }
-                public Object evaluate(MessageEvaluationContext message) throws JMSException {
-                    return matches(message) ? Boolean.TRUE : Boolean.FALSE;
-                }
-            });
-        */
-        
+
+        /*
+         * Need to think about this a little more. We could do per message
+         * security checking to implement finer grained security checking. For
+         * example a user can only see messages with price>1000 . Perhaps this
+         * should just be another additional broker filter that installs this
+         * type of feature. If we did want to do that, then we would install a
+         * predicate. We should be careful since there may be an existing
+         * predicate already assigned and the consumer info may be sent to a
+         * remote broker, so it also needs to support being marshaled.
+         * info.setAdditionalPredicate(new BooleanExpression() { public boolean
+         * matches(MessageEvaluationContext message) throws JMSException { if(
+         * !subject.getAuthorizedReadDests().contains(message.getDestination()) ) {
+         * Set allowedACLs =
+         * authorizationMap.getReadACLs(message.getDestination());
+         * if(allowedACLs!=null && !subject.isInOneOf(allowedACLs)) return
+         * false; subject.getAuthorizedReadDests().put(message.getDestination(),
+         * message.getDestination()); } return true; } public Object
+         * evaluate(MessageEvaluationContext message) throws JMSException {
+         * return matches(message) ? Boolean.TRUE : Boolean.FALSE; } });
+         */
+
         return super.addConsumer(context, info);
     }
-    
+
     public void addProducer(ConnectionContext context, ProducerInfo info) throws Exception {
-        
-        SecurityContext subject = (SecurityContext) context.getSecurityContext();
-        if( subject == null )
+
+        SecurityContext subject = (SecurityContext)context.getSecurityContext();
+        if (subject == null) {
             throw new SecurityException("User is not authenticated.");
-        
-        if( info.getDestination()!=null ) {
-        	
-        	Set allowedACLs = null;
-        	if(!info.getDestination().isTemporary()) {
-        		allowedACLs = authorizationMap.getWriteACLs(info.getDestination());          
-        	}else {
-        	   	allowedACLs = authorizationMap.getTempDestinationWriteACLs();
-        	}
-            if(allowedACLs!=null && !subject.isInOneOf(allowedACLs)) 
-                throw new SecurityException("User "+subject.getUserName()+" is not authorized to write to: "+info.getDestination());
-            
-            
+        }
+        if (info.getDestination() != null) {
+
+            Set allowedACLs = null;
+            if (!info.getDestination().isTemporary()) {
+                allowedACLs = authorizationMap.getWriteACLs(info.getDestination());
+            } else {
+                allowedACLs = authorizationMap.getTempDestinationWriteACLs();
+            }
+            if (allowedACLs != null && !subject.isInOneOf(allowedACLs)){
+                throw new SecurityException("User " + subject.getUserName() + " is not authorized to write to: " + info.getDestination());
+            }
             subject.getAuthorizedWriteDests().put(info.getDestination(), info.getDestination());
         }
-        
+
         super.addProducer(context, info);
     }
-        
+
     public void send(ProducerBrokerExchange producerExchange, Message messageSend) throws Exception {
-        SecurityContext subject = (SecurityContext) producerExchange.getConnectionContext().getSecurityContext();
-        if( subject == null )
+        SecurityContext subject = (SecurityContext)producerExchange.getConnectionContext().getSecurityContext();
+        if (subject == null) {
             throw new SecurityException("User is not authenticated.");
+        }
+        if (!subject.getAuthorizedWriteDests().contains(messageSend.getDestination())) {
+
+            Set allowedACLs = null;
+            if (!messageSend.getDestination().isTemporary()) {
+                allowedACLs = authorizationMap.getWriteACLs(messageSend.getDestination());
+            } else {
+                allowedACLs = authorizationMap.getTempDestinationWriteACLs();
+            }
 
-        if( !subject.getAuthorizedWriteDests().contains(messageSend.getDestination()) ) {
-        	
-        	Set allowedACLs = null;
-        	if(!messageSend.getDestination().isTemporary()) {
-                allowedACLs = authorizationMap.getWriteACLs(messageSend.getDestination());            
-        	}else {
-        		allowedACLs = authorizationMap.getTempDestinationWriteACLs();
-        	}
-            
-        	if(allowedACLs!=null && !subject.isInOneOf(allowedACLs))
-                throw new SecurityException("User "+subject.getUserName()+" is not authorized to write to: "+messageSend.getDestination());
-        	
+            if (allowedACLs != null && !subject.isInOneOf(allowedACLs)) {
+                throw new SecurityException("User " + subject.getUserName() + " is not authorized to write to: " + messageSend.getDestination());
+            }
             subject.getAuthorizedWriteDests().put(messageSend.getDestination(), messageSend.getDestination());
         }
 
         super.send(producerExchange, messageSend);
     }
-    
+
     // SecurityAdminMBean interface
     // -------------------------------------------------------------------------
 
@@ -206,13 +196,12 @@
     public void removeTopicRole(String topic, String operation, String role) {
         removeDestinationRole(new ActiveMQTopic(topic), operation, role);
     }
-    
+
     public void addDestinationRole(javax.jms.Destination destination, String operation, String role) {
     }
-    
+
     public void removeDestinationRole(javax.jms.Destination destination, String operation, String role) {
     }
-
 
     public void addRole(String role) {
     }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationEntry.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationEntry.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationEntry.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/AuthorizationEntry.java Wed Aug  8 11:56:59 2007
@@ -16,8 +16,6 @@
  */
 package org.apache.activemq.security;
 
-import org.apache.activemq.filter.DestinationMapEntry;
-
 import java.lang.reflect.Constructor;
 import java.lang.reflect.Method;
 import java.util.Collections;
@@ -25,13 +23,14 @@
 import java.util.Set;
 import java.util.StringTokenizer;
 
+import org.apache.activemq.filter.DestinationMapEntry;
+
 /**
  * Represents an entry in a {@link DefaultAuthorizationMap} for assigning
  * different operations (read, write, admin) of user roles to a specific
  * destination or a hierarchical wildcard area of destinations.
  * 
  * @org.apache.xbean.XBean
- * 
  * @version $Revision$
  */
 public class AuthorizationEntry extends DestinationMapEntry {
@@ -39,20 +38,20 @@
     private Set readACLs = Collections.EMPTY_SET;
     private Set writeACLs = Collections.EMPTY_SET;
     private Set adminACLs = Collections.EMPTY_SET;
-    
+
     private String adminRoles = null;
     private String readRoles = null;
     private String writeRoles = null;
-    
+
     private String groupClass = "org.apache.activemq.jaas.GroupPrincipal";
-        
+
     public String getGroupClass() {
-    	return groupClass;
+        return groupClass;
     }
-     
+
     public void setGroupClass(String groupClass) {
         this.groupClass = groupClass;
-    }    
+    }
 
     public Set getAdminACLs() {
         return adminACLs;
@@ -79,23 +78,26 @@
     }
 
     // helper methods for easier configuration in Spring
-    // ACLs are already set in the afterPropertiesSet method to ensure that  groupClass is set first before
-    // calling parceACLs() on any of the roles. We still need to add  the call to parceACLs inside the helper
-    // methods for instances where we configure security programatically without using xbean
+    // ACLs are already set in the afterPropertiesSet method to ensure that
+    // groupClass is set first before
+    // calling parceACLs() on any of the roles. We still need to add the call to
+    // parceACLs inside the helper
+    // methods for instances where we configure security programatically without
+    // using xbean
     // -------------------------------------------------------------------------
     public void setAdmin(String roles) throws Exception {
-    	adminRoles = roles;
-    	setAdminACLs(parseACLs(adminRoles));
+        adminRoles = roles;
+        setAdminACLs(parseACLs(adminRoles));
     }
 
     public void setRead(String roles) throws Exception {
-    	readRoles = roles;
-    	setReadACLs(parseACLs(readRoles));
+        readRoles = roles;
+        setReadACLs(parseACLs(readRoles));
     }
 
     public void setWrite(String roles) throws Exception {
-    	writeRoles = roles;
-    	setWriteACLs(parseACLs(writeRoles));
+        writeRoles = roles;
+        setWriteACLs(parseACLs(writeRoles));
     }
 
     protected Set parseACLs(String roles) throws Exception {
@@ -105,58 +107,63 @@
             String name = iter.nextToken().trim();
             Class[] paramClass = new Class[1];
             paramClass[0] = String.class;
-            
+
             Object[] param = new Object[1];
             param[0] = name;
 
             try {
-            	Class cls = Class.forName(groupClass);
-            	
-            	Constructor[] constructors = cls.getConstructors();
-            	int i;
-            	for (i=0; i<constructors.length; i++) {
-            		Class[] paramTypes = constructors[i].getParameterTypes(); 
-            		if (paramTypes.length!=0 && paramTypes[0].equals(paramClass[0])) break;
-            	}
-            	if (i < constructors.length) {
-            		Object instance = constructors[i].newInstance(param);
-                	answer.add(instance);
-            	}
-            	else {
-            		Object instance = cls.newInstance();
-            		Method[] methods = cls.getMethods();
-            		i=0;
-            		for (i=0; i<methods.length; i++) {
-            			Class[] paramTypes = methods[i].getParameterTypes();
-            			if (paramTypes.length!=0 && methods[i].getName().equals("setName") && paramTypes[0].equals(paramClass[0])) break;
-            		}
-                		
-                	if (i < methods.length) {
-                		methods[i].invoke(instance, param);
-                    	answer.add(instance);
-                	}
-                	else throw new NoSuchMethodException();
-            	}
+                Class cls = Class.forName(groupClass);
+
+                Constructor[] constructors = cls.getConstructors();
+                int i;
+                for (i = 0; i < constructors.length; i++) {
+                    Class[] paramTypes = constructors[i].getParameterTypes();
+                    if (paramTypes.length != 0 && paramTypes[0].equals(paramClass[0])) {
+                        break;
+                    }
+                }
+                if (i < constructors.length) {
+                    Object instance = constructors[i].newInstance(param);
+                    answer.add(instance);
+                } else {
+                    Object instance = cls.newInstance();
+                    Method[] methods = cls.getMethods();
+                    i = 0;
+                    for (i = 0; i < methods.length; i++) {
+                        Class[] paramTypes = methods[i].getParameterTypes();
+                        if (paramTypes.length != 0 && methods[i].getName().equals("setName") && paramTypes[0].equals(paramClass[0])) {
+                            break;
+                        }
+                    }
+
+                    if (i < methods.length) {
+                        methods[i].invoke(instance, param);
+                        answer.add(instance);
+                    } else {
+                        throw new NoSuchMethodException();
+                    }
+                }
+            } catch (Exception e) {
+                throw e;
             }
-            catch (Exception e) { throw e; }
         }
         return answer;
     }
-    
+
     public void afterPropertiesSet() throws Exception {
         super.afterPropertiesSet();
-        
-        if(adminRoles!=null) {
-        	setAdminACLs(parseACLs(adminRoles));
+
+        if (adminRoles != null) {
+            setAdminACLs(parseACLs(adminRoles));
         }
 
-        if(writeRoles!=null) {
-        	setWriteACLs(parseACLs(writeRoles));
+        if (writeRoles != null) {
+            setWriteACLs(parseACLs(writeRoles));
         }
-        
-        if(readRoles!=null) {
-        	setReadACLs(parseACLs(readRoles));
+
+        if (readRoles != null) {
+            setReadACLs(parseACLs(readRoles));
         }
-        
-    }    
+
+    }
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/DefaultAuthorizationMap.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/DefaultAuthorizationMap.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/DefaultAuthorizationMap.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/DefaultAuthorizationMap.java Wed Aug  8 11:56:59 2007
@@ -27,7 +27,8 @@
 /**
  * Represents a destination based configuration of policies so that individual
  * destinations or wildcard hierarchies of destinations can be configured using
- * different policies. Each entry in the map represents the authorization ACLs for each operation.
+ * different policies. Each entry in the map represents the authorization ACLs
+ * for each operation.
  * 
  * @org.apache.xbean.XBean element="authorizationMap"
  * 
@@ -36,53 +37,53 @@
 public class DefaultAuthorizationMap extends DestinationMap implements AuthorizationMap {
 
     private AuthorizationEntry defaultEntry;
-    
+
     private TempDestinationAuthorizationEntry tempDestinationAuthorizationEntry;
-    
+
     public DefaultAuthorizationMap() {
     }
 
     public DefaultAuthorizationMap(List authorizationEntries) {
         setAuthorizationEntries(authorizationEntries);
-       
+
     }
 
-  
-    public void setTempDestinationAuthorizationEntry(TempDestinationAuthorizationEntry tempDestinationAuthorizationEntry) {
+    public void setTempDestinationAuthorizationEntry(
+                                                     TempDestinationAuthorizationEntry tempDestinationAuthorizationEntry) {
         this.tempDestinationAuthorizationEntry = tempDestinationAuthorizationEntry;
-    }    
-    
+    }
+
     public TempDestinationAuthorizationEntry getTempDestinationAuthorizationEntry() {
         return this.tempDestinationAuthorizationEntry;
-    }    
-    
+    }
+
     public Set getTempDestinationAdminACLs() {
-        if(tempDestinationAuthorizationEntry != null)    
-        	return tempDestinationAuthorizationEntry.getAdminACLs();
+        if (tempDestinationAuthorizationEntry != null)
+            return tempDestinationAuthorizationEntry.getAdminACLs();
         else
-        	return null;
+            return null;
     }
-    
+
     public Set getTempDestinationReadACLs() {
-    	if(tempDestinationAuthorizationEntry != null)  
-           	return tempDestinationAuthorizationEntry.getReadACLs();
-    	else
-    		return null;
+        if (tempDestinationAuthorizationEntry != null)
+            return tempDestinationAuthorizationEntry.getReadACLs();
+        else
+            return null;
     }
-    
+
     public Set getTempDestinationWriteACLs() {
-    	if(tempDestinationAuthorizationEntry != null)
-           	return tempDestinationAuthorizationEntry.getWriteACLs();
-    	else
-    		return null;
-    }    
-    
+        if (tempDestinationAuthorizationEntry != null)
+            return tempDestinationAuthorizationEntry.getWriteACLs();
+        else
+            return null;
+    }
+
     public Set getAdminACLs(ActiveMQDestination destination) {
         Set entries = getAllEntries(destination);
         Set answer = new HashSet();
-        // now lets go through each entry adding individual 
+        // now lets go through each entry adding individual
         for (Iterator iter = entries.iterator(); iter.hasNext();) {
-            AuthorizationEntry entry = (AuthorizationEntry) iter.next();
+            AuthorizationEntry entry = (AuthorizationEntry)iter.next();
             answer.addAll(entry.getAdminACLs());
         }
         return answer;
@@ -91,10 +92,10 @@
     public Set getReadACLs(ActiveMQDestination destination) {
         Set entries = getAllEntries(destination);
         Set answer = new HashSet();
-        
-        // now lets go through each entry adding individual 
+
+        // now lets go through each entry adding individual
         for (Iterator iter = entries.iterator(); iter.hasNext();) {
-            AuthorizationEntry entry = (AuthorizationEntry) iter.next();
+            AuthorizationEntry entry = (AuthorizationEntry)iter.next();
             answer.addAll(entry.getReadACLs());
         }
         return answer;
@@ -103,17 +104,17 @@
     public Set getWriteACLs(ActiveMQDestination destination) {
         Set entries = getAllEntries(destination);
         Set answer = new HashSet();
-        
-        // now lets go through each entry adding individual 
+
+        // now lets go through each entry adding individual
         for (Iterator iter = entries.iterator(); iter.hasNext();) {
-            AuthorizationEntry entry = (AuthorizationEntry) iter.next();
+            AuthorizationEntry entry = (AuthorizationEntry)iter.next();
             answer.addAll(entry.getWriteACLs());
         }
         return answer;
     }
 
     public AuthorizationEntry getEntryFor(ActiveMQDestination destination) {
-        AuthorizationEntry answer = (AuthorizationEntry) chooseValue(destination);
+        AuthorizationEntry answer = (AuthorizationEntry)chooseValue(destination);
         if (answer == null) {
             answer = getDefaultEntry();
         }
@@ -140,13 +141,13 @@
     protected Class getEntryClass() {
         return AuthorizationEntry.class;
     }
+
     protected Set getAllEntries(ActiveMQDestination destination) {
         Set entries = get(destination);
         if (defaultEntry != null) {
-        entries.add(defaultEntry);
+            entries.add(defaultEntry);
         }
         return entries;
     }
-
 
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/JaasAuthenticationBroker.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/JaasAuthenticationBroker.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/JaasAuthenticationBroker.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/JaasAuthenticationBroker.java Wed Aug  8 11:56:59 2007
@@ -31,7 +31,6 @@
 
 import java.util.concurrent.CopyOnWriteArrayList;
 
-
 /**
  * Logs a user in using JAAS.
  * 
@@ -46,7 +45,7 @@
         super(next);
         this.jassConfiguration = jassConfiguration;
     }
-    
+
     static class JaasSecurityContext extends SecurityContext {
 
         private final Subject subject;
@@ -59,28 +58,31 @@
         public Set getPrincipals() {
             return subject.getPrincipals();
         }
-        
+
     }
-    
+
     public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception {
 
-        if( context.getSecurityContext()==null ) {
-            // Set the TCCL since it seems JAAS needs it to find the login module classes.
+        if (context.getSecurityContext() == null) {
+            // Set the TCCL since it seems JAAS needs it to find the login
+            // module classes.
             ClassLoader original = Thread.currentThread().getContextClassLoader();
             Thread.currentThread().setContextClassLoader(JaasAuthenticationBroker.class.getClassLoader());
             try {
                 // Do the login.
                 try {
-                    JassCredentialCallbackHandler callback = new JassCredentialCallbackHandler(info.getUserName(), info.getPassword());
+                    JassCredentialCallbackHandler callback = new JassCredentialCallbackHandler(info
+                        .getUserName(), info.getPassword());
                     LoginContext lc = new LoginContext(jassConfiguration, callback);
                     lc.login();
                     Subject subject = lc.getSubject();
-                    
+
                     SecurityContext s = new JaasSecurityContext(info.getUserName(), subject);
                     context.setSecurityContext(s);
                     securityContexts.add(s);
                 } catch (Exception e) {
-                    throw (SecurityException)new SecurityException("User name or password is invalid.").initCause(e);
+                    throw (SecurityException)new SecurityException("User name or password is invalid.")
+                        .initCause(e);
                 }
             } finally {
                 Thread.currentThread().setContextClassLoader(original);
@@ -88,21 +90,22 @@
         }
         super.addConnection(context, info);
     }
-    
-    public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception {
+
+    public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error)
+        throws Exception {
         super.removeConnection(context, info, error);
-        if( securityContexts.remove(context.getSecurityContext()) ) {
+        if (securityContexts.remove(context.getSecurityContext())) {
             context.setSecurityContext(null);
         }
     }
-    
+
     /**
-     * Previously logged in users may no longer have the same access anymore.  Refresh
-     * all the logged into users. 
+     * Previously logged in users may no longer have the same access anymore.
+     * Refresh all the logged into users.
      */
     public void refresh() {
         for (Iterator iter = securityContexts.iterator(); iter.hasNext();) {
-            SecurityContext sc = (SecurityContext) iter.next();
+            SecurityContext sc = (SecurityContext)iter.next();
             sc.getAuthorizedReadDests().clear();
             sc.getAuthorizedWriteDests().clear();
         }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SecurityContext.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SecurityContext.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SecurityContext.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SecurityContext.java Wed Aug  8 11:56:59 2007
@@ -40,7 +40,7 @@
     };
 
     final String userName;
-    
+
     final ConcurrentHashMap authorizedReadDests = new ConcurrentHashMap();
     final ConcurrentHashMap authorizedWriteDests = new ConcurrentHashMap();
 
@@ -51,11 +51,11 @@
     public boolean isInOneOf(Set allowedPrincipals) {
         HashSet set = new HashSet(getPrincipals());
         set.retainAll(allowedPrincipals);
-        return set.size()>0;
+        return set.size() > 0;
     }
 
     abstract public Set getPrincipals();
-    
+
     public String getUserName() {
         return userName;
     }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthenticationBroker.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthenticationBroker.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthenticationBroker.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthenticationBroker.java Wed Aug  8 11:56:59 2007
@@ -27,62 +27,62 @@
 
 import java.util.concurrent.CopyOnWriteArrayList;
 
-
 /**
  * Handles authenticating a users against a simple user name/password map.
  * 
  * @version $Revision$
  */
 public class SimpleAuthenticationBroker extends BrokerFilter {
-    
+
     private final Map userPasswords;
     private final Map userGroups;
     private final CopyOnWriteArrayList securityContexts = new CopyOnWriteArrayList();
-    
+
     public SimpleAuthenticationBroker(Broker next, Map userPasswords, Map userGroups) {
         super(next);
         this.userPasswords = userPasswords;
         this.userGroups = userGroups;
     }
-    
+
     public void addConnection(ConnectionContext context, ConnectionInfo info) throws Exception {
 
-        if( context.getSecurityContext()==null ) {
+        if (context.getSecurityContext() == null) {
             // Check the username and password.
-            String pw = (String) userPasswords.get(info.getUserName());
-            if( pw == null || !pw.equals(info.getPassword()) )
+            String pw = (String)userPasswords.get(info.getUserName());
+            if (pw == null || !pw.equals(info.getPassword()))
                 throw new SecurityException("User name or password is invalid.");
-        
+
             final Set groups = (Set)userGroups.get(info.getUserName());
             SecurityContext s = new SecurityContext(info.getUserName()) {
                 public Set getPrincipals() {
                     return groups;
                 }
             };
-            
+
             context.setSecurityContext(s);
             securityContexts.add(s);
         }
         super.addConnection(context, info);
     }
-    
-    public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error) throws Exception {
+
+    public void removeConnection(ConnectionContext context, ConnectionInfo info, Throwable error)
+        throws Exception {
         super.removeConnection(context, info, error);
-        if( securityContexts.remove(context.getSecurityContext()) ) {
+        if (securityContexts.remove(context.getSecurityContext())) {
             context.setSecurityContext(null);
         }
     }
-    
+
     /**
-     * Previously logged in users may no longer have the same access anymore.  Refresh
-     * all the logged into users. 
+     * Previously logged in users may no longer have the same access anymore.
+     * Refresh all the logged into users.
      */
     public void refresh() {
         for (Iterator iter = securityContexts.iterator(); iter.hasNext();) {
-            SecurityContext sc = (SecurityContext) iter.next();
+            SecurityContext sc = (SecurityContext)iter.next();
             sc.getAuthorizedReadDests().clear();
             sc.getAuthorizedWriteDests().clear();
         }
     }
-    
+
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthenticationPlugin.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthenticationPlugin.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthenticationPlugin.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthenticationPlugin.java Wed Aug  8 11:56:59 2007
@@ -33,9 +33,11 @@
 
 /**
  * A simple authentication plugin
- *  
- * @org.apache.xbean.XBean element="simpleAuthenticationPlugin" description="Provides a simple authentication
- * plugin configured with a map of user-passwords and a map of user-groups or a list of authentication users"
+ * 
+ * @org.apache.xbean.XBean element="simpleAuthenticationPlugin"
+ *                         description="Provides a simple authentication plugin
+ *                         configured with a map of user-passwords and a map of
+ *                         user-groups or a list of authentication users"
  * 
  * @version $Revision$
  */
@@ -43,10 +45,11 @@
     private Map userPasswords;
     private Map userGroups;
 
-    public SimpleAuthenticationPlugin() {}
+    public SimpleAuthenticationPlugin() {
+    }
 
     public SimpleAuthenticationPlugin(List users) {
-    	setUsers(users);
+        setUsers(users);
     }
 
     public Broker installPlugin(Broker broker) {
@@ -56,30 +59,31 @@
     public Map getUserGroups() {
         return userGroups;
     }
-    
+
     /**
      * Sets individual users for authentication
      * 
      * @org.apache.xbean.ElementType class="org.apache.activemq.security.AuthenticationUser"
      */
     public void setUsers(List users) {
-    	userPasswords = new HashMap();
-    	userGroups = new HashMap();
-    	for (Iterator it = users.iterator(); it.hasNext();) {
-    	    AuthenticationUser user = (AuthenticationUser)it.next();
-    	    userPasswords.put(user.getUsername(), user.getPassword());
+        userPasswords = new HashMap();
+        userGroups = new HashMap();
+        for (Iterator it = users.iterator(); it.hasNext();) {
+            AuthenticationUser user = (AuthenticationUser)it.next();
+            userPasswords.put(user.getUsername(), user.getPassword());
             Set groups = new HashSet();
             StringTokenizer iter = new StringTokenizer(user.getGroups(), ",");
             while (iter.hasMoreTokens()) {
                 String name = iter.nextToken().trim();
                 groups.add(new GroupPrincipal(name));
             }
-    	    userGroups.put(user.getUsername(), groups);
-    	}
-    }    
+            userGroups.put(user.getUsername(), groups);
+        }
+    }
 
     /**
-     * Sets the groups a user is in. The key is the user name and the value is a Set of groups
+     * Sets the groups a user is in. The key is the user name and the value is a
+     * Set of groups
      */
     public void setUserGroups(Map userGroups) {
         this.userGroups = userGroups;

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthorizationMap.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthorizationMap.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthorizationMap.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/security/SimpleAuthorizationMap.java Wed Aug  8 11:56:59 2007
@@ -36,7 +36,7 @@
     private DestinationMap adminACLs;
 
     private TempDestinationAuthorizationEntry tempDestinationAuthorizationEntry;
-    
+
     public SimpleAuthorizationMap() {
     }
 
@@ -47,41 +47,43 @@
     }
 
     /*
-     * Need to think how to retrieve the ACLs for temporary destinations since they are not map 
-     * to a specific destination. For now we'll just retrieve it from a TempDestinationAuthorizationEntry 
-     * same way as the DefaultAuthorizationMap. The ACLs retrieved here will be map to all temp destinations
+     * Need to think how to retrieve the ACLs for temporary destinations since
+     * they are not map to a specific destination. For now we'll just retrieve
+     * it from a TempDestinationAuthorizationEntry same way as the
+     * DefaultAuthorizationMap. The ACLs retrieved here will be map to all temp
+     * destinations
      */
-    
-    public void setTempDestinationAuthorizationEntry(TempDestinationAuthorizationEntry tempDestinationAuthorizationEntry) {
+
+    public void setTempDestinationAuthorizationEntry(
+                                                     TempDestinationAuthorizationEntry tempDestinationAuthorizationEntry) {
         this.tempDestinationAuthorizationEntry = tempDestinationAuthorizationEntry;
-    }    
-    
+    }
+
     public TempDestinationAuthorizationEntry getTempDestinationAuthorizationEntry() {
         return this.tempDestinationAuthorizationEntry;
-    }    
+    }
 
-    
     public Set getTempDestinationAdminACLs() {
-        if(tempDestinationAuthorizationEntry != null)    
-        	return tempDestinationAuthorizationEntry.getAdminACLs();
+        if (tempDestinationAuthorizationEntry != null)
+            return tempDestinationAuthorizationEntry.getAdminACLs();
         else
-        	return null;
+            return null;
     }
-    
+
     public Set getTempDestinationReadACLs() {
-    	if(tempDestinationAuthorizationEntry != null)  
-           	return tempDestinationAuthorizationEntry.getReadACLs();
-    	else
-    		return null;
+        if (tempDestinationAuthorizationEntry != null)
+            return tempDestinationAuthorizationEntry.getReadACLs();
+        else
+            return null;
     }
-    
+
     public Set getTempDestinationWriteACLs() {
-    	if(tempDestinationAuthorizationEntry != null)
-           	return tempDestinationAuthorizationEntry.getWriteACLs();
-    	else
-    		return null;
-    }       
-        
+        if (tempDestinationAuthorizationEntry != null)
+            return tempDestinationAuthorizationEntry.getWriteACLs();
+        else
+            return null;
+    }
+
     public Set getAdminACLs(ActiveMQDestination destination) {
         return adminACLs.get(destination);
     }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/CommandVisitor.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/CommandVisitor.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/CommandVisitor.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/CommandVisitor.java Wed Aug  8 11:56:59 2007
@@ -47,45 +47,71 @@
 public interface CommandVisitor {
 
     Response processAddConnection(ConnectionInfo info) throws Exception;
+
     Response processAddSession(SessionInfo info) throws Exception;
+
     Response processAddProducer(ProducerInfo info) throws Exception;
+
     Response processAddConsumer(ConsumerInfo info) throws Exception;
-    
+
     Response processRemoveConnection(ConnectionId id) throws Exception;
+
     Response processRemoveSession(SessionId id) throws Exception;
+
     Response processRemoveProducer(ProducerId id) throws Exception;
+
     Response processRemoveConsumer(ConsumerId id) throws Exception;
-    
+
     Response processAddDestination(DestinationInfo info) throws Exception;
+
     Response processRemoveDestination(DestinationInfo info) throws Exception;
+
     Response processRemoveSubscription(RemoveSubscriptionInfo info) throws Exception;
-    
+
     Response processMessage(Message send) throws Exception;
+
     Response processMessageAck(MessageAck ack) throws Exception;
+
     Response processMessagePull(MessagePull pull) throws Exception;
 
     Response processBeginTransaction(TransactionInfo info) throws Exception;
+
     Response processPrepareTransaction(TransactionInfo info) throws Exception;
+
     Response processCommitTransactionOnePhase(TransactionInfo info) throws Exception;
+
     Response processCommitTransactionTwoPhase(TransactionInfo info) throws Exception;
+
     Response processRollbackTransaction(TransactionInfo info) throws Exception;
 
     Response processWireFormat(WireFormatInfo info) throws Exception;
+
     Response processKeepAlive(KeepAliveInfo info) throws Exception;
+
     Response processShutdown(ShutdownInfo info) throws Exception;
+
     Response processFlush(FlushCommand command) throws Exception;
 
     Response processBrokerInfo(BrokerInfo info) throws Exception;
+
     Response processRecoverTransactions(TransactionInfo info) throws Exception;
+
     Response processForgetTransaction(TransactionInfo info) throws Exception;
+
     Response processEndTransaction(TransactionInfo info) throws Exception;
+
     Response processMessageDispatchNotification(MessageDispatchNotification notification) throws Exception;
-	Response processProducerAck(ProducerAck ack) throws Exception;
-	Response processMessageDispatch(MessageDispatch dispatch) throws Exception;
-	Response processControlCommand(ControlCommand command) throws Exception;
-	Response processConnectionError(ConnectionError error) throws Exception;
-	Response processConnectionControl(ConnectionControl control) throws Exception;
-	Response processConsumerControl(ConsumerControl control) throws Exception;
-    
-}
 
+    Response processProducerAck(ProducerAck ack) throws Exception;
+
+    Response processMessageDispatch(MessageDispatch dispatch) throws Exception;
+
+    Response processControlCommand(ControlCommand command) throws Exception;
+
+    Response processConnectionError(ConnectionError error) throws Exception;
+
+    Response processConnectionControl(ConnectionControl control) throws Exception;
+
+    Response processConsumerControl(ConsumerControl control) throws Exception;
+
+}

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/CommandVisitorAdapter.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/CommandVisitorAdapter.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/CommandVisitorAdapter.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/CommandVisitorAdapter.java Wed Aug  8 11:56:59 2007
@@ -46,140 +46,141 @@
 
 public class CommandVisitorAdapter implements CommandVisitor {
 
-	public Response processAddConnection(ConnectionInfo info) throws Exception {
-		return null;
-	}
-
-	public Response processAddConsumer(ConsumerInfo info) throws Exception {
-		return null;
-	}
-
-	public Response processAddDestination(DestinationInfo info) throws Exception {
-		return null;
-	}
-
-	public Response processAddProducer(ProducerInfo info) throws Exception {
-		return null;
-	}
-
-	public Response processAddSession(SessionInfo info) throws Exception {
-		return null;
-	}
-
-	public Response processBeginTransaction(TransactionInfo info) throws Exception {
-		return null;
-	}
-
-	public Response processBrokerInfo(BrokerInfo info) throws Exception {
-		return null;
-	}
-
-	public Response processCommitTransactionOnePhase(TransactionInfo info) throws Exception {
-		return null;
-	}
-
-	public Response processCommitTransactionTwoPhase(TransactionInfo info) throws Exception {
-		return null;
-	}
-
-	public Response processEndTransaction(TransactionInfo info) throws Exception {
-		return null;
-	}
-
-	public Response processFlush(FlushCommand command) throws Exception {
-		return null;
-	}
-
-	public Response processForgetTransaction(TransactionInfo info) throws Exception {
-		return null;
-	}
-
-	public Response processKeepAlive(KeepAliveInfo info) throws Exception {
-		return null;
-	}
-
-	public Response processMessage(Message send) throws Exception {
-		return null;
-	}
-
-	public Response processMessageAck(MessageAck ack) throws Exception {
-		return null;
-	}
-
-	public Response processMessageDispatchNotification(MessageDispatchNotification notification) throws Exception {
-		return null;
-	}
-
-	public Response processMessagePull(MessagePull pull) throws Exception {
-		return null;
-	}
-
-	public Response processPrepareTransaction(TransactionInfo info) throws Exception {
-		return null;
-	}
-
-	public Response processProducerAck(ProducerAck ack) throws Exception {
-		return null;
-	}
-
-	public Response processRecoverTransactions(TransactionInfo info) throws Exception {
-		return null;
-	}
-
-	public Response processRemoveConnection(ConnectionId id) throws Exception {
-		return null;
-	}
-
-	public Response processRemoveConsumer(ConsumerId id) throws Exception {
-		return null;
-	}
-
-	public Response processRemoveDestination(DestinationInfo info) throws Exception {
-		return null;
-	}
-
-	public Response processRemoveProducer(ProducerId id) throws Exception {
-		return null;
-	}
-
-	public Response processRemoveSession(SessionId id) throws Exception {
-		return null;
-	}
-
-	public Response processRemoveSubscription(RemoveSubscriptionInfo info) throws Exception {
-		return null;
-	}
-
-	public Response processRollbackTransaction(TransactionInfo info) throws Exception {
-		return null;
-	}
-
-	public Response processShutdown(ShutdownInfo info) throws Exception {
-		return null;
-	}
-
-	public Response processWireFormat(WireFormatInfo info) throws Exception {
-		return null;
-	}
-
-	public Response processMessageDispatch(MessageDispatch dispatch) throws Exception {
-		return null;
-	}
-
-	public Response processControlCommand(ControlCommand command) throws Exception {
-		return null;
-	}
-
-	public Response processConnectionControl(ConnectionControl control) throws Exception {
-		return null;
-	}
-
-	public Response processConnectionError(ConnectionError error) throws Exception {
-		return null;
-	}
-
-	public Response processConsumerControl(ConsumerControl control) throws Exception {
-		return null;
-	}
+    public Response processAddConnection(ConnectionInfo info) throws Exception {
+        return null;
+    }
+
+    public Response processAddConsumer(ConsumerInfo info) throws Exception {
+        return null;
+    }
+
+    public Response processAddDestination(DestinationInfo info) throws Exception {
+        return null;
+    }
+
+    public Response processAddProducer(ProducerInfo info) throws Exception {
+        return null;
+    }
+
+    public Response processAddSession(SessionInfo info) throws Exception {
+        return null;
+    }
+
+    public Response processBeginTransaction(TransactionInfo info) throws Exception {
+        return null;
+    }
+
+    public Response processBrokerInfo(BrokerInfo info) throws Exception {
+        return null;
+    }
+
+    public Response processCommitTransactionOnePhase(TransactionInfo info) throws Exception {
+        return null;
+    }
+
+    public Response processCommitTransactionTwoPhase(TransactionInfo info) throws Exception {
+        return null;
+    }
+
+    public Response processEndTransaction(TransactionInfo info) throws Exception {
+        return null;
+    }
+
+    public Response processFlush(FlushCommand command) throws Exception {
+        return null;
+    }
+
+    public Response processForgetTransaction(TransactionInfo info) throws Exception {
+        return null;
+    }
+
+    public Response processKeepAlive(KeepAliveInfo info) throws Exception {
+        return null;
+    }
+
+    public Response processMessage(Message send) throws Exception {
+        return null;
+    }
+
+    public Response processMessageAck(MessageAck ack) throws Exception {
+        return null;
+    }
+
+    public Response processMessageDispatchNotification(MessageDispatchNotification notification)
+        throws Exception {
+        return null;
+    }
+
+    public Response processMessagePull(MessagePull pull) throws Exception {
+        return null;
+    }
+
+    public Response processPrepareTransaction(TransactionInfo info) throws Exception {
+        return null;
+    }
+
+    public Response processProducerAck(ProducerAck ack) throws Exception {
+        return null;
+    }
+
+    public Response processRecoverTransactions(TransactionInfo info) throws Exception {
+        return null;
+    }
+
+    public Response processRemoveConnection(ConnectionId id) throws Exception {
+        return null;
+    }
+
+    public Response processRemoveConsumer(ConsumerId id) throws Exception {
+        return null;
+    }
+
+    public Response processRemoveDestination(DestinationInfo info) throws Exception {
+        return null;
+    }
+
+    public Response processRemoveProducer(ProducerId id) throws Exception {
+        return null;
+    }
+
+    public Response processRemoveSession(SessionId id) throws Exception {
+        return null;
+    }
+
+    public Response processRemoveSubscription(RemoveSubscriptionInfo info) throws Exception {
+        return null;
+    }
+
+    public Response processRollbackTransaction(TransactionInfo info) throws Exception {
+        return null;
+    }
+
+    public Response processShutdown(ShutdownInfo info) throws Exception {
+        return null;
+    }
+
+    public Response processWireFormat(WireFormatInfo info) throws Exception {
+        return null;
+    }
+
+    public Response processMessageDispatch(MessageDispatch dispatch) throws Exception {
+        return null;
+    }
+
+    public Response processControlCommand(ControlCommand command) throws Exception {
+        return null;
+    }
+
+    public Response processConnectionControl(ConnectionControl control) throws Exception {
+        return null;
+    }
+
+    public Response processConnectionError(ConnectionError error) throws Exception {
+        return null;
+    }
+
+    public Response processConsumerControl(ConsumerControl control) throws Exception {
+        return null;
+    }
 
 }

Modified: activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionState.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionState.java?view=diff&rev=563982&r1=563981&r2=563982
==============================================================================
--- activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionState.java (original)
+++ activemq/trunk/activemq-core/src/main/java/org/apache/activemq/state/ConnectionState.java Wed Aug  8 11:56:59 2007
@@ -34,71 +34,75 @@
 import org.apache.activemq.command.TransactionId;
 
 public class ConnectionState {
-    
+
     ConnectionInfo info;
     private final ConcurrentHashMap transactions = new ConcurrentHashMap();
     private final ConcurrentHashMap sessions = new ConcurrentHashMap();
     private final List tempDestinations = Collections.synchronizedList(new ArrayList());
     private final AtomicBoolean shutdown = new AtomicBoolean(false);
-    
+
     public ConnectionState(ConnectionInfo info) {
         this.info = info;
         // Add the default session id.
         addSession(new SessionInfo(info, -1));
     }
-    
+
     public String toString() {
         return info.toString();
     }
-    
-	public void reset(ConnectionInfo info) {
-		this.info=info;
-		transactions.clear();
-		sessions.clear();
-		tempDestinations.clear();
-		shutdown.set(false);
-	}
 
+    public void reset(ConnectionInfo info) {
+        this.info = info;
+        transactions.clear();
+        sessions.clear();
+        tempDestinations.clear();
+        shutdown.set(false);
+    }
 
     public void addTempDestination(DestinationInfo info) {
-    	checkShutdown();
+        checkShutdown();
         tempDestinations.add(info);
     }
 
-	public void removeTempDestination(ActiveMQDestination destination) {
+    public void removeTempDestination(ActiveMQDestination destination) {
         for (Iterator iter = tempDestinations.iterator(); iter.hasNext();) {
-            DestinationInfo di = (DestinationInfo) iter.next();
-            if( di.getDestination().equals(destination) ) {
+            DestinationInfo di = (DestinationInfo)iter.next();
+            if (di.getDestination().equals(destination)) {
                 iter.remove();
             }
         }
     }
-	
+
     public void addTransactionState(TransactionId id) {
-    	checkShutdown();
-    	transactions.put(id, new TransactionState(id));
-    }        
+        checkShutdown();
+        transactions.put(id, new TransactionState(id));
+    }
+
     public TransactionState getTransactionState(TransactionId id) {
         return (TransactionState)transactions.get(id);
     }
+
     public Collection getTransactionStates() {
         return transactions.values();
     }
+
     public TransactionState removeTransactionState(TransactionId id) {
-        return (TransactionState) transactions.remove(id);
+        return (TransactionState)transactions.remove(id);
     }
 
     public void addSession(SessionInfo info) {
-    	checkShutdown();
-        sessions.put(info.getSessionId(), new SessionState(info));            
-    }        
+        checkShutdown();
+        sessions.put(info.getSessionId(), new SessionState(info));
+    }
+
     public SessionState removeSession(SessionId id) {
         return (SessionState)sessions.remove(id);
     }
+
     public SessionState getSessionState(SessionId id) {
         return (SessionState)sessions.get(id);
     }
-    
+
     public ConnectionInfo getInfo() {
         return info;
     }
@@ -114,18 +118,18 @@
     public Collection getSessionStates() {
         return sessions.values();
     }
-    
+
     private void checkShutdown() {
-		if( shutdown.get() )
-			throw new IllegalStateException("Disposed");
-	}
-    
+        if (shutdown.get())
+            throw new IllegalStateException("Disposed");
+    }
+
     public void shutdown() {
-    	if( shutdown.compareAndSet(false, true) ) {
-    		for (Iterator iter = sessions.values().iterator(); iter.hasNext();) {
-				SessionState ss = (SessionState) iter.next();
-				ss.shutdown();
-			}
-    	}
+        if (shutdown.compareAndSet(false, true)) {
+            for (Iterator iter = sessions.values().iterator(); iter.hasNext();) {
+                SessionState ss = (SessionState)iter.next();
+                ss.shutdown();
+            }
+        }
     }
 }



Mime
View raw message