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 Details

    • 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:
    • AXIS2_CONFIG_DISABLE_ADMIN_SERVICES

      public static final String AXIS2_CONFIG_DISABLE_ADMIN_SERVICES
      Constant to be used to disable admin services.
      See Also:
    • LOG_MGT_TRUNCATE_TO_MICROSECONDS

      public static final String LOG_MGT_TRUNCATE_TO_MICROSECONDS
      Constant to be used for properties storing whether to truncate log timestamps to microseconds.
      See Also:
    • HTTP_PORT

      public static final String HTTP_PORT
      Constant to be used for properties storing the http port of the servlet transport.
      See Also:
    • 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:
  • Method Details

    • 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:
      setConfigurationProperty in interface ServerConfigurationService
      Parameters:
      key - the key to add
      value - the value
    • overrideConfigurationProperty

      public void overrideConfigurationProperty(String key, String value)
      overrides the configuration property instead of adding the value to the list
      Specified by:
      overrideConfigurationProperty in interface ServerConfigurationService
      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:
      getFirstProperty in interface ServerConfigurationService
      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:
      getProperties in interface ServerConfigurationService
      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:
      getDocumentElement in interface ServerConfigurationService
      Returns:
      DOM element containing server configuration.
    • isProtectedToken

      protected boolean isProtectedToken(String key)
    • getProtectedValue

      protected String getProtectedValue(String key)
    • getDeniedAdminServices

      public Set<String> getDeniedAdminServices()
      Specified by:
      getDeniedAdminServices in interface ServerConfigurationService