The IScenarioService interface
To use the ScenarioService in its basic form, an application needs to create an object that implements the IScenarioService interface by using the ScenarioServiceFactory method createScenarioService(). The recommended usage is to pass a listener to the factory method so that the application is notified of all scenarios in the correlator as they are discovered. If a listener is not passed directly to the factory, the application must perform the following steps in this precise order to guarantee it sees all scenarios:
1. Obtain an instance of the service via one of the static methods of ScenarioServiceFactory.
2. Add one or more listeners so that the application will be notified of new scenarios as they are added.
3. The application should call either getScenarios(), getScenarioIds(), or getScenarioNames() to discover any scenarios that the service discovered before the application listener was added.
Application listeners receive
PropertyChangeEvents from this interface. Notifications are available when scenarios are added or removed from the correlator, when a ScenarioService support monitor is unloaded from the correlator, and when the status of the scenario discovery mechanism is changed. For more information on
PropertyChangeEvents, refer to the
Javadoc documentation.
Classes that implement the IScenarioService interface have the following methods:
void addListener(java.beans.PropertyChangeListener listener) Add a PropertyChangeListener that will be notified of changes to any bound property of this object.
void addListener() — defined as:
void addListener(
java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Add a PropertyChangeListener that will be notified of changes to a specific named bound property of this object.
void destroy() Destroy this service and clean up resources.
java.util.Map<String, Object> getConfig() Get the configuration properties that define the requested operating semantics of this instance of the service.
DiscoveryStatusEnum getDiscoveryStatus() Get the status of the internal scenario discovery process.
IEventService getEventService() Get the underlying EventService that is being used by this ScenarioService.
IScenarioDefinition getScenarioById(java.lang.String scenarioId) Get a ScenarioDefinition for a specific scenario, using the ScenarioId as the lookup key.
IScenarioDefinition getScenarioByName(java.lang.String scenarioDisplayName) Get a ScenarioDefinition for a specific scenario, using the Display Name as the lookup key.
java.util.Set<Long> getScenarioIds() Get the IDs of all known scenarios (not instances) in the correlator.
java.util.Set<String> getScenarioNames() Get the Display Names of all known scenarios (not instances) in the correlator.
java.util.List<IScenarioDefinition> getScenarios() Get the ScenarioDefinitions of all known scenarios in the correlator.
boolean isDestroyed() Determine if this service is destroyed.
void removeListener(java.beans.PropertyChangeListener listener) Remove a PropertyChangeListener that was to be notified of changes to any bound property of this object.
void removeListener() — defined as:
void removeListener(
java.lang.String propertyName,
java.beans.PropertyChangeListener listener)
Remove a PropertyChangeListener that was to be notified of changes to a specific named bound property of this object.