com.typesafe.config.Config

Here are the examples of the java api com.typesafe.config.Config taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1264 Examples 7

19 Source : NestedConfig.java
with Apache License 2.0
from zpochen

abstract clreplaced NestedConfig implements Config {

    // private static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(NestedConfig.clreplaced);
    private final Config c;

    NestedConfig(Config c) {
        this.c = c;
    }

    @Override
    public ConfigObject root() {
        return c.root();
    }

    @Override
    public ConfigOrigin origin() {
        return c.origin();
    }

    @Override
    public Config withFallback(ConfigMergeable other) {
        return c.withFallback(other);
    }

    @Override
    public Config resolve() {
        return c.resolve();
    }

    @Override
    public Config resolve(ConfigResolveOptions options) {
        return c.resolve(options);
    }

    @Override
    public void checkValid(Config reference, String... restrictToPaths) {
        c.checkValid(reference, restrictToPaths);
    }

    @Override
    public boolean hasPath(String path) {
        return c.hasPath(path);
    }

    @Override
    public boolean isEmpty() {
        return c.isEmpty();
    }

    @Override
    public Set<Entry<String, ConfigValue>> entrySet() {
        return c.entrySet();
    }

    @Override
    public boolean getBoolean(String path) {
        return c.getBoolean(path);
    }

    @Override
    public Number getNumber(String path) {
        return c.getNumber(path);
    }

    @Override
    public int getInt(String path) {
        return c.getInt(path);
    }

    @Override
    public long getLong(String path) {
        return c.getLong(path);
    }

    @Override
    public double getDouble(String path) {
        return c.getDouble(path);
    }

    @Override
    public String getString(String path) {
        return c.getString(path);
    }

    @Override
    public ConfigObject getObject(String path) {
        return c.getObject(path);
    }

    @Override
    public Config getConfig(String path) {
        return c.getConfig(path);
    }

    @Override
    public Object getAnyRef(String path) {
        return c.getAnyRef(path);
    }

    @Override
    public ConfigValue getValue(String path) {
        return c.getValue(path);
    }

    @Override
    public Long getBytes(String path) {
        return c.getBytes(path);
    }

    @Override
    public Long getMilliseconds(String path) {
        return c.getMilliseconds(path);
    }

    @Override
    public Long getNanoseconds(String path) {
        return c.getNanoseconds(path);
    }

    @Override
    public ConfigList getList(String path) {
        return c.getList(path);
    }

    @Override
    public List<Boolean> getBooleanList(String path) {
        return c.getBooleanList(path);
    }

    @Override
    public List<Number> getNumberList(String path) {
        return c.getNumberList(path);
    }

    @Override
    public List<Integer> getIntList(String path) {
        return c.getIntList(path);
    }

    @Override
    public List<Long> getLongList(String path) {
        return c.getLongList(path);
    }

    @Override
    public List<Double> getDoubleList(String path) {
        return c.getDoubleList(path);
    }

    @Override
    public List<String> getStringList(String path) {
        return c.getStringList(path);
    }

    @Override
    public List<? extends ConfigObject> getObjectList(String path) {
        return c.getObjectList(path);
    }

    @Override
    public List<? extends Config> getConfigList(String path) {
        return c.getConfigList(path);
    }

    @Override
    public List<? extends Object> getAnyRefList(String path) {
        return c.getAnyRefList(path);
    }

    @Override
    public List<Long> getBytesList(String path) {
        return c.getBytesList(path);
    }

    @Override
    public List<Long> getMillisecondsList(String path) {
        return c.getMillisecondsList(path);
    }

    @Override
    public List<Long> getNanosecondsList(String path) {
        return c.getNanosecondsList(path);
    }

    @Override
    public Config withOnlyPath(String path) {
        return c.withOnlyPath(path);
    }

    @Override
    public Config withoutPath(String path) {
        return c.withoutPath(path);
    }

    @Override
    public Config atPath(String path) {
        return c.atPath(path);
    }

    @Override
    public Config atKey(String key) {
        return c.atKey(key);
    }

    @Override
    public Config withValue(String path, ConfigValue value) {
        return c.withValue(path, value);
    }
}

