*** This interface provides Binary Compatibility only, not Source Compatibility ***
Package com.sas.services.storedprocess
Interface ExecutionBaseInterface
- All Superinterfaces:
Remote
- All Known Subinterfaces:
Execution2Interface,ExecutionInterface
@SASScope("ALL")
@BinaryCompatibilityOnly
public interface ExecutionBaseInterface
extends Remote
This interface describes various common aspects associated with the execution of
a stored process.
- Since:
- 9.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intGet all lines of the log.static final intFormat the log as "html".static final intFormat the log as "text".static final intThe stored process has completed execution without any exception.static final intThe destroy method has been called.static final intThe execution of the stored process resulted in an exception.static final intThe stored process is executing.static final intAn exception occurred during the setup or execution stage of the stored process. -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Free resources allocated by the service for this execution.Get the exceptions which caused the stored process to complete with a status ofSTATUS_SAS_EXCEPTION_OCCURREDorSTATUS_EXCEPTION_OCCURRED.InputStreamgetInputStream(Object streamKey) Get an input stream.com.sas.io.InputStreamHeaderInterfacegetInputStreamHeader(String streamKey) Get the stream header for an input stream.OutputStreamgetOutputStream(Object streamKey) Get an output stream.com.sas.io.OutputStreamHeaderInterfacegetOutputStreamHeader(String streamKey) Get the stream header for an output stream.Get the package produced by the execution of the stored process.intGet the SAS condition code associated with the execution of the stored process.StringGet the session id associated with this execution.intGet the status of this execution.Get the stored process alert item associated with this execution.booleanIs the stored process being executed synchronously?StringreadSASLog(int flag, int maxLines) Read the SAS log associated with this execution.intWait until the stored process completes execution.intwaitForCompletion(long milliSecondTimeout) Wait until the stored process completes execution or until the time specified has elapsed.
-
Field Details
-
STATUS_EXECUTING
static final int STATUS_EXECUTINGThe stored process is executing. This is one of the values returned bygetStatus().- See Also:
-
STATUS_SAS_EXCEPTION_OCCURRED
static final int STATUS_SAS_EXCEPTION_OCCURREDAn exception occurred during the setup or execution stage of the stored process. This is one of the values returned bygetStatus(). Setting of this code implies the stored process did not complete execution. The exception can be obtained usinggetExceptions().- See Also:
-
STATUS_COMPLETED_WITHOUT_EXCEPTION
static final int STATUS_COMPLETED_WITHOUT_EXCEPTIONThe stored process has completed execution without any exception. This is one of the values returned bygetStatus().- See Also:
-
STATUS_EXCEPTION_OCCURRED
static final int STATUS_EXCEPTION_OCCURREDThe execution of the stored process resulted in an exception. This is one of the values returned bygetStatus(). The exception can be obtained usinggetExceptions(). The SAS log can be be obtained by invokingreadSASLog(int, int).- See Also:
-
STATUS_DESTROYED
static final int STATUS_DESTROYEDThe destroy method has been called. This value can only returned bywaitForCompletion()orwaitForCompletion(long). This value is only returned ifdestroy()gets called beforewaitForCompletionreturns.- See Also:
-
LOG_ALL_LINES
static final int LOG_ALL_LINESGet all lines of the log. The log can be obtained by invokingreadSASLog(int, int).- See Also:
-
LOG_FORMAT_TEXT
static final int LOG_FORMAT_TEXTFormat the log as "text". The log can be obtained by invokingreadSASLog(int, int).- See Also:
-
LOG_FORMAT_HTML
static final int LOG_FORMAT_HTMLFormat the log as "html". The log can be obtained by invokingreadSASLog(int, int). Log lines will be marked up with HTML tags to indicate the type of log line. NOTE, INFO, WARNING and ERROR messages are highlighted.- See Also:
-
-
Method Details
-
getResultPackage
Get the package produced by the execution of the stored process.See the sub-interface method (
Execution2Interface.getResultPackage()orExecutionInterface.getResultPackage()for more details.- Returns:
- the package or null if there is none.
- Throws:
RemoteException- if a network anomaly is encountered.IllegalStateException
-
getStatus
int getStatus() throws RemoteExceptionGet the status of this execution.See the sub-interface method (
Execution2Interface.getStatus()orExecutionInterface.getStatus()for more details.- Throws:
IllegalStateException- if destroy() has been called.RemoteException- if a network anomaly is encountered.
-
isSynchronous
boolean isSynchronous() throws RemoteExceptionIs the stored process being executed synchronously?- Throws:
IllegalStateException- if destroy() has been called.RemoteException- if a network anomaly is encountered.
-
getExceptions
Get the exceptions which caused the stored process to complete with a status ofSTATUS_SAS_EXCEPTION_OCCURREDorSTATUS_EXCEPTION_OCCURRED.- Throws:
IllegalStateException- if destroy() has been called.RemoteException- if a network anomaly is encountered.
-
readSASLog
String readSASLog(int flag, int maxLines) throws RemoteException, IllegalStateException, TransportException Read the SAS log associated with this execution. The method should only be called after execution is complete. The second parameter specifies the number of lines to be returned - all lines can be requested by specifyingLOG_ALL_LINES. If a call does not return all lines available, subsequent calls to this method return lines in the log after those previously returned. Once all lines have been returned, any subsequent calls will return an empty string. System.getProperty("line.separator") is used to obtain the newline character sequence that is inserted after each line in the returned string. IfLOG_FORMAT_HTMLtype output is requested the returned string is enclosed by "PRE" tags and another newline character sequence appended after the closing "PRE" tag.- Parameters:
flag- one ofLOG_FORMAT_TEXTorLOG_FORMAT_HTMLmaxLines- the maximum number of lines to get orLOG_ALL_LINESif all lines are needed- Returns:
- a String containing the formatted log
- Throws:
RemoteException- if a network anomaly is encountered.IllegalStateException- if the status isSTATUS_EXECUTINGor if destroy() has been called.TransportException- if there is a problem communicating with the SAS server.
-
waitForCompletion
int waitForCompletion() throws InterruptedException, RemoteExceptionWait until the stored process completes execution. If the execution has completed it returns immediately; if not, it blocks (using Java's wait/notify mechanism) until the stored process completes execution.- Returns:
- the completion status - same return value as would be obtained by
calling
getStatus(). - Throws:
IllegalStateException- if destroy() has been called.InterruptedException- if the thread executing the method is interruptedRemoteException- if a network anomaly is encountered.
-
waitForCompletion
int waitForCompletion(long milliSecondTimeout) throws InterruptedException, RemoteException Wait until the stored process completes execution or until the time specified has elapsed. If the execution has completed it returns it returns immediately; if not, it blocks (using Java's wait/notify mechanism) until the stored process completes execution or the time specified has elapsed.- Parameters:
milliSecondTimeout- - the maximum time to wait in milliseconds- Returns:
- the completion status - same return value as would be obtained by
calling
getStatus(). - Throws:
IllegalStateException- if destroy() has been called.InterruptedException- if the thread executing the method is interruptedRemoteException- if a network anomaly is encountered.
-
destroy
void destroy() throws RemoteException, IllegalStateException, ConnectionFactoryException, TransportExceptionFree resources allocated by the service for this execution. This method is called after the client has processed all output from the stored process to perform resource cleanup. The following is done:- If the stored process delivers a package the package is closed unless the life cycle of the package is not bound to the execution interface.
- If a connection was obtained from the connection service by the stored process service the connection is released.
- Frees any logger associated with this object.
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
waitForCompletion()be called before the call to this method.- Throws:
ConnectionFactoryException- if thrown by the Connection Service when closing the connectionIllegalStateException- if the status isSTATUS_EXECUTINGor this method is called a second time.TransportException- if there is a problem communicating with the SAS server.RemoteException- if a network anomaly is encountered.
-
getSessionID
String getSessionID() throws IllegalStateException, RemoteExceptionGet the session id associated with this execution.See the sub-interface method (
Execution2Interface.getSessionID()orExecutionInterface.getSessionID()for more details.- Returns:
- the session id or null if there is no session id associated with the execution.
- Throws:
RemoteException- if a network anomaly is encountered.IllegalStateException
-
getStoredProcessAlert
Get the stored process alert item associated with this execution. An alert is created ifStoredProcessInterface's execute methodwas called with its createAlert parameter set to true.- Returns:
- the alert item associated with this execution or null if there is none.
- Throws:
IllegalStateException- if destroy() has been called.RemoteException- if a network anomaly is encountered.
-
getInputStream
InputStream getInputStream(Object streamKey) throws IllegalStateException, RemoteException Get an input stream. Input streams are only available for stored processes with server typeStoredProcessBaseInterface.SERVER_TYPE_STOREDPROCESS. See the sub-interface method (Execution2Interface.getInputStream(Object)orExecutionInterface.getInputStream(Object)for more details.- Parameters:
streamKey- an object whose toString method provides the stream name.- Returns:
- A serializable object which implements InputStream or null if not available
- Throws:
IllegalStateException- if destroy() has been called.RemoteException- if a network anomaly is encountered.
-
getOutputStream
OutputStream getOutputStream(Object streamKey) throws IllegalStateException, RemoteException Get an output stream. Output streams are only available for stored processes with server typeStoredProcessBaseInterface.SERVER_TYPE_STOREDPROCESS.- Parameters:
streamKey- an object whose toString method provides the stream name.- Returns:
- A serializable object which implements OutputStream or null if not available
- Throws:
IllegalStateException- if destroy() has been called.RemoteException- if a network anomaly is encountered.
-
getInputStreamHeader
com.sas.io.InputStreamHeaderInterface getInputStreamHeader(String streamKey) throws RemoteException Get the stream header for an input stream. An input stream header can only be obtained if the corresponding input stream is available.- Parameters:
streamKey- names the input stream.- Returns:
- the stream header for the input stream specified or null if not available
- Throws:
IllegalStateException- if destroy() has been called.RemoteException- if a network anomaly is encountered.
-
getOutputStreamHeader
com.sas.io.OutputStreamHeaderInterface getOutputStreamHeader(String streamKey) throws RemoteException Get the stream header for an output stream. An output stream header can only be obtained if the corresponding output stream is available.- Parameters:
streamKey- names the output stream.- Returns:
- the stream header for the output stream specified or null if not available
- Throws:
IllegalStateException- if destroy() has been called.RemoteException- if a network anomaly is encountered.
-
getSASConditionCode
int getSASConditionCode() throws RemoteExceptionGet the SAS condition code associated with the execution of the stored process. For stored processes run on a Workspace server the condition code is not available and a value of zero is returned.- Returns:
- the SAS condition code.
- Throws:
RemoteException- if a network anomaly is encountered.IllegalStateException- if the status isSTATUS_EXECUTINGorSTATUS_SAS_EXCEPTION_OCCURRED, or if destroy() has been called.
-