KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > scalagent > kjoram > Destination


1 /*
2  * JORAM: Java(TM) Open Reliable Asynchronous Messaging
3  * Copyright (C) 2001 - ScalAgent Distributed Technologies
4  * Copyright (C) 1996 - Dyade
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 (INRIA)
22  * Contributor(s): Nicolas Tachker (ScalAgent)
23  */

24 package com.scalagent.kjoram;
25
26 import java.util.Vector JavaDoc;
27 import java.util.Hashtable JavaDoc;
28
29 public abstract class Destination
30   extends com.scalagent.kjoram.admin.AdministeredObject
31 {
32   /** Identifier of the agent destination. */
33   protected String JavaDoc agentId;
34
35
36   /**
37    * Constructs a destination.
38    *
39    * @param agentId Identifier of the agent destination.
40    */

41   public Destination(String JavaDoc agentId)
42   {
43     super(agentId);
44     this.agentId = agentId;
45
46     if (JoramTracing.dbgClient)
47       JoramTracing.log(JoramTracing.DEBUG, this + ": created.");
48   }
49
50   /**
51    * Constructs an empty destination.
52    */

53   public Destination()
54   {}
55
56
57   /** Returns the name of the destination. */
58   public String JavaDoc getName()
59   {
60     return agentId;
61   }
62
63   /**
64    * Returns <code>true</code> if the parameter object is a Joram destination
65    * wrapping the same agent identifier.
66    */

67   public boolean equals(Object JavaDoc obj)
68   {
69     if (! (obj instanceof Destination))
70       return false;
71
72     return (agentId.equals(((Destination) obj).getName()));
73   }
74
75   public void setAgentId(String JavaDoc agentId) {
76     this.agentId = agentId;
77   }
78
79  /**
80    * Codes a <code>Destination</code> as a Hashtable for travelling through the
81    * SOAP protocol.
82    */

83   public Hashtable JavaDoc code() {
84     Hashtable JavaDoc h = super.code();
85     h.put("agentId",agentId);
86     return h;
87   }
88 }
89
Popular Tags