19 Source : DrillConfig.java
with Apache License 2.0
from zpochen

/**
 * Creates a drill configuration using the provided config file.
 * @param config custom configuration file
 * @return {@link DrillConfig} instance
 */
public static DrillConfig create(Config config) {
    return new DrillConfig(config.resolve(), true);
}

19 Source : ConfigUtil.java
with Apache License 2.0
from zhisheng17

public static Properties toProperties(Config config) {
    Properties properties = new Properties();
    config.entrySet().forEach(e -> properties.put(e.getKey(), unwrapped(config.getValue(e.getKey()))));
    return properties;
}

19 Source : ConfigUtil.java
with Apache License 2.0
from zhisheng17

public static Map<String, String> toMap(Config config) {
    Map<String, String> map = new HashMap<>();
    config.entrySet().forEach(e -> map.put(e.getKey(), unwrapped(e.getValue())));
    return map;
}

19 Source : AkkaSource.java
with Apache License 2.0
from zhisheng17

private Config getOrCreateMandatoryProperties(Config properties) {
    if (!properties.hasPath("akka.actor.provider")) {
        properties = properties.withValue("akka.actor.provider", ConfigValueFactory.fromAnyRef("akka.remote.RemoteActorRefProvider"));
    }
    if (!properties.hasPath("akka.remote.enabled-transports")) {
        properties = properties.withValue("akka.remote.enabled-transports", ConfigValueFactory.fromAnyRef(Collections.singletonList("akka.remote.netty.tcp")));
    }
    return properties;
}

19 Source : ActorPathService.java
with Apache License 2.0
from zerosoft

/**
 * 管理也存在系统的Actor地址服务
 */
public clreplaced ActorPathService {

    /**
     * 本节点存在的IService的地址
     */
    protected static Map<String, ActorRef<IServiceActor>> localService = Maps.newConcurrentMap();

    /**
     * 本节点存在的集群Actor的地址
     */
    public static Map<String, Member> clusterService = Maps.newConcurrentMap();

    public static Config akkaConfig;

    // 网络会话管理
    protected static ActorRef<ISessionManager> sessionManager;

    // 用户管理
    protected static ActorRef<IUserManager> userManager;

    protected static ActorRef<IGameWorldActor> gameWorldMessageActorRef;

    public static ActorRef<ClusterEvent.ClusterDomainEvent> clusterDomainEventActorRef;
}

19 Source : TrainWorker.java
with MIT License
from yuantiku

private Config updateConfigWithCustom(Config config) {
    for (Map.Entry<String, Object> entry : customParamsMap.entrySet()) {
        config = config.withValue(entry.getKey(), ConfigValueFactory.fromAnyRef(entry.getValue()));
    }
    return config;
}

19 Source : TrainWorker.java
with MIT License
from yuantiku

public String getTrainDataPath() {
    String configRealPath = (new File(configFile).exists()) ? configFile : configPath;
    File realFile = new File(configRealPath);
    CheckUtils.check(realFile.exists(), "config file(%s) doesn't exist!", configRealPath);
    Config config = ConfigFactory.parseFile(realFile);
    config = updateConfigWithCustom(config);
    return config.getString("data.train.data_path");
}

19 Source : TrainWorker.java
with MIT License
from yuantiku

public String getURI() {
    String configRealPath = (new File(configFile).exists()) ? configFile : configPath;
    File realFile = new File(configRealPath);
    CheckUtils.check(realFile.exists(), "config file(%s) doesn't exist!", configRealPath);
    Config config = ConfigFactory.parseFile(realFile);
    config = updateConfigWithCustom(config);
    return config.getString("fs_scheme");
}

19 Source : GBDTFeatureParams.java
with MIT License
from yuantiku

// init feature approximate params, called in main thread
public void init(Map<String, Integer> fName2IndexMap, long globalSampleCnt) {
    if (needFeaAppro) {
        CheckUtils.check(fName2IndexMap != null, "[GBDT] fName2IndexMap shouldn't be null");
        featureApproximateParamList = new ArrayList<>(feaApproConfList.size());
        Set<Integer> existCols = new HashSet<>(16);
        for (Config feaConf : feaApproConfList) {
            FeatureApproximateParams feaAppr = new FeatureApproximateParams();
            feaAppr.init(feaConf, existCols, fName2IndexMap, globalSampleCnt);
            featureApproximateParamList.add(feaAppr);
        }
        feaApproConfList = null;
    }
}

