org.avineas.fins.gw
public class Gateway extends java.lang.Object
Constructor and Description |
---|
Gateway() |
Modifier and Type | Method and Description |
---|---|
void |
addUnit(Address addr,
Unit unit)
Add a unit to the unit set, meaning that it is registered to be working with this
gateway.
|
void |
destroy()
Destroy method for shutting down the thread.
|
long |
getTimeout()
Get the time-out time, in ms, in which replies should be received.
|
int |
getTries()
Get the number of tries that take place during sending to an other node
before the message is considered to be un-deliverable.
|
void |
init()
The after properties set method of this gateway.
|
boolean |
removeUnit(Address addr)
Remove a unit with a specific address.
|
void |
setPort(int port)
Set the local UDP port of this gateway.
|
void |
setRemoteNodes(java.util.Map<java.lang.String,java.lang.String> nodes)
Method that is called during bootstrap to set the remote node definition.
|
void |
setTimeout(long timeout)
Set the timeout, in ms in which replies should be received back
from remote nodes.
|
void |
setTries(int tries)
Set the number of times a packet will be sent before it is considered as not
deliverable.
|
void |
setUnits(java.util.Map<java.lang.String,Unit> unitMap)
Method that should be called at boot strap to set the units that are local
to this gateway.
|
java.lang.String |
toString() |
public void setRemoteNodes(java.util.Map<java.lang.String,java.lang.String> nodes) throws java.net.UnknownHostException
nodes
- A map with FINS node/UDP host/port combinations. Fins nodes
should be specified as string value "network/node" the UDP combination as
"ipaddress:port", like "0/1" -> "remotehost:9000"java.net.UnknownHostException
- In case the IP host is not knownpublic void addUnit(Address addr, Unit unit)
addr
- The address of the unit, should be in unit format like 12/3/1, indicating
the network, node and unit respectivelyunit
- The unit to register with this addresspublic boolean removeUnit(Address addr)
addr
- The address to removepublic void setUnits(java.util.Map<java.lang.String,Unit> unitMap)
addUnit(Address, Unit)
can be used to add units at run-time.unitMap
- The map with FINS unit address/Unit interface combinationspublic void setPort(int port) throws java.net.SocketException
port
- The UDP port numberjava.net.SocketException
@PostConstruct public void init() throws java.net.SocketException
java.net.SocketException
public long getTimeout()
public void setTimeout(long timeout)
timeout
- The timeout in mspublic int getTries()
public void setTries(int tries)
tries
- The number of times a packet will be sent and waited for@PreDestroy public void destroy()
public java.lang.String toString()
toString
in class java.lang.Object