T - public abstract class ConfBase<T extends ConfigBase> extends Logged implements ConfBaseMBean
The property file approach uses the system property
org.bedework.config.pfile
which provides
the absolute path to a property file which may be fetched via http or
read as a local file.
This file has properties defined for each configuration and some global to all
An example file may look like:
org.bedework.config.base=file://$JBOSS_SERVER_DIR/conf/bedework/ # Calendar clients config dir org.bedework.clients.confuri=client-configs # Calendar core config dir org.bedework.bwcore.confuri=bwcore # Calendar engine config dir org.bedework.bwengine.confuri=bwengine # carddav conf dir org.bedework.carddav.confuri=carddavConfig # hosts conf dir org.bedework.hosts.confuri=hosts # selfreg conf dir org.bedework.selfreg.confuri=selfreg # synch conf dir org.bedework.synch.confuri=synch # tzsvr conf dir org.bedework.tzs.confuri=tzsvr
Each may be augmented by providing a path suffix - used to add additional path elements to the base path.
| Modifier and Type | Field and Description |
|---|---|
protected T |
cfg |
static String |
statusDone |
static String |
statusFailed |
static String |
statusRunning |
static String |
statusStopped |
static String |
statusTimedout |
static String |
statusUnknown |
auditLoggerName, debug, errorLoggerName, metricsLoggerName| Modifier | Constructor and Description |
|---|---|
protected |
ConfBase()
At least setServiceName MUST be called
|
protected |
ConfBase(String serviceName) |
| Modifier and Type | Method and Description |
|---|---|
protected ObjectName |
createObjectName(String serviceType,
String name) |
T |
getConfig() |
protected T |
getConfigInfo(Class<T> cl) |
protected T |
getConfigInfo(ConfigurationStore cfs,
String configName,
Class<T> cl) |
protected T |
getConfigInfo(String configName,
Class<T> cl) |
String |
getConfigName() |
String |
getConfigPname() |
String |
getConfigUri() |
static ManagementContext |
getManagementContext() |
String |
getPathSuffix() |
protected Set<ObjectName> |
getRegisteredMBeans() |
String |
getServiceName() |
protected ObjectName |
getServiceObjectName() |
String |
getStatus() |
ConfigurationStore |
getStore()
Get a ConfigurationStore based on the uri or property value.
|
boolean |
isRunning()
Lifecycle
|
abstract String |
loadConfig()
(Re)load the configuration
|
protected String |
loadConfig(Class<T> cl) |
protected String |
loadOnlyConfig(Class<T> cl)
Load the configuration if we only expect one and we don't care or know
what it's called.
|
protected static Object |
makeObject(String className) |
protected void |
register(ObjectName key,
Object bean) |
protected void |
register(String serviceType,
String name,
Object view) |
String |
saveConfig()
Save the current configuration
|
void |
setConfigName(String val) |
void |
setConfigPname(String val)
Specify a system property giving the absolute path to the configuration directory.
|
void |
setConfigUri(String val)
Specify the absolute path to the configuration directory.
|
void |
setPathSuffix(String val)
Specify a suffix to the path to the configuration directory.
|
void |
setServiceName(String val) |
void |
setStatus(String val) |
void |
setStore(ConfigurationStore val)
Set a ConfigurationStore
|
void |
start()
Lifecycle
|
void |
stop()
Lifecycle
|
protected void |
unregister(ObjectName key) |
protected void |
unregister(String serviceType,
String name) |
audit, debug, enableAuditLogger, enableErrorLogger, enableMetricsLogger, error, error, getAuditLoggerIfEnabled, getErrorLoggerIfEnabled, getLogger, getLogger, getMetricsLoggerIfEnabled, info, isAuditLoggerEnabled, isErrorLoggerEnabled, isMetricsLoggerEnabled, metrics, warnpublic static final String statusDone
public static final String statusFailed
public static final String statusRunning
public static final String statusStopped
public static final String statusTimedout
public static final String statusUnknown
protected T extends ConfigBase cfg
protected ConfBase()
protected ConfBase(String serviceName)
public void setServiceName(String val)
val - IDENTICAL to that defined for service.public String getServiceName()
getServiceName in interface BaseMBeanpublic void setStatus(String val)
val - a status.public String getStatus()
public void start()
BaseMBeanpublic void stop()
BaseMBeanpublic boolean isRunning()
BaseMBeanpublic void setConfigUri(String val)
val - public String getConfigUri()
public void setConfigPname(String val)
val - public String getConfigPname()
public void setPathSuffix(String val)
val - public String getPathSuffix()
public void setStore(ConfigurationStore val)
val - public ConfigurationStore getStore() throws ConfigException
ConfigExceptionpublic T getConfig()
public abstract String loadConfig()
protected Set<ObjectName> getRegisteredMBeans()
public void setConfigName(String val)
setConfigName in interface ConfBaseMBeanpublic String getConfigName()
getConfigName in interface ConfBaseMBeanpublic String saveConfig()
ConfBaseMBeansaveConfig in interface ConfBaseMBeanprotected ObjectName getServiceObjectName() throws MalformedObjectNameException
MalformedObjectNameExceptionprotected ObjectName createObjectName(String serviceType, String name) throws MalformedObjectNameException
MalformedObjectNameExceptionprotected T getConfigInfo(Class<T> cl) throws ConfigException
ConfigExceptionprotected T getConfigInfo(String configName, Class<T> cl) throws ConfigException
ConfigExceptionprotected T getConfigInfo(ConfigurationStore cfs, String configName, Class<T> cl) throws ConfigException
ConfigExceptionprotected String loadConfig(Class<T> cl)
cl - protected String loadOnlyConfig(Class<T> cl)
cl - protected void register(ObjectName key, Object bean) throws Exception
key - bean - Exceptionprotected void unregister(ObjectName key) throws Exception
key - Exceptionpublic static ManagementContext getManagementContext()
Copyright © 2017 Bedework. All rights reserved.