de.fhg.igd.atlas.core
Class LSServer

java.lang.Object
  extended byde.fhg.igd.semoa.service.AbstractService
      extended byde.fhg.igd.semoa.net.AbstractServer
          extended byde.fhg.igd.atlas.core.LSServer
All Implemented Interfaces:
Runnable, Server, Service

public class LSServer
extends AbstractServer

Provides a server of the location service which stores implicit name to contact address mappings. This Location Service Server (LSServer) is used by a Location Service Client (LSClient) to lookup or register the location of mobile objects.

Following request are accepted as LSP messages from the network:

A LSServer is responsible for all implicit names with a certain prefix.

Version:
"$Id: LSServer.java 1913 2007-08-08 02:41:53Z jpeters $"
Author:
Jan Peters
See Also:
LSServerService, ServerInfo

Nested Class Summary
 
Nested classes inherited from class de.fhg.igd.semoa.net.AbstractServer
AbstractServer.Job
 
Field Summary
private static String[] DEPEND_
          The dependencies to other objects in the global Environment.
private static Logger log_
          The Logger instance for this class
static int MAX_CAPACITY
          The maximum capacity of this server.
static String OPT_DESCR
          The ArgsParser option descriptor for the case that this class is initiated from command line.
static String PROTOCOL
          The string identifier of the protocol spoken by this server.
protected  LSServerServiceImpl serverService_
          The reference to the LSServerService interface.
static long STORAGE_DB_TIMEOUT
          Timeout for entries of the internal storage database in milli seconds.
 
Fields inherited from class de.fhg.igd.semoa.net.AbstractServer
bad_, DEFAULT_CAPACITY, good_, thread_
 
Fields inherited from class de.fhg.igd.semoa.service.AbstractService
REV_POSTFIX, REV_PREFIX
 
Fields inherited from interface de.fhg.igd.semoa.net.Server
BOUND_TO_PORT, ERROR, RUNNING, SHUTDOWN, UNDEFINED
 
Constructor Summary
protected LSServer(StorageDB storageDB, boolean verifyContactAddress)
          Creates an instance of this class and initializes the LSServerService with the given parameters.
 
Method Summary
 String author()
          Returns the String with the author's name.
 String[] dependencies()
          Returns the dependencies of this service as described in Service.
protected  void handleConnection(Socket connection)
          Handles the given connection according to a simple request/response scheme.
protected  LSPReply handleRequest(LSPRequest request)
          Handles the given request and returns a corresponding reply.
 String info()
          Returns the String with the service's short description.
static void main(String[] argv)
          Initializes the LSServer from command line.
 String protocol()
           
 String revision()
          Returns the revision number of this class as a string.
 
Methods inherited from class de.fhg.igd.semoa.net.AbstractServer
bad, createJob, createServerSocket, exceptionInfo, getCapacity, getMaximumSize, getPort, getServerState, good, isEnabled, localURL, rebind, run, serverStateChanged, setCapacity, setEnabled, setMaximumSize, setPort, shutdown, signal, toString
 
Methods inherited from class de.fhg.igd.semoa.service.AbstractService
checkDependencies, docs, doPrivileged, doPrivileged, getACC, getEnvironment, majorVersion, minorVersion
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log_

private static Logger log_
The Logger instance for this class


DEPEND_

private static final String[] DEPEND_
The dependencies to other objects in the global Environment.


PROTOCOL

public static final String PROTOCOL
The string identifier of the protocol spoken by this server.

See Also:
Constant Field Values

MAX_CAPACITY

public static final int MAX_CAPACITY
The maximum capacity of this server.

See Also:
Constant Field Values

STORAGE_DB_TIMEOUT

public static long STORAGE_DB_TIMEOUT
Timeout for entries of the internal storage database in milli seconds.


OPT_DESCR

public static final String OPT_DESCR
The ArgsParser option descriptor for the case that this class is initiated from command line.

See Also:
Constant Field Values

serverService_

protected LSServerServiceImpl serverService_
The reference to the LSServerService interface.

Constructor Detail

LSServer

protected LSServer(StorageDB storageDB,
                   boolean verifyContactAddress)
Creates an instance of this class and initializes the LSServerService with the given parameters. If storageDB is null, the MemoryDB is used as default database for the server.

Parameters:
storageDB - The storage database to use as part of the LSServer.
verifyContactAddress - If this flag is set, contact addresses to register are verified first (see LSServerServiceImpl).
Method Detail

info

public String info()
Returns the String with the service's short description.

Specified by:
info in interface Service
Specified by:
info in class AbstractService
Returns:
The String with the service's short description.

author

public String author()
Returns the String with the author's name.

Specified by:
author in interface Service
Overrides:
author in class AbstractServer
Returns:
The String with the author's name.

revision

public String revision()
Returns the revision number of this class as a string.

Specified by:
revision in class AbstractService
Returns:
The revision number of this class as a string.

dependencies

public String[] dependencies()
Returns the dependencies of this service as described in Service.

Specified by:
dependencies in interface Service
Overrides:
dependencies in class AbstractService
Returns:
The array of dependencies.

protocol

public String protocol()
Specified by:
protocol in interface Server
Specified by:
protocol in class AbstractServer
Returns:
The string identifier of the protocol spoken by this server.

handleConnection

protected void handleConnection(Socket connection)
Handles the given connection according to a simple request/response scheme. This method is called if the server has accepted a new connection. In addition to the regular replies of corresponding requests, replies with the following states can be returned to sender in case of an error, which has been occured during request decoding:

Overrides:
handleConnection in class AbstractServer
Parameters:
connection - The socket connection that must be handled by this method.

handleRequest

protected LSPReply handleRequest(LSPRequest request)
Handles the given request and returns a corresponding reply. Following requests are allowed:

Parameters:
request - The request to be handled.
Returns:
The reply to the given request.

main

public static void main(String[] argv)
                 throws ArgsParserException,
                        ObjectExistsException
Initializes the LSServer from command line.

Parameters:
argv - The command line parameters.
Throws:
ArgsParserException
ObjectExistsException


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.