org.abstracthorizon.danube.service.server
Class ServerService

java.lang.Object
  extended by org.abstracthorizon.danube.service.Service
      extended by org.abstracthorizon.danube.service.server.ServerService
All Implemented Interfaces:
Runnable
Direct Known Subclasses:
MultiThreadServerService

public abstract class ServerService
extends Service

This abstract cass introduces port for potential socket to listen to and connection handler to be invoked with created connection.

Author:
Daniel Sendula

Field Summary
protected  ConnectionHandler connectionHandler
          Connection handler new connection to be handed to
protected  InetSocketAddress socketAddress
          Socket address
 
Fields inherited from class org.abstracthorizon.danube.service.Service
DESTROYED, INITIALIZED, listeners, logger, name, NOT_INITIALIZED, RUNNING, SERVICE_STATE_NAMES, STARTED, STOPPED, STOPPING, stopService
 
Constructor Summary
ServerService()
          Default constructor
 
Method Summary
 String getAddress()
           
 ConnectionHandler getConnectionHandler()
          Returns connection handler connections are handed to.
 int getPort()
          Returns the port service is expecting connections on
 InetSocketAddress getSocketAddress()
           
 void setAddress(String address)
           
 void setConnectionHandler(ConnectionHandler connectionHandler)
          Sets connection handler
 void setPort(int port)
          Sets the port.
 void setSocketAddress(InetSocketAddress socketAddress)
           
 
Methods inherited from class org.abstracthorizon.danube.service.Service
addListener, changeState, create, destroy, getName, getState, getStateName, removeListener, setName, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface java.lang.Runnable
run
 

Field Detail

socketAddress

protected InetSocketAddress socketAddress
Socket address


connectionHandler

protected ConnectionHandler connectionHandler
Connection handler new connection to be handed to

Constructor Detail

ServerService

public ServerService()
Default constructor

Method Detail

getPort

public int getPort()
Returns the port service is expecting connections on

Returns:
the port

setPort

public void setPort(int port)
Sets the port. It has to be set before Service.create() method is called.

Parameters:
port - the port

setAddress

public void setAddress(String address)

getAddress

public String getAddress()

setSocketAddress

public void setSocketAddress(InetSocketAddress socketAddress)

getSocketAddress

public InetSocketAddress getSocketAddress()

getConnectionHandler

public ConnectionHandler getConnectionHandler()
Returns connection handler connections are handed to.

Returns:
connection handler

setConnectionHandler

public void setConnectionHandler(ConnectionHandler connectionHandler)
Sets connection handler

Parameters:
connectionHandler - connection handler


Copyright © 2005-2009 Abstract Horizon. All Rights Reserved.