nan.model
Class ServerSettings

java.lang.Object
  extended bynan.model.ServerSettings
All Implemented Interfaces:
Transposer, XMLSerializable

public class ServerSettings
extends java.lang.Object
implements XMLSerializable, Transposer

The settings used by the News Server.

Version:
1.8, 1/4/04
Author:
John David Ratliff

Field Summary
static int DEFAULT_LOCAL_PORT
          The default local port for SSH tunnels.
static int DEFAULT_NEWS_PORT
          The default news port.
static java.lang.String DEFAULT_NEWS_SERVER
          The default news server hostname.
static int DEFAULT_SSH_PORT
          The default SSH port.
static java.lang.String XML_DIRECTORY
          XML tag for the remote save directory property.
static java.lang.String XML_LOCAL_PORT
          XML tag for ssh local port property.
static java.lang.String XML_NEWS_PORT
          XML tag for news port property.
static java.lang.String XML_NEWS_SERVER
          XML tag for news server property.
static java.lang.String XML_SSH_PORT
          XML tag for ssh server port property.
static java.lang.String XML_SSH_SERVER
          XML tag for ssh server hostname property.
static java.lang.String XML_SSH_USERNAME
          XML tag for ssh username property.
static java.lang.String XML_TAG
          XML tag for serialization.
static java.lang.String XML_USE_REMOTE_SAVE
          XML tag for the remote save property.
static java.lang.String XML_USE_SSH
          XML tag for SSH property.
static java.lang.String XML_USE_TUNNEL
          XML tag for the ssh tunnel property.
 
Constructor Summary
ServerSettings()
          Creates a new ServerSettings object.
 
Method Summary
 boolean equals(java.lang.Object object)
          Tests if this ServerSettings is logically equivalent to another ServerSettings.
 java.lang.String getDirectory()
          Gets the directory for remote save.
 int getLocalPort()
          Gets the local port used for the SSH tunnel.
 int getNewsPort()
          Gets the news server port.
 java.lang.String getNewsServer()
          Gets the news server hostname.
 java.lang.String getPassword()
          Gets the SSH password.
 int getSSHPort()
          Gets the SSH port.
 java.lang.String getSSHServer()
          Gets the SSH server hostname.
 java.lang.String getUsername()
          Gets the username for the SSH account.
 void setDirectory(java.lang.String directory)
          Sets the directory for remote save.
 void setLocalPort(int port)
          Sets the local port used for the SSH tunnel.
 void setNewsPort(int port)
          Sets the news server port.
 void setNewsServer(java.lang.String newsServer)
          Sets the new server hostname.
 void setPassword(java.lang.String password)
          Sets the password for the SSH account.
 void setSSHPort(int port)
          Sets the SSH server port.
 void setSSHServer(java.lang.String sshServer)
          Sets the SSH server hostname.
 void setUsername(java.lang.String username)
          Sets the SSH username.
 void setUseSSH(boolean useSSH)
          Sets if SSH is being used.
 java.lang.String toString()
          Gets a String representation of the ServerSettings.
 org.dom4j.Document toXML()
          Converts this ServerSettings into an XML Document.
 void transpose(java.lang.Object object)
          Transposes (copies over) the values of another object of the same type onto this one.
 boolean useRemoteSave()
          Whether remote save is being used or not.
 boolean useSSH()
          If SSH is being used.
 boolean useTunnel()
          Whether an SSH tunnel is being used or not.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

XML_TAG

public static final java.lang.String XML_TAG
XML tag for serialization.

See Also:
Constant Field Values

XML_NEWS_SERVER

public static final java.lang.String XML_NEWS_SERVER
XML tag for news server property.

See Also:
Constant Field Values

XML_NEWS_PORT

public static final java.lang.String XML_NEWS_PORT
XML tag for news port property.

See Also:
Constant Field Values

XML_USE_SSH

public static final java.lang.String XML_USE_SSH
XML tag for SSH property.

See Also:
Constant Field Values

XML_SSH_SERVER

public static final java.lang.String XML_SSH_SERVER
XML tag for ssh server hostname property.

See Also:
Constant Field Values

XML_SSH_PORT

public static final java.lang.String XML_SSH_PORT
XML tag for ssh server port property.

See Also:
Constant Field Values

XML_SSH_USERNAME

public static final java.lang.String XML_SSH_USERNAME
XML tag for ssh username property.

See Also:
Constant Field Values

XML_USE_TUNNEL

public static final java.lang.String XML_USE_TUNNEL
XML tag for the ssh tunnel property.

See Also:
Constant Field Values

XML_LOCAL_PORT

