Пример #1
0
 protected static void doConfigure(String configFile) {
   show("...Reading {}", configFile);
   final LaContainerBuilder builder = newConfigurationContainerBuilder();
   configurationContainer = builder.build(configFile);
   configurationContainer.init();
   final Configurator configurator;
   if (configurationContainer.hasComponentDef(Configurator.class)) {
     configurator = (Configurator) configurationContainer.getComponent(Configurator.class);
   } else {
     configurator = newDefaultConfigurator();
   }
   configurator.configure(configurationContainer);
 }
Пример #2
0
  /**
   * Creates a channel from an array of protocols. Note that after a {@link
   * org.jgroups.JChannel#close()}, the protocol list <em>should not</em> be reused, ie. new
   * JChannel(protocols) would reuse the same protocol list, and this might lead to problems !
   *
   * @param protocols The list of protocols, from bottom to top, ie. the first protocol in the list
   *     is the transport, the last the top protocol
   * @throws Exception
   */
  public JChannel(Collection<Protocol> protocols) throws Exception {
    prot_stack = new ProtocolStack();
    setProtocolStack(prot_stack);
    for (Protocol prot : protocols) {
      prot_stack.addProtocol(prot);
      prot.setProtocolStack(prot_stack);
    }
    prot_stack.init();

    // Substitute vars with defined system props (if any)
    List<Protocol> prots = prot_stack.getProtocols();
    Map<String, String> map = new HashMap<>();
    for (Protocol prot : prots) Configurator.resolveAndAssignFields(prot, map);
  }
Пример #3
0
  /** Creates a new instance of CheckBoxModifier */
  public CheckBoxModifier(
      final Enum configurable, final JCheckBox checkBox, final Configurator configurator) {
    super(configurable, checkBox, configurator);

    this.checkBox = checkBox;

    setValue(configurator.getValue(configurable));

    checkBox.addActionListener(
        new ActionListener() {
          public void actionPerformed(ActionEvent event) {
            configurator.setValue(configurable, getValue());
          }
        });
  }