Package com.sun.jini.discovery.plaintext
Class Client
java.lang.Object
com.sun.jini.discovery.plaintext.Client
- All Implemented Interfaces:
DiscoveryFormatProvider,MulticastAnnouncementDecoder,MulticastRequestEncoder,UnicastDiscoveryClient
public class Client
extends Object
implements MulticastRequestEncoder, MulticastAnnouncementDecoder, UnicastDiscoveryClient
Implements the client side of the
net.jini.discovery.plaintext discovery format.- Since:
- 2.0
- Author:
- Sun Microsystems, Inc.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckUnicastDiscoveryConstraints(InvocationConstraints constraints) Checks and returns normally if this client is capable of fulfilling the given absolute constraints.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 aMulticastAnnouncementinstance that contains the decoded data.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.voidencodeMulticastRequest(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.Returns the name of the format implemented by this provider.
-
Constructor Details
-
Client
public Client()Constructs a new instance.
-
-
Method Details
-
getFormatName
Description copied from interface:DiscoveryFormatProviderReturns the name of the format implemented by this provider.- Specified by:
getFormatNamein interfaceDiscoveryFormatProvider- Returns:
- the name of the format implemented by this provider
-
encodeMulticastRequest
public void encodeMulticastRequest(MulticastRequest request, DatagramBufferFactory bufs, InvocationConstraints constraints) throws IOException Description copied from interface:MulticastRequestEncoderEncodes the given multicast request data into byte buffers obtained from the provided datagram buffer factory, in a manner that satisfies the specified absolute constraints.nullconstraints 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.- Specified by:
encodeMulticastRequestin interfaceMulticastRequestEncoder- Parameters:
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, ornull- Throws:
IOException- if an error occurs in encoding the data to sendUnsupportedConstraintException- if unable to satisfy the specified constraints
-
decodeMulticastAnnouncement
public MulticastAnnouncement decodeMulticastAnnouncement(ByteBuffer buf, InvocationConstraints constraints) throws IOException Description copied from interface:MulticastAnnouncementDecoderDecodes the multicast announcement data contained in the given buffer in a manner that satisfies the specified absolute constraints, returning aMulticastAnnouncementinstance that contains the decoded data.nullconstraints are considered equivalent to empty constraints. All the specified constraints are checked before this method returns.- Specified by:
decodeMulticastAnnouncementin interfaceMulticastAnnouncementDecoder- Parameters:
buf- a buffer containing the packet data to decode. The multicast announcement data must begin at position zero ofbuf.constraints- the constraints to apply when decoding the data, ornull- Returns:
- the decoded multicast announcement data
- Throws:
IOException- if an error occurs in interpreting the dataUnsupportedConstraintException- if unable to satisfy the specified constraints
-
checkUnicastDiscoveryConstraints
public void checkUnicastDiscoveryConstraints(InvocationConstraints constraints) throws UnsupportedConstraintException Description copied from interface:UnicastDiscoveryClientChecks and returns normally if this client is capable of fulfilling the given absolute constraints.nullconstraints are considered equivalent to empty constraints.- Specified by:
checkUnicastDiscoveryConstraintsin interfaceUnicastDiscoveryClient- Parameters:
constraints- the constraints to check, ornull- Throws:
UnsupportedConstraintException- if unable to satisfy the specified constraints
-
doUnicastDiscovery
public UnicastResponse doUnicastDiscovery(Socket socket, InvocationConstraints constraints, ClassLoader defaultLoader, ClassLoader verifierLoader, Collection context, ByteBuffer sent, ByteBuffer received) throws IOException, ClassNotFoundException Description copied from interface:UnicastDiscoveryClientPerforms 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. Byte buffers containing the data sent and received so far over the given socket (for the unicast discovery protocol 2 handshake) are provided for use by formats which integrity protect or otherwise incorporate the handshake data.nullconstraints are considered equivalent to empty constraints.- Specified by:
doUnicastDiscoveryin interfaceUnicastDiscoveryClient- Parameters:
socket- the socket on which to perform unicast discoveryconstraints- the constraints to apply to unicast discovery, ornulldefaultLoader- the class loader value (possiblynull) to be passed as thedefaultLoaderargument toRMIClassLoadermethods when unmarshalling the registrar proxyverifierLoader- the class loader value (possiblynull) to pass toSecurity.verifyCodebaseIntegrity, if codebase integrity verification is used when unmarshalling the registrar proxycontext- the collection of context information objects (possiblynull) to use when unmarshalling the registrar proxysent- a buffer containing the data already sentreceived- a buffer containing the data already received- Returns:
- the received unicast response data
- Throws:
IOException- 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 resolved
-