org.ssonet.net
Interface ConnectionListener

All Known Implementing Classes:
AnimatedCatalogDialog, AnimatedOrderDialog, MerchantServer, TestClient, TestJigsaw, TestServer

public interface ConnectionListener

Observes the life cycle of a connection. Before a SSONET connection is established, server and client negotiate their security goals. It can be configured, that if a conflict occures, a party wants to be called back, to possibly prevent this conflict. This callback is done by the Method decideSecurityGoal() .
An application can adapt its security configuration before the requested negotiation starts. The method negotiationRequestReceived() is called, when a negotiation request from the partner was received, but before the negotiation of security parameters starts. Objects which are interested in the state of the connection associated with a SSONET(Server)ClientSocket implement this interface. Usually these objects register themselves to the corresponding SSONETContext.
Simple example:

    public synchronized void connectionStateChanged(SSONETContext context,
                                                        int currentState)
        {
                if (currentState == RUNNING_STATE) notifyAll();
        }
        public synchronized void waitRunning(SSONETClientSocket s) {
                SSONETContext context = s.getContext();
                context.addConnectionListener(this);
                while (context.getConnectionState()!=RUNNING_STATE) {
                        // wait for notify in connectionStateChanged
                        try { wait(); } catch (InterruptedException ie) {}
                        // allow connectionStateChanged to finish
                        // avoids ConcurrentModificationException in the contexts
                        //   listeners-list, if no other ConnectionListener is registered
                        Thread.currentThread().yield();
                }
                context.removeConnectionListener(this);
        }

Author:
Sebastian Clauß

Field Summary
static int FINISHED_STATE
           
static int INIT_STATE
           
static int MECHANISMS_NEGOTIATION
           
static int NOT_STARTED_STATE
           
static int RUNNING_STATE
           
static int SECURITY_GOAL_NEGOTIATION
           
 
Method Summary
 void connectionStateChanged(org.ssonet.net.SSONETContext context, int currentState)
          When the connection state has changed, this method reports the current state.
 boolean decideSecurityGoal(int securityGoal, org.ssonet.net.ActionConfiguration ownConfiguration, org.ssonet.net.SSONETContext context)
          This method must decide, wether a user wants to give in in a security goal negotiation conflict, or not.
 void negotiationRequestReceived(org.ssonet.net.SSONETContext context, int negotiationType)
          The method negotiationRequestReceived() is called by SSONETProtocolStream , when a request for a security goal and mechanisms negotiation, or only a mechanisms negotiation was received, but before the negotiation of security parameters starts.
 

Field Detail

NOT_STARTED_STATE

public static final int NOT_STARTED_STATE
See Also:
Constant Field Values

INIT_STATE

public static final int INIT_STATE
See Also:
Constant Field Values

RUNNING_STATE

public static final int RUNNING_STATE
See Also:
Constant Field Values

FINISHED_STATE

public static final int FINISHED_STATE
See Also:
Constant Field Values

SECURITY_GOAL_NEGOTIATION

public static final int SECURITY_GOAL_NEGOTIATION
See Also:
Constant Field Values

MECHANISMS_NEGOTIATION

public static final int MECHANISMS_NEGOTIATION
See Also:
Constant Field Values
Method Detail

negotiationRequestReceived

public void negotiationRequestReceived(org.ssonet.net.SSONETContext context,
                                       int negotiationType)
The method negotiationRequestReceived() is called by SSONETProtocolStream , when a request for a security goal and mechanisms negotiation, or only a mechanisms negotiation was received, but before the negotiation of security parameters starts.

Parameters:
context - the SSONETContext used by the server for this request.
negotiationType - SECURITY_GOAL_NEGOTIATION if the negotiation requested is a security goal (and mechanisms) negotiation,

MECHANISMS_NEGOTIATION if the negotiation requested is only a mechanisms negotiation.


connectionStateChanged

public void connectionStateChanged(org.ssonet.net.SSONETContext context,
                                   int currentState)
When the connection state has changed, this method reports the current state.


decideSecurityGoal

public boolean decideSecurityGoal(int securityGoal,
                                  org.ssonet.net.ActionConfiguration ownConfiguration,
                                  org.ssonet.net.SSONETContext context)
This method must decide, wether a user wants to give in in a security goal negotiation conflict, or not.

Parameters:
securityGoal - the security goal to decide on, the security goals are defined in class ssonet.SSONETConstants.
ownConfiguration - the ActionConfiguration object of the user. This holds the actual security goal configuration.
context - informations about the communication partner.
Returns:
true, if he gives in, false otherwise.


Copyright © 2003 DRIM Team. All Rights Reserved.