19 Source : GBDTCommonParams.java
with MIT License
from yuantiku

public static GBDTCommonParams loadParams(Config config) throws Exception {
    GBDTCommonParams params = new GBDTCommonParams();
    params.verbose = config.getBoolean("verbose");
    params.dataParams = new GBDTDataParams(config, "");
    params.modelParams = new GBDTModelParams(config, "");
    params.featureParams = new GBDTFeatureParams(config, "");
    params.optimizationParams = new GBDTOptimizationParams(config, "");
    checkParams(params);
    return params;
}

19 Source : CommonParams.java
with MIT License
from yuantiku

public static void main(String[] args) {
    Config config = ConfigFactory.parseFile(new File("config/model/linear.conf"));
    System.out.println(CommonParams.loadParams(config));
}

19 Source : CommonParams.java
with MIT License
from yuantiku

public static CommonParams loadParams(Config config) {
    CommonParams params = new CommonParams();
    params.dataParams = new DataParams(config, "");
    params.featureParams = new FeatureParams(config, "");
    params.lossParams = new LossParams(config, "");
    params.modelParams = new ModelParams(config, "");
    String optimizer = config.getString("optimization.optimizer");
    params.lsParams = new LineSearchParams(config, "optimization.");
    params.verbose = config.getBoolean("verbose");
    CheckUtils.check(optimizer.equals("line_search"), "optimization.optimizer only support:%s", "line_search");
    return params;
}

19 Source : DataFlowFactory.java
with MIT License
from yuantiku

public static DataFlow createDataFlow(String modelName, IFileSystem fs, Config config, ThreadCommSlave comm, int threadNum, boolean needPyTransform, String pyTransformScrip) throws Exception {
    if (modelName.equalsIgnoreCase("linear")) {
        return new LinearModelDataFlow(fs, config, comm, threadNum, needPyTransform, pyTransformScrip);
    } else if (modelName.equalsIgnoreCase("gbdt")) {
        return new GBDTDataFlow(fs, config, comm, threadNum, needPyTransform, pyTransformScrip);
    } else if (modelName.equalsIgnoreCase("fm")) {
        return new FMModelDataFlow(fs, config, comm, threadNum, needPyTransform, pyTransformScrip);
    } else if (modelName.equalsIgnoreCase("ffm")) {
        return new FFMModelDataFlow(fs, config, comm, threadNum, needPyTransform, pyTransformScrip);
    } else if (modelName.equalsIgnoreCase("gbmlr")) {
        return new GBMLRDataFlow(fs, config, comm, threadNum, needPyTransform, pyTransformScrip);
    } else if (modelName.equalsIgnoreCase("gbsdt")) {
        return new GBSDTDataFlow(fs, config, comm, threadNum, needPyTransform, pyTransformScrip);
    } else if (modelName.equalsIgnoreCase("multiclreplaced_linear")) {
        return new MulticlreplacedLinearModelDataFlow(fs, config, comm, threadNum, needPyTransform, pyTransformScrip);
    } else if (modelName.equalsIgnoreCase("gbhmlr")) {
        return new GBHMLRDataFlow(fs, config, comm, threadNum, needPyTransform, pyTransformScrip);
    } else if (modelName.equalsIgnoreCase("gbhsdt")) {
        return new GBHSDTDataFlow(fs, config, comm, threadNum, needPyTransform, pyTransformScrip);
    } else {
        throw new IOException("unknown model name!");
    }
}

19 Source : DefaultConfig.java
with Apache License 2.0
from yggdrash

public void setConfig(Config config) {
    this.config = config;
}

19 Source : ConfigUtil.java
with MIT License
from yangziwen

private static boolean hasPath(Config config, String path) {
    return config != null && config.hasPath(path);
}

19 Source : ConfigUtil.java
with MIT License
from yangziwen

