Channel data model

Channel data model provides the pre-build extensible interfaces, and uses the JPA technique to access persistent channel data. Channel data model includes Database table, Java data bean, and DAO API.

Data base table used in channel data model

An instance of Register Account table (or Channel Runtime table) must depend on an instance in Channel Policy Base table. When an instance in Channel Policy Base table is removed, the corresponding instances in Register Account table (or Channel Runtime table) is removed automatically.

Java data bean used in channel data model

Java data bean is Java abstract for the data in data table. Every data bean is responding to a database table which contains channel data. For example, ChannelPolicyBase is responding to Channel Policy Base table.
The following table shows the details about the data beans.
JavaBean Name Database Table Content User case Data originator
com.ibm.btt.channel.data.ChannelPolicyBase Channel Policy Base Channel policy base data Read often, update/delete rarely, (read when user login When User sign channel
com.ibm.btt.channel.data.ChannelRuntime Channel Runtime User runtime behavior on channel Read/update often, delete rarely, (read/update when user login/ transfer) When User sign channel
com.ibm.btt.channel.data.RegisteredAccounts Registered Accounts Registered Account for each channel signed(part of channel base data) Read often, update/delete rarely, (read when user login) When User sign channel
com.ibm.btt.channel.data.FeePolicyBase Fee Base Fee related Read often, update rarely, no delete (read when application start ) System solution build
com.ibm.btt.channel.data.ChannelEJ Channel EJ All transaction EJ for channels High frequency Add, maintained by DB admin Transaction

DAO API

Channel data model provides a series of DAO API, and you can use them to operate the channel data.
The following figures are DAO APIs:
      public interface ChannelPolicyBaseDAO {

	    public ChannelPolicyBase getChannelPolicyBase(ChannelPolicyBasePK id)  ;

	    public void addChannelPolicyBase(ChannelPolicyBase channelPolicyBase)  ;

	    public void deleteChannelPolicyBase(ChannelPolicyBasePK id)  ;  

	    public void updateChannelPolicyBase(ChannelPolicyBase channelPolicyBase)  ;

	    public List<RegisteredAccounts> getRegisteredAccountsNumber(ChannelPolicyBasePK id) ;

	    public  void  addRegisteredAccountsNumber(ChannelPolicyBasePK id, String[] accountNumbers) ;

	    public void setAccountNumberAlias(ChannelPolicyBasePK id, String accountNumber, String accountAlias) ;

	    public void removeRegisteredAccountNumber(ChannelPolicyBasePK id, String[] accountNumbers) ;
}
An instance of ChannelPolicyBase is responding to a line in Channel Policy Base table. And ChannelPolicyBasePK is the key of ChannelPolicyBase, which including the fields: The interface to operation on ChannelRuntime entity:
public interface ChannelRuntimeDAO {

public ChannelRuntime getChannelRuntime(ChannelRuntimePK id)  ;

public void addChannelRuntime(ChannelRuntime channelRuntime)  ;
public void deleteChannelRuntime(ChannelRuntimePK id)  ;

public void updateChannelRuntime(ChannelRuntime channelRuntime) ;

public void  increaseTransferedAmount(ChannelRuntimePK id, Double amount) ; 

public void  increaseTransferedCount(ChannelRuntimePK id) ; 

public void  increasePasswordErrorCount(ChannelRuntimePK id ) ; 

public void  resetChannelRuntime(ChannelRuntimePK id ) ; 

public void  resetChannelRuntimeAll() ; 
}

An instance of ChannelRuntime is responding to a line in Channel Runtime table. And ChannelRuntimePK is the key of ChannelRuntime, which including the fields:

The following codes give an example to use these interfaces:

ChannelPolicyBaseDAO baseDao=new ChannelPolicyBaseDAOImpl();
		ChannelPolicyBase  policybase=new ChannelPolicyBase();
		policybase.setId(new ChannelPolicyBasePK("user01", "InternetBanking"));
		policybase.setLoginAlias("kkkk");
		
		baseDao.addChannelPolicyBase(policybase);

In the example, a new ChannelPolicyBase instance is created in the DB. The class ChannelPolicyBaseDAOImpl is the implementation class of ChannelPolicyBaseDAO; the class ChannelRuntimeDAOImpl is the implementation class of ChannelRuntimeDAO;

Configuring the channel data model

BTT Channel Data Model follows the JPA standards to persist channel data. Before deploying, you should follow the JPA standards to configure the JDBC Connections. The following steps introduce how to configure:

  1. Specify the file bttchanneldata.jar in your class path. This JAR file is located at ${btt_root}/lib/bttchanneldata.jar.
  2. Specify the file com.ibm.ws.jpa.thinclient.0.jar standalone Java archive (JAR) in your class path. This standalone JAR file is available from the client and server installation images. The location of this file on the client install image is ${app_client_root}/runtimes/com.ibm.ws.jpa.thinclient.0.jar. The location of this file on the server install image is ${app_server_root}/runtimes/com.ibm.ws.jpa.thinclient.0.jar.
  3. Specify the database connection driver jar in your class path. For DB2 v9 or v9.5 or v9.7, the driver JAR files are db2jcc.jar and db2jcc_license_cisuz.jar; For Oracle 11, the driver JAR file is ojdbc14.jar; For SQL Server 2005, the driver JAR file is sqljdbc.jar.
  4. Create database, and then run the DDL files accordingly to the database type to generate or update the tables. The DDL files are available from the file bttchanneldata.jar. For DB2, the DDL file is channelManagement.DDL; For Oracle, the DDL file is channelManagement_oracle.DDL; For SQL Server, the DDL file is channelManagement_sqlserver.DDL.
  5. In the persistence.xml, specify your database configuration options.
    1. If you want to connect to DB in URL mode, specify as following:

      For DB2, specify as following configuration:

      <property name="openjpa.ConnectionDriverName" 		value="com.ibm.db2.jcc.DB2Driver" />
      <property name="openjpa.ConnectionURL" 			value="jdbc:db2://SERVER_NAME:50000/DB_NAME" />
      <property name="openjpa.ConnectionUserName" 		value="USER_NAME" />
      <property name="openjpa.ConnectionPassword" 		value="USER_PASSWORD" />
      </properties>

      For Oracle, specify as following configuration:

      <property name="openjpa.ConnectionDriverName" 			value="oracle.jdbc.driver.OracleDriver" />
      <property name="openjpa.ConnectionURL" 			value="jdbc:oracle:thin:SERVER_NAME:1521:DB_NAME" />
      <property name="openjpa.ConnectionUserName" 			value="USER_NAME" />
      <property name="openjpa.ConnectionPassword" 			value="USER_PASSWORD" />
      </properties> 

      For SQL Server, specify as following configuration:

      <property name="openjpa.ConnectionDriverName" 		value=" com.microsoft.sqlserver.jdbc.SQLServerDriver " />
      <property name="openjpa.ConnectionURL"           value=" jdbc:sqlserver://SERVER_NAME:1433;DatabaseName=DB_NAME/>
      <property name="openjpa.ConnectionUserName" 		value="USER_NAME" />
      <property name="openjpa.ConnectionPassword" 		value="USER_PASSWORD" />
      </properties>
    2. If you want to connect to DB in DataSource mode, specify as following:
      <jta-data-source>JNDI_of_DataSource</jta-data-source>
      <properties>
        <property name="openjpa.jdbc.Schema" value="schema_NAME" />
      </properties>
      Note: If you use SQL Server, the DataSource mode is not commended.