/**
   * Starts the JMX Adaptor.
   *
   * @throws SynapseException if the JMX configuration is erroneous and/or the connector server
   *     cannot be started
   */
  private void startJmxAdapter() {
    Properties synapseProperties = SynapsePropertiesLoader.loadSynapseProperties();
    JmxInformation jmxInformation =
        JmxInformationFactory.createJmxInformation(
            synapseProperties, serverConfigurationInformation.getHostName());

    // Start JMX Adapter only if at least a JMX JNDI port is configured
    if (jmxInformation.getJndiPort() != -1) {
      jmxAdapter = new JmxAdapter(jmxInformation);
      jmxAdapter.start();
    }
  }
 /**
  * Initiating DataSourceRepositoryHolder with a new data source information repository or reusing
  * an existing repository.
  *
  * @param serverContextInformation ServerContextInformation instance
  */
 private void initDataSourceHelper(ServerContextInformation serverContextInformation) {
   DataSourceRepositoryHolder repositoryHolder = DataSourceRepositoryHolder.getInstance();
   Properties synapseProperties = SynapsePropertiesLoader.reloadSynapseProperties();
   Object repo =
       serverContextInformation.getProperty(
           DataSourceConstants.DATA_SOURCE_INFORMATION_REPOSITORY);
   if (repo instanceof DataSourceInformationRepository) {
     repositoryHolder.init((DataSourceInformationRepository) repo, synapseProperties);
   } else {
     repositoryHolder.init(null, synapseProperties);
   }
 }
 private synchronized void initEnterpriseBeanstalkHolder(
     ServerContextInformation serverContextInformation) {
   if (serverContextInformation.getProperty(
           EnterpriseBeanstalkConstants.BEANSTALK_MANAGER_PROP_NAME)
       == null) {
     EnterpriseBeanstalkManager beanstalkHolder = new EnterpriseBeanstalkManager();
     Properties synapseProperties = SynapsePropertiesLoader.reloadSynapseProperties();
     beanstalkHolder.init(synapseProperties);
     serverContextInformation.addProperty(
         EnterpriseBeanstalkConstants.BEANSTALK_MANAGER_PROP_NAME, beanstalkHolder);
   }
 }
  /** {@inheritDoc} */
  public SynapseConfiguration createSynapseConfiguration() {

    String synapseXMLLocation = serverConfigurationInformation.getSynapseXMLLocation();
    Properties properties = SynapsePropertiesLoader.loadSynapseProperties();
    if (serverConfigurationInformation.getResolveRoot() != null) {
      properties.put(
          SynapseConstants.RESOLVE_ROOT, serverConfigurationInformation.getResolveRoot());
    }

    if (serverConfigurationInformation.getSynapseHome() != null) {
      properties.put(
          SynapseConstants.SYNAPSE_HOME, serverConfigurationInformation.getSynapseHome());
    }

    if (synapseXMLLocation != null) {
      synapseConfiguration =
          SynapseConfigurationBuilder.getConfiguration(synapseXMLLocation, properties);
    } else {
      log.warn(
          "System property or init-parameter '"
              + SynapseConstants.SYNAPSE_XML
              + "' is not specified. Using default configuration..");
      synapseConfiguration = SynapseConfigurationBuilder.getDefaultConfiguration();
    }

    Enumeration keys = properties.keys();
    while (keys.hasMoreElements()) {
      String key = (String) keys.nextElement();
      synapseConfiguration.setProperty(key, properties.getProperty(key));
    }

    // Set the Axis2 ConfigurationContext to the SynapseConfiguration
    synapseConfiguration.setAxisConfiguration(configurationContext.getAxisConfiguration());
    MessageContextCreatorForAxis2.setSynConfig(synapseConfiguration);

    // set the Synapse configuration into the Axis2 configuration
    Parameter synapseConfigurationParameter =
        new Parameter(SynapseConstants.SYNAPSE_CONFIG, synapseConfiguration);
    try {
      configurationContext.getAxisConfiguration().addParameter(synapseConfigurationParameter);
    } catch (AxisFault e) {
      handleFatal(
          "Could not set parameters '"
              + SynapseConstants.SYNAPSE_CONFIG
              + "' to the Axis2 configuration : "
              + e.getMessage(),
          e);
    }

    addServerIPAndHostEntries();

    return synapseConfiguration;
  }