|
||||||||||
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.semoa.net.RequestServer de.fhg.igd.semoa.net.ship.ShipServer
Nested Class Summary |
Nested classes inherited from class de.fhg.igd.semoa.net.AbstractServer |
AbstractServer.Job |
Field Summary | |
static int |
DEFAULT_MAX_PACKET_SIZE
The maximum supported size of datagrams (4096 Bytes). |
static int |
DEFAULT_SHIP_PORT
The default UDP port to listen on (47470). |
private static String[] |
DEPEND_
The dependencies to other objects in the global
Environment . |
private ShipRequestHandler |
handler_
The handler which actually executes queries. |
private static Logger |
log_
The Logger instance for this class |
private Name |
name_
The distinguished name of this host. |
static String |
PROTOCOL
The protocol identifier (ship). |
private Random |
rand_
Random number generator for packet numbers. |
Fields inherited from class de.fhg.igd.semoa.net.AbstractServer |
bad_, DEFAULT_CAPACITY, good_, MAX_CAPACITY, thread_ |
Fields inherited from class de.fhg.igd.semoa.service.AbstractService |
REV_POSTFIX, REV_PREFIX |
Fields inherited from interface de.fhg.igd.semoa.net.ship.ShipService |
WHATIS |
Fields inherited from interface de.fhg.igd.semoa.net.ship.ShipConstants |
COMM_POD_ACL, COMM_POD_URL, COMM_PODS_ACL, COMM_PODS_URL, LOCATION_ADDRESS, LOCATION_CITY, LOCATION_COUNTRY, LOCATION_GPS_LAT, LOCATION_GPS_LONG, LOCATION_ROOM, LOCATION_STATE, LOCATION_ZIP, OWNER_DN, PLATFORM_PURPOSE, TRANSPORT_IN_RAW_MAX, TRANSPORT_IN_RAW_URL, TRANSPORT_IN_RAWS_MAX, TRANSPORT_IN_RAWS_URL |
Fields inherited from interface de.fhg.igd.semoa.net.Server |
BOUND_TO_PORT, ERROR, RUNNING, SHUTDOWN, UNDEFINED |
Constructor Summary | |
ShipServer()
Default constructor. |
Method Summary | |
String |
author()
Returns the name of the author of the service. |
protected Request |
createRequest(Socket con,
Request req)
Creates a Request instance which is ready
to be decoded. |
private Socket |
createSocket(URL url)
|
String[] |
dependencies()
Returns the dependencies of this service as described in Service . |
Set |
getKeySet()
Returns a set of all SHIP keys defined by the local SHIP service. |
Set |
getKeySet(String expr)
Returns a subset of SHIP keys defined by the local SHIP service. |
Set |
getKeySet(String expr,
URL host)
Returns a subset of SHIP keys defined by a remote SHIP service. |
Set |
getKeySet(URL host)
Returns a set of all SHIP keys defined by a remote SHIP service. |
Map |
getMap()
Returns the complete map of key value pairs defined by the local SHIP service. |
Map |
getMap(String expr)
Returns a subset of key value pairs defined by the local SHIP service. |
Map |
getMap(String expr,
URL host)
Returns the a subset of key value pairs by a remote SHIP service. |
Map |
getMap(URL host)
Returns the complete map of key value pairs by a remote SHIP service. |
String |
getValue(String key)
Returns a specific value selected by a given key defined by the local SHIP service. |
String |
getValue(String key,
URL host)
Returns a specific value selected by a given key defined by on a remote SHIP service. |
protected void |
handleConnection(Socket socket)
Handles incoming SHIP requests. |
protected void |
handleError(ShipReply reply)
|
String |
info()
Returns the informative string which should describe the service's essence in a sentence. |
boolean |
isAlive(URL host)
Checks whether a certain host is alive. |
String |
localDN()
|
protected int |
nextId()
Calculates the package IDs. |
String |
protocol()
|
String |
revision()
Returns the revision number of this class as a string. |
protected ShipReply |
send(ShipRequest request,
URL host)
Initiates a connection to the specified host and
sends the given request . |
void |
setConfig(URL configFile)
Initializes this ship server. |
String |
toString()
|
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 |
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 |
Methods inherited from interface de.fhg.igd.semoa.net.ship.ShipService |
localURL |
Field Detail |
private static Logger log_
Logger
instance for this class
public static final String PROTOCOL
public static final int DEFAULT_SHIP_PORT
public static final int DEFAULT_MAX_PACKET_SIZE
private static final String[] DEPEND_
Environment
. There is none dependency.
private ShipRequestHandler handler_
setConfig(de.fhg.igd.util.URL)
results in instantiation of a new handler object.
private Name name_
private Random rand_
Constructor Detail |
public ShipServer()
null
. Use setConfig(de.fhg.igd.util.URL)
after instantiation for initializing the service correctly.
Method Detail |
public String author()
AbstractService
author
in interface Service
author
in class AbstractServer
public String info()
AbstractService
info
in interface Service
info
in class AbstractService
public String revision()
AbstractService
majorVersion()
, minorVersion
based on the assumption that this method returns a
revision string as generated by rcs(1) for the template
"$Revision: 1.7 $/$Date: 2007-08-08 04:41:53 +0200 (Wed, 08 Aug 2007) $".
revision
in class AbstractService
public String[] dependencies()
AbstractService
Service
. This default
implementation returns an array of length 0.
dependencies
in interface Service
dependencies
in class AbstractService
public String protocol()
protocol
in interface Server
protocol
in class AbstractServer
public String toString()
toString
in class AbstractServer
public String localDN()
localDN
in interface ShipService
String
(see KeyMaster.AUTH_KEY
).public boolean isAlive(URL host) throws ShipException
ShipService
false
. Hence, a negative result may not be
interpreted as if the pinged host is down; the server could
just deny answering SHIP requests.
isAlive
in interface ShipService
host
- denotes the SHIP port of the host to be queried
ShipException
- if access connection to remote SHIP
service fails.public Set getKeySet(String expr, URL host) throws ShipException
ShipService
getKeySet
in interface ShipService
expr
- allows wildcards to get just a subset of the maphost
- denotes denotes the SHIP port of the host to be queried
ShipException
- if access connection to remote SHIP
service fails.public Set getKeySet(String expr)
ShipService
getKeySet
in interface ShipService
expr
- allows wildcards to get just a subset of the map
public Set getKeySet(URL host) throws ShipException
ShipService
getKeySet
in interface ShipService
host
- denotes denotes the SHIP port of the host to be queried
ShipException
- if access connection to remote SHIP
service fails.public Set getKeySet()
ShipService
getKeySet
in interface ShipService
public String getValue(String key, URL host) throws ShipException
ShipService
getValue
in interface ShipService
key
- defines a specific valuehost
- denotes the SHIP port of the host to be queried
ShipException
- if access connection to remote SHIP
service fails.public String getValue(String key)
ShipService
getValue
in interface ShipService
key
- defines a specific value
null
otherwise.public Map getMap(String expr, URL host) throws ShipException
ShipService
getMap
in interface ShipService
expr
- allows wildcards to get just a subset of the maphost
- denotes the SHIP port of the host to be queried
ShipException
- if access connection to remote SHIP
service fails.public Map getMap(String expr)
ShipService
getMap
in interface ShipService
expr
- allows wildcards to get just a subset of the map
public Map getMap(URL host) throws ShipException
ShipService
getMap(".*", host)
.
getMap
in interface ShipService
host
- denotes the SHIP port of the host to be queried
ShipException
- if access connection to remote SHIP
service fails.public Map getMap()
ShipService
getMap(".*")
getMap
in interface ShipService
protected void handleConnection(Socket socket) throws Exception
AbstractServer.handleConnection(java.net.Socket)
as is automatically called when a remote host sends a ship
request. The request will be read and processed. The resulting
reply
is sent back via the still open socket.
handleConnection
in class RequestServer
socket
- a socket to the calling ship server.
Exception
- this methods hands back all occuring
exceptions to the caller.AbstractServer
protected Request createRequest(Socket con, Request req)
RequestServer
Request
instance which is ready
to be decoded.
createRequest
in class RequestServer
con
- The socket connection that must be handled
by the Request
generated by this
method.req
- The previous Request
or
null
if this is the first call for the given
connection.
Request
instance that can be
decoded, and which is subsequently invoked to
handle the decoded request.protected ShipReply send(ShipRequest request, URL host) throws ShipException
host
and
sends the given request
. The host URL should
contain a port number, otherwise DEFAULT_SHIP_PORT
is
used.
request
- the ship request to be sent.host
- the url of the target host to be queried.
NullPointerException
- if request
is null.
NullPointerException
- if host
is null.
ShipException
public void setConfig(URL configFile)
Properties
.The SeMoA shell allows to re-init an always running server with a new or altered configuration file. This is done by means of the following statement:
Publish -key ${WhatIs:SHIP} ; -setConfig ship.conf
configFile
- the pathname of the ship configuration file.private Socket createSocket(URL url) throws IOException
IOException
protected int nextId()
protected void handleError(ShipReply reply) throws ShipException
ShipException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |