edu.vt.marian.server
Class query

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

public class query
extends java.lang.Object

class name: query class description: this class represents a query in the system, in fact this object takes the most responsibility to search documents for users. uses the services of class(es): designer(s): Jianxin Zhao (jxzhao@csgrad.cs.vt.edu) implementator(s): Jian Zeng (jizeng@vt.edu) finished time: known bugs: JDK version: 1.1.7A side effects:


Field Summary
static int BATCH_SIZE_WRONG
           
static int CAST_FAIL
           
static int COLLECTION_NOT_VTLS
           
static int COLLECTION_NULL
           
static int DATA_NULL
          returned values for method invoke_parser
static int DOC_IDS_NULL
          returned values of method process_get_circulation_info
static int DOC_IDS_SIZE_ZERO
           
static int DOCS_NULL
           
static int DONE
           
static int ELEMENT_WRONG
           
static int FIRST_ELEMENT_WRONG
           
static int INIT
          Five states of the query.
static int INPUT_VALUE_ZERO
           
static int INVALID_BATCH_SIZE
          returned values of method process_show_next_k
static int MESSAGE_INVALID
          returned values for process_show_information_query
static int NAME_OF_RPC_FUNCTION_NULL
           
static int NEGATIVE_ID
          returned values for method set_id
static int NO_PARSER
           
static int NO_SUCH_ELEMENT
           
static int OBJS_SIZE_ZERO
           
static int OPEN_SOCKET_FAIL
           
static int PARAMETERS_NULL
          returned values for process_call_from_c
static int PROCESS_CALL_FROM_QUERY_TO_CLIENT_FAIL
           
static int PROCESS_FUNCTION_FAIL
           
static int PROCESS_INVOKE_PARSER_FAIL
          returned values for method invoke_parsers
static int PROCESS_INVOKE_PARSERS_FAIL
           
static int PROCESS_RAW_RETR_FAIL
           
static int PROCESS_SESSION_GET_CIRCULATION_INFO_FAIL
           
static int PROCESS_SESSION_INFORMATION_QUERY_FAIL
           
static int PROCESS_SESSION_INVOKE_PARSER_FAIL
           
static int PROCESS_SESSION_INVOKE_PARSERS_FAIL
           
static int PROCESS_SESSION_SHOW_NEXT_K_FAIL
           
static int PROCESS_SESSION_SHOW_RAW_FAIL
           
static int QUERY
           
static int QUERY_DONE
           
static int RAW_DATA_NULL
           
static int RAW_ELEMENT_WRONG
           
static int READ_FROM_SOCKET_FAIL
           
static int RPC_FUNCTION_NULL
          returned values for method process_call_from_client
static int SECOND_ELEMENT_WRONG
           
static int SIZE_NOT_SAME
           
static int SOCKET_INPUT_EMPTY_STRING
           
static int SOCKET_INPUT_NULL
           
static int START
           
static int STATE_INVALID
          returned values for set_state
static int STATE_IS_NOT_INIT
          returned values for method process_search_collection
static int STATE_IS_NOT_QUERY
          returned values for process_show_raw_retr and process_add_raw_retr
static int STATE_IS_NOT_QUERY_DONE
           
static int STATE_IS_NOT_START
          returned values for method process_biblio_query_text
static int SUCCESS
          define returned values
static int THIRD_ELEMENT_WRONG
           
static int UNRECOGNIZED_FUNCTION
           
static int WRITE_TO_SOCKET_FAIL
           
static int WRONG_PARAMETER
           
 
Constructor Summary
query(session s, int query_id, resource_manager rm, edu.vt.marian.common.Debug debug)
          method description: this constructor will create a query object, this query object belongs to the specified session, has the specified query id, will use the specified resource manager.
 
