|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.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 Serviceauthor in class AbstractServerpublic String info()
AbstractService
info in interface Serviceinfo in class AbstractServicepublic String revision()
AbstractServicemajorVersion(), 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 AbstractServicepublic String[] dependencies()
AbstractServiceService. This default
implementation returns an array of length 0.
dependencies in interface Servicedependencies in class AbstractServicepublic String protocol()
protocol in interface Serverprotocol in class AbstractServerpublic String toString()
toString in class AbstractServerpublic String localDN()
localDN in interface ShipServiceString
(see KeyMaster.AUTH_KEY).
public boolean isAlive(URL host)
throws ShipException
ShipServicefalse. 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 ShipServicehost - 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 ShipServiceexpr - 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 ShipServiceexpr - allows wildcards to get just a subset of the map
public Set getKeySet(URL host)
throws ShipException
ShipService
getKeySet in interface ShipServicehost - 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 ShipServicekey - 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 ShipServicekey - defines a specific value
null otherwise.
public Map getMap(String expr,
URL host)
throws ShipException
ShipService
getMap in interface ShipServiceexpr - 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 ShipServiceexpr - allows wildcards to get just a subset of the map
public Map getMap(URL host)
throws ShipException
ShipServicegetMap(".*", host).
getMap in interface ShipServicehost - denotes the SHIP port of the host to be queried
ShipException - if access connection to remote SHIP
service fails.public Map getMap()
ShipServicegetMap(".*")
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 RequestServersocket - 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)
RequestServerRequest instance which is ready
to be decoded.
createRequest in class RequestServercon - 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.
ShipExceptionpublic 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
IOExceptionprotected 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 | |||||||||