edu.vt.marian.server
Class session

java.lang.Object
  |
  +--edu.vt.marian.server.session

public class session
extends java.lang.Object

class name: session class description: this class represents a session in the system, currently a session represent a user's activity in a period of time. uses the services of class(es): designer(s): Jianxin Zhao (jxzhao@csgrad.cs.vt.edu) implementator(s): Ning Chai (nchai@csgrad.cs.vt.edu) finished time: Nov 26th, 1998 known bugs: JDK version: 1.1.5 side effects:


Field Summary
static int C_QUEUE_SIZE_NOT_EQUAL_0
           
static int CANNOT_FIND_QUERY
           
static int CLIENT_AND_C_QUEUES_SIZE_NOT_EQUAL_0
           
static int CLIENT_QUEUE_SIZE_NOT_EQUAL_0
           
static int INVALID_MAX_NUMBER_QUERIES
           
static int INVALID_PARAMETER_TYPE
           
static int INVALID_SESSION_ID
           
static int NULL_MESSAGE
           
static int NULL_PARAMETER
           
static int NULL_RPC_FUNCTION
           
static int NULL_RPC_FUNCTION_NAME
           
static int OK
           
static int PROCESS_CALL_FROM_C_FAILED
           
static int PROCESS_CALL_FROM_CLIENT_FAILED
           
static int PROCESS_CALL_FROM_SESSION_TO_C_FAILED
           
static int PROCESS_CALL_FROM_SESSION_TO_CLIENT_FAILED
           
static int PROCESS_ERROR_FOR_SESSION_MANAGER_FAILED
           
static int PROCESS_FUNCTION_FROM_C_FAILED
           
static int PROCESS_FUNCTION_FROM_CLIENT_FAILED
           
static int PROCESS_SHOW_INFORMATION_1_FAILED
           
static int QUERIES_OVERFLOW
           
 
Constructor Summary
session(session_table st, int session_id, resource_manager rm, edu.vt.marian.common.Debug debug)
          method description: this constructor will create a session object, this session belongs to the specified session table, has the specified id and will use the specified resource manager.
session(session_table st, int session_id, java.lang.String dir_name, resource_manager rm, edu.vt.marian.common.Debug debug)
          method description: this constructor will create a session object, this session belongs to the specified session table, has the specified id and will use the specified resource manager, the directory/file contains all the configuration information for this session.
 
