net.sf.dict4j
Class DictSession

java.lang.Object
  extended by net.sf.dict4j.DictSession
Direct Known Subclasses:
DictSessionWithCache

public class DictSession
extends java.lang.Object

Dict protocol session

This class is thread-safe.

Author:
Yuriy.V.Lazarev

Constructor Summary
DictSession(DictTransport transport)
           
DictSession(java.lang.String address)
           
DictSession(java.lang.String address, int port)
           
 
Method Summary
 boolean auth(java.lang.String username, java.lang.String password)
           
 java.lang.String client(java.lang.String client)
           
 void close()
           
 java.lang.String databaseInfo(java.lang.String database)
           
 java.util.List<Definition> define(DatabaseWord databaseWord)
           
 java.util.List<Definition> define(java.lang.String word)
           
 java.util.List<Definition> define(java.lang.String word, Database database)
           
 java.util.List<Definition> define(java.lang.String word, java.lang.String database)
          Get definitions of word from given database
 Banner getBanner()
           
 java.lang.String help()
           
 boolean isClosed()
           
 boolean isOpen()
           
 boolean isOptionMime()
           
 java.util.List<DatabaseWord> match(java.lang.String word)
          Match word in all available databases using default strategy
 java.util.List<DatabaseWord> match(java.lang.String word, Database database)
           
 java.util.List<DatabaseWord> match(java.lang.String word, Database database, Strategy strategy)
           
 java.util.List<DatabaseWord> match(java.lang.String word, java.lang.String database, java.lang.String strategy)
          Match word in given database using given strategy
 void open(java.lang.String client)
           
 java.lang.String quit()
           
 java.lang.String serverInfo()
           
 void setLogAppender(DictLogAppender logAppender)
           
 void setOptionMime()
           
 java.util.List<Database> showDatabases()
           
 java.util.List<Strategy> showStrategies()
           
 java.lang.String status()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DictSession

public DictSession(java.lang.String address)

DictSession

public DictSession(java.lang.String address,
                   int port)

DictSession

public DictSession(DictTransport transport)
Method Detail

setLogAppender

public void setLogAppender(DictLogAppender logAppender)

open

public void open(java.lang.String client)

auth

public boolean auth(java.lang.String username,
                    java.lang.String password)

close

public void close()

isOpen

public boolean isOpen()

isClosed

public boolean isClosed()

client

public java.lang.String client(java.lang.String client)

status

public java.lang.String status()

help

public java.lang.String help()

serverInfo

public java.lang.String serverInfo()

databaseInfo

public java.lang.String databaseInfo(java.lang.String database)

showDatabases

public java.util.List<Database> showDatabases()

showStrategies

public java.util.List<Strategy> showStrategies()

define

public java.util.List<Definition> define(java.lang.String word,
                                         java.lang.String database)
Get definitions of word from given database

Parameters:
word - word to match
database - database to search
Returns:
list of all available word's definitions

define

public java.util.List<Definition> define(java.lang.String word)

define

public java.util.List<Definition> define(DatabaseWord databaseWord)

define

public java.util.List<Definition> define(java.lang.String word,
                                         Database database)

match

public java.util.List<DatabaseWord> match(java.lang.String word)
Match word in all available databases using default strategy

Parameters:
word - word to match
Returns:
List of database words matched

match

public java.util.List<DatabaseWord> match(java.lang.String word,
                                          java.lang.String database,
                                          java.lang.String strategy)
Match word in given database using given strategy

Parameters:
word - word to match
database - database to search matches
strategy - strategy to use for search
Returns:
List of database words matched

match

public java.util.List<DatabaseWord> match(java.lang.String word,
                                          Database database,
                                          Strategy strategy)

match

public java.util.List<DatabaseWord> match(java.lang.String word,
                                          Database database)

quit

public java.lang.String quit()

isOptionMime

public boolean isOptionMime()

setOptionMime

public void setOptionMime()

getBanner

public Banner getBanner()