public static int getIntOrDefault(Config config, String path, int defaultValue) {
    return hasPath(config, path) ? config.getInt(path) : defaultValue;
}

19 Source : ConfigUtil.java
with MIT License
from yangziwen

public static List<String> getStringList(Config config, String path) {
    return hasPath(config, path) ? config.getStringList(path) : Collections.emptyList();
}

19 Source : ConfigUtil.java
with MIT License
from yangziwen

public static boolean getBooleanOrDefault(Config config, String path, boolean defaultValue) {
    return hasPath(config, path) ? config.getBoolean(path) : defaultValue;
}

19 Source : ConfigUtil.java
with MIT License
from yangziwen

public static String getStringOrDefault(Config config, String path, String defaultValue) {
    return hasPath(config, path) ? config.getString(path) : defaultValue;
}

19 Source : ConfigUtil.java
with MIT License
from yangziwen

public static Config getConfig(Config config, String path) {
    return hasPath(config, path) ? config.getConfig(path) : ConfigFactory.empty();
}

19 Source : TaskConfig.java
with MIT License
from yangziwen

public static List<TaskConfig> from(Config config, List<String> taskNames) {
    return taskNames.stream().map(name -> config.getConfig(name)).map(GlobalConfig.task::newTaskConfig).filter(Objects::nonNull).collect(Collectors.toList());
}

19 Source : ServiceModule.java
with Apache License 2.0
from YANG-DB

private void bindInternalsController(Env env, Config config, Binder binder) {
    binder.install(new PrivateModule() {

        @Override
        protected void configure() {
            this.bind(InternalsController.clreplaced).to(StandardInternalsController.clreplaced);
            this.expose(InternalsController.clreplaced);
        }
    });
}

19 Source : ServiceModule.java
with Apache License 2.0
from YANG-DB

private void bindSparqlController(Env env, Config config, Binder binder) {
    binder.install(new PrivateModule() {

        @Override
        protected void configure() {
            this.bind(SchemaTranslatorController.clreplaced).annotatedWith(named(LoggingSparqlController.controllerParameter)).to(StandardGraphQLController.clreplaced);
            this.bind(Logger.clreplaced).annotatedWith(named(LoggingSparqlController.loggerParameter)).toInstance(LoggerFactory.getLogger(StandardGraphQLController.clreplaced));
            this.bind(SchemaTranslatorController.clreplaced).annotatedWith(named(StandardSparqlController.transformerName)).to(LoggingSparqlController.clreplaced);
            this.expose(SchemaTranslatorController.clreplaced).annotatedWith(named(StandardSparqlController.transformerName));
        }
    });
}

19 Source : ServiceModule.java
with Apache License 2.0
from YANG-DB

// region ModuleBase Implementation
@Override
protected void configureInner(Env env, Config config, Binder binder) throws Throwable {
    // bind common components
    long defaultTimeout = config.hasPath("fuse.cursor.timeout") ? config.getLong("fuse.cursor.timeout") : 60 * 1000 * 3;
    binder.bindConstant().annotatedWith(Names.named(ExecutionScope.clientParameter)).to(defaultTimeout);
    binder.bind(RequestIdSupplier.clreplaced).annotatedWith(named(CachedRequestIdSupplier.RequestIdSupplierParameter)).to(SnowflakeRequestIdSupplier.clreplaced).asEagerSingleton();
    binder.bind(RequestIdSupplier.clreplaced).to(CachedRequestIdSupplier.clreplaced).in(RequestScoped.clreplaced);
    binder.bind(RequestExternalMetadataSupplier.clreplaced).to(RequestExternalMetadataSupplier.Impl.clreplaced).in(RequestScoped.clreplaced);
    // bind service controller
    bindApiDescriptionController(env, config, binder);
    bindInternalsController(env, config, binder);
    bindDashboardController(env, config, binder);
    bindQueryController(env, config, binder);
    bindCursorController(env, config, binder);
    bindPageController(env, config, binder);
    bindCatalogController(env, config, binder);
    bindGraphQLController(env, config, binder);
    bindSparqlController(env, config, binder);
    bindSqlController(env, config, binder);
    bindDataLoaderController(env, config, binder);
    bindIdGeneratorController(env, config, binder);
    // bind requests
    binder.bind(InternalsDriver.clreplaced).to(StandardInternalsDriver.clreplaced).in(RequestScoped.clreplaced);
    binder.bind(DashboardDriver.clreplaced).to(StandardDashboardDriver.clreplaced).in(RequestScoped.clreplaced);
    binder.bind(CreateQueryRequest.clreplaced).in(RequestScoped.clreplaced);
    binder.bind(CreatePageRequest.clreplaced).in(RequestScoped.clreplaced);
    // cursors type
    binder.bind(CreateCsvCursorRequest.clreplaced).in(RequestScoped.clreplaced);
    binder.bind(CreateGraphHierarchyCursorRequest.clreplaced).in(RequestScoped.clreplaced);
    binder.bind(CreateGraphCursorRequest.clreplaced).in(RequestScoped.clreplaced);
    binder.bind(CreateGraphQLCursorRequest.clreplaced).in(RequestScoped.clreplaced);
    binder.bind(CreatePathsCursorRequest.clreplaced).in(RequestScoped.clreplaced);
    // execution scope
    binder.bind(ExecutionScope.clreplaced).in(RequestScoped.clreplaced);
    // bind request parameters
    binder.bind(PlanTraceOptions.clreplaced).in(RequestScoped.clreplaced);
    // bind status resource
    bindStatusResource(env, config, binder);
    // register PostConfigurer
    binder.bind(PostConfigurer.clreplaced).asEagerSingleton();
    // register Status Reported Job
    binder.bind(StatusReportedJob.clreplaced).in(new SingletonScope());
    // register life cycle hooks
    processLifeCycle(env, config, binder);
}

19 Source : ServiceModule.java
with Apache License 2.0
from YANG-DB

// endregion
// region Private Methods
private void bindApiDescriptionController(Env env, Config config, Binder binder) {
    binder.install(new PrivateModule() {

        @Override
        protected void configure() {
            this.bind(ApiDescriptionController.clreplaced).annotatedWith(named(LoggingApiDescriptionController.controllerParameter)).to(StandardApiDescriptionController.clreplaced);
            this.bind(Logger.clreplaced).annotatedWith(named(LoggingApiDescriptionController.loggerParameter)).toInstance(LoggerFactory.getLogger(StandardApiDescriptionController.clreplaced));
            this.bind(ApiDescriptionController.clreplaced).to(LoggingApiDescriptionController.clreplaced);
            this.expose(ApiDescriptionController.clreplaced);
        }
    });
}

19 Source : ServiceModule.java
with Apache License 2.0
from YANG-DB

private void bindDataLoaderController(Env env, Config config, Binder binder) {
    binder.install(new PrivateModule() {

        @Override
        protected void configure() {
            this.bind(DataLoaderController.clreplaced).annotatedWith(named(LoggingDataLoaderController.controllerParameter)).to(StandardDataLoaderController.clreplaced);
            this.bind(Logger.clreplaced).annotatedWith(named(LoggingDataLoaderController.loggerParameter)).toInstance(LoggerFactory.getLogger(StandardDataLoaderController.clreplaced));
            this.bind(DataLoaderController.clreplaced).to(LoggingDataLoaderController.clreplaced);
            this.expose(DataLoaderController.clreplaced);
        }
    });
}

19 Source : ServiceModule.java
with Apache License 2.0
from YANG-DB

private void processLifeCycle(Env env, Config config, Binder binder) {
    env.onStart(() -> {
        logger.info("starting YangDB");
        FuseUtils.onStart();
    });
    env.onStop(() -> {
        logger.info("stopping YangDB");
        FuseUtils.onStop();
    });
    env.onStarted(() -> {
        logger.info("YangDB started");
        FuseUtils.onStarted();
    });
}

19 Source : ServiceModule.java
with Apache License 2.0
from YANG-DB

