QJCC homepage

biz.chitec.quarterback.gjsa
Class ServerReply

java.lang.Object
  extended bybiz.chitec.quarterback.gjsa.ServerReply
All Implemented Interfaces:
java.io.Serializable

public final class ServerReply
extends java.lang.Object
implements java.io.Serializable

encapsulates a single reply from a GJSA server. ServerReply is returned from a GJSA server to a querying client. Each ServerReply has the reply for exactly one ServerRequest. A ServerReply consists of a type field and one result. This may be of any type or even left out.

ServerReply is also the main instance for converting reply types between their representations. Within the ServerReply class is the central storage for the list of known reply symbols, and ServerReply has static methods to query these.

Version:
$Id: 613c5f87591aada0f23f86da51f73272e5028f9f $
Author:
Dirk Hillbrecht 1997-2000, chitec/Dirk Hillbrecht 2000. Distributed under the terms of the GNU LGPL.
See Also:
Serialized Form

Field Summary
(package private) static java.util.List cshv
          Chat symbol holder vector
private static Logger mess
          ServerReply may print messages to global logger when inserting chat symbol holder
(package private) static java.util.ResourceBundle rb
          Holder for messages' resource bundle
 java.lang.Object result
          The result
 boolean showparam
          Marker whether the result shell be logged or not.
 int type
          The reply type.
 
Constructor Summary
ServerReply(int t)
          Constructs a reply without result (just reply type).
ServerReply(int t, java.lang.Object o)
          Constructs a reply with type and result (which is of any type).
ServerReply(int t, java.lang.Object o, boolean sp)
          Constructs a reply with type, result and logging marker.
 
Method Summary
static void addChatSymbolHolder(ChatSymbolHolder cshx)
          Adds a chat symbol holder
 boolean equals(java.lang.Object o)
          Checks equality of this ServerReply to something else.
 java.lang.Object getMessageResult()
          Return result.
static int getReplyNum(java.lang.String n)
          Class method.
 int getReplyType()
          Return the reply type
 java.lang.Object getResult()
          Return the result.
 boolean isPositive()
          Convenience method for reply checking: Returns whether this reply was somehow positive, i.e.
 java.lang.String replyTypeName()
          Returns the reply type in symbolic representation.
static void setLogger(Logger m)
          Set the logger ServerReply may write messages to when inserting chat symbol holder
static void setResourceBundle(java.util.ResourceBundle rbx)
          Sets the ServerReply global resource bundle with multilingual messages
 java.lang.String toString()
          Convert the ServerReply to a string.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

mess

private static Logger mess
ServerReply may print messages to global logger when inserting chat symbol holder


cshv

static java.util.List cshv
Chat symbol holder vector


rb

static java.util.ResourceBundle rb
Holder for messages' resource bundle


type

public int type
The reply type.


result

public java.lang.Object result
The result


showparam

public boolean showparam
Marker whether the result shell be logged or not.

Constructor Detail

ServerReply

public ServerReply(int t)
Constructs a reply without result (just reply type).


ServerReply

public ServerReply(int t,
                   java.lang.Object o)
Constructs a reply with type and result (which is of any type).


ServerReply

public ServerReply(int t,
                   java.lang.Object o,
                   boolean sp)
Constructs a reply with type, result and logging marker. The marker is only needed for logging purposes and demarks whether the result shell be written out in the logs or be replaced by "###" (e.g. needed for transmitted passwords which should not be logged normally).

Method Detail

setLogger

public static void setLogger(Logger m)
Set the logger ServerReply may write messages to when inserting chat symbol holder


addChatSymbolHolder

public static void addChatSymbolHolder(ChatSymbolHolder cshx)
Adds a chat symbol holder


setResourceBundle

public static void setResourceBundle(java.util.ResourceBundle rbx)
Sets the ServerReply global resource bundle with multilingual messages


getReplyType

public int getReplyType()
Return the reply type


getResult

public java.lang.Object getResult()
Return the result. If no result is available, null is returned.


getMessageResult

public java.lang.Object getMessageResult()
Return result. Similar to getResult(), but with special handling of a List of String type result. These types are evaluated using the ResourceBundle to give a String. Normally, this behaviour will be wanted for error messages, which come from the server in a multilingual way and must be adapted to the local language.


replyTypeName

public java.lang.String replyTypeName()
Returns the reply type in symbolic representation.


getReplyNum

public static int getReplyNum(java.lang.String n)
Class method. Converts symbolic reply type into numeric representation.


equals

public boolean equals(java.lang.Object o)
Checks equality of this ServerReply to something else. Returns true iff and only iff o is also a ServerReply and type and result do match.


toString

public java.lang.String toString()
Convert the ServerReply to a string. For debugging purposes only.


isPositive

public boolean isPositive()
Convenience method for reply checking: Returns whether this reply was somehow positive, i.e. OK, ACCEPTED, or YES


QJCC homepage