net.directj.csf
Class ServerFactory

java.lang.Object
  |
  +--net.directj.csf.ServerFactory
Direct Known Subclasses:
ServerFactoryImpl

public abstract class ServerFactory
extends java.lang.Object

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
private static ServerFactory instance
          the factory single instance.
 
Constructor Summary
protected ServerFactory()
          Forbids direct instanciation.
 
Method Summary
abstract  Server createServer()
          Creates a new server.
abstract  Server createServer(java.lang.String _name, int _port)
          Creates a new server.
abstract  Server createServer(java.lang.String _name, int _port, int _maxClient)
          Creates a new server.
abstract  Server createServer(java.lang.String _name, int _port, int _maxClient, java.net.InetAddress _address)
          Creates a new server.
static ServerFactory getDefault()
          Returs the default factory.
abstract  java.lang.String[] getSupportedType()
          Returns the list of server type supported by this factory.
abstract  java.lang.String[] getSupportedTypeDescription()
          Returns the description of the different supported type.
abstract  void setServerType(java.lang.String _type)
          Changes the type of the server that will be created with the createServer method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

instance

private static ServerFactory instance
the factory single instance.

Constructor Detail

ServerFactory

protected ServerFactory()
Forbids direct instanciation.

Method Detail

getSupportedType

public abstract 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.

Returns:
String[] - An array of string that indicate the list of supported server type.
See Also:
The description method.

getSupportedTypeDescription

public abstract 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.

Returns:
String[] - An array of string that describe the supported server type.
See Also:
The server type method.

setServerType

public abstract 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.

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.

getDefault

public static ServerFactory getDefault()
Returs the default factory.

Returns:
ServerFactory - The default ServerFactory.

createServer

public abstract Server createServer()
Creates a new server.

Returns:
ClientHandler - A new client server.

createServer

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

Parameters:
_name - The server's name.
_port - The server's port.
Returns:
Server - A new server.
Throws:
java.lang.IllegalArgumentException - If a specified parameters is not valid.

createServer

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

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 parameters is not valid.

createServer

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

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 parameters is not valid.


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