activemq-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rajdav...@apache.org
Subject svn commit: r908869 - in /activemq/trunk/activemq-web-console/src/main: java/org/apache/activemq/web/controller/SendMessage.java webapp/send.jsp
Date Thu, 11 Feb 2010 08:22:33 GMT
Author: rajdavies
Date: Thu Feb 11 08:22:31 2010
New Revision: 908869

URL: http://svn.apache.org/viewvc?rev=908869&view=rev
Log:
Added cron support for scheduled delivery - this is further enhancements for 
https://issues.apache.org/activemq/browse/AMQ-451

Modified:
    activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/controller/SendMessage.java
    activemq/trunk/activemq-web-console/src/main/webapp/send.jsp

Modified: activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/controller/SendMessage.java
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/controller/SendMessage.java?rev=908869&r1=908868&r2=908869&view=diff
==============================================================================
--- activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/controller/SendMessage.java
(original)
+++ activemq/trunk/activemq-web-console/src/main/java/org/apache/activemq/web/controller/SendMessage.java
Thu Feb 11 08:22:31 2010
@@ -18,12 +18,10 @@
 
 import java.util.Iterator;
 import java.util.Map;
-
 import javax.jms.JMSException;
 import javax.jms.Message;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
-
 import org.apache.activemq.command.ActiveMQDestination;
 import org.apache.activemq.web.BrokerFacade;
 import org.apache.activemq.web.DestinationFacade;
@@ -66,7 +64,8 @@
         return redirectToBrowseView();
     }
 
-    protected void sendMessages(HttpServletRequest request, WebClient client, ActiveMQDestination
dest) throws JMSException {
+    protected void sendMessages(HttpServletRequest request, WebClient client, ActiveMQDestination
dest)
+            throws JMSException {
         if (jmsMessageCount <= 1) {
             jmsMessageCount = 1;
         }
@@ -177,34 +176,56 @@
         Map map = request.getParameterMap();
         if (map != null) {
             for (Iterator iter = map.entrySet().iterator(); iter.hasNext();) {
-                Map.Entry entry = (Map.Entry)iter.next();
-                String name = (String)entry.getKey();
+                Map.Entry entry = (Map.Entry) iter.next();
+                String name = (String) entry.getKey();
                 Object value = entry.getValue();
                 if (isValidPropertyName(name)) {
                     if (value instanceof String[]) {
-                        String[] array = (String[])value;
+                        String[] array = (String[]) value;
                         if (array.length > 0) {
                             value = array[0];
                         } else {
                             value = null;
                         }
                     }
-                    if (value instanceof String) {
-                        String text = value.toString().trim();
-                        if (text.length() == 0) {
-                            value = null;
-                        } else {
-                            value = text;
+                    if ((name.equals("AMQ_SCHEDULED_DELAY") || name.equals("AMQ_SCHEDULED_PERIOD")))
{
+                        if (value != null) {
+                            String str = value.toString().trim();
+                            if (str.length() > 0) {
+                                message.setLongProperty(name, Long.parseLong(str));
+                            }
+                        }
+                    } else if (name.equals("AMQ_SCHEDULED_REPEAT")) {
+                        if (value != null) {
+                            String str = value.toString().trim();
+                            if (str.length() > 0) {
+                                message.setIntProperty(name, Integer.parseInt(str));
+                            }
+                        }
+                    } else if (name.equals("AMQ_SCHEDULED_CRON")) {
+                        if (value != null) {
+                            String str = value.toString().trim();
+                            if (str.length() > 0) {
+                                message.setStringProperty(name, str);
+                            }
+                        }
+                    } else {
+                        if (value instanceof String) {
+                            String text = value.toString().trim();
+                            if (text.length() == 0) {
+                                value = null;
+                            } else {
+                                value = text;
+                            }
+                        }
+                        if (value != null) {
+                            message.setObjectProperty(name, value);
                         }
-                    }
-                    if (value != null) {
-                        message.setObjectProperty(name, value);
                     }
                 }
             }
         }
     }
-
     protected boolean isValidPropertyName(String name) {
         // allow JMSX extensions or non JMS properties
         return name.startsWith("JMSX") || !name.startsWith("JMS");

Modified: activemq/trunk/activemq-web-console/src/main/webapp/send.jsp
URL: http://svn.apache.org/viewvc/activemq/trunk/activemq-web-console/src/main/webapp/send.jsp?rev=908869&r1=908868&r2=908869&view=diff
==============================================================================
--- activemq/trunk/activemq-web-console/src/main/webapp/send.jsp (original)
+++ activemq/trunk/activemq-web-console/src/main/webapp/send.jsp Thu Feb 11 08:22:31 2010
@@ -107,10 +107,10 @@
 </tr>
 <tr>
 	<td class="label">
-	    <label for="AMQ_SCHEDULED_START_TIME">Scheduled start(ms)</label>
+	    <label for="AMQ_SCHEDULED_DELAY">delay(ms)</label>
 	</td>
 	<td>
-	    <form:text name="AMQ_SCHEDULED_START_TIME"/>
+	    <form:text name="AMQ_SCHEDULED_DELAY"/>
 	</td>
 	<td class="label">
 	    <label for="AMQ_SCHEDULED_PERIOD">Time(ms) to wait before scheduling again</label>



Mime
View raw message