GigaSpaces XAP 9.0 API

com.sun.jini.discovery.plaintext
Class Client

java.lang.Object
  extended by 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
Client()
          Constructs a new instance.
 
Method Summary
 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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Client

public Client()
Constructs a new instance.

Method Detail

getFormatName

public String getFormatName()
Description copied from interface: DiscoveryFormatProvider
Returns the name of the format implemented by this provider.

Specified by:
getFormatName in interface DiscoveryFormatProvider
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: MulticastRequestEncoder
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. 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.

Specified by:
encodeMulticastRequest in interface MulticastRequestEncoder
Parameters:
request - the request data to encode
bufs - the factory for producing buffers in which to write encoded data
constraints - the constraints to apply when encoding the data, or null
Throws:
IOException - if an error occurs in encoding the data to send
UnsupportedConstraintException - if unable to satisfy the specified constraints

decodeMulticastAnnouncement

public MulticastAnnouncement decodeMulticastAnnouncement(ByteBuffer buf,
                                                         InvocationConstraints constraints)
                                                  throws IOException
Description copied from interface: MulticastAnnouncementDecoder
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. null constraints are considered equivalent to empty constraints. All the specified constraints are checked before this method returns.

Specified by:
decodeMulticastAnnouncement in interface MulticastAnnouncementDecoder
Parameters:
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
Returns:
the decoded multicast announcement data
Throws:
IOException - if an error occurs in interpreting the data
UnsupportedConstraintException - if unable to satisfy the specified constraints

checkUnicastDiscoveryConstraints

public void checkUnicastDiscoveryConstraints(InvocationConstraints constraints)
                                      throws UnsupportedConstraintException
Description copied from interface: UnicastDiscoveryClient
Checks and returns normally if this client is capable of fulfilling the given absolute constraints. null constraints are considered equivalent to empty constraints.

Specified by:
checkUnicastDiscoveryConstraints in interface UnicastDiscoveryClient
Parameters:
constraints - the constraints to check, or null
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: UnicastDiscoveryClient
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. 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. null constraints are considered equivalent to empty constraints.

Specified by:
doUnicastDiscovery in interface UnicastDiscoveryClient
Parameters:
socket - the socket on which to perform unicast discovery
constraints - 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 proxy
verifierLoader - the class loader value (possibly null) to pass to Security.verifyCodebaseIntegrity, if codebase integrity verification is used when unmarshalling the registrar proxy
context - the collection of context information objects (possibly null) to use when unmarshalling the registrar proxy
sent - a buffer containing the data already sent
received - 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 send
UnsupportedConstraintException - if unable to satisfy the specified constraints
ClassNotFoundException - if the class of the discovered registrar cannot be resolved

GigaSpaces XAP 9.0 API

Copyright © GigaSpaces.