public class Client extends Object implements MulticastRequestEncoder, MulticastAnnouncementDecoder, UnicastDiscoveryClient
net.jini.discovery.plaintext
discovery format.Constructor and Description |
---|
Client()
Constructs a new instance.
|
Modifier and Type | Method and Description |
---|---|
void |
checkUnicastDiscoveryConstraints(InvocationConstraints constraints)
Checks and returns normally if this client is capable of fulfilling the
given absolute constraints.
|
MulticastAnnouncement |
decodeMulticastAnnouncement(ByteBuffer buf,
InvocationConstraints constraints)
Decodes the multicast announcement data contained in the given buffer in
a manner that satisfies the specified absolute constraints, returning a
MulticastAnnouncement instance that contains the decoded data. |
UnicastResponse |
doUnicastDiscovery(Socket socket,
InvocationConstraints constraints,
ClassLoader defaultLoader,
ClassLoader verifierLoader,
Collection context,
ByteBuffer sent,
ByteBuffer received)
Performs the client side of unicast discovery, obtaining the returned
response data over the provided socket using the given default and
codebase verifier class loaders and collection of object stream context
objects in a manner that satisfies the specified absolute constraints.
|
void |
encodeMulticastRequest(MulticastRequest request,
DatagramBufferFactory bufs,
InvocationConstraints constraints)
Encodes the given multicast request 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.
|
public String getFormatName()
DiscoveryFormatProvider
getFormatName
in interface DiscoveryFormatProvider
public void encodeMulticastRequest(MulticastRequest request, DatagramBufferFactory bufs, InvocationConstraints constraints) throws IOException
MulticastRequestEncoder
null
constraints are
considered equivalent to empty constraints. Multicast request 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.encodeMulticastRequest
in interface MulticastRequestEncoder
request
- the request 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 MulticastAnnouncement decodeMulticastAnnouncement(ByteBuffer buf, InvocationConstraints constraints) throws IOException
MulticastAnnouncementDecoder
MulticastAnnouncement
instance that contains the decoded data.
null
constraints are considered equivalent to empty
constraints. All the specified constraints are checked before this
method returns.decodeMulticastAnnouncement
in interface MulticastAnnouncementDecoder
buf
- a buffer containing the packet data to decode. The
multicast announcement data must begin at position zero of
buf
.constraints
- the constraints to apply when decoding the data, or
null
IOException
- if an error occurs in interpreting the dataUnsupportedConstraintException
- if unable to satisfy the
specified constraintspublic void checkUnicastDiscoveryConstraints(InvocationConstraints constraints) throws UnsupportedConstraintException
UnicastDiscoveryClient
null
constraints are
considered equivalent to empty constraints.checkUnicastDiscoveryConstraints
in interface UnicastDiscoveryClient
constraints
- the constraints to check, or null
UnsupportedConstraintException
- if unable to satisfy the
specified constraintspublic UnicastResponse doUnicastDiscovery(Socket socket, InvocationConstraints constraints, ClassLoader defaultLoader, ClassLoader verifierLoader, Collection context, ByteBuffer sent, ByteBuffer received) throws IOException, ClassNotFoundException
UnicastDiscoveryClient
null
constraints are considered equivalent
to empty constraints.doUnicastDiscovery
in interface UnicastDiscoveryClient
socket
- the socket on which to perform unicast discoveryconstraints
- the constraints to apply to unicast discovery, or
null
defaultLoader
- the class loader value (possibly null
)
to be passed as the defaultLoader
argument to
RMIClassLoader
methods when unmarshalling the registrar
proxyverifierLoader
- the class loader value (possibly
null
) to pass to Security.verifyCodebaseIntegrity
, if codebase integrity verification is
used when unmarshalling the registrar proxycontext
- the collection of context information objects (possibly
null
) to use when unmarshalling the registrar proxysent
- a buffer containing the data already sentreceived
- a buffer containing the data already receivedIOException
- if an error occurs in interpreting received data or
in formatting data to sendUnsupportedConstraintException
- if unable to satisfy the
specified constraintsClassNotFoundException
- if the class of the discovered registrar
cannot be resolvedCopyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.