net.sf.jradius.handler
Class EventHandlerBase

java.lang.Object
  extended by net.sf.jradius.handler.EventHandlerBase
All Implemented Interfaces:
JRCommand, EventHandler, org.apache.commons.chain.Command
Direct Known Subclasses:
EventHandlerChain, HandlerLogHandler, PacketHandlerBase, SessionExpiredHandler, SSOProxyService

public abstract class EventHandlerBase
extends java.lang.Object
implements EventHandler

The base abstract class of all Event Handlers (the base of all handles)

Author:
David Bird, Gert Jan Verhoog

Field Summary
protected  HandlerConfigurationItem config
           
 
Constructor Summary
EventHandlerBase()
           
 
Method Summary
 boolean doesHandle(JRadiusEvent event)
          Tests whether or not this handler handles the given JRadiusEvent.
 boolean execute(org.apache.commons.chain.Context context)
           
 java.lang.String getName()
           
abstract  boolean handle(JRadiusEvent event)
           
 void setConfig(ConfigurationItem cfg)
          Set the ConfigurationItem of this handler.
 void setName(java.lang.String name)
           
protected  java.lang.String[] splitUserName(java.lang.String username)
          Split the User-Name into username plus realm (checks for prefix realm first - realm/username, then postfix realms - username@realm)
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

config

protected HandlerConfigurationItem config
Constructor Detail

EventHandlerBase

public EventHandlerBase()
Method Detail

setConfig

public void setConfig(ConfigurationItem cfg)
Description copied from interface: JRCommand
Set the ConfigurationItem of this handler. All JRadius handlers have an associated HandlerConfigurationItem associated with it.

Specified by:
setConfig in interface JRCommand
Parameters:
cfg - The HandlerConfigurationItem to be set

doesHandle

public boolean doesHandle(JRadiusEvent event)
Description copied from interface: JRCommand
Tests whether or not this handler handles the given JRadiusEvent.

Specified by:
doesHandle in interface JRCommand
Parameters:
event - The JRadiusEvent (or JRadiusRequest) to be checked
Returns:
Returns true if this handler should handle the given event

handle

public abstract boolean handle(JRadiusEvent event)
                        throws java.lang.Exception
Specified by:
handle in interface EventHandler
Throws:
java.lang.Exception

execute

public boolean execute(org.apache.commons.chain.Context context)
                throws java.lang.Exception
Specified by:
execute in interface org.apache.commons.chain.Command
Throws:
java.lang.Exception

getName

public java.lang.String getName()
Specified by:
getName in interface JRCommand
Returns:
Returns the name of the handler (as defined in the configuration)

setName

public void setName(java.lang.String name)
Specified by:
setName in interface EventHandler

splitUserName

protected java.lang.String[] splitUserName(java.lang.String username)
Split the User-Name into username plus realm (checks for prefix realm first - realm/username, then postfix realms - username@realm)

Parameters:
username - The username to parse
Returns:
Returns an array of 2 Strings { username, realm } if a realm is found, otherwise it returns null


Copyright © 2006 The JRadius Project, All Rights Reserved.