org.apache.uima.ducc.cli
Class CliBase

java.lang.Object
  extended by org.apache.uima.ducc.cli.CliBase
All Implemented Interfaces:
org.apache.uima.ducc.cli.IUiOptions
Direct Known Subclasses:
DuccJobCancel, DuccJobSubmit, DuccManagedReservationCancel, DuccManagedReservationSubmit, DuccReservationCancel, DuccReservationSubmit, DuccServiceApi, DuccServiceCancel, DuccServiceSubmit

public abstract class CliBase
extends Object
implements org.apache.uima.ducc.cli.IUiOptions

Define common methods and data used by all the DUCC API and CLI.


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.apache.uima.ducc.cli.IUiOptions
org.apache.uima.ducc.cli.IUiOptions.ClasspathOrderParms, org.apache.uima.ducc.cli.IUiOptions.UiOption
 
Field Summary
 
Fields inherited from interface org.apache.uima.ducc.cli.IUiOptions
help_width
 
Constructor Summary
CliBase()
           
 
Method Summary
abstract  boolean execute()
          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.
 long getDuccId()
          This returns the unique numeric id for the requested work.
 int getReturnCode()
          This returns the return code from the execution of the requested work.
 boolean isConsoleAttached()
          This is used to find if the remote console is redirected to the local process, and if so, is it still active.
static org.apache.commons.cli.Options makeOptions(org.apache.uima.ducc.cli.IUiOptions.UiOption[] optlist)
           
 boolean setProperty(String key, String value)
          Set a property via the API.
 boolean waitForCompletion()
          Wait for the listeners - maybe a console listener, maybe a job listener, maybe both.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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.

makeOptions

public static org.apache.commons.cli.Options makeOptions(org.apache.uima.ducc.cli.IUiOptions.UiOption[] optlist)

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.

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.

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–2014 The Apache Software Foundation. All rights reserved.