private void bindCatalogController(Env env, Config config, Binder binder) {
    binder.install(new PrivateModule() {

        @Override
        protected void configure() {
            this.bind(CatalogController.clreplaced).annotatedWith(named(LoggingCatalogController.controllerParameter)).to(StandardCatalogController.clreplaced);
            this.bind(Logger.clreplaced).annotatedWith(named(LoggingCatalogController.loggerParameter)).toInstance(LoggerFactory.getLogger(StandardCatalogController.clreplaced));
            this.bind(CatalogController.clreplaced).to(LoggingCatalogController.clreplaced);
            this.expose(CatalogController.clreplaced);
        }
    });
}

19 Source : ServiceModule.java
with Apache License 2.0
from YANG-DB

private void bindSqlController(Env env, Config config, Binder binder) {
    binder.install(new PrivateModule() {

        @Override
        protected void configure() {
            this.bind(SchemaTranslatorController.clreplaced).annotatedWith(named(LoggingSqlController.controllerParameter)).to(StandardGraphQLController.clreplaced);
            this.bind(Logger.clreplaced).annotatedWith(named(LoggingSqlController.loggerParameter)).toInstance(LoggerFactory.getLogger(StandardGraphQLController.clreplaced));
            this.bind(SchemaTranslatorController.clreplaced).annotatedWith(named(StandardSqlController.transformerName)).to(LoggingSqlController.clreplaced);
            this.expose(SchemaTranslatorController.clreplaced).annotatedWith(named(StandardSqlController.transformerName));
        }
    });
}

19 Source : ServiceModule.java
with Apache License 2.0
from YANG-DB

private void bindQueryController(Env env, Config config, Binder binder) {
    binder.install(new PrivateModule() {

        @Override
        protected void configure() {
            this.bind(CursorController.clreplaced).annotatedWith(named(StandardQueryController.cursorControllerParameter)).to(StandardCursorController.clreplaced);
            this.bind(PageController.clreplaced).annotatedWith(named(StandardQueryController.pageControllerParameter)).to(StandardPageController.clreplaced);
            this.bind(QueryController.clreplaced).annotatedWith(named(LoggingQueryController.controllerParameter)).to(StandardQueryController.clreplaced);
            this.bind(Logger.clreplaced).annotatedWith(named(LoggingQueryController.loggerParameter)).toInstance(LoggerFactory.getLogger(StandardQueryController.clreplaced));
            this.bind(new TypeLiteral<Descriptor<Query>>() {
            }).annotatedWith(named(LoggingQueryController.queryDescriptorParameter)).to(JacksonQueryDescriptor.clreplaced).asEagerSingleton();
            this.bind(QueryController.clreplaced).to(LoggingQueryController.clreplaced);
            this.expose(QueryController.clreplaced);
        }
    });
}

19 Source : ServiceModule.java
with Apache License 2.0
from YANG-DB

protected void bindStatusResource(Env env, Config conf, Binder binder) {
    // node status persist processor
    binder.install(new PrivateModule() {

        @Override
        protected void configure() {
            String clazz = env.config().hasPath("fuse.node_status_reporter") ? env.config().getString("fuse.node_status_reporter") : InMemNodeStatusResource.clreplaced.getName();
            try {
                this.bind(NodeStatusResource.clreplaced).to((Clreplaced<? extends NodeStatusResource>) Clreplaced.forName(clazz)).asEagerSingleton();
                this.expose(NodeStatusResource.clreplaced);
            } catch (ClreplacedNotFoundException e) {
                e.printStackTrace();
            }
        }
    });
}

19 Source : ServiceModule.java
with Apache License 2.0
from YANG-DB

private void bindIdGeneratorController(Env env, Config config, Binder binder) {
    binder.install(new PrivateModule() {

        @Override
        protected void configure() {
            this.bind(new TypeLiteral<IdGeneratorController<Range>>() {
            }).to(new TypeLiteral<StandardIdGeneratorController<Range>>() {
            }).asEagerSingleton();
            this.expose(new TypeLiteral<IdGeneratorController<Range>>() {
            });
        }
    });
}

19 Source : ServiceModule.java
with Apache License 2.0
from YANG-DB

private void bindDashboardController(Env env, Config config, Binder binder) {
    binder.install(new PrivateModule() {

        @Override
        protected void configure() {
            this.bind(DashboardController.clreplaced).to(StandardDashboardController.clreplaced);
            this.expose(DashboardController.clreplaced);
        }
    });
}

