Class InnovatorApplicationDefault

  • All Implemented Interfaces:
    InnovatorApplication

    public abstract class InnovatorApplicationDefault
    extends java.lang.Object
    implements InnovatorApplication
    The class is a default implementation of the InnovatorApplication interface. It should facilitate coding for Java applications when connecting to an Innovator server. It uses an InnovatorBatchLoginDefault instance when the application is started from the command line.
    Author:
    borschet
    See Also:
    InnovatorBatchLoginDefault
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected boolean addToReply​(ELElement obj)
      Supplies a transparent view of an application regardless of whether it is started from Innovator clients or using the command line.
      protected boolean addToReply​(java.util.List<? extends ELElement> list)
      Supplies a transparent view of an application regardless of whether it is started from Innovator clients or using the command line.
      void afterRun()
      A callback method can be overloaded; the method is called after the application is successfully run.
      void beforeRun()
      A callback method can be overloaded; the method is called before running the application.
      protected void clearReply()
      Clears the Innovator reply list.
      static InnovatorApplication create​(java.lang.Class<? extends InnovatorApplication> cls, Property[] props, java.lang.String[] args)
      This method should be called in your static main method.
      protected java.lang.String[] getCommandLineArguments()  
      java.lang.String getInoDir()
      Returns the value of the environment variable INODIR.
      java.lang.String getInoHome()
      Returns the value of the environment variable INOHOME.
      protected PropertyProvider getPropertyProvider()
      Gets the property provider.
      protected java.util.List<ELElement> getReplySelection()
      Supplies a transparent view of an application regardless of whether it is started from Innovator clients or using the command line.
      protected java.util.List<ELElement> getSelection()
      Supplies a transparent view of an application regardless of whether it is started from Innovator clients or using the command line.
      void ignoreBatchLogin()  
      void info​(java.lang.String msg, java.lang.Object... vargs)
      Records program activity with INFO level.
      void log​(java.util.logging.Level l, java.lang.String msg, java.lang.Object... vargs)
      Logs program activity (this is done by using the Logger class).
      void msg​(java.lang.String key, java.lang.Object... vargs)
      Displays a language-specific message which must be specified according to the rules defined in InoNls.
      void onExit()
      A callback method can be overloaded; the method is called before exiting the application.
      void onInit()
      A callback method can be overloaded; the method is called upon application initialization.
      protected void ShowUsage()  
      protected void start()  
      void warning​(java.lang.String key, java.lang.Object... vargs)
      The method delivers a warning message to the user.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • InnovatorApplicationDefault

        public InnovatorApplicationDefault()
    • Method Detail

      • ignoreBatchLogin

        public void ignoreBatchLogin()
      • ShowUsage

        protected void ShowUsage()
      • start

        protected final void start()
                            throws java.lang.Exception
        Throws:
        java.lang.Exception
      • create

        public static InnovatorApplication create​(java.lang.Class<? extends InnovatorApplication> cls,
                                                  Property[] props,
                                                  java.lang.String[] args)
                                           throws java.lang.Exception

        This method should be called in your static main method. All necessary steps to obtain a valid connection to a model are carried out. A user is logged-on by default. A run() is then called to run your specific application code. It also provides various methods for message logging and argument parsing. If an exception is raised in your code, it handles the output.

        Example:

        public static void main(String[] args) throws Exception {
        InnovatorApplicationDefault.create(TestMain.class, null, args);
        }

        Parameters:
        cls - your application instance's class to be created; it must implement InnovatorApplication
        props - a list of valid properties/arguments which the application can handle
        args - the arguments received from the static main method
        Returns:
        the created instance upon successful execution
        Throws:
        java.lang.Exception
      • getPropertyProvider

        protected PropertyProvider getPropertyProvider()
        Gets the property provider.
        Returns:
        an instance of PropertyProvider
      • log

        public final void log​(java.util.logging.Level l,
                              java.lang.String msg,
                              java.lang.Object... vargs)
        Logs program activity (this is done by using the Logger class).
        Specified by:
        log in interface InnovatorApplication
        Parameters:
        l - the logging level
        msg - a message that can contain message format variables
        vargs - the arguments for the message format
        See Also:
        Logger.log(java.util.logging.Level, java.lang.String)
      • info

        public final void info​(java.lang.String msg,
                               java.lang.Object... vargs)
        Records program activity with INFO level.
        Specified by:
        info in interface InnovatorApplication
        Parameters:
        msg - a message that can contain message format variables
        vargs - the arguments for the message format
        See Also:
        Level.INFO
      • msg

        public final void msg​(java.lang.String key,
                              java.lang.Object... vargs)
        Displays a language-specific message which must be specified according to the rules defined in InoNls.
        Specified by:
        msg in interface InnovatorApplication
        Parameters:
        key - a property file's message key
        vargs - the arguments for the message format
        See Also:
        InoNls.Msg(String, Object[])
      • warning

        public final void warning​(java.lang.String key,
                                  java.lang.Object... vargs)
        The method delivers a warning message to the user. Error conditions should be triggered using exceptions.
        Specified by:
        warning in interface InnovatorApplication
        Parameters:
        key - a property file's message key
        vargs - the arguments for the message format
      • getCommandLineArguments

        protected java.lang.String[] getCommandLineArguments()
        Returns:
        all command line arguments.
      • getSelection

        protected java.util.List<ELElement> getSelection()
        Supplies a transparent view of an application regardless of whether it is started from Innovator clients or using the command line.
        Returns:
        a list of selected elements.
      • getReplySelection

        protected java.util.List<ELElement> getReplySelection()
        Supplies a transparent view of an application regardless of whether it is started from Innovator clients or using the command line.
        Returns:
        a list that will eventually be returned to the Innovator client.
      • addToReply

        protected boolean addToReply​(ELElement obj)
        Supplies a transparent view of an application regardless of whether it is started from Innovator clients or using the command line. You can add an element to the Innovator reply list.
        Returns:
        true, if add was alright, otherwise false
      • addToReply

        protected boolean addToReply​(java.util.List<? extends ELElement> list)
        Supplies a transparent view of an application regardless of whether it is started from Innovator clients or using the command line. You can add a list of elements to the Innovator reply list.
        Returns:
        true, if add was alright, otherwise false
      • clearReply

        protected void clearReply()
        Clears the Innovator reply list.
        See Also:
        List.clear()
      • onInit

        public void onInit()
        A callback method can be overloaded; the method is called upon application initialization.
        Specified by:
        onInit in interface InnovatorApplication
      • onExit

        public void onExit()
        A callback method can be overloaded; the method is called before exiting the application.
        Specified by:
        onExit in interface InnovatorApplication
      • beforeRun

        public void beforeRun()
        A callback method can be overloaded; the method is called before running the application.
      • afterRun

        public void afterRun()
        A callback method can be overloaded; the method is called after the application is successfully run.
      • getInoHome

        public java.lang.String getInoHome()
        Returns the value of the environment variable INOHOME. This value is only available when started from Innovator Model Editor.
        Returns:
        Value of the environment variable INOHOME
      • getInoDir

        public java.lang.String getInoDir()
        Returns the value of the environment variable INODIR. This value is only available when started from Innovator Model Editor.
        Returns:
        Value of the environment variable INODIR