Method Summary
 int exit(java.lang.String condition)
          method description: this method will let this query object exit smoothly, release all resources it occupied and kill all the threads it created.
 int get_id()
          method description: this method will return the id of this query object uses the services of class(es): input parameter(s): none output parameter(s): none return value: the id of this query object as an integer synchronization consideration: none
 long get_inactive_time()
          method description: this method will return the time query object has been inactive, it's 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 query object as a long integer, the unit is milliseconds.
 int get_state()
          method description: this method will return the value of state.
 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 uses the services of class(es): input parameter(s): rf -- the rpc function to process output parameter(s): none return value: SUCCESS -- the function has been processed correctly others -- RPC_FUNCTION_NULL NAME_OF_RPC_FUNCTION_NULL WRONG_PARAMETER PROCESS_FUNCTION_FAIL UNRECOGNIZED_FUNCTION NO_SUCH_ELEMENT PARAMETERS_NULL SIZE_NOT_SAME OBJS_SIZE_ZERO FIRST_ELEMENT_WRONG SECOND_ELEMENT_WRONG THIRD_ELEMENT_WRONG RAW_ELEMENT_WRONG RAW_DATA_NULL PROCESS_RAW_RETR_FAIL synchronization consideration: this is a reader method on whatever data
 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) to query uses the services of class(es): log_manager input parameter(s): rf -- the rpc function to process output parameter(s): none return value: SUCCESS -- the function has been processed correctly others -- RPC_FUNCTION_NULL NAME_OF_RPC_FUNCTION_NULL WRONG_PARAMETER PROCESS_FUNCTION_FAIL UNRECOGNIZED_FUNCTION NO_SUCH_ELEMENT synchronization consideration: none
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INIT

public static final int INIT
Five states of the query.

START

public static final int START

QUERY

public static final int QUERY

QUERY_DONE

public static final int QUERY_DONE

DONE

public static final int DONE

SUCCESS

public static final int SUCCESS
define returned values

NEGATIVE_ID

public static final int NEGATIVE_ID
returned values for method set_id

RPC_FUNCTION_NULL

public static final int RPC_FUNCTION_NULL
returned values for method process_call_from_client

NAME_OF_RPC_FUNCTION_NULL

public static final int NAME_OF_RPC_FUNCTION_NULL

WRONG_PARAMETER

public static final int WRONG_PARAMETER

PROCESS_FUNCTION_FAIL

public static final int PROCESS_FUNCTION_FAIL

UNRECOGNIZED_FUNCTION

public static final int UNRECOGNIZED_FUNCTION

NO_SUCH_ELEMENT

public static final int NO_SUCH_ELEMENT

STATE_IS_NOT_INIT

public static final int STATE_IS_NOT_INIT
returned values for method process_search_collection

COLLECTION_NULL

public static final int COLLECTION_NULL

COLLECTION_NOT_VTLS

public static final int COLLECTION_NOT_VTLS

PROCESS_CALL_FROM_QUERY_TO_CLIENT_FAIL

public static final int PROCESS_CALL_FROM_QUERY_TO_CLIENT_FAIL

STATE_IS_NOT_START

public static final int STATE_IS_NOT_START
returned values for method process_biblio_query_text

BATCH_SIZE_WRONG

public static final int BATCH_SIZE_WRONG

PROCESS_INVOKE_PARSERS_FAIL

public static final int PROCESS_INVOKE_PARSERS_FAIL

PROCESS_INVOKE_PARSER_FAIL

public static final int PROCESS_INVOKE_PARSER_FAIL
returned values for method invoke_parsers

NO_PARSER

public static final int NO_PARSER

PROCESS_SESSION_INVOKE_PARSERS_FAIL

public static final int PROCESS_SESSION_INVOKE_PARSERS_FAIL

DATA_NULL

public static final int DATA_NULL
returned values for method invoke_parser

PROCESS_SESSION_INVOKE_PARSER_FAIL

public static final int PROCESS_SESSION_INVOKE_PARSER_FAIL

INVALID_BATCH_SIZE

public static final int INVALID_BATCH_SIZE
returned values of method process_show_next_k

STATE_IS_NOT_QUERY_DONE

public static final int STATE_IS_NOT_QUERY_DONE

PROCESS_SESSION_SHOW_NEXT_K_FAIL

public static final int PROCESS_SESSION_SHOW_NEXT_K_FAIL

DOC_IDS_NULL

public static final int DOC_IDS_NULL
returned values of method process_get_circulation_info

DOC_IDS_SIZE_ZERO

public static final int DOC_IDS_SIZE_ZERO

OPEN_SOCKET_FAIL

public static final int OPEN_SOCKET_FAIL

CAST_FAIL

public static final int CAST_FAIL

WRITE_TO_SOCKET_FAIL

public static final int WRITE_TO_SOCKET_FAIL

READ_FROM_SOCKET_FAIL

public static final int READ_FROM_SOCKET_FAIL

SOCKET_INPUT_NULL

public static final int SOCKET_INPUT_NULL