19 Source : ServiceModule.java
with Apache License 2.0
from YANG-DB

private void bindPageController(Env env, Config config, Binder binder) {
    binder.install(new PrivateModule() {

        @Override
        protected void configure() {
            this.bind(PageController.clreplaced).annotatedWith(named(LoggingPageController.controllerParameter)).to(StandardPageController.clreplaced);
            this.bind(Logger.clreplaced).annotatedWith(named(LoggingPageController.loggerParameter)).toInstance(LoggerFactory.getLogger(StandardPageController.clreplaced));
            this.bind(PageController.clreplaced).to(LoggingPageController.clreplaced);
            this.expose(PageController.clreplaced);
        }
    });
}

19 Source : ServiceModule.java
with Apache License 2.0
from YANG-DB

private void bindGraphQLController(Env env, Config config, Binder binder) {
    binder.install(new PrivateModule() {

        @Override
        protected void configure() {
            this.bind(SchemaTranslatorController.clreplaced).annotatedWith(named(LoggingGraphQLController.controllerParameter)).to(StandardGraphQLController.clreplaced);
            this.bind(Logger.clreplaced).annotatedWith(named(LoggingGraphQLController.loggerParameter)).toInstance(LoggerFactory.getLogger(StandardGraphQLController.clreplaced));
            this.bind(SchemaTranslatorController.clreplaced).annotatedWith(named(StandardGraphQLController.transformerName)).to(LoggingGraphQLController.clreplaced);
            this.expose(SchemaTranslatorController.clreplaced).annotatedWith(named(StandardGraphQLController.transformerName));
        }
    });
}

19 Source : ServiceModule.java
with Apache License 2.0
from YANG-DB

private void bindCursorController(Env env, Config config, Binder binder) {
    binder.install(new PrivateModule() {

        @Override
        protected void configure() {
            this.bind(CursorController.clreplaced).annotatedWith(named(LoggingCursorController.controllerParameter)).to(StandardCursorController.clreplaced);
            this.bind(Logger.clreplaced).annotatedWith(named(LoggingCursorController.loggerParameter)).toInstance(LoggerFactory.getLogger(StandardCursorController.clreplaced));
            this.bind(CursorController.clreplaced).to(LoggingCursorController.clreplaced);
            this.expose(CursorController.clreplaced);
        }
    });
}

19 Source : Bootstrap.java
with Apache License 2.0
from YANG-DB

private void loadModules(Env env, Config conf, Binder binder) {
    String profile = conf.getString("application.profile");
    System.out.println("Active Profile " + profile);
    System.out.println("Loading modules: " + "modules." + profile);
    List<String> modules = conf.getStringList("modules." + profile);
    modules.forEach(value -> {
        try {
            Method method = Jooby.Module.clreplaced.getMethod("configure", Env.clreplaced, Config.clreplaced, Binder.clreplaced);
            method.invoke(Clreplaced.forName(value).newInstance(), env, conf, binder);
            System.out.println(" -- Module " + value + " loaded");
        } catch (Exception e) {
            // todo something usefull here - sbould the app break ???
            System.out.println("ERROR - Bootstrap loading failed " + e.getMessage());
            e.printStackTrace();
        }
    });
    System.out.println("All modules loaded[" + modules.size() + "]");
}

19 Source : FuseUtils.java
with Apache License 2.0
from YANG-DB

public static boolean loadEmbedded(Config config) throws Exception {
    if (config.hasPath(ELASTICSEARCH_EMBEDDED) && config.getBoolean(ELASTICSEARCH_EMBEDDED)) {
        String nodeName = config.getString(ELASTICSEARCH_CLUSTER_NAME);
        boolean deleteOnLoad = true;
        if (config.hasPath(ELASTICSEARCH_DELETE_DATA_ON_LOAD)) {
            deleteOnLoad = config.getBoolean(ELASTICSEARCH_DELETE_DATA_ON_LOAD);
        }
        int nodePort = config.getInt(ELASTICSEARCH_PORT);
        String target = "target/es";
        if (config.hasPath(ELASTICSEARCH_WORKING_DIR))
            target = config.getString(ELASTICSEARCH_WORKING_DIR);
        System.out.println(String.format("Loading elasticsearch (embedded?%b) server %s on port %d on target %s", config.getBoolean("elasticsearch.embedded"), nodeName, nodePort, target));
        closeables.add(new ElasticEmbeddedNode(target, 9200, nodePort, nodeName, deleteOnLoad));
        return true;
    }
    return false;
}

19 Source : FuseApp.java
with Apache License 2.0
from YANG-DB

public FuseApp conf(Config config) {
    super.use(config);
    return this;
}

19 Source : FuseApp.java
with Apache License 2.0
from YANG-DB

// endregion
// region Public Methods
public FuseApp conf(File file, String activeProfile, Tuple2<String, ConfigValue>... values) {
    Config config = loadConfig(file, activeProfile, values);
    super.use(config);
    return this;
}

19 Source : GtaModule.java
with Apache License 2.0
from YANG-DB

private Clreplaced<? extends PlanTraversalTranslator> getPlanTraversalTranslatorClreplaced(Config conf) throws ClreplacedNotFoundException {
    return (Clreplaced<? extends PlanTraversalTranslator>) Clreplaced.forName(conf.getString("fuse.plan_traversal_translator_clreplaced"));
}

19 Source : EpbModuleM2CountBased.java
with Apache License 2.0
from YANG-DB

@Override
protected PlanSelector<PlanWithCost<Plan, PlanDetailedCost>, AsgQuery> globalPlanSelector(Config config) {
    return new CheapestPlanSelector();
}

19 Source : EpbModuleM2CountBased.java
with Apache License 2.0
from YANG-DB

@Override
protected PlanPruneStrategy<PlanWithCost<Plan, PlanDetailedCost>> globalPrunerStrategy(Config config) {
    return new M2GlobalPruner();
}

19 Source : EpbModuleM2CountBased.java
with Apache License 2.0
from YANG-DB

// region ModuleBase Implementation
@Override
protected Clreplaced<? extends PlanExtensionStrategy<Plan, AsgQuery>> planExtensionStrategy(Config config) {
    return M2PlanExtensionStrategy.clreplaced;
}

19 Source : EpbModule.java
with Apache License 2.0
from YANG-DB

@Override
protected Clreplaced<? extends PlanExtensionStrategy<Plan, AsgQuery>> planExtensionStrategy(Config config) {
    return M1PlanExtensionStrategy.clreplaced;
}

19 Source : EpbDfsRuleBasedRedundantModule.java
with Apache License 2.0
from YANG-DB

protected Clreplaced<? extends StatisticsProviderFactory> getStatisticsProviderFactory(Config conf) throws ClreplacedNotFoundException {
    return (Clreplaced<? extends StatisticsProviderFactory>) Clreplaced.forName(conf.getString(conf.getString("replacedembly") + ".stats_provider_clreplaced"));
}

19 Source : EpbDfsRuleBasedRedundantModule.java
with Apache License 2.0
from YANG-DB

// region Private Methods
@Override
protected Clreplaced<? extends PlanExtensionStrategy<Plan, AsgQuery>> planExtensionStrategy(Config conf) throws ClreplacedNotFoundException {
    return (Clreplaced<? extends PlanExtensionStrategy<Plan, AsgQuery>>) Clreplaced.forName(conf.getString(conf.getString("replacedembly") + ".plan_extension_strategy_clreplaced"));
}

19 Source : EpbDfsRuleBasedRedundantModule.java
with Apache License 2.0
from YANG-DB

@Override
protected PlanPruneStrategy<PlanWithCost<Plan, PlanDetailedCost>> globalPrunerStrategy(Config config) {
    return new CheapestPlanPruneStrategy();
}

19 Source : EpbDfsRedundantModule.java
with Apache License 2.0
from YANG-DB

// region Private Methods
@Override
protected Clreplaced<? extends PlanExtensionStrategy<Plan, AsgQuery>> planExtensionStrategy(Config config) {
    return M1DfsRedundantPlanExtensionStrategy.clreplaced;
}

See More Examples