Allow listeners to throw exceptions from within hooks.

This commit is contained in:
Michael Jumper
2012-03-23 12:13:54 -07:00
parent fc6750da00
commit 837614800d
4 changed files with 26 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
package net.sourceforge.guacamole.net.event.listener; package net.sourceforge.guacamole.net.event.listener;
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.net.event.AuthenticationFailureEvent; import net.sourceforge.guacamole.net.event.AuthenticationFailureEvent;
/** /**
@@ -17,7 +18,12 @@ public interface AuthenticationFailureListener {
* *
* @param e The AuthenticationFailureEvent describing the authentication * @param e The AuthenticationFailureEvent describing the authentication
* failure that just occurred. * failure that just occurred.
* @throws GuacamoleException If an error occurs while handling the
* authentication failure event. Note that
* throwing an exception will NOT cause the
* authentication failure to be canceled.
*/ */
public void authenticationFailed(AuthenticationFailureEvent e); public void authenticationFailed(AuthenticationFailureEvent e)
throws GuacamoleException;
} }

View File

@@ -1,5 +1,6 @@
package net.sourceforge.guacamole.net.event.listener; package net.sourceforge.guacamole.net.event.listener;
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.net.event.AuthenticationSuccessEvent; import net.sourceforge.guacamole.net.event.AuthenticationSuccessEvent;
/** /**
@@ -22,7 +23,12 @@ public interface AuthenticationSuccessListener {
* @return true if the successful authentication attempt should be * @return true if the successful authentication attempt should be
* allowed, or false if the attempt should be denied, causing * allowed, or false if the attempt should be denied, causing
* the attempt to effectively fail. * the attempt to effectively fail.
* @throws GuacamoleException If an error occurs while handling the
* authentication success event. Throwing an
* exception will also cancel the authentication
* success.
*/ */
public boolean authenticationSucceeded(AuthenticationSuccessEvent e); public boolean authenticationSucceeded(AuthenticationSuccessEvent e)
throws GuacamoleException;
} }

View File

@@ -1,5 +1,6 @@
package net.sourceforge.guacamole.net.event.listener; package net.sourceforge.guacamole.net.event.listener;
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.net.event.TunnelAttachEvent; import net.sourceforge.guacamole.net.event.TunnelAttachEvent;
/** /**
@@ -20,7 +21,11 @@ public interface TunnelAttachListener {
* @return true if the tunnel should be allowed to be attached, or false * @return true if the tunnel should be allowed to be attached, or false
* if the attempt should be denied, causing the attempt to * if the attempt should be denied, causing the attempt to
* effectively fail. * effectively fail.
* @throws GuacamoleException If an error occurs while handling the
* tunnel attach event. Throwing an exception
* will also stop the tunnel from being attached.
*/ */
public boolean tunnelAttached(TunnelAttachEvent e); public boolean tunnelAttached(TunnelAttachEvent e)
throws GuacamoleException;
} }

View File

@@ -1,5 +1,6 @@
package net.sourceforge.guacamole.net.event.listener; package net.sourceforge.guacamole.net.event.listener;
import net.sourceforge.guacamole.GuacamoleException;
import net.sourceforge.guacamole.net.event.TunnelDetachEvent; import net.sourceforge.guacamole.net.event.TunnelDetachEvent;
/** /**
@@ -20,7 +21,11 @@ public interface TunnelDetachListener {
* @return true if the tunnel should be allowed to be detached, or false * @return true if the tunnel should be allowed to be detached, or false
* if the attempt should be denied, causing the attempt to * if the attempt should be denied, causing the attempt to
* effectively fail. * effectively fail.
* @throws GuacamoleException If an error occurs while handling the
* tunnel detach event. Throwing an exception
* will also stop the tunnel from being detached.
*/ */
public boolean tunnelDetached(TunnelDetachEvent e); public boolean tunnelDetached(TunnelDetachEvent e)
throws GuacamoleException;
} }