KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > joram > client > connector > ConnectionRequest


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

23 package org.objectweb.joram.client.connector;
24
25
26 /**
27  * A <code>ConnectionRequest</code> instance wraps a user connection
28  * request for performing unified messaging.
29  */

30 public class ConnectionRequest
31              implements javax.resource.spi.ConnectionRequestInfo JavaDoc
32 {
33   /**
34    * Identification of the user requesting a connection to the
35    * underlying JORAM server.
36    */

37   protected String JavaDoc userName;
38   /**
39    * Password of the user requesting a connection to the
40    * underlying JORAM server.
41    */

42   protected String JavaDoc password;
43
44
45   /**
46    * Constructs a <code>ConnectionRequest</code> instance.
47    *
48    * @param userName Name of the user requesting a connection.
49    * @param password Password of the user requesting a connection.
50    */

51   public ConnectionRequest(String JavaDoc userName, String JavaDoc password)
52   {
53     this.userName = userName;
54     this.password = password;
55   }
56
57
58   /**
59    * Returns the identification of the user requesting a connection to the
60    * underlying JORAM server.
61    */

62   public String JavaDoc getUserName()
63   {
64     return userName;
65   }
66
67   /**
68    * Returns the password of the user requesting a connection to the
69    * underlying JORAM server.
70    */

71   public String JavaDoc getPassword()
72   {
73     return password;
74   }
75
76
77   /**
78    * Compares <code>ConnectionRequest</code> instances wrapped users
79    * identities.
80    */

81   public boolean equals(Object JavaDoc o)
82   {
83     if (! (o instanceof ConnectionRequest))
84       return false;
85
86     ConnectionRequest other = (ConnectionRequest) o;
87     return this.getClass().getName().equals(o.getClass().getName())
88            && other.getUserName().equals(userName);
89   }
90
91   /** Returns a code based on the wrapped user identity. */
92   public int hashCode()
93   {
94     return ("Unified:" + userName).hashCode();
95   }
96 }
97
Popular Tags