|
Hyperic HQ Plugin API v. 4.4.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.hyperic.hq.product.GenericPlugin
org.hyperic.hq.product.MeasurementPlugin
org.hyperic.hq.product.JDBCMeasurementPlugin
public abstract class JDBCMeasurementPlugin
Base class for JDBC measurement plugins. Abstracts the JDBC connection and query functionality.
Field Summary | |
---|---|
protected java.lang.String |
_sqlLog
|
protected static java.lang.String |
AVAIL_ATTR
|
static int |
COL_INVALID
|
static java.lang.String |
PROP_INDEX
|
static java.lang.String |
PROP_PASSWORD
|
static java.lang.String |
PROP_TABLE
|
static java.lang.String |
PROP_URL
|
static java.lang.String |
PROP_USER
|
Fields inherited from class org.hyperic.hq.product.MeasurementPlugin |
---|
PROP_TEMPLATE_CONFIG, TYPE_COLLECTOR |
Fields inherited from class org.hyperic.hq.product.GenericPlugin |
---|
config, FILE_DELIM, FILE_DELIM_ESC, PROP_NAME |
Constructor Summary | |
---|---|
JDBCMeasurementPlugin()
|
Method Summary | |
---|---|
protected java.sql.Connection |
getCachedConnection(Metric metric)
|
protected java.sql.Connection |
getCachedConnection(java.lang.String url,
java.lang.String user,
java.lang.String pass)
|
protected int |
getColumn(Metric jdsn)
The column in the ResultSet that holds the measurement value. |
protected java.lang.String |
getColumnName(Metric jdsn)
|
ConfigSchema |
getConfigSchema(TypeInfo info,
ConfigResponse config)
Config schema includes jdbc URL, database username and password. |
protected abstract java.sql.Connection |
getConnection(java.lang.String url,
java.lang.String user,
java.lang.String password)
The plugin must preform the DriverManager.getConnection so its ClassLoader is used to find the driver. |
protected abstract java.lang.String |
getDefaultURL()
|
protected abstract void |
getDriver()
The plugin must preform the Class.forName so its ClassLoader is used to find the driver. |
static java.util.Properties |
getJDBCConnectionProperties(java.lang.String user,
java.lang.String password)
Utility method that returns an instance of Properties containing the given user and password keys. |
protected abstract java.lang.String |
getQuery(Metric jdsn)
|
protected double |
getQueryValue(Metric jdsn)
Do the database query returned by the getQuery() method and return the result. |
protected double |
getQueryValue(Metric jdsn,
boolean logSql)
|
MetricValue |
getValue(Metric metric)
Dispatches to getQueryValue() |
void |
init(PluginManager manager)
Verifies that JDBC driver returned by the getDriver() method can be loaded by the plugin. |
protected abstract void |
initQueries()
|
protected void |
processColumnHeader(java.sql.ResultSetMetaData md)
|
protected void |
processColumns(java.sql.ResultSet rs)
|
protected void |
removeCachedConnection(java.lang.String url,
java.lang.String user,
java.lang.String pass)
|
protected void |
setData(java.sql.ResultSet rs)
|
void |
shutdown()
Close any cached connections. |
Methods inherited from class org.hyperic.hq.product.MeasurementPlugin |
---|
getCollectorProperties, getHelp, getManager, getMeasurementProperties, getMeasurements, getNewCollector, getPlatformHelpProperties, getPluginXMLHelp, translate |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final java.lang.String AVAIL_ATTR
public static final java.lang.String PROP_URL
public static final java.lang.String PROP_USER
public static final java.lang.String PROP_PASSWORD
public static final java.lang.String PROP_TABLE
public static final java.lang.String PROP_INDEX
public static final int COL_INVALID
protected java.lang.String _sqlLog
Constructor Detail |
---|
public JDBCMeasurementPlugin()
Method Detail |
---|
public ConfigSchema getConfigSchema(TypeInfo info, ConfigResponse config)
getConfigSchema
in class MeasurementPlugin
info
- The TypeInfo of this plugin from ProductPlugin.getTypesconfig
- ConfigReponse of the parent resource (if any).
public void init(PluginManager manager) throws PluginException
init
in class MeasurementPlugin
manager
- The plugin manager for this plugin type.
PluginException
public void shutdown() throws PluginException
shutdown
in class GenericPlugin
PluginException
public MetricValue getValue(Metric metric) throws PluginException, MetricUnreachableException, MetricInvalidException, MetricNotFoundException
getValue
in class MeasurementPlugin
metric
- Value returned from translate(), representing a
specific metric to retrieve
PluginException
- Thrown when an internal plugin error occurs
MetricUnreachableException
- The monitored resource is unreachable.
I.e. ConnectException
MetricInvalidException
- The plugin is unable to use the metric,
generally a developer bug where the template is malformed.
I.e. JMX MalformedObjectNameException
MetricNotFoundException
- The monitored resource does not know
about the requested Metric. I.e. JMX AttributeNotFoundExceptionprotected abstract void initQueries()
protected abstract java.lang.String getQuery(Metric jdsn)
protected abstract void getDriver() throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
protected abstract java.sql.Connection getConnection(java.lang.String url, java.lang.String user, java.lang.String password) throws java.sql.SQLException
java.sql.SQLException
protected abstract java.lang.String getDefaultURL()
protected int getColumn(Metric jdsn)
protected java.lang.String getColumnName(Metric jdsn)
protected java.sql.Connection getCachedConnection(Metric metric) throws java.sql.SQLException
java.sql.SQLException
protected java.sql.Connection getCachedConnection(java.lang.String url, java.lang.String user, java.lang.String pass) throws java.sql.SQLException
java.sql.SQLException
protected void removeCachedConnection(java.lang.String url, java.lang.String user, java.lang.String pass)
protected double getQueryValue(Metric jdsn) throws MetricNotFoundException, PluginException, MetricUnreachableException
MetricNotFoundException
PluginException
MetricUnreachableException
protected double getQueryValue(Metric jdsn, boolean logSql) throws MetricNotFoundException, PluginException, MetricUnreachableException
MetricNotFoundException
PluginException
MetricUnreachableException
protected void setData(java.sql.ResultSet rs) throws java.sql.SQLException
java.sql.SQLException
protected void processColumnHeader(java.sql.ResultSetMetaData md) throws java.sql.SQLException
java.sql.SQLException
protected void processColumns(java.sql.ResultSet rs) throws java.sql.SQLException
java.sql.SQLException
public static java.util.Properties getJDBCConnectionProperties(java.lang.String user, java.lang.String password)
user
- the username for the JDBC connectionpassword
- the password for the JDBC connection
|
Hyperic HQ Plugin API v. 4.4.0.2 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |