net.jini.jeri.kerberos
Class KerberosServerEndpoint.ListenEndpointImpl

java.lang.Object
  extended by net.jini.jeri.kerberos.KerberosServerEndpoint.ListenEndpointImpl
All Implemented Interfaces:
ServerEndpoint.ListenEndpoint
Enclosing class:
KerberosServerEndpoint

private final class KerberosServerEndpoint.ListenEndpointImpl
extends Object
implements ServerEndpoint.ListenEndpoint


Constructor Summary
private KerberosServerEndpoint.ListenEndpointImpl()
           
 
Method Summary
 void checkPermissions()
          Verifies that the current security context has all of the security permissions necessary to listen for requests on this ListenEndpoint.
 boolean equals(Object obj)
          Two instances of this class are equal if they are instances of the same concrete class; have server subjects that compare equal using ==; have the same server principal; have the same port; and have server socket factories that are both null, or have the same actual class and are equal.
private  KerberosServerEndpoint getServerEndpoint()
           
 int hashCode()
          Returns a hash code value for this object.
 ServerEndpoint.ListenHandle listen(RequestDispatcher requestDispatcher)
          Listens for requests received on the communication endpoint represented by this ListenEndpoint, dispatching them to the supplied RequestDispatcher in the form of InboundRequest instances.
 String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

KerberosServerEndpoint.ListenEndpointImpl

private KerberosServerEndpoint.ListenEndpointImpl()
Method Detail

checkPermissions

public void checkPermissions()
Description copied from interface: ServerEndpoint.ListenEndpoint
Verifies that the current security context has all of the security permissions necessary to listen for requests on this ListenEndpoint.

This method should be used when an invocation of ListenEndpoint.listen is used to receive requests for a variety of interested parties, each with potentially different security permissions possibly more limited than those granted to the code managing the shared endpoint, so that the managing code can enforce proper access control for each party.

Specified by:
checkPermissions in interface ServerEndpoint.ListenEndpoint
See Also:
InboundRequest.checkPermissions()

listen

public ServerEndpoint.ListenHandle listen(RequestDispatcher requestDispatcher)
                                   throws IOException
Description copied from interface: ServerEndpoint.ListenEndpoint
Listens for requests received on the communication endpoint represented by this ListenEndpoint, dispatching them to the supplied RequestDispatcher in the form of InboundRequest instances.

This method starts a continuing listen operation and then immediately returns a ListenHandle that represents the listen operation that was started. For the duration of the listen operation, all requests received on the communication endpoint will be dispatched to the supplied RequestDispatcher as InboundRequest instances. The returned ListenHandle can be used to stop the listen operation and to obtain a ListenCookie to identify the listen operation as the return value of the ListenContext.addListenEndpoint method.

Typically, this method is invoked by a ListenContext implementation when its addListenEndpoint method is called as part of the execution of a ServerEndpoint.enumerateListenEndpoints invocation. The Endpoint instance that can be used to send requests to the communication endpoints represented by the ServerEndpoint (including this ListenEndpoint) is produced by the ServerEndpoint implementation given, in part, the ListenCookie obtained from the ListenHandle returned by this method.

This method verifies that the current security context has all of the security permissions necessary to listen for requests on this ListenEndpoint, as appropriate to the implementation of this interface (see ServerEndpoint.ListenEndpoint.checkPermissions()). Note that in addition to this security check, the implementation of this interface may also perform a further security check per request received (when the origin of a given request is known), to verify that the same security context also has all of the permissions necessary to receive requests from that particular origin (see InboundRequest.checkPermissions()). This interface does not provide an API for determining when such a security check has failed; the behavior will be as if the associated request never occurred.

Implementations of this method should provide robust behavior (such as continuing to listen for requests) in the event that the supplied RequestDispatcher's dispatch method throws an unchecked exception.

Requests may be dispatched in separate threads as necessary for requests received on this ListenEndpoint while others are still being processed by earlier dispatch invocations. The implementation of this interface must assume that there may be arbitrary execution dependencies between the processing of such concurrently received requests, and thus it must not attempt any particular serialization of their processing; therefore, a request received must be either dispatched or rejected within a reasonable period of time, rather than be queued indefinitely waiting for the return of earlier dispatch invocations.

Implementations of this method should generally dispatch a request in a daemon thread with a security context at least as restrictive as the one in which this method was invoked, and without holding visible synchronization locks.

Specified by:
listen in interface ServerEndpoint.ListenEndpoint
Parameters:
requestDispatcher - the RequestDispatcher to use to dispatch incoming requests received on this communication endpoint
Returns:
a ListenHandle that represents the listen operation that was started
Throws:
IOException - if an I/O exception occurs while attempting to listen for requests on this ListenEndpoint. This could occur, for example, if an I/O resource associated with this communication endpoint is already in exclusive use, or if there are insufficient I/O resources for the operation.

hashCode

public int hashCode()
Returns a hash code value for this object.

Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Two instances of this class are equal if they are instances of the same concrete class; have server subjects that compare equal using ==; have the same server principal; have the same port; and have server socket factories that are both null, or have the same actual class and are equal. Note that two listen endpoints can be equal without having the same server host or client socket factory.

Overrides:
equals in class Object

toString

public String toString()
Returns a string representation of this object.

Overrides:
toString in class Object

getServerEndpoint

private KerberosServerEndpoint getServerEndpoint()


Copyright 2007-2010, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.