SOCKET_INPUT_EMPTY_STRING

public static final int SOCKET_INPUT_EMPTY_STRING

INPUT_VALUE_ZERO

public static final int INPUT_VALUE_ZERO

PROCESS_SESSION_GET_CIRCULATION_INFO_FAIL

public static final int PROCESS_SESSION_GET_CIRCULATION_INFO_FAIL

PARAMETERS_NULL

public static final int PARAMETERS_NULL
returned values for process_call_from_c

SIZE_NOT_SAME

public static final int SIZE_NOT_SAME

OBJS_SIZE_ZERO

public static final int OBJS_SIZE_ZERO

FIRST_ELEMENT_WRONG

public static final int FIRST_ELEMENT_WRONG

SECOND_ELEMENT_WRONG

public static final int SECOND_ELEMENT_WRONG

THIRD_ELEMENT_WRONG

public static final int THIRD_ELEMENT_WRONG

RAW_ELEMENT_WRONG

public static final int RAW_ELEMENT_WRONG

RAW_DATA_NULL

public static final int RAW_DATA_NULL

PROCESS_RAW_RETR_FAIL

public static final int PROCESS_RAW_RETR_FAIL

STATE_IS_NOT_QUERY

public static final int STATE_IS_NOT_QUERY
returned values for process_show_raw_retr and process_add_raw_retr

DOCS_NULL

public static final int DOCS_NULL

ELEMENT_WRONG

public static final int ELEMENT_WRONG

PROCESS_SESSION_SHOW_RAW_FAIL

public static final int PROCESS_SESSION_SHOW_RAW_FAIL

MESSAGE_INVALID

public static final int MESSAGE_INVALID
returned values for process_show_information_query

PROCESS_SESSION_INFORMATION_QUERY_FAIL

public static final int PROCESS_SESSION_INFORMATION_QUERY_FAIL

STATE_INVALID

public static final int STATE_INVALID
returned values for set_state
Constructor Detail

query

public query(session s,
             int query_id,
             resource_manager rm,
             edu.vt.marian.common.Debug debug)
method description: this constructor will create a query object, this query object belongs to the specified session, has the specified query id, will use the specified resource manager. uses the services of class(es): Debug input parameter(s): s -- the session this query object belongs to. query_id -- the id of this query object, this is uniqe in the session this object belongs to. rm -- the resource manager this query object will use to do searching and write log. debug -- used for debugging. output parameter(s): none return value: none synchronization consideration: none
Method Detail

get_inactive_time

public long get_inactive_time()
method description: this method will return the time query object has been inactive, it's 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 query object as a long integer, the unit is milliseconds. synchronization consideration: none

exit

public int exit(java.lang.String condition)
method description: this method will let this query object exit smoothly, release all resources it occupied and kill all the threads it created. uses the services of class(es): log_manager, ReaderWriterMutex input parameter(s): condition --- this specify under what condition this method is called output parameter(s): none return value: SUCCESS -- the exit is smooth synchronization consideration: this is a synchronized method because we need to update the state.

get_id

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

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) to query uses the services of class(es): log_manager input parameter(s): rf -- the rpc function to process output parameter(s): none return value: SUCCESS -- the function has been processed correctly others -- RPC_FUNCTION_NULL NAME_OF_RPC_FUNCTION_NULL WRONG_PARAMETER PROCESS_FUNCTION_FAIL UNRECOGNIZED_FUNCTION NO_SUCH_ELEMENT synchronization consideration: 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 uses the services of class(es): input parameter(s): rf -- the rpc function to process output parameter(s): none return value: SUCCESS -- the function has been processed correctly others -- RPC_FUNCTION_NULL NAME_OF_RPC_FUNCTION_NULL WRONG_PARAMETER PROCESS_FUNCTION_FAIL UNRECOGNIZED_FUNCTION NO_SUCH_ELEMENT PARAMETERS_NULL SIZE_NOT_SAME OBJS_SIZE_ZERO FIRST_ELEMENT_WRONG SECOND_ELEMENT_WRONG THIRD_ELEMENT_WRONG RAW_ELEMENT_WRONG RAW_DATA_NULL PROCESS_RAW_RETR_FAIL synchronization consideration: this is a reader method on whatever data

get_state

public int get_state()
method description: this method will return the value of state. uses the services of class(es): input parameter(s): none output parameter(s): none return value: state -- possible value is 0-4 right now. synchronization consideration: none