|
Foundation |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Execution2Interface
This interface describes various aspects associated with the execution of a stored process. See the package description documentation for usage information.
Field Summary | |
---|---|
static int |
STATUS_ABORTED
The abort method has been called. |
static int |
STATUS_WAITING_FOR_CONNECTION
The stored process is waiting for a connection to become available. |
Fields inherited from interface com.sas.services.storedprocess.ExecutionBaseInterface |
---|
LOG_ALL_LINES, LOG_FORMAT_HTML, LOG_FORMAT_TEXT, STATUS_COMPLETED_WITHOUT_EXCEPTION, STATUS_DESTROYED, STATUS_EXCEPTION_OCCURRED, STATUS_EXECUTING, STATUS_SAS_EXCEPTION_OCCURRED |
Method Summary | |
---|---|
void |
abort()
Abort execution of the stored process. |
void |
destroy()
Free resources allocated by the service for this execution. |
java.io.InputStream |
getInputStream(java.lang.Object streamKey)
Get an input stream. |
OutputParameterInterface |
getOutputParameter(java.lang.String name)
Get the OutputParameterInterface object
corresponding to the output parameter (SAS macro variable) name
specified from the list returned by getOutputParameters() . |
java.util.List<OutputParameterInterface> |
getOutputParameters()
Returns the list of output parameters as OutputParameterInterface
objects. |
java.io.OutputStream |
getOutputStream(java.lang.Object streamKey)
Get an output stream. |
ResultPackageInterface |
getResultPackage()
Get the package produced by the execution of the stored process. |
int |
getSASConditionCode()
Get the SAS condition code associated with the execution of the stored process. |
SASLog |
getSASListing()
Get the SAS listing associated with this execution. |
SASLog |
getSASListing(int maxLines)
Get the SAS listing associated with this execution. |
SASLog |
getSASLog()
/** Get the SAS log associated with this execution. |
SASLog |
getSASLog(int maxLines)
Get the SAS log associated with this execution. |
java.lang.String |
getSessionID()
Get the session id associated with this execution. |
int |
getStatus()
Get the status of this execution. |
java.lang.String |
readSASLog(int flag,
int maxLines)
Read the SAS log associated with this execution. |
void |
setResultPackageLifeCycleBound(boolean boundToLifeCycle)
Sets whether the life-cycle of the package is bound to the Execution2Interface . |
int |
waitForConnection()
Wait until a connection to the server is available. |
int |
waitForConnection(long milliSecondTimeout)
Wait until a connection to the server is available or until the time specified has elapsed. |
Methods inherited from interface com.sas.services.storedprocess.ExecutionBaseInterface |
---|
getExceptions, getInputStreamHeader, getOutputStreamHeader, getStoredProcessAlert, isSynchronous, waitForCompletion, waitForCompletion |
Field Detail |
---|
static final int STATUS_ABORTED
getStatus()
.
static final int STATUS_WAITING_FOR_CONNECTION
getStatus()
and is
returned if StoredProcess2Interface.executeAsynch(ExecutionStatusListener2Interface, boolean)
is called and a server is not available.
Method Detail |
---|
void destroy() throws java.rmi.RemoteException, java.lang.IllegalStateException, ConnectionFactoryException, TransportException
If the stored process is executed asynchronously and this method is called while
the stored process is still executing an IllegalStateException will be thrown by this method.
For such use cases, it's recommended that ExecutionBaseInterface.waitForCompletion()
be called before
the call to this method.
destroy
in interface ExecutionBaseInterface
ConnectionFactoryException
- if thrown by the Connection Service
when closing the connection
java.lang.IllegalStateException
- if the status is STATUS_WAITING_FOR_CONNECTION
,
ExecutionBaseInterface.STATUS_EXECUTING
or this method is called a second time.
TransportException
- if there is a problem communicating with the SAS server.
java.rmi.RemoteException
- if a network anomaly is encountered.java.io.InputStream getInputStream(java.lang.Object streamKey) throws java.lang.IllegalStateException, java.rmi.RemoteException
StoredProcessBaseInterface.SERVER_TYPE_STOREDPROCESS
. Either
the stream needs to be defined as a data target, or, in the case of _WEBOUT,
streaming capability should be selected for execution.
If execution is via StoredProcess2Interface.executeAsynch(ExecutionStatusListener2Interface, boolean)
,
this method blocks on waitForConnection()
if a connection to the server
is not available.
getInputStream
in interface ExecutionBaseInterface
streamKey
- an object whose toString method provides the stream name.
java.lang.IllegalStateException
- if destroy() has been called.
java.rmi.RemoteException
- if a network anomaly is encountered.java.io.OutputStream getOutputStream(java.lang.Object streamKey) throws java.lang.IllegalStateException, java.rmi.RemoteException
StoredProcessBaseInterface.SERVER_TYPE_STOREDPROCESS
.
If execution is via StoredProcess2Interface.executeAsynch(ExecutionStatusListener2Interface, boolean)
,
this method blocks on waitForConnection()
if a connection to the server
is not available.
getOutputStream
in interface ExecutionBaseInterface
streamKey
- an object whose toString method provides the stream name.
java.lang.IllegalStateException
- if destroy() has been called.
java.rmi.RemoteException
- if a network anomaly is encountered.java.util.List<OutputParameterInterface> getOutputParameters() throws TransportException, java.rmi.RemoteException
OutputParameterInterface
objects. All output parameters defined in metadata are automatically
present in this list. However, the list may also contain items not defined
in metadata as described in getOutputParameter(String)
.
For stored processes run on a Workspace server this functionality is unavailable and an IllegalStateException is thrown.
java.lang.IllegalStateException
- if the status is STATUS_WAITING_FOR_CONNECTION
,
ExecutionBaseInterface.STATUS_EXECUTING
or
ExecutionBaseInterface.STATUS_SAS_EXCEPTION_OCCURRED
,
or if destroy() has been called.
java.rmi.RemoteException
- if a network anomaly is encountered.
TransportException
OutputParameterInterface getOutputParameter(java.lang.String name) throws TransportException, java.rmi.RemoteException
OutputParameterInterface
object
corresponding to the output parameter (SAS macro variable) name
specified from the list returned by getOutputParameters()
.
If no output parameter with that name is found in the list, the server
is queried to see if a value is associated with that SAS macro name. If
there is no value, a null is returned. If there is a value, a
OutputParameterInterface with type String for that name is created and
returned; also, the newly created OutputParameterInterface
is added to the list of output parameters returned by
getOutputParameters()
.
For stored processes run on a Workspace server this functionality is unavailable and an IllegalStateException is thrown.
name
- the name of the output parameter whose value is desired.
OutputParameterInterface
for the name specified
java.lang.IllegalStateException
- if the status is STATUS_WAITING_FOR_CONNECTION
,
ExecutionBaseInterface.STATUS_EXECUTING
,
ExecutionBaseInterface.STATUS_SAS_EXCEPTION_OCCURRED
,
or if destroy() has been called.
TransportException
- if there is a problem communicating with the SAS server.
java.rmi.RemoteException
- if a network anomaly is encountered.ResultPackageInterface getResultPackage() throws java.lang.IllegalStateException, java.rmi.RemoteException
getResultPackage
in interface ExecutionBaseInterface
java.rmi.RemoteException
- if a network anomaly is encountered.
java.lang.IllegalStateException
- if the status is STATUS_WAITING_FOR_CONNECTION
,
ExecutionBaseInterface.STATUS_EXECUTING
,
ExecutionBaseInterface.STATUS_SAS_EXCEPTION_OCCURRED
or
STATUS_ABORTED
, or if destroy() has been called.int getSASConditionCode() throws java.rmi.RemoteException
getSASConditionCode
in interface ExecutionBaseInterface
java.rmi.RemoteException
- if a network anomaly is encountered.
java.lang.IllegalStateException
- if the status is STATUS_WAITING_FOR_CONNECTION
, ExecutionBaseInterface.STATUS_EXECUTING
or
ExecutionBaseInterface.STATUS_SAS_EXCEPTION_OCCURRED
, or if destroy() has been called.void setResultPackageLifeCycleBound(boolean boundToLifeCycle) throws ResultsBindingException, java.rmi.RemoteException, java.lang.IllegalStateException
Execution2Interface
. By default, the life-cycle of the package is
bound to the Execution2Interface
. If it is,
the package is closed when destroy()
is called. This method is called before the result pacakge
is accessed via getResultPackage()
.
boundToLifeCycle
- true - package is closed by ExecutionInteface's destroy();
false - package life controlled by consumer.
ResultsBindingException
- if there is no result package or an exception occurs making a copy
java.lang.IllegalStateException
- if called after getResultPackage() is accessed or
if called a second time with a different argument
java.rmi.RemoteException
- if a network anomaly is encountered.int getStatus() throws java.rmi.RemoteException
If the stored process is executing
STATUS_EXECUTING
is returned. If it has completed,
one of STATUS_COMPLETED_WITHOUT_EXCEPTION
,
STATUS_SAS_EXCEPTION_OCCURRED
or
STATUS_EXCEPTION_OCCURRED
is
returned depending on how execution terminated. If stored process execution was aborted by
using the abort()
method, STATUS_ABORTED
is returned unless execution was
complete at the time of the abort.
Note: if the exception is due to the more specific reasons
specified in STATUS_SAS_EXCEPTION_OCCURRED
then STATUS_SAS_EXCEPTION_OCCURRED
is returned
over the more generic STATUS_EXCEPTION_OCCURRED
.
getStatus
in interface ExecutionBaseInterface
java.lang.IllegalStateException
- if destroy() has been called.
java.rmi.RemoteException
- if a network anomaly is encountered.void abort() throws java.rmi.RemoteException, TransportException
StoredProcess2Interface.executeAsynch(ExecutionStatusListener2Interface, boolean)
or asynchronously via
StoredProcess2Interface.execute(boolean, ExecutionStatusListener2Interface, boolean, Object)
;
however, if execute() has been called synchronously
this Execution2Interface
object is not available until after execution is completed
and no purpose would be served by calling abort.
If the stored process has not completed execution at the time this method is called, the
stored process is interrupted (if execution has begun) and the status returned by
getStatus()
is STATUS_ABORTED
. If the stored process has completed
execution at the time this method is called there is no change in the value
returned by the getStatus()
.
If executeAsynch() was used and execution of the stored process is waiting for a connection to become available, this method does not interrupt that process. However, once a connection does become available execution will not occur due to the pending abort().
The following items, if applicable, may be obtained from an aborted stored process:
ExecutionBaseInterface.readSASLog(int, int)
)
getOutputParameter(String)
or getOutputParameters()
)
ExecutionBaseInterface.getSASConditionCode()
)
java.lang.IllegalStateException
- if destroy() has been called or if the stored process is being executed synchronously
java.rmi.RemoteException
- if a network anomaly is encountered.
TransportException
- if there is a problem communicating with the SAS server.java.lang.String getSessionID() throws java.lang.IllegalStateException, java.rmi.RemoteException
getSessionID
in interface ExecutionBaseInterface
java.rmi.RemoteException
- if a network anomaly is encountered.
java.lang.IllegalStateException
- if the status is STATUS_WAITING_FOR_CONNECTION
,
ExecutionBaseInterface.STATUS_EXECUTING
,
ExecutionBaseInterface.STATUS_SAS_EXCEPTION_OCCURRED
or
STATUS_ABORTED
,
or if destroy() has been called.SASLog getSASLog() throws java.rmi.RemoteException, java.lang.IllegalStateException, TransportException
getSASLog(int)
method.
Any subsequent calls to obtain the SAS log return an empty object.
The method should only be called after execution is complete.
SASLog
object containing the log
java.rmi.RemoteException
- if a network anomaly is encountered.
java.lang.IllegalStateException
- if the status is STATUS_WAITING_FOR_CONNECTION
,
ExecutionBaseInterface.STATUS_EXECUTING
or if destroy() has been called.
TransportException
- if there is a problem communicating with the SAS server.SASLog getSASLog(int maxLines) throws java.rmi.RemoteException, java.lang.IllegalStateException, TransportException
getSASLog()
method.
If a call does not return all lines available, subsequent calls
to obtain remaining SAS log lines return lines in the log after
those previously returned.
Once all lines have been returned, any subsequent call returns an empty object.
The method should only be called after execution is complete.
maxLines
- the maximum number of lines to get
SASLog
object containing the log
java.rmi.RemoteException
- if a network anomaly is encountered.
java.lang.IllegalStateException
- if the status is STATUS_WAITING_FOR_CONNECTION
,
ExecutionBaseInterface.STATUS_EXECUTING
or if destroy() has been called.
TransportException
- if there is a problem communicating with the SAS server.SASLog getSASListing() throws java.rmi.RemoteException, java.lang.IllegalStateException, TransportException
getSASListing(int)
method.
Any subsequent calls to this method or to getSASListing(int)
return an empty object.
The method should only be called after execution is complete.
SASLog
object containing the listing
java.rmi.RemoteException
- if a network anomaly is encountered.
java.lang.IllegalStateException
- if the status is STATUS_WAITING_FOR_CONNECTION
,
ExecutionBaseInterface.STATUS_EXECUTING
or if destroy() has been called.
TransportException
- if there is a problem communicating with the SAS server.SASLog getSASListing(int maxLines) throws java.rmi.RemoteException, java.lang.IllegalStateException, TransportException
getSASListing()
method.
If a call does not return all lines available, subsequent calls
to this method or to getSASListing()
return lines in the listing after those previously returned.
Once all lines have been returned, any subsequent calls will return an empty object.
The method should only be called after execution is complete.
maxLines
- the maximum number of lines to get
SASLog
object containing the listing
java.rmi.RemoteException
- if a network anomaly is encountered.
java.lang.IllegalStateException
- if the status is STATUS_WAITING_FOR_CONNECTION
,
ExecutionBaseInterface.STATUS_EXECUTING
or if destroy() has been called.
TransportException
- if there is a problem communicating with the SAS server.java.lang.String readSASLog(int flag, int maxLines) throws java.rmi.RemoteException, java.lang.IllegalStateException, TransportException
ExecutionBaseInterface.LOG_ALL_LINES
) or more lines
than are present, that call returns the lines available but
subsequent calls return an empty string unless there has
been output to the log after that call.
System.getProperty("line.separator")
is used to obtain the newline character sequence that is inserted
after each line in the returned string. If ExecutionBaseInterface.LOG_FORMAT_HTML
type output is requested
the returned string is enclosed by "PRE" tags and another newline
character sequence appended after the closing "PRE" tag.
readSASLog
in interface ExecutionBaseInterface
flag
- one of ExecutionBaseInterface.LOG_FORMAT_TEXT
or ExecutionBaseInterface.LOG_FORMAT_HTML
maxLines
- the maximum number of lines to get or
ExecutionBaseInterface.LOG_ALL_LINES
if all lines are needed
java.rmi.RemoteException
- if a network anomaly is encountered.
java.lang.IllegalStateException
- if the status is STATUS_WAITING_FOR_CONNECTION
,
ExecutionBaseInterface.STATUS_EXECUTING
or if destroy() has been called.
TransportException
- if there is a problem communicating with the SAS server.int waitForConnection() throws java.lang.InterruptedException, java.rmi.RemoteException
getStatus()
.
java.lang.IllegalStateException
- if destroy() has been called.
java.lang.InterruptedException
- if the thread executing the method is interrupted
java.rmi.RemoteException
- if a network anomaly is encountered.StoredProcess2Interface.executeAsynch(ExecutionStatusListener2Interface, boolean)
int waitForConnection(long milliSecondTimeout) throws java.lang.InterruptedException, java.rmi.RemoteException
milliSecondTimeout
- - the maximum time to wait in milliseconds
getStatus()
.
java.lang.IllegalStateException
- if destroy() has been called.
java.lang.InterruptedException
- if the thread executing the method is interrupted
java.rmi.RemoteException
- if a network anomaly is encountered.StoredProcess2Interface.executeAsynch(ExecutionStatusListener2Interface, boolean)
|
Foundation |
|
| |||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |