Package adams.db.mirrored
Class DbBackend
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,BackendManager
,DbBackend
,Serializable
public class DbBackend extends AbstractDbBackend
MySQL Spectral backend.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected DbBackend[]
m_Backends
the backends.protected AbstractDatabaseConnection[]
m_Mirrors
the database connections of the mirrors.protected JdbcUrl[]
m_MirrorsForUrls
the urls the mirrors are for.protected DbBackend
m_NonMirroredBackend
the default backend.-
Fields inherited from class adams.db.AbstractDbBackend
BACKEND_AUTODETECT, BACKEND_MYSQL, KEY_BACKEND, m_Initialized, m_Properties, m_Singleton
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description DbBackend()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
backendsTipText()
Returns the tip text for this property.protected boolean
canMirror(AbstractDatabaseConnection conn)
Checks whether connection can be mirrored.void
defineOptions()
Adds options to the internal list of options.protected DbBackend
getBackendFor(AbstractDatabaseConnection conn)
Returns the corresponding backend for the connection URL provided.DbBackend[]
getBackends()
Returns the backends in use.LogIntf
getLog(AbstractDatabaseConnection conn)
Returns the handler for the sample data table.protected AbstractDatabaseConnection
getMirrorFor(AbstractDatabaseConnection conn)
Returns the corresponding mirror for the connection URL provided.AbstractDatabaseConnection[]
getMirrors()
Returns the mirror connections in use.JdbcUrl[]
getMirrorsForUrls()
Returns the URLs that the mirrors are for.DbBackend
getNonMirroredBackend()
Returns the backend to use for non-mirrored connections.SQLIntf
getSQL(AbstractDatabaseConnection conn)
Returns the handler for the spectrum table.String
globalInfo()
Returns a string describing the object.boolean
isSupported(AbstractDatabaseConnection conn)
Returns whether this connection is supported.String
mirrorsForUrlsTipText()
Returns the tip text for this property.String
mirrorsTipText()
Returns the tip text for this property.String
nonMirroredBackendTipText()
Returns the tip text for this property.void
setBackends(DbBackend[] value)
Sets the backends to use.void
setMirrors(AbstractDatabaseConnection[] value)
Sets the mirror connections to use.void
setMirrorsForUrls(JdbcUrl[] value)
Sets the URLs that the mirrors are for.void
setNonMirroredBackend(DbBackend value)
Sets the backend to use for non-mirrored connections.-
Methods inherited from class adams.db.AbstractDbBackend
getProperties, getSingleton
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel, setLoggingLevel
-
Methods inherited from interface adams.core.logging.LoggingSupporter
getLogger, isLoggingEnabled
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
m_Mirrors
protected AbstractDatabaseConnection[] m_Mirrors
the database connections of the mirrors.
-
m_MirrorsForUrls
protected JdbcUrl[] m_MirrorsForUrls
the urls the mirrors are for.
-
m_Backends
protected DbBackend[] m_Backends
the backends.
-
m_NonMirroredBackend
protected DbBackend m_NonMirroredBackend
the default backend.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
isSupported
public boolean isSupported(AbstractDatabaseConnection conn)
Returns whether this connection is supported.- Parameters:
conn
- the database connection- Returns:
- always true
-
setMirrors
public void setMirrors(AbstractDatabaseConnection[] value)
Sets the mirror connections to use.- Parameters:
value
- the connections
-
getMirrors
public AbstractDatabaseConnection[] getMirrors()
Returns the mirror connections in use.- Returns:
- the connections
-
mirrorsTipText
public String mirrorsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setMirrorsForUrls
public void setMirrorsForUrls(JdbcUrl[] value)
Sets the URLs that the mirrors are for.- Parameters:
value
- the urls
-
getMirrorsForUrls
public JdbcUrl[] getMirrorsForUrls()
Returns the URLs that the mirrors are for.- Returns:
- the urls
-
mirrorsForUrlsTipText
public String mirrorsForUrlsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setBackends
public void setBackends(DbBackend[] value)
Sets the backends to use.- Parameters:
value
- the backends
-
getBackends
public DbBackend[] getBackends()
Returns the backends in use.- Returns:
- the backends
-
backendsTipText
public String backendsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setNonMirroredBackend
public void setNonMirroredBackend(DbBackend value)
Sets the backend to use for non-mirrored connections.- Parameters:
value
- the backend
-
getNonMirroredBackend
public DbBackend getNonMirroredBackend()
Returns the backend to use for non-mirrored connections.- Returns:
- the backend
-
nonMirroredBackendTipText
public String nonMirroredBackendTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getMirrorFor
protected AbstractDatabaseConnection getMirrorFor(AbstractDatabaseConnection conn)
Returns the corresponding mirror for the connection URL provided.- Parameters:
conn
- the URL to get the mirror for- Returns:
- the mirror, null if no mirror
-
getBackendFor
protected DbBackend getBackendFor(AbstractDatabaseConnection conn)
Returns the corresponding backend for the connection URL provided.- Parameters:
conn
- the URL to get the backend for- Returns:
- the backend, null if no backend
-
canMirror
protected boolean canMirror(AbstractDatabaseConnection conn)
Checks whether connection can be mirrored.- Parameters:
conn
- the connection to check- Returns:
- true if can be mirrored
-
getSQL
public SQLIntf getSQL(AbstractDatabaseConnection conn)
Returns the handler for the spectrum table.- Parameters:
conn
- the database connection- Returns:
- the handler
-
getLog
public LogIntf getLog(AbstractDatabaseConnection conn)
Returns the handler for the sample data table.- Parameters:
conn
- the database connection- Returns:
- the handler
-
-