|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.silverpeas.notification.jms.access.JMSAccessObject
@Named public final class JMSAccessObject
An object providing an access to the services of a JMS system and managing the life-cycle of the connections and of the sessions.
This object is managed by the IoC container so that it can be injected as dependency into the JMS implementation of the Notification API. This object acts as a facade to the underlying JMS system and provides operations to access the JMS objects. It manages the life-cycle of connections and sessions with the JMS system and wraps some technical details from the JMS consumer/producer operations.
Nested Class Summary | |
---|---|
class |
JMSAccessObject.ConnectionExceptionListener
|
Constructor Summary | |
---|---|
JMSAccessObject()
|
Method Summary | |
---|---|
void |
addConnectionFailureListener(ConnectionFailureListener listener)
Adds a listener of JMS exceptions that will be occur between the client and the server. |
protected void |
closeConnection()
|
javax.jms.ObjectMessage |
createObjectMessageFor(javax.jms.TopicPublisher publisher)
Creates a message ready to be sent by the specified publisher. |
javax.jms.TopicPublisher |
createTopicPublisher(String topicName)
Creates a publisher to the specified topic. |
javax.jms.TopicSubscriber |
createTopicSubscriber(String topicName,
String subscriberId,
javax.jms.MessageListener listener)
Creates a subscription to the specified topic with the specified listener for receiving the messages published in the topic. |
void |
disposeTopicPublisher(javax.jms.TopicPublisher publisher)
Disposes the specified publisher. |
void |
disposeTopicSubscriber(javax.jms.TopicSubscriber subscriber)
Disposes the subscription to a topic represented by the specified TopicSubscriver instance. |
protected Set<ConnectionFailureListener> |
getConnectionFailureListeners()
|
javax.jms.Topic |
getExistingTopic(String name)
Gets the topic corresponding to the specified name. |
protected javax.jms.TopicSession |
getTopicSessionForPublishing()
Gets a JMS session for publishing operations. |
protected javax.jms.TopicSession |
getTopicSessionForSubscription()
Gets a JMS session for subscription operations. |
protected void |
openConnection()
|
protected void |
releaseSession(javax.jms.Session session)
Releases an opened sessions. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JMSAccessObject()
Method Detail |
---|
public javax.jms.Topic getExistingTopic(String name) throws NamingException
name
- the topic name.
NamingException
- if no such topic exists with the specified name.public javax.jms.TopicSubscriber createTopicSubscriber(String topicName, String subscriberId, javax.jms.MessageListener listener) throws javax.jms.JMSException, NamingException
disposeTopicSubscriber
method with the TopicSubscriber instance as parameter.
topicName
- the name of topic.subscriberId
- the unique identifier of the subscription.listener
- the listener that will receive the messages published in the topic.
javax.jms.JMSException
- if an error occurs while subscribing to the specified topic.
NamingException
- if no such topic exists with the specified name.public void disposeTopicSubscriber(javax.jms.TopicSubscriber subscriber) throws javax.jms.JMSException
subscriber
- the subscriber matching the subscription to a given topic.
javax.jms.JMSException
- if an error occurs while unsubscribing the subscription.public javax.jms.TopicPublisher createTopicPublisher(String topicName) throws NamingException, javax.jms.JMSException
topicName
- the name of the topic.
NamingException
- if no such topic exists with the specified name.
javax.jms.JMSException
- if an error occurs while creating a message publisher.public void disposeTopicPublisher(javax.jms.TopicPublisher publisher) throws javax.jms.JMSException
publisher
- the publisher to dispose.
javax.jms.JMSException
- if an error occurs while disposing the publisher.public javax.jms.ObjectMessage createObjectMessageFor(javax.jms.TopicPublisher publisher) throws javax.jms.JMSException
publisher
- the publisher from which the session with the JMS system can be retreived.
javax.jms.JMSException
- if an error occurs while creating a JMS message.public void addConnectionFailureListener(ConnectionFailureListener listener)
listener
- a listener of exceptions on a JMS connection.protected javax.jms.TopicSession getTopicSessionForPublishing()
javax.jms.JMSException
- if an error occurs while creating or fetching a JMS session.protected javax.jms.TopicSession getTopicSessionForSubscription()
javax.jms.JMSException
- if an error occurs while creating or fetching a JMS session.protected void releaseSession(javax.jms.Session session) throws javax.jms.JMSException
session
- the session to release.
javax.jms.JMSException
- if an error occurs while released the JMS session.@PostConstruct protected void openConnection() throws NamingException, javax.jms.JMSException
NamingException
javax.jms.JMSException
@PreDestroy protected void closeConnection() throws javax.jms.JMSException
javax.jms.JMSException
protected Set<ConnectionFailureListener> getConnectionFailureListeners()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |