Package adams.db.mirrored
Class SpectralDbBackend
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.db.AbstractSpectralDbBackend
-
- adams.db.mirrored.SpectralDbBackend
-
- All Implemented Interfaces:
adams.core.Destroyable
,adams.core.GlobalInfoSupporter
,adams.core.logging.LoggingLevelHandler
,adams.core.logging.LoggingSupporter
,adams.core.option.OptionHandler
,adams.core.SizeOfHandler
,adams.db.BackendManager
,SpectralDbBackend
,Serializable
public class SpectralDbBackend extends AbstractSpectralDbBackend
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 SpectralDbBackend[]
m_Backends
the backends.protected adams.db.AbstractDatabaseConnection[]
m_Mirrors
the database connections of the mirrors.protected adams.db.JdbcUrl[]
m_MirrorsForUrls
the urls the mirrors are for.protected SpectralDbBackend
m_NonMirroredBackend
the default backend.-
Fields inherited from class adams.db.AbstractSpectralDbBackend
BACKEND_AUTODETECT, BACKEND_MYSQL, KEY_BACKEND, m_Initialized, m_Properties, m_Singleton
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from interface adams.db.SpectralDbBackend
FILENAME
-
-
Constructor Summary
Constructors Constructor Description SpectralDbBackend()
-
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(adams.db.AbstractDatabaseConnection conn)
Checks whether connection can be mirrored.void
defineOptions()
Adds options to the internal list of options.protected SpectralDbBackend
getBackendFor(adams.db.AbstractDatabaseConnection conn)
Returns the corresponding backend for the connection URL provided.SpectralDbBackend[]
getBackends()
Returns the backends in use.protected adams.db.AbstractDatabaseConnection
getMirrorFor(adams.db.AbstractDatabaseConnection conn)
Returns the corresponding mirror for the connection URL provided.adams.db.AbstractDatabaseConnection[]
getMirrors()
Returns the mirror connections in use.adams.db.JdbcUrl[]
getMirrorsForUrls()
Returns the URLs that the mirrors are for.SpectralDbBackend
getNonMirroredBackend()
Returns the backend to use for non-mirrored connections.SampleDataIntf
getSampleData(adams.db.AbstractDatabaseConnection conn)
Returns the handler for the sample data table.SpectrumIntf
getSpectrum(adams.db.AbstractDatabaseConnection conn)
Returns the handler for the spectrum table.String
globalInfo()
Returns a string describing the object.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(SpectralDbBackend[] value)
Sets the backends to use.void
setMirrors(adams.db.AbstractDatabaseConnection[] value)
Sets the mirror connections to use.void
setMirrorsForUrls(adams.db.JdbcUrl[] value)
Sets the URLs that the mirrors are for.void
setNonMirroredBackend(SpectralDbBackend value)
Sets the backend to use for non-mirrored connections.-
Methods inherited from class adams.db.AbstractSpectralDbBackend
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
-
-
-
-
Field Detail
-
m_Mirrors
protected adams.db.AbstractDatabaseConnection[] m_Mirrors
the database connections of the mirrors.
-
m_MirrorsForUrls
protected adams.db.JdbcUrl[] m_MirrorsForUrls
the urls the mirrors are for.
-
m_Backends
protected SpectralDbBackend[] m_Backends
the backends.
-
m_NonMirroredBackend
protected SpectralDbBackend m_NonMirroredBackend
the default backend.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceadams.core.GlobalInfoSupporter
- Specified by:
globalInfo
in classadams.core.option.AbstractOptionHandler
- 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 interfaceadams.core.option.OptionHandler
- Overrides:
defineOptions
in classadams.core.option.AbstractOptionHandler
-
setMirrors
public void setMirrors(adams.db.AbstractDatabaseConnection[] value)
Sets the mirror connections to use.- Parameters:
value
- the connections
-
getMirrors
public adams.db.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(adams.db.JdbcUrl[] value)
Sets the URLs that the mirrors are for.- Parameters:
value
- the urls
-
getMirrorsForUrls
public adams.db.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(SpectralDbBackend[] value)
Sets the backends to use.- Parameters:
value
- the backends
-
getBackends
public SpectralDbBackend[] 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(SpectralDbBackend value)
Sets the backend to use for non-mirrored connections.- Parameters:
value
- the backend
-
getNonMirroredBackend
public SpectralDbBackend 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 adams.db.AbstractDatabaseConnection getMirrorFor(adams.db.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 SpectralDbBackend getBackendFor(adams.db.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(adams.db.AbstractDatabaseConnection conn)
Checks whether connection can be mirrored.- Parameters:
conn
- the connection to check- Returns:
- true if can be mirrored
-
getSpectrum
public SpectrumIntf getSpectrum(adams.db.AbstractDatabaseConnection conn)
Returns the handler for the spectrum table.- Parameters:
conn
- the database connection- Returns:
- the handler
-
getSampleData
public SampleDataIntf getSampleData(adams.db.AbstractDatabaseConnection conn)
Returns the handler for the sample data table.- Parameters:
conn
- the database connection- Returns:
- the handler
-
-