james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ieu...@apache.org
Subject svn commit: r1452285 - in /james/server/trunk/queue: queue-activemq/src/main/java/org/apache/james/queue/activemq/ queue-jms/ queue-jms/src/main/java/org/apache/james/queue/jms/ queue-jms/src/main/java/org/apache/james/queue/library/ queue-jms/src/test...
Date Mon, 04 Mar 2013 13:09:30 GMT
Author: ieugen
Date: Mon Mar  4 13:09:30 2013
New Revision: 1452285

URL: http://svn.apache.org/r1452285
Log:
Added @Override to queue

Modified:
    james/server/trunk/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueue.java
    james/server/trunk/queue/queue-jms/pom.xml
    james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueue.java
    james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueueFactory.java
    james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueueItem.java
    james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/jms/MimeMessageObjectMessageSource.java
    james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/library/AbstractMailQueueFactory.java
    james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/library/MailQueueManagement.java
    james/server/trunk/queue/queue-jms/src/test/java/org/apache/james/queue/jms/JMSMailQueueTest.java

Modified: james/server/trunk/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueue.java
URL: http://svn.apache.org/viewvc/james/server/trunk/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueue.java?rev=1452285&r1=1452284&r2=1452285&view=diff
==============================================================================
--- james/server/trunk/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueue.java
(original)
+++ james/server/trunk/queue/queue-activemq/src/main/java/org/apache/james/queue/activemq/ActiveMQMailQueue.java
Mon Mar  4 13:09:30 2013
@@ -117,9 +117,9 @@ public class ActiveMQMailQueue extends J
             try {
                 BlobMessage blobMessage = (BlobMessage) message;
                 try {
-                    // store URL and queuename for later usage
+                    // store URL and queueName for later usage
                     mail.setAttribute(JAMES_BLOB_URL, blobMessage.getURL());
-                    mail.setAttribute(JAMES_QUEUE_NAME, queuename);
+                    mail.setAttribute(JAMES_QUEUE_NAME, queueName);
                 } catch (MalformedURLException e) {
                     // Ignore on error
                     logger.debug("Unable to get url from blobmessage for mail " + mail.getName());
@@ -185,9 +185,9 @@ public class ActiveMQMailQueue extends J
                  
                     
                 // store the queue name in the props
-                props.put(JAMES_QUEUE_NAME, queuename);
+                props.put(JAMES_QUEUE_NAME, queueName);
 
-                Queue queue = session.createQueue(queuename);
+                Queue queue = session.createQueue(queueName);
 
                 producer = session.createProducer(queue);
                 for (Map.Entry<String, Object> entry : props.entrySet()) {
@@ -300,7 +300,7 @@ public class ActiveMQMailQueue extends J
             replyTo = session.createTemporaryQueue();
             consumer = session.createConsumer(replyTo);
 
-            Queue myQueue = session.createQueue(queuename);
+            Queue myQueue = session.createQueue(queueName);
             producer = session.createProducer(null);
 
             String queueName = "ActiveMQ.Statistics.Destination." + myQueue.getQueueName();

Modified: james/server/trunk/queue/queue-jms/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/queue/queue-jms/pom.xml?rev=1452285&r1=1452284&r2=1452285&view=diff
==============================================================================
--- james/server/trunk/queue/queue-jms/pom.xml (original)
+++ james/server/trunk/queue/queue-jms/pom.xml Mon Mar  4 13:09:30 2013
@@ -72,8 +72,8 @@
             <artifactId>protocols-smtp</artifactId>
         </dependency>
         <dependency>
-          <groupId>javax.inject</groupId>
-          <artifactId>javax.inject</artifactId>
+            <groupId>javax.inject</groupId>
+            <artifactId>javax.inject</artifactId>
         </dependency>
 
         <!-- test dependencies -->
@@ -83,6 +83,11 @@
             <scope>test</scope>
         </dependency>
         <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-simple</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
             <groupId>org.apache.activemq</groupId>
             <artifactId>activemq-core</artifactId>
             <scope>test</scope>

Modified: james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueue.java
URL: http://svn.apache.org/viewvc/james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueue.java?rev=1452285&r1=1452284&r2=1452285&view=diff
==============================================================================
--- james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueue.java
(original)
+++ james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueue.java
Mon Mar  4 13:09:30 2013
@@ -18,19 +18,15 @@
  ****************************************************************/
 package org.apache.james.queue.jms;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Enumeration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.StringTokenizer;
-import java.util.concurrent.TimeUnit;
+import com.google.common.io.Closeables;
+import org.apache.james.core.MailImpl;
+import org.apache.james.core.MimeMessageCopyOnWriteProxy;
+import org.apache.james.queue.api.MailPrioritySupport;
+import org.apache.james.queue.api.MailQueue;
+import org.apache.james.queue.api.ManageableMailQueue;
+import org.apache.mailet.Mail;
+import org.apache.mailet.MailAddress;
+import org.slf4j.Logger;
 
 import javax.jms.BytesMessage;
 import javax.jms.Connection;
@@ -46,15 +42,19 @@ import javax.jms.Session;
 import javax.mail.MessagingException;
 import javax.mail.internet.AddressException;
 import javax.mail.internet.MimeMessage;
-
-import org.apache.james.core.MailImpl;
-import org.apache.james.core.MimeMessageCopyOnWriteProxy;
-import org.apache.james.queue.api.MailPrioritySupport;
-import org.apache.james.queue.api.MailQueue;
-import org.apache.james.queue.api.ManageableMailQueue;
-import org.apache.mailet.Mail;
-import org.apache.mailet.MailAddress;
-import org.slf4j.Logger;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.NoSuchElementException;
+import java.util.StringTokenizer;
+import java.util.concurrent.TimeUnit;
 
 /**
  * <p>
@@ -69,14 +69,14 @@ import org.slf4j.Logger;
  */
 public class JMSMailQueue implements ManageableMailQueue, JMSSupport, MailPrioritySupport
{
 
-    protected final String queuename;
+    protected final String queueName;
     protected final ConnectionFactory connectionFactory;
     protected final Logger logger;
     public final static String FORCE_DELIVERY = "FORCE_DELIVERY";
 
-    public JMSMailQueue(final ConnectionFactory connectionFactory, final String queuename,
final Logger logger) {
+    public JMSMailQueue(final ConnectionFactory connectionFactory, final String queueName,
final Logger logger) {
         this.connectionFactory = connectionFactory;
-        this.queuename = queuename;
+        this.queueName = queueName;
         this.logger = logger;
     }
 
@@ -92,6 +92,7 @@ public class JMSMailQueue implements Man
      * should get overridden by these implementations
      * </p>
      */
+    @Override
     public MailQueueItem deQueue() throws MailQueueException {
         Connection connection = null;
         Session session = null;
@@ -104,7 +105,7 @@ public class JMSMailQueue implements Man
                 connection.start();
 
                 session = connection.createSession(true, Session.SESSION_TRANSACTED);
-                Queue queue = session.createQueue(queuename);
+                Queue queue = session.createQueue(queueName);
                 consumer = session.createConsumer(queue, getMessageSelector());
 
                 message = consumer.receive(10000);
@@ -173,10 +174,7 @@ public class JMSMailQueue implements Man
 
     }
 
-    /**
-     * @see org.apache.james.queue.api.MailQueue#enQueue(org.apache.mailet.Mail,
-     * long, java.util.concurrent.TimeUnit)
-     */
+    @Override
     public void enQueue(Mail mail, long delay, TimeUnit unit) throws MailQueueException {
         Connection connection = null;
         Session session = null;
@@ -230,9 +228,7 @@ public class JMSMailQueue implements Man
         }
     }
 
-    /**
-     * @see org.apache.james.queue.api.MailQueue#enQueue(org.apache.mailet.Mail)
-     */
+    @Override
     public void enQueue(Mail mail) throws MailQueueException {
         enQueue(mail, NO_DELAY, TimeUnit.MILLISECONDS);
     }
@@ -244,7 +240,7 @@ public class JMSMailQueue implements Man
         MessageProducer producer = null;
 
         try {
-            Queue queue = session.createQueue(queuename);
+            Queue queue = session.createQueue(queueName);
 
             producer = session.createProducer(queue);
             ObjectMessage message = session.createObjectMessage();
@@ -283,7 +279,7 @@ public class JMSMailQueue implements Man
 
     /**
      * Get JMS Message properties with values
-     * 
+     *
      * @param mail
      * @param delayInMillis
      * @throws JMSException
@@ -347,7 +343,7 @@ public class JMSMailQueue implements Man
     /**
      * Create the complete Mail from the JMS Message. So the created
      * {@link Mail} is completely populated
-     * 
+     *
      * @param message
      * @return the complete mail
      * @throws MessagingException
@@ -365,7 +361,7 @@ public class JMSMailQueue implements Man
      * Populat the given {@link Mail} instance with a {@link MimeMessage}. The
      * {@link MimeMessage} is read from the JMS Message. This implementation use
      * a {@link BytesMessage}
-     * 
+     *
      * @param message
      * @param mail
      * @throws MessagingException
@@ -382,7 +378,7 @@ public class JMSMailQueue implements Man
     /**
      * Populate Mail with values from Message. This exclude the
      * {@link MimeMessage}
-     * 
+     *
      * @param message
      * @param mail
      * @throws JMSException
@@ -396,14 +392,14 @@ public class JMSMailQueue implements Man
         String recipients = message.getStringProperty(JAMES_MAIL_RECIPIENTS);
         StringTokenizer recipientTokenizer = new StringTokenizer(recipients, JAMES_MAIL_SEPARATOR);
         while (recipientTokenizer.hasMoreTokens()) {
-        	String token = recipientTokenizer.nextToken();
+            String token = recipientTokenizer.nextToken();
             try {
                 MailAddress rcpt = new MailAddress(token);
                 rcpts.add(rcpt);
             } catch (AddressException e) {
                 // Should never happen as long as the user does not modify the
                 // the header by himself
-            	logger.error("Unable to parse the recipient address " + token + " for mail "
+ mail.getName() + ", so we ignore it", e);
+                logger.error("Unable to parse the recipient address " + token + " for mail
" + mail.getName() + ", so we ignore it", e);
             }
         }
         mail.setRecipients(rcpts);
@@ -414,14 +410,14 @@ public class JMSMailQueue implements Man
         StringTokenizer namesTokenizer = new StringTokenizer(attributeNames, JAMES_MAIL_SEPARATOR);
         while (namesTokenizer.hasMoreTokens()) {
             String name = namesTokenizer.nextToken();
-            
+
             // Now cast the property back to Serializable and set it as attribute.
             // See JAMES-1241
             Object attrValue = message.getObjectProperty(name);
-           
+
             // ignore null values. See JAMES-1294
             if (attrValue != null) {
-                if (attrValue instanceof Serializable) {   
+                if (attrValue instanceof Serializable) {
                     mail.setAttribute(name, (Serializable) attrValue);
                 } else {
                     logger.error("Not supported mail attribute " + name + " of type " + attrValue
+ " for mail " + mail.getName());
@@ -438,8 +434,8 @@ public class JMSMailQueue implements Man
             } catch (AddressException e) {
                 // Should never happen as long as the user does not modify the
                 // the header by himself
-            	logger.error("Unable to parse the sender address " + sender + " for mail " +
mail.getName() + ", so we fallback to a null sender", e);
-            	mail.setSender(null);
+                logger.error("Unable to parse the sender address " + sender + " for mail
" + mail.getName() + ", so we fallback to a null sender", e);
+                mail.setSender(null);
             }
         }
 
@@ -449,7 +445,7 @@ public class JMSMailQueue implements Man
 
     /**
      * Convert the attribute value if necessary.
-     * 
+     *
      * @param value
      * @return convertedValue
      */
@@ -462,12 +458,12 @@ public class JMSMailQueue implements Man
 
     @Override
     public String toString() {
-        return "MailQueue:" + queuename;
+        return "MailQueue:" + queueName;
     }
 
     /**
      * Create a {@link org.apache.james.queue.api.MailQueue.MailQueueItem} for the given
parameters
-     * 
+     *
      * @param connection
      * @param session
      * @param consumer
@@ -485,10 +481,8 @@ public class JMSMailQueue implements Man
         return JAMES_NEXT_DELIVERY + " <= " + System.currentTimeMillis() + " OR " + FORCE_DELIVERY
+ " = true";
     }
 
-    /**
-     * @see org.apache.james.queue.api.ManageableMailQueue#getSize()
-     */
     @SuppressWarnings("unchecked")
+    @Override
     public long getSize() throws MailQueueException {
         Connection connection = null;
         Session session = null;
@@ -498,7 +492,7 @@ public class JMSMailQueue implements Man
             connection = connectionFactory.createConnection();
             connection.start();
             session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-            Queue queue = session.createQueue(queuename);
+            Queue queue = session.createQueue(queueName);
 
             browser = session.createBrowser(queue);
 
@@ -510,8 +504,8 @@ public class JMSMailQueue implements Man
             }
             return size;
         } catch (Exception e) {
-            logger.error("Unable to get size of queue " + queuename, e);
-            throw new MailQueueException("Unable to get size of queue " + queuename, e);
+            logger.error("Unable to get size of queue " + queueName, e);
+            throw new MailQueueException("Unable to get size of queue " + queueName, e);
         } finally {
             try {
                 if (browser != null)
@@ -536,9 +530,7 @@ public class JMSMailQueue implements Man
         }
     }
 
-    /**
-     * @see org.apache.james.queue.api.ManageableMailQueue#flush()
-     */
+    @Override
     public long flush() throws MailQueueException {
         Connection connection = null;
         Session session = null;
@@ -552,7 +544,7 @@ public class JMSMailQueue implements Man
             connection.start();
 
             session = connection.createSession(true, Session.SESSION_TRANSACTED);
-            Queue queue = session.createQueue(queuename);
+            Queue queue = session.createQueue(queueName);
             consumer = session.createConsumer(queue);
             producer = session.createProducer(queue);
 
@@ -581,7 +573,7 @@ public class JMSMailQueue implements Man
             } catch (JMSException e1) {
                 // ignore on rollback
             }
-            throw new MailQueueException("Unable to get size of queue " + queuename, e);
+            throw new MailQueueException("Unable to get size of queue " + queueName, e);
         } finally {
             if (consumer != null) {
 
@@ -616,9 +608,7 @@ public class JMSMailQueue implements Man
         }
     }
 
-    /**
-     * @see org.apache.james.queue.api.MailQueueManagementMBean#clear()
-     */
+    @Override
     public long clear() throws MailQueueException {
         return count(removeWithSelector(null));
     }
@@ -633,7 +623,7 @@ public class JMSMailQueue implements Man
 
     /**
      * Remove messages with the given selector
-     * 
+     *
      * @param selector
      * @return messages
      */
@@ -650,7 +640,7 @@ public class JMSMailQueue implements Man
             connection.start();
 
             session = connection.createSession(true, Session.SESSION_TRANSACTED);
-            Queue queue = session.createQueue(queuename);
+            Queue queue = session.createQueue(queueName);
             consumer = session.createConsumer(queue, selector);
             while (first || message != null) {
                 if (first) {
@@ -703,7 +693,7 @@ public class JMSMailQueue implements Man
     /**
      * Create a copy of the given {@link Message}. This includes the properties
      * and the payload
-     * 
+     *
      * @param session
      * @param m
      * @return copy
@@ -723,28 +713,22 @@ public class JMSMailQueue implements Man
         return copy;
     }
 
-    /**
-     * @see
-     * org.apache.james.queue.api.ManageableMailQueue#remove(org.apache.james.queue.api.ManageableMailQueue.Type,
-     * java.lang.String)
-     */
+    @Override
     public long remove(Type type, String value) throws MailQueueException {
         switch (type) {
-        case Name:
-            return count(removeWithSelector(JAMES_MAIL_NAME + " = '" + value + "'"));
-        case Sender:
-            return count(removeWithSelector(JAMES_MAIL_SENDER + " = '" + value + "'"));
-        case Recipient:
-            return count(removeWithSelector(JAMES_MAIL_RECIPIENTS + " = '" + value + "' or
" + JAMES_MAIL_RECIPIENTS + " = '%," + value + "' or " + JAMES_MAIL_RECIPIENTS + " = '%,"
+ value + "%'"));
-        default:
-            break;
+            case Name:
+                return count(removeWithSelector(JAMES_MAIL_NAME + " = '" + value + "'"));
+            case Sender:
+                return count(removeWithSelector(JAMES_MAIL_SENDER + " = '" + value + "'"));
+            case Recipient:
+                return count(removeWithSelector(JAMES_MAIL_RECIPIENTS + " = '" + value +
"' or " + JAMES_MAIL_RECIPIENTS + " = '%," + value + "' or " + JAMES_MAIL_RECIPIENTS + " =
'%," + value + "%'"));
+            default:
+                break;
         }
         return -1;
     }
 
-    /**
-     * @see org.apache.james.queue.api.ManageableMailQueue#browse()
-     */
+    @Override
     @SuppressWarnings("unchecked")
     public MailQueueIterator browse() throws MailQueueException {
         Connection connection = null;
@@ -754,28 +738,24 @@ public class JMSMailQueue implements Man
             connection = connectionFactory.createConnection();
             connection.start();
             session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-            Queue queue = session.createQueue(queuename);
+            Queue queue = session.createQueue(queueName);
 
             browser = session.createBrowser(queue);
 
             final Enumeration<Message> messages = browser.getEnumeration();
 
-            final Connection myconnection = connection;
-            final Session mysession = session;
-            final QueueBrowser mybrowser = browser;
+            final Connection myConnection = connection;
+            final Session mySession = session;
+            final QueueBrowser myBrowser = browser;
 
             return new MailQueueIterator() {
 
-                /**
-                 * Not supported, read-only
-                 */
+                @Override
                 public void remove() {
                     throw new UnsupportedOperationException("Read-only");
                 }
 
-                /**
-                 * @see java.util.Iterator#next()
-                 */
+                @Override
                 public MailQueueItemView next() {
                     while (hasNext()) {
                         try {
@@ -784,18 +764,12 @@ public class JMSMailQueue implements Man
                             final long nextDelivery = m.getLongProperty(JAMES_NEXT_DELIVERY);
                             return new MailQueueItemView() {
 
-                                /**
-                                 * @see
-                                 * org.apache.james.queue.api.ManageableMailQueue.MailQueueItemView#getNextDelivery()
-                                 */
+                                @Override
                                 public long getNextDelivery() {
                                     return nextDelivery;
                                 }
 
-                                /**
-                                 * @see
-                                 * org.apache.james.queue.api.ManageableMailQueue.MailQueueItemView#getMail()
-                                 */
+                                @Override
                                 public Mail getMail() {
                                     return mail;
                                 }
@@ -808,39 +782,33 @@ public class JMSMailQueue implements Man
                     }
 
                     throw new NoSuchElementException();
-
                 }
 
-                /**
-                 * @see java.util.Iterator#hasNext()
-                 */
+                @Override
                 public boolean hasNext() {
                     return messages.hasMoreElements();
                 }
 
-                /**
-                 * @see
-                 * org.apache.james.queue.api.ManageableMailQueue.MailQueueIterator#close()
-                 */
+                @Override
                 public void close() {
 
                     try {
-                        if (mybrowser != null)
-                            mybrowser.close();
+                        if (myBrowser != null)
+                            myBrowser.close();
                     } catch (JMSException e1) {
                         // ignore here
                     }
 
                     try {
-                        if (mysession != null)
-                            mysession.close();
+                        if (mySession != null)
+                            mySession.close();
                     } catch (JMSException e1) {
                         // ignore here
                     }
 
                     try {
-                        if (myconnection != null)
-                            myconnection.close();
+                        if (myConnection != null)
+                            myConnection.close();
                     } catch (JMSException e1) {
                         // ignore here
                     }
@@ -869,8 +837,8 @@ public class JMSMailQueue implements Man
             } catch (JMSException e1) {
                 // ignore here
             }
-            logger.error("Unable to browse queue " + queuename, e);
-            throw new MailQueueException("Unable to browse queue " + queuename, e);
+            logger.error("Unable to browse queue " + queueName, e);
+            throw new MailQueueException("Unable to browse queue " + queueName, e);
         }
     }
 

Modified: james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueueFactory.java
URL: http://svn.apache.org/viewvc/james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueueFactory.java?rev=1452285&r1=1452284&r2=1452285&view=diff
==============================================================================
--- james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueueFactory.java
(original)
+++ james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueueFactory.java
Mon Mar  4 13:09:30 2013
@@ -40,11 +40,7 @@ public class JMSMailQueueFactory extends
         this.connectionFactory = connectionFactory;
     }
 
-    /**
-     * @see
-     * org.apache.james.queue.library.AbstractMailQueueFactory#createMailQueue
-     * (java.lang.String)
-     */
+    @Override
     protected MailQueue createMailQueue(String name) {
         return new JMSMailQueue(connectionFactory, name, log);
     }

Modified: james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueueItem.java
URL: http://svn.apache.org/viewvc/james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueueItem.java?rev=1452285&r1=1452284&r2=1452285&view=diff
==============================================================================
--- james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueueItem.java
(original)
+++ james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/jms/JMSMailQueueItem.java
Mon Mar  4 13:09:30 2013
@@ -45,9 +45,7 @@ public class JMSMailQueueItem implements
         this.consumer = consumer;
     }
 
-    /**
-     * @see org.apache.james.queue.api.MailQueue.MailQueueItem#done(boolean)
-     */
+    @Override
     public void done(boolean success) throws MailQueueException {
         try {
             if (success) {
@@ -86,9 +84,7 @@ public class JMSMailQueueItem implements
         }
     }
 
-    /**
-     * @see org.apache.james.queue.api.MailQueue.MailQueueItem#getMail()
-     */
+    @Override
     public Mail getMail() {
         return mail;
     }

Modified: james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/jms/MimeMessageObjectMessageSource.java
URL: http://svn.apache.org/viewvc/james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/jms/MimeMessageObjectMessageSource.java?rev=1452285&r1=1452284&r2=1452285&view=diff
==============================================================================
--- james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/jms/MimeMessageObjectMessageSource.java
(original)
+++ james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/jms/MimeMessageObjectMessageSource.java
Mon Mar  4 13:09:30 2013
@@ -53,23 +53,17 @@ public class MimeMessageObjectMessageSou
         return content.length;
     }
 
-    /**
-     * @see org.apache.james.core.MimeMessageSource#getInputStream()
-     */
+    @Override
     public InputStream getInputStream() throws IOException {
         return in.newStream(0, -1);
     }
 
-    /**
-     * @see org.apache.james.core.MimeMessageSource#getSourceId()
-     */
+    @Override
     public String getSourceId() {
         return id;
     }
 
-    /**
-     * @see org.apache.james.lifecycle.api.Disposable#dispose()
-     */
+    @Override
     public void dispose() {
         try {
             in.close();

Modified: james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/library/AbstractMailQueueFactory.java
URL: http://svn.apache.org/viewvc/james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/library/AbstractMailQueueFactory.java?rev=1452285&r1=1452284&r2=1452285&view=diff
==============================================================================
--- james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/library/AbstractMailQueueFactory.java
(original)
+++ james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/library/AbstractMailQueueFactory.java
Mon Mar  4 13:09:30 2013
@@ -70,10 +70,7 @@ public abstract class AbstractMailQueueF
 
     }
 
-    /**
-     * @see
-     * org.apache.james.queue.api.MailQueueFactory#getQueue(java.lang.String)
-     */
+    @Override
     public synchronized final MailQueue getQueue(String name) {
         
         MailQueue queue = queues.get(name);
@@ -128,9 +125,7 @@ public abstract class AbstractMailQueueF
 
     }
 
-    /**
-     * @see org.apache.james.lifecycle.api.LogEnabled#setLog(org.slf4j.Logger)
-     */
+    @Override
     public void setLog(Logger log) {
         this.log = log;
     }

Modified: james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/library/MailQueueManagement.java
URL: http://svn.apache.org/viewvc/james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/library/MailQueueManagement.java?rev=1452285&r1=1452284&r2=1452285&view=diff
==============================================================================
--- james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/library/MailQueueManagement.java
(original)
+++ james/server/trunk/queue/queue-jms/src/main/java/org/apache/james/queue/library/MailQueueManagement.java
Mon Mar  4 13:09:30 2013
@@ -18,13 +18,14 @@
  ****************************************************************/
 package org.apache.james.queue.library;
 
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
+import org.apache.james.queue.api.MailQueue.MailQueueException;
+import org.apache.james.queue.api.MailQueueManagementMBean;
+import org.apache.james.queue.api.ManageableMailQueue;
+import org.apache.james.queue.api.ManageableMailQueue.MailQueueItemView;
+import org.apache.james.queue.api.ManageableMailQueue.MailQueueIterator;
+import org.apache.james.queue.api.ManageableMailQueue.Type;
+import org.apache.mailet.Mail;
+import org.apache.mailet.MailAddress;
 
 import javax.management.NotCompliantMBeanException;
 import javax.management.StandardMBean;
@@ -33,15 +34,13 @@ import javax.management.openmbean.Compos
 import javax.management.openmbean.CompositeType;
 import javax.management.openmbean.OpenType;
 import javax.management.openmbean.SimpleType;
-
-import org.apache.james.queue.api.MailQueueManagementMBean;
-import org.apache.james.queue.api.ManageableMailQueue;
-import org.apache.james.queue.api.MailQueue.MailQueueException;
-import org.apache.james.queue.api.ManageableMailQueue.MailQueueItemView;
-import org.apache.james.queue.api.ManageableMailQueue.MailQueueIterator;
-import org.apache.james.queue.api.ManageableMailQueue.Type;
-import org.apache.mailet.Mail;
-import org.apache.mailet.MailAddress;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 
 /**
  * JMX MBean implementation which expose management functions by wrapping a
@@ -56,9 +55,7 @@ public class MailQueueManagement extends
 
     }
 
-    /**
-     * @see org.apache.james.queue.api.MailQueueManagementMBean#clear()
-     */
+    @Override
     public long clear() throws Exception {
         try {
             return queue.clear();
@@ -67,9 +64,7 @@ public class MailQueueManagement extends
         }
     }
 
-    /**
-     * @see org.apache.james.queue.api.MailQueueManagementMBean#flush()
-     */
+    @Override
     public long flush() throws Exception {
         try {
             return queue.flush();
@@ -78,9 +73,7 @@ public class MailQueueManagement extends
         }
     }
 
-    /**
-     * @see org.apache.james.queue.api.MailQueueManagementMBean#getSize()
-     */
+    @Override
     public long getSize() throws Exception {
         try {
             return queue.getSize();
@@ -89,10 +82,7 @@ public class MailQueueManagement extends
         }
     }
 
-    /**
-     * @see
-     * org.apache.james.queue.api.MailQueueManagementMBean#removeWithName(java.lang.String)
-     */
+    @Override
     public long removeWithName(String name) throws Exception {
         try {
             return queue.remove(Type.Name, name);
@@ -101,11 +91,7 @@ public class MailQueueManagement extends
         }
     }
 
-    /**
-     * @see
-     * org.apache.james.queue.api.MailQueueManagementMBean#removeWithRecipient
-     * (java.lang.String)
-     */
+    @Override
     public long removeWithRecipient(String address) throws Exception {
         try {
             return queue.remove(Type.Recipient, address);
@@ -114,10 +100,7 @@ public class MailQueueManagement extends
         }
     }
 
-    /**
-     * @see
-     * org.apache.james.queue.api.MailQueueManagementMBean#removeWithSender(java.lang.String)
-     */
+    @Override
     public long removeWithSender(String address) throws Exception {
         try {
             return queue.remove(Type.Sender, address);
@@ -126,16 +109,14 @@ public class MailQueueManagement extends
         }
     }
 
-    /**
-     * @see org.apache.james.queue.api.MailQueueManagementMBean#browse()
-     */
+    @Override
     @SuppressWarnings("unchecked")
     public List<CompositeData> browse() throws Exception {
         MailQueueIterator it = queue.browse();
         List<CompositeData> data = new ArrayList<CompositeData>();
-        String[] names = new String[] { "name", "sender", "state", "recipients", "size",
"lastUpdated", "remoteAddress", "remoteHost", "errorMessage", "attributes", "nextDelivery"
};
-        String[] descs = new String[] { "Unique name", "Sender", "Current state", "Recipients",
"Size in bytes", "Timestamp of last update", "IPAddress of the sender", "Hostname of the sender",
"Errormessage if any", "Attributes stored", "Timestamp of when the next delivery attempt will
be make" };
-        OpenType[] types = new OpenType[] { SimpleType.STRING, SimpleType.STRING, SimpleType.STRING,
SimpleType.STRING, SimpleType.LONG, SimpleType.LONG, SimpleType.STRING, SimpleType.STRING,
SimpleType.STRING, SimpleType.STRING, SimpleType.LONG };
+        String[] names = new String[]{"name", "sender", "state", "recipients", "size", "lastUpdated",
"remoteAddress", "remoteHost", "errorMessage", "attributes", "nextDelivery"};
+        String[] descs = new String[]{"Unique name", "Sender", "Current state", "Recipients",
"Size in bytes", "Timestamp of last update", "IPAddress of the sender", "Hostname of the sender",
"Errormessage if any", "Attributes stored", "Timestamp of when the next delivery attempt will
be make"};
+        OpenType[] types = new OpenType[]{SimpleType.STRING, SimpleType.STRING, SimpleType.STRING,
SimpleType.STRING, SimpleType.LONG, SimpleType.LONG, SimpleType.STRING, SimpleType.STRING,
SimpleType.STRING, SimpleType.STRING, SimpleType.LONG};
 
         while (it.hasNext()) {
 

Modified: james/server/trunk/queue/queue-jms/src/test/java/org/apache/james/queue/jms/JMSMailQueueTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/queue/queue-jms/src/test/java/org/apache/james/queue/jms/JMSMailQueueTest.java?rev=1452285&r1=1452284&r2=1452285&view=diff
==============================================================================
--- james/server/trunk/queue/queue-jms/src/test/java/org/apache/james/queue/jms/JMSMailQueueTest.java
(original)
+++ james/server/trunk/queue/queue-jms/src/test/java/org/apache/james/queue/jms/JMSMailQueueTest.java
Mon Mar  4 13:09:30 2013
@@ -18,13 +18,6 @@
  ****************************************************************/
 package org.apache.james.queue.jms;
 
-import java.io.IOException;
-import java.util.*;
-import java.util.concurrent.TimeUnit;
-import javax.jms.ConnectionFactory;
-import javax.mail.MessagingException;
-import javax.mail.Session;
-import javax.mail.internet.MimeMessage;
 import org.apache.activemq.ActiveMQConnectionFactory;
 import org.apache.activemq.broker.BrokerService;
 import org.apache.activemq.broker.region.policy.PolicyEntry;
@@ -37,17 +30,33 @@ import org.apache.james.queue.api.Manage
 import org.apache.mailet.Mail;
 import org.apache.mailet.MailAddress;
 import org.junit.After;
-import static org.junit.Assert.*;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
 import org.junit.Before;
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.jms.ConnectionFactory;
+import javax.mail.MessagingException;
+import javax.mail.Session;
+import javax.mail.internet.MimeMessage;
+import java.io.IOException;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.Enumeration;
+import java.util.Iterator;
+import java.util.Properties;
+import java.util.UUID;
+import java.util.concurrent.TimeUnit;
+
 public class JMSMailQueueTest {
 
+    protected final static String QUEUE_NAME = "test";
     protected JMSMailQueue queue;
     private BrokerService broker;
-    protected final static String QUEUE_NAME = "test";
 
     @Before
     public void setUp() throws Exception {
@@ -77,13 +86,10 @@ public class JMSMailQueueTest {
         aBroker.setDestinationPolicy(pMap);
 
         return aBroker;
-
     }
 
     protected JMSMailQueue createQueue(ConnectionFactory factory, String queueName) {
-        Logger log = LoggerFactory.getLogger("MockLog");
-        // slf4j can't set programmatically any log level. It's just a facade
-        // log.setLevel(SimpleLog.LOG_LEVEL_DEBUG);
+        Logger log = LoggerFactory.getLogger(JMSMailQueueTest.class);
         return new JMSMailQueue(factory, queueName, log);
     }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message