|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--ar.com.ktulu.dict.Server
DICT Server as defined in RFC 2229. It parses initialization arguments
supplied by the user and creates an instance of ServerThread
for each connection. It also manages the list of Databases and Strategies
known.
ServerThread,
Strategy,
Database| Field Summary | |
(package private) java.util.Vector |
connections
|
(package private) java.util.LinkedList |
dbs
Dictionaries. |
(package private) int |
delay
Maximum number of seconds a connection can be idle. |
(package private) java.util.Hashtable |
hash_dbs
|
(package private) int |
maxConns
Maximun number of simultaneously open connections. |
(package private) int |
queue
Queue length for incoming connections. |
(package private) long |
startup
|
(package private) java.util.Hashtable |
strategies
|
| Constructor Summary | |
Server()
Uses default values for arguments. |
|
Server(java.lang.String[] args)
|
|
| Method Summary | |
protected boolean |
addConnection(java.net.Socket s)
Creates a new ServerThread and adds it to the list of open connections |
java.util.Iterator |
databases()
|
int |
databaseSize()
|
protected java.lang.String |
ensureLength(java.lang.String s,
int l)
Returns a new string with minimum length l. |
protected java.lang.String |
getConfBaseDir()
Returns the default base dir for the configuration files. |
Database |
getDatabase(java.lang.String name)
|
protected java.util.Properties |
getDefaultConfig()
Returns default values for configuration parameters. |
Strategy |
getStrategy(java.lang.String name)
|
protected void |
initStrategies(java.lang.String conf)
|
boolean |
isLogging()
|
void |
loginfo(java.lang.String s)
|
static void |
main(java.lang.String[] args)
|
protected java.util.Properties |
processCL(java.lang.String[] args)
Parses command line arguments |
protected boolean |
propIsNumber(java.util.Properties props,
java.lang.String name)
|
protected void |
readConfig(java.lang.String conf)
Parses dictd.conf and initializes the databases defined in it. |
protected org.w3c.dom.Document |
readDOMDocument(java.lang.String fname)
|
void |
removeConnection(ServerThread st)
Used by ServerThread when the connection is closed to notify the server that this connection is no longer open. |
void |
run()
|
java.util.Iterator |
strategies()
|
int |
strategiesSize()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
java.util.LinkedList dbs
java.util.Hashtable hash_dbs
java.util.Hashtable strategies
int maxConns
java.util.Vector connections
int queue
int delay
long startup
| Constructor Detail |
public Server()
throws java.io.IOException,
java.lang.ClassNotFoundException,
java.lang.IllegalAccessException,
java.lang.InstantiationException
public Server(java.lang.String[] args)
throws java.io.IOException,
java.lang.ClassNotFoundException,
java.lang.IllegalAccessException,
java.lang.InstantiationException
| Method Detail |
public boolean isLogging()
public void loginfo(java.lang.String s)
protected java.lang.String getConfBaseDir()
protected java.lang.String ensureLength(java.lang.String s,
int l)
protected java.util.Properties processCL(java.lang.String[] args)
protected boolean propIsNumber(java.util.Properties props,
java.lang.String name)
protected java.util.Properties getDefaultConfig()
protected void initStrategies(java.lang.String conf)
throws java.io.IOException,
java.lang.ClassNotFoundException,
java.lang.IllegalAccessException,
java.lang.InstantiationException
java.io.IOException
java.lang.ClassNotFoundException
java.lang.IllegalAccessException
java.lang.InstantiationException
protected org.w3c.dom.Document readDOMDocument(java.lang.String fname)
throws java.io.IOException,
org.xml.sax.SAXException,
javax.xml.parsers.ParserConfigurationException
java.io.IOException
org.xml.sax.SAXException
javax.xml.parsers.ParserConfigurationException
protected void readConfig(java.lang.String conf)
throws java.io.IOException
java.io.IOExceptionpublic Database getDatabase(java.lang.String name)
public int databaseSize()
public java.util.Iterator databases()
public Strategy getStrategy(java.lang.String name)
public int strategiesSize()
public java.util.Iterator strategies()
protected boolean addConnection(java.net.Socket s)
ServerThreadpublic void removeConnection(ServerThread st)
ServerThreadpublic void run()
public static void main(java.lang.String[] args)
throws java.util.NoSuchElementException,
java.lang.IllegalAccessException,
java.lang.InstantiationException
java.util.NoSuchElementException
java.lang.IllegalAccessException
java.lang.InstantiationException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||