Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: mobile/jmsapi/TopicSession.java


1   /** Java class "TopicSession.java" generated from Poseidon for UML.
2    *  Poseidon for UML is developed by <A HREF="http://www.gentleware.com">Gentleware</A>.
3    *  Generated with <A HREF="http://jakarta.apache.org/velocity/">velocity</A> template engine.
4    */
5   package mobile.jmsapi;
6   
7   import mobile.protocol.Reply;
8   
9   /**
10   * <p>
11   * class representinf a session of a connection with JMS provider in Pub-Sub mode
12   * </p>
13   */
14  public class TopicSession extends Session {
15  
16    ///////////////////////////////////////
17    // operations
18  
19    /**>
20     * bitmask
21     * </p>
22     * <p>
23     * @return TOPIC
24     */
25    protected int TYPE_MASK()
26    {
27      return TOPIC;
28    }
29  
30  
31    /**
32     * <p>
33     * create a new Topic Subscriber
34     * </p> <p>
35     * @return new TopicSubscriber
36     * </p>
37     */
38    protected Consumer newConsumer()
39    {
40      return new TopicSubscriber();
41    }
42  
43    /**
44     * <p>
45     * create a new Topic Publisher
46     * </p> <p>
47     * @return new TopicPublisher
48     * </p>
49     */
50    protected Producer  newProducer()
51    {
52      return new TopicPublisher();
53    }
54  
55  
56  /**
57   * <p>
58   * create new topic subscriber of messages from specified Topic
59   * </p><p>
60   * @param _dest is a source of messages
61   * </p><p>
62   * @return new TopicSubscriber
63   * </p>
64   */
65      public TopicSubscriber createTopicSubscriber(Topic _src)
66        throws JMSException
67      {
68        return (TopicSubscriber) createConsumer(_src);
69      } // end createTopicSubscriber
70  
71  /**
72   * <p>
73   * create new topic publisher of messages to specified Topic
74   * </p><p>
75   * @param _dest is a destination  of messages
76   * </p><p>
77   * @return new TopicPublisher
78   * </p>
79   */
80      public TopicPublisher createTopicPublisher(Topic _dest)
81        throws JMSException
82      {
83        return (TopicPublisher) createProducer(_dest);
84      } // end createTopicPublisher
85  
86  
87    public TopicSubscriber createDurableSubscriber(Topic _topic, String _name)
88      throws JMSException
89    {
90      try
91      {
92        Reply rep = request(CREATE_DURABLE_TOPIC_SUBSCRIBER, new Integer(id),
93                     new Integer(_topic.id), _name);
94        TopicSubscriber result = new TopicSubscriber();
95        result.id = ((Integer)(rep.getData()[0])).intValue();
96        return result;
97      }
98      catch (Throwable err)
99      {
100       throw new JMSException("communication lost");
101     }
102   }
103 
104 } // end TopicSession
105 
106 
107 
108 
109