コード例 #1
0
  public void createLocalServer(int port) {
    String newUser = null;
    String newUserPassword = null;
    org.apache.felix.utils.properties.Properties userProps = null;

    try {
      userProps =
          new org.apache.felix.utils.properties.Properties(
              new File(System.getProperty("karaf.home") + "/etc/users.properties"));
    } catch (IOException e) {
      LOGGER.warn("Failed to load users from etc/users.properties. No users will be imported.", e);
    }

    String zookeeperPassword = System.getProperty(SystemProperties.ZOOKEEPER_PASSWORD);

    CreateEnsembleOptions createOpts = CreateEnsembleOptions.build();

    if (userProps != null && !userProps.isEmpty()) {
      newUser = (String) userProps.keySet().iterator().next();
      newUserPassword = (String) userProps.get(newUser);
      createOpts.user(newUser, newUserPassword);
    }

    if (zookeeperPassword != null && !zookeeperPassword.isEmpty()) {
      createOpts.zookeeperPassword(zookeeperPassword);
    }

    createLocalServer(port, createOpts);
  }
コード例 #2
0
 public void removeFromCluster(List<String> containers) {
   CreateEnsembleOptions options = CreateEnsembleOptions.build();
   options.setZookeeperPassword(fabricService.getZookeeperPassword());
   removeFromCluster(containers, options);
 }
コード例 #3
0
 public void createCluster(List<String> containers) {
   createCluster(containers, CreateEnsembleOptions.build());
 }