private void refreshContents(String environment) {
    MDFClientConfigRepository repository =
        MDFClientConfigurator.getInstance().getConfigRepository();

    MDFClientEnvConfigRepository envConfig = repository.getConfig(environment);

    textTcpAddress.setText(envConfig.getTcpInfo().getEndPointInfo().getDisplayable());
    userName.setPreferredSize(fieldSize);
    password.setPreferredSize(fieldSize);
    userName.setText(envConfig.getTcpInfo().getUserName());
    password.setText(envConfig.getTcpInfo().getPassword());

    /*
    String networkInterface=repository.getMDFClientRuntimeParameters().getMulticastNetworkInterface();

    if(networkInterface!=null)
    {
    	textMulticastNetworkInterface.setText(networkInterface);
    }
    else
    {
    	textMulticastNetworkInterface.setText("<default>");
    }

    textSequenceProblemAction.setText(repository.getMDFClientRuntimeParameters().getSequenceProblemAction().getAction());
    textMulticastInactivityThreshold.setText(Integer.toString(repository.getMDFClientRuntimeParameters().getMulticastInactivityThreshold()));
    */

    return;
  }
Ejemplo n.º 2
0
  /** Choose the configuration */
  private void chooseConfiguration() {
    channelPairInfo = multicastConnectivityPanel.getSelectedChannelPairInfo();

    if (channelPairInfo != null) {
      String env = mdfClientConfigPanel.getSelectedEnvironment();
      MulticastChannelContext context = mdfClientConfigPanel.getSelectedMulticastContext();
      List<MarketType> interestedMarketTypes =
          multicastConnectivityPanel.getInterestedMarketTypes();
      boolean isInterestedInUDS = multicastConnectivityPanel.isInterestedInUDS();

      /**
       * Choose the env specific repository and create a client configuration with the TCP
       * information applicable for that environment
       *
       * <p>Next, the channel pair information chosen by the user/env, is used to initialize the
       * multicast group
       *
       * <p>Finally, the interested market types applicable for the selected multicast group is used
       * to finalize the config
       *
       * <p>This is the selected configuration used by the application
       */
      MDFClientConfigRepository repository =
          MDFClientConfigurator.getInstance().getConfigRepository();
      MDFClientEnvConfigRepository envRepository = repository.getConfig(env);

      String groupName = channelPairInfo.getGroupName();
      MulticastGroupDefinition multicastGroupDefinition =
          repository.getMulticastGroupDefinition(groupName);
      HashMap<String, MulticastGroupDefinition> mcGroupDefinitionMap =
          new HashMap<String, MulticastGroupDefinition>();
      mcGroupDefinitionMap.put(groupName, multicastGroupDefinition);

      MDFClientConfiguration mdfClientConfig =
          new MDFClientConfiguration(env, mcGroupDefinitionMap, envRepository.getTcpInfo());
      com.theice.mdf.client.config.domain.TCPConnectionInfo tcpInfo = mdfClientConfig.getTcpInfo();
      // user the username and password from the config dialog window
      tcpInfo.setUserName(multicastConnectivityPanel.userName.getText());
      tcpInfo.setPassword(multicastConnectivityPanel.password.getText());

      HashMap<String, MulticastChannelPairInfo> channelPairInfoMap =
          new HashMap<String, MulticastChannelPairInfo>();
      channelPairInfoMap.put(groupName, channelPairInfo);
      mdfClientConfig.setMulticastChannelPairInfoMap(channelPairInfoMap);

      mdfClientConfig.setMDFClientRuntimeParameters(
          MDFClientConfigurator.getInstance()
              .getConfigRepository()
              .getMDFClientRuntimeParameters());
      HashMap<String, List<MarketType>> interestedMarketTypesMap =
          new HashMap<String, List<MarketType>>();
      interestedMarketTypesMap.put(groupName, interestedMarketTypes);
      mdfClientConfig.setInterestedMarketTypesMap(interestedMarketTypesMap);
      mdfClientConfig.setIsInterestedInUDS(isInterestedInUDS);

      if (logger.isTraceEnabled()) {
        logger.trace("### Choosing Configuration ### " + mdfClientConfig.toString());
        logger.trace(
            "### Interested Market Types : "
                + multicastConnectivityPanel.getInterestedMarketTypes().toString());
      }

      MDFClientConfigurator.getInstance().setCurrentConfiguration(mdfClientConfig);
    }

    return;
  }