Method Summary
 int execute_next_call_from_c()
          method description: this method will take out a function from C/C++ server function queue and pass it to corresponding query object to process uses the services of class(es): input parameter(s): none output parameter(s): none return value: OK -- a function has been taken out from queue and processed by the corresponding query correctly NULL_RPC_FUNCTION -- the queue is empty NULL_RPC_FUNCTION_NAME -- the rpc_function's name is null NULL_PARAMETER -- the parameter of rpc_function is null INVALID_PARAMETER_TYPE -- the parameter's type of rpc_function is invalid PROCESS_SHOW_INFORMATION_1_FAILED -- error happens when query process the function "show_information_1" PROCESS_FUNCTION_FROM_C_FAILED -- error happens when query process the function CANNOT_FIND_QUERY -- invalid query id PROCESS_ERROR_FOR_SESSION_MANAGER_FAILED -- error happens when session process the function synchronization: synchronized
 int execute_next_call_from_client()
          method description: this method will take out a function from the client function queue and pass it to corresponding query object to process uses the services of class(es): input parameter(s): none output parameter(s): none return value: OK -- a function has been taken out from queue and processed by the corresponding query correctly NULL_RPC_FUNCTION -- the queue is empty NULL_PARAMETER -- No parameter is found in the rpc_function INVALID_PARAMETER_TYPE -- The parameter's type of rpc_function is invalid PROCESS_FUNCTION_FROM_CLIENT_FAILED -- error happens when query process the function QUERIES_OVERFLOW -- Queries overflowed synchronization: synchronized
 int exit(java.lang.String condition)
          method description: this method will let the session object exit smoothly, release the resources it occupied and kill all the threads it created.
 int get_id()
          method description: this method will return the id of this session object.
 long get_inactive_time()
          method description: this method will return the inactive time of this session object, this is the time interval between the last time a function is processed and the time this method is called.
 int get_max_number_queries()
          method description: this method will return the possible maximum number of queries allowed in this object uses the services of class(es): none input parameter(s): none output parameter(s): none return value: the maximum possible number of queries allowed in this session object as an integer synchronization: none
 int get_number_queries()
          method description: this method will return the number of queries currently in this session object.
 int get_number_unprocessed_call_from_c()
          method description: this method will tell the current number of functions in the C/C++ server function queue.
 int get_number_unprocessed_call_from_client()
          method description: this method will tell the current number of functions in the client function queue.
 int log_data_from_query(int log_level, int query_id, java.lang.String message)
          method description: this method log the data sent from the specified query of this session uses the services of class(es): none input parameter(s): log_level -- specifies the depth of the message, 1 means it's the query itself query_id -- identifies the query sent the message message message -- the message the query want the session to log generator relative to the session output parameter(s): none return value: OK -- the message has been logged correctly other -- synchronization: none
 int process_call_from_c(edu.vt.marian.uip.rpc_function rf)
          method description: this method will process the function sent from C/C++ marian server, in fact it just put the function into the corresponding function queue uses the services of class(es): input parameter(s): rf -- the rpc function need to be processed output parameter(s): none return value: OK -- the function has been processed correctly PROCESS_CALL_FROM_C_FAILED -- can not enter the function into the queue because the queue overflowed other -- synchronization: none
 int process_call_from_client(edu.vt.marian.uip.rpc_function rf)
          method description: this method will process the function sent from client (currently webgate), in fact it just put the function into the corresponding queue object it created uses the services of class(es): input parameter(s): rf -- the rpc function need to be processed output parameter(s): none return value: OK -- the function has been processed correctly PROCESS_CALL_FROM_CLIENT_FAILED -- client function queue overflowed synchronization: none
 int process_call_from_query_to_c(int query_id, edu.vt.marian.uip.rpc_function rf)
          method description: this method will process the function sent from one of its query object to C/C++ marian server, in fact it just insert the query id to the function and then pass it to session manager.
 int process_call_from_query_to_client(int query_id, edu.vt.marian.uip.rpc_function rf)
          method description: this method will process the function sent from one of it's query object to client (currently webgate), in fact it just insert the query id in the function and then pass it to session manager.
 int set_max_number_queries(int number)
          method description: this method will set the maximum possible number of queries allowed in this session object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

OK

public static final int OK

CLIENT_QUEUE_SIZE_NOT_EQUAL_0

public static final int CLIENT_QUEUE_SIZE_NOT_EQUAL_0

C_QUEUE_SIZE_NOT_EQUAL_0

public static final int C_QUEUE_SIZE_NOT_EQUAL_0

CLIENT_AND_C_QUEUES_SIZE_NOT_EQUAL_0

public static final int CLIENT_AND_C_QUEUES_SIZE_NOT_EQUAL_0

PROCESS_CALL_FROM_SESSION_TO_C_FAILED

public static final int PROCESS_CALL_FROM_SESSION_TO_C_FAILED

PROCESS_CALL_FROM_CLIENT_FAILED

public static final int PROCESS_CALL_FROM_CLIENT_FAILED

PROCESS_CALL_FROM_C_FAILED

public static final int PROCESS_CALL_FROM_C_FAILED

NULL_RPC_FUNCTION

public static final int NULL_RPC_FUNCTION

NULL_PARAMETER

public static final int NULL_PARAMETER

INVALID_PARAMETER_TYPE

public static final int INVALID_PARAMETER_TYPE

PROCESS_FUNCTION_FROM_CLIENT_FAILED

public static final int PROCESS_FUNCTION_FROM_CLIENT_FAILED

PROCESS_FUNCTION_FROM_C_FAILED

public static final int PROCESS_FUNCTION_FROM_C_FAILED

NULL_RPC_FUNCTION_NAME

public static final int NULL_RPC_FUNCTION_NAME

PROCESS_ERROR_FOR_SESSION_MANAGER_FAILED

public static final int PROCESS_ERROR_FOR_SESSION_MANAGER_FAILED

PROCESS_SHOW_INFORMATION_1_FAILED

public static final int PROCESS_SHOW_INFORMATION_1_FAILED

CANNOT_FIND_QUERY

