net.directj.csf.impl
Class ServerFactoryImpl

java.lang.Object
  |
  +--net.directj.csf.ServerFactory
        |
        +--net.directj.csf.impl.ServerFactoryImpl

public class ServerFactoryImpl
extends ServerFactory

This class is used to easely create servers. It is quite simple, but can manage a lot of server'type, like SSL or TLS server. To change the type of the created server, you may use the getSupportedType(), getSupportedTypeDescription() and setServerType() methods.

Version:
0.1.0
Author:
CARTAPANIS Alexandre <earendil@jprolog.net>

Field Summary
static java.lang.String JLOGGER
          The "jlogger" server type.
static java.lang.String JLOGGER_DESC
          The "standard" server type.
static java.lang.String STANDARD
          The "standard" server type.
static java.lang.String STANDARD_DESC
          The "standard" server type.
static java.lang.String[] SUPPORTED_TYPE
          The array of suppported server type.
static java.lang.String[] SUPPORTED_TYPE_DESC
          The array of suppported server type description.
private  java.lang.String type
          The current server type.
 
Fields inherited from class net.directj.csf.ServerFactory
 
Constructor Summary
ServerFactoryImpl()
           
 
Method Summary
 Server createServer()
          Creates a new server.
 Server createServer(java.lang.String _name, int _port)
          Creates a new server.
 Server createServer(java.lang.String _name, int _port, int _maxClient)
          Creates a new server.
 Server createServer(java.lang.String _name, int _port, int _maxClient, java.net.InetAddress _address)
          Creates a new server.
 java.lang.String[] getSupportedType()
          Returns the list of server type supported by this factory.
 java.lang.String[] getSupportedTypeDescription()
          Returns the description of the different supported type.
 void setServerType(java.lang.String _type)
          Changes the type of the server that will be created with the createServer method.
 
Methods inherited from class net.directj.csf.ServerFactory
getDefault
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

STANDARD

public static final java.lang.String STANDARD
The "standard" server type.

See Also:
Constant Field Values

STANDARD_DESC

public static final java.lang.String STANDARD_DESC
The "standard" server type.

See Also:
Constant Field Values

JLOGGER

public static final java.lang.String JLOGGER
The "jlogger" server type.

See Also:
Constant Field Values

JLOGGER_DESC

public static final java.lang.String JLOGGER_DESC
The "standard" server type.

See Also:
Constant Field Values

SUPPORTED_TYPE

public static final java.lang.String[] SUPPORTED_TYPE
The array of suppported server type.


SUPPORTED_TYPE_DESC

public static final java.lang.String[] SUPPORTED_TYPE_DESC
The array of suppported server type description.


type

private java.lang.String type
The current server type.

Constructor Detail

ServerFactoryImpl

public ServerFactoryImpl()
Method Detail

getSupportedType

public java.lang.String[] getSupportedType()
Returns the list of server type supported by this factory. You can get a description of each type by using the getSupportedTypeDesciption() method.

Specified by:
getSupportedType in class ServerFactory
Returns:
String[] - An array of string that indicate the list of supported server type.
See Also:
The description method.

getSupportedTypeDescription

public java.lang.String[] getSupportedTypeDescription()
Returns the description of the different supported type. The ith String of the returned array is the description of the ith String returned by the getSupportedTypeDescription.

Specified by:
getSupportedTypeDescription in class ServerFactory
Returns:
String[] - An array of string that describe the supported server type.
See Also:
The server type method.

setServerType

public void setServerType(java.lang.String _type)
                   throws java.lang.IllegalArgumentException
Changes the type of the server that will be created with the createServer method. You can check the valid server type by using the getSupportedType method.

Specified by:
setServerType in class ServerFactory
Parameters:
_type - The server's type.
Throws:
java.lang.IllegalArgumentException - If the specified type is not a valid server's type.
See Also:
The method to check the valid type.

createServer

public Server createServer()
Creates a new server.

Specified by:
createServer in class ServerFactory
Returns:
Server - A new client server.

createServer

public Server createServer(java.lang.String _name,
                           int _port)
                    throws java.lang.IllegalArgumentException
Creates a new server.

Specified by:
createServer in class ServerFactory
Parameters:
_name - The server's name.
_port - The server's port.
Returns:
Server - A new server.
Throws:
java.lang.IllegalArgumentException - If a specified paramters is not valid.

createServer

public Server createServer(java.lang.String _name,
                           int _port,
                           int _maxClient)
                    throws java.lang.IllegalArgumentException
Creates a new server.

Specified by:
createServer in class ServerFactory
Parameters:
_name - The server's name.
_port - The server's port.
_maxClient - The maximum amount of client the server can handle.
Returns:
Server - A new server.
Throws:
java.lang.IllegalArgumentException - If a specified paramters is not valid.

createServer

public Server createServer(java.lang.String _name,
                           int _port,
                           int _maxClient,
                           java.net.InetAddress _address)
                    throws java.lang.IllegalArgumentException
Creates a new server.

Specified by:
createServer in class ServerFactory
Parameters:
_name - The server's name.
_port - The server's port.
_maxClient - The maximum amount of client the server can handle.
_address - The server's address.
Returns:
Server - A new server.
Throws:
java.lang.IllegalArgumentException - If a specified paramters is not valid.


Copyright 2002 CARTAPANIS Alexandre
This page was last updated on May 10 2003