com.oy.shared.lw.samples.mysqlrepl.impl
Class MySqlReplCmd

java.lang.Object
  extended bycom.oy.shared.lw.samples.mysqlrepl.impl.MySqlReplCmd

public class MySqlReplCmd
extends java.lang.Object


Field Summary
private  MySqlReplContext ctx
           
private static java.text.NumberFormat formatter
           
(package private)  java.lang.String SHOW_MASTER_LOGS_LOG_NAME
           
(package private)  java.lang.String SHOW_MASTER_STATUS_FILE
           
(package private)  java.lang.String SHOW_SLAVE_STATUS_MASTER_LOG_FILE
           
(package private)  java.lang.String SHOW_VARIABLE_VALUE
           
private  ITrace trace
           
 
Constructor Summary
MySqlReplCmd(ITrace trace, MySqlReplContext ctx)
           
 
Method Summary
 java.sql.Connection borrowNewToMaster()
           
private  java.sql.Connection borrowNewToRoot()
           
 java.sql.Connection borrowNewToSlave()
           
private  int execUpdate(java.sql.Connection conn, java.lang.String sql)
           
private  java.lang.String formatBinLogFileName(int idx, java.lang.String baseName)
           
private static int getBinLogFileIndex(java.lang.String fileName)
           
private static java.lang.String getBinLogFileNameBase(java.lang.String fileName)
           
 MySqlReplDbStatus getSlaveStatus(java.sql.Connection toSlave, int uid)
           
 MySqlReplDbStatus incMasterStatus(java.sql.Connection toMaster, int uid)
           
 boolean initMaster()
           
private  boolean isValidMasterBinLog(java.sql.Connection toMaster, java.lang.String name)
           
private  java.sql.PreparedStatement newPreparedStatement(java.sql.Connection conn, java.lang.String text)
           
 void purgeBinLogs(java.sql.Connection toMaster, MySqlReplDbStatus slaveStatus, MySqlReplStatusMonitor monitor)
           
 void releaseToMaster(java.sql.Connection conn)
           
 void releaseToRoot(java.sql.Connection conn)
           
 void releaseToSlave(java.sql.Connection conn)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

formatter

private static final java.text.NumberFormat formatter

SHOW_MASTER_STATUS_FILE

final java.lang.String SHOW_MASTER_STATUS_FILE
See Also:
Constant Field Values

SHOW_SLAVE_STATUS_MASTER_LOG_FILE

final java.lang.String SHOW_SLAVE_STATUS_MASTER_LOG_FILE
See Also:
Constant Field Values

SHOW_MASTER_LOGS_LOG_NAME

final java.lang.String SHOW_MASTER_LOGS_LOG_NAME
See Also:
Constant Field Values

SHOW_VARIABLE_VALUE

final java.lang.String SHOW_VARIABLE_VALUE
See Also:
Constant Field Values

trace

private ITrace trace

ctx

private MySqlReplContext ctx
Constructor Detail

MySqlReplCmd

public MySqlReplCmd(ITrace trace,
                    MySqlReplContext ctx)
Method Detail

initMaster

public boolean initMaster()
                   throws java.sql.SQLException
Throws:
java.sql.SQLException

incMasterStatus

public MySqlReplDbStatus incMasterStatus(java.sql.Connection toMaster,
                                         int uid)
                                  throws java.sql.SQLException
Throws:
java.sql.SQLException

getSlaveStatus

public MySqlReplDbStatus getSlaveStatus(java.sql.Connection toSlave,
                                        int uid)
                                 throws java.sql.SQLException,
                                        ESlaveStateException
Throws:
java.sql.SQLException
ESlaveStateException

isValidMasterBinLog

private boolean isValidMasterBinLog(java.sql.Connection toMaster,
                                    java.lang.String name)
                             throws java.sql.SQLException
Throws:
java.sql.SQLException

purgeBinLogs

public void purgeBinLogs(java.sql.Connection toMaster,
                         MySqlReplDbStatus slaveStatus,
                         MySqlReplStatusMonitor monitor)
                  throws java.sql.SQLException
Throws:
java.sql.SQLException

execUpdate

private int execUpdate(java.sql.Connection conn,
                       java.lang.String sql)
                throws java.sql.SQLException
Throws:
java.sql.SQLException

releaseToSlave

public void releaseToSlave(java.sql.Connection conn)

releaseToMaster

public void releaseToMaster(java.sql.Connection conn)

releaseToRoot

public void releaseToRoot(java.sql.Connection conn)

borrowNewToSlave

public java.sql.Connection borrowNewToSlave()
                                     throws java.sql.SQLException
Throws:
java.sql.SQLException

borrowNewToMaster

public java.sql.Connection borrowNewToMaster()
                                      throws java.sql.SQLException
Throws:
java.sql.SQLException

borrowNewToRoot

private java.sql.Connection borrowNewToRoot()
                                     throws java.sql.SQLException
Throws:
java.sql.SQLException

getBinLogFileIndex

private static int getBinLogFileIndex(java.lang.String fileName)

getBinLogFileNameBase

private static java.lang.String getBinLogFileNameBase(java.lang.String fileName)

formatBinLogFileName

private java.lang.String formatBinLogFileName(int idx,
                                              java.lang.String baseName)

newPreparedStatement

private java.sql.PreparedStatement newPreparedStatement(java.sql.Connection conn,
                                                        java.lang.String text)
                                                 throws java.sql.SQLException
Throws:
java.sql.SQLException


Copyright (C) 2005-2006 Pavel Simakov
http://www.softwaresecretweapons.com