public interface Session extends SystemSession
A data mining server is typically a remote server identified by a
ServerConnectionDescriptor
.
From Modeler API 2.0 a server can also be a local server instance spawned as a child process
of the Modeler API host process (see connect()
). This local server mode
requires a local server installation, such as a Modeler client installation, on the
local machine. The installation directory is located through the system property
com.spss.psapi.session.serverInstallationDirectoryThis property must point to a valid installation directory and must be set before the session factory is instantiated otherwise connections to the local server will fail.
Modifier and Type | Method and Description |
---|---|
void |
addExecutionFeedbackListener(ExecutionFeedbackListener listener)
Adds the specified execution feedback listener to this session.
|
void |
addExecutionStateListener(ExecutionStateListener listener)
Adds the specified execution state listener to this session.
|
void |
close()
Closes this session.
|
void |
connect()
Connects this session to a local server instance.
|
void |
connect(ProcessorStream stream)
Connects the stream to the session's server.
|
void |
connect(ServerConnectionDescriptor serverDescriptor)
Connects this session to the remote server identified by the specified server descriptor.
|
ProcessorStream |
createProcessorStream(java.lang.String name)
Deprecated.
|
ProcessorStream |
createProcessorStream(java.lang.String name,
boolean autoConnect)
Deprecated.
|
ServerDatabaseConnection |
createServerDatabaseConnection(java.lang.String datasourceName,
java.lang.String credentialName,
java.lang.String catalogName)
Creates a
ServerDatabaseConnection . |
ServerDatabaseConnection |
createServerDatabaseConnection(java.lang.String datasourceName,
java.lang.String userName,
java.lang.String password,
java.lang.String catalogName)
Creates a
ServerDatabaseConnection . |
ASCredentialDescriptor |
getASCredentialDescriptor()
Returns the credential descriptor used to log in to the Analytic Server.
|
java.lang.Object |
getAttribute(java.lang.String name)
Returns the value of the specified attribute in this session,
or
null if there is no such attribute. |
java.util.Collection<java.lang.String> |
getAttributeNames()
Returns the names of the attributes defined in this session.
|
ContentContainerFactory |
getContentContainerFactory()
Returns the
ContentContainerFactory for this session. |
OutputFactory |
getOutputFactory()
Returns the
OutputFactory for this session. |
ParameterProvider |
getParameters()
Returns the parameter provider for this session.
|
Parser |
getParser()
Returns the shared parser for this session
|
Repository |
getRepository()
Returns the repository object that provides simple mechanisms for storing and
retrieving objects.
|
RepositoryConnectionDescriptor |
getRepositoryConnectionDescriptor()
Returns the repository connection descriptor.
|
RowSetFactory |
getRowSetFactory()
Returns the
RowSetFactory for this session. |
ServerCatalogManager |
getServerCatalogManager()
Returns the server catalog manager for this session
|
ServerConnectionDescriptor |
getServerConnectionDescriptor()
Returns the ServerConnectionDescriptor used to connect this session to a
remote server.
|
RowSet |
getServerDatabaseDriverNames()
Returns a row set that lists the database drivers available on the
data mining server host.
|
RowSet |
getServerDataSourceNames()
Returns a row set that lists the available system DSNs visible on the
data mining server host.
|
ServerFileSystem |
getServerFileSystem()
Returns the server file system.
|
ServerVersionInfo |
getServerVersionInfo()
Returns information about the connected server version
or
null if the session is not connected. |
TaskFactory |
getTaskFactory()
Returns the
TaskFactory for this session. |
TaskRunner |
getTaskRunner()
Returns the
TaskRunner for this session. |
UIResources |
getUIResources()
Returns the interface that provides access to UI-related resources.
|
void |
interrupt()
Interrupts any synchronous task which is currently executing.
|
boolean |
isBusy()
Returns
true if this session is currently executing a synchronous task
(even if the task is in the process of being interrupted). |
boolean |
isClosed()
Returns
true if this has been closed. |
boolean |
isConnected()
Returns
true if this session has a server connection. |
boolean |
isValidASCredentialDescriptor(ASCredentialDescriptor asConnectionDescriptor)
Check weather the credential descriptor is a valid
|
boolean |
isValidRepositoryConnectionDescriptor(RepositoryConnectionDescriptor descriptor)
Returns
true if the supplied repository connection descriptor is
valid i.e. can connect to a content repository. |
ExecutionHandle |
publish(DataWriter node)
Executes the specified
DataWriter in publish mode to obtain a
PublishedImage . |
ExecutionHandle |
publish(TerminalProcessor node,
boolean inline)
Executes the specified node in publish mode to obtain a
PublishedImage ready for inline scoring. |
void |
removeAttribute(java.lang.String name)
Deletes the specified attribute from this session.
|
void |
removeExecutionFeedbackListener(ExecutionFeedbackListener listener)
Removes the specified execution feedback listener from this session.
|
void |
removeExecutionStateListener(ExecutionStateListener listener)
Removes the specified execution state listener from this session.
|
ExecutionHandle |
run(Processor[] nodes,
java.util.Collection results)
Executes the supplied array of nodes synchronously and waits for them to complete.
|
ExecutionHandle |
run(ProcessorStream stream,
java.util.Collection results)
Executes the supplied stream synchronously and waits for it to complete.
|
ExecutionHandle |
runTask(Task task)
Executes the supplied task synchronously and waits for it to complete.
|
void |
setASCredentialDescriptor(ASCredentialDescriptor asConnectionDescriptor)
Sets the credential descriptor used to log in Analytic Server.
|
void |
setAttribute(java.lang.String name,
java.lang.Object value)
Assigns a value to the specified attribute in this session.
|
void |
setRepositoryConnectionDescriptor(RepositoryConnectionDescriptor descriptor)
Sets the repository connection descriptor to be used when a connection
to a content repository is required.
|
ExecutionHandle |
spawn(Processor[] nodes,
java.util.Collection builtObjects)
Executes the supplied array of nodes asynchronously.
|
ExecutionHandle |
spawn(ProcessorStream stream,
java.util.Collection results)
Executes the supplied stream asynchronously.
|
ExecutionHandle |
spawnPublish(DataWriter node)
Executes the specified
DataWriter asynchronously in publish mode to obtain a
PublishedImage . |
ExecutionHandle |
spawnPublish(TerminalProcessor node,
boolean inline)
Executes the specified node asynchronously in publish mode to obtain a
PublishedImage ready for inline scoring. |
ExecutionHandle |
spawnTask(Task task)
Executes the supplied task asynchronously.
|
void |
waitForAllTasksToFinish()
Waits for all tasks in progress on this session to complete.
|
getConnectionDetailView, getConnectionDetailView, getDataModelFactory, getLocale, getLocaleInfo, getPropertyFactory, getRuntimes, isLocalSession
void close()
ProcessorStream
and invalidates
any other objects created by this session.isClosed()
boolean isClosed()
true
if this has been closed.true
if this has been closedclose()
void connect(ServerConnectionDescriptor serverDescriptor) throws ServerConnectionException
serverDescriptor
- identifies a remote data mining serverServerConnectionException
- if a connection to the server cannot be established
or if the Session already has a connectionvoid connect() throws ServerConnectionException
ServerConnectionException
- if a local server instance cannot be created
or if the session already has a connectionboolean isConnected()
true
if this session has a server connection.true
if this session has a server connectionServerConnectionDescriptor getServerConnectionDescriptor()
null
if the session is connected to a
local server or has not yet been connected.null
void setRepositoryConnectionDescriptor(RepositoryConnectionDescriptor descriptor)
descriptor
- the new repository connection descriptorgetRepositoryConnectionDescriptor()
,
isValidRepositoryConnectionDescriptor(com.spss.psapi.core.RepositoryConnectionDescriptor)
RepositoryConnectionDescriptor getRepositoryConnectionDescriptor()
setRepositoryConnectionDescriptor(com.spss.psapi.core.RepositoryConnectionDescriptor)
,
isValidRepositoryConnectionDescriptor(com.spss.psapi.core.RepositoryConnectionDescriptor)
boolean isValidRepositoryConnectionDescriptor(RepositoryConnectionDescriptor descriptor)
true
if the supplied repository connection descriptor is
valid i.e. can connect to a content repository.descriptor
- the repository connection descriptortrue
if the supplied repository connection descriptor is validgetRepositoryConnectionDescriptor()
,
setRepositoryConnectionDescriptor(com.spss.psapi.core.RepositoryConnectionDescriptor)
ASCredentialDescriptor getASCredentialDescriptor()
setASCredentialDescriptor(ASCredentialDescriptor)
,
isValidASCredentialDescriptor(ASCredentialDescriptor)
void setASCredentialDescriptor(ASCredentialDescriptor asConnectionDescriptor)
asConnectionDescriptor
- the credential descriptorgetASCredentialDescriptor()
,
isValidASCredentialDescriptor(ASCredentialDescriptor)
boolean isValidASCredentialDescriptor(ASCredentialDescriptor asConnectionDescriptor)
asConnectionDescriptor
- the credential descriptortrue
if the connection descriptor is validgetASCredentialDescriptor()
,
setASCredentialDescriptor(ASCredentialDescriptor)
ProcessorStream createProcessorStream(java.lang.String name) throws ServerConnectionException
ProcessorStream
. If the session is connected
to a server then the stream will also be connected to the server.
This is the same as calling createProcessorStream(name, autoConnect)
with the autoConnect
set to true
.
This method is deprecated, please use TaskRunner.createStream()
.
name
- the object's nameProcessorStream
ServerConnectionException
- if the Session is already connected
but a new connection could not be created for the streamTaskRunner.createStream(String, boolean, boolean)
,
getTaskRunner()
ProcessorStream createProcessorStream(java.lang.String name, boolean autoConnect) throws ServerConnectionException
ProcessorStream
.
This method is deprecated, please use TaskRunner.createStream()
.
name
- the object's nameautoConnect
- the object's nameProcessorStream
ServerConnectionException
- if the Session is already connected
and the auto-connect flag is true
but a new connection could not be created
for the streamTaskRunner.createStream(String, boolean, boolean)
,
getTaskRunner()
void connect(ProcessorStream stream) throws ServerConnectionException, OwnerException
stream
- the stream to be connectedServerConnectionException
- if the Session is not connected
or if the stream is already connectedOwnerException
- if the stream was not created by this sessionExecutionHandle runTask(Task task) throws OwnerException, ObjectLockedException, SessionException
ExecutionHandle
which can be used to access the exit status and any result from the task.task
- the Task
to be executedOwnerException
- if the task was not created by this session's
TaskFactoryObjectLockedException
- if the task is already executing or any
object referenced by the task is locked for updatingSessionException
- if the session cannot execute the task or if
execution completes in a state other than SUCCESS
ExecutionHandle spawnTask(Task task) throws OwnerException, ObjectLockedException
ExecutionHandle
which can be used to monitor and control the progress of the task.task
- the Task
to be executedOwnerException
- if the task was not created by this session's
TaskFactoryObjectLockedException
- if the task is already executing or any
object referenced by the task is locked for updatingExecutionHandle run(ProcessorStream stream, java.util.Collection results) throws OwnerException, ObjectLockedException, ServerConnectionException, SessionException
ExecutionHandle
which can be used to access the exit status and any result from the task.stream
- the ProcessorStream
to be executedresults
- an empty collection that will contain any built objects once execution has completedOwnerException
- if the stream was not created by this sessionObjectLockedException
- if the stream is lockedServerConnectionException
- if the stream is not connected to a serverSessionException
- if the session is already running
another task, cannot execute the task or if execution completes in
a state other than SUCCESS
ExecutionHandle spawn(ProcessorStream stream, java.util.Collection results) throws OwnerException, ObjectLockedException, ServerConnectionException
ExecutionHandle
which can be used to monitor and control the progress of the task.stream
- the ProcessorStream
to be executedresults
- an empty collection that will contain any built objects once execution has completedOwnerException
- if the stream was not created by this sessionObjectLockedException
- if the stream is lockedServerConnectionException
- if the stream is not connected to a serverExecutionHandle run(Processor[] nodes, java.util.Collection results) throws OwnerException, ObjectLockedException, ServerConnectionException, SessionException
ExecutionHandle
which can be used to access the exit status and any result from the task.nodes
- the array of Processor
objects to be executedresults
- an empty collection that will contain any built objects once execution has completedOwnerException
- if the nodes' stream was not created by this
session or the nodes are not all owned by the same streamObjectLockedException
- if the nodes' owner stream is lockedServerConnectionException
- if the nodes' stream is not connected to a serverSessionException
- if the session is already running
another task, cannot execute the task or if execution completes in
a state other than SUCCESS
java.lang.IllegalArgumentException
- if the array is emptyExecutionHandle spawn(Processor[] nodes, java.util.Collection builtObjects) throws OwnerException, ObjectLockedException, ServerConnectionException
ExecutionHandle
which can be used to monitor and control the progress of the task.
There must be at least one node in the array.nodes
- the array of Processor
objects to be executedbuiltObjects
- an empty collection that will be populated by built objects created by the executionOwnerException
- if the nodes' stream was not created by this
session or the nodes are not all owned by the same streamObjectLockedException
- if the nodes' stream is lockedServerConnectionException
- if the nodes' stream is not connected to a serverjava.lang.IllegalArgumentException
- if the array is emptyExecutionHandle publish(DataWriter node) throws OwnerException, ObjectLockedException, ServerConnectionException, SessionException
DataWriter
in publish mode to obtain a
PublishedImage
. This overrides the execution mode set in the node
and retrieves the published image from the server on completion. Execution is
synchronous. The result is an ExecutionHandle
which can be used to determine
the exit status of the task and, if the task completes successfully, to obtain the
result of the task which is a PublishedImage
.node
- the DataWriter
to be publishedOwnerException
- if the node was not created by this sessionObjectLockedException
- if the node or its containing stream is lockedServerConnectionException
- if the stream is not connected to a serverSessionException
- if the session is already running another task,
or cannot execute the task for some other reason,
or if execution completes in a state other than SUCCESS
ExecutionHandle spawnPublish(DataWriter node) throws OwnerException, ObjectLockedException, ServerConnectionException
DataWriter
asynchronously in publish mode to obtain a
PublishedImage
. This overrides the execution mode set in the node
and retrieves the published image from the server on completion.
Returns an ExecutionHandle
which can be used to monitor and control the progress of the
publishing task and, if it completes successfully, to obtain the task result
which is a PublishedImage
.node
- the DataWriter
to be publishedOwnerException
- if the node was not created by this sessionObjectLockedException
- if the node or its containing stream is lockedServerConnectionException
- if the stream is not connected to a serverExecutionHandle publish(TerminalProcessor node, boolean inline) throws OwnerException, ObjectLockedException, ServerConnectionException, SessionException
PublishedImage
ready for inline scoring.
If inline
is false
, this is equivalent to calling
publish(DataWriter)
and the node must be a data writer. Otherwise,
the node may be any terminal node and the stream is
modified in place
to replace the input and output nodes with ones suitable for inline scoring.
Execution is synchronous. The result is an ExecutionHandle
which can be used to determine
the exit status of the publishing task and, if the task completes successfully, to obtain the
result of the task which is a PublishedImage
.
node
- the TerminalProcessor
to be published.
Must be a DataWriter
if not publishing inlineinline
- true
to prepare the image for inline scoringOwnerException
- if the node was not created by this sessionObjectLockedException
- if the node or its containing stream is lockedServerConnectionException
- if the stream is not connected to a serverSessionException
- if the session is already running another task,
or cannot execute the task for some other reason,
or if the stream cannot be prepared for inline scoring,
or if execution completes in a state other than SUCCESS
ExecutionHandle spawnPublish(TerminalProcessor node, boolean inline) throws OwnerException, ObjectLockedException, ServerConnectionException, SessionException
PublishedImage
ready for inline scoring.
If inline
is false
, this is equivalent to calling
publish(DataWriter)
and the node must be a data writer. Otherwise,
the node may be any terminal node and the stream is
modified in place
to replace the input and output nodes with ones suitable for inline scoring.
Returns an ExecutionHandle
which can be used to monitor and control the progress of the
publishing task and, if it completes successfully, to obtain the task result
which is a PublishedImage
.
node
- the TerminalProcessor
to be published.
Must be a DataWriter
if not publishing inlineinline
- true
to prepare the image for inline scoringOwnerException
- if the node was not created by this sessionObjectLockedException
- if the node or its containing stream is lockedServerConnectionException
- if the stream is not connected to a serverSessionException
- if the stream cannot be prepared for inline scoringServerFileSystem getServerFileSystem() throws ServerConnectionException, ServerResourceException
ServerConnectionException
- if the session is not connected to a serverServerResourceException
- if access to the server file system was deniedRowSet getServerDataSourceNames() throws ServerConnectionException, ServerResourceException
ServerConnectionException
- if the session is not connected to a serverServerResourceException
- if access to the server data sources was deniedRowSet getServerDatabaseDriverNames() throws ServerConnectionException, ServerResourceException
ServerConnectionException
- if the session is not connected to a serverServerResourceException
- if access to the database drivers was deniedServerDatabaseConnection createServerDatabaseConnection(java.lang.String datasourceName, java.lang.String credentialName, java.lang.String catalogName) throws ServerConnectionException, ServerResourceException
ServerDatabaseConnection
. The datasource name must visible
to the data mining server.datasourceName
- the datasource namecredentialName
- the stored credential namecatalogName
- the catalog nameServerDatabaseConnection
ServerConnectionException
- if the session is not connected to a serverServerResourceException
- if the connection task fails.ServerDatabaseConnection createServerDatabaseConnection(java.lang.String datasourceName, java.lang.String userName, java.lang.String password, java.lang.String catalogName) throws ServerConnectionException, ServerResourceException
ServerDatabaseConnection
. The datasource name must visible
to the data mining server.datasourceName
- the datasource nameuserName
- the user namepassword
- the passwordcatalogName
- the catalog nameServerDatabaseConnection
ServerConnectionException
- if the session is not connected to a serverServerResourceException
- if the connection task fails.void addExecutionStateListener(ExecutionStateListener listener)
listener
- the listener to be addedvoid removeExecutionStateListener(ExecutionStateListener listener)
listener
- the listener to be removedvoid addExecutionFeedbackListener(ExecutionFeedbackListener listener)
listener
- the listener to be addedvoid removeExecutionFeedbackListener(ExecutionFeedbackListener listener)
listener
- the listener to be removedboolean isBusy()
true
if this session is currently executing a synchronous task
(even if the task is in the process of being interrupted).
This method may be called from any thread.
true
if this session is executing a synchronous taskinterrupt()
void interrupt()
This method may be called from any thread.
isBusy()
RowSetFactory getRowSetFactory()
RowSetFactory
for this session.RowSetFactory
RowSetFactory
TaskFactory getTaskFactory()
TaskFactory
for this session.TaskFactory
TaskFactory
TaskRunner getTaskRunner()
TaskRunner
for this session.TaskRunner
TaskRunner
OutputFactory getOutputFactory()
OutputFactory
for this session.OutputFactory
OutputFactory
ContentContainerFactory getContentContainerFactory()
ContentContainerFactory
for this session.ContentContainerFactory
ContentContainerFactory
ServerCatalogManager getServerCatalogManager()
java.lang.Object getAttribute(java.lang.String name)
null
if there is no such attribute.
Attributes are created by the application, not by the Modeler API.name
- an attribute namevoid setAttribute(java.lang.String name, java.lang.Object value)
null
, the attribute is deleted from the session.name
- an attribute namevalue
- the attribute valuevoid removeAttribute(java.lang.String name)
name
- an attribute namejava.util.Collection<java.lang.String> getAttributeNames()
void waitForAllTasksToFinish()
UIResources getUIResources()
ServerVersionInfo getServerVersionInfo()
null
if the session is not connected.Repository getRepository()
ParameterProvider getParameters()
Parser getParser()
(C) Copyright IBM Corp. 1994, 2015. All Rights Reserved.