Class ExceptionManager

    • Field Detail

      • exceptionMessage

        public StringParameter exceptionMessage
        The exception message from the caught exception.
      • statusMessage

        public StringParameter statusMessage
        The latest action, if any, taken by the CatchExceptionAttribute. For example, a notification that the model has restarted. It offers a way to provide feedback to the user.
    • Constructor Detail

      • ExceptionManager

        public ExceptionManager​(NamedObj container,
                                java.lang.String name)
                         throws NameDuplicationException,
                                IllegalActionException
        Create a model attribute with the specified container and name.
        Parameters:
        container - The specified container.
        name - The specified name.
        Throws:
        IllegalActionException - If the attribute is not of an acceptable class for the container, or if the name contains a period.
        NameDuplicationException - If the name coincides with an attribute already in the container.
    • Method Detail

      • addInitializable

        public void addInitializable​(Initializable initializable)
        Add the specified object to the set of objects whose preinitialize(), initialize(), and wrapup() methods should be invoked upon invocation of the corresponding methods of this object.
        Specified by:
        addInitializable in interface Initializable
        Parameters:
        initializable - The object whose methods should be invoked.
        See Also:
        removeInitializable(Initializable)
      • executionError

        public void executionError​(Manager manager,
                                   java.lang.Throwable throwable)
        Do nothing upon execution error. Exceptions are passed to this attribute through handleException(). This method is required by the ExecutionListener interface.
        Specified by:
        executionError in interface ExecutionListener
        Parameters:
        manager - The manager controlling the execution.
        throwable - The throwable to report.
      • executionFinished

        public void executionFinished​(Manager manager)
        Restart here if restart is desired. This method is called upon successful completion.
        Specified by:
        executionFinished in interface ExecutionListener
        Parameters:
        manager - The manager controlling the execution.
      • handleException

        public boolean handleException​(NamedObj context,
                                       java.lang.Throwable exception)
                                throws IllegalActionException
        Handle an exception according to the specified policy: continue: Not implemented yet Consume the exception and return control to the director. Could be valuable for domains like DE or modal models when new events will arrive. Probably not appropriate for domains like SDF where the director follows a predefined schedule based on data flow (since the actor throwing the exception no longer provides output to the next actor). throw: Do not catch the exception. restart: Stop and restart the model. Does not apply to exceptions generated during initialize(). stop: Stop the model.
        Specified by:
        handleException in interface ExceptionHandler
        Parameters:
        context - The object in which the error occurred.
        exception - The exception to be handled.
        Returns:
        true if the exception is handled; false if this attribute did not handle it
        Throws:
        IllegalActionException - If thrown by the parent
      • removeInitializable

        public void removeInitializable​(Initializable initializable)
        Remove the specified object from the list of objects whose preinitialize(), initialize(), and wrapup() methods should be invoked upon invocation of the corresponding methods of this object. If the specified object is not on the list, do nothing.
        Specified by:
        removeInitializable in interface Initializable
        Parameters:
        initializable - The object whose methods should no longer be invoked.
        See Also:
        addInitializable(Initializable)
      • preinitialize

        public void preinitialize()
                           throws IllegalActionException
        Register this attribute with the manager. Done here instead of in the constructor since the director is found in order to get the manager. The constructor for this attribute might be called before the constructor for the director.
        Specified by:
        preinitialize in interface Initializable
        Throws:
        IllegalActionException - If the parent class throws it
      • _getInitializableContainer

        protected Initializable _getInitializableContainer()
        Return the first Initializable encountered above this in the hierarchy that will be initialized (i.e., it is either an atomic actor or an opaque composite actor).
        Returns:
        The first Initializable above this in the hierarchy, or null if there is none.
        See Also:
        AbstractInitializableAttribute