Creates and initializes the {@link ServerParams} singleton.

@param args  The command line arguments.
@return      The singleton object.
@throws      ConfigurationException if an error occurs parsing the input YAML file
or command line arguments.
544523
public static ServerParams load(String[] args) throws ConfigurationException {
        if (INSTANCE != null) {
            logger.warn("Configuration is loaded already. Use ServerParams.getInstance() method. ");
            return INSTANCE;
        }

        INSTANCE = new ServerParams();
        INSTANCE.parseConfigFile(getConfigUrl());
        INSTANCE.parseCommandLineArgs(args);
        INSTANCE.parseOverrideFile();
        INSTANCE.printConfig();
        
        // TODO: Delete the next line when ServerConfig is phased out.
        copyParamsToServerConfig();
        return INSTANCE;
    }
720432
public static ConfigSource parseMainArgs(String...args) {
        Map<String, String> result;
        if (args == null) {
            result = Collections.emptyMap();
        } else {
            result = new HashMap<>();
            String prefix = System.getProperty("main.args.prefix","");
            String key = null;
            for (String arg : args) {
                if (arg.startsWith("--")) {
                    arg = arg.substring(2);
                    int index = arg.indexOf('=');
                    if (index > 0) {
                        key = arg.substring(0, index).trim();
                        result.put(prefix + key, arg.substring(index + 1).trim());
                        key = null;
                    } else {
                        result.put(prefix + arg, arg);
                    }
                } else if (arg.charAt(0) == '-') {
                    key = arg.substring(1);
                } else {
                    if (key != null) {
                        result.put(prefix + key, arg);
                        key = null;
                    } else {
                        result.put(prefix + arg, arg);
                    }
                }
            }
        }
        return new CLIPropertySource(result);
    }
337854
static public IParserInput getInstance(final String... args)
    {
        final NamespaceParser parser = new NamespaceParser();
        parser.args = args;
        return parser;
    }
1208655
public static void main(String[] args) {
    Properties properties = new Properties();
    LOG.info("Load chronos.cfg configuration from class path");
    try {
      properties.load(ChronosServer.class.getClassLoader().getResourceAsStream("chronos.cfg"));
      properties.setProperty(FailoverServer.BASE_ZNODE,
        "/chronos" + "/" + properties.getProperty(CLUSTER_NAME));
    } catch (IOException e) {
      LOG.fatal("Error to load chronos.cfg configuration, exit immediately", e);
      System.exit(0);
    }

    ChronosServer chronosServer = null;
    LOG.info("Init chronos server and connect ZooKeeper");
    try {
      chronosServer = new ChronosServer(properties);
    } catch (Exception e) {
      LOG.fatal("Exception to init chronos server, exit immediately", e);
      System.exit(0);
    }
    chronosServer.run();
  }
646613
public T newInstance(Object... args) throws Throwable
    {
        Constructor<? extends T> constructor = ClassUtils.findBestTypedConstructor(klass, args);
        return ClassUtils.invoke(constructor, args);
    }
849125
public ProviderConfig<T> setServer(ServerConfig server) {
        if (this.server == null) {
            this.server = new ArrayList<ServerConfig>();
        }
        this.server.add(server);
        return this;
    }
515051
@SuppressWarnings("unchecked")
	private T createInstance(final String className, final Object... arguments) {
		try {
			Class<?> implementation = Class.forName(className, false, classLoader);
			if (service.isAssignableFrom(implementation)) {
				return (T) implementation.getDeclaredConstructor(argumentTypes).newInstance(arguments);
			} else {
				InternalLogger.log(Level.ERROR, "Class '" + className + "' does not implement servcie interface '" + service + "'");
			}
		} catch (ClassNotFoundException ex) {
			InternalLogger.log(Level.ERROR, "Service implementation '" + className + "' not found");
		} catch (NoSuchMethodException ex) {
			InternalLogger.log(Level.ERROR, "Service implementation '" + className + "' has no matching constructor");
		} catch (InstantiationException ex) {
			InternalLogger.log(Level.ERROR, "Service implementation '" + className + "' is not instantiable");
		} catch (IllegalAccessException ex) {
			InternalLogger.log(Level.ERROR, "Constructor of service implementation '" + className + "' is not accessible");
		} catch (IllegalArgumentException ex) {
			InternalLogger.log(Level.ERROR, "Illegal arguments for constructor of service implementation '" + className + "'");
		} catch (InvocationTargetException ex) {
			InternalLogger.log(Level.ERROR, ex.getTargetException(), "Failed creating service implementation '" + className + "'");
		}

		return null;
	}
377067
public ConfigurableApplicationContext run(String... args) {
		StopWatch stopWatch = new StopWatch();
		stopWatch.start();
		ConfigurableApplicationContext context = null;
		Collection<SpringBootExceptionReporter> exceptionReporters = new ArrayList<>();
		configureHeadlessProperty();
		SpringApplicationRunListeners listeners = getRunListeners(args);
		listeners.starting();
		try {
			ApplicationArguments applicationArguments = new DefaultApplicationArguments(
					args);
			ConfigurableEnvironment environment = prepareEnvironment(listeners,
					applicationArguments);
			configureIgnoreBeanInfo(environment);
			Banner printedBanner = printBanner(environment);
			context = createApplicationContext();
			exceptionReporters = getSpringFactoriesInstances(
					SpringBootExceptionReporter.class,
					new Class[] { ConfigurableApplicationContext.class }, context);
			prepareContext(context, environment, listeners, applicationArguments,
					printedBanner);
			refreshContext(context);
			afterRefresh(context, applicationArguments);
			stopWatch.stop();
			if (this.logStartupInfo) {
				new StartupInfoLogger(this.mainApplicationClass)
						.logStarted(getApplicationLog(), stopWatch);
			}
			listeners.started(context);
			callRunners(context, applicationArguments);
		}
		catch (Throwable ex) {
			handleRunFailure(context, ex, exceptionReporters, listeners);
			throw new IllegalStateException(ex);
		}

		try {
			listeners.running(context);
		}
		catch (Throwable ex) {
			handleRunFailure(context, ex, exceptionReporters, null);
			throw new IllegalStateException(ex);
		}
		return context;
	}
481631
public static ConfigurableApplicationContext start(Class<?> app, String... args) {
        return start(new Class<?>[]{app}, args);
    }
234696
public static DataNode createDataNode(String args[], Configuration conf) 
    throws IOException {
    DataNode dn = instantiateDataNode(args, conf);
    if (dn != null) {
      dn.runDatanodeDaemon();
    }
    return dn;
  }
467659
public static <T> T newInstance(Class clazz, Object... args) {

        if (clazz == null) return null;

        Class[] argsClass = getArgsClasses(args);

        try {
            Constructor<T> constructor = clazz.<T>getConstructor(argsClass);
            return constructor.newInstance(args);
        } catch (InstantiationException | InvocationTargetException | NoSuchMethodException | IllegalAccessException e) {
            throw new IllegalStateException(e.getMessage(), e);
        }
    }
258902
public static Server getServer(final Object instance, final String bindAddress, final int port, Configuration conf) 
    throws IOException {
    return getServer(instance, bindAddress, port, 1, false, conf);
  }
533556
public static void main(final String[] args) {

        // describe all instances in aws-mock
        List<Instance> allInstances = describeAllInstances();
        for (Instance i : allInstances) {
            System.out.println(i.getInstanceId() + " - " + i.getState().getName());
        }

        // describe specifiled instances in aws-mock
        List<Instance> someInstances = describeInstances(Arrays.asList("i-12345678", "i=abcdef00"));
        for (Instance i : someInstances) {
            System.out.println(i.getInstanceId() + " - " + i.getState().getName());
        }
    }
306937
@SuppressWarnings("unchecked")
    public static DataProviderFactory create(final Object... args) {
        // Find the implementation for the DataProviderFactory.
        final Class<? extends DataProviderFactory> dataProviderClass = findDataProviderImpl();

        // Find the constructor that matches the arguments passed.
        final DataProviderFactory factory;
        try {
            Constructor<? extends DataProviderFactory> dataProviderConstructor = null;
            final Constructor[] constructors = dataProviderClass.getDeclaredConstructors();
            for (final Constructor constructor : constructors) {
                final Class<?>[] params = constructor.getParameterTypes();
                boolean matches = false;

                // Ensure that all the argument match
                if (args.length == params.length) {
                    matches = true;
                    for (int i = 0; i < params.length; i++) {
                        if (!params[i].isAssignableFrom(args[i].getClass())) {
                            matches = false;
                        }
                    }
                }

                // If the constructor matches then break the loop, as we've found the matching constructor
                if (matches) {
                    dataProviderConstructor = constructor;
                    break;
                }
            }

            // Make sure a constructor was found
            if (dataProviderConstructor != null) {
                factory = dataProviderConstructor.newInstance(args);
            } else {
                factory = null;
            }
        } catch (Exception e) {
            throw new RuntimeException(e);
        }

        return factory;
    }
22619
public static void main(final String[] args)
	{

		if (args.length != 1) {
			throw new IllegalArgumentException(
					"Configuration File ist missing.");
		}

		try {

			// Reads the configuration
			ConfigSettings config = readConfiguration(args[0]);
			new DiffToolThread(config).run();
		}
		catch (Exception e) {
			e.printStackTrace();
		}
	}
1228545
public static void main(String[] args) {
    InstancedConfiguration conf = new InstancedConfiguration(ConfigurationUtils.defaults());
    if (!ConfigurationUtils.masterHostConfigured(conf) && args.length > 0) {
      System.out.println(ConfigurationUtils
          .getMasterHostNotConfiguredMessage("Alluxio fsadmin shell"));
      System.exit(1);
    }
    // Reduce the RPC retry max duration to fall earlier for CLIs
    conf.set(PropertyKey.USER_RPC_RETRY_MAX_DURATION, "5s", Source.DEFAULT);
    FileSystemAdminShell fsAdminShell = new FileSystemAdminShell(conf);
    System.exit(fsAdminShell.run(args));
  }
368085
public static void main(final String... args) throws Exception {

        final StorageConfiguration config = new StorageConfiguration(new File(args[0]));
        Storage.createStorage(config);
        final IStorage storage = Storage.openStorage(new File(args[0]));

        Injector injector =
            Guice.createInjector(new ModuleSetter().setDataFacClass(TreeNodeFactory.class).setMetaFacClass(
                NodeMetaPageFactory.class).createModule());
        IBackendFactory backend = injector.getInstance(IBackendFactory.class);
        IRevisioning revision = injector.getInstance(IRevisioning.class);
        Properties props = new Properties();
        props.setProperty(ConstructorProps.STORAGEPATH, storage.getLocation().getAbsolutePath());
        props.setProperty(ConstructorProps.RESOURCE, "shredded");
        storage.createResource(new ResourceConfiguration(props, backend, revision, new TreeNodeFactory(),
            new NodeMetaPageFactory()));
        final ISession session =
            storage.getSession(new SessionConfiguration("shredded", StandardSettings.KEY));

        final DefaultHandler defHandler = new DefaultHandler();

        final SAXSerializer serializer = new SAXSerializer(session, defHandler);
        serializer.call();

        session.close();
    }