public static final int CANNOT_FIND_QUERY

PROCESS_CALL_FROM_SESSION_TO_CLIENT_FAILED

public static final int PROCESS_CALL_FROM_SESSION_TO_CLIENT_FAILED

INVALID_SESSION_ID

public static final int INVALID_SESSION_ID

INVALID_MAX_NUMBER_QUERIES

public static final int INVALID_MAX_NUMBER_QUERIES

QUERIES_OVERFLOW

public static final int QUERIES_OVERFLOW

NULL_MESSAGE

public static final int NULL_MESSAGE
Constructor Detail

session

public session(session_table st,
               int session_id,
               java.lang.String dir_name,
               resource_manager rm,
               edu.vt.marian.common.Debug debug)
method description: this constructor will create a session object, this session belongs to the specified session table, has the specified id and will use the specified resource manager, the directory/file contains all the configuration information for this session. uses the services of class(es): input parameter(s): st -- the session table this session belongs to session_id -- the id of this sesion, it's uniq in the session table file_name -- directory/file which contains all the configuration information of this session object rm -- this session will use this resource manager to log data and it also pass the resource manager to all the queries it created debug -- used for debugging output parameter(s): none return value: none synchronization: none

session

public session(session_table st,
               int session_id,
               resource_manager rm,
               edu.vt.marian.common.Debug debug)
method description: this constructor will create a session object, this session belongs to the specified session table, has the specified id and will use the specified resource manager. uses the services of class(es): input parameter(s): st -- the session table this session belongs to session_id -- the id of this sesion, it's uniq in the session table rm -- this session will use this resource manager to log data and it also pass the resource manager to all the queries it created debug -- used for debugging output parameter(s): none return value: none synchronization: none
Method Detail

get_inactive_time

public long get_inactive_time()
method description: this method will return the inactive time of this session object, this is the time interval between the last time a function is processed and the time this method is called. uses the services of class(es): input parameter(s): none output parameter(s): none return value: the inactive time of this object as a long integer, the unit is ms. synchronization: none

exit

public int exit(java.lang.String condition)
method description: this method will let the session object exit smoothly, release the resources it occupied and kill all the threads it created. uses the services of class(es): input parameter(s): condition -- specifies under what condition this method is called output parameter(s): none return value: OK -- the exit is smooth CLIENT_QUEUE_SIZE_NOT_EQUAL_0 -- client function queue length is not 0 C_QUEUE_SIZE_NOT_EQUAL_0 -- c function queue length is not 0 CLIENT_AND_C_QUEUES_SIZE_NOT_EQUAL_0 -- both function queue lengthes are not 0 synchronization: synchronized

process_call_from_client

public int process_call_from_client(edu.vt.marian.uip.rpc_function rf)
method description: this method will process the function sent from client (currently webgate), in fact it just put the function into the corresponding queue object it created uses the services of class(es): input parameter(s): rf -- the rpc function need to be processed output parameter(s): none return value: OK -- the function has been processed correctly PROCESS_CALL_FROM_CLIENT_FAILED -- client function queue overflowed synchronization: none

process_call_from_c

public int process_call_from_c(edu.vt.marian.uip.rpc_function rf)
method description: this method will process the function sent from C/C++ marian server, in fact it just put the function into the corresponding function queue uses the services of class(es): input parameter(s): rf -- the rpc function need to be processed output parameter(s): none return value: OK -- the function has been processed correctly PROCESS_CALL_FROM_C_FAILED -- can not enter the function into the queue because the queue overflowed other -- synchronization: none

execute_next_call_from_client

public int execute_next_call_from_client()
method description: this method will take out a function from the client function queue and pass it to corresponding query object to process uses the services of class(es): input parameter(s): none output parameter(s): none return value: OK -- a function has been taken out from queue and processed by the corresponding query correctly NULL_RPC_FUNCTION -- the queue is empty NULL_PARAMETER -- No parameter is found in the rpc_function INVALID_PARAMETER_TYPE -- The parameter's type of rpc_function is invalid PROCESS_FUNCTION_FROM_CLIENT_FAILED -- error happens when query process the function QUERIES_OVERFLOW -- Queries overflowed synchronization: synchronized

execute_next_call_from_c

