org.openuat.authentication
Class AuthenticationEventSender

java.lang.Object
  extended by org.openuat.authentication.AuthenticationEventSender
Direct Known Subclasses:
BluetoothOpportunisticConnector, CKPOverUDP, DHWithVerification, DongleProtocolHandler, HostProtocolHandler, HostServerBase, KeyManager

public abstract class AuthenticationEventSender
extends java.lang.Object

This is an abstract class to encapsulate the notion of an authentication event sender. The basic capability is to send events about the the progress of the respective authentication, i.e. AuthenticationSuccess, AuthenticationFailure and AuthenticationProgress events.

Version:
1.0
Author:
Rene Mayrhofer

Field Summary
protected  java.util.Vector eventsHandlers
          The list of listeners that are notified of authentication events.
 
Constructor Summary
AuthenticationEventSender()
           
 
Method Summary
 void addAuthenticationProgressHandler(AuthenticationProgressHandler h)
          Register a listener for receiving events.
protected  void raiseAuthenticationFailureEvent(java.lang.Object remote, java.lang.Exception e, java.lang.String msg)
          Helper method for sending an AuthenticationFailure event to all registered listeners (if any).
protected  void raiseAuthenticationProgressEvent(java.lang.Object remote, int cur, int max, java.lang.String msg)
          Helper method for sending an AuthenticationProgress event to all registered listeners (if any).
protected  boolean raiseAuthenticationStartedEvent(java.lang.Object remote)
          Helper method for sending an AuthenticationStarted event to all registered listeners (if any).
protected  void raiseAuthenticationSuccessEvent(java.lang.Object remote, java.lang.Object result)
          Helper method for sending an AuthenticationSuccess event to all registered listeners (if any).
 boolean removeAuthenticationProgressHandler(AuthenticationProgressHandler h)
          De-register a listener for receiving events.
 boolean setAuthenticationProgressHandlers(java.util.Vector handlers)
          Set the list of registered handlers, if none has been registered so far.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

eventsHandlers

protected java.util.Vector eventsHandlers
The list of listeners that are notified of authentication events.

Constructor Detail

AuthenticationEventSender

public AuthenticationEventSender()
Method Detail

addAuthenticationProgressHandler

public void addAuthenticationProgressHandler(AuthenticationProgressHandler h)
Register a listener for receiving events.


removeAuthenticationProgressHandler

public boolean removeAuthenticationProgressHandler(AuthenticationProgressHandler h)
De-register a listener for receiving events.


setAuthenticationProgressHandlers

public boolean setAuthenticationProgressHandlers(java.util.Vector handlers)
Set the list of registered handlers, if none has been registered so far. This should only be used for initialization and will not do anything if any listener has been registered before.

Parameters:
handlers - The list of events handlers to use. Elements of the vector must be of type AuthenticationProgressHandler.
Returns:
true if the list was set, false otherwise (when any listener has been registered before, the list will not be overwritten).

raiseAuthenticationSuccessEvent

protected void raiseAuthenticationSuccessEvent(java.lang.Object remote,
                                               java.lang.Object result)
Helper method for sending an AuthenticationSuccess event to all registered listeners (if any).


raiseAuthenticationFailureEvent

protected void raiseAuthenticationFailureEvent(java.lang.Object remote,
                                               java.lang.Exception e,
                                               java.lang.String msg)
Helper method for sending an AuthenticationFailure event to all registered listeners (if any).


raiseAuthenticationProgressEvent

protected void raiseAuthenticationProgressEvent(java.lang.Object remote,
                                                int cur,
                                                int max,
                                                java.lang.String msg)
Helper method for sending an AuthenticationProgress event to all registered listeners (if any).


raiseAuthenticationStartedEvent

protected boolean raiseAuthenticationStartedEvent(java.lang.Object remote)
Helper method for sending an AuthenticationStarted event to all registered listeners (if any).



2005-2009, Rene Mayrhofer.