Java Reference
In-Depth Information
Container-Managed Sign-On
In container-managed sign-on, an application component does not have to pass any sign-
on security information to the getConnection() method. The security information is
supplied by the container, as shown in the following example (the method call is high-
lighted in bold ):
Click here to view code image
// Business method in an application component
Context initctx = new InitialContext();
// Perform JNDI lookup to obtain a connection factory
javax.resource.cci.ConnectionFactory cxf =
(javax.resource.cci.ConnectionFactory)initctx.lookup(
"java:comp/env/eis/MainframeCxFactory");
// Invoke factory to obtain a connection. The security
// information is not passed in the getConnection method
javax.resource.cci.Connection cx = cxf. getConnection() ;
...
Component-Managed Sign-On
In component-managed sign-on, an application component is responsible for passing the
needed sign-on security information for the resource to the getConnection method.
For example, security information might be a user name and password, as shown here (the
method call is highlighted in bold ):
Click here to view code image
// Method in an application component
Context initctx = new InitialContext();
// Perform JNDI lookup to obtain a connection factory
javax.resource.cci.ConnectionFactory cxf =
(javax.resource.cci.ConnectionFactory)initctx.lookup(
"java:comp/env/eis/MainframeCxFactory");
// Get a new ConnectionSpec
com.myeis.ConnectionSpecImpl properties = //..
// Invoke factory to obtain a connection
properties.setUserName("...");
properties.setPassword("...");
javax.resource.cci.Connection cx =
cxf. getConnection(properties) ;
...
Search WWH ::




Custom Search