コード例 #1
0
  /** Parse and populate child configuration modules. */
  private void populateConfigurationModules() {
    ConfigurationDirectory configDirectory =
        serviceDirectory.getConfigurationDirectory(serviceInfo.getConfigDir());

    if (configDirectory != null) {
      for (ConfigurationModule config : configDirectory.getConfigurationModules()) {
        ConfigurationInfo info = config.getModuleInfo();
        if (isValid()) {
          setValid(config.isValid() && info.isValid());
          if (!isValid()) {
            setErrors(config.getErrors());
            setErrors(info.getErrors());
          }
        }
        serviceInfo.getProperties().addAll(info.getProperties());
        serviceInfo.setTypeAttributes(config.getConfigType(), info.getAttributes());
        configurationModules.put(config.getConfigType(), config);
      }

      for (String excludedType : serviceInfo.getExcludedConfigTypes()) {
        if (!configurationModules.containsKey(excludedType)) {
          ConfigurationInfo configInfo =
              new ConfigurationInfo(
                  Collections.<PropertyInfo>emptyList(), Collections.<String, String>emptyMap());
          ConfigurationModule config = new ConfigurationModule(excludedType, configInfo);

          config.setDeleted(true);
          configurationModules.put(excludedType, config);
        }
      }
    }
  }
コード例 #2
0
  private ServiceModule createServiceModule(
      ServiceInfo serviceInfo,
      Collection<ConfigurationModule> configurations,
      StackContext context) {

    if (serviceInfo.getName() == null) {
      serviceInfo.setName("service1");
    }

    ConfigurationDirectory configDirectory = createConfigurationDirectory(configurations);
    ServiceDirectory serviceDirectory =
        createServiceDirectory(serviceInfo.getConfigDir(), configDirectory);

    return createServiceModule(context, serviceInfo, serviceDirectory);
  }
コード例 #3
0
  private ServiceModule createServiceModule(ServiceInfo serviceInfo) {
    String configType = "type1";

    if (serviceInfo.getName() == null) {
      serviceInfo.setName("service1");
    }

    StackContext context = createStackContext(serviceInfo.getName(), true);
    // no config props
    ConfigurationInfo configInfo =
        createConfigurationInfo(
            Collections.<PropertyInfo>emptyList(), Collections.<String, String>emptyMap());

    ConfigurationModule module = createConfigurationModule(configType, configInfo);
    ConfigurationDirectory configDirectory =
        createConfigurationDirectory(Collections.singletonList(module));
    ServiceDirectory serviceDirectory =
        createServiceDirectory(serviceInfo.getConfigDir(), configDirectory);

    return createServiceModule(context, serviceInfo, serviceDirectory);
  }