|
JXTA | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.jxta.impl.endpoint.relay.RelayTransport
public final class RelayTransport
The Relay Server supports the following commands: CONNECT - message contains PEERID, optional LEASE DISCONNECT - message contains PEERID. GETSERVER - message contains PEERID.
Field Summary | |
---|---|
(package private) static String |
CONNECT_REQUEST
|
(package private) static MessageElement |
CONNECT_REQUEST_ELEMENT
|
(package private) static String |
CONNECTED_RESPONSE
|
(package private) static MessageElement |
CONNECTED_RESPONSE_ELEMENT
|
(package private) static long |
DEFAULT_BROADCAST_INTERVAL
|
(package private) static int |
DEFAULT_CLIENT_QUEUE_SIZE
|
(package private) static long |
DEFAULT_LEASE
|
(package private) static int |
DEFAULT_MAX_CLIENTS
|
(package private) static int |
DEFAULT_MAX_SERVERS
|
(package private) static long |
DEFAULT_POLL_INTERVAL
|
(package private) static long |
DEFAULT_STALL_TIMEOUT
|
(package private) static String |
DISCONNECT_REQUEST
|
(package private) static MessageElement |
DISCONNECT_REQUEST_ELEMENT
|
(package private) static String |
DISCONNECTED_RESPONSE
|
(package private) static MessageElement |
DISCONNECTED_RESPONSE_ELEMENT
|
(package private) static String |
LEASE_ELEMENT
|
(package private) static String |
PEERID_ELEMENT
|
(package private) static String |
PID_REQUEST
|
(package private) static MessageElement |
PID_REQUEST_ELEMENT
|
(package private) static String |
PID_RESPONSE
|
(package private) static MessageElement |
PID_RESPONSE_ELEMENT
|
(package private) static String |
protocolName
|
(package private) static String |
RELAY_ADV_ELEMENT
|
(package private) static String |
RELAY_NS
|
(package private) static String |
REQUEST_ELEMENT
|
(package private) static String |
RESPONSE_ELEMENT
|
Fields inherited from interface net.jxta.platform.Module |
---|
START_AGAIN_PROGRESS, START_AGAIN_STALLED, START_DISABLED, START_OK |
Constructor Summary | |
---|---|
RelayTransport()
|
Method Summary | |
---|---|
(package private) static Message |
createConnectedMessage(long lease)
|
(package private) static Message |
createConnectMessage(long lease,
boolean doReturnAdv,
boolean doFlushQueue)
|
(package private) static String |
createConnectString(long lease,
boolean doReturnAdv,
boolean doFlushQueue)
|
(package private) static Message |
createDisconnectedMessage()
|
(package private) static Message |
createDisconnectMessage()
|
(package private) static Message |
createPIDRequestMessage()
|
(package private) static Message |
createPIDResponseMessage(String pidStr)
|
protected PeerGroup |
getGroup()
|
protected String |
getServiceName()
|
(package private) static String |
getString(Message message,
String elementName)
Convinence function for getting a String from the element with the given tag and relay namespace |
void |
init(PeerGroup group,
ID assignedID,
Advertisement implAdv)
Initialize the module, passing it its peer group and advertisement. |
void |
processIncomingMessage(Message message,
EndpointAddress srcAddr,
EndpointAddress dstAddr)
This method is invoked by the EndpointService for each incoming message which is addressed to this listener. |
(package private) static void |
setString(Message message,
String elementName,
String value)
Convinence function for setting a string element with the relay namespace |
int |
startApp(String[] args)
Complete any remaining initialization of the module. |
void |
stopApp()
Stop a module. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
static final String protocolName
static final String RELAY_NS
static final String REQUEST_ELEMENT
static final String RESPONSE_ELEMENT
static final String PEERID_ELEMENT
static final String LEASE_ELEMENT
static final String RELAY_ADV_ELEMENT
static final String CONNECT_REQUEST
static final MessageElement CONNECT_REQUEST_ELEMENT
static final String DISCONNECT_REQUEST
static final MessageElement DISCONNECT_REQUEST_ELEMENT
static final String PID_REQUEST
static final MessageElement PID_REQUEST_ELEMENT
static final String CONNECTED_RESPONSE
static final MessageElement CONNECTED_RESPONSE_ELEMENT
static final String DISCONNECTED_RESPONSE
static final MessageElement DISCONNECTED_RESPONSE_ELEMENT
static final String PID_RESPONSE
static final MessageElement PID_RESPONSE_ELEMENT
static final int DEFAULT_MAX_CLIENTS
static final int DEFAULT_MAX_SERVERS
static final long DEFAULT_LEASE
static final long DEFAULT_STALL_TIMEOUT
static final long DEFAULT_POLL_INTERVAL
static final long DEFAULT_BROADCAST_INTERVAL
static final int DEFAULT_CLIENT_QUEUE_SIZE
Constructor Detail |
---|
public RelayTransport()
Method Detail |
---|
public void init(PeerGroup group, ID assignedID, Advertisement implAdv) throws PeerGroupException
init
in interface Module
group
- The PeerGroup from which this Module can obtain services.
If this module is a Service, this is also the PeerGroup of which this
module is a service.assignedID
- Identity of Module within group.
modules can use it as a the root of their namespace to create
names that are unique within the group but predictable by the
same module on another peer. This is normally the ModuleClassID
which is also the name under which the module is known by other
modules. For a group it is the PeerGroupID itself.
The parameters of a service, in the Peer configuration, are indexed
by the assignedID of that service, and a Service must publish its
run-time parameters in the Peer Advertisement under its assigned ID.implAdv
- The implementation advertisement for this
Module. It is permissible to pass null if no implementation
advertisement is available. This may happen if the
implementation was selected by explicit class name rather than
by following an implementation advertisement. Modules are not
required to support that style of loading, but if they do, then
their documentation should mention it.
PeerGroupException
- This module failed to initialize.public int startApp(String[] args)
startApp()
is completed. That is
also the opportunity to supply arbitrary arguments (mostly to
applications).
If this module is a PeerGroup
service, it may be invoked
several times depending on its return value.
startApp
in interface Module
args
- An array of Strings forming the parameters for this
Module.
Module.START_OK
, Module.START_AGAIN_PROGRESS
,
Module.START_AGAIN_STALLED
, which indicates partial or complete
success, or any other value (negative values are
recommended for future compatibility), which indicates failure.public void stopApp()
init()
completes and should not assume that startApp()
has been
called or completed.
The Module cannot be forced to comply, but in the future
we might be able to deny it access to anything after some timeout.
stopApp
in interface Module
public void processIncomingMessage(Message message, EndpointAddress srcAddr, EndpointAddress dstAddr)
processIncomingMessage
in interface EndpointListener
message
- Incoming messagesrcAddr
- Endpoint Address of the source of the message.dstAddr
- Endpoint Address of the destination of the message.protected PeerGroup getGroup()
protected String getServiceName()
static Message createPIDRequestMessage()
static Message createPIDResponseMessage(String pidStr)
static Message createConnectMessage(long lease, boolean doReturnAdv, boolean doFlushQueue)
static String createConnectString(long lease, boolean doReturnAdv, boolean doFlushQueue)
static Message createConnectedMessage(long lease)
static Message createDisconnectMessage()
static Message createDisconnectedMessage()
static void setString(Message message, String elementName, String value)
message
- the messageelementName
- message element namevalue
- the value of the stringstatic String getString(Message message, String elementName)
message
- the messageelementName
- the value of the string
|
JXSE | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |