コード例 #1
0
  private void addServerIPAndHostEntries() {
    String hostName = serverConfigurationInformation.getHostName();
    String ipAddress = serverConfigurationInformation.getIpAddress();
    if (hostName != null && !"".equals(hostName)) {
      Entry entry = new Entry(SynapseConstants.SERVER_HOST);
      entry.setValue(hostName);
      synapseConfiguration.addEntry(SynapseConstants.SERVER_HOST, entry);
    }

    if (ipAddress != null && !"".equals(ipAddress)) {
      Entry entry = new Entry(SynapseConstants.SERVER_IP);
      entry.setValue(ipAddress);
      if (synapseConfiguration.getAxisConfiguration().getTransportsIn() != null) {
        Map<String, TransportInDescription> transportInConfigMap =
            synapseConfiguration.getAxisConfiguration().getTransportsIn();
        if (transportInConfigMap != null) {
          TransportInDescription transportInDescription = transportInConfigMap.get("http");
          if (transportInDescription != null) {
            Parameter bindAddressParam = transportInDescription.getParameter("bind-address");
            if (bindAddressParam != null) {
              entry.setValue(bindAddressParam.getValue());
            }
          }
        }
      }
      synapseConfiguration.addEntry(SynapseConstants.SERVER_IP, entry);
    }
  }
コード例 #2
0
  /** Adds all Synapse proxy services to the Axis2 configuration. */
  private void deployProxyServices() {

    boolean failSafeProxyEnabled =
        SynapseConfigUtils.isFailSafeEnabled(SynapseConstants.FAIL_SAFE_MODE_PROXY_SERVICES);

    log.info("Deploying Proxy services...");
    String thisServerName = serverConfigurationInformation.getServerName();
    if (thisServerName == null || "".equals(thisServerName)) {
      thisServerName = serverConfigurationInformation.getHostName();
      if (thisServerName == null || "".equals(thisServerName)) {
        thisServerName = "localhost";
      }
    }

    for (ProxyService proxy : synapseConfiguration.getProxyServices()) {

      // start proxy service if either, pinned server name list is empty
      // or pinned server list has this server name
      List pinnedServers = proxy.getPinnedServers();
      if (pinnedServers != null && !pinnedServers.isEmpty()) {
        if (!pinnedServers.contains(thisServerName)) {
          log.info(
              "Server name not in pinned servers list."
                  + " Not deploying Proxy service : "
                  + proxy.getName());
          continue;
        }
      }

      try {
        AxisService proxyService =
            proxy.buildAxisService(
                synapseConfiguration, configurationContext.getAxisConfiguration());
        if (proxyService != null) {
          log.info("Deployed Proxy service : " + proxy.getName());
          if (!proxy.isStartOnLoad()) {
            proxy.stop(synapseConfiguration);
          }
        } else {
          log.warn("The proxy service " + proxy.getName() + " will NOT be available");
        }
      } catch (SynapseException e) {
        if (failSafeProxyEnabled) {
          log.warn(
              "The proxy service "
                  + proxy.getName()
                  + " cannot be deployed - "
                  + "Continue in Proxy Service fail-safe mode.");
        } else {
          handleException("The proxy service " + proxy.getName() + " : Deployment Error");
        }
      }
    }
  }
コード例 #3
0
  /**
   * 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();
    }
  }