dion 2004/09/07 21:49:48
Modified: jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms
StopwatchTag.java OnMessageTag.java
Log:
detab
Revision Changes Path
1.5 +31 -31
jakarta-commons/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/StopwatchTag.java
Index: StopwatchTag.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/StopwatchTag.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- StopwatchTag.java 25 Feb 2004 01:31:54 -0000 1.4
+++ StopwatchTag.java 8 Sep 2004 04:49:48 -0000 1.5
@@ -1,12 +1,12 @@
/*
* Copyright 2002,2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -25,7 +25,7 @@
import org.apache.commons.messenger.tool.StopWatchMessageListener;
-/**
+/**
* This tag can be used to measure the amount of time it takes to process JMS
messages.
* This tag can be wrapped around any custom JMS tag which consumes JMS messages.
*
@@ -36,80 +36,80 @@
/** the underlying MessageListener */
private MessageListener messageListener;
-
+
/** The Log to which logging calls will be made. */
private Log log = LogFactory.getLog( StopwatchTag.class );
-
+
/** the message group size */
private int groupSize = 1000;
public StopwatchTag() {
}
-
+
// Tag interface
- //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
public void doTag(XMLOutput output) throws JellyTagException {
// evaluate body as it may contain child tags to register a MessageListener
invokeBody(output);
-
+
MessageListener listener = getMessageListener();
- ConsumerTag tag = (ConsumerTag)
findAncestorWithClass(ConsumerTag.class);
- if (tag == null) {
- throw new JellyTagException("This tag must be nested within a
ConsumerTag like the subscribe tag");
- }
+ ConsumerTag tag = (ConsumerTag) findAncestorWithClass(ConsumerTag.class);
+ if (tag == null) {
+ throw new JellyTagException("This tag must be nested within a
ConsumerTag like the subscribe tag");
+ }
// clear the listener for the next tag invocation, if caching is employed
setMessageListener(null);
- StopWatchMessageListener stopWatch = new
StopWatchMessageListener(listener);
- stopWatch.setGroupSize(groupSize);
- stopWatch.setLog(log);
+ StopWatchMessageListener stopWatch = new StopWatchMessageListener(listener);
+ stopWatch.setGroupSize(groupSize);
+ stopWatch.setLog(log);
- // perform the consumption
- tag.setMessageListener(stopWatch);
+ // perform the consumption
+ tag.setMessageListener(stopWatch);
}
-
+
// Properties
- //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
/**
* @return the number of messages in the group before the performance
statistics are logged
*/
public int getGroupSize() {
return groupSize;
- }
-
+ }
+
/**
* Sets the number of messages in the group before the performance statistics
are logged
*/
public void setGroupSize(int groupSize) {
this.groupSize = groupSize;
- }
-
-
+ }
+
+
/**
* @return the logger to which statistic messages will be sent
*/
public Log getLog() {
return log;
}
-
+
/**
* Sets the logger to which statistic messages will be sent
*/
public void setLog(Log log) {
this.log = log;
}
-
+
/**
* @return the MessageListener which this listener delegates to
*/
public MessageListener getMessageListener() {
- return messageListener;
+ return messageListener;
}
-
+
/**
* Sets the JMS messageListener used to consume JMS messages on the given
destination
*/
@@ -117,4 +117,4 @@
this.messageListener = messageListener;
}
-}
+}
1.6 +33 -33
jakarta-commons/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/OnMessageTag.java
Index: OnMessageTag.java
===================================================================
RCS file:
/home/cvs/jakarta-commons/jelly/jelly-tags/jms/src/java/org/apache/commons/jelly/tags/jms/OnMessageTag.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- OnMessageTag.java 25 Feb 2004 01:31:54 -0000 1.5
+++ OnMessageTag.java 8 Sep 2004 04:49:48 -0000 1.6
@@ -1,12 +1,12 @@
/*
* Copyright 2002,2004 The Apache Software Foundation.
- *
+ *
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
- *
+ *
* http://www.apache.org/licenses/LICENSE-2.0
- *
+ *
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -27,7 +27,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-/**
+/**
* This tag creates a JMS MessageListener which will invoke this
* tag's body whenever a JMS Message is received. The JMS Message
* will be available via a variable, which defaults to the 'message'
@@ -41,48 +41,48 @@
/** The Log to which logging calls will be made. */
private static final Log log = LogFactory.getLog(OnMessageTag.class);
- private String var = "message";
-
+ private String var = "message";
+
public OnMessageTag() {
}
// Tag interface
- //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
public void doTag(XMLOutput output) throws JellyTagException {
- ConsumerTag tag = (ConsumerTag)
findAncestorWithClass(ConsumerTag.class);
- if (tag == null) {
- throw new JellyTagException("This tag must be nested within a
ConsumerTag like the subscribe tag");
- }
-
- final JellyContext childContext = context.newJellyContext();
- final Script script = getBody();
- final XMLOutput childOutput = output;
-
- MessageListener listener = new MessageListener() {
- public void onMessage(Message message) {
- childContext.setVariable(var, message);
- try {
- script.run(childContext, childOutput);
- }
- catch (Exception e) {
- log.error("Caught exception processing
message: " + message + ". Exception: " + e, e);
- }
- }
- };
+ ConsumerTag tag = (ConsumerTag) findAncestorWithClass(ConsumerTag.class);
+ if (tag == null) {
+ throw new JellyTagException("This tag must be nested within a
ConsumerTag like the subscribe tag");
+ }
+
+ final JellyContext childContext = context.newJellyContext();
+ final Script script = getBody();
+ final XMLOutput childOutput = output;
+
+ MessageListener listener = new MessageListener() {
+ public void onMessage(Message message) {
+ childContext.setVariable(var, message);
+ try {
+ script.run(childContext, childOutput);
+ }
+ catch (Exception e) {
+ log.error("Caught exception processing message: " + message +
". Exception: " + e, e);
+ }
+ }
+ };
- // perform the consumption
- tag.setMessageListener(listener);
+ // perform the consumption
+ tag.setMessageListener(listener);
}
-
+
// Properties
- //-------------------------------------------------------------------------
+ //-------------------------------------------------------------------------
/**
* Sets the name of the variable used to make the JMS message available to this
tags
* body when a message is received.
*/
public void setVar(String var) {
- this.var = var;
+ this.var = var;
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]