You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
227 lines
5.8 KiB
227 lines
5.8 KiB
/****************************************************************************** |
|
* |
|
* Copyright: Intellectual Property of Four Elements Capital Pte Ltd, Singapore. |
|
* All rights reserved. |
|
* |
|
******************************************************************************/ |
|
|
|
package com.fourelementscapital.db; |
|
|
|
import java.sql.Date; |
|
import java.sql.Timestamp; |
|
import java.util.ArrayList; |
|
import java.util.Collection; |
|
import java.util.Map; |
|
import java.util.Vector; |
|
|
|
import com.fourelementscapital.db.vo.BBSyncTrigger; |
|
|
|
|
|
/** |
|
* Abstract class implements methods related to BBSync |
|
*/ |
|
public abstract class BBSyncDB extends SuperDB{ |
|
|
|
/** |
|
* Connect database |
|
*/ |
|
public void connectDB() throws Exception { |
|
super.connectDB(DB_NAME_BBSYNC); |
|
} |
|
|
|
/** |
|
* List all bbsync |
|
* @return bbsync |
|
* @throws Exception |
|
*/ |
|
public abstract Vector listAll() throws Exception; |
|
|
|
/** |
|
* Get field mapping by bbsync id |
|
* @param bbsyncid bbsync id |
|
* @return field mapping |
|
* @throws Exception |
|
*/ |
|
public abstract ArrayList fieldMapping4BBSync(int bbsyncid) throws Exception; |
|
|
|
/** |
|
* Get download query |
|
* @param id bbsync id |
|
* @return bbsync |
|
* @throws Exception |
|
*/ |
|
public abstract Map getDownloadQuery(long id) throws Exception; |
|
|
|
/** |
|
* Get field mapping |
|
* @return field mapping |
|
* @throws Exception |
|
*/ |
|
public abstract Vector getFieldMapping() throws Exception; |
|
|
|
/** |
|
* Update triggered date |
|
* @param id bbsync id |
|
* @param start trigger start date |
|
* @param end trigger end date |
|
* @throws Exception |
|
*/ |
|
public abstract void updateTriggeredDate(int id, Timestamp start, |
|
Timestamp end) throws Exception; |
|
|
|
/** |
|
* Delete field mapping |
|
* @param id field mapping id |
|
* @throws Exception |
|
*/ |
|
public abstract void deleteFieldMapping(int id) throws Exception; |
|
|
|
/** |
|
* Add field mapping |
|
* @param dbfield field mapping db field |
|
* @param bbfield field mapping bb field |
|
* @throws Exception |
|
*/ |
|
public abstract void addFieldMapping(String dbfield, String bbfield) |
|
throws Exception; |
|
|
|
/** |
|
* Update contract logs |
|
* @param contract contracts |
|
* @param marketsector market sector |
|
* @param lastsync last sync |
|
* @param scommodities scommodities |
|
* @param fields contract fields |
|
* @throws Exception |
|
*/ |
|
public abstract void updateContractLogs(Vector<String> contract,String marketsector, |
|
Timestamp lastsync, Map<String, String> scommodities,Collection fields) |
|
throws Exception; |
|
|
|
/** |
|
* Update securities logs |
|
* @param contract contracts |
|
* @param marketsector market sector |
|
* @param lastsync last sync |
|
* @param fields contract fields |
|
* @throws Exception |
|
*/ |
|
public abstract void updateSecuritiesLogs(Vector<String> contract, |
|
String marketsector, Timestamp lastsync,Collection fields) throws Exception; |
|
|
|
/** |
|
* Get contract names to ref synchronized |
|
* @param pendingonly is pending only |
|
* @throws Exception |
|
* @return contract info |
|
*/ |
|
public abstract Vector<String> getContractNames2RefSync(boolean pendingonly) |
|
throws Exception; |
|
|
|
/** |
|
* Get security names to ref synchronized |
|
* @param pendingonly is pending only |
|
* @throws Exception |
|
* @return security info |
|
*/ |
|
public abstract Map<String, String> getSecurityNames2RefSync( |
|
boolean pendingonly) throws Exception; |
|
|
|
/** |
|
* Get security name to ref synchronized |
|
* @param ticker ticker |
|
* @throws Exception |
|
* @return security info |
|
*/ |
|
public abstract Map<String,String> getSecurityName2RefSync(String ticker) throws Exception ; |
|
|
|
/** |
|
* Update contract reference |
|
* @param contractname contract name |
|
* @param fielddata field data |
|
* @throws Exception |
|
*/ |
|
public abstract void updateContractReference(String contractname, |
|
Map<String, String> fielddata) throws Exception; |
|
|
|
/** |
|
* Update security reference |
|
* @param securityname security name |
|
* @param marketsector market sector |
|
* @param fielddata field data |
|
* @throws Exception |
|
*/ |
|
public abstract void updateSecurityReference(String securityname, |
|
String marketsector, Map<String, String> fielddata) |
|
throws Exception; |
|
|
|
/** |
|
* Add sync logs |
|
* @param bbsyncid bbsync id |
|
* @param start start time |
|
* @param end end time |
|
* @param message message |
|
* @param status status |
|
* @param manual_scheduler manual scheduler |
|
* @throws Exception |
|
*/ |
|
public abstract void addSyncLogs(int bbsyncid, Timestamp start, |
|
Timestamp end, String message, String status, |
|
String manual_scheduler) throws Exception; |
|
|
|
/** |
|
* Remove schedule ticker |
|
* @param bbsync_id bbsync id |
|
* @param ticker contract |
|
* @throws Exception |
|
*/ |
|
public abstract void removeScheduleTicker(int bbsync_id, String ticker) |
|
throws Exception; |
|
|
|
/** |
|
* Save schedule |
|
* @param id bbsync id |
|
* @param name bbsync name |
|
* @param mkt_secdb is market security db |
|
* @param dateoption date option |
|
* @param datefrom date from |
|
* @param dateto date to |
|
* @param datenumber date recent number |
|
* @param fields bbsync fields |
|
* @param contracts bbsync contracts |
|
* @param t BBSync trigger |
|
* @param marketsector market sector |
|
* @param timezone timezone |
|
* @return bbsync id |
|
* @throws Exception |
|
*/ |
|
public abstract int saveSchedule(int id, String name, String mkt_secdb, |
|
String dateoption, Date datefrom, Date dateto, int datenumber, |
|
Vector fields, String contracts, BBSyncTrigger t, |
|
String marketsector, String timezone) throws Exception; |
|
|
|
public abstract void deleteQuery(int id) throws Exception; |
|
|
|
/** |
|
* Record started peer |
|
* @param peername peer name |
|
* @param sessionid session id |
|
* @param time time |
|
* @throws Exception |
|
*/ |
|
public abstract void peerStarted(String peername,long sessionid, java.util.Date time) throws Exception ; |
|
|
|
/** |
|
* Record stopped peer |
|
* @param peername peer name |
|
* @param sessionid session id |
|
* @param time time |
|
* @throws Exception |
|
*/ |
|
public abstract void peerStopped(String peername, long sessionid, java.util.Date time) throws Exception; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|