KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > datashare > objects > TokenRequestObject


1 /* ----- BEGIN LICENSE BLOCK -----
2  * Version: MPL 1.1
3  *
4  * The contents of this file are subject to the Mozilla Public License Version
5  * 1.1 (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  * http://www.mozilla.org/MPL/
8  *
9  * Software distributed under the License is distributed on an "AS IS" basis,
10  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11  * for the specific language governing rights and limitations under the
12  * License.
13  *
14  * The Original Code is the DataShare server.
15  *
16  * The Initial Developer of the Original Code is
17  * Ball Aerospace & Technologies Corp, Fairborn, Ohio
18  * Portions created by the Initial Developer are Copyright (C) 2001
19  * the Initial Developer. All Rights Reserved.
20  *
21  * Contributor(s): Charles Wood <cwood@ball.com>
22  *
23  * ----- END LICENSE BLOCK ----- */

24 /* RCS $Id: TokenRequestObject.java,v 1.1.1.1 2001/10/23 13:37:19 lizellaman Exp $
25  * $Log: TokenRequestObject.java,v $
26  * Revision 1.1.1.1 2001/10/23 13:37:19 lizellaman
27  * initial sourceforge release
28  *
29  */

30
31 package org.datashare.objects;
32
33 /**
34  * This class is used for both Client to Server communications and Server to Client
35  * communications. For Client to Server, the client can REQUEST a Token and CANCEL
36  * a request. The Client to Server CANCEL is used both for canceling a requested Token
37  * that has not yet been received, and for returning a Token that has been received.
38  * For the Server to Client, the server can GRANT the requested Token, and can
39  * REVOKE a granted Token. This object is sent over the commandStatusConnection, not
40  * with the data channels.
41  *
42  */

43 public class TokenRequestObject implements java.io.Serializable JavaDoc
44    {
45    /**
46     * this allows us to serialize this class without 'marshalling' errors.
47     *
48     */

49    static final long serialVersionUID = 9058094854095490536L;
50
51    /**
52     * Use this for typeOfRequest for
53     */

54    public static final int REQUEST = 0;
55
56    /**
57     * Use this for typeOfRequest for
58     */

59    public static final int CANCEL = 1;
60
61    /**
62     * Use this for typeOfRequest for
63     */

64    public static final int GRANT = 2;
65
66    /**
67     * Use this for typeOfRequest for
68     */

69    public static final int REVOKE = 3;
70
71    /**
72     * use typeOfRequest as index into this to get String version of Request
73     */

74    public static final String JavaDoc typeOfRequestStrings[] =
75       {"Request", "Cancel", "Grant", "Revoke"};
76
77    /**
78     * This defines the type of history request, use REQUEST or CANCEL for Client to Server,
79     * GRANT or REVOKE for Server to Client.
80     */

81    public int typeOfRequest = CANCEL; // default value
82

83    /**
84     * The ADSKey string for the channel for which EJBs are desired (required for COUNT request)
85     */

86    public String JavaDoc tokenKey;
87
88    /**
89     * The Session name for the Token desired
90     */

91    public String JavaDoc sessionName = "";
92
93    /**
94     * The Channel name for the Token desired
95     */

96    public String JavaDoc channelName = "";
97
98    /**
99     * Constructor, normally not used
100     */

101    public TokenRequestObject()
102       {
103       }
104
105    /**
106     * Constructor, used except when typeOfRequest is REQUEST
107     * @param typeOfRequest indicates what type of action is requested
108     * @param tokenKey tokenKey for the channel whose Token we are making a request/response for
109     */

110    public TokenRequestObject(int typeOfRequest, String JavaDoc tokenKey)
111       {
112       this.typeOfRequest = typeOfRequest;
113       this.tokenKey = tokenKey;
114       }
115
116    /**
117     * Constructor, required when typeOfRequest is REQUEST
118     * @param typeOfRequest indicates what type of action is requested
119     * @parma sessionName name of the Session for which a Token is requested, used to determine
120     * if the connection is active
121     * @parma channelName name of the Channel for which a Token is requested, used to determine
122     * if the connection is active
123     * @param tokenKey tokenKey for the channel whose Token we are making a request/response for
124     */

125    public TokenRequestObject(int typeOfRequest, String JavaDoc sessionName, String JavaDoc channelName, String JavaDoc tokenKey)
126       {
127       this(typeOfRequest, tokenKey);
128       this.sessionName = sessionName;
129       this.channelName = channelName;
130       }
131    }
132
Popular Tags