nesstar.api
Class Executor

java.lang.Object
  extended by nesstar.api.Executor
All Implemented Interfaces:
Runnable

public class Executor
extends Object
implements Runnable

A manager for the execution of an URL.

The URL can be:

The Executor is initialised with: The execution takes place on a separate thread.

Notes:
@bug threads are not reused.
@bug won't handle properly HTML form calls (login, etc.)
@todo redesign completly, together with ExecutorLog. remove unnecessary functionality from public interface


Field Summary
static int NO_TIMEOUT
          indicates that the Executor should not try to enforce a timeout on the method execution.
static String OLD_EXPLORER_ID
          The proxy URL of the first version of the Nesstar Explorer
 
Constructor Summary
Executor(URL url, ExecutorLog log)
          Constructor for the Executor object
Executor(URL url, ExecutorLog log, HTMLViewer viewer)
          Constructor for the Executor object
Executor(URL url, ExecutorLog log, int timeout)
          Constructor for the Executor object
Executor(URL url, ExecutorLog log, int timeout, HTMLViewer viewer)
          Constructor for the Executor object
Executor(URL url, ExecutorLog log, int timeout, HTMLViewer viewer, boolean wantResult)
           
 
Method Summary
 void cancel()
          Cancel execution of current command
 void execute()
          Execute the operation managed by this Executor.
static Exception getAPIException(Exception e)
           
 String getHeader(String name)
          Gets the header attribute of the Executor object
 Vector getHeaders()
          Gets the headers attribute of the Executor object
 URL getOnAccessCancelled()
          Gets the onAccessRefused attribute of the Executor object
 URL getOnAccessChallenged()
           
 URL getOnAccessGranted()
          Gets the onAccessGranted attribute of the Executor object
 URL getOnAccessRefused()
          Gets the onAccessRefused attribute of the Executor object
 URL getOpURL()
           
 void run()
          Main processing method for the Executor object
static void setDefaultOnAccessGranted(URL defaultOnAccessGranted)
          Sets the defaultOnAccessGranted attribute of the Executor class
static void setDefaultOnAccessRefused(URL defaultOnAccessRefused)
          Sets the defaultOnAccessRefused attribute of the Executor class
 void setHeader(String name, String value)
          Sets the header attribute of the Executor object
 void setOnAccessCancelled(URL onAccessCancelled)
          Sets the onAccessCancelled attribute of the Executor object
 void setOnAccessChallenged(URL accessChallenged)
           
 void setOnAccessGranted(URL onAccessGranted)
          Sets the onAccessGranted attribute of the Executor object
 void setOnAccessRefused(URL onAccessRefused)
          Sets the onAccessRefused attribute of the Executor object
 void setReexecute(boolean reexecute)
          Sets the reexecute attribute of the Executor object
 void setWantsRawResult(boolean wantsRawResult)
          Sets the wantsRawResult attribute of the Executor object
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_TIMEOUT

public static int NO_TIMEOUT
indicates that the Executor should not try to enforce a timeout on the method execution.


OLD_EXPLORER_ID

public static String OLD_EXPLORER_ID
The proxy URL of the first version of the Nesstar Explorer

Constructor Detail

Executor

public Executor(URL url,
                ExecutorLog log,
                int timeout,
                HTMLViewer viewer,
                boolean wantResult)
Parameters:
url - the url to execute
log - the log to which messages and exceptions have to be forwarded
timeout - in secs
viewer - the internal viewer to use to show non Nesstar URLs and challenges
wantResult - if true the executor won't use the viewer and will return to the ExecutorLog the contents of non-nesstar URLs

Executor

public Executor(URL url,
                ExecutorLog log,
                int timeout,
                HTMLViewer viewer)
Constructor for the Executor object

Parameters:
url - the url to execute
log - the log to which messages and exceptions have to be forwarded
timeout - in secs
viewer - the internal viewer to use to show non Nesstar URLs and challenges

Executor

public Executor(URL url,
                ExecutorLog log,
                int timeout)
Constructor for the Executor object

Parameters:
url -
log -
timeout -

Executor

public Executor(URL url,
                ExecutorLog log,
                HTMLViewer viewer)
Constructor for the Executor object

Parameters:
url -
log -
viewer -

Executor

public Executor(URL url,
                ExecutorLog log)
Constructor for the Executor object

Parameters:
url -
log -
Method Detail

setWantsRawResult

public void setWantsRawResult(boolean wantsRawResult)
Sets the wantsRawResult attribute of the Executor object

Parameters:
wantsRawResult - The new wantsRawResult value

setHeader

public void setHeader(String name,
                      String value)
Sets the header attribute of the Executor object

Parameters:
name - The new header value
value - The new header value

setReexecute

public void setReexecute(boolean reexecute)
Sets the reexecute attribute of the Executor object

Parameters:
reexecute - The new reexecute value

setOnAccessGranted

public void setOnAccessGranted(URL onAccessGranted)
Sets the onAccessGranted attribute of the Executor object

Parameters:
onAccessGranted - The new onAccessGranted value

setOnAccessCancelled

public void setOnAccessCancelled(URL onAccessCancelled)
Sets the onAccessCancelled attribute of the Executor object

Parameters:
onAccessCancelled - The new onAccessCancelled value

getOnAccessChallenged

public URL getOnAccessChallenged()
Returns:
Returns the _onAccessChallenged.

setOnAccessChallenged

public void setOnAccessChallenged(URL accessChallenged)
Parameters:
accessChallenged - The _onAccessChallenged to set.

setDefaultOnAccessGranted

public static void setDefaultOnAccessGranted(URL defaultOnAccessGranted)
Sets the defaultOnAccessGranted attribute of the Executor class

Parameters:
defaultOnAccessGranted - The new defaultOnAccessGranted value

setOnAccessRefused

public void setOnAccessRefused(URL onAccessRefused)
Sets the onAccessRefused attribute of the Executor object

Parameters:
onAccessRefused - The new onAccessRefused value

setDefaultOnAccessRefused

public static void setDefaultOnAccessRefused(URL defaultOnAccessRefused)
Sets the defaultOnAccessRefused attribute of the Executor class

Parameters:
defaultOnAccessRefused - The new defaultOnAccessRefused value

getHeader

public String getHeader(String name)
Gets the header attribute of the Executor object

Parameters:
name -
Returns:
The header value

getHeaders

public Vector getHeaders()
Gets the headers attribute of the Executor object

Returns:
The headers value

getOnAccessGranted

public URL getOnAccessGranted()
Gets the onAccessGranted attribute of the Executor object

Returns:
The onAccessGranted value

getOnAccessRefused

public URL getOnAccessRefused()
Gets the onAccessRefused attribute of the Executor object

Returns:
The onAccessRefused value

getOnAccessCancelled

public URL getOnAccessCancelled()
Gets the onAccessRefused attribute of the Executor object

Returns:
The onAccessRefused value

getOpURL

public URL getOpURL()
Returns:
the URL accessed to perform the operation *

execute

public void execute()
Execute the operation managed by this Executor. Information regarding the proceeding of the operation will be sent to the registered Log if present This method returns immediatly as the command is executed on a separate Thread An Executor may be executed multiple times


getAPIException

public static Exception getAPIException(Exception e)
Parameters:
e - the exception returned by MIMEObject
Returns:
an adapted exeption with the correct error message and type

run

public void run()
Main processing method for the Executor object

Specified by:
run in interface Runnable

cancel

public void cancel()
Cancel execution of current command

Bug:
this call is ignored

Nesstar SDK

Copyright©2003 NSD - All Rights Reserved