KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > joram > mom > dest > bridge > BridgeTopic


1 /*
2  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
3  * Copyright (C) 2004 - 2007 ScalAgent Distributed Technologies
4  * Copyright (C) 2003 - 2004 Bull SA
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA.
20  *
21  * Initial developer(s): Frederic Maistre (Bull SA)
22  * Contributor(s): ScalAgent Distributed Technologies
23  */

24 package org.objectweb.joram.mom.dest.bridge;
25
26 import java.util.Properties JavaDoc;
27
28 import org.objectweb.joram.mom.dest.DestinationImpl;
29 import org.objectweb.joram.mom.dest.Topic;
30
31 import fr.dyade.aaa.agent.AgentId;
32 import fr.dyade.aaa.agent.Notification;
33
34 /**
35  * A <code>BridgeTopic</code> agent is an agent hosting a bridge topic,
36  * and which behaviour is provided by a <code>BridgeTopicImpl</code> instance.
37  *
38  * @see BridgeTopicImpl
39  */

40 public class BridgeTopic extends Topic {
41
42   /**
43    * Constructs a <code>BridgeTopic</code> agent.
44    */

45   public BridgeTopic() {
46     super();
47     fixed = true;
48   }
49
50   /**
51    * Creates the bridge topic.
52    *
53    * @param adminId Identifier of the bridge topic administrator.
54    * @param prop The initial set of properties.
55    *
56    * @exception IllegalArgumentException If the JMS properties are invalid.
57    */

58   public DestinationImpl createsImpl(AgentId adminId, Properties JavaDoc prop) {
59     BridgeTopicImpl topicImpl = new BridgeTopicImpl(getId(), adminId, prop);
60     return topicImpl;
61   }
62   
63   /**
64    * Specializes this <code>TopicImpl</code> method for processing the
65    * specific bridge notifications.
66    * @throws Exception
67    */

68   public void react(AgentId from, Notification not)
69               throws Exception JavaDoc {
70     if (not instanceof BridgeDeliveryNot)
71       ((BridgeTopicImpl) destImpl).bridgeDeliveryNot(from, (BridgeDeliveryNot) not);
72     else if (not instanceof BridgeAckNot)
73       ((BridgeTopicImpl) destImpl).bridgeAckNot((BridgeAckNot) not);
74     else
75       super.react(from, not);
76   }
77 }
78
Popular Tags