public class MessageUtils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static float |
JAVA_VERSION |
static java.lang.String |
OS_ARCH |
static java.lang.String |
OS_NAME |
static java.lang.String |
OS_VERSION |
static int |
RC_AUTHERROR
auth failure
|
static int |
RC_BADDATA
unexpected request data
|
static int |
RC_BADRESP
unexpected response
|
static int |
RC_DBERROR
Database failure
|
static int |
RC_EXPIRED
message expired
|
static int |
RC_IOERROR
IO faillure
|
static int |
RC_JMSERROR
JMS failure
|
static int |
RC_MSGERROR
unexpected message type
|
static int |
RC_NOTFOUND
required msg property not found
|
static int |
RC_OK
everything is OK
|
static int |
RC_REQERROR
illegal request
|
static int |
RC_TIMEOUT
request timed out
|
static int |
RC_UNKNOWN
unexpected error
|
static int |
SHOW_AGE |
static int |
SHOW_BODY |
static int |
SHOW_CORRID |
static int |
SHOW_DATE |
static int |
SHOW_DCOUNT |
static int |
SHOW_DMODE |
static int |
SHOW_DST |
static int |
SHOW_EXPIRY |
static int |
SHOW_FAMILY |
static int |
SHOW_MSGID |
static int |
SHOW_MSGTYPE |
static int |
SHOW_NOTHING |
static int |
SHOW_PRIORITY |
static int |
SHOW_PROPS |
static int |
SHOW_REPLY |
static int |
SHOW_SIZE |
static int |
SHOW_TSTAMP |
static java.lang.String |
USER_NAME |
static int |
XA_CLIENT |
static int |
XA_COMMIT |
Constructor and Description |
---|
MessageUtils()
default constructor for MessageUtils
|
Modifier and Type | Method and Description |
---|---|
static javax.jms.Message |
convert(java.util.Map map,
java.lang.String text)
converts a set of attributes in the map into a JMS TextEvent
|
static javax.jms.Message |
convert(javax.jms.Message msg,
int type,
byte[] buffer)
converts a message into a JMSEvent in the specific type and returns
the new message where type 0 is for BytesMessage, 1 for TextMessage,
2 for MapMessage and 3 for ObjectMessage.
|
static int |
copy(javax.jms.Message msg,
javax.jms.Message message,
byte[] buffer)
copies a message into another message and returns 1 with changes or
0 without changes.
|
static int |
copyBytes(javax.jms.BytesMessage msg,
byte[] buffer,
java.io.OutputStream out)
It copies bytes from the body of the BytesMessage to the output stream.
|
static int |
copyBytes(java.io.InputStream in,
byte[] buffer,
javax.jms.BytesMessage msg)
It copies bytes from the input stream to the body of the BytesMessage.
|
static void |
disableFlowControl(javax.jms.Session s)
disables the flow control on the SoniceMQ JMS session
|
static java.lang.String |
display(javax.jms.Message inMessage,
java.lang.String msgStr,
int displayMask,
java.lang.String[] propertyName)
returns a string for display purpose
|
static javax.jms.Message |
duplicate(javax.jms.Message msg,
byte[] buffer)
duplicates a message and returns a JMSEvent in the same type.
|
static void |
enableFlowControl(javax.jms.Session s)
enables the flow control on the SoniceMQ JMS session
|
static java.lang.String |
format(javax.jms.MapMessage msg,
java.lang.String mapKey,
Template template)
returns a formatted string of the MapMessage with the given template
and an optional key for accessing to the property of Map.
|
static java.lang.String |
format(javax.jms.Message msg,
byte[] buffer,
Template template)
returns a formatted string of the message with the given template
|
static java.lang.String |
format(javax.jms.Message msg,
byte[] buffer,
Template template,
java.util.Map subMap)
returns a formatted string of the message with the given template
and a set of substitutions
|
static java.lang.String |
format(javax.jms.Message msg,
byte[] buffer,
Template template,
Template repeat,
java.util.Map exclude)
It returns a formatted string of the message with the given template
and a repeated template.
|
static java.lang.String |
format(java.lang.String prefix,
Template[] template,
TextSubstitution[] substitution,
byte[] buffer,
javax.jms.Message inMessage)
returns a formatted string of the content of the message according to
the given set of templates and substitutions.
|
static java.lang.String[] |
getColumns(java.lang.String query)
It parses the MSQL query and returns a sorted list of the column names
in the query.
|
static java.lang.Object[] |
getPlugins(java.util.Map props,
java.lang.String argName,
java.lang.String methodName,
java.lang.String[] argClassNames,
java.lang.String closerName,
java.lang.String prefix)
It returns an Object array with plugin method, plugin object and a
method to close all resources.
|
static java.lang.String |
getProperty(java.lang.String name,
javax.jms.Message msg)
returns the property value of the name from the message
|
static java.lang.String |
getPropertyID(java.lang.String name)
returns the property ID for a JMSProperty
|
static java.lang.String |
getQueue(java.lang.String query)
It parses the MSQL query and returns the queue name or null
|
static int |
getResult(int type,
int maxMsg,
Template temp,
XQueue xq,
byte[] buffer,
java.lang.StringBuffer strBuf)
It gets all the messages from the XQueue and packs them into a
StringBuffer according to the ResultType.
|
static java.lang.String |
getSelector(java.lang.String query)
It parses the MSQL query and returns the message selector or null
|
static byte[] |
hexString2Bytes(java.lang.String hexStr)
returns a byte array for the number of the hex string
|
static java.lang.String |
list(javax.jms.Message msg,
int type)
returns a string on the message for list purpose
|
static java.util.Map<java.lang.String,java.lang.String> |
listXQ(XQueue xq,
int type,
java.lang.String[] pn)
lists all NEW messages in a specific XQ and returns a Map based on
the given resultType and the property list.
|
static byte[] |
long2Bytes(long l)
returns a byte array for the number
|
static int |
pack(int maxMsg,
java.lang.String prefix,
Template template,
XQueue xq,
byte[] buffer,
javax.jms.Message inMessage)
returns the number of messages packed into inMessage's body on success,
or -1 if failed.
|
static java.lang.Throwable |
parse(java.lang.reflect.Method parse,
java.lang.Object parser,
java.lang.String msgStr,
javax.jms.Message message)
It parses the text and fills the result into the message.
|
static void |
pause(XQueue xq)
sets PAUSE bit on the global mask of the XQueue.
|
static java.lang.String |
processBody(javax.jms.Message inMessage,
byte[] buffer)
In case of BytesMessages, you may need to reset them before
using this method to process message body.
|
static void |
resetMapBody(javax.jms.MapMessage msg)
resets the body Map on a MapMessage so its body is writeable.
|
static void |
resetProperties(javax.jms.Message msg)
resets JMSProperty on the message so its JMSProperties are writeable.
|
static int |
resetReplyTo(javax.jms.Destination replyTo,
javax.jms.Message msg)
It resets JMSReplyTo to replyTo and returns 0 for success
|
static void |
resumeRunning(XQueue xq)
sets RUNNING bit on the global mask of the XQueue.
|
static int |
setMapProperty(java.lang.String name,
int type,
java.lang.String value,
javax.jms.MapMessage msg)
sets the property of a MapMessage.
|
static int |
setProperty(java.lang.String name,
int type,
java.lang.String value,
javax.jms.Message msg)
sets the user property of certain type on the message.
|
static int |
setProperty(java.lang.String name,
java.lang.String value,
javax.jms.Message msg)
sets JMSProperty or String property on the message.
|
static java.lang.String |
show(javax.jms.Message msg,
int type)
returns a string for detail of the message
|
static void |
standby(XQueue xq)
sets STANDBY bit on the global mask of the XQueue.
|
static void |
stopRunning(XQueue xq)
sets STOP bit on the global mask of the XQueue.
|
static java.lang.String |
substitute(java.lang.String input)
substitutes GlobalProperties with ${xxx} as the place holder
|
static java.lang.String |
substitute(java.lang.String input,
Template template) |
static java.lang.String |
substitute(java.lang.String input,
Template template,
java.util.Map map) |
static java.util.List<java.lang.Object> |
substituteProperties(java.util.List props)
It returns a List with fully cloned and substituted properties
|
static java.util.Map<java.lang.String,java.lang.Object> |
substituteProperties(java.util.Map props)
It returns a Map with fully cloned and substituted properties
|
public static final int SHOW_BODY
public static final int SHOW_DATE
public static final int SHOW_SIZE
public static final int SHOW_DST
public static final int SHOW_MSGID
public static final int SHOW_CORRID
public static final int SHOW_PROPS
public static final int SHOW_EXPIRY
public static final int SHOW_PRIORITY
public static final int SHOW_DMODE
public static final int SHOW_DCOUNT
public static final int SHOW_TSTAMP
public static final int SHOW_MSGTYPE
public static final int SHOW_REPLY
public static final int SHOW_FAMILY
public static final int SHOW_AGE
public static final int SHOW_NOTHING
public static final int XA_CLIENT
public static final int XA_COMMIT
public static final int RC_OK
public static final int RC_MSGERROR
public static final int RC_NOTFOUND
public static final int RC_REQERROR
public static final int RC_BADDATA
public static final int RC_JMSERROR
public static final int RC_IOERROR
public static final int RC_DBERROR
public static final int RC_EXPIRED
public static final int RC_TIMEOUT
public static final int RC_AUTHERROR
public static final int RC_BADRESP
public static final int RC_UNKNOWN
public static final float JAVA_VERSION
public static final java.lang.String OS_NAME
public static final java.lang.String OS_ARCH
public static final java.lang.String OS_VERSION
public static final java.lang.String USER_NAME
public static java.lang.String substitute(java.lang.String input, Template template)
public static java.lang.String substitute(java.lang.String input, Template template, java.util.Map map)
public static java.lang.String substitute(java.lang.String input)
public static java.util.Map<java.lang.String,java.lang.Object> substituteProperties(java.util.Map props)
public static java.util.List<java.lang.Object> substituteProperties(java.util.List props)
public static java.lang.String getPropertyID(java.lang.String name)
public static java.lang.String getProperty(java.lang.String name, javax.jms.Message msg) throws javax.jms.JMSException
javax.jms.JMSException
public static int setProperty(java.lang.String name, java.lang.String value, javax.jms.Message msg) throws javax.jms.JMSException
javax.jms.JMSException
public static int setProperty(java.lang.String name, int type, java.lang.String value, javax.jms.Message msg) throws javax.jms.JMSException
javax.jms.JMSException
public static int setMapProperty(java.lang.String name, int type, java.lang.String value, javax.jms.MapMessage msg) throws javax.jms.JMSException
javax.jms.JMSException
public static java.lang.String processBody(javax.jms.Message inMessage, byte[] buffer) throws javax.jms.JMSException
javax.jms.JMSException
public static java.lang.String format(javax.jms.Message msg, byte[] buffer, Template template) throws javax.jms.JMSException
javax.jms.JMSException
public static java.lang.String format(javax.jms.MapMessage msg, java.lang.String mapKey, Template template) throws javax.jms.JMSException
javax.jms.JMSException
public static java.lang.String format(javax.jms.Message msg, byte[] buffer, Template template, java.util.Map subMap) throws javax.jms.JMSException
javax.jms.JMSException
public static java.lang.String format(javax.jms.Message msg, byte[] buffer, Template template, Template repeat, java.util.Map exclude) throws javax.jms.JMSException
javax.jms.JMSException
public static java.lang.String format(java.lang.String prefix, Template[] template, TextSubstitution[] substitution, byte[] buffer, javax.jms.Message inMessage)
public static java.lang.String list(javax.jms.Message msg, int type)
public static java.lang.String show(javax.jms.Message msg, int type)
public static java.lang.String display(javax.jms.Message inMessage, java.lang.String msgStr, int displayMask, java.lang.String[] propertyName) throws javax.jms.JMSException
javax.jms.JMSException
public static javax.jms.Message duplicate(javax.jms.Message msg, byte[] buffer) throws javax.jms.JMSException
javax.jms.JMSException
public static javax.jms.Message convert(javax.jms.Message msg, int type, byte[] buffer) throws javax.jms.JMSException
javax.jms.JMSException
public static javax.jms.Message convert(java.util.Map map, java.lang.String text)
public static int copy(javax.jms.Message msg, javax.jms.Message message, byte[] buffer) throws javax.jms.JMSException
javax.jms.JMSException
public static void resetProperties(javax.jms.Message msg) throws javax.jms.JMSException
javax.jms.JMSException
public static void resetMapBody(javax.jms.MapMessage msg) throws javax.jms.JMSException
javax.jms.JMSException
public static byte[] hexString2Bytes(java.lang.String hexStr)
public static byte[] long2Bytes(long l)
public static java.lang.Throwable parse(java.lang.reflect.Method parse, java.lang.Object parser, java.lang.String msgStr, javax.jms.Message message)
public static int getResult(int type, int maxMsg, Template temp, XQueue xq, byte[] buffer, java.lang.StringBuffer strBuf) throws javax.jms.JMSException
javax.jms.JMSException
public static int pack(int maxMsg, java.lang.String prefix, Template template, XQueue xq, byte[] buffer, javax.jms.Message inMessage)
public static java.lang.String getSelector(java.lang.String query)
public static java.lang.String getQueue(java.lang.String query)
public static java.lang.String[] getColumns(java.lang.String query)
public static void stopRunning(XQueue xq)
public static void resumeRunning(XQueue xq)
public static void pause(XQueue xq)
public static void standby(XQueue xq)
public static int copyBytes(java.io.InputStream in, byte[] buffer, javax.jms.BytesMessage msg) throws javax.jms.JMSException
javax.jms.JMSException
public static int copyBytes(javax.jms.BytesMessage msg, byte[] buffer, java.io.OutputStream out) throws javax.jms.JMSException
javax.jms.JMSException
public static java.util.Map<java.lang.String,java.lang.String> listXQ(XQueue xq, int type, java.lang.String[] pn)
public static int resetReplyTo(javax.jms.Destination replyTo, javax.jms.Message msg) throws javax.jms.JMSException
javax.jms.JMSException
public static java.lang.Object[] getPlugins(java.util.Map props, java.lang.String argName, java.lang.String methodName, java.lang.String[] argClassNames, java.lang.String closerName, java.lang.String prefix)
public static void enableFlowControl(javax.jms.Session s)
public static void disableFlowControl(javax.jms.Session s)