com.objectplanet.survey.plugin
Class PluginBusSurvey

java.lang.Object
  |
  +--com.objectplanet.survey.plugin.PluginBusSurvey

public class PluginBusSurvey
extends java.lang.Object

This class is opinio's event notification mechanism for survey type events. To enhance performance and scalability, the component that is registered on the bus can subscribe to events for a single survey, or to all surveys. Subscribing to all surveys (indicating the survey id 0) should be done with care, because the plugin must then handle a lot of events (several events per question per respondent).

Author:
Torgeir Punnerud
Created:
26. august 2002

Constructor Summary
PluginBusSurvey()
           
 
Method Summary
static void addToBus(IPBComponent comp, long surveyId)
          Adds a component to the bus.
static IPBComponent[] getComponents(long surveyId)
          Returns an array of all components connected to the specific survey bus.
static void removeFromBus(IPBComponent comp, long surveyId)
          Removes a component from the bus.
static void send(PluginBusEvent event, long surveyId)
          Sends an event to all components on the bus.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginBusSurvey

public PluginBusSurvey()
Method Detail

getComponents

public static IPBComponent[] getComponents(long surveyId)
Returns an array of all components connected to the specific survey bus.

Parameters:
surveyId - Survey id of the plugin bus to get. 0 will return components that have registered to receive all events.
Returns:
The components value

addToBus

public static void addToBus(IPBComponent comp,
                            long surveyId)
Adds a component to the bus. It will receive all events sent on the bus.

Parameters:
comp - The component to add
surveyId - The feature to be added to the ToBus attribute

removeFromBus

public static void removeFromBus(IPBComponent comp,
                                 long surveyId)
Removes a component from the bus.

Parameters:
comp - The component to remove
surveyId - Survey id of the survey to receive events from. 0 (zero) specifies all surveys. Use the value 0 with care, because this may reduce performance of the application.

send

public static void send(PluginBusEvent event,
                        long surveyId)
Sends an event to all components on the bus. The event will be sent to all components in turn, with the original sender receiving it last.

Parameters:
event - The event
surveyId - Sends events to all listening plugins.

Copyright © ObjectPlanet Inc. All Rights Reserved.

Built on May 7 2003