*** This interface provides Binary Compatibility only, not Source Compatibility ***

Interface StoredProcessInterface

All Superinterfaces:
MetadataInterface, PublicObjectInterface, Remote, com.sas.services.util.UpgradeInterface

@SASScope("ALL") @BinaryCompatibilityOnly public interface StoredProcessInterface extends MetadataInterface, UpgradeInterface
This is a generic interface for interacting with a repository entry that represents a SAS stored process object. An object implemented by this interface is also known as a stored process smart object.

This interface can also be used to create a new stored process in metadata. Sample code which creates a new stored process can be found in the description section of this package.

Consumers querying metadata are encouraged to use the model of stored processes introduced in 9.3. Using those getters will work for both styles of stored processes and there should be no need to make version specific tests.

Consumers modifying metadata will need to use version dependent code. Version dependent setters typically throw an UnsupportedOperationException if called on the wrong version of stored process and this is described in the method documentation.

Since:
9.0
  • Field Details

    • NINETWO_VERSION

      static final com.sas.util.UsageVersion NINETWO_VERSION
      The usage version corresponding to version of stored processes that were introduced in 9.2. This version number is 1.0.
      Since:
      9.3
    • NINETHREE_VERSION

      static final com.sas.util.UsageVersion NINETHREE_VERSION
      The usage version corresponding to version of stored processes that were introduced in 9.3. This version number is 2.0.
      Since:
      9.3
    • CURRENT_VERSION

      static final com.sas.util.UsageVersion CURRENT_VERSION
      The usage version corresponding to version of stored processes that are considered current in this release. Do note that older versions may also be supported in a release.

      In 9.3 this value is the same as NINETHREE_VERSION.

      Since:
      9.3
  • Method Details

    • newServiceObject

      StoredProcessInterface newServiceObject(SessionContextInterface sessionContext) throws ServiceException, RemoteException
      Deprecated.
      The StoredProcessInterface service object returned by this method cannot be used to avail of features introduced in 9.2 or later. See newServiceObject().
      Obtains a StoredProcessInterface service object used to execute the Stored Process. This is a legacy method used to handle stored processes in pre-9.2 format. It will also "back-convert" 9.2 format stored processes so that they can be executed by StoredProcessInterface. Its behavior on a 9.3 format stored process is undefined.
      Parameters:
      sessionContext - SessionContextInterface to be used for the execution of the Stored Process
      Returns:
      a StoredProcessInterface service object
      Throws:
      RemoteException - if a network anomaly is encountered
      ServiceException
    • newServiceObject

      Object newServiceObject(StoredProcessOptions options) throws ServiceException, RemoteException
      Obtains a service object used to execute the Stored Process.

      This method is equivalent to calling StoredProcessServiceInterface.newStoredProcess(StoredProcessInterface, StoredProcessOptions) with this smart object and the specified StoredProcessOptions parameter and the javadoc for that method provides complete details of the effects of the options parameter.

      Parameters:
      options - to control the service object
      Returns:
      a Stored Process service object.
      Throws:
      RemoteException - if a network anomaly is encountered
      ServiceException
      Since:
      9.2
    • newServiceObject

      Object newServiceObject() throws ServiceException, RemoteException
      Obtains a service object used to execute the Stored Process. This method returns an interface corresponding to the current version of the service object. In this release it's a StoredProcess2Interface. If the smart object does not correspond to the version supported by this service object a ServiceException will be thrown.

      More specialized behavior can be obtained by calling newServiceObject(StoredProcessOptions).

      Specified by:
      newServiceObject in interface MetadataInterface
      Returns:
      the current version of a Stored Process service object
      Throws:
      RemoteException - if a network anomaly is encountered
      ServiceException - if an error occurs
    • setServer

      void setServer(LogicalServerInterface logicalServer) throws ServiceException, RemoteException
      Sets the logical server smart object the stored process runs on.

      This method is only valid for 9.2 stored processes and will throw an UnsupportedOperationException if invoked on other stored processes.

      Parameters:
      logicalServer - the server to run the stored process on; if null is specified a NullPointerException is thrown
      Throws:
      ServiceException - if there's an exception setting the value
      RemoteException - if a network anomaly is encountered
    • setServerContext

      void setServerContext(ServerContextInterface serverContext) throws ServiceException, RemoteException
      Sets the server context smart object the stored process runs on.

      This method is invalid for 9.2 stored processes and will throw an UnsupportedOperationException if invoked on one.

      Parameters:
      logicalServer - the server context to run the stored process on; if null is specified a NullPointerException is thrown
      Throws:
      ServiceException - if there's an exception setting the value
      RemoteException - if a network anomaly is encountered
      Since:
      9.3
    • setSourceCode

      void setSourceCode(String sourceCode) throws ServiceException, RemoteException
      Sets the source code of the stored process.

      This method is invalid for 9.2 stored processes and will throw an UnsupportedOperationException if invoked on one.

      At the current time this method is only supported if the source code location is StoredProcessInterface.SourceCodeLocation.METADATA.

      Parameters:
      sourceCode - SAS source code, lines are separated using the '\n' character
      Throws:
      ServiceException - if there's an exception setting the value
      RemoteException - if a network anomaly is encountered
      Since:
      9.3
    • getSourceCode

      String getSourceCode() throws ServiceException, RemoteException
      Returns the source code of the stored process.

      At the current time this method is only supported if the source code location is StoredProcessInterface.SourceCodeLocation.METADATA and will return UnsupportedOperationException if the source code location is StoredProcessInterface.SourceCodeLocation.FILE_SYSTEM.

      Returns:
      SAS source code, lines are separated using the '\n' character
      Throws:
      ServiceException - if there's an exception setting the value
      RemoteException - if a network anomaly is encountered
      Since:
      9.3
    • setLogicalServerType

      void setLogicalServerType(StoredProcessInterface.LogicalServerType logicalServerType) throws ServiceException, RemoteException
      Sets the type of logical server the stored process runs on.

      This method is invalid for 9.2 stored processes and will throw an UnsupportedOperationException if invoked on one.

      Parameters:
      logicalServerType - one of the values from StoredProcessInterface.LogicalServerType
      Throws:
      ServiceException - if there's an exception setting the value
      RemoteException - if a network anomaly is encountered
      Since:
      9.3
    • getLogicalServerType

      StoredProcessInterface.LogicalServerType getLogicalServerType() throws ServiceException, RemoteException
      Gets the type of logical server the stored process runs on.

      For 9.2 stored processes the value returned is either StoredProcessInterface.LogicalServerType.WORKSPACE or StoredProcessInterface.LogicalServerType.STORED_PROCESS. Will return null if there is no logical server associated with the stored process which should not happen under normal circumstances.

      Returns:
      one of the values from StoredProcessInterface.LogicalServerType
      Throws:
      ServiceException - if there's an exception setting the value
      RemoteException - if a network anomaly is encountered
      Since:
      9.3
    • setOtherServerContextAllowed

      void setOtherServerContextAllowed(boolean isOtherServerContextAllowed) throws ServiceException, RemoteException
      Sets whether the stored process can run on a different server context. The metadata definition of a stored process specifies a default server context for the stored process to run on. If this method is called with a true argument, a different server context may be specified at execution time.

      Stored processes which are defined to run on more than one server context are required to store their source code in metadata.

      This method is invalid for 9.2 stored processes and will throw an UnsupportedOperationException if invoked on one.

      Parameters:
      isOtherServerContextAllowed - whether a different server context to run the stored process can be specified at execution time
      Throws:
      ServiceException - if there's an exception setting the value
      RemoteException - if a network anomaly is encountered
      Since:
      9.3
    • isOtherServerContextAllowed

      boolean isOtherServerContextAllowed() throws ServiceException, RemoteException
      Determines whether the stored process can run on a different server context.

      Returns:
      whether a different server context to run the stored process can be specified at execution time
      Throws:
      ServiceException - if there's an exception setting the value
      RemoteException - if a network anomaly is encountered
      Since:
      9.3
      See Also:
    • setSourceCodeLocation

      void setSourceCodeLocation(StoredProcessInterface.SourceCodeLocation sourceCodeLocation) throws ServiceException, RemoteException
      Sets the location type of the source code.

      This method is invalid for 9.2 stored processes and will throw an UnsupportedOperationException if invoked on one.

      If other servers contexts are to be allowed (set by calling setOtherServerContextAllowed(boolean) with a true argument), this method should be called with StoredProcessInterface.SourceCodeLocation.METADATA. If other server contexts are not to be allowed, this method can be called with either StoredProcessInterface.SourceCodeLocation value. If the method is not called for a new stored process the default setting will be StoredProcessInterface.SourceCodeLocation.FILE_SYSTEM.

      Parameters:
      sourceCodeLocation - one of StoredProcessInterface.SourceCodeLocation.METADATA or StoredProcessInterface.SourceCodeLocation.FILE_SYSTEM; if null is specified a NullPointerException is thrown
      Throws:
      ServiceException - if there's an exception setting the value
      RemoteException - if a network anomaly is encountered
      Since:
      9.3
    • getSourceCodeLocation

      StoredProcessInterface.SourceCodeLocation getSourceCodeLocation() throws ServiceException, RemoteException
      Gets the location type of the source code.

      See setSourceCodeLocation(SourceCodeLocation) for more details.

      This method returns StoredProcessInterface.SourceCodeLocation.FILE_SYSTEM for 9.2 stored processes.

      Returns:
      one of StoredProcessInterface.SourceCodeLocation.METADATA or StoredProcessInterface.SourceCodeLocation.FILE_SYSTEM
      Throws:
      ServiceException - if there's an exception getting the value
      RemoteException - if a network anomaly is encountered.
      Since:
      9.3
    • setSourceCodeRepository

      void setSourceCodeRepository(DirectoryInterface sourceCodeRepository) throws ServiceException, RemoteException
      Sets the source code repository associated with the stored process.

      9.2 stored processes only support source code in the file system. For other stored processes this method will throw a ServiceException if the source code location is not StoredProcessInterface.SourceCodeLocation.FILE_SYSTEM.

      Parameters:
      sourceCodeRepository - the source code repository associated with the stored process; if null is specified a NullPointerException is thrown
      Throws:
      ServiceException - if there's an exception setting the value
      RemoteException - if a network anomaly is encountered
    • setSourceFileName

      void setSourceFileName(String sourceFileName) throws ServiceException, RemoteException
      Sets the the source code file name of the stored process.

      9.2 stored processes only support source code in the file system. For other stored processes this method will throw a ServiceException if the source code location is not StoredProcessInterface.SourceCodeLocation.FILE_SYSTEM.

      Parameters:
      sourceFileName - the source code file name of the stored process; if null is specified a NullPointerException is thrown
      Throws:
      ServiceException - if there's an exception setting the value
      RemoteException - if a network anomaly is encountered
    • setResultCapabilities

      void setResultCapabilities(boolean isPackageCapable, boolean isStreamCapable) throws ServiceException, RemoteException
      Sets the result capabilities of the stored process. For a new stored process no capability is set by default. Package capability is supported on both types of servers (Workspace and Stored Process). Stream capability is supported only on Stored Process servers in 9.2 and on both types of servers in 9.3.
      Parameters:
      isPackageCapable - true, if package capability is desired; false, if package capability is not desired
      isStreamCapable - true, if stream capability is desired; false, if stream capability is not desired
      Throws:
      ServiceException - if there's an exception setting the value
      RemoteException - if a network anomaly is encountered
    • getServer

      LogicalServerInterface getServer() throws ServiceException, RemoteException
      Gets the the logical server smart object the stored process is designed to run on. A null is returned if one is not available, which should not happen under normal circumstances.

      For 9.2 stored processes it returns the logical server that the stored process is associated with.

      For other stored processes the value returned depends on the value returned by getLogicalServerType(). If that value is StoredProcessInterface.LogicalServerType.WORKSPACE or StoredProcessInterface.LogicalServerType.STORED_PROCESS it returns the Workspace server or Stored Process server connected to the Server Context if that type of server exists and null otherwise. If the value is StoredProcessInterface.LogicalServerType.ANY, it first attempt to find a Stored Process logical server definition attached to the Server Context and returns that if it exists; if that does not exist, it looks for a Workspace logical server definition attached to the same Server Context returning that if it exists; if neither is present, a null is returned. Do note that the value returned is based on metadata definitions and not on the presence of a running server.

      Throws:
      ServiceException - if there's an exception getting the value
      RemoteException - if a network anomaly is encountered.
    • getServerContext

      ServerContextInterface getServerContext() throws ServiceException, RemoteException
      Gets the server context smart object associated with the stored process.

      For 9.2 stored processes: a stored process is associated with a logical server (the corresponding smart object is returned by getServer()). The logical server is associated with a server context and the corresponding smart object for this server context is returned by this method.

      For other stored processes: a stored process is associated with a server context and this method returns the corresponding server context smart object.

      A null is returned if one is not available, which should not happen under normal circumstances.

      Throws:
      ServiceException - if there's an exception getting the value
      RemoteException - if a network anomaly is encountered.
    • getSourceCodeRepository

      DirectoryInterface getSourceCodeRepository() throws ServiceException, RemoteException
      Gets the the source code repository smart object associated with the stored process. A null is returned if one is not available.
      Throws:
      ServiceException - if there's an exception getting the value
      RemoteException - if a network anomaly is encountered.
    • getSourceFileName

      String getSourceFileName() throws ServiceException, RemoteException
      Gets the the source code file name of the stored process. A null is returned if one is not available.
      Throws:
      ServiceException - if there's an exception getting the value
      RemoteException - if a network anomaly is encountered.
    • isPackageCapable

      boolean isPackageCapable() throws ServiceException, RemoteException
      Describes whether the stored process has the result capability of package enabled.
      Returns:
      true if the stored process is capable of package output; false, if not capable
      Throws:
      ServiceException - if there's an exception determining the value
      RemoteException - if a network anomaly is encountered.
    • isStreamCapable

      boolean isStreamCapable() throws ServiceException, RemoteException
      Describes whether the stored process has the result capability of stream enabled.
      Returns:
      true if the stored process is capable of streaming output; false, if not capable
      Throws:
      ServiceException - if there's an exception determining the value
      RemoteException - if a network anomaly is encountered.
    • getOutputParameters

      List<OutputParameter> getOutputParameters() throws ServiceException, RemoteException
      Returns the list of output parameters. The list contains OutputParameter objects. If there are no output parameters an empty list is returned.
      Returns:
      as described above
      Throws:
      ServiceException - if there's an exception getting the value
      RemoteException - if a network anomaly is encountered.
    • setOutputParameters

      void setOutputParameters(List<OutputParameter> outputParameters) throws ServiceException, RemoteException
      Sets the list of output parameters. Specifying a null argument is similar to specifying an empty list. Output parameters should not be set on a 9.2 stored process running on a Workspace server.
      Parameters:
      outputParameters - list of OutputParameter objects.
      Throws:
      ServiceException - if there are inconsistencies in the list of output parameters
      RemoteException - if a network anomaly is encountered
    • getStreams

      List<GenericStream> getStreams() throws ServiceException, RemoteException
      Returns the list of data sources and data targets. The list contains GenericStream and XMLStream objects and the DataSourceOrTarget.isSource() method can be used to determine whether an object is a data source or data target. If there are no data sources or data targets an empty list is returned.

      Do note post 9.2 DataTable support was added to the list of data sources and targets. This method only returns the GenericStream and XMLStream objects present and will not return any DataTable objects that are present.

      Returns:
      as described above
      Throws:
      ServiceException - if there's an exception getting the value
      RemoteException - if a network anomaly is encountered.
      See Also:
    • setStreams

      void setStreams(List<? extends GenericStream> streams) throws ServiceException, RemoteException
      Sets the list of data sources and data targets. The list contains GenericStream and XMLStream objects and the DataSourceOrTarget.isSource() method determines whether an object is a data source or data target. Data sources and data targets are only supported for stored processes which run on Stored Process servers in 9.2 stored processes; for other stored processes, both Stored Process servers and Workspace servers support data sources and data targets.

      Specifying a null argument is equivalent to specifying an empty list.

      This method is only valid for 9.2 stored processes and will throw an UnsupportedOperationException if invoked on other stored processes.

      Parameters:
      streams - list of GenericStream and XMLStream objects
      Throws:
      ServiceException - if there are inconsistencies in the list of streams
      RemoteException - if a network anomaly is encountered
      See Also:
    • getDataSourcesAndTargets

      List<DataSourceOrTarget> getDataSourcesAndTargets() throws ServiceException, RemoteException
      Returns the list of data sources and data targets. The list may contain a mix of GenericStream, XMLStream and DataTable objects. The DataSourceOrTarget.isSource() method can be used to determine whether an object is a data source or a data target. If there are no data sources or data targets an empty list is returned.

      Since 9.2 stored processes did not support DataTable objects this method will not return any DataTable objects for a 9.2 stored process.

      Returns:
      as described above
      Throws:
      ServiceException - if there's an exception getting the value
      RemoteException - if a network anomaly is encountered.
      Since:
      9.3
    • setDataSourcesAndTargets

      void setDataSourcesAndTargets(List<? extends DataSourceOrTarget> dataSourcesAndTargets) throws ServiceException, RemoteException
      Sets the list of data sources and data targets. The list may contain a mix of GenericStream, XMLStream and DataTable objects and the DataSourceOrTarget.isSource() method determines whether an object is a data source or data target.

      This method is invalid for 9.2 stored processes and will throw an UnsupportedOperationException if invoked on one.

      Specifying a null argument is equivalent to specifying an empty list.

      Parameters:
      dataSourcesAndTargets - list of data sources and targets objects
      Throws:
      ServiceException - if there are inconsistencies in the list of streams
      RemoteException - if a network anomaly is encountered
      Since:
      9.3
    • validate

      void validate() throws ServiceException, RemoteException
      Validates the stored process. Minimal validation is done when individual setters are called and the bulk of the validation is done when this method is invoked. There is no requirement for consumer code to call this method. This method is automatically called when the update() method is called to ensure that the values set on the stored process are consistent.

      For a 9.2 stored process, this method checks that

      • a source code repository has been set.
      • a source file name has been set.
      • a server has been set.
      • the server context associated with the server is the same as the server context associated with the source code repository.
      • if run on a Workspace server
        • streaming capability is not set.
        • output parameters are not set.
        • data streams or data targets are not set.
      • that prompt names are unique.
      No validation of the prompt hierarchy is done.

      For a 9.3 stored process, this method checks that

      • a source code repository has been set if the source code is on the file system.
      • a source file name has been set if the source code is on the file system.
      • a server context has been set.
      • the server context associated is the same as the server context associated with the source code repository if the source code repository is set.
      • if other server contexts are allowed the source code is in metadata.
      • that prompt names are unique.
      No validation of the prompt hierarchy is done.
      Throws:
      ServiceException - if an inconsistent set of values has been set
      RemoteException - if a network anomaly is encountered
    • update

      void update() throws ServiceException, RemoteException
      Persists the stored process after performing validation by invoking validate(). If validation is not successful, the stored process is not persisted. Do notice if persistence is done through a mechanism other than invoking the update method, validation will not be done (unless explicitly invoked via validate()) and an inconsistent set of metadata may be persisted.

      Specified by:
      update in interface MetadataInterface
      Throws:
      ServiceException - if an exception was thrown while updating
      RemoteException - if a network anomaly is encountered
    • convertToVersion

      void convertToVersion(com.sas.util.UsageVersion version) throws ServiceException, RemoteException
      Converts the stored process to the version specified. Throws an VersionIncompatibleException if the conversion cannot be performed. After this method is called, update() should be called to persist the changes to the metadata server.

      This method should only be called on a well-formed stored process with one exception. If the InformationServiceInterface.newMetadataInFolder(com.sas.services.information.metadata.FolderInterface, com.sas.services.information.RepositoryInterface, String, String) method is called to create a new stored process, a version 1 stored process is created. In that case, if a different version is desired this method should be called immediately - before any other setters are called.

      If an existing stored process is to be modified and converted it is recommended that this method first be called to perform the conversion, setters then be called to modify the stored process and finally update() be called to write out the stored process to the metadata repository. Alternatively, if the setters are called first, validate() must be called before the call to this method and update().

      If the above "best practices" are not followed, results may be unpredictable and a ServiceException may be thrown.

      Parameters:
      version - the version to convert to; one of NINETWO_VERSION, NINETHREE_VERSION or CURRENT_VERSION.
      Throws:
      ServiceException
      RemoteException
      Since:
      9.3
    • getPromptValues

      com.sas.prompts.PromptValuesInterface getPromptValues() throws ServiceException, RemoteException
      Convenience method to obtain a PromptValues object containing stored process prompts.

      Do note the returned object is for client use. The underlying PromptGroup should not be modified as it belongs to this smart object; if modified, the results are undefined.

      Returns:
      PromptValuesInterface
      Throws:
      ServiceException
      RemoteException
      Since:
      9.3