de.fhg.igd.atlas.core
Class LSProxyServiceImpl

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

public class LSProxyServiceImpl
extends AbstractService
implements LSProxyService, LSAdminService

Provides the functionality of the Location Server Proxy (LSProxy) which can be seen as gateway between Location Service Client (LSClient) and Location Service Server (LSServer).

Version:
"$Id: LSProxyServiceImpl.java 1913 2007-08-08 02:41:53Z jpeters $"
Author:
Jan Peters
See Also:
LSProxyService, LSProxy

Field Summary
protected  LSClientServiceImpl clientService_
          The reference to the LSClientService interface.
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 security algorithms.
protected  LSServerServiceImpl serverService_
          The reference to the LSServerService interface.
 
Fields inherited from class de.fhg.igd.semoa.service.AbstractService
REV_POSTFIX, REV_PREFIX
 
Constructor Summary
LSProxyServiceImpl(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.
 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.
protected  boolean initLSInfrastructure(String configFile)
          Initialize the location service infrastructure of distributed LS-Servers by parsing the given configuration file.
protected  boolean initLSInfrastructure(URL configLdapServer)
          Initialize the location service infrastructure of distributed LS-Servers by requesting the configuration from a LDAP server with the given URL.
 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).
 LSPReply registerPlain(LSPRegisterPlain request)
          Handles the given register plain request (see LSPRegister).
 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 proxy's internal database.
 void setTimeout(long timeout)
          Sets the timeout of entries in the proxy 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.


serverService_

protected LSServerServiceImpl serverService_
The reference to the LSServerService interface.


clientService_

protected LSClientServiceImpl clientService_
The reference to the LSClientService interface.


securityOptions_

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

Constructor Detail

LSProxyServiceImpl

public LSProxyServiceImpl(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 registerPlain is verified (see LSServerServiceImpl.
Method Detail

initLSInfrastructure

protected boolean initLSInfrastructure(String configFile)
Initialize the location service infrastructure of distributed LS-Servers by parsing the given configuration file. If configFile is null, no server will be initialized.

Parameters:
configFile - The name the configuration file containing the configuration of the location service infrastructure.
Returns:
true, if the given configuration file has been parsed successfully, false otherwise.

initLSInfrastructure

protected boolean initLSInfrastructure(URL configLdapServer)
Initialize the location service infrastructure of distributed LS-Servers by requesting the configuration from a LDAP server with the given URL. If configLdapServer is null, no server will be initialized.

Parameters:
configLdapServer - The URL of the ldap server maintaining the configuration of the location service infrastructure.
Returns:
true, if the configuration has been received successfully from the given LDAP server, false otherwise.

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.

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 proxy 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 proy 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 proxy'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.

lookup

public LSPReply lookup(LSPLookup request)
Handles the given lookup request (see LSPLookup).

  lookup in local database
  |
  +--globalLookup
 
The lookup request is processed in the local database. If the entry has not been not found the request is forwarded to the corresponding LSServer and this result is returned.

Following reply states and bodies are possible (see LSPReply):

The SERVER_ERROR_FLAG of the reply is set, if the reply state of the LSServer has been an IO_ERROR.

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

registerPlain

public LSPReply registerPlain(LSPRegisterPlain request)
Handles the given register plain request (see LSPRegister).
  +--registerPlain in local database
  |
  +--globalRegisterEncrypted/Encoded
     |
     +--globalRegisterPlain
 
The request is processed in the local database first. If the reply state is not ACKNOWLEDGE, registration is aborted and the reply is returned directly.

If the reply was succesful the request is forwarded to the corresponding LSServer by using encryption respectively encoding of the request message if security options are available, using plain messages otherwise.

Nevertheless the result of the request processed on the local database will be returned (the proxy's state is more important than the serer's one)

Following reply states are possible (see LSPReply):

The SERVER_ERROR_FLAG of the reply is set, if the reply state of the LSServer has been an IO_ERROR.

In the case that an update request could not be processed succesfully on proxy respectively server side, because the corresponding entry has not been found, it's tried to reinitialize the entry with an init request.

Specified by:
registerPlain in interface LSProxyService
Parameters:
request - The register plain 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 LSProxyService
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):

Specified by:
proxyInvalidate in interface LSProxyService
Parameters:
request - The proxy invalidate request.
Returns:
The reply to the given request.


Copyright © Fraunhofer Gesellschaft. All Rights Reserved.