|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.systinet.transport.jms.ReductionTemplate
Simplified template to write custom Reduction interface implementations.
Reduction
Constructor Summary | |
ReductionTemplate()
|
Method Summary | |
abstract boolean |
check()
Returns true of the reduction can be used. |
abstract javax.jms.Message |
createMessage(byte[] data,
javax.jms.Session session)
Creates message using the session and fills it with data. |
abstract byte[] |
getMessageData(javax.jms.Message msg)
Gets data from the message passed as an argument. |
abstract java.lang.String |
getStringProperty(javax.jms.Message msg,
java.lang.String key)
Gets value of the property of the message. |
void |
publishClientData(javax.jms.TopicSession session,
javax.jms.Topic topic,
byte[] data,
java.util.Map jmsProperties,
int deliveryMode,
int priority,
int timeToLive)
Template implementation of the method publishClientData. |
byte[] |
receiveClientData(javax.jms.QueueSession session,
javax.jms.Queue queue,
long timeout,
java.util.Map properties)
Template implementation of the method receiveClientData. |
abstract javax.jms.Queue |
resolveQueue(java.lang.String name)
Resolves the queue with the given name. |
abstract javax.jms.QueueConnectionFactory |
resolveQueueConnectionFactory(java.lang.String name)
Resolves the queue connection factory with the given name. |
abstract javax.jms.Topic |
resolveTopic(java.lang.String name)
Resolves the topic with the given name. |
abstract javax.jms.TopicConnectionFactory |
resolveTopicConnectionFactory(java.lang.String name)
Resolves topic connection factory with the given name. |
void |
sendClientData(javax.jms.QueueSession session,
javax.jms.Queue queue,
javax.jms.Queue replyQueue,
byte[] data,
java.util.Map jmsProperties,
int deliveryMode,
int priority,
int timeToLive)
Template implementation of the method sendClientData. |
void |
sendData(javax.jms.QueueSession session,
javax.jms.Queue queue,
byte[] data,
java.util.Map outputProperties,
int deliveryMode,
int priority,
int timeToLive)
Template implementation of the method @method sendData. |
abstract void |
setProperty(javax.jms.Message message,
java.lang.String key,
java.lang.Object value)
Sets property of the message. |
void |
startQueueListening(JmsDataHandler handler,
javax.jms.QueueSession session,
javax.jms.Queue queue,
java.lang.String serverSelector)
Template implementation of the method startQueueListening. |
abstract void |
startResolving(java.util.Map properties)
Typically this method should allocate resources needed to be able to resolve object in following calls of the resolve* methods. |
void |
startTopicListening(JmsDataHandler handler,
javax.jms.TopicSession session,
javax.jms.Topic topic,
java.lang.String serverSelector,
java.lang.String durableId)
Template implementation of the method startTopicListening. |
void |
stopListening()
Template implementation of the method stopListening. |
abstract void |
stopResolving()
Called after all resolve* method calls are performed. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public ReductionTemplate()
Method Detail |
public abstract void startResolving(java.util.Map properties) throws javax.naming.NamingException
startResolving
in interface Reduction
properties
- allows passing of customization parameters to
the reduction implementation. User may pass them using
WebserviceLookup.lookup(...). Otherwise, the properties
are read from JMS transport configuration.
javax.naming.NamingException
- when an exception occures during setup of resourcespublic abstract void stopResolving() throws javax.naming.NamingException
stopResolving
in interface Reduction
javax.naming.NamingException
- when an exception occures during closing resourcespublic abstract boolean check()
check
in interface Reduction
public abstract javax.jms.Queue resolveQueue(java.lang.String name) throws javax.naming.NamingException
resolveQueue
in interface Reduction
name
- the queue
javax.naming.NamingException
- if an exception occures during resolving the request.public abstract javax.jms.Topic resolveTopic(java.lang.String name) throws javax.naming.NamingException
resolveTopic
in interface Reduction
name
- the topic name
javax.naming.NamingException
- if an exception occures during resolving the request.public abstract javax.jms.QueueConnectionFactory resolveQueueConnectionFactory(java.lang.String name) throws javax.naming.NamingException
resolveQueueConnectionFactory
in interface Reduction
name
- the factory name
javax.naming.NamingException
- if an exception occures during resolving the request.public abstract javax.jms.TopicConnectionFactory resolveTopicConnectionFactory(java.lang.String name) throws javax.naming.NamingException
resolveTopicConnectionFactory
in interface Reduction
name
- the factory name
javax.naming.NamingException
- if an exception occures during resolving the request.public abstract void setProperty(javax.jms.Message message, java.lang.String key, java.lang.Object value) throws javax.jms.JMSException
message
- message to be the property set onkey
- key value of the propertyvalue
- value of the property.
javax.jms.JMSException
- when en exception occures during setting the propertypublic abstract java.lang.String getStringProperty(javax.jms.Message msg, java.lang.String key) throws javax.jms.JMSException
msg
- message which holds the propertykey
- key value of the property
javax.jms.JMSException
- when en exception occures during setting the propertypublic abstract javax.jms.Message createMessage(byte[] data, javax.jms.Session session) throws javax.jms.JMSException
data
- the message holdssession
- which creates the message
javax.jms.JMSException
- when an exception occures during message creationpublic abstract byte[] getMessageData(javax.jms.Message msg)
msg
- the message which hold the data.
public void sendClientData(javax.jms.QueueSession session, javax.jms.Queue queue, javax.jms.Queue replyQueue, byte[] data, java.util.Map jmsProperties, int deliveryMode, int priority, int timeToLive) throws javax.jms.JMSException
sendClientData
in interface Reduction
session
- the session to be used when sending the messagequeue
- the queue to be used when sending the messagereplyQueue
- the queue where this reduction should expect optional response data.
May be null.data
- data to be sent. The method may perform aditional processing like encrypting
or encoding the data.jmsProperties
- the JMS properties to be set ob the output message. The method may perform
aditional processing on othe properies.deliveryMode
- delivery mode to be set, one of javax.jms.DeliveryMode constantspriority
- priority of the messagetimeToLive
- time to live of the message
javax.jms.JMSException
public byte[] receiveClientData(javax.jms.QueueSession session, javax.jms.Queue queue, long timeout, java.util.Map properties) throws javax.jms.JMSException
receiveClientData
in interface Reduction
session
- the session to be used when receiving the messagequeue
- the queue to be used when receiving the messagetimeout
- time, after timeout occuresproperties
- the structure to be filled with received properties and it initialy contains
some properties like server selector value used to receive message
javax.jms.JMSException
public void publishClientData(javax.jms.TopicSession session, javax.jms.Topic topic, byte[] data, java.util.Map jmsProperties, int deliveryMode, int priority, int timeToLive) throws javax.jms.JMSException
publishClientData
in interface Reduction
session
- the session to be used when publishing the messagetopic
- the topic to be used when publishing the messagedata
- data to be sent. The method may perform aditional processing like encrypting
or encoding the data.jmsProperties
- the JMS properties to be set ob the output message. The method may perform
aditional processing on othe properies.deliveryMode
- delivery mode to be set, one of javax.jms.DeliveryMode constantspriority
- priority of the messagetimeToLive
- time to live of the message
javax.jms.JMSException
public void startQueueListening(JmsDataHandler handler, javax.jms.QueueSession session, javax.jms.Queue queue, java.lang.String serverSelector) throws javax.jms.JMSException
startQueueListening
in interface Reduction
handler
- the handler to be used to process received datasession
- the session which receives the dataqueue
- the queue which receives the dataserverSelector
- id which identifies messages sent to the server. If not null,
the listening must be performed with the selector string :
String selector = JmsConstants.MSG_TYPE + "='"
+ JmsConstants.TYPE_REQUEST + "'"
+ ( ( serverSelector == null ) ? "" : ( " AND "
+ JmsConstants.SERVER_SELECTOR + "='" + serverSelector + "'" ) );
javax.jms.JMSException
public void startTopicListening(JmsDataHandler handler, javax.jms.TopicSession session, javax.jms.Topic topic, java.lang.String serverSelector, java.lang.String durableId) throws javax.jms.JMSException
startTopicListening
in interface Reduction
handler
- the handler to be used to process received datasession
- the session which receives the datatopic
- the topic which receives the dataserverSelector
- id which identifies messages sent to the server. If not null,
the listening must be performed with the selector string :
String selector = JmsConstants.MSG_TYPE + "='"
+ JmsConstants.TYPE_REQUEST + "'"
+ ( ( serverSelector == null ) ? "" : ( " AND "
+ JmsConstants.SERVER_SELECTOR + "='" + serverSelector + "'" ) );
durableId
- the client identifier of the durable subscription. If null, the subscriber
will not be durable.
javax.jms.JMSException
public void stopListening()
stopListening
in interface Reduction
public void sendData(javax.jms.QueueSession session, javax.jms.Queue queue, byte[] data, java.util.Map outputProperties, int deliveryMode, int priority, int timeToLive) throws javax.jms.JMSException
sendData
in interface Reduction
session
- the session, which sends dataqueue
- the queue, which sends datadata
- the data to be sentoutputProperties
- JMS properties which have to be set on the output JMS message.deliveryMode
- delivery mode to be set, one of javax.jms.DeliveryMode constantspriority
- priority of the messagetimeToLive
- time to live of the message
javax.jms.JMSException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |