Create default {@link Utensils} by a given {@link JBakeConfiguration}
@param config a {@link JBakeConfiguration}
@return a default {@link Utensils} instance
498349
public static Utensils createDefaultUtensils(JBakeConfiguration config) {

        JBakeConfigurationInspector inspector = new JBakeConfigurationInspector(config);
        inspector.inspect();

        Utensils utensils = new Utensils();
        utensils.setConfiguration(config);
        ContentStore contentStore = DBUtil.createDataStore(config);
        utensils.setContentStore(contentStore);
        utensils.setCrawler(new Crawler(contentStore, config));
        utensils.setRenderer(new Renderer(contentStore, config));
        utensils.setAsset(new Asset(config));

        return utensils;
    }
584824
public static <T> Key<T> keyWithDefault(String name, T defaultValue) {
    return new Key<>(name, defaultValue);
  }
1058513
public static ZabMessage.ClusterConfiguration
  buildConfig(ClusterConfiguration config) {
    ZabMessage.Zxid version = toProtoZxid(config.getVersion());
    return ZabMessage.ClusterConfiguration.newBuilder()
                                          .setVersion(version)
                                          .addAllServers(config.getPeers())
                                          .build();
  }
198069
public static Context createContext(Configuration config) {
		Context context = new Context();

		context.setProperty(Context.OS_NAME, System.getProperty("os.name"));
		context.setProperty(Context.OS_VERSION, System.getProperty("os.version"));
		context.setProperty(Context.OS_ARCHITECTURE, System.getProperty("os.arch"));

		context.setProperty(Context.JAVA_VERSION, System.getProperty("java.version"));
		context.setProperty(Context.JAVA_VENDOR, System.getProperty("java.vendor"));

		context.setProperty(Context.JAVA_RUNTIME_NAME, System.getProperty("java.runtime.name"));
		context.setProperty(Context.JAVA_RUNTIME_VERSION, System.getProperty("java.runtime.version"));

		context.setProperty(Context.JAVA_VM_NAME, System.getProperty("java.vm.name"));
		context.setProperty(Context.JAVA_VM_VERSION, System.getProperty("java.vm.version"));
		context.setProperty(Context.JAVA_VM_VENDOR, System.getProperty("java.vm.vendor"));

		context.setProperty(Context.JAVA_VM_SPEC_NAME, System.getProperty("java.vm.specification.name"));
		context.setProperty(Context.JAVA_VM_SPEC_VERSION, System.getProperty("java.vm.specification.version"));
		context.setProperty(Context.JAVA_VM_SPEC_VENDOR, System.getProperty("java.vm.specification.vendor"));

		context.setProperty(Context.JAVA_SPEC_NAME, System.getProperty("java.specification.name"));
		context.setProperty(Context.JAVA_SPEC_VERSION, System.getProperty("java.specification.version"));
		context.setProperty(Context.JAVA_SPEC_VENDOR, System.getProperty("java.specification.vendor"));

		context.setProperty(Context.JAVA_CLASS_VERSION, System.getProperty("java.class.version"));

		context.setPreProperty(Context.MEMORY_TOTAL, Runtime.getRuntime().totalMemory());
		context.setPreProperty(Context.MEMORY_FREE, Runtime.getRuntime().freeMemory());
		context.setPreProperty(Context.MEMORY_USED, Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory());

		// Enriched with SCM data
		if (config.getScmInfo() != null) {
			ScmInfo scmInfo = config.getScmInfo();

			context.setPropertyNullAvoided(Context.PROBEDOCK_SCM_NAME, scmInfo.getName());
			context.setPropertyNullAvoided(Context.PROBEDOCK_SCM_VERSION, scmInfo.getVersion());
			context.setPropertyNullAvoided(Context.PROBEDOCK_SCM_DIRTY, scmInfo.isDirty());
			context.setPropertyNullAvoided(Context.PROBEDOCK_SCM_BRANCH, scmInfo.getBranch());
			context.setPropertyNullAvoided(Context.PROBEDOCK_SCM_COMMIT, scmInfo.getCommit());

			// Enriched with SCM remote data
			if (scmInfo.getRemote() != null) {
				ScmRemoteInfo scmRemoteInfo = scmInfo.getRemote();

				context.setPropertyNullAvoided(Context.PROBEDOCK_SCM_REMOTE_NAME, scmRemoteInfo.getName());
				context.setPropertyNullAvoided(Context.PROBEDOCK_SCM_REMOTE_FETCH_URL, scmRemoteInfo.getFetchUrl());
				context.setPropertyNullAvoided(Context.PROBEDOCK_SCM_REMOTE_PUSH_URL, scmRemoteInfo.getPushUrl());
				context.setPropertyNullAvoided(Context.PROBEDOCK_SCM_REMOTE_AHEAD, scmRemoteInfo.getAhead());
				context.setPropertyNullAvoided(Context.PROBEDOCK_SCM_REMOTE_BEHIND, scmRemoteInfo.getBehind());
			}
		}

		return context;
	}
