Decision Center API

ilog.rules.teamserver.model
Interface IlrSessionFactory

All Superinterfaces:
Serializable
All Known Implementing Classes:
IlrRemoteSessionFactory

public interface IlrSessionFactory
extends Serializable

A static object used to connect a registered user to Decision Center and get a corresponding IlrSession instance.

Code Example

The following code example shows how to connect to Decision Center and retrieve an active session:

   String serverUrl = "http://hostname:9080/teamserver";
   String datasource = "jdbc/ilogDataSource";
   String login = "rtsAdmin";
   String password = "rtsAdmin";
   String project = "loanvalidation-rules";

   IlrSessionFactory factory = new IlrRemoteSessionFactory();
   try {
     factory.connect(login, password, serverUrl, datasource);
     IlrSession session = factory.getSession();
     //Perform some actions
     //You should always close a session after actions are performed
     //to free up Decision Center resources and improve performance.
     session.close();
   }
   catch (IlrConnectException cE)
   {
     cE.printStackTrace();
   }
 

See Also:
IlrSession

Method Summary
 void connect(AuthenticationCredentials credentials, String url, String dataSourceName)
          Establishes a connection to Decision Center.
 void connect(String username, String password, String url, String dataSourceName)
          Connects the given user to Decision Center.
 IlrSession getSession()
          Returns the session created by the connection.
 

Method Detail

getSession

IlrSession getSession()
Returns the session created by the connection.

Returns:
A session, or null if no user is connected or if the connection failed.

connect

void connect(String username,
             String password,
             String url,
             String dataSourceName)
             throws IlrConnectException
Connects the given user to Decision Center.

Once connected, getSession will return a session associated with this user.

Throws:
IlrConnectException - If the connection failed.
Parameters:
username - The user name.
password - The user password.
url - The URL of the application server.
dataSourceName - The name of the data source. If null, the default name is jdbc/ilogDataSource.
See Also:
Connecting to Decision Center, IlrSession.getUserName()

connect

void connect(AuthenticationCredentials credentials,
             String url,
             String dataSourceName)
             throws IlrConnectException
Establishes a connection to Decision Center. When using this method, the credentials are passed to an implementation of AuthenticationHandler that is responsible for the connection.

You have two options to set the handler:

Once connected, getSession will return a session associated with this user.

Throws:
IlrConnectException - If the connection failed.
Parameters:
credentials - The credentials to use for the connection.
url - The URL of the application server.
dataSourceName - The name of the data source. If null, the default name is jdbc/ilogDataSource.
See Also:
Connecting to Decision Center, IlrSession.getUserName(), AuthenticationCredentials, AuthenticationHandler

Decision Center API

© Copyright IBM Corp. 1987, 2013