Interface AecuService


  • @ProviderType
    public interface AecuService
    Service interface for AECU. Use this to execute scripts or query the history.

    How to perform an execution:
    1. Get a list of files to execute using getFiles. This will filter all files that do not match the run mode and any fallback scripts.
    2. Start a new history entry to store your results using createHistoryEntry. This store a new run with in-progress state.
    3. Execute your files one by one with execute
    4. Store each script run in history using storeExecutionInHistory
    5. Mark the run as done by closing the history with finishHistoryEntry
    Author:
    Roland Gruber
    • Field Detail

      • AECU_CONF_PATH_PREFIX

        static final String AECU_CONF_PATH_PREFIX
        Prefix in repository where install hook AECU scripts are located.
        See Also:
        Constant Field Values
      • AECU_APPS_PATH_PREFIX

        static final String AECU_APPS_PATH_PREFIX
        Prefix in repository where install hook AECU scripts are located.
        See Also:
        Constant Field Values
    • Method Detail

      • getVersion

        String getVersion()
        Returns the AECU version.
        Returns:
        version
      • getFiles

        List<String> getFiles​(String path)
                       throws AecuException
        Returns a list of files that can be executed in the given path.
        Parameters:
        path - file or folder
        Returns:
        list of files that are executable
        Throws:
        AecuException - error finding files (e.g. invalid path)
      • matchesRunmodes

        boolean matchesRunmodes​(String name)
        Checks if the folder matches the system's run modes if specified in folder name.
        Parameters:
        name - resource name
        Returns:
        matches run modes
      • isValidScriptName

        boolean isValidScriptName​(String name)
        Checks if the name is a valid script.
        Parameters:
        name - file name
        Returns:
        is valid
      • execute

        ExecutionResult execute​(String path,
                                String data)
                         throws AecuException
        Executes the script at the given position.
        Parameters:
        path - path of script
        data - json object of script
        Returns:
        execution result
        Throws:
        AecuException - error during execution
      • storeExecutionInHistory

        HistoryEntry storeExecutionInHistory​(HistoryEntry history,
                                             ExecutionResult result)
                                      throws AecuException
        Stores an execution run in existing history.
        Parameters:
        history - history entry
        result - script execution result
        Returns:
        updated history
        Throws:
        AecuException - error inserting history entry
      • getHistory

        List<HistoryEntry> getHistory​(int startIndex,
                                      int count)
                               throws AecuException
        Returns the last history entries. The search starts at the newest entry.
        Parameters:
        startIndex - start reading at this index (first is 0)
        count - number of entries to read
        Returns:
        history entries (newest first)
        Throws:
        AecuException - error reading history
      • executeWithInstallHookHistory

        HistoryEntry executeWithInstallHookHistory​(String path)
                                            throws AecuException
        Executes the script(s) at the given position and taking install hook history into account.
        Parameters:
        path - path of script/folder
        Returns:
        execution result
        Throws:
        AecuException - error during execution
      • executeWithInstallHookHistory

        HistoryEntry executeWithInstallHookHistory​(String path,
                                                   String data)
                                            throws AecuException
        Executes the script(s) at the given position and taking install hook history into account.
        Parameters:
        path - path of script/folder
        data - data json string of script
        Returns:
        execution result
        Throws:
        AecuException - error during execution