int updateType, Object oldValue, Object newValue )
throws BrokerException {
String _updatesql = "";
UID currentID = null;
boolean myConn = false;
PreparedStatement pstmt = null;
Exception myex = null;
try {
// Get a connection
DBManager dbMgr = DBManager.getDBManager();
if ( conn == null ) {
conn = dbMgr.getConnection( false );
myConn = true;
}
switch (updateType) {
case HABrokerInfo.UPDATE_VERSION:
_updatesql = updateVersionSQL;
pstmt = conn.prepareStatement( updateVersionSQL );
pstmt.setInt( 1, ((Integer)newValue).intValue() );
pstmt.setString( 2, id );
pstmt.executeUpdate();
pstmt.close();
break;
case HABrokerInfo.UPDATE_URL:
_updatesql = updateURLSQL;
pstmt = conn.prepareStatement( updateURLSQL );
pstmt.setString( 1, (String)newValue );
pstmt.setString( 2, id );
pstmt.executeUpdate();
pstmt.close();
break;
case HABrokerInfo.RESET_TAKEOVER_BROKER_READY_OPERATING:
_updatesql = resetTakeoverBrokerSQL;
pstmt = conn.prepareStatement( resetTakeoverBrokerSQL );
pstmt.setInt( 1, (BrokerState.OPERATING).intValue() );
pstmt.setString( 2, id );
int updateCnt = pstmt.executeUpdate();
pstmt.close();
if (updateCnt == 1) {
logger.log(logger.INFO, br.getKString(
BrokerResources.I_THIS_BROKER_RESETED_TAKEOVER_BROKER, TAKEOVER_BROKER_COLUMN, id));
long ssid = dbMgr.getDAOFactory().getStoreSessionDAO().insert(
conn, id, ((UID)newValue).longValue(), false);
logger.log(logger.INFO, br.getKString(
BrokerResources.I_THIS_BROKER_CURRENT_STORE_SESSION, id, String.valueOf(ssid)));
currentID = new UID(ssid);
break;
} else if (updateCnt == 0) {
_updatesql = updateStateThisBrokerSQL;
if (!updateState( conn, id, BrokerState.OPERATING,
(BrokerState)oldValue, true )) {