org.apache.uima.ducc.cli

Class CliBase

    • Field Detail

      • ducc_home

        protected String ducc_home
      • dispatcher

        protected org.apache.uima.ducc.transport.dispatcher.IDuccEventDispatcher dispatcher
      • commandLine

        protected org.apache.uima.ducc.cli.CommandLine commandLine
      • friendlyId

        protected long friendlyId
      • returnCode

        protected int returnCode
      • cli_props

        protected org.apache.uima.ducc.common.utils.DuccProperties cli_props
      • debug

        protected boolean debug
      • console_listener

        protected org.apache.uima.ducc.cli.ConsoleListener console_listener
      • suppress_console_log

        protected boolean suppress_console_log
      • host_address

        protected String host_address
      • console_attach

        protected boolean console_attach
      • monitor_listener

        protected org.apache.uima.ducc.cli.MonitorListener monitor_listener
      • userSpecifiedProperties

        protected Properties userSpecifiedProperties
    • Constructor Detail

      • CliBase

        public CliBase()
    • Method Detail

      • execute

        public abstract boolean execute()
                                 throws Exception
        All extenders must implement execute - this method does whatever processing on the input is needed and passes the CLI request to the internal DUCC processes.
        Returns:
        Return true if execution works, and false otherwise.
        Throws:
        Exception - The specific exception is a function of the implementor.
      • inhibitDefaults

        protected void inhibitDefaults()
      • check_service_dependencies

        boolean check_service_dependencies(String endpoint)
      • check_heap_size

        void check_heap_size(String argsOption)
      • init

        protected void init(String myClassName,
                            org.apache.uima.ducc.cli.IUiOptions.UiOption[] opts,
                            String[] args,
                            org.apache.uima.ducc.common.utils.DuccProperties cli_props,
                            IDuccCallback consoleCb)
                     throws Exception
        Throws:
        Exception
      • init

        protected void init(String myClassName,
                            org.apache.uima.ducc.cli.IUiOptions.UiOption[] opts,
                            Properties props,
                            org.apache.uima.ducc.common.utils.DuccProperties cli_props,
                            IDuccCallback consoleCb)
                     throws Exception
        Throws:
        Exception
      • init

        protected void init(String myClassName,
                            org.apache.uima.ducc.cli.IUiOption[] uiOpts,
                            String[] args,
                            Properties props,
                            org.apache.uima.ducc.common.utils.DuccProperties cli_props,
                            IDuccCallback consoleCb,
                            String servlet)
                     throws Exception
        Parameters:
        myClassName - Name of the class invoking me, for help string
        uiOpts - Array of IUioptions permitted for this command
        args - Arguments from the command line (or null)
        props - Properties passed in from the API (or null)
        cli_props - (Initially) empty properties file to be filled in
        consoleCb - Console callback object (optional)
        servlet - The name of the http servlet that will serve this request
        Throws:
        Exception - If initialization fails, e.g. invalid arguments or properties
      • setOptions

        void setOptions(org.apache.uima.ducc.cli.IUiOption[] uiOpts)
                 throws Exception
        Throws:
        Exception
      • setDefaults

        void setDefaults(org.apache.uima.ducc.cli.IUiOption[] uiOpts,
                         boolean suppress_console)
                  throws IOException
        Throws:
        IOException
      • saveSpec

        void saveSpec(String name,
                      org.apache.uima.ducc.common.utils.DuccProperties props)
               throws Exception
        Throws:
        Exception
      • extractReply

        boolean extractReply(org.apache.uima.ducc.transport.event.AbstractDuccOrchestratorEvent reply)
        Extract messages and job pid from reply. This sets messages and errors into the appropriate structures for the API, and extracts the numeric id of the [job, ducclet, reservation, service] returned by the Orchestrator.
        Parameters:
        reply - - an Orchestrator reply event
        Returns:
        true if the action succeeded and false otherwise. The action in this case, is whatever the Orchestrator was asked to do: submit something, cancel something, etc.
      • usage

        void usage(String message)
      • setProperty

        public boolean setProperty(String key,
                                   String value)
        Set a property via the API. This method allows the API user to build up or override properties after the initial API object is constructed.
        Parameters:
        key - This is the property name.
        value - This is the value of the property.
        Returns:
        true if the property is set. Returns false if the property is not legal for this API.
      • message

        void message(String... e)
      • getReturnCode

        public int getReturnCode()
        This returns the return code from the execution of the requested work. Return code is only available when the monitor wait completes ... if not waiting then assume success.
        Returns:
        The exit code of the job, process, etc.
      • getDuccId

        public long getDuccId()
        This returns the unique numeric id for the requested work. For submissions (job, reservation, etc) this is the newly assigned id.
        Returns:
        The unique numeric id of the job, reservation, etc.
      • consoleExits

        void consoleExits()
      • monitorExits

        void monitorExits(int rc)
      • startMonitors

        protected void startMonitors(boolean start_stdin,
                                     org.apache.uima.ducc.transport.event.IDuccContext.DuccContext context)
                              throws Exception
        Throws:
        Exception
      • startMonitor

        protected void startMonitor(org.apache.uima.ducc.transport.event.IDuccContext.DuccContext context)
      • initConsoleListener

        protected void initConsoleListener()
                                    throws Exception
        Throws:
        Exception
      • startConsoleListener

        protected void startConsoleListener(boolean start_stdin)
                                     throws Exception
        Throws:
        Exception
      • stopListeners

        protected void stopListeners()
      • isConsoleAttached

        public boolean isConsoleAttached()
        This is used to find if the remote console is redirected to the local process, and if so, is it still active.
        Returns:
        True if the console is still attached to the remote process, false otherwise.
      • waitForCompletion

        public boolean waitForCompletion()
        Wait for the listeners - maybe a console listener, maybe a job listener, maybe both.
        Returns:
        true if a monitor wait was done, false otherwise. A monitor wait results in a return code from the process. In all other cases the return code is spurious.

Copyright © 2012–2019 The Apache Software Foundation. All rights reserved.