public static final java.lang.String XML_LOCAL_PORT
XML tag for ssh local port property.

See Also:
Constant Field Values

XML_USE_REMOTE_SAVE

public static final java.lang.String XML_USE_REMOTE_SAVE
XML tag for the remote save property.

See Also:
Constant Field Values

XML_DIRECTORY

public static final java.lang.String XML_DIRECTORY
XML tag for the remote save directory property.

See Also:
Constant Field Values

DEFAULT_NEWS_SERVER

public static final java.lang.String DEFAULT_NEWS_SERVER
The default news server hostname.

See Also:
Constant Field Values

DEFAULT_NEWS_PORT

public static final int DEFAULT_NEWS_PORT
The default news port.

See Also:
Constant Field Values

DEFAULT_SSH_PORT

public static final int DEFAULT_SSH_PORT
The default SSH port.

See Also:
Constant Field Values

DEFAULT_LOCAL_PORT

public static final int DEFAULT_LOCAL_PORT
The default local port for SSH tunnels.

See Also:
Constant Field Values
Constructor Detail

ServerSettings

public ServerSettings()
Creates a new ServerSettings object.

Method Detail

toXML

public org.dom4j.Document toXML()
Converts this ServerSettings into an XML Document.

Specified by:
toXML in interface XMLSerializable
Returns:
The XML Document.

getNewsServer

public java.lang.String getNewsServer()
Gets the news server hostname.

Returns:
The hostname.

setNewsServer

public void setNewsServer(java.lang.String newsServer)
Sets the new server hostname.

Parameters:
newsServer - The hostname.

getNewsPort

public int getNewsPort()
Gets the news server port.

Returns:
The port.

setNewsPort

public void setNewsPort(int port)
                 throws InvalidPortException
Sets the news server port.

Parameters:
port - The port.
Throws:
InvalidPortException - if the port is out of range (1 < port < 65535).

useSSH

public boolean useSSH()
If SSH is being used.

Returns:
true if using SSH; false otherwise.

setUseSSH

public void setUseSSH(boolean useSSH)
Sets if SSH is being used.

Parameters:
useSSH - true to use SSH; false otherwise.

getSSHServer

public java.lang.String getSSHServer()
Gets the SSH server hostname.

Returns:
The hostname.

setSSHServer

public void setSSHServer(java.lang.String sshServer)
Sets the SSH server hostname.

Parameters:
sshServer - The hostname.

getSSHPort

public int getSSHPort()
Gets the SSH port.

Returns:
The port.

setSSHPort

public void setSSHPort(int port)
                throws InvalidPortException
Sets the SSH server port.

Parameters:
port - The port.
Throws:
InvalidPortException - if the port is out of range (1 < port < 65535).

getUsername

public java.lang.String getUsername()
Gets the username for the SSH account.

Returns:
The SSH username.

setUsername

public void setUsername(java.lang.String username)
Sets the SSH username.

Parameters:
username - The username.

getPassword

public java.lang.String getPassword()
Gets the SSH password.

Returns:
The password.

setPassword

public void setPassword(java.lang.String password)
Sets the password for the SSH account.

Parameters:
password - The SSH password.

useTunnel

public boolean useTunnel()
Whether an SSH tunnel is being used or not.

Returns:
true for SSH tunnel use; false otherwise.

getLocalPort

public int getLocalPort()
Gets the local port used for the SSH tunnel.

Returns:
The port.

setLocalPort

public void setLocalPort(int port)
                  throws InvalidPortException
Sets the local port used for the SSH tunnel.

Parameters:
port - The port.
Throws:
InvalidPortException - if the port is out of range (1024 < port < 65535).

useRemoteSave

public boolean useRemoteSave()
Whether remote save is being used or not.

Returns:
true if using remote save; false otherwise.

getDirectory

public java.lang.String getDirectory()
Gets the directory for remote save.

Returns:
The remote save directory.

setDirectory

public void setDirectory(java.lang.String directory)
Sets the directory for remote save.

Parameters:
directory - The directory.

equals

public boolean equals(java.lang.Object object)
Tests if this ServerSettings is logically equivalent to another ServerSettings.

Parameters:
object - The object to test for equality with.
Returns:
true if the objects are equal; false otherwise.

transpose

public void transpose(java.lang.Object object)
Transposes (copies over) the values of another object of the same type onto this one. If the object is not the same type as the invoked object, it will be ignored.

Specified by:
transpose in interface Transposer
Parameters:
object - The object to transpose over this one.

toString

public java.lang.String toString()
Gets a String representation of the ServerSettings.

Returns:
A String representation.