Creates a new <code>Launcher</code> instance according to the
configurations.

@return a <code>Launcher</code> instance
168752
@Override
	public Launcher build() {
		LauncherImpl launcher = new LauncherImpl();
		launcher.setNativeFastCheck(nativeFastCheck);
		launcher.setPrintDebugCommandline(printDebugCommandline);
		launcher.setUseDaemonThreads(useDaemonThreads);
		return launcher;
	}
142859
public Deployment build()
   {
      return new DeploymentImpl(identifier, name, archive, classLoader,
                                metadata, activation,
                                resourceAdapter, getConnectionFactories(), getAdminObjects(), classLoaderPlugin);
   }
1003276
public static ConfigBuilder configBuilder() {
    return new ConfigBuilder(new StringReader(""), new StringWriter(),
        EMPTY_CONNECTION_FACTORY, EMPTY_COMMAND_HANDLER,
        EMPTY_PROPERTY_HANDLER, EMPTY_ENV, DEFAULT_MAX_STACK_LENGTH);
  }
629601
public J4pClient build() {
        return new J4pClient(url,createHttpClient(),
                             targetUrl != null ? new J4pTargetConfig(targetUrl,targetUser,targetPassword) :  null,
                             responseExtractor);
    }
759754
public Config build() {
    if (this.language == null) {
      this.language = "java";
    }
    if (this.endpoint == null) {
      this.endpoint = SyncSender.DEFAULT_API_ENDPOINT;
    }
    if (this.notifier == null) {
      this.notifier = new NotifierProvider();
    }
    if (this.sender == null) {
      SyncSender.Builder innerSender =
          new SyncSender.Builder(this.endpoint)
          .accessToken(accessToken)
          .proxy(proxy);
      if (this.jsonSerializer != null) {
        innerSender.jsonSerializer(this.jsonSerializer);
      }
      this.sender =
        new BufferedSender.Builder().sender(innerSender.build()).build();
    }
    if (this.timestamp == null) {
      this.timestamp = new TimestampProvider();
    }

    return new ConfigImpl(this);
  }
670569
public static ConfigurationManager getInstance()
		throws ConfigurationException
	{

		if (instance == null) {
			throw ErrorFactory
					.createConfigurationException(ErrorKeys.CONFIGURATION_CONFIGURATIONMANAGER_NOT_INITIALIZED);
		}
		return instance;
	}
403921
public static <T> T newInstance(Class<T> clazz) {
		try {
			return clazz.newInstance();
		}
		catch (InstantiationException | IllegalAccessException e) {
			throw new ResourceException(String.format("couldn't create a new instance of %s", clazz));
		}
	}
882491
public T newInstance() {
        try {
            return getEnhancedClass().newInstance();
        } catch (Exception e) {
            logger.error("Could not instantiate enhanced object.", e);

            throw ExceptionUtil.propagate(e);
        }
    }
819965
public final Thread launch() {

		if (state != RUN) {
			onLaunch();
			state = RUN;
			Thread thread = (new Thread(this));
			thread.start();
			return thread;
		} else {
			return null;
		}
	}
1161669
protected Class<? extends LauncherDelegate> getLauncherDelegateClass(ClassLoader loader) throws ClassNotFoundException {
        String className = "com.ibm.ws.kernel.launch.internal.LauncherDelegateImpl";

        Class<?> clazz = loader.loadClass(className);
        if (clazz == null)
            throw new ClassNotFoundException(className);

        return clazz.asSubclass(LauncherDelegate.class);
    }
1105564
public Launch aSynchLaunch() throws LaunchException {
		JobDataMap jobDataMap = new JobDataMap();
		jobDataMap.put(Launch.PARAMETERS, this.launch.getParameters());
		jobDataMap.put(Launch.DEFAULT_EXECUTOR_KEY, this.launch.getExecutorService());
		try {
			this.launch.aSynchLaunch();
		} catch (org.parallelj.launching.LaunchException e) {
			throw new LaunchException(e);
		}
		this.legacyLaunchResult = new LaunchResult(launch.getLaunchId(), jobDataMap);
		
		return this;
	}
804834
public PebbleEngine createPebbleEngine() {
        PebbleEngine.Builder builder = new PebbleEngine.Builder();
        builder.strictVariables(strictVariables);
        if (defaultLocale != null) {
            builder.defaultLocale(defaultLocale);
        }
        if (templateLoaders == null) {
            if (templateLoaderPaths != null && templateLoaderPaths.length > 0) {
                List<Loader<?>> templateLoaderList = new ArrayList<>();
                for (String path : templateLoaderPaths) {
                    templateLoaderList.add(getTemplateLoaderForPath(path));
                }
                setTemplateLoader(templateLoaderList);
            }
        }
        Loader<?> templateLoader = getAggregateTemplateLoader(templateLoaders);
        builder.loader(templateLoader);
        return builder.build();
    }
774320
public static ThorntailConfigurationBuilder create(Configuration config)
    {
        ThorntailConfigurationBuilder builder = new ThorntailConfigurationBuilder();

        ConfigurationElement propertiesElem = null;
        try
        {
            propertiesElem = config.getConfigurationElement("properties");
        }
        catch (RuntimeException e)
        {
            // Do nothing
        }
        if (propertiesElem != null)
        {
            Map<String, String> properties = new TreeMap<>();
            propertiesElem.getChildren().stream()
                        .filter(ConfigurationElement.class::isInstance)
                        .map(ConfigurationElement.class::cast)
                        .forEach(elem -> properties.put(elem.getName(), elem.getText()));
            builder.properties(properties);
        }
        return builder;
    }
1116787
protected Throwable relaunch(ClassLoader classLoader) throws Exception {
		RestartLauncher launcher = new RestartLauncher(classLoader, this.mainClassName,
				this.args, this.exceptionHandler);
		launcher.start();
		launcher.join();
		return launcher.getError();
	}
320665
protected Object createInstance(String classname) {

        // get the classloader to use
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        if (classLoader == null) {
            classLoader = this.getClass().getClassLoader();
        }

        // create an instance of the class using the default constructor
        try {

            return classLoader.loadClass(classname).newInstance();

        } catch (InstantiationException e) {
            throw new IllegalStateException(e);
        } catch (IllegalAccessException e) {
            throw new IllegalStateException(e);
        } catch (ClassNotFoundException e) {
            throw new IllegalStateException(e);
        }

    }
324534
protected T createInstance() {
		try {
			return targetClass.newInstance();
		} catch (InstantiationException e) {
			throw new RuntimeException(e);
		} catch (IllegalAccessException e) {
			throw new RuntimeException(e);
		}
	}
948962
public static ProcessBuilder getProcessBuilder(String mainClass, List<URL> classPath, List<String> args) throws LauncherException
	{
		List<String> cmdList = new ArrayList<String>();
		String[] cmdArray;
		
		cmdList.add(getJavaPath());
		if(classPath != null && classPath.size() > 0)
		{
			cmdList.add("-cp");
			cmdList.add(mkPath(classPath));
		}
		cmdList.add(mainClass);
		if(args!=null && args.size()>0)
			cmdList.addAll(args);
		cmdArray = cmdList.toArray(new String[cmdList.size()]);
		if(logger.isDebugEnabled())
			logger.debug("cmdArray=" + Arrays.toString(cmdArray));
		return new ProcessBuilder(cmdArray);
	}