org.enhydra.barracuda.core.event
Class DefaultEventGateway

java.lang.Object
  extended byorg.enhydra.barracuda.core.event.DefaultEventGateway
All Implemented Interfaces:
EventGateway
Direct Known Subclasses:
BarracudaAdmin, BarracudaConfig, CompConfig, DataConfig, DataObjectGateway, DomConfig, EventConfig, FormsConfig, GlobalUtilities, LocalUtilities, LoginScreen, LongRunningEventGateway, MainScreen, MasterConfig, RenderPageEventGateway, SampleScreen, TemplateTableScreen, TestScreen, UtilConfig, ViewConfig

public class DefaultEventGateway
extends Object
implements EventGateway

Default implementation of an EventGateway. An event gateway just indicates that the class has an interest in events, and as such needs access to the EventBroker in order to register its listeners there.


Constructor Summary
DefaultEventGateway()
           
 
Method Summary
 void add(EventGateway eg)
          Add an event gateway to this one
 void deregister(EventBroker eb)
          Ask all interested parties to de-register with the EventBroker
 void deregisterLocalEventInterests(EventBroker eb)
          Deregister any local interests in the EventBroker
 List getChildren()
          Get a list of child gateways.
 EventGateway getParent()
          Get the parent event gateway.
protected static void print(org.apache.log4j.Logger extLogger, OutputStream out, String s)
           
 void printStackTrace(int depth, org.apache.log4j.Logger extLogger)
          For debugging purposes.
 void printStackTrace(int depth, OutputStream out)
          For debugging purposes.
 void register(EventBroker eb)
          Ask all interested parties to register with the EventBroker
 void registerLocalEventAliases(EventBroker eb)
          Register any local event aliases in the EventBroker
 void registerLocalEventInterests(EventBroker eb)
          Register any local interests in the EventBroker
 void remove(EventGateway eg)
          Remove an event gateway from this one
 void setParent(EventGateway eg)
          Set the parent event gateway.
 void specifyLocalEventAliases(Class event)
          Rather than overriding the registerLocalEventAliases method, you can just invoke this method instead for type of event you want to manually alias.
 void specifyLocalEventInterests(ListenerFactory factory)
          Rather than overriding the registerLocalEventInterests method, you can just invoke this method instead for each interest you'd like to register.
 void specifyLocalEventInterests(ListenerFactory factory, Class event)
          Rather than overriding the registerLocalEventInterests method, you can just invoke this method instead for each interest you'd like to register.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultEventGateway

public DefaultEventGateway()
Method Detail

setParent

public final void setParent(EventGateway eg)
Set the parent event gateway. Null indicates its the root.

Specified by:
setParent in interface EventGateway
Parameters:
eg - the parent event gateway

getParent

public final EventGateway getParent()
Get the parent event gateway. Returns null if it's the root.

Specified by:
getParent in interface EventGateway
Returns:
the parent event gateway

add

public final void add(EventGateway eg)
Add an event gateway to this one

Specified by:
add in interface EventGateway
Parameters:
eg - the event gateway to be added

remove

public final void remove(EventGateway eg)
Remove an event gateway from this one

Specified by:
remove in interface EventGateway
Parameters:
eg - the event gateway to be removed

getChildren

public List getChildren()
Get a list of child gateways. The list returned is a copy of the underlying child gateway list.

Specified by:
getChildren in interface EventGateway
Returns:
a list of child gateways

register

public final void register(EventBroker eb)
Ask all interested parties to register with the EventBroker

Specified by:
register in interface EventGateway
Parameters:
eb - the event broker this gateway should use to register for events

registerLocalEventInterests

public void registerLocalEventInterests(EventBroker eb)
Register any local interests in the EventBroker

Specified by:
registerLocalEventInterests in interface EventGateway
Parameters:
eb - the event broker this gateway should use to register for local events

registerLocalEventAliases

public void registerLocalEventAliases(EventBroker eb)
Register any local event aliases in the EventBroker

Specified by:
registerLocalEventAliases in interface EventGateway
Parameters:
eb - the event broker this gateway should use to register aliases for local events

specifyLocalEventInterests

public final void specifyLocalEventInterests(ListenerFactory factory)
Rather than overriding the registerLocalEventInterests method, you can just invoke this method instead for each interest you'd like to register. The gateway will keep track of all factories specified, and register/deregister when appropriate (so you don't have to worry about it). Notice that this method registers just the listener id (not for a specific class of event). The only real reason for using the registerLocalEventInterests method would be if you actually need access to the EventBroker. Note that if the event class is not an instance of BaseEvent, the request is just silently ignored (unlike the event broker, which throws an exception).

Specified by:
specifyLocalEventInterests in interface EventGateway
Parameters:
factory - the factory we wish to register with the event broker

specifyLocalEventInterests

public final void specifyLocalEventInterests(ListenerFactory factory,
                                             Class event)
Rather than overriding the registerLocalEventInterests method, you can just invoke this method instead for each interest you'd like to register. The gateway will keep track of all factories specified, and register/deregister when appropriate (so you don't have to worry about it). The only real reason for using the registerLocalEventInterests method would be if you actually need access to the EventBroker. Note that if the event class is not an instance of BaseEvent, the request is just silently ignored (unlike the event broker, which throws an exception).

Specified by:
specifyLocalEventInterests in interface EventGateway
Parameters:
factory - the factory we wish to register with the event broker
event - the class of events we are interested in

specifyLocalEventAliases

public final void specifyLocalEventAliases(Class event)
Rather than overriding the registerLocalEventAliases method, you can just invoke this method instead for type of event you want to manually alias. The only real reason for using the registerLocalEventAliases method would be if you actually need access to the EventBroker. Note that if the event class is not an instance of BaseEvent, the request is just silently ignored (unlike the event broker, which throws an exception).

Specified by:
specifyLocalEventAliases in interface EventGateway
Parameters:
event - the class of events we are interested in registering aliases for

deregister

public final void deregister(EventBroker eb)
Ask all interested parties to de-register with the EventBroker

Specified by:
deregister in interface EventGateway
Parameters:
eb - the event broker this gateway should use to de-register for events

deregisterLocalEventInterests

public void deregisterLocalEventInterests(EventBroker eb)
Deregister any local interests in the EventBroker

Specified by:
deregisterLocalEventInterests in interface EventGateway
Parameters:
eb - the event broker this gateway should use to de-register for local events

printStackTrace

public void printStackTrace(int depth,
                            org.apache.log4j.Logger extLogger)
For debugging purposes. Print the basic structure of the gateway.


printStackTrace

public void printStackTrace(int depth,
                            OutputStream out)
For debugging purposes. Print the basic structure of the gateway.


print

protected static void print(org.apache.log4j.Logger extLogger,
                            OutputStream out,
                            String s)


Copyright © 2003 BarracudaMVC.org All Rights Reserved.