ilog.rules.teamserver.model
Interface IlrSessionFactory
-
- All Superinterfaces:
- java.io.Serializable
- All Known Implementing Classes:
- IlrRemoteSessionFactory
public interface IlrSessionFactory extends java.io.Serializable
A static object used to connect a registered user to Decision Center and get a correspondingIlrSession
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(); }
-
-
Method Summary
Methods Modifier and Type Method and Description void
connect(AuthenticationCredentials credentials, java.lang.String url, java.lang.String dataSourceName)
Establishes a connection to Decision Center.void
connect(java.lang.String username, java.lang.String password, java.lang.String url, java.lang.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(java.lang.String username, java.lang.String password, java.lang.String url, java.lang.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. Ifnull
, the default name isjdbc/ilogDataSource
.- See Also:
- Connecting to Decision Center,
IlrSession.getUserName()
-
connect
void connect(AuthenticationCredentials credentials, java.lang.String url, java.lang.String dataSourceName) throws IlrConnectException
Establishes a connection to Decision Center. When using this method, the credentials are passed to an implementation ofAuthenticationHandler
that is responsible for the connection.You have two options to set the handler:
- You can add the property
AuthenticationCredentials.AuthenticationHandlerClassname
as authentication details of thecredentials
with the fully qualified name of the implementation ofAuthenticationHandler
. - You can add the property "auth-executor-class" in the "com\ibm\rules\decisioncenter\auth.config" file with the fully qualified name of the implementation of
AuthenticationHandler
.
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. Ifnull
, the default name isjdbc/ilogDataSource
.- See Also:
- Connecting to Decision Center,
IlrSession.getUserName()
,AuthenticationCredentials
,AuthenticationHandler
- You can add the property
-
-