Import the launcher data from configurer.

@param configurer The configurer reference (must not be <code>null</code>).
@return The launcher data.
@throws LionEngineException If unable to read node.
499628
public static List<LauncherConfig> imports(Configurer configurer)
    {
        Check.notNull(configurer);

        final Collection<Xml> children = configurer.getRoot().getChildren(NODE_LAUNCHER);
        final List<LauncherConfig> launchers = new ArrayList<>(children.size());

        for (final Xml launcher : children)
        {
            launchers.add(imports(launcher));
        }

        return launchers;
    }
1017705
public static SarlConfig getConfiguration(ConfigurationFactory configFactory) {
		assert configFactory != null;
		return configFactory.config(SarlConfig.class, PREFIX);
	}
1080088
private AgentCoreEngineConfiguration downloadAndOverlayConfiguration(
            HttpClientBuilder hcb,
            AgentCoreEngineConfiguration initialConfig)
            throws Exception {

        AgentCoreEngineConfiguration newOverlaidConfiguration = initialConfig;

        String typeVersionToDownload = initialConfig.getGlobalConfiguration().getTypeVersion();

        // If there is no type version declared, download and overlay nothing.
        // If we have no inventory metadata at all, and we are not in metrics only mode
        // then we are required to download the config successfully;
        // an exception is thrown if we cannot download and overlay the config in that case.
        // If we already have some inventory metadata already, then we will not abort with an exception
        // on download/overlay failure - we'll just continue with the old inventory metadata.
        boolean requireDownload = false;
        Exception error = null;

        if (typeVersionToDownload != null) {
            if (initialConfig.getDmrConfiguration().getTypeSets().isDisabledOrEmpty()
                    && initialConfig.getJmxConfiguration().getTypeSets().isDisabledOrEmpty()) {
                requireDownload = !isMetricsOnlyMode(initialConfig);
            }

            OkHttpClient httpclient = hcb.getHttpClient();
            String url = Util.getContextUrlString(
                    initialConfig.getStorageAdapter().getUrl(),
                    initialConfig.getStorageAdapter().getInventoryContext())
                    .append("get-inventory-config")
                    .append("/")
                    .append(typeVersionToDownload)
                    .toString();
            Request request = hcb.buildGetRequest(url, null);
            Response response = null;
            try {
                log.debugf("Downloading inventory configuration from server: %s", url);
                response = httpclient.newCall(request).execute();
                if (response.code() != 200) {
                    error = new Exception(String.format("Cannot download inventory configuration [%s]: %d/%s",
                            typeVersionToDownload, response.code(), response.message()));
                } else {
                    newOverlaidConfiguration = overlayConfiguration(response.body().byteStream());
                }
            } catch (Exception e) {
                error = new Exception(String.format("Failed to download and overlay inventory configuration [%s]",
                        typeVersionToDownload), e);
            } finally {
                if (response != null) {
                    response.body().close();
                }
            }
        } else {
            log.debugf("No inventory type version declared; no configuration will be downloaded. "
                    + "Original configuration will be used as-is.");
        }

        if (error != null) {
            if (requireDownload) {
                throw error;
            } else {
                log.errorf(error, "Will continue with the previous inventory configuration.");
            }
        }

        return newOverlaidConfiguration;
    }
482706
@SuppressWarnings("unchecked")
    public MessagingConfiguration getMessagingConfiguration(ServletConfig servletConfig) {
        Assert.isTrue(JdkVersion.getMajorJavaVersion() >= JdkVersion.JAVA_15, "Spring BlazeDS Integration requires a minimum of Java 1.5");
        Assert.notNull(servletConfig, "FlexConfigurationManager requires a non-null ServletConfig - "
            + "Is it being used outside a WebApplicationContext?");

        MessagingConfiguration configuration = new MessagingConfiguration();

        configuration.getSecuritySettings().setServerInfo(servletConfig.getServletContext().getServerInfo());

        if (CollectionUtils.isEmpty(configuration.getSecuritySettings().getLoginCommands())) {
            LoginCommandSettings settings = new LoginCommandSettings();
            settings.setClassName(NoOpLoginCommand.class.getName());
            configuration.getSecuritySettings().getLoginCommands().put(LoginCommandSettings.SERVER_MATCH_OVERRIDE, settings);
        }

        if (this.parser == null) {
            this.parser = getDefaultConfigurationParser();
        }

        Assert.notNull(this.parser, "Unable to create a parser to load Flex messaging configuration.");

        this.parser.parse(this.configurationPath, new ResourceResolverAdapter(this.resourceLoader), configuration);

        return configuration;
    }
