|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectibi.broker.api.cci.CasterConnectionFactory
public class CasterConnectionFactory
This class is used with theCasterConnection
andCasterManagedConnectionFactory
classes to connect to ReportCaster. These three classes are implementations of the JCA'sConnectionFactory
, Connection, andManagedConnectionFactory
classes, respectively, and enable the application client components to obtain connections. Together, these three classes form the basis of ReportCaster's implementation of the J2EE CCI interfaces.The J2EE application components, which can include EJBs, JavaBeans, JSPs, and servlets, access a particular ReportCaster instance using the
CasterConnectionFactory
, which provides a repository of connection objects for the requesting client. Whether the client (which may be ReportCaster itself) accesses the underlying data repository directly (non-managed mode) or indirectly through a J2EE application server (managed mode),CasterConnectionFactory
allocates connection handles in the form of CasterConnnection instances.A
CasterConnection
instance serves as a main endpoint in the dialog between the requesting clients, application server, and the underlying resource. This dialog is mediated by the resource adapter, which is implemented within the ReportCaster API as a design pattern, not as a packaged JAR requiring an application server level deployment descriptor. The class that provides the point of access isCasterConnectionFactory
.The code below illustrates how the
CasterConnectionFactory
class is used. This sample code below is taken from the samples packaged with the product. ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + Copyright (c) 2004 Information Builders, Inc. All Rights Reserved. + + + + Information Builders offers sample API programs as a heuristic device. + + They are not intended, as is, for production use. Licensed users are + + welcome to alter and extend these samples and deploy them in other + + environments, or alternate configurations, as they see fit. + + Information Builders will support the documented functionality of + + its API classes and methods. However, Information Builders is not + + responsible for functionality or behavior of products built with + + its API unless the documented behavior of its discrete classes and + + methods is different than the actual results. + + + + Redistributions of IBI source code and documentation must be within + + the scope of the Information Builders Software License Agreement. + + + + ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ package ibi.broker.api.samples; import ibi.broker.api.CasterManagedConnectionFactory; import ibi.broker.api.cci.CasterConnection; import ibi.broker.api.cci.CasterConnectionFactory; import ibi.broker.api.cci.PasswordCredential; import java.util.ResourceBundle; import javax.resource.cci.ConnectionSpec; public class Util { public static CasterConnection createCasterConnection() throws Exception { ResourceBundle bundle = null; String host = "localhost"; String port = "8200"; String user = "admin"; String password = ""; try { bundle = ResourceBundle.getBundle("ibi.broker.api.samples.samples"); host = bundle.getString("host"); port = bundle.getString("port"); user = bundle.getString("user"); password = bundle.getString("password"); } catch(Exception ex){} CasterManagedConnectionFactory managedConnectionFactory = new CasterManagedConnectionFactory(); managedConnectionFactory.setServerName(host); managedConnectionFactory.setPortNumber(port); CasterConnectionFactory connectionFactory = (CasterConnectionFactory)managedConnectionFactory.createConnectionFactory(); ConnectionSpec credential = new PasswordCredential(user, password.toCharArray()); return ((CasterConnection)connectionFactory.getConnection(credential)); }
Constructor Summary | |
---|---|
CasterConnectionFactory(javax.resource.spi.ConnectionManager cm,
javax.resource.spi.ManagedConnectionFactory mcf)
Primary constructor for CasterConnectionFactory. |
Method Summary | |
---|---|
javax.resource.cci.Connection |
getConnection()
Obtains a CasterConnection instance of the connection handle
to satisfy a connection request for the current user. |
javax.resource.cci.Connection |
getConnection(javax.resource.cci.ConnectionSpec credential)
Obtains a CasterConnection instance of the connection handle
to satisfy a connection request from the user identified in the
ConnectionSpec . |
javax.resource.cci.Connection |
getConnection(javax.resource.cci.ConnectionSpec credential,
boolean specialCheckingMRRole,
boolean useConsoleMode)
|
javax.resource.cci.ResourceAdapterMetaData |
getMetaData()
Obtains metadata for the Resource Adapter. |
javax.resource.cci.RecordFactory |
getRecordFactory()
Obtains a RecordFactory object, used to create generic Record
instances. |
javax.naming.Reference |
getReference()
Obtains the Reference instance. |
java.util.Hashtable |
getSendMode()
|
boolean |
isWebAuthenticationEnabled()
|
void |
setAuthenticationExit(java.lang.String exit)
Specifies the AuthenticationExit's class or interface name. |
void |
setConfig(ibi.broker.system.config.CasterConfig config)
Assigns the Configuration file for the Distribution server. |
void |
setDSTTraceWorker(ibi.broker.util.DSTTraceWorker traceWorker)
|
void |
setReference(javax.naming.Reference arg0)
Sets the Reference instance. |
void |
setRepositoryType(int i)
Sets the ReportCaster repository type specified as an integer value. |
void |
setSendMode(java.util.Hashtable sendMode)
|
void |
setWebAuthenticationEnabled(boolean flag)
Specifies the value of a boolean flag which indicates whether or not WebAuthentication is turned on. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CasterConnectionFactory(javax.resource.spi.ConnectionManager cm, javax.resource.spi.ManagedConnectionFactory mcf)
Method Detail |
---|
public void setDSTTraceWorker(ibi.broker.util.DSTTraceWorker traceWorker)
public void setSendMode(java.util.Hashtable sendMode)
public java.util.Hashtable getSendMode()
public void setConfig(ibi.broker.system.config.CasterConfig config)
config
- name of distribution server configuration file.public javax.resource.cci.Connection getConnection() throws javax.resource.ResourceException
CasterConnection
instance of the connection handle
to satisfy a connection request for the current user. This getConnection
variant should be used when an application component requires that the
container manage sign-on/security. This scenario is termed container-
managed sign-on whereby the client component calling the method does not
pass in any security information but instead leaves that up to the application
server.
getConnection
in interface javax.resource.cci.ConnectionFactory
CasterConnection
instance.
javax.resource.ResourceException
- - Failed to get a CasterConnection instance.
Examples of error cases are:
getConnection(javax.resource.cci.ConnectionSpec)
public javax.resource.cci.Connection getConnection(javax.resource.cci.ConnectionSpec credential) throws javax.resource.ResourceException
CasterConnection
instance of the connection handle
to satisfy a connection request from the user identified in the
ConnectionSpec
. This version of getConnection
should be used in the case where the application component manages the
security (i.e., component-managed sign on). In contrast to the previous case
where sign-on is managed by the application server container, here the
client passes in security credentials such as username and password directly
through the ConnectionSpec
instance.
getConnection
in interface javax.resource.cci.ConnectionFactory
credential
- A reference to the
ConnectionSpec
object used to specify the users security
credentials.
CasterConnection
instance.
javax.resource.ResourceException
- - Failed to get a CasterConnection instance.
Examples of error cases are:
getConnection()
public javax.resource.cci.Connection getConnection(javax.resource.cci.ConnectionSpec credential, boolean specialCheckingMRRole, boolean useConsoleMode) throws javax.resource.ResourceException
javax.resource.ResourceException
public javax.resource.cci.RecordFactory getRecordFactory() throws javax.resource.ResourceException
RecordFactory
object, used to create generic Record
instances. This feature is currently unavailable to API users.
getRecordFactory
in interface javax.resource.cci.ConnectionFactory
null
.
javax.resource.ResourceException
ConnectionFactory.getRecordFactory()
public javax.resource.cci.ResourceAdapterMetaData getMetaData() throws javax.resource.ResourceException
getMetaData
in interface javax.resource.cci.ConnectionFactory
ResourceAdapterMetaData
.
javax.resource.ResourceException
- - Failed to get metadata information about the resource
adapter.getMetaData()
public void setReference(javax.naming.Reference arg0)
arg0
- - A Reference instanceReferenceable.setReference(javax.naming.Reference)
,
getReference()
public javax.naming.Reference getReference() throws javax.naming.NamingException
getReference
in interface javax.naming.Referenceable
javax.naming.NamingException
- - if a naming exception was encountered while
retrieving the reference.Referenceable.getReference()
public void setWebAuthenticationEnabled(boolean flag)
flag
- The Boolean value.public boolean isWebAuthenticationEnabled()
public void setAuthenticationExit(java.lang.String exit)
exit
- name of class or interface which specifies the
WebAuthentication exit point.public void setRepositoryType(int i)
CasterManagedConnectionFactory
class.
i
- DB ibi.broker.api.CasterManagedConnectionFactory.DB
;ibi.broker.api.CasterManagedConnectionFactory.LDAP
;
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |