jsim.jmessage
Class Result

java.lang.Object
  extended by jsim.jmessage.Message
      extended by jsim.jmessage.Result
All Implemented Interfaces:
java.io.Serializable

public class Result
extends Message

The Result class is a JSIM message type representing the query result returned by the DBAgent. It may contain a simple message indicating if the query is successful or not. Or it may encapsulate a Java ResultSet object. In the former case, the action type would be "Information". In the latter case, the action type would be either "Sequence number" or "Normal result".

See Also:
Serialized Form

Field Summary
 
Fields inherited from class jsim.jmessage.Message
actionType
 
Constructor Summary
Result(java.lang.String actionType, java.sql.ResultSet rs)
          Constructs a Result instance by action type and a ResultSet object.
Result(java.lang.String actionType, java.lang.String info)
          Constructs a Result instance by action type and information.
 
Method Summary
 int getColumnCount()
          Returns the number of columns.
 java.lang.String[] getColumnLabels()
          Returns the number of rows.
 java.lang.String getInfo()
          Returns the information/message.
 int getRowCount()
          Returns the number of rows.
 java.lang.Object[][] getValue()
          Returns the value array.
 void print()
          Prints out the information or query result for debugging purposes.
 void readObject(java.io.ObjectInputStream in)
          Meets the Java serialization requirements.
 java.lang.String toString()
          Returns an XML fragment representing this instance of Result.
 void writeObject(java.io.ObjectOutputStream out)
          Meets the Java serialization requirements.
 
Methods inherited from class jsim.jmessage.Message
getActionType
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Result

public Result(java.lang.String actionType,
              java.lang.String info)
Constructs a Result instance by action type and information.

Parameters:
actionType - The type of result
info - The message

Result

public Result(java.lang.String actionType,
              java.sql.ResultSet rs)
       throws java.sql.SQLException
Constructs a Result instance by action type and a ResultSet object.

Parameters:
actionType - The result type
rs - The ResultSet object
Throws:
java.sql.SQLException
Method Detail

getColumnCount

public int getColumnCount()
Returns the number of columns.

Returns:
int The number of columns

getRowCount

public int getRowCount()
Returns the number of rows.

Returns:
int The number of rows

getColumnLabels

public java.lang.String[] getColumnLabels()
Returns the number of rows.

Returns:
String [][] The column labels

getValue

public java.lang.Object[][] getValue()
Returns the value array.

Returns:
Object [][] The array of value (rows:columns)

getInfo

public java.lang.String getInfo()
Returns the information/message.

Returns:
info The information/message

writeObject

public void writeObject(java.io.ObjectOutputStream out)
                 throws java.io.IOException
Meets the Java serialization requirements.

Parameters:
out - The ObjectOutputStream
Throws:
java.io.IOException

readObject

public void readObject(java.io.ObjectInputStream in)
                throws java.io.IOException,
                       java.lang.ClassNotFoundException
Meets the Java serialization requirements.

Parameters:
in - The ObjectInputStream
Throws:
java.io.IOException, - java.lang.ClassNotFoundException
java.io.IOException
java.lang.ClassNotFoundException

toString

public java.lang.String toString()
Returns an XML fragment representing this instance of Result.

Overrides:
toString in class java.lang.Object
Returns:
String The XML fragment

print

public void print()
Prints out the information or query result for debugging purposes.