Class ServerCommunication

java.lang.Object
  extended by ServerCommunication
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener

public class ServerCommunication
extends java.lang.Object
implements java.awt.event.ActionListener

Class ServerCommunication provides the interface for communication with the server. All types of messages that are understood by the server are created here. It uses class ServerNetCommunication for the actual sending of the messages.


Field Summary
static byte EOL
           
static byte EOM
           
static int ERROR_ACCOUNT_DISABLED
           
static int ERROR_ANOTHER_ERROR
           
static int ERROR_CANNOT_ALLOCATE_MEMORY
           
static int ERROR_CANNOT_READ_FILE
           
static int ERROR_CANNOT_WRITE_FILE
           
static int error_login_failed
           
static int error_max_clients
           
static int ERROR_NO_CHANGE_PASSWORD_PERMISSION
           
static int error_ok
           
static int ERROR_OK
           
static int ERROR_REGEXP_COMPILATION
           
static int ERROR_USER_DOES_NOT_EXIST
           
static int ERROR_WRONG_OLD_PASSWORD
           
static int ERROR_WRONG_PASSWORD
           
static byte GET_TREE_SUBTYPE_CONTEXT
           
static byte GET_TREE_SUBTYPE_FIRST
           
static byte GET_TREE_SUBTYPE_OCCURENCE
           
static byte GET_TREE_SUBTYPE_TREE
           
static int maxlenmes
           
static byte oddelovac
           
static byte OK
           
 byte[] zprava
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void destroy()
           
static int findByte(byte[] zprava, int position, byte character)
           
 java.lang.String getActualPath()
           
 java.lang.String getClientRecommendedVersion()
           
 java.lang.String getClientRequiredVersion()
           
 java.lang.String getCorpusIdentifier()
           
 int getError()
           
 java.lang.String getErrorMessage()
           
 java.lang.String getFileTail()
           
 NGForest getForest()
           
 java.lang.String getInitialPath()
           
 long getNumberOfActualOccurrence()
           
 long getNumberOfActualTree()
           
 long getNumberOfFoundOccurences()
           
 long getNumberOfFoundTrees()
           
 long getNumberOfSearchedTrees()
           
 java.lang.String getServerName()
           
 int getServerPort()
           
 java.lang.String getServerVersion()
           
 void getStatistics()
           
static java.lang.String getString(byte[] pole, int odkud, byte termination_char)
           
static java.lang.String getString(byte[] zprava, int position, int length)
           
static java.lang.String getWholeString(byte[] pole, int odkud)
          Returns the String representation of the rest of the array pole encoded in UTF-8; it starts ad position odkud and goes until it finds EOM (which should be zero in order to work with UTF-8)
 void changeDir(java.lang.String adr)
           
 int changePassword(java.lang.String login_name, java.lang.String encoded_old_password, java.lang.String encoded_new_password)
           
 boolean isConnected()
           
 int loadNextTree(TreeLoadedListener tree_loaded_listener, byte subtype, boolean repeat)
           
 int loadPrevTree(byte subtype)
           
 NGForest loadTree()
           
 int login()
           
 int nastavStromyDleDotazu(java.lang.String sp, boolean above_result, boolean match_lemma_variants, boolean match_lemma_comments, boolean first_only, boolean invert_match)
           
 boolean nastavVsechnyStromy()
           
 void precti_adr(boolean prvni)
           
 void precti_sbr(boolean prvni)
           
 int read5InitialInformations()
           
 void readActualPath()
           
 void readClientRequiredVersion()
           
 void readServerVersion()
           
 int receive(byte[] buffer, byte EOM)
           
 int removeOccurrence(TreeLoadedListener tree_loaded_listener, boolean repeat)
           
 void send(byte[] buffer, int delka)
           
 void setMessagesShower(ShowMessagesAble sma)
           
 void stopTheQuery()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

maxlenmes

public static final int maxlenmes
See Also:
Constant Field Values

zprava

public byte[] zprava

EOM

public static final byte EOM
See Also:
Constant Field Values

EOL

public static final byte EOL
See Also:
Constant Field Values

OK

public static final byte OK
See Also:
Constant Field Values

oddelovac

public static byte oddelovac

GET_TREE_SUBTYPE_CONTEXT

public static final byte GET_TREE_SUBTYPE_CONTEXT
See Also:
Constant Field Values

GET_TREE_SUBTYPE_OCCURENCE

public static final byte GET_TREE_SUBTYPE_OCCURENCE
See Also:
Constant Field Values

GET_TREE_SUBTYPE_TREE

public static final byte GET_TREE_SUBTYPE_TREE
See Also:
Constant Field Values

GET_TREE_SUBTYPE_FIRST

public static final byte GET_TREE_SUBTYPE_FIRST
See Also:
Constant Field Values

error_ok

public static final int error_ok
See Also:
Constant Field Values

error_max_clients

