Package com.sun.jini.discovery.plaintext
Class Server
java.lang.Object
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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcheckUnicastDiscoveryConstraints(InvocationConstraints constraints) Checks and returns normally if this server is capable of fulfilling the given absolute constraints.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 aMulticastRequestinstance that contains the decoded data.voidencodeMulticastAnnouncement(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.Returns the name of the format implemented by this provider.voidhandleUnicastDiscovery(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).
-
Constructor Details
-
Server
public Server()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
-
decodeMulticastRequest
public MulticastRequest decodeMulticastRequest(ByteBuffer buf, InvocationConstraints constraints, ClientSubjectChecker checker) throws IOException Description copied from interface:MulticastRequestDecoderDecodes 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 aMulticastRequestinstance that contains the decoded data.nullconstraints are considered equivalent to empty constraints. All the specified constraints are checked before this method returns.- Specified by:
decodeMulticastRequestin interfaceMulticastRequestDecoder- Parameters:
buf- a buffer containing the packet data to decode. The multicast request data must begin at position zero ofbuf.constraints- the constraints to apply when decoding the data, ornullchecker- the object to use to check the client subject, ornull- Returns:
- the decoded multicast request data
- Throws:
IOException- if an error occurs in interpreting the dataUnsupportedConstraintException- if unable to satisfy the specified constraints
-
encodeMulticastAnnouncement
public void encodeMulticastAnnouncement(MulticastAnnouncement announcement, DatagramBufferFactory bufs, InvocationConstraints constraints) throws IOException Description copied from interface:MulticastAnnouncementEncoderEncodes the given multicast announcement 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 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:
encodeMulticastAnnouncementin interfaceMulticastAnnouncementEncoder- Parameters:
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, ornull- Throws:
IOException- if an error occurs in encoding the data to sendUnsupportedConstraintException- if unable to satisfy the specified constraints
-
checkUnicastDiscoveryConstraints
public void checkUnicastDiscoveryConstraints(InvocationConstraints constraints) throws UnsupportedConstraintException Description copied from interface:UnicastDiscoveryServerChecks and returns normally if this server is capable of fulfilling the given absolute constraints.nullconstraints are considered equivalent to empty constraints.- Specified by:
checkUnicastDiscoveryConstraintsin interfaceUnicastDiscoveryServer- Parameters:
constraints- the constraints to check, ornull- 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:UnicastDiscoveryServerHandles 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.nullconstraints are considered equivalent to empty constraints.- Specified by:
handleUnicastDiscoveryin interfaceUnicastDiscoveryServer- Parameters:
response- the unicast response data to transmitsocket- the socket on which to handle unicast discoveryconstraints- the constraints to apply to unicast discovery, ornullchecker- the object to use to check the client subject, ornullcontext- 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 sent- Throws:
IOException- if an error occurs in interpreting received data or in formatting data to sendUnsupportedConstraintException- if unable to satisfy the specified constraints
-