public int execute_next_call_from_c()
method description: this method will take out a function from C/C++ server function queue and pass it to corresponding query object to process uses the services of class(es): input parameter(s): none output parameter(s): none return value: OK -- a function has been taken out from queue and processed by the corresponding query correctly NULL_RPC_FUNCTION -- the queue is empty NULL_RPC_FUNCTION_NAME -- the rpc_function's name is null NULL_PARAMETER -- the parameter of rpc_function is null INVALID_PARAMETER_TYPE -- the parameter's type of rpc_function is invalid PROCESS_SHOW_INFORMATION_1_FAILED -- error happens when query process the function "show_information_1" PROCESS_FUNCTION_FROM_C_FAILED -- error happens when query process the function CANNOT_FIND_QUERY -- invalid query id PROCESS_ERROR_FOR_SESSION_MANAGER_FAILED -- error happens when session process the function synchronization: synchronized

get_number_unprocessed_call_from_client

public int get_number_unprocessed_call_from_client()
method description: this method will tell the current number of functions in the client function queue. uses the services of class(es): function_queue input parameter(s): none output parameter(s): none return value: an integer specifies how many functions are there in the client function queue synchronization: none

get_number_unprocessed_call_from_c

public int get_number_unprocessed_call_from_c()
method description: this method will tell the current number of functions in the C/C++ server function queue. uses the services of class(es): function_queue input parameter(s): none output parameter(s): none return value: an integer specifies how many functions are there in the c/C++ marian server function queue synchronization: none

process_call_from_query_to_client

public int process_call_from_query_to_client(int query_id,
                                             edu.vt.marian.uip.rpc_function rf)
method description: this method will process the function sent from one of it's query object to client (currently webgate), in fact it just insert the query id in the function and then pass it to session manager. uses the services of class(es): rpc_function, parameter input parameter(s): queyr_id -- specifies which query passed the function to this object rf -- the rpc function need to be processed output parameter(s): none return value: OK -- the function has been processed correctly NULL_RPC_FUNCTION -- the parameter rpc_function is null PROCESS_CALL_FROM_SESSION_TO_CLIENT_FAILED -- error happens when process call from session to client other -- synchronization: none

process_call_from_query_to_c

public int process_call_from_query_to_c(int query_id,
                                        edu.vt.marian.uip.rpc_function rf)
method description: this method will process the function sent from one of its query object to C/C++ marian server, in fact it just insert the query id to the function and then pass it to session manager. uses the services of class(es): rpf_function, parameter input parameter(s): queyr_id -- specifies which query passed the function to this object rf -- the rpc function need to be processed output parameter(s): none return value: OK -- the function has been processed correctly NULL_RPC_FUNCTION -- the parameter rpc_function is null PROCESS_CALL_FROM_SESSION_TO_C_FAILED -- error happens when process call from session to c other -- synchronization: none

get_id

public int get_id()
method description: this method will return the id of this session object. uses the services of class(es): none input parameter(s): none output parameter(s): none return value: the id of this session as an integer synchronization: none

get_number_queries

public int get_number_queries()
method description: this method will return the number of queries currently in this session object. uses the services of class(es): none input parameter(s): none output parameter(s): none return value: the number of queries in this session object as an integer synchronization: none

get_max_number_queries

public int get_max_number_queries()
method description: this method will return the possible maximum number of queries allowed in this object uses the services of class(es): none input parameter(s): none output parameter(s): none return value: the maximum possible number of queries allowed in this session object as an integer synchronization: none

set_max_number_queries

public int set_max_number_queries(int number)
method description: this method will set the maximum possible number of queries allowed in this session object. uses the services of class(es): input parameter(s): number -- this will be the new maximum number output parameter(s): none return value: OK -- the new number has been set correctly INVALID_MAX_NUMBER_QUERIES -- the number is negative and doesn't make sense other -- synchronization: none

log_data_from_query

public int log_data_from_query(int log_level,
                               int query_id,
                               java.lang.String message)
method description: this method log the data sent from the specified query of this session uses the services of class(es): none input parameter(s): log_level -- specifies the depth of the message, 1 means it's the query itself query_id -- identifies the query sent the message message message -- the message the query want the session to log generator relative to the session output parameter(s): none return value: OK -- the message has been logged correctly other -- synchronization: none