public class Server extends Object implements MulticastRequestDecoder, MulticastAnnouncementEncoder, UnicastDiscoveryServer
net.jini.discovery.plaintext
discovery format.Constructor and Description |
---|
Server()
Constructs a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
checkUnicastDiscoveryConstraints(InvocationConstraints constraints)
Checks and returns normally if this server is capable of fulfilling the
given absolute constraints.
|
MulticastRequest |
decodeMulticastRequest(ByteBuffer buf,
InvocationConstraints constraints,
ClientSubjectChecker checker)
Decodes the multicast request data contained in the given buffer in a
manner that satisfies the specified absolute constraints and client
subject checker (if any), returning a
MulticastRequest instance
that contains the decoded data. |
void |
encodeMulticastAnnouncement(MulticastAnnouncement announcement,
DatagramBufferFactory bufs,
InvocationConstraints constraints)
Encodes the given multicast announcement data into byte buffers obtained
from the provided datagram buffer factory, in a manner that satisfies
the specified absolute constraints.
|
String |
getFormatName()
Returns the name of the format implemented by this provider.
|
void |
handleUnicastDiscovery(UnicastResponse response,
Socket socket,
InvocationConstraints constraints,
ClientSubjectChecker checker,
Collection context,
ByteBuffer received,
ByteBuffer sent)
Handles the server side of unicast discovery, transmitting the given
response data over the provided socket using the given collection of
object stream context objects in a manner that satisfies the specified
absolute constraints and client subject checker (if any).
|
public String getFormatName()
DiscoveryFormatProvider
getFormatName
in interface DiscoveryFormatProvider
public MulticastRequest decodeMulticastRequest(ByteBuffer buf, InvocationConstraints constraints, ClientSubjectChecker checker) throws IOException
MulticastRequestDecoder
MulticastRequest
instance
that contains the decoded data. null
constraints are
considered equivalent to empty constraints. All the specified
constraints are checked before this method returns.decodeMulticastRequest
in interface MulticastRequestDecoder
buf
- a buffer containing the packet data to decode. The multicast
request data must begin at position zero of buf
.constraints
- the constraints to apply when decoding the data, or
null
checker
- the object to use to check the client subject, or
null
IOException
- if an error occurs in interpreting the dataUnsupportedConstraintException
- if unable to satisfy the
specified constraintspublic void encodeMulticastAnnouncement(MulticastAnnouncement announcement, DatagramBufferFactory bufs, InvocationConstraints constraints) throws IOException
MulticastAnnouncementEncoder
null
constraints are
considered equivalent to empty constraints. Multicast announcement data
that is too large to fit in a single datagram buffer is split across
multiple buffers, with the constraints applied to each; this method is
responsible for determining if and when to split the data based on the
available space in the obtained buffers.encodeMulticastAnnouncement
in interface MulticastAnnouncementEncoder
announcement
- the announcement data to encodebufs
- the factory for producing buffers in which to write encoded
dataconstraints
- the constraints to apply when encoding the data, or
null
IOException
- if an error occurs in encoding the data to sendUnsupportedConstraintException
- if unable to satisfy
the specified constraintspublic void checkUnicastDiscoveryConstraints(InvocationConstraints constraints) throws UnsupportedConstraintException
UnicastDiscoveryServer
null
constraints are
considered equivalent to empty constraints.checkUnicastDiscoveryConstraints
in interface UnicastDiscoveryServer
constraints
- the constraints to check, or null
UnsupportedConstraintException
- if unable to satisfy the
specified constraintspublic void handleUnicastDiscovery(UnicastResponse response, Socket socket, InvocationConstraints constraints, ClientSubjectChecker checker, Collection context, ByteBuffer received, ByteBuffer sent) throws IOException
UnicastDiscoveryServer
null
constraints are considered equivalent to empty
constraints.handleUnicastDiscovery
in interface UnicastDiscoveryServer
response
- the unicast response data to transmitsocket
- the socket on which to handle unicast discoveryconstraints
- the constraints to apply to unicast discovery, or
null
checker
- the object to use to check the client subject, or
null
context
- the collection of context information objects to use when
marshalling the registrar proxyreceived
- a buffer containing the data already receivedsent
- a buffer containing the data already sentIOException
- if an error occurs in interpreting received data or
in formatting data to sendUnsupportedConstraintException
- if unable to satisfy the
specified constraintsCopyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.