de.fhg.igd.atlas.core
Class LSServerServiceImpl

java.lang.Object
  extended byde.fhg.igd.semoa.service.AbstractService
      extended byde.fhg.igd.atlas.core.LSServerServiceImpl
All Implemented Interfaces:
LSAdminService, LSServerService, Service

public class LSServerServiceImpl
extends AbstractService
implements LSServerService, LSAdminService

Provides the functionality of the Location Server Server (LSServer) which can store location entries of mobile agents in its internal storage database.

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

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
protected  boolean securityOptions_
          This flag is set, when it's possible to use registerEncrypted and registerEncoded, which need special cryptographic algorithms.
private static X509Certificate serverCertificate_
          The certificate of the server, used to decrypt LSP messages within registerEncrypted.
private static PrivateKey serverPrivateKey_
          The private key of the server, used to decrypt LSP messages within registerEncrypted.
protected  StorageDB storageDB_
          The internal database which is used to store the location entries of mobile objects.
protected  boolean verifyContactAddress_
          If this flag is set, the given contact address is verified, in a register, registerPlain, registerEncoded or registerEncrypted call.
 
Fields inherited from class de.fhg.igd.semoa.service.AbstractService
REV_POSTFIX, REV_PREFIX
 
Constructor Summary
LSServerServiceImpl(StorageDB storageDB, boolean verifyContactAddress)
          Creates an instance of this class with the given parameters.
 
Method Summary
 TrustedListener addListener(Listener listener)
          Adds a Listener.
 String author()
          Returns the String with the author's name.
protected  boolean checkURL(URL url)
          Checks if the given url describes an existing host.
 String[] dependencies()
          Returns the dependencies of this service as described in Service.
 boolean getEventFlag()
          Returns the current state of the event flag of the server's internal database.
 long getTimeout()
          Returns the timeout of entries in the server database.
 String info()
          Returns the String with the service's short description.
 LSPReply list(LSPList request)
          Handles the given list request (see LSPList).
 LSPReply lookup(LSPLookup request)
          Handles the given lookup request (see LSPLookup).
 LSPReply proxyInvalidate(LSPProxyInvalidate request)
          Handles the given proxy invalidate request (see LSPProxyInvalidate).
 LSPReply refresh(LSPRefresh request)
          Handles the given refresh request (see LSPRefresh).
protected  int register(LSPRegister request)
          Handles the given register request (see LSPRegister).
 LSPReply registerEncoded(LSPRegisterEncoded request)
          Handles the given register encoded request (see LSPRegisterEncoded).
 LSPReply registerEncrypted(LSPRegisterEncrypted request)
          Handles the given register encrypted request (see LSPRegisterEncrypted).
 LSPReply registerPlain(LSPRegisterPlain request)
          Handles the given register plain request (see LSPRegisterPlain).
 String revision()
          Returns the revision number of this class as a string.
 boolean securityAvailable()
          Returns the availability of encryption and encoding what needs special cryptographic algorithms.
 void setEventFlag(boolean flag)
          Sets the event flag to enable respectively disable the generation of events within the server's internal database.
 void setTimeout(long timeout)
          Sets the timeout of entries in the server database.
 String 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.


serverCertificate_

private static X509Certificate serverCertificate_
The certificate of the server, used to decrypt LSP messages within registerEncrypted.


serverPrivateKey_

private static PrivateKey serverPrivateKey_
The private key of the server, used to decrypt LSP messages within registerEncrypted.


securityOptions_

protected boolean securityOptions_
This flag is set, when it's possible to use registerEncrypted and registerEncoded, which need special cryptographic algorithms.


verifyContactAddress_

protected boolean verifyContactAddress_
If this flag is set, the given contact address is verified, in a register, registerPlain, registerEncoded or registerEncrypted call. Working in an intranet with NAT and an external location server, it is usefull to deactivate this option.


storageDB_

protected StorageDB storageDB_
The internal database which is used to store the location entries of mobile objects.

Constructor Detail

LSServerServiceImpl

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

Parameters:
storageDB - The storage database used to store the location entries of mobile objects.
verifyContactAddress - If this flag is set, the contact address given in a call of one of the four register methods is verified (see verifyContactAddress_).
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
Specified by:
author in class AbstractService
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.

toString

