Interface IScenarioDefinition


  • public interface IScenarioDefinition
    IScenarioDefinition supports creating instances of a scenario, listening for added/removed/changed instances, and getting the information about the scenario definition itself (for example id, display name, input/output parameter names and types).
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Interface Description
      static class  IScenarioDefinition.ScenarioType
      Enumeration used to distinguish between different kinds of scenario definition.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String EXTRA_PARAMS_METADATA_PREFIX
      Prefix for identifying metadata entries in the extra parameters map returned by getExtraParams().
      static java.lang.String PROPERTY_INSTANCE_ADDED
      Property name for events fired that signal a new ScenarioInstance has been added.
      static java.lang.String PROPERTY_INSTANCE_DIED
      Property name for events fired that signal a ScenarioInstance has died unexpectedly.
      static java.lang.String PROPERTY_INSTANCE_DISCOVERY_STATUS
      Property name for events fired that signal the status of the internal mechanism for discovering scenario instances in the Correlator.
      static java.lang.String PROPERTY_INSTANCE_EDITED
      Property name for events fired that signal a ScenarioInstance has been edited.
      static java.lang.String PROPERTY_INSTANCE_REMOVED
      Property name for events fired that signal an existing ScenarioInstance has been removed.
      static java.lang.String PROPERTY_INSTANCE_STATE_CHANGE
      Property name for events fired that signal an existing ScenarioInstance has changed state.
      static java.lang.String PROPERTY_INSTANCE_UPDATED
      Property name for events fired that signal a ScenarioInstance has been updated.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void addListener​(java.beans.PropertyChangeListener listener)
      Add a PropertyChangeListener that will be notified of changes to any bound property of this object.
      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.
      IScenarioInstance createInstance​(java.lang.String owner)
      Create a new instance of this scenario, using default values for all input parameters.
      IScenarioInstance createInstance​(java.lang.String owner, java.util.Map<java.lang.String,​java.lang.Object> inputParameters)
      Create a new instance of this scenario, with the supplied values for input parameters.
      IScenarioInstance createInstance​(java.lang.String owner, java.util.Map<java.lang.String,​java.lang.Object> inputParameters, java.beans.PropertyChangeListener listener)
      Create a new instance of this Scenario, with the supplied values for input parameters, and atomically add a listener.
      IScenarioInstance createInstance​(java.lang.String owner, java.util.Map<java.lang.String,​java.lang.Object> inputParameters, java.lang.String property, java.beans.PropertyChangeListener listener)
      Create a new instance of this Scenario, with the supplied values for input parameters, and atomically add a listener.
      java.lang.String getDescription()
      Get the description of the scenario.
      DiscoveryStatusEnum getDiscoveryStatus()
      Get the status of the internal scenario instance discovery process.
      java.lang.String getDisplayName()
      Get the display name of the scenario.
      java.util.Map<java.lang.String,​java.lang.String> getExtraParams()
      Return the read-only map of extra parameters.
      java.lang.String getId()
      Get the ID of the scenario definition, which is unique within the correlator.
      java.util.List<java.lang.String> getInputParameterConstraints()
      Get the constraints of all input parameters for the scenario.
      java.util.List<java.lang.Object> getInputParameterDefaults()
      Get the default values of all input parameters for the scenario.
      java.util.Set<java.lang.String> getInputParameterNames()
      Get the names of all input parameters for the scenario.
      java.util.List<ParameterTypeEnum> getInputParameterTypes()
      Get the types of all input parameters for the scenario.
      IScenarioInstance getInstance​(long instanceId)
      Get a single specific instance of this scenario, by instance ID.
      java.util.List<IScenarioInstance> getInstances()
      Get all instances of this scenario.
      java.util.List<IScenarioInstance> getInstancesForOwner​(java.lang.String owner)
      Get all instances of this scenario for a specific owner.
      java.util.Set<java.lang.String> getOutputParameterNames()
      Get the names of all output parameters for the scenario.
      java.util.List<ParameterTypeEnum> getOutputParameterTypes()
      Get the types of all output parameters for the scenario.
      IScenarioDefinition.ScenarioType getType()
      Return the type of Scenario (i.e.
      boolean isInputParameter​(java.lang.String parameterName)
      Test if a specific named parameter is an input parameter.
      boolean isOutputParameter​(java.lang.String parameterName)
      Test if a specific named parameter is an output parameter.
      boolean isReadOnly()
      Return if the Scenario is read only or can have instances created, edited and deleted.
      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​(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.
      void requestInstances()
      Initiate requesting instances.
    • Field Detail

      • PROPERTY_INSTANCE_ADDED

        static final java.lang.String PROPERTY_INSTANCE_ADDED
        Property name for events fired that signal a new ScenarioInstance has been added.
        See Also:
        Constant Field Values
      • PROPERTY_INSTANCE_DIED

        static final java.lang.String PROPERTY_INSTANCE_DIED
        Property name for events fired that signal a ScenarioInstance has died unexpectedly.
        See Also:
        Constant Field Values
      • PROPERTY_INSTANCE_EDITED

        static final java.lang.String PROPERTY_INSTANCE_EDITED
        Property name for events fired that signal a ScenarioInstance has been edited.
        See Also:
        Constant Field Values
      • PROPERTY_INSTANCE_UPDATED

        static final java.lang.String PROPERTY_INSTANCE_UPDATED
        Property name for events fired that signal a ScenarioInstance has been updated.
        See Also:
        Constant Field Values
      • PROPERTY_INSTANCE_REMOVED

        static final java.lang.String PROPERTY_INSTANCE_REMOVED
        Property name for events fired that signal an existing ScenarioInstance has been removed.
        See Also:
        Constant Field Values
      • PROPERTY_INSTANCE_STATE_CHANGE

        static final java.lang.String PROPERTY_INSTANCE_STATE_CHANGE
        Property name for events fired that signal an existing ScenarioInstance has changed state.
        See Also:
        InstanceStateEnum, Constant Field Values
      • PROPERTY_INSTANCE_DISCOVERY_STATUS

        static final java.lang.String PROPERTY_INSTANCE_DISCOVERY_STATUS
        Property name for events fired that signal the status of the internal mechanism for discovering scenario instances in the Correlator.
        See Also:
        DiscoveryStatusEnum, Constant Field Values
      • EXTRA_PARAMS_METADATA_PREFIX

        static final java.lang.String EXTRA_PARAMS_METADATA_PREFIX
        Prefix for identifying metadata entries in the extra parameters map returned by getExtraParams(). Entries with key names prefixed by the EXTRA_PARAMS_METADATA_PREFIX string are considered metadata entries.
        See Also:
        getExtraParams(), Constant Field Values
    • Method Detail

      • getDiscoveryStatus

        DiscoveryStatusEnum getDiscoveryStatus()
        Get the status of the internal scenario instance discovery process.
        Returns:
        a static instance of the enum class DiscoveryStatusEnum to indicate the status.
      • requestInstances

        void requestInstances()
        Initiate requesting instances. This is called automatically when the scenario is discovered after creating the scenario service after listeners on the service have been fired unless the IScenarioService.CONFIG_AUTO_INSTANCE_DISCOVERY is set to false. If the discovery status is not PENDING, this is a no-op.
      • getId

        java.lang.String getId()
        Get the ID of the scenario definition, which is unique within the correlator.

        Returns:
        The unique ID for this scenario definition, for example "DV_MyDataView".
      • getDisplayName

        java.lang.String getDisplayName()
        Get the display name of the scenario.
        Returns:
        The display name.
      • getDescription

        java.lang.String getDescription()
        Get the description of the scenario. This is not a formal description, but a human readable description provided by the scenario author.
        Returns:
        The human readable description.
      • getInstances

        java.util.List<IScenarioInstance> getInstances()
        Get all instances of this scenario.

        The returned List is a shallow copy (new List) of the instances.

        Returns:
        The read-only List (possibly empty) of all instances of this scenario. Each item is an IScenarioInstance.
      • getInstance

        IScenarioInstance getInstance​(long instanceId)
        Get a single specific instance of this scenario, by instance ID.
        Parameters:
        instanceId - The ID of the required instance.
        Returns:
        The specific instance.
      • getInstancesForOwner

        java.util.List<IScenarioInstance> getInstancesForOwner​(java.lang.String owner)
        Get all instances of this scenario for a specific owner.

        The returned List is a shallow copy (new List) of only the relevant instances.

        Parameters:
        owner - The owner for which instances are required.
        Returns:
        The read-only List (possibly empty) of all instances for the specific owner. Each item is an IScenarioInstance.
      • getInputParameterNames

        java.util.Set<java.lang.String> getInputParameterNames()
        Get the names of all input parameters for the scenario.
        Returns:
        The read-only ordered Set (possibly empty) of all input field names - order is as required by the MonitorScript events. Each item is a String.
      • getOutputParameterNames

        java.util.Set<java.lang.String> getOutputParameterNames()
        Get the names of all output parameters for the scenario.
        Returns:
        The read-only ordered Set (possibly empty) of all output field names - order is as required by the MonitorScript events. Each item is a String.
      • getInputParameterTypes

        java.util.List<ParameterTypeEnum> getInputParameterTypes()
        Get the types of all input parameters for the scenario. Note that these are not Java types, but the types of the scenario parameters.
        Returns:
        The read-only List (possibly empty) of all input field types. Each item is a ParameterTypeEnum.
        See Also:
        ParameterTypeEnum
      • getOutputParameterTypes

        java.util.List<ParameterTypeEnum> getOutputParameterTypes()
        Get the types of all output parameters for the scenario. Note that these are not Java types, but the types of the scenario parameters.
        Returns:
        The read-only List (possibly empty) of all output field types. Each item is a ParameterTypeEnum.
        See Also:
        ParameterTypeEnum
      • isReadOnly

        boolean isReadOnly()
        Return if the Scenario is read only or can have instances created, edited and deleted.
        Returns:
        true is the Scenario is read only, otherwise false.
      • getExtraParams

        java.util.Map<java.lang.String,​java.lang.String> getExtraParams()
        Return the read-only map of extra parameters.
        Returns:
        The read-only map containing extra parameters.
        See Also:
        EXTRA_PARAMS_METADATA_PREFIX
      • getInputParameterConstraints

        java.util.List<java.lang.String> getInputParameterConstraints()
        Get the constraints of all input parameters for the scenario. Each input parameter has an associated set of optional validation constraints, expressed as an XML string. The current implementation of the Scenario Service does not enforce these constraints, but provides access to them such that a client may enforce them outside of the service.
        Returns:
        The read-only List (possibly empty) of all input field constraints. Each item is a String (XML).
      • getInputParameterDefaults

        java.util.List<java.lang.Object> getInputParameterDefaults()
        Get the default values of all input parameters for the scenario.
        Returns:
        The read-only List (possibly empty) of all input field default values. Each item is an Object of the correct Java type.
        See Also:
        ParameterTypeEnum
      • isInputParameter

        boolean isInputParameter​(java.lang.String parameterName)
        Test if a specific named parameter is an input parameter.
        Parameters:
        parameterName - The name of a parameter to be tested.
        Returns:
        true if the named parameter is an input parameter, false otherwise.
      • isOutputParameter

        boolean isOutputParameter​(java.lang.String parameterName)
        Test if a specific named parameter is an output parameter.
        Parameters:
        parameterName - The name of a parameter to be tested.
        Returns:
        true if the named parameter is an output parameter, false otherwise.
      • createInstance

        IScenarioInstance createInstance​(java.lang.String owner)
                                  throws InvalidInputParameterException,
                                         IllegalCallingThreadException
        Create a new instance of this scenario, using default values for all input parameters. If an instance cannot be created for any reason (other than invalid input parameters), the return value will be null.
        Parameters:
        owner - id of the owner of this Scenario.
        Returns:
        The newly created instance, or null if the creation failed.
        Throws:
        InvalidInputParameterException - when any of the inputParameters is invalid. Note that future versions of this API may also throw this exception to indicate constraint violations.
        IllegalCallingThreadException - if called from the data processing thread (i.e. from a PropertyChangeListener listening to an instance or definition).
      • createInstance

        IScenarioInstance createInstance​(java.lang.String owner,
                                         java.util.Map<java.lang.String,​java.lang.Object> inputParameters)
                                  throws InvalidInputParameterException,
                                         IllegalCallingThreadException
        Create a new instance of this scenario, with the supplied values for input parameters. Any input parameters not supplied will take default values. If an instance cannot be created for any reason (other than invalid input parameters), the return value will be null.
        Parameters:
        owner - id of the owner of this Scenario.
        inputParameters - contains mappings from input parameter name to initial values.
        Returns:
        The newly created instance, or null if the creation failed.
        Throws:
        InvalidInputParameterException - when any of the inputParameters is invalid. Note that future versions of this API may also throw this exception to indicate constraint violations.
        IllegalCallingThreadException - if called from the data processing thread (i.e. from a PropertyChangeListener listening to an instance or definition).
      • createInstance

        IScenarioInstance createInstance​(java.lang.String owner,
                                         java.util.Map<java.lang.String,​java.lang.Object> inputParameters,
                                         java.beans.PropertyChangeListener listener)
                                  throws InvalidInputParameterException,
                                         IllegalCallingThreadException
        Create a new instance of this Scenario, with the supplied values for input parameters, and atomically add a listener. Any input parameters not supplied will take default values. If an instance cannot be created for any reason (other than invalid input parameters), the return value will be null.
        Parameters:
        owner - id of the owner of this Scenario.
        inputParameters - contains mappings from input parameter name to initial values.
        listener - a listener (all properties) to register atomically to the instance.
        Returns:
        The newly created instance, or null if the creation failed.
        Throws:
        InvalidInputParameterException - when any of the inputParameters is invalid. Note that future versions of this API may also throw this exception to indicate constraint violations.
        IllegalCallingThreadException - if called from the data processing thread (i.e. from a PropertyChangeListener listening to an instance or definition).
      • createInstance

        IScenarioInstance createInstance​(java.lang.String owner,
                                         java.util.Map<java.lang.String,​java.lang.Object> inputParameters,
                                         java.lang.String property,
                                         java.beans.PropertyChangeListener listener)
                                  throws InvalidInputParameterException,
                                         IllegalCallingThreadException
        Create a new instance of this Scenario, with the supplied values for input parameters, and atomically add a listener. Any input parameters not supplied will take default values. If an instance cannot be created for any reason (other than invalid input parameters), the return value will be null.
        Parameters:
        owner - id of the owner of this Scenario.
        inputParameters - contains mappings from input parameter name to initial values.
        property - the property the listener listens to.
        listener - a listener to register atomically to the instance.
        Returns:
        The newly created instance, or null if the creation failed.
        Throws:
        InvalidInputParameterException - when any of the inputParameters is invalid. Note that future versions of this API may also throw this exception to indicate constraint violations.
        IllegalCallingThreadException - if called from the data processing thread (i.e. from a PropertyChangeListener listening to an instance or definition).