- public class Server
- extends klentry
- implements java.awt.event.ItemListener
Represents a generic server. Each server listens on a different
TCP/IP port. All of the methods are overriden by specific server types.
There is no public constructor.
Warning: the key field is used to store a unique identifier
and should not be modified. You cannot at present subclass or extend Server.
flushLogs()
- Flushes the server's logs.
getName()
- Returns the server's name.
getPort()
- Returns the TCP/IP port on which the server listens for incoming
requests.
getSavedStatus()
- Returns the server's status as read from or will be saved to
the configuration file.
getStatus()
- Returns true if the server is running.
init()
- Performs any initialisation required after the configuration file
has been read.
itemStateChanged(ItemEvent)
- Responds to changes in the state of the server's check mark
in the GUI window servers pull-down menu.
kill()
- Kills the server.
periodic(long)
- Performs certain time-dependent tasks such as checking for
timed-out connections.
resetLogs(String)
- Resets the server's logs.
setName(String)
- Sets the server's name.
setPort(int)
- Sets the TCP/IP port on which the server listens for incoming
requests.
setSavedStatus(boolean)
- Sets the server's status as it will be saved to
the configuration file.
start()
- Starts the server.
stop()
- Stops the server.
updateSavedStatus()
- Updates the server's status as it will be saved to
the configuration file to reflect the server's current status.
itemStateChanged
public void itemStateChanged(java.awt.event.ItemEvent tevent)
Responds to changes in the state of the server's check mark
in the GUI window servers pull-down menu. It has to be public because of the
ItemListener interface. Do not call this method.
kill
public void kill()
Kills the server.
Warning: do not invoke this method if the server is a member of a list.
- Overrides:
- kill in class klentry
init
public void init()
Performs any initialisation required after the configuration file
has been read.
start
public void start()
Starts the server.
stop
public void stop()
Stops the server.
getStatus
public boolean getStatus()
Returns true if the server is running.
getSavedStatus
public boolean getSavedStatus()
Returns the server's status as read from or will be saved to
the configuration file.
setSavedStatus
public void setSavedStatus(boolean newStatus)
Sets the server's status as it will be saved to
the configuration file.
updateSavedStatus
public void updateSavedStatus()
Updates the server's status as it will be saved to
the configuration file to reflect the server's current status.
getPort
public int getPort()
Returns the TCP/IP port on which the server listens for incoming
requests.
setPort
public void setPort(int thePort)
Sets the TCP/IP port on which the server listens for incoming
requests. If the server is running it is first shut down and
then restarted.
getName
public java.lang.String getName()
Returns the server's name.
setName
public void setName(java.lang.String newName)
Sets the server's name.
periodic
public void periodic(long currentTime)
Performs certain time-dependent tasks such as checking for
timed-out connections.
Called periodically by the timer thread.
- Parameters:
currentTime
- the current time as returned by System.currentTimeMillis()
flushLogs
public void flushLogs()
Flushes the server's logs.
resetLogs
public void resetLogs(java.lang.String theExtension)
Resets the server's logs.