com.ibm.ulc.comm
Class Server

java.lang.Object
  |
  +--com.ibm.ulc.util.UlcObject
        |
        +--com.ibm.ulc.comm.Server

public class Server
extends UlcObject
implements java.lang.Runnable

The framework for a server. It dynamically creates a TransportServer (depending on the protocol specified in a URL) that listens for incoming connections. A UlcConnection is then created for each accepted connection. The Server framework is independent of the request format and the transport kind.

See Also:
UlcConnection, UlcTransportServer, Request, Serialized Form

Field Summary
protected static boolean DEBUG
           
protected static ISocketFactory fgSocketFactory
           
protected  java.lang.String fName
           
protected  int fPort
           
 
Constructor Summary
Server()
          Constructs a server.
Server(java.lang.String name)
          Constructs a server.
 
Method Summary
static void addConnectionController(IConnectionController controller)
          Method to register a connection controller object.
protected  void createConnection(java.net.Socket socket)
          Deprecated.  
 void createConnection(UlcTransport transport)
          Factory method for creating a connection from a given transport.
protected  java.net.ServerSocket createServerSocket(int port)
          Deprecated.  
 java.lang.String getName()
           
static java.lang.String getServerUrlFileName()
           
static ISocketFactory getSocketFactory()
          Retrieves the factory object for creating all sockets within ULC.
 java.lang.String getStartedString()
          return the string to indicate that this Server has started.
static void propagateConnectionCreated(IConnection connection)
          Helper method for connection control.
static void propagateConnectionEnded(IConnection connection, UlcTransportException ex)
          Helper method for connection control.
static void propagateConnectionStarted(IConnection connection, UlcTransportException ex)
          Helper method for connection control.
static void removeConnectionController(IConnectionController controller)
          Method to deregister a connection controller object.
 void run()
          Deprecated.  
protected static void setServerUrlFileName(java.lang.String name)
           
static void setSocketFactory(ISocketFactory factory)
          Sets the factory object for creating all sockets within ULC.
 int start(int port)
          Deprecated.  
 int start(java.lang.String urlString)
          Starts the server by creating a new thread for accepting connections on the address specified by the passed in URL.
 
Methods inherited from class com.ibm.ulc.util.UlcObject
trouble, trouble2, trouble2Err, troubleErr
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fPort

protected int fPort

fName

protected java.lang.String fName

fgSocketFactory

protected static ISocketFactory fgSocketFactory

DEBUG

protected static final boolean DEBUG
Constructor Detail

Server

public Server()
Constructs a server.

Server

public Server(java.lang.String name)
Constructs a server.
Method Detail

addConnectionController

public static void addConnectionController(IConnectionController controller)
Method to register a connection controller object.

createConnection

public void createConnection(UlcTransport transport)
Factory method for creating a connection from a given transport. Override to define the connection to be created.
Parameters:
transport - com.ibm.ulc.comm.UlcTransport

createConnection

protected void createConnection(java.net.Socket socket)
Deprecated.  
Factory method for creating a connection. Override to define the connection to be created.

createServerSocket

protected java.net.ServerSocket createServerSocket(int port)
                                            throws java.io.IOException
Deprecated.  

getName

public java.lang.String getName()

getServerUrlFileName

public static java.lang.String getServerUrlFileName()

getSocketFactory

public static ISocketFactory getSocketFactory()
Retrieves the factory object for creating all sockets within ULC. If a factory hasn't been explicitely set this method creates an instance of com.ibm.ulc.comm.DefaultSocketFactory.

getStartedString

public java.lang.String getStartedString()
return the string to indicate that this Server has started.

propagateConnectionCreated

public static void propagateConnectionCreated(IConnection connection)
Helper method for connection control. Calls all registered connection controllers' connectionCreated() method with the given connection argument.

propagateConnectionEnded

public static void propagateConnectionEnded(IConnection connection,
                                            UlcTransportException ex)
Helper method for connection control. Calls all registered connection controllers' connectionEnded() method with the given connection and exception arguments.

propagateConnectionStarted

public static void propagateConnectionStarted(IConnection connection,
                                              UlcTransportException ex)
Helper method for connection control. Calls all registered connection controllers' connectionStarted() method with the given connection and exception arguments.

removeConnectionController

public static void removeConnectionController(IConnectionController controller)
Method to deregister a connection controller object.

run

public void run()
Deprecated.  
Runs the server and starts accepting connections.
Specified by:
run in interface java.lang.Runnable

setServerUrlFileName

protected static void setServerUrlFileName(java.lang.String name)

setSocketFactory

public static void setSocketFactory(ISocketFactory factory)
Sets the factory object for creating all sockets within ULC. Call this method before calling method Server.start. If the factory is not explicitely set ULC will use an instance of com.ibm.ulc.comm.DefaultSocketFactory.

start

public int start(int port)
Deprecated.  
Starts the server on the given port by creating a new thread for accepting connections.

start

public int start(java.lang.String urlString)
Starts the server by creating a new thread for accepting connections on the address specified by the passed in URL.
Parameters:
urlString - java.lang.String