net.directj.csf
Class ClientFactory

java.lang.Object
  |
  +--net.directj.csf.ClientFactory
Direct Known Subclasses:
ClientFactoryImpl

public abstract class ClientFactory
extends java.lang.Object

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

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

Field Summary
private static ClientFactory instance
          the factory single instance.
 
Constructor Summary
protected ClientFactory()
          Forbids direct instanciation.
 
Method Summary
abstract  Client createClient(int _port, java.net.InetAddress _address)
          Creates a new client.
static ClientFactory getDefault()
          Returs the default factory.
abstract  java.lang.String[] getSupportedType()
          Returns the list of client type supported by this factory.
abstract  java.lang.String[] getSupportedTypeDescription()
          Returns the description of the different supported type.
abstract  void setClientType(java.lang.String _type)
          Changes the type of the client 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 ClientFactory instance
the factory single instance.

Constructor Detail

ClientFactory

protected ClientFactory()
Forbids direct instanciation.

Method Detail

getSupportedType

public abstract java.lang.String[] getSupportedType()
Returns the list of client 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 client 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 client type.
See Also:
The client type method.

setClientType

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

Parameters:
_type - The client's type.
Throws:
java.lang.IllegalArgumentException - If the specified type is not a valid client's type.
See Also:
The method to check the valid type.

getDefault

public static ClientFactory getDefault()
Returs the default factory.

Returns:
ClientFactory - The default ClientFactory.

createClient

public abstract Client createClient(int _port,
                                    java.net.InetAddress _address)
                             throws java.lang.IllegalArgumentException
Creates a new client.

Parameters:
_port - The server's port, where the client will bind to.
_address - The server's address, where the client will bind to.
Returns:
Client - A new client.
Throws:
java.lang.IllegalArgumentException - If a specified parameters is not valid.


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