public static final int error_max_clients
See Also:
Constant Field Values

error_login_failed

public static final int error_login_failed
See Also:
Constant Field Values

ERROR_OK

public static final int ERROR_OK
See Also:
Constant Field Values

ERROR_CANNOT_READ_FILE

public static final int ERROR_CANNOT_READ_FILE
See Also:
Constant Field Values

ERROR_CANNOT_WRITE_FILE

public static final int ERROR_CANNOT_WRITE_FILE
See Also:
Constant Field Values

ERROR_USER_DOES_NOT_EXIST

public static final int ERROR_USER_DOES_NOT_EXIST
See Also:
Constant Field Values

ERROR_ACCOUNT_DISABLED

public static final int ERROR_ACCOUNT_DISABLED
See Also:
Constant Field Values

ERROR_WRONG_PASSWORD

public static final int ERROR_WRONG_PASSWORD
See Also:
Constant Field Values

ERROR_WRONG_OLD_PASSWORD

public static final int ERROR_WRONG_OLD_PASSWORD
See Also:
Constant Field Values

ERROR_NO_CHANGE_PASSWORD_PERMISSION

public static final int ERROR_NO_CHANGE_PASSWORD_PERMISSION
See Also:
Constant Field Values

ERROR_CANNOT_ALLOCATE_MEMORY

public static final int ERROR_CANNOT_ALLOCATE_MEMORY
See Also:
Constant Field Values

ERROR_ANOTHER_ERROR

public static final int ERROR_ANOTHER_ERROR
See Also:
Constant Field Values

ERROR_REGEXP_COMPILATION

public static final int ERROR_REGEXP_COMPILATION
See Also:
Constant Field Values
Method Detail

setMessagesShower

public void setMessagesShower(ShowMessagesAble sma)

getServerName

public java.lang.String getServerName()

getServerPort

public int getServerPort()

getServerVersion

public java.lang.String getServerVersion()

getClientRequiredVersion

public java.lang.String getClientRequiredVersion()

getClientRecommendedVersion

public java.lang.String getClientRecommendedVersion()

isConnected

public boolean isConnected()

getError

public int getError()

getErrorMessage

public java.lang.String getErrorMessage()

getWholeString

public static java.lang.String getWholeString(byte[] pole,
                                              int odkud)
Returns the String representation of the rest of the array pole encoded in UTF-8; it starts ad position odkud and goes until it finds EOM (which should be zero in order to work with UTF-8)

Parameters:
pole - byte[]
odkud - int
Returns:
String

getString

public static java.lang.String getString(byte[] pole,
                                         int odkud,
                                         byte termination_char)

readServerVersion

public void readServerVersion()

readClientRequiredVersion

public void readClientRequiredVersion()

readActualPath

public void readActualPath()

read5InitialInformations

public int read5InitialInformations()

login

public int login()

getActualPath

public java.lang.String getActualPath()

getInitialPath

public java.lang.String getInitialPath()

getCorpusIdentifier

public java.lang.String getCorpusIdentifier()

precti_adr

public void precti_adr(boolean prvni)

precti_sbr

public void precti_sbr(boolean prvni)

changeDir

public void changeDir(java.lang.String adr)

changePassword

public int changePassword(java.lang.String login_name,
                          java.lang.String encoded_old_password,
                          java.lang.String encoded_new_password)

stopTheQuery

public void stopTheQuery()

nastavVsechnyStromy

public boolean nastavVsechnyStromy()

nastavStromyDleDotazu

public int nastavStromyDleDotazu(java.lang.String sp,
                                 boolean above_result,
                                 boolean match_lemma_variants,
                                 boolean match_lemma_comments,
                                 boolean first_only,
                                 boolean invert_match)

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

loadPrevTree

public int loadPrevTree(byte subtype)

loadNextTree

public int loadNextTree(TreeLoadedListener tree_loaded_listener,
                        byte subtype,
                        boolean repeat)

removeOccurrence

public int removeOccurrence(TreeLoadedListener tree_loaded_listener,
                            boolean repeat)

findByte

public static int findByte(byte[] zprava,
                           int position,
                           byte character)

getString

public static java.lang.String getString(byte[] zprava,
                                         int position,
                                         int length)

loadTree

public NGForest loadTree()

getForest

public NGForest getForest()

getStatistics

public void getStatistics()

getNumberOfActualOccurrence

public long getNumberOfActualOccurrence()

getNumberOfActualTree

public long getNumberOfActualTree()

getNumberOfFoundOccurences

public long getNumberOfFoundOccurences()

getNumberOfFoundTrees

public long getNumberOfFoundTrees()

getNumberOfSearchedTrees

public long getNumberOfSearchedTrees()

getFileTail

public java.lang.String getFileTail()

send

public void send(byte[] buffer,
                 int delka)

receive

public int receive(byte[] buffer,
                   byte EOM)

destroy

public void destroy()