GigaSpaces XAP 9.7.2 API

com.sun.jini.discovery.plaintext
Class Server

java.lang.Object
  extended by com.sun.jini.discovery.plaintext.Server
All Implemented Interfaces:
DiscoveryFormatProvider, MulticastAnnouncementEncoder, MulticastRequestDecoder, UnicastDiscoveryServer

public class Server
extends Object
implements MulticastRequestDecoder, MulticastAnnouncementEncoder, UnicastDiscoveryServer

Implements the server side of the net.jini.discovery.plaintext discovery format.

Since:
2.0
Author:
Sun Microsystems, Inc.

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

Constructor Detail

Server

public Server()
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

decodeMulticastRequest

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

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

encodeMulticastAnnouncement

public void encodeMulticastAnnouncement(MulticastAnnouncement announcement,
                                        DatagramBufferFactory bufs,
                                        InvocationConstraints constraints)
                                 throws IOException
Description copied from interface: MulticastAnnouncementEncoder
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. 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.

Specified by:
encodeMulticastAnnouncement in interface MulticastAnnouncementEncoder
Parameters:
announcement - the announcement 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

checkUnicastDiscoveryConstraints

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

Specified by:
checkUnicastDiscoveryConstraints in interface UnicastDiscoveryServer
Parameters:
constraints - the constraints to check, or null
Throws:
UnsupportedConstraintException - if unable to satisfy the specified constraints

handleUnicastDiscovery

public void handleUnicastDiscovery(UnicastResponse response,
                                   Socket socket,
                                   InvocationConstraints constraints,
                                   ClientSubjectChecker checker,
                                   Collection context,
                                   ByteBuffer received,
                                   ByteBuffer sent)
                            throws IOException
Description copied from interface: UnicastDiscoveryServer
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). Byte buffers containing the data received and sent 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:
handleUnicastDiscovery in interface UnicastDiscoveryServer
Parameters:
response - the unicast response data to transmit
socket - the socket on which to handle unicast discovery
constraints - 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 proxy
received - a buffer containing the data already received
sent - a buffer containing the data already sent
Throws:
IOException - if an error occurs in interpreting received data or in formatting data to send
UnsupportedConstraintException - if unable to satisfy the specified constraints

GigaSpaces XAP 9.7.2 API

Copyright © GigaSpaces.