Package com.saperion.config
Class SaJMXConfiguration
java.lang.Object
com.saperion.config.SaJMXConfiguration
- All Implemented Interfaces:
- DynamicMBean
A 
DynamicMBean implementation for the JMX system configuration.- Author:
- rbo
- 
Field SummaryFields
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddNewProperties(String name, SaAbstractJMXProperties props) Add new property set.booleanconfigureLog4j(SaJMXConstants.ConfigKey section) Configures the Log4J system from the given section key.booleanconfigureLog4j(String section) Configures the Log4J system from the given section.getAbsoluteConfigPath(String fileName) returns an absolute path for the specified file name.getAttribute(String attributeName) getAttributes(String[] attributeNames) booleangetBooleanProperty(SaJMXConstants.ConfigKey configKey, String name, boolean defaultValue) Reads boolean property with default value.booleangetBooleanProperty(String name, boolean defaultValue) Reads boolean property in dotted name format with default value.Reads the configuration type.doublegetDoubleProperty(SaJMXConstants.ConfigKey configKey, String name, double defaultValue) Reads double property with default value.doublegetDoubleProperty(String name, double defaultValue) Reads double property in dotted name format with default value.getFileProperty(SaJMXConstants.ConfigKey configKey, String name) Reads file property.getFirstToken(String value, String delimiter) Returns the first token of the given value, separated by the given delimiter.static SaJMXConfigurationGet instance.intgetIntProperty(SaJMXConstants.ConfigKey configKey, String name, int defaultValue) Reads integer property with default value.intgetIntProperty(String name, int defaultValue) Reads integer property in dotted name format with default value.getLinkProperty(SaJMXConstants.ConfigKey configKey) Reads linked file property.intgetNumberOfTokens(SaJMXConstants.ConfigKey configKey, String propertyName, String delimiter) Reads a multivalue property and returns the number of tokens separated by the given delimiter.Reads a property set.getProperties(String name) Reads a property set.getProperty(SaJMXConstants.ConfigKey configKey, String key) Returns the value for a given key from the given configuration.getProperty(SaJMXConstants.ConfigKey configKey, String key, String defaultValue) Returns the value for a given key from the given configuration with default value.getProperty(String name) Reads property in dotted name format.getProperty(String name, String defaultValue) Reads property in dotted name format with default value.intgetSecondIntToken(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[].booleanhasProperty(SaJMXConstants.ConfigKey configKey, String propertyName) Returns true if the property with the given name exists within the given configuration.booleanChecks, if the given section exists.booleanhasSection(String section) Checks, if the given section exists.booleanvoidnewBackendProperties(SaRMISystemCommand cmd, Properties sysprops) Adds the backend properties to configuration.voidAdds the backend features to configuration.voidAdd a new property set to the configuration.voidnewProperties(String name, InputStream in) Add a new stream property set to the configuration.voidnewProperties(String name, String configFile) Add a new property set to the configuration.voidnewProperties(String name, String configFile, boolean isClassPathResource) Add a new property set to the configuration.voidnewXMLProperties(String name, InputStream in) Add a new XML property set to the configuration.voidnewXMLProperties(String name, String configFile) Add a new XML property set to the configuration.voidregisterBean(String name, Object bean) Register a new bean.voidregisterBean(String name, Object bean, int port) Register a new bean.voidsetAttribute(Attribute attribute) setAttributes(AttributeList attributes) voidsetConfigType(SaJMXConstants.ConfigVariant type, String mainFile) Set the configuration type and main file.voidsetConfigType(SaJMXConstants.ConfigVariant type, Properties configuration) Set the configuration type and properties.voidsetConfigTypeAndConfigDirectory(SaJMXConstants.ConfigVariant type, String configurationDir) Set the configuration type and configuration directory.voidsetProperties(SaJMXConstants.ConfigKey key, Properties props) sets a property set to the already existing configuration.
- 
Field Details- 
ROOT_TAGRoot entry for Saperion.- See Also:
 
- 
CFG_TAGConfig tag.- See Also:
 
- 
SYSTEM_CONFIGSystem configuration name.
- 
CONFIG_DIRConfiguration directory.
 
- 
- 
Method Details- 
getInstanceGet instance.- Returns:
- Instance
 
- 
getConfigDir
- 
getAbsoluteConfigPathreturns an absolute path for the specified file name.- Parameters:
- fileName- the name of configuration file
- Returns:
- the absolute path.
 
- 
hasSectionChecks, if the given section exists.- Parameters:
- section- Section name
- Returns:
- True, if exists
 
- 
hasSectionChecks, if the given section exists.- Parameters:
- key- Section key
- Returns:
- True, if exists
 
- 
addNewPropertiesAdd new property set.- Parameters:
- name- Name
- props- Properties
 
- 
registerBeanRegister a new bean.- Parameters:
- name- Name
- bean-
 
- 
registerBeanRegister a new bean.- Parameters:
- name- Name
- bean-
- port-
 
- 
configureLog4jConfigures the Log4J system from the given section.- Parameters:
- section- Section
- Returns:
- Success
 
- 
isLog4jConfiguredpublic boolean isLog4jConfigured()- Returns:
- log4j configured
 
- 
configureLog4jConfigures the Log4J system from the given section key.- Parameters:
- section- Section key
- Returns:
- Success
 
- 
setConfigTypepublic void setConfigType(SaJMXConstants.ConfigVariant type, String mainFile) throws FileNotFoundException Set the configuration type and main file.- Parameters:
- type- Configuration type
- mainFile- Main file name
- Throws:
- FileNotFoundException- File not found.
 
- 
setConfigTypeSet the configuration type and properties.- Parameters:
- type- Configuration type
- configuration- Configuration properties
 
- 
setConfigTypeAndConfigDirectorypublic void setConfigTypeAndConfigDirectory(SaJMXConstants.ConfigVariant type, String configurationDir) throws FileNotFoundException Set the configuration type and configuration directory.- Parameters:
- type- Configuration type
- configurationDir- Configuration directory
- Throws:
- FileNotFoundException- File not found.
 
- 
getConfigTypeReads the configuration type.- Returns:
- Configuration type
 
- 
newPropertiesAdd a new property set to the configuration.- Parameters:
- name- Configuration name
- configFile- Configuration file name
- Throws:
- IOException- Exception
 
- 
newPropertiespublic void newProperties(String name, String configFile, boolean isClassPathResource) throws IOException Add a new property set to the configuration.- Parameters:
- name- Configuration name
- configFile- Configuration file name
- isClassPathResource- true if configFile is a classpath related resource
- Throws:
- IOException- Exception
 
- 
newLinkAdd a new property set to the configuration.- Parameters:
- name- Configuration name
- configFile- Configuration file name
- Throws:
- IOException- Exception
 
- 
newPropertiesAdd a new stream property set to the configuration.- Parameters:
- name- Configuration name
- in- Configuration stream
- Throws:
- IOException- Exception
 
- 
newXMLPropertiesAdd a new XML property set to the configuration.- Parameters:
- name- Configuration name
- in- Configuration stream
- Throws:
- IOException- Exception
 
- 
newXMLPropertiesAdd a new XML property set to the configuration.- Parameters:
- name- Configuration name
- configFile- Configuration file name
- Throws:
- IOException- Exception
 
- 
newBackendPropertiespublic void newBackendProperties(SaRMISystemCommand cmd, Properties sysprops) throws RemoteException Adds the backend properties to configuration.- Parameters:
- cmd- System commands
- sysprops- Properties of section ApplicationServer
- Throws:
- RemoteException- Exception
 
- 
newFeaturePropertiesAdds the backend features to configuration.- Parameters:
- cmd- System commands
- Throws:
- RemoteException- Exception
 
- 
getPropertiesReads a property set.- Parameters:
- name- Name
- Returns:
- Property set or NULL, if set of this name don't exists
 
- 
getPropertiesReads a property set.- Parameters:
- key- ConfigKey
- Returns:
- Property set or NULL, if set of this name don't exists
 
- 
setPropertiessets a property set to the already existing configuration.- Parameters:
- key- ConfigKey
- props- Properties
 
- 
getPropertyReturns the value for a given key from the given configuration.- Parameters:
- configKey- Configuration key
- key- Key
- Returns:
- Value
 
- 
hasPropertyReturns true if the property with the given name exists within the given configuration.- Parameters:
- configKey- Configuration key
- propertyName- property name
- Returns:
- Value
 
- 
getPropertyReturns the value for a given key from the given configuration with default value.- Parameters:
- configKey- Configuration key
- key- Key
- defaultValue- Default value
- Returns:
- Value
 
- 
getPropertyReads property in dotted name format.- Parameters:
- name- Name
- Returns:
- Value
 
- 
getPropertyReads property in dotted name format with default value.- Parameters:
- name- Name
- defaultValue- Default value
- Returns:
- Value
 
- 
getIntPropertyReads integer property in dotted name format with default value.- Parameters:
- name- Name
- defaultValue- Default value
- Returns:
- Value
 
- 
getIntPropertyReads integer property with default value.- Parameters:
- configKey- Configuration key
- name- Name
- defaultValue- Default value
- Returns:
- Value
 
- 
getDoublePropertyReads double property in dotted name format with default value.- Parameters:
- name- Name
- defaultValue- Default value
- Returns:
- Value
 
- 
getDoublePropertypublic double getDoubleProperty(SaJMXConstants.ConfigKey configKey, String name, double defaultValue) Reads double property with default value.- Parameters:
- configKey- Configuration key
- name- Name
- defaultValue- Default value
- Returns:
- Value
 
- 
getBooleanPropertyReads boolean property in dotted name format with default value.- Parameters:
- name- Name
- defaultValue- Default value
- Returns:
- Value
 
- 
getBooleanPropertypublic boolean getBooleanProperty(SaJMXConstants.ConfigKey configKey, String name, boolean defaultValue) Reads boolean property with default value.- Parameters:
- configKey- Configuration key
- name- Name
- defaultValue- Default value
- Returns:
- Value
 
- 
getFilePropertypublic File getFileProperty(SaJMXConstants.ConfigKey configKey, String name) throws FileNotFoundException Reads file property.- Parameters:
- configKey- Configuration key
- name- Name
- Returns:
- Value
- Throws:
- FileNotFoundException- File not found
 
- 
getLinkPropertyReads linked file property.- Parameters:
- configKey- Configuration key
- Returns:
- Value
- Throws:
- FileNotFoundException- File not found
 
- 
getNumberOfTokenspublic int getNumberOfTokens(SaJMXConstants.ConfigKey configKey, String propertyName, String delimiter) Reads a multivalue property and returns the number of tokens separated by the given delimiter.- Parameters:
- configKey- configuration key
- propertyName- the name of the property
- delimiter- the delimiter separating the tokens
- Returns:
- number of tokens
 
- 
getTokenspublic String[] getTokens(SaJMXConstants.ConfigKey configKey, String propertyName, String delimiter) Reads a multivalue property separated by the given delimiter and returns the values as String[]. Note that all whitespaces are removed.- Parameters:
- configKey- configuration key
- propertyName- the name of the property
- delimiter- the delimiter separating the tokens
- Returns:
- values as String[]
 
- 
getFirstTokenReturns the first token of the given value, separated by the given delimiter. Example: if value = host:port (delimiter is ":") host will be returned.- Parameters:
- value- given string to split
- delimiter- the delimiter separating the tokens
- Returns:
- first token
 
- 
getSecondIntTokenReturns the second token of the given value and converts it to int. Both tokens has to be separated by the given delimiter. Example: if value = host:port (delimiter is ":") port will be returned. If aNumberFormatExceptionoccurs, the given defaultValue is returned.- Parameters:
- value- given string to split
- delimiter- the delimiter separating the tokens
- defaultValue- if the second token is undefined or may not be converted to int the defaultValue will be returned.
- Returns:
- second token as int
 
- 
getAttributepublic Object getAttribute(String attributeName) throws AttributeNotFoundException, MBeanException, ReflectionException - Specified by:
- getAttributein interface- DynamicMBean
- Throws:
- AttributeNotFoundException
- MBeanException
- ReflectionException
- See Also:
 
- 
getAttributes- Specified by:
- getAttributesin interface- DynamicMBean
- See Also:
 
- 
getMBeanInfo- Specified by:
- getMBeanInfoin interface- DynamicMBean
- See Also:
 
- 
invokepublic Object invoke(String actionName, Object[] params, String[] signature) throws MBeanException, ReflectionException - Specified by:
- invokein interface- DynamicMBean
- Throws:
- MBeanException
- ReflectionException
- See Also:
 
- 
setAttributepublic void setAttribute(Attribute attribute) throws AttributeNotFoundException, InvalidAttributeValueException, MBeanException, ReflectionException - Specified by:
- setAttributein interface- DynamicMBean
- Throws:
- AttributeNotFoundException
- InvalidAttributeValueException
- MBeanException
- ReflectionException
- See Also:
 
- 
setAttributes- Specified by:
- setAttributesin interface- DynamicMBean
- See Also:
 
 
-