public final class SaJMXConfiguration extends Object implements DynamicMBean
DynamicMBean
implementation for the JMX system configuration.Modifier and Type | Field and Description |
---|---|
static String |
CFG_TAG
Config tag.
|
static String |
CONFIG_DIR
Configuration directory.
|
static String |
ROOT_TAG
Root entry for Saperion.
|
static String |
SYSTEM_CONFIG
System configuration name.
|
Modifier and Type | Method and Description |
---|---|
void |
addNewProperties(String name,
SaAbstractJMXProperties props)
Add new property set.
|
boolean |
configureLog4j(SaJMXConstants.ConfigKey section)
Configures the Log4J system from the given section key.
|
boolean |
configureLog4j(String section)
Configures the Log4J system from the given section.
|
String |
getAbsoluteConfigPath(String fileName)
returns an absolute path for the specified file name.
|
Object |
getAttribute(String attributeName) |
AttributeList |
getAttributes(String[] attributeNames) |
boolean |
getBooleanProperty(SaJMXConstants.ConfigKey configKey,
String name,
boolean defaultValue)
Reads boolean property with default value.
|
boolean |
getBooleanProperty(String name,
boolean defaultValue)
Reads boolean property in dotted name format with default value.
|
SaJMXConstants.ConfigVariant |
getConfigType()
Reads the configuration type.
|
double |
getDoubleProperty(SaJMXConstants.ConfigKey configKey,
String name,
double defaultValue)
Reads double property with default value.
|
double |
getDoubleProperty(String name,
double defaultValue)
Reads double property in dotted name format with default value.
|
File |
getFileProperty(SaJMXConstants.ConfigKey configKey,
String name)
Reads file property.
|
String |
getFirstToken(String value,
String delimiter)
Returns the first token of the given value, separated by the given
delimiter.
|
static SaJMXConfiguration |
getInstance()
Get instance.
|
int |
getIntProperty(SaJMXConstants.ConfigKey configKey,
String name,
int defaultValue)
Reads integer property with default value.
|
int |
getIntProperty(String name,
int defaultValue)
Reads integer property in dotted name format with default value.
|
File |
getLinkProperty(SaJMXConstants.ConfigKey configKey)
Reads linked file property.
|
MBeanInfo |
getMBeanInfo() |
int |
getNumberOfTokens(SaJMXConstants.ConfigKey configKey,
String propertyName,
String delimiter)
Reads a multivalue property and returns the number of tokens separated by
the given delimiter.
|
Properties |
getProperties(SaJMXConstants.ConfigKey key)
Reads a property set.
|
Properties |
getProperties(String name)
Reads a property set.
|
String |
getProperty(SaJMXConstants.ConfigKey configKey,
String key)
Returns the value for a given key from the given configuration.
|
String |
getProperty(SaJMXConstants.ConfigKey configKey,
String key,
String defaultValue)
Returns the value for a given key from the given configuration with
default value.
|
String |
getProperty(String name)
Reads property in dotted name format.
|
String |
getProperty(String name,
String defaultValue)
Reads property in dotted name format with default value.
|
int |
getSecondIntToken(String value,
String delimiter,
int defaultValue)
Returns the second token of the given value and converts it to int.
|
String[] |
getTokens(SaJMXConstants.ConfigKey configKey,
String propertyName,
String delimiter)
Reads a multivalue property separated by the given delimiter and returns
the values as String[].
|
boolean |
hasProperty(SaJMXConstants.ConfigKey configKey,
String propertyName)
Returns true if the property with the given name exists within the given
configuration.
|
boolean |
hasSection(SaJMXConstants.ConfigKey key)
Checks, if the given section exists.
|
boolean |
hasSection(String section)
Checks, if the given section exists.
|
Object |
invoke(String actionName,
Object[] params,
String[] signature) |
boolean |
isLog4jConfigured() |
void |
newBackendProperties(SaRMISystemCommand cmd,
Properties sysprops)
Adds the backend properties to configuration.
|
void |
newFeatureProperties(SaRMISystemCommand cmd)
Adds the backend features to configuration.
|
void |
newLink(String name,
String configFile)
Add a new property set to the configuration.
|
void |
newProperties(String name,
InputStream in)
Add a new stream property set to the configuration.
|
void |
newProperties(String name,
String configFile)
Add a new property set to the configuration.
|
void |
newProperties(String name,
String configFile,
boolean isClassPathResource)
Add a new property set to the configuration.
|
void |
newXMLProperties(String name,
InputStream in)
Add a new XML property set to the configuration.
|
void |
newXMLProperties(String name,
String configFile)
Add a new XML property set to the configuration.
|
void |
registerBean(String name,
Object bean)
Register a new bean.
|
void |
setAttribute(Attribute attribute) |
AttributeList |
setAttributes(AttributeList attributes) |
void |
setConfigType(SaJMXConstants.ConfigVariant type,
Properties configuration)
Set the configuration type and properties.
|
void |
setConfigType(SaJMXConstants.ConfigVariant type,
String mainFile)
Set the configuration type and main file.
|
void |
setConfigTypeAndConfigDirectory(SaJMXConstants.ConfigVariant type,
String configurationDir)
Set the configuration type and configuration directory.
|
void |
setProperties(SaJMXConstants.ConfigKey key,
Properties props)
sets a property set to the already existing configuration.
|
public static final String ROOT_TAG
public static final String CFG_TAG
public static final String SYSTEM_CONFIG
public static final String CONFIG_DIR
public static SaJMXConfiguration getInstance()
public String getAbsoluteConfigPath(String fileName)
fileName
- the name of configuration filepublic boolean hasSection(String section)
section
- Section namepublic boolean hasSection(SaJMXConstants.ConfigKey key)
key
- Section keypublic void addNewProperties(String name, SaAbstractJMXProperties props)
name
- Nameprops
- Propertiespublic void registerBean(String name, Object bean)
name
- Namebean
- Beanpublic boolean configureLog4j(String section)
section
- Sectionpublic boolean isLog4jConfigured()
public boolean configureLog4j(SaJMXConstants.ConfigKey section)
section
- Section keypublic void setConfigType(SaJMXConstants.ConfigVariant type, String mainFile) throws FileNotFoundException
type
- Configuration typemainFile
- Main file nameFileNotFoundException
- File not found.public void setConfigType(SaJMXConstants.ConfigVariant type, Properties configuration)
type
- Configuration typeconfiguration
- Configuration propertiespublic void setConfigTypeAndConfigDirectory(SaJMXConstants.ConfigVariant type, String configurationDir) throws FileNotFoundException
type
- Configuration typeconfigurationDir
- Configuration directoryFileNotFoundException
- File not found.public SaJMXConstants.ConfigVariant getConfigType()
public void newProperties(String name, String configFile) throws IOException
name
- Configuration nameconfigFile
- Configuration file nameIOException
- Exceptionpublic void newProperties(String name, String configFile, boolean isClassPathResource) throws IOException
name
- Configuration nameconfigFile
- Configuration file nameisClassPathResource
- true if configFile is a classpath related resourceIOException
- Exceptionpublic void newLink(String name, String configFile) throws IOException
name
- Configuration nameconfigFile
- Configuration file nameIOException
- Exceptionpublic void newProperties(String name, InputStream in) throws IOException
name
- Configuration namein
- Configuration streamIOException
- Exceptionpublic void newXMLProperties(String name, InputStream in) throws IOException
name
- Configuration namein
- Configuration streamIOException
- Exceptionpublic void newXMLProperties(String name, String configFile) throws IOException
name
- Configuration nameconfigFile
- Configuration file nameIOException
- Exceptionpublic void newBackendProperties(SaRMISystemCommand cmd, Properties sysprops) throws RemoteException
cmd
- System commandssysprops
- Properties of section ApplicationServerRemoteException
- Exceptionpublic void newFeatureProperties(SaRMISystemCommand cmd) throws RemoteException
cmd
- System commandsRemoteException
- Exceptionpublic Properties getProperties(String name)
name
- Namepublic Properties getProperties(SaJMXConstants.ConfigKey key)
key
- ConfigKeypublic void setProperties(SaJMXConstants.ConfigKey key, Properties props)
key
- ConfigKeyprops
- Propertiespublic String getProperty(SaJMXConstants.ConfigKey configKey, String key)
configKey
- Configuration keykey
- Keypublic boolean hasProperty(SaJMXConstants.ConfigKey configKey, String propertyName)
configKey
- Configuration keypropertyName
- property namepublic String getProperty(SaJMXConstants.ConfigKey configKey, String key, String defaultValue)
configKey
- Configuration keykey
- KeydefaultValue
- Default valuepublic String getProperty(String name)
name
- Namepublic String getProperty(String name, String defaultValue)
name
- NamedefaultValue
- Default valuepublic int getIntProperty(String name, int defaultValue)
name
- NamedefaultValue
- Default valuepublic int getIntProperty(SaJMXConstants.ConfigKey configKey, String name, int defaultValue)
configKey
- Configuration keyname
- NamedefaultValue
- Default valuepublic double getDoubleProperty(String name, double defaultValue)
name
- NamedefaultValue
- Default valuepublic double getDoubleProperty(SaJMXConstants.ConfigKey configKey, String name, double defaultValue)
configKey
- Configuration keyname
- NamedefaultValue
- Default valuepublic boolean getBooleanProperty(String name, boolean defaultValue)
name
- NamedefaultValue
- Default valuepublic boolean getBooleanProperty(SaJMXConstants.ConfigKey configKey, String name, boolean defaultValue)
configKey
- Configuration keyname
- NamedefaultValue
- Default valuepublic File getFileProperty(SaJMXConstants.ConfigKey configKey, String name) throws FileNotFoundException
configKey
- Configuration keyname
- NameFileNotFoundException
- File not foundpublic File getLinkProperty(SaJMXConstants.ConfigKey configKey) throws FileNotFoundException
configKey
- Configuration keyFileNotFoundException
- File not foundpublic int getNumberOfTokens(SaJMXConstants.ConfigKey configKey, String propertyName, String delimiter)
configKey
- configuration keypropertyName
- the name of the propertydelimiter
- the delimiter separating the tokenspublic String[] getTokens(SaJMXConstants.ConfigKey configKey, String propertyName, String delimiter)
configKey
- configuration keypropertyName
- the name of the propertydelimiter
- the delimiter separating the tokenspublic String getFirstToken(String value, String delimiter)
value
- given string to splitdelimiter
- the delimiter separating the tokenspublic int getSecondIntToken(String value, String delimiter, int defaultValue)
NumberFormatException
occurs, the given defaultValue is
returned.value
- given string to splitdelimiter
- the delimiter separating the tokensdefaultValue
- if the second token is undefined or may not be converted to
int the defaultValue will be returned.public Object getAttribute(String attributeName) throws AttributeNotFoundException, MBeanException, ReflectionException
getAttribute
in interface DynamicMBean
AttributeNotFoundException
MBeanException
ReflectionException
DynamicMBean.getAttribute(java.lang.String)
public AttributeList getAttributes(String[] attributeNames)
getAttributes
in interface DynamicMBean
DynamicMBean.getAttributes(java.lang.String[])
public MBeanInfo getMBeanInfo()
getMBeanInfo
in interface DynamicMBean
DynamicMBean.getMBeanInfo()
public Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException, ReflectionException
invoke
in interface DynamicMBean
MBeanException
ReflectionException
DynamicMBean.invoke(java.lang.String,
java.lang.Object[], java.lang.String[])
public void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException
setAttribute
in interface DynamicMBean
AttributeNotFoundException
InvalidAttributeValueException
MBeanException
ReflectionException
DynamicMBean.setAttribute(javax.management.Attribute)
public AttributeList setAttributes(AttributeList attributes)
setAttributes
in interface DynamicMBean
DynamicMBean.setAttributes(javax.management.AttributeList)
Copyright © 2016 SAPERION AG. All rights reserved.