Using the Workspace Manager |
The figure below shows the relationship of the interfaces provided with the Workspace Manager.
As the figure shows, the principal interfaces of the SASWorkspaceManager are:
The IWorkspaceManager interface is the top level interface. It provides collection methods for ServerDefs, LoginDefs, LogicalNameDefs, SAS Workspaces and WorkspacePools.
This interface is used to create, enumerate, locate, and remove running SAS Workspace instances. The only SAS Workspaces that can be manipulated through IWorkspaces are those which are created from IWorkspaces.
This interface allows you to create and manipulate login definitions (LoginDefs). A loginDef is only needed for connections using the IOM Bridge for COM. SSPI, the default NT security, is used for COM/DCOM connections.
ILoginDefs contains the standard collection methods Count, _NewEnum, Add, Item, and Remove where the key is the loginDefName. It also supports one additional method: CheckAccess.
The workspace manager uses the server def to determine how to connect to the server. For a local or dcom server, only the Name and Hostname values need be filled out. The IOM Bridge for Com requires Protocol to be set to ProtocolBridge; Port and ServiceName may be used with the IOM Bridge for COM.
IServerDefs contains the standard collection methods Count, _NewEnum, Add, Item, and Remove where the key is the serverDefName. It also supports one additional method: CheckAccess.
This interface is used to create, enumerate, locate, and remove WorkspacePool objects.
This interface is used to configure parameters for a WorkspacePool.
This interface is used to notify a pool when the associated SAS workspace can be returned to the pool.
The reference documentation for using the SASWorkspaceManager interfaces is shipped with the Workspace Manager as online help in .chm format. The following descriptions provide usage information for two commonly used methods:
This method creates a SAS Workspace from a logical name definition. The signature for this method is shown below:
CreateWorkspaceByLogicalName([in]BSTR name, [in] enum Visibility visibility, [in]BSTR logicalName, [in]BSTR referenceDN, [out]BSTR *xmlInfo, [out, retval]IWorkspace **newWorkspace)
The invocation of this method results in the following sequence of steps to create the new workspace:
The name that is passed to the method can be used in other IWorkspaces methods to determine which workspace to locate or remove. The name is also set on IWorkspace->Name before this method returns. The SAS Workspace Manager does not ever look at IWorkspace->Name, so a client could change the name after calling Create. The xmlInfo is only defined when this method returns an IWorkspace. See Error Reporting for details.
Note that the WorkspaceManager should be notified when a Workspace is no longer in use, so the workspace can be removed from the internal list, and so the reference the WorkspaceManager holds on the Workspace can be released.
This method creates a workspace from a ServerDef object instead of a logical name. It also accepts the actual userName and password instead of a reference to a LoginDef. This method is preferred over CreateWorkspaceByLogicalName since it does not require username/password pairs to be written to a file or a network directory.
The signature for this method is shown below:
CreateWorkspaceByServer([in]BSTR workspaceName, [in] enum SASWorkspaceManagerVisibility visibility, [in]IServerDef *serverDef, [in]BSTR userName, [in]BSTR password, [out]BSTR *xmlInfo, [out, retval]IWorkspace **newWorkspace)
This method attempts to connect to each of the hosts listed in the provided serverDef, one at a time, until either a successful connection is made or all hosts have failed. The userName/password is not required for serverDefs that specify ProtocolCom.
Using the Workspace Manager |