|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.fhg.igd.semoa.service.AbstractService de.fhg.igd.semoa.net.AbstractServer de.fhg.igd.atlas.core.LSProxy
Provides a proxy server that will be used as gateway to Location
Service Servers (LSServer
) by Location Service Clients
(LSClient
) in the local LAN if existent.
This Location Service Proxy (LSProxy
) can be installed
as potential proxy to improve the lookup speed and the fault tolerance
in case of network breakdowns. The active proxy will be elected
automatically among all existent potential proxys in the common LAN.
Following request are accepted as LSP messages from the local LAN:
LSPLookup
LSPRegisterPlain
LSPRefresh
LSPProxyInvalidate
LSProxyService
,
ProxyInfo
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 ProxyInfo |
proxyInfo_
The reference to an instance of LSProxy , |
protected LSProxyServiceImpl |
proxyService_
The reference to the LSProxyService 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 |
LSProxy(StorageDB storageDB,
boolean verifyContactAddress)
Creates an instance of this class and initializes the LSProxyService
with the given parameters. |
Method Summary | |
String |
author()
Returns the String with the author's name. |
protected boolean |
checkHostLocality()
Checks if another LSProxy already runs on the same host with the initialized port. |
protected boolean |
checkLANLocality(Socket connection)
Checks the LAN locality of the source of the given connection . |
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. |
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. |
static void |
main(String[] argv)
Initializes the LSProxy from command line. |
String |
protocol()
|
String |
revision()
Returns the revision number of this class as a string. |
protected void |
serverStateChanged(int state)
Implementation of the server state hook, which is called by the servers run method. |
Methods inherited from class de.fhg.igd.semoa.net.AbstractServer |
bad, createJob, createServerSocket, exceptionInfo, getCapacity, getMaximumSize, getPort, getServerState, good, isEnabled, localURL, rebind, run, 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 |
private static Logger log_
Logger
instance for this class
private static final String[] DEPEND_
Environment
.
public static final String PROTOCOL
public static final int MAX_CAPACITY
public static long STORAGE_DB_TIMEOUT
public static final String OPT_DESCR
ArgsParser
option descriptor for the case
that this class is initiated from command line.
protected LSProxyServiceImpl proxyService_
LSProxyService
interface.
protected ProxyInfo proxyInfo_
LSProxy
,
Constructor Detail |
protected LSProxy(StorageDB storageDB, boolean verifyContactAddress)
LSProxyService
with the given parameters.
If storageDB
is null
, the
MemoryDB
is used as default database for the server.
If filename
is null
,
no server will be initialized.
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 LSProxyServiceImpl
).Method Detail |
protected boolean initLSInfrastructure(String configFile)
configFile
is null
,
no server will be initialized.
configFile
- The name the configuration file
containing the configuration of the location service infrastructure.
protected boolean initLSInfrastructure(URL configLdapServer)
configLdapServer
is null
,
no server will be initialized.
configLdapServer
- The URL of the ldap server
maintaining the configuration of the location service infrastructure.
public String info()
info
in interface Service
info
in class AbstractService
public String author()
author
in interface Service
author
in class AbstractServer
public String revision()
revision
in class AbstractService
public String[] dependencies()
Service
.
dependencies
in interface Service
dependencies
in class AbstractService
public String protocol()
protocol
in interface Server
protocol
in class AbstractServer
protected void serverStateChanged(int state)
run
method.
According to the current server state, the status
of the local proxy is updated for the Vicinity election.
serverStateChanged
in class AbstractServer
protected void handleConnection(Socket connection)
WRONG_VERSION
REQUEST_TYPE_INVALID
REQUEST_BODY_INVALID
handleConnection
in class AbstractServer
connection
- The socket connection that must be
handled by this method.protected boolean checkHostLocality()
true
iff another LSProxy server
is running locally, false
otherwise.protected boolean checkLANLocality(Socket connection)
connection
.
true
if the source of the
connection
lies in the current subnet;
false
otherwise.protected LSPReply handleRequest(LSPRequest request)
request
and returns a corresponding reply.
Following requests are allowed:
LSPLookup
LSPRegisterPlain
LSPRefresh
LSPProxyInvalidate
request
- The request to be handled.
public static void main(String[] argv) throws ArgsParserException, ObjectExistsException
LSProxy
from command line.
argv
- The command line parameters.
ArgsParserException
ObjectExistsException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |