com.sapportals.wcm.util.events

Interface IEventBroker

All Known Subinterfaces:
IResourceEventBroker, ITransactionalEventBroker
All Known Implementing Classes:
OverallResourceEventBroker

public interface IEventBroker

The event broker is a mediator between event senders (IEventSender) and receivers (IEventReceiver). All senders and receivers must register themselfs with a broker. All receivers will receive events from all senders but it is possible to register for different event "templates" (event class and type). Usually a sender will instanciate its own broker and register itself.

Copyright (c) SAP AG 2001-2002


Field Summary
static int PRIO_MAX
           
static int PRIO_MIN
           
 
Method Summary
 IEventList clearHoldEvents(IEventReceiver receiver)
           
 IEventList getEvents()
           
 IEventList getHoldEvents(IEventReceiver receiver)
           
 SenderMode getMode(IEventReceiver receiver)
           
 void hold(IEventReceiver receiver, boolean collect)
           
 void register(IEventReceiver receiver, IEvent template)
          Registers an event receiver.
 void register(IEventReceiver receiver, IEvent template, IEventMapper mapping)
          See the general contract of the register(IEventReceiver, IEvent) method.
 void register(IEventReceiver receiver, IEvent template, IEventMapper mapping, int priority, boolean async)
          See the general contract of the register(IEventReceiver, IEvent) method.
 void register(IEventReceiver receiver, IEvent template, int priority, boolean async)
          See the general contract of the register(IEventReceiver, IEvent) method.
 void register(IEventSender sender)
          Registers an event sender instance.
 void resume(IEventReceiver receiver)
          Resumes a previously suspended event receiver.
 void send(IEvent event, IEventSender sender)
          Sends the specified event to all receivers that have registered for this kind of event.
 void suspend(IEventReceiver receiver)
          Suspend the event receiver.
 void unregister(IEventReceiver receiver, IEvent template)
          Unregisters an event receiver/template tuple.
 void unregister(IEventSender sender)
          Unregisteres the event sender instance.
 

Field Detail

PRIO_MAX

public static final int PRIO_MAX
See Also:
Constant Field Values

PRIO_MIN

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

send

public void send(IEvent event,
                 IEventSender sender)
          throws WcmException
Sends the specified event to all receivers that have registered for this kind of event.

Parameters:
event - The event so send.
sender - The event sended instance (the caller).
Throws:
WcmException - If the event sender is not registered.

register

public void register(IEventSender sender)
              throws WcmException
Registers an event sender instance.

Parameters:
sender - The event sender.
Throws:
WcmException - Exception raised in failure situation

register

public void register(IEventReceiver receiver,
                     IEvent template)
              throws WcmException
Registers an event receiver. The receiver will only receive events which match the template event. This depends on the matching rules imlemented in the events IEvent.isLike(IEvent) method. Usually the event's instance and type are relevant.

It is allowed to register the same event receiver instance several times with different templates.

Parameters:
receiver - The event receiver to register
template - The event template
Throws:
WcmException

register

public void register(IEventReceiver receiver,
                     IEvent template,
                     IEventMapper mapping)
              throws WcmException
See the general contract of the register(IEventReceiver, IEvent) method. This regstration method has an additional IEventMapper argument.

Parameters:
receiver - The event receiver to register
template - The event template
mapping - The event mapper
Throws:
WcmException
See Also:
IEventMapper

register

public void register(IEventReceiver receiver,
                     IEvent template,
                     int priority,
                     boolean async)
              throws WcmException
See the general contract of the register(IEventReceiver, IEvent) method. This regstration method has two additional arguments for priority and asynchronous events.

The priority controls the order of multible receivers which have registered for the same event(s). Receivers with higher priority (smaller values) will receive an event before receivers with lower priority (greater values).

An event receiver can choose to receive events asynchronously. This means that a dedicated event queue and sender thread is created for each receiver and template. The event sender will not be blocked, that means the send() method puts the event into the queue and returns immediatelly.

Parameters:
receiver - The event receiver to register
template - The event template
priority - The priority of this receiver and template.
async - If true, the receiver will receive the events on a seperate thread.
Throws:
WcmException

register

public void register(IEventReceiver receiver,
                     IEvent template,
                     IEventMapper mapping,
                     int priority,
                     boolean async)
              throws WcmException
See the general contract of the register(IEventReceiver, IEvent) method.

Parameters:
receiver - The event receiver to register
template - The event template
mapping - The event mapper
priority - The priority of this receiver and template.
async - If true, the receiver will receive the events on a seperate thread.
Throws:
WcmException
See Also:
register(IEventReceiver, IEvent, IEventMapper), register(IEventReceiver, IEvent, int, boolean)

unregister

public void unregister(IEventSender sender)
                throws WcmException
Unregisteres the event sender instance.

Parameters:
sender - The event sender to unregister
Throws:
WcmException

unregister

public void unregister(IEventReceiver receiver,
                       IEvent template)
                throws WcmException
Unregisters an event receiver/template tuple.

Parameters:
receiver - The event receiver
template - The event template
Throws:
WcmException

suspend

public void suspend(IEventReceiver receiver)
Suspend the event receiver. The broker will stop delivering any events until resume(IEventReceiver) is called.

Parameters:
receiver - The receiver to suspend

resume

public void resume(IEventReceiver receiver)
Resumes a previously suspended event receiver. The broker will continue delivering events to the receiver.

Parameters:
receiver - The receiver to resume

hold

public void hold(IEventReceiver receiver,
                 boolean collect)

getMode

public SenderMode getMode(IEventReceiver receiver)

getHoldEvents

public IEventList getHoldEvents(IEventReceiver receiver)

clearHoldEvents

public IEventList clearHoldEvents(IEventReceiver receiver)

getEvents

public IEventList getEvents()


Copyright 2006 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts Institute of Technology. Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. MaxDB is a trademark of MySQL AB, Sweden. SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary. These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.