207652
public ChameleonTargetConfiguration importConfiguration(ChameleonTargetConfiguration other) {

        if (this.container == null || this.container.isEmpty()) {
            this.container = other.getContainer();
        }

        if (this.version == null || this.version.isEmpty()) {
            this.version = other.getVersion();
        }

        if (this.mode == null) {
            this.mode = other.getMode();
        }

        final Set<Map.Entry<String, String>> entries = other.getCustomProperties().entrySet();

        for (Map.Entry<String, String> entry : entries) {
            if (! this.customProperties.containsKey(entry.getKey())) {
                this.customProperties.put(entry.getKey(), entry.getValue());
            }
        }

        return this;
    }
531643
public ConfigParseOptions setClassLoader(ClassLoader loader) {
        if (this.classLoader == loader)
            return this;
        else
            return new ConfigParseOptions(this.syntax, this.originDescription, this.allowMissing,
                    this.includer, loader);
    }
841645
private static JavaDriverClientLauncher getLauncher(final String clockConfigPath, final int driverServicePort) {
    try {
      final Configuration clockArgConfig = Configurations.merge(
          LAUNCHER_STATIC_CONFIG,
          DriverClientGrpcConfiguration.CONF
              .set(DriverClientGrpcConfiguration.DRIVER_SERVICE_PORT, driverServicePort)
              .build(),
          TANG.newConfigurationBuilder()
              .bindNamedParameter(ClockConfigurationPath.class, clockConfigPath)
              .build());

      return TANG.newInjector(clockArgConfig).getInstance(JavaDriverClientLauncher.class);
    } catch (final InjectionException ex) {
      throw fatal("Unable to instantiate REEFLauncher.", ex);
    }
  }
622451
public OperationFuture<ServerMetadata> importServer(ImportServerConfig config) {
        BaseServerResponse response = client.importServer(
            serverConverter.buildImportServerRequest(
                config,
                config.getCustomFields().isEmpty() ?
                    null :
                    client.getCustomFields()
            )
        );

        return postProcessBuildServerResponse(response, config);
    }
489908
public ComputerLauncher getDelegatedLauncher() {
        ComputerLauncher l = launcher;
        while (true) {
            if (l instanceof DelegatingComputerLauncher) {
                l = ((DelegatingComputerLauncher) l).getLauncher();
            } else if (l instanceof ComputerLauncherFilter) {
                l = ((ComputerLauncherFilter) l).getCore();
            } else {
                break;
            }
        }
        return l;
    }
781378
public static ApplicationConfiguration load(InputStream input) throws Exception {
		XMLStreamReader xml = XMLInputFactory.newFactory().createXMLStreamReader(input);
		while (xml.hasNext()) {
			xml.next();
			if (xml.getEventType() == XMLStreamConstants.START_ELEMENT) {
				if (!"project".equals(xml.getLocalName()))
					throw new Exception("Root element of an lc-project.xml file must be <project>");
				ApplicationConfiguration cfg = new ApplicationConfiguration();
				boolean found = false;
				while (xml.hasNext()) {
					xml.next();
					if (xml.getEventType() == XMLStreamConstants.START_ELEMENT) {
						if ("application".equals(xml.getLocalName())) {
							found = true;
							cfg.load(xml);
							break;
						}
					}
				}
				if (!found)
					throw new Exception("No application element found in lc-project.xml file");
				return cfg;
			}
		}
		throw new Exception("Nothing found in lc-project.xml file");
	}
513536
public static Configuration getConfiguration() {
	    if(configuration == null){
            try {
                configuration = (Configuration) getContext().getBean("configuration");
            } catch (BeansException e) {
                LOGGER.error("Can't load config. Error: {}",e ,e);
            }
        }
	    return configuration;
	}
72145
public static Xml exports(LauncherConfig config)
    {
        Check.notNull(config);

        final Xml node = new Xml(NODE_LAUNCHER);
        node.writeInteger(ATT_RATE, config.getRate());

        for (final LaunchableConfig launchable : config.getLaunchables())
        {
            node.add(LaunchableConfig.exports(launchable));
        }

        return node;
    }
1065754
@SuppressWarnings("static-method")
	@Provides
	@Singleton
	public Log4jIntegrationConfig getLog4jIntegrationConfig(ConfigurationFactory configFactory, Injector injector) {
		final Log4jIntegrationConfig config = Log4jIntegrationConfig.getConfiguration(configFactory);
		injector.injectMembers(config);
		return config;
	}
1050886
public static Class get(String clazzname, ClassLoader loader) throws ClassNotFoundException {
        return Util.loadClass(clazzname, loader != null? loader : ClassConfigurator.class.getClassLoader());
    }
692052
public static <D extends DifferenceEngineConfigurer<D>>
        D withPlaceholderSupport(D configurer) {
        return withPlaceholderSupportUsingDelimiters(configurer, null, null);
    }
