Examples of ConfigurationLoader


Examples of eu.scape_project.pw.idp.utils.ConfigurationLoader

    /**
     * Constructor.
     */
    public ReCaptchaValidator() {
        ConfigurationLoader configurationLoader = new ConfigurationLoader();
        config = configurationLoader.load();
    }
View Full Code Here

Examples of io.airlift.configuration.ConfigurationLoader

    public static <T> T loadConfig(Class<T> clazz, Optional<String> path)
            throws IOException
    {
        ImmutableMap.Builder<String, String> map = ImmutableMap.builder();
        ConfigurationLoader loader = new ConfigurationLoader();
        if (path.isPresent()) {
            map.putAll(loader.loadPropertiesFrom(path.get()));
        }
        map.putAll(loader.getSystemProperties());
        return new ConfigurationFactory(map.build()).build(clazz);
    }
View Full Code Here

Examples of io.airlift.configuration.ConfigurationLoader

        Map<String, String> requiredProperties;
        ConfigurationFactory configurationFactory;
        if (requiredConfigurationProperties == null) {
            // initialize configuration
            log.info("Loading configuration");
            ConfigurationLoader loader = new ConfigurationLoader();

            requiredProperties = Collections.emptyMap();
            String configFile = System.getProperty("config");
            if (configFile != null) {
                requiredProperties = loader.loadPropertiesFrom(configFile);
            }
        }
        else {
            requiredProperties = requiredConfigurationProperties;
        }
View Full Code Here

Examples of io.airlift.configuration.ConfigurationLoader

import java.util.concurrent.Executors;

public class NiftyLoadTester {

    public static void main(String[] args) throws Exception {
    ConfigurationFactory cf = new ConfigurationFactory(new ConfigurationLoader().loadProperties());
    AbstractModule exampleModule = new AbstractModule() {
      @Override
      public void configure() {
        ConfigurationModule.bindConfig(binder()).to(LoadTesterConfig.class);
        binder().bind(NiftyBootstrap.class).in(Singleton.class);
View Full Code Here

Examples of io.airlift.configuration.ConfigurationLoader

    public static void main(String[] args) throws Exception
    {
        // Configure netty logs to go to SLF4J
        InternalLoggerFactory.setDefaultFactory(new Slf4JLoggerFactory());

        ConfigurationFactory cf = new ConfigurationFactory(new ConfigurationLoader().loadProperties());
        AbstractModule exampleModule = new AbstractModule()
        {
            @Override
            public void configure()
            {
View Full Code Here

Examples of mx4j.tools.config.ConfigurationLoader

      /* Choice 2: as a created MBean */
      // server.createMBean(ConfigurationLoader.class.getName(), ObjectName.getInstance("config:service=loader"), null);

      /* Choice 3: as a registered MBean */
      ConfigurationLoader loader = new ConfigurationLoader();
      server.registerMBean(loader, ObjectName.getInstance("config:service=loader"));

      // The XML file

      /* Choice 1: read it from classpath using classloaders
         Note: the directory that contains the XML file must be in the classpath */
      // InputStream stream = ConfigurationStartup.class.getClassLoader().getResourceAsStream("config.xml");
      // Reader reader = new BufferedReader(new InputStreamReader(stream));

      /* Choice 2: read it from a file
         Note: requires file path to be passed as program argument */
      String path = args[0];
      Reader reader = new BufferedReader(new FileReader(path));

      // Read and execute the 'startup' section of the XML file
      loader.startup(reader);

      reader.close();

      System.out.println("Application configured successfully");
   }
View Full Code Here

Examples of mx4j.tools.config.ConfigurationLoader

              "  <shutdown>" +
              "    <unregister objectname=\"" + name + "\" />" +
              "  </shutdown>" +
              "</configuration>" +
              "";
      ConfigurationLoader loader = new ConfigurationLoader(server);
      Reader reader = new BufferedReader(new StringReader(config));
      loader.startup(reader);
      sleep(1000);

      assertTrue(server.isRegistered(new ObjectName(name)));

      Socket socket = new Socket((String)null, port);
View Full Code Here

Examples of mx4j.tools.config.ConfigurationLoader

              "    <call refobjectid=\"" + id + "\" method=\"stop\" />" +
              "    <unregister objectname=\"" + name + "\" />" +
              "  </shutdown>" +
              "</configuration>" +
              "";
      ConfigurationLoader loader = new ConfigurationLoader(server);
      Reader reader = new BufferedReader(new StringReader(config));
      loader.startup(reader);
      sleep(1000);

      assertTrue(server.isRegistered(new ObjectName(name)));
      Boolean active = (Boolean)server.getAttribute(new ObjectName(name), "Active");
      assertTrue(active.booleanValue());
View Full Code Here

Examples of mx4j.tools.config.ConfigurationLoader

   {
      MBeanServer server = newMBeanServer();
      String config =
              "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +
              "<configuration>";
      ConfigurationLoader loader = new ConfigurationLoader(server);
      try
      {
         loader.startup(new StringReader(config));
         fail();
      }
      catch (ConfigurationException x)
      {
      }
View Full Code Here

Examples of mx4j.tools.config.ConfigurationLoader

      String config =
              "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>" +
              "<configuration>" +
              "   <dummy />" +
              "</configuration>";
      ConfigurationLoader loader = new ConfigurationLoader(server);
      try
      {
         loader.startup(new StringReader(config));
         fail();
      }
      catch (ConfigurationException x)
      {
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.