Package org.wso2.carbon.base
Class ServerConfiguration
- java.lang.Object
-
- org.wso2.carbon.base.ServerConfiguration
-
- All Implemented Interfaces:
ServerConfigurationService
public class ServerConfiguration extends Object implements ServerConfigurationService
This class stores the configuration of the Carbon Server.
-
-
Field Summary
Fields Modifier and Type Field Description static StringAXIS2_CONFIG_REPO_LOCATIONConstant to be used for properties storing the axis2 repository location.static StringCOMMAND_LISTENER_PORTConstant to be used for properties storing the port of the command listener.static StringHTTP_PORTConstant to be used for properties storing the http port of the servlet transport.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voidforceInit(InputStream xmlInputStream)Method to forcibly initialize the server configuration.voidforceInit(String configurationXMLLocation)Method to forcibly initialize the server configuration.voidforceInit(String configurationXMLLocation, boolean isLoadedConfigurationPreserved)Method to forcibly initialize the server configuration.ElementgetDocumentElement()Method to retrieve the Configuration as an XML Document.StringgetFirstProperty(String key)There can be multiple objects with the same key.static ServerConfigurationgetInstance()Method to retrieve an instance of the server configuration.String[]getProperties(String key)There can be multiple object corresponding to the same object.protected StringgetProtectedValue(String key)voidinit(InputStream xmlInputStream)This initializes the server configuration.voidinit(String configurationXMLLocation)This initializes the server configuration.protected booleanisProtectedToken(String key)voidoverrideConfigurationProperty(String key, String value)overrides the configuration property instead of adding the value to the listvoidsetConfigurationProperty(String key, String value)Method to a given key, value pair into the configuration.
-
-
-
Field Detail
-
AXIS2_CONFIG_REPO_LOCATION
public static final String AXIS2_CONFIG_REPO_LOCATION
Constant to be used for properties storing the axis2 repository location.- See Also:
- Constant Field Values
-
HTTP_PORT
public static final String HTTP_PORT
Constant to be used for properties storing the http port of the servlet transport.- See Also:
- Constant Field Values
-
COMMAND_LISTENER_PORT
public static final String COMMAND_LISTENER_PORT
Constant to be used for properties storing the port of the command listener.- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static ServerConfiguration getInstance()
Method to retrieve an instance of the server configuration.- Returns:
- instance of the server configuration
-
init
public void init(InputStream xmlInputStream) throws ServerConfigurationException
This initializes the server configuration. This method should only be called once, for successive calls, it will be checked.- Parameters:
xmlInputStream- the server configuration file stream.- Throws:
ServerConfigurationException- if the operation failed.
-
init
public void init(String configurationXMLLocation) throws ServerConfigurationException
This initializes the server configuration. This method should only be called once, for successive calls, it will be checked.- Parameters:
configurationXMLLocation- the location of the server configuration file (carbon.xml).- Throws:
ServerConfigurationException- if the operation failed.
-
forceInit
public void forceInit(InputStream xmlInputStream) throws ServerConfigurationException
Method to forcibly initialize the server configuration. If there is any configuration loaded, it will not be preserved.- Parameters:
xmlInputStream- the server configuration file stream.- Throws:
ServerConfigurationException- if the operation failed.
-
forceInit
public void forceInit(String configurationXMLLocation) throws ServerConfigurationException
Method to forcibly initialize the server configuration. If there is any configuration loaded, it will not be preserved.- Parameters:
configurationXMLLocation- the location of the server configuration file (carbon.xml).- Throws:
ServerConfigurationException- if the operation failed.
-
forceInit
public void forceInit(String configurationXMLLocation, boolean isLoadedConfigurationPreserved) throws ServerConfigurationException
Method to forcibly initialize the server configuration.- Parameters:
configurationXMLLocation- the location of the server configuration file (carbon.xml).isLoadedConfigurationPreserved- whether the currently loaded configuration is preserved.- Throws:
ServerConfigurationException- if the operation failed.
-
setConfigurationProperty
public void setConfigurationProperty(String key, String value)
Method to a given key, value pair into the configuration.- Specified by:
setConfigurationPropertyin interfaceServerConfigurationService- Parameters:
key- the key to addvalue- the value
-
overrideConfigurationProperty
public void overrideConfigurationProperty(String key, String value)
overrides the configuration property instead of adding the value to the list- Specified by:
overrideConfigurationPropertyin interfaceServerConfigurationService- Parameters:
key-value-
-
getFirstProperty
public String getFirstProperty(String key)
There can be multiple objects with the same key. This will return the first String from them- Specified by:
getFirstPropertyin interfaceServerConfigurationService- Parameters:
key- the search key- Returns:
- value corresponding to the given key
-
getProperties
public String[] getProperties(String key)
There can be multiple object corresponding to the same object.- Specified by:
getPropertiesin interfaceServerConfigurationService- Parameters:
key- the search key- Returns:
- the properties corresponding to the
key
-
getDocumentElement
public Element getDocumentElement()
Method to retrieve the Configuration as an XML Document.- Specified by:
getDocumentElementin interfaceServerConfigurationService- Returns:
- DOM element containing server configuration.
-
isProtectedToken
protected boolean isProtectedToken(String key)
-
-