1216198
public ServiceCall<Configuration> getConfiguration(GetConfigurationOptions getConfigurationOptions) {
    Validator.notNull(getConfigurationOptions, "getConfigurationOptions cannot be null");
    String[] pathSegments = { "v1/environments", "configurations" };
    String[] pathParameters = { getConfigurationOptions.environmentId(), getConfigurationOptions.configurationId() };
    RequestBuilder builder = RequestBuilder.get(RequestBuilder.constructHttpUrl(getEndPoint(), pathSegments,
        pathParameters));
    builder.query("version", versionDate);
    Map<String, String> sdkHeaders = SdkCommon.getSdkHeaders("discovery", "v1", "getConfiguration");
    for (Entry<String, String> header : sdkHeaders.entrySet()) {
      builder.header(header.getKey(), header.getValue());
    }
    builder.header("Accept", "application/json");
    return createServiceCall(builder.build(), ResponseConverterUtils.getObject(Configuration.class));
  }
660462
private static HashMap<String, HashMap<String, String>> readConfigurations(
      ResourceLoader resourceLoader, String configFile, String className)
      throws IOException {
    HashMap<String, HashMap<String, String>> configs = null;
    InputStream reader = resourceLoader.openResource(configFile);
    // parse xml
    XMLInputFactory factory = XMLInputFactory.newInstance();
    try {
      XMLStreamReader streamReader = factory.createXMLStreamReader(reader);
      String currentElement = null;
      ArrayList<String> currentElements = new ArrayList<String>();
      QName qname;
      boolean skipCurrentConfigurations = false;
      try {
        int event = streamReader.getEventType();
        while (true) {
          switch (event) {
          case XMLStreamConstants.START_DOCUMENT:
            if (!streamReader.getCharacterEncodingScheme().equals("UTF-8")) {
              throw new IOException("XML not UTF-8 encoded");
            }
            break;
          case XMLStreamConstants.END_DOCUMENT:
            break;
          case XMLStreamConstants.SPACE:
            break;
          case XMLStreamConstants.START_ELEMENT:
            // get data
            qname = streamReader.getName();
            if (configs == null) {
              if (qname.getLocalPart().equals(CONFIGURATIONS_MTAS)) {
                configs = new HashMap<String, HashMap<String, String>>();
              } else {
                throw new IOException("no Mtas Configurations File");
              }
            } else if (currentElement != null
                && currentElement.equals(CONFIGURATIONS_MTAS)) {
              if (qname.getLocalPart().equals(CONFIGURATIONS_CONFIGURATIONS)) {
                skipCurrentConfigurations = true;
                if (className != null) {
                  for (int i = 0; i < streamReader.getAttributeCount(); i++) {
                    if (streamReader.getAttributeLocalName(i).equals("type")) {
                      if (streamReader.getAttributeValue(i).equals(className)) {
                        skipCurrentConfigurations = false;
                      }
                    }
                  }
                }
              } else {
                throw new IOException("unexpected " + qname.getLocalPart());
              }
            } else if (currentElement != null
                && currentElement.equals(CONFIGURATIONS_CONFIGURATIONS)
                && !skipCurrentConfigurations) {
              if (qname.getLocalPart().equals(CONFIGURATIONS_CONFIGURATION)) {
                String configurationName = null;
                HashMap<String, String> configurationValues = new HashMap<String, String>();
                for (int i = 0; i < streamReader.getAttributeCount(); i++) {
                  if (streamReader.getAttributeLocalName(i)
                      .equals(CONFIGURATIONS_CONFIGURATION_NAME)) {
                    configurationName = streamReader.getAttributeValue(i);
                  } else {
                    configurationValues.put(
                        streamReader.getAttributeLocalName(i),
                        streamReader.getAttributeValue(i));
                  }
                }
                if (configurationName != null) {
                  configs.put(configurationName, configurationValues);
                } else {
                  throw new IOException("configuration without "
                      + CONFIGURATIONS_CONFIGURATION_NAME);
                }
              } else {
                throw new IOException("unexpected tag " + qname.getLocalPart());
              }
            }
            currentElement = qname.getLocalPart();
            currentElements.add(currentElement);
            break;
          case XMLStreamConstants.END_ELEMENT:
            if (currentElement != null
                && currentElement.equals(CONFIGURATIONS_CONFIGURATIONS)) {
              skipCurrentConfigurations = false;
            }
            int i = currentElements.size();
            currentElements.remove((i - 1));
            if (i > 1) {
              currentElement = currentElements.get(i - 2);
            } else {
              currentElement = null;
            }
            break;
          case XMLStreamConstants.CHARACTERS:
            break;
          }
          if (!streamReader.hasNext()) {
            break;
          }
          event = streamReader.next();
        }
      } finally {
        streamReader.close();
      }
    } catch (XMLStreamException e) {
      log.debug(e);
    }
    return configs;
  }