public class Config
extends java.lang.Object
The Config class represents a configuration properties file.
Expected configuration items are:| Item | Description |
|---|---|
| zookeeper | Zookeeper's connection address |
| thread.pool.size | Maximum concurrent data capture executors |
| affinity | Comma-delimited list of data sources enabled for this node |
| interval | Interval between data capture cycles (any integer equal to or greater than zero) |
| sources | Comma-delimited list of data sources |
| source.<source>.connection | jdbc connection string |
| source.<source>.driver | jdbc driver's full classname |
| source.<source>.user | connection's user name |
| source.<source>.password | user's password |
| source.<source>.handlers | comma-delimited list of handler's full classnames |
| Constructor and Description |
|---|
Config(java.lang.String path)
Constructs the object loading configuration properties from a given file.
|
| Modifier and Type | Method and Description |
|---|---|
java.util.List<java.lang.String> |
getAffinity()
Get a list of datasources enabled for this node (parameter
affinity). |
java.lang.String |
getAgentName()
Retrieves a 'unofficial' agent name based.
|
Sources |
getDataSources()
Data sources are a list of database connections and its associated
handler's class names.
|
java.util.Collection<JournalHandler> |
getHandlers()
Retrieves all handlers defined in the configuration properties.
|
Source |
getSourceByHandler(JournalHandler handler)
Retrieves the data source associated to a given handler.
|
int |
getThreadPoolSize()
Retrieves the
thread.pool.size parameter. |
java.lang.String |
getZooKeeper()
Retrieves the zookeeper connection string.
|
void |
listAll()
Print out configuration data.
|
void |
report()
Nice logging for objects
|
java.lang.String |
toString() |
public Config(java.lang.String path)
throws ConfigurationException
path - file/path nameConfigurationException - any configuration retrieval errorpublic Sources getDataSources() throws ConfigurationException
Sources object with a list of data sources.ConfigurationException - when a required entry is missedpublic java.util.Collection<JournalHandler> getHandlers() throws ConfigurationException
ConfigurationException - any configuration retrieval errorpublic Source getSourceByHandler(JournalHandler handler) throws ConfigurationException
handler - a JournalHandler objectSource object associated to the handlerConfigurationException - any configuration retrieval errorpublic java.lang.String getZooKeeper()
throws ConfigurationException
ConfigurationException - any configuration retrieval errorpublic int getThreadPoolSize()
throws ConfigurationException
thread.pool.size parameter.ConfigurationException - any configuration retrieval errorpublic java.util.List<java.lang.String> getAffinity()
throws ConfigurationException
affinity). An empty list means that all datasources must be
considered.ConfigurationException - any configuration retrieval errorpublic java.lang.String getAgentName()
Agent-xxxxx) orAgent-999999)
public void report()
public void listAll()
throws ConfigurationException
ConfigurationException - any configuration retrieval errorpublic java.lang.String toString()
toString in class java.lang.Object