public String toString()
Overrides:
toString in class AbstractService
Returns:
The string representation of this instance.

checkURL

protected boolean checkURL(URL url)
Checks if the given url describes an existing host. This is done by a sequence of lookup and reverse lookup on the URL's hostname.

Parameters:
url - The url to examine.
Returns:
true if url is existent; false otherwise.

getTimeout

public long getTimeout()
Returns the timeout of entries in the server database.

Specified by:
getTimeout in interface LSAdminService
Returns:
The timeout of entries in the server database or 0 if the timeout mechanism is deactivated.

setTimeout

public void setTimeout(long timeout)
Sets the timeout of entries in the server database. A timeout of 0 deactivates the timeout mechanism.

Specified by:
setTimeout in interface LSAdminService
Parameters:
timeout - The timeout in milli seconds.

securityAvailable

public boolean securityAvailable()
Returns the availability of encryption and encoding what needs special cryptographic algorithms.

Specified by:
securityAvailable in interface LSAdminService
Returns:
true if secure register requests can be handled; false otherwise.

addListener

public TrustedListener addListener(Listener listener)
Adds a Listener. The Listener will receive events of the type StorageDBEvent. Iff the event flag has been set, those events are triggered by the internal database of the server to incrementally describe its state. Listener instances passed to this method shall be wrapped in a TrustedListener which is then returned.

Specified by:
addListener in interface LSAdminService
Parameters:
listener - The Listener to be registered.
Returns:
The TrustedListener that wraps around the given Listener.
Throws:
NullPointerException - if listener is null.

setEventFlag

public void setEventFlag(boolean flag)
Sets the event flag to enable respectively disable the generation of events within the server's internal database.

Specified by:
setEventFlag in interface LSAdminService
Parameters:
flag - The event flag to be set.

getEventFlag

public boolean getEventFlag()
Returns the current state of the event flag of the server's internal database.

Specified by:
getEventFlag in interface LSAdminService
Returns:
The event flag.

register

protected int register(LSPRegister request)
Handles the given register request (see LSPRegister). Depending on the given new and current cookie, it is distinguished if the request is an init, update or delete register request:

Following reply states are possible (see LSPReply):

Parameters:
request - The register request.
Returns:
The reply to the given request.

lookup

public LSPReply lookup(LSPLookup request)
Handles the given lookup request (see LSPLookup). Following reply states and bodies are possible (see LSPReply):

Specified by:
lookup in interface LSServerService
Parameters:
request - The lookup request.
Returns:
The reply to the given request.

registerPlain

public LSPReply registerPlain(LSPRegisterPlain request)
Handles the given register plain request (see LSPRegisterPlain). Following reply states are possible (see LSPReply):

Specified by:
registerPlain in interface LSServerService
Parameters:
request - The register plain request.
Returns:
The reply to the given request.

registerEncrypted

public LSPReply registerEncrypted(LSPRegisterEncrypted request)
Handles the given register encrypted request (see LSPRegisterEncrypted). Following reply states are possible (see LSPReply):

Specified by:
registerEncrypted in interface LSServerService
Parameters:
request - The register encrypted request.
Returns:
The reply to the given request.

registerEncoded

public LSPReply registerEncoded(LSPRegisterEncoded request)
Handles the given register encoded request (see LSPRegisterEncoded). Following reply states are possible (see LSPReply):

Specified by:
registerEncoded in interface LSServerService
Parameters:
request - The register encoded request.
Returns:
The reply to the given request.

refresh

public LSPReply refresh(LSPRefresh request)
Handles the given refresh request (see LSPRefresh). Following reply states and bodies are possible (see LSPReply):

Specified by:
refresh in interface LSServerService
Parameters:
request - The refresh request.
Returns:
The reply to the given request.

list

public LSPReply list(LSPList request)
Handles the given list request (see LSPList). Following reply states and bodies are possible (see LSPReply):

Specified by:
list in interface LSAdminService
Parameters:
request - The list request.
Returns:
The reply to the given request.

proxyInvalidate

public LSPReply proxyInvalidate(LSPProxyInvalidate request)
Handles the given proxy invalidate request (see LSPProxyInvalidate). Following reply states are possible (see LSPReply):

Parameters:
request - The proxy invalidate request.
Returns:
The reply to the given request.


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.