376417
public OperationFuture<ServerMetadata> create(CreateServerConfig config) {
        BaseServerResponse response = client.create(
            serverConverter.buildCreateServerRequest(
                config,
                config.getCustomFields().isEmpty() ?
                    null :
                    client.getCustomFields())
        );

        return postProcessBuildServerResponse(response, config);
    }
400525
public static IDataSource create(JsonObject config) throws DataSourceCreationException {
        String title = config.getAsJsonPrimitive("title").getAsString();
        String description = config.getAsJsonPrimitive("description").getAsString();
        String typeName = config.getAsJsonPrimitive("type").getAsString();
        
        JsonObject settings = config.getAsJsonObject("settings");

        final IDataSourceType type = DataSourceTypesRegistry.getType(typeName);
        if ( type == null )
            throw new UnknownDataSourceTypeException(typeName);

        return type.createDataSource( title, description, settings );
    }
1292478
public OperationFuture<LoadBalancerPool> create(LoadBalancerPoolConfig config) {
        LoadBalancer loadBalancer = config.getLoadBalancer();
        LoadBalancerMetadata loadBalancerMetadata = loadBalancerService.findByRef(loadBalancer);

        LoadBalancerPoolMetadata metadata = loadBalancerPoolClient.create(
            loadBalancerMetadata.getDataCenterId(),
            loadBalancerMetadata.getId(),
            new LoadBalancerPoolRequest()
                .port(config.getPort())
                .method(config.getMethod())
                .persistence(config.getPersistence())
        );

        LoadBalancerPool pool = LoadBalancerPool.refById(metadata.getId(), loadBalancer);

        return new OperationFuture<>(
            pool,
            addLoadBalancerNodes(config, pool)
        );
    }
1148248
public DefaultCacheEventListenerConfiguration build() {
    DefaultCacheEventListenerConfiguration defaultCacheEventListenerConfiguration;
    if (this.listenerClass != null) {
      defaultCacheEventListenerConfiguration = new DefaultCacheEventListenerConfiguration(this.eventsToFireOn, this.listenerClass, this.listenerArguments);
    } else {
      defaultCacheEventListenerConfiguration = new DefaultCacheEventListenerConfiguration(this.eventsToFireOn, this.listenerInstance);
    }
    if (eventOrdering != null) {
      defaultCacheEventListenerConfiguration.setEventOrderingMode(this.eventOrdering);
    }
    if (eventFiringMode != null) {
      defaultCacheEventListenerConfiguration.setEventFiringMode(this.eventFiringMode);
    }
    return defaultCacheEventListenerConfiguration;
  }
1038438
@RequestMapping(value = "configurations/create", method = RequestMethod.POST)
    public JenkinsConfiguration newConfiguration(@RequestBody JenkinsConfiguration configuration) {
        return jenkinsService.newConfiguration(configuration);
    }
456427
public static function buildConfig($config = array())
    {
        $default = static::getDefaultParameters();
        $required = static::getRequiredParameters();
        $config = Collection::fromConfig($config, $default, $required);

        $standardHeaders = array(
            'Accept-Charset' => 'utf-8',
            'Accept'         => 'application/json',
        );

        $requestOptions = array(
            'headers' => $standardHeaders,
        );

        $config->add('request.options', $requestOptions);

        return $config;
    }
87048
private static Configuration createCfg(TemplateConfig config) {
		if (null == config) {
			config = new TemplateConfig();
		}

		final Configuration cfg = new Configuration(Configuration.VERSION_2_3_28);
		cfg.setLocalizedLookup(false);
		cfg.setDefaultEncoding(config.getCharset().toString());

		switch (config.getResourceMode()) {
		case CLASSPATH:
			cfg.setTemplateLoader(new ClassTemplateLoader(ClassUtil.getClassLoader(), config.getPath()));
			break;
		case FILE:
			try {
				cfg.setTemplateLoader(new FileTemplateLoader(FileUtil.file(config.getPath())));
			} catch (IOException e) {
				throw new IORuntimeException(e);
			}
			break;
		case WEB_ROOT:
			 try {
				 cfg.setTemplateLoader(new FileTemplateLoader(FileUtil.file(FileUtil.getWebRoot(), config.getPath())));
			 } catch (IOException e) {
				 throw new IORuntimeException(e);
			 }
			break;
		case STRING:
			cfg.setTemplateLoader(new SimpleStringTemplateLoader());
			break;
		default:
			break;
		}
		
		return cfg;
	}
1145862
public MtasTokenizer create(String configuration, String defaultConfiguration) throws IOException {
    return create(TokenStream.DEFAULT_TOKEN_ATTRIBUTE_FACTORY, configuration, defaultConfiguration);
  }
988178
public static ShardingStrategy newInstance(final ShardingStrategyConfiguration shardingStrategyConfig) {
        if (shardingStrategyConfig instanceof StandardShardingStrategyConfiguration) {
            return new StandardShardingStrategy((StandardShardingStrategyConfiguration) shardingStrategyConfig);
        }
        if (shardingStrategyConfig instanceof InlineShardingStrategyConfiguration) {
            return new InlineShardingStrategy((InlineShardingStrategyConfiguration) shardingStrategyConfig);
        }
        if (shardingStrategyConfig instanceof ComplexShardingStrategyConfiguration) {
            return new ComplexShardingStrategy((ComplexShardingStrategyConfiguration) shardingStrategyConfig);
        }
        if (shardingStrategyConfig instanceof HintShardingStrategyConfiguration) {
            return new HintShardingStrategy((HintShardingStrategyConfiguration) shardingStrategyConfig);
        }
        return new NoneShardingStrategy();
    }
650707
public static AtomixClusterBuilder builder(String config, ClassLoader classLoader) {
    return new AtomixClusterBuilder(config(withDefaultResources(config), classLoader));
  }
662330
public static SecondaryConfig defaultSecondaryConfig(SecondaryKeyCreator keyCreator) {
        SecondaryConfig cfg = new SecondaryConfig();
        cfg.setAllowCreate(true);
        //Duplicates are frequently required for secondary databases
        cfg.setSortedDuplicates(true);
        cfg.setTransactional(true);
        cfg.setKeyCreator(checkNotNull(keyCreator, "SecondaryKeyCreator cannot be null"));
        return cfg;
    }
711107
public Section mbean(String name, MBeanRule.Consumer config) {
        MBeanRule rule = new MBeanRule(name);
        config.accept(rule);
        this.rules.add(rule);
        return this;
    }
129928
public Object createInstance(StoreConfiguration storeConfiguration) {
      for(CacheStoreFactory factory : factories) {
         Object instance = factory.createInstance(storeConfiguration);
         if(instance != null) {
            return instance;
         }
      }
      throw log.unableToInstantiateClass(storeConfiguration.getClass());
   }