001: /* ----- BEGIN LICENSE BLOCK -----
002: * Version: MPL 1.1
003: *
004: * The contents of this file are subject to the Mozilla Public License Version
005: * 1.1 (the "License"); you may not use this file except in compliance with
006: * the License. You may obtain a copy of the License at
007: * http://www.mozilla.org/MPL/
008: *
009: * Software distributed under the License is distributed on an "AS IS" basis,
010: * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
011: * for the specific language governing rights and limitations under the
012: * License.
013: *
014: * The Original Code is the DataShare server.
015: *
016: * The Initial Developer of the Original Code is
017: * Ball Aerospace & Technologies Corp, Fairborn, Ohio
018: * Portions created by the Initial Developer are Copyright (C) 2001
019: * the Initial Developer. All Rights Reserved.
020: *
021: * Contributor(s): Charles Wood <cwood@ball.com>
022: *
023: * ----- END LICENSE BLOCK ----- */
024: /* RCS $Id: TokenRequestObject.java,v 1.1.1.1 2001/10/23 13:37:19 lizellaman Exp $
025: * $Log: TokenRequestObject.java,v $
026: * Revision 1.1.1.1 2001/10/23 13:37:19 lizellaman
027: * initial sourceforge release
028: *
029: */
030:
031: package org.datashare.objects;
032:
033: /**
034: * This class is used for both Client to Server communications and Server to Client
035: * communications. For Client to Server, the client can REQUEST a Token and CANCEL
036: * a request. The Client to Server CANCEL is used both for canceling a requested Token
037: * that has not yet been received, and for returning a Token that has been received.
038: * For the Server to Client, the server can GRANT the requested Token, and can
039: * REVOKE a granted Token. This object is sent over the commandStatusConnection, not
040: * with the data channels.
041: *
042: */
043: public class TokenRequestObject implements java.io.Serializable {
044: /**
045: * this allows us to serialize this class without 'marshalling' errors.
046: *
047: */
048: static final long serialVersionUID = 9058094854095490536L;
049:
050: /**
051: * Use this for typeOfRequest for
052: */
053: public static final int REQUEST = 0;
054:
055: /**
056: * Use this for typeOfRequest for
057: */
058: public static final int CANCEL = 1;
059:
060: /**
061: * Use this for typeOfRequest for
062: */
063: public static final int GRANT = 2;
064:
065: /**
066: * Use this for typeOfRequest for
067: */
068: public static final int REVOKE = 3;
069:
070: /**
071: * use typeOfRequest as index into this to get String version of Request
072: */
073: public static final String typeOfRequestStrings[] = { "Request",
074: "Cancel", "Grant", "Revoke" };
075:
076: /**
077: * This defines the type of history request, use REQUEST or CANCEL for Client to Server,
078: * GRANT or REVOKE for Server to Client.
079: */
080: public int typeOfRequest = CANCEL; // default value
081:
082: /**
083: * The ADSKey string for the channel for which EJBs are desired (required for COUNT request)
084: */
085: public String tokenKey;
086:
087: /**
088: * The Session name for the Token desired
089: */
090: public String sessionName = "";
091:
092: /**
093: * The Channel name for the Token desired
094: */
095: public String channelName = "";
096:
097: /**
098: * Constructor, normally not used
099: */
100: public TokenRequestObject() {
101: }
102:
103: /**
104: * Constructor, used except when typeOfRequest is REQUEST
105: * @param typeOfRequest indicates what type of action is requested
106: * @param tokenKey tokenKey for the channel whose Token we are making a request/response for
107: */
108: public TokenRequestObject(int typeOfRequest, String tokenKey) {
109: this .typeOfRequest = typeOfRequest;
110: this .tokenKey = tokenKey;
111: }
112:
113: /**
114: * Constructor, required when typeOfRequest is REQUEST
115: * @param typeOfRequest indicates what type of action is requested
116: * @parma sessionName name of the Session for which a Token is requested, used to determine
117: * if the connection is active
118: * @parma channelName name of the Channel for which a Token is requested, used to determine
119: * if the connection is active
120: * @param tokenKey tokenKey for the channel whose Token we are making a request/response for
121: */
122: public TokenRequestObject(int typeOfRequest, String sessionName,
123: String channelName, String tokenKey) {
124: this(typeOfRequest, tokenKey);
125: this.sessionName = sessionName;
126: this.channelName = channelName;
127: }
128: }
|