Class ConfigMBeanImpl
- java.lang.Object
-
- javax.management.StandardMBean
-
- org.apache.karaf.config.core.impl.ConfigMBeanImpl
-
- All Implemented Interfaces:
DynamicMBean,MBeanRegistration,ConfigMBean
public class ConfigMBeanImpl extends StandardMBean implements ConfigMBean
Implementation of the ConfigMBean.
-
-
Constructor Summary
Constructors Constructor Description ConfigMBeanImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidappend(String pid, Map<String,String> properties)Add new properties or update existing ones (without removing others) in a given configuration.voidappendProperty(String pid, String key, String value)Append (or add) a value for the given configuration key.voidcreate(String pid)Create a new configuration for the given PID.StringcreateFactoryConfiguration(String factoryPid)StringcreateFactoryConfiguration(String factoryPid, String alias)StringcreateFactoryConfiguration(String factoryPid, String alias, Map<String,String> properties)StringcreateFactoryConfiguration(String factoryPid, Map<String,String> properties)Create a factory based configuration.voiddelete(String pid)Delete a configuration identified by the given PID.voiddelete(String pid, List<String> properties)Delete properties from a configuration.voiddeleteProperty(String pid, String key)Remove the configuration property identified by the given key.protected StringdisplayValue(Object value)booleanexists(String pid)Check if a configuration identified by the given PID exists.List<String>getConfigs()Get all config pidsStringgetProperty(String pid, String key)Get a configuration property.voidinstall(String url, String finalname, boolean override)Install a cfg file.Map<String,String>listProperties(String pid)Get the list of properties for a configuration PID.voidsetConfigRepo(ConfigRepository configRepo)voidsetProperty(String pid, String key, String value)Set a configuration property.voidupdate(String pid, Map<String,String> properties)Update a complete configuration.-
Methods inherited from class javax.management.StandardMBean
cacheMBeanInfo, getAttribute, getAttributes, getCachedMBeanInfo, getClassName, getConstructors, getDescription, getDescription, getDescription, getDescription, getDescription, getDescription, getDescription, getImpact, getImplementation, getImplementationClass, getMBeanInfo, getMBeanInterface, getParameterName, getParameterName, invoke, postDeregister, postRegister, preDeregister, preRegister, setAttribute, setAttributes, setImplementation
-
-
-
-
Constructor Detail
-
ConfigMBeanImpl
public ConfigMBeanImpl() throws NotCompliantMBeanException- Throws:
NotCompliantMBeanException
-
-
Method Detail
-
getConfigs
public List<String> getConfigs() throws MBeanException
Get all config pids- Specified by:
getConfigsin interfaceConfigMBean- Returns:
- the list of all configuration PIDs.
- Throws:
MBeanException- in case of MBean failure.
-
create
public void create(String pid) throws MBeanException
Description copied from interface:ConfigMBeanCreate a new configuration for the given PID.- Specified by:
createin interfaceConfigMBean- Parameters:
pid- the configuration PID.- Throws:
MBeanException- in case of MBean failure.
-
install
public void install(String url, String finalname, boolean override) throws MBeanException
Description copied from interface:ConfigMBeanInstall a cfg file.- Specified by:
installin interfaceConfigMBean- Parameters:
url- The location of the cfg file.finalname- The final name of the cfg file in the etc folder.override- True to override the cfg file if it already exists, false else.- Throws:
MBeanException- in case of MBean failure.
-
delete
public void delete(String pid) throws MBeanException
Description copied from interface:ConfigMBeanDelete a configuration identified by the given PID.- Specified by:
deletein interfaceConfigMBean- Parameters:
pid- the configuration PID to delete.- Throws:
MBeanException- in case of MBean failure.
-
exists
public boolean exists(String pid) throws MBeanException
Description copied from interface:ConfigMBeanCheck if a configuration identified by the given PID exists.- Specified by:
existsin interfaceConfigMBean- Parameters:
pid- The configuration PID to check.- Returns:
- true if the configuration exists, false else.
- Throws:
MBeanException- in case of MBean failure.
-
listProperties
public Map<String,String> listProperties(String pid) throws MBeanException
Description copied from interface:ConfigMBeanGet the list of properties for a configuration PID.- Specified by:
listPropertiesin interfaceConfigMBean- Parameters:
pid- the configuration PID.- Returns:
- the list of properties.
- Throws:
MBeanException- in case of MBean failure.
-
deleteProperty
public void deleteProperty(String pid, String key) throws MBeanException
Description copied from interface:ConfigMBeanRemove the configuration property identified by the given key.- Specified by:
deletePropertyin interfaceConfigMBean- Parameters:
pid- the configuration PID.key- the property key.- Throws:
MBeanException- in case of MBean failure.
-
appendProperty
public void appendProperty(String pid, String key, String value) throws MBeanException
Description copied from interface:ConfigMBeanAppend (or add) a value for the given configuration key.- Specified by:
appendPropertyin interfaceConfigMBean- Parameters:
pid- the configuration PID.key- the property key.value- the value to append to the current property value.- Throws:
MBeanException- in case of MBean failure.
-
setProperty
public void setProperty(String pid, String key, String value) throws MBeanException
Description copied from interface:ConfigMBeanSet a configuration property.- Specified by:
setPropertyin interfaceConfigMBean- Parameters:
pid- the configuration PID.key- the property key.value- the property value.- Throws:
MBeanException- in case of MBean failure.
-
getProperty
public String getProperty(String pid, String key) throws MBeanException
Description copied from interface:ConfigMBeanGet a configuration property.- Specified by:
getPropertyin interfaceConfigMBean- Parameters:
pid- the configuration PID.key- the property key.- Throws:
MBeanException- in case of MBean failure.
-
update
public void update(String pid, Map<String,String> properties) throws MBeanException
Description copied from interface:ConfigMBeanUpdate a complete configuration.- Specified by:
updatein interfaceConfigMBean- Parameters:
pid- the configuration PID.properties- the new properties to set in the configuration.- Throws:
MBeanException- in case of MBean failure.
-
append
public void append(String pid, Map<String,String> properties) throws MBeanException
Description copied from interface:ConfigMBeanAdd new properties or update existing ones (without removing others) in a given configuration.- Specified by:
appendin interfaceConfigMBean- Parameters:
pid- the configuration PID.properties- the properties to add/update.- Throws:
MBeanException- in case of MBean failure.
-
delete
public void delete(String pid, List<String> properties) throws MBeanException
Description copied from interface:ConfigMBeanDelete properties from a configuration.- Specified by:
deletein interfaceConfigMBean- Parameters:
pid- the configuration PID.properties- the properties to delete from the configuration.- Throws:
MBeanException- in case of MBean failure.
-
setConfigRepo
public void setConfigRepo(ConfigRepository configRepo)
-
createFactoryConfiguration
public String createFactoryConfiguration(String factoryPid) throws MBeanException
- Specified by:
createFactoryConfigurationin interfaceConfigMBean- Throws:
MBeanException
-
createFactoryConfiguration
public String createFactoryConfiguration(String factoryPid, String alias) throws MBeanException
- Specified by:
createFactoryConfigurationin interfaceConfigMBean- Throws:
MBeanException
-
createFactoryConfiguration
public String createFactoryConfiguration(String factoryPid, Map<String,String> properties) throws MBeanException
Description copied from interface:ConfigMBeanCreate a factory based configuration.- Specified by:
createFactoryConfigurationin interfaceConfigMBean- Parameters:
factoryPid- the configuration factory PID.properties- the new properties to set in the configuration.- Returns:
- the created PID.
- Throws:
MBeanException- in case of MBean failure.
-
createFactoryConfiguration
public String createFactoryConfiguration(String factoryPid, String alias, Map<String,String> properties) throws MBeanException
- Specified by:
createFactoryConfigurationin interfaceConfigMBean- Throws:
MBeanException
-
-