当前位置: 首页>>代码示例>>Java>>正文


Java ConfigFactory类代码示例

本文整理汇总了Java中org.aeonbits.owner.ConfigFactory的典型用法代码示例。如果您正苦于以下问题:Java ConfigFactory类的具体用法?Java ConfigFactory怎么用?Java ConfigFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ConfigFactory类属于org.aeonbits.owner包,在下文中一共展示了ConfigFactory类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: BabelConfig

import org.aeonbits.owner.ConfigFactory; //导入依赖的package包/类
/**
 * Creates a config object from file in path or from default if fails to load file
 *
 * @param pathToConfig
 */
private BabelConfig(String pathToConfig) {
    //if string null or empty, use or own configFromFile.properties.
    if (pathToConfig == null) {
        cfg = ConfigFactory.create(ConfigFromFile.class);
    } else {
        //get config.properties file from path

        try {
            Properties props = new Properties();
            props.load(new FileInputStream(new File(pathToConfig)));
            cfg = ConfigFactory.create(ConfigFromFile.class, props);
        } catch (IOException e) {
            cfg = ConfigFactory.create(ConfigFromFile.class);
        }

    }

}
 
开发者ID:gidim,项目名称:Babler,代码行数:24,代码来源:BabelConfig.java

示例2: start

import org.aeonbits.owner.ConfigFactory; //导入依赖的package包/类
@CommandRef(desc = "Start a new Appium session from ${user.home}/appium.txt file")
public void start() throws MalformedURLException, CommandsException {
  try {
    ConfigCapabilities config = ConfigFactory.create(ConfigCapabilities.class);
    DesiredCapabilities caps = new DesiredCapabilities();

    caps.setCapability(DEVICE_NAME, config.deviceName());
    caps.setCapability(NEW_COMMAND_TIMEOUT, config.cmdTimeout());
    caps.setCapability(APP, config.app());
    setApp(config.app());

    if (!config.udid().isEmpty()) {
      caps.setCapability(UDID, config.udid());
      setDeviceID(config.udid());
    }

    URL urlServer = new URL(config.appiumServer());
    setPlatformName(config.platformName(), urlServer, caps);

  } catch (Exception e) {
    throw new RuntimeException(
        format("An error has occurred: [%s] Please check the appium.txt file on: [%s]",
            e.getMessage(), getProperty("user.home")));
  }
}
 
开发者ID:mobileboxlab,项目名称:appium-java-repl,代码行数:26,代码来源:AppiumCommands.java

示例3: create

import org.aeonbits.owner.ConfigFactory; //导入依赖的package包/类
public static DlCheckAgent create(Instrumentation inst, String args) {
    String agentName = JAgentUtil.getImplTitle(DlCheckAgent.class);
    String agentVersion = JAgentUtil.getImplVersion(DlCheckAgent.class);
    Configuration cfg = ConfigFactory.create(Configuration.class, System.getProperties());
    Log.Level logLevel;
    try {
        logLevel = Log.Level.valueOf(cfg.logLevel());
    } catch (IllegalArgumentException e) {
        System.err.println("Invalid log level: " + cfg.logLevel() + ", INFO used by default");
        logLevel = Log.Level.INFO;
    }
    Log log = new Log(agentName, logLevel, cfg.logFile());
    DlCheckAgent agent = new DlCheckAgent(inst, args, agentName, agentVersion, log);
    agent.setRedefineClasses(cfg.redefine());
    agent.setIsVerboseRedefinition(cfg.verboseRedifinition());
    CachingClassFileTransformer transformer = new Transformer(cfg, log, agentVersion);
    transformer.setCacheDir(cfg.cacheDir());
    transformer.setDumpDir(cfg.dumpDir());
    agent.addTransformer(transformer);
    LocationManager.getInstance().init(cfg.cacheDir(), agentVersion);
    PotentialDeadlockPublisher.init();
    return agent;
}
 
开发者ID:Devexperts,项目名称:dlcheck,代码行数:24,代码来源:DlCheckAgent.java

示例4: create

import org.aeonbits.owner.ConfigFactory; //导入依赖的package包/类
public static SampleAgent create(Instrumentation inst, String agentArgs) {
    String agentName = JAgentUtil.getImplTitle(SampleAgent.class);
    String agentVersion = JAgentUtil.getImplVersion(SampleAgent.class);
    Configuration cfg = ConfigFactory.create(Configuration.class, System.getProperties());
    Log.Level logLevel;
    try {
        logLevel = Log.Level.valueOf(cfg.logLevel());
    } catch (IllegalArgumentException e) {
        System.err.println("Invalid log level: " + cfg.logLevel() + ", INFO used by default");
        logLevel = Log.Level.INFO;
    }
    Log log = new Log(agentName, logLevel, cfg.logFile());
    SampleAgent agent = new SampleAgent(inst, agentArgs, agentName, agentVersion, log);
    agent.setRedefineClasses(cfg.redefine());
    agent.setIsVerboseRedefinition(cfg.verboseRedifinition());
    agent.addTransformer(new MethodDeleterTransformer(cfg.clazz(), cfg.method(), log));
    return agent;
}
 
开发者ID:Devexperts,项目名称:jagent,代码行数:19,代码来源:SampleAgent.java

示例5: testOwnerAPI

import org.aeonbits.owner.ConfigFactory; //导入依赖的package包/类
@Test
public void testOwnerAPI() throws Exception
{
	final Properties props = new Properties()
	{
		private static final long serialVersionUID = 1L;
		{
			setProperty("server.host.name", "localhost");
			setProperty("server.http.port", "80");
		}
	};
	final TestConfig cfg1 = ConfigFactory.create(TestConfig.class, props);
	LOG.trace("Server " + cfg1.hostname() + ":" + cfg1.port()
			+ " will run " + cfg1.maxThreads());

	final TestConfig cfg2 = ConfigCache
			.getOrCreate(TestConfig.class, props);
	LOG.trace("Server " + cfg2.hostname() + ":" + cfg2.port()
			+ " will run " + cfg2.maxThreads());
}
 
开发者ID:krevelen,项目名称:coala,代码行数:21,代码来源:ConfigTest.java

示例6: main

import org.aeonbits.owner.ConfigFactory; //导入依赖的package包/类
public static void main(String[] args) throws InterruptedException {
    Thread back = new Thread(new MainBack());
    back.start();
    MainBack.PM.waitUntilProcessesLoaded();
    cfg = ConfigFactory.create(ThisConfig.class);
    try {
        readFromConfig();
    } catch (IOException e) {
        // TODO Auto-generated catch block
        e.printStackTrace();
    }
    createAndShowGUI();
    setupTray();
}
 
开发者ID:SlideKB,项目名称:SlideBar,代码行数:15,代码来源:UI.java

示例7: main

import org.aeonbits.owner.ConfigFactory; //导入依赖的package包/类
public static void main(String[] args) throws Exception{
	//使用owner管理项目配置  @see owner-doc
	ServerConf cfg = ConfigFactory.create(ServerConf.class);
	
	//初始化请求分发路由配置
	ActionDispatcher dispatcher = new ActionDispatcher();
	dispatcher.init(cfg.routerConfigPath());
	
	//启动 netty 服务
	new HttpServer(cfg.port()).run();
}
 
开发者ID:cyfonly,项目名称:nettice,代码行数:12,代码来源:HttpServer.java

示例8: beforeTest

import org.aeonbits.owner.ConfigFactory; //导入依赖的package包/类
@Before
public void beforeTest()
{
    cfg = ConfigFactory.create(TestConfig.class, System.getenv(), System.getProperties());
    restTemplate = Mockito.mock(RestTemplate.class);

    assertNotNull(cfg.authToken());
}
 
开发者ID:mytaxi,项目名称:phrase-java-client,代码行数:9,代码来源:DefaultLocaleAPITest.java

示例9: beforeTest

import org.aeonbits.owner.ConfigFactory; //导入依赖的package包/类
@Before
public void beforeTest()
{

    cfg = ConfigFactory.create(TestConfig.class, System.getenv(), System.getProperties());
    restTemplate = Mockito.mock(RestTemplate.class);
    String authTokenMock = "authMockTockenString";
    translationAPI = new DefaultPhraseTranslationAPI(restTemplate, authTokenMock);
    projectId = "SomeProjectId";
    localeId = "SomeLocaleId";
}
 
开发者ID:mytaxi,项目名称:phrase-java-client,代码行数:12,代码来源:DefaultPhraseTranslationAPITest.java

示例10: getMongoClient

import org.aeonbits.owner.ConfigFactory; //导入依赖的package包/类
public synchronized SharedMongoClient getMongoClient() {
    if(sharedMongoClient == null) {
        logger.debug("Bootstrapping a new MongoClient Instance");

        mongoConfiguration = ConfigFactory.create(MongoConfiguration.class);

        MongoClientOptions clientOptions = mongoClientOptionsFromConfiguration();
        ServerAddress serverAddress =  buildAddressFromConfiguration();
        MongoClient mongoClient = new MongoClient(serverAddress, clientOptions);
        sharedMongoClient = new SharedMongoClient(mongoClient, mongoConfiguration);
    }
    return sharedMongoClient;
}
 
开发者ID:rynmrtn,项目名称:mongo-client-lib,代码行数:14,代码来源:MongoClientFactory.java

示例11: getConfiguration

import org.aeonbits.owner.ConfigFactory; //导入依赖的package包/类
@Provides
public EndPointHealthConfiguration getConfiguration() {
    return ConfigFactory
            .create(EndPointHealthConfiguration.class, System.getProperties());
}
 
开发者ID:spypunk,项目名称:endpoint-health,代码行数:6,代码来源:EndPointHealthModule.java

示例12: loadConfiguration

import org.aeonbits.owner.ConfigFactory; //导入依赖的package包/类
private boolean loadConfiguration() {
    cfg = ConfigFactory.create(ThisConfig.class);

    return true;
}
 
开发者ID:SlideKB,项目名称:SlideBar,代码行数:6,代码来源:AltProcess.java

示例13: loadConfiguration

import org.aeonbits.owner.ConfigFactory; //导入依赖的package包/类
private boolean loadConfiguration() {
    cfg = ConfigFactory.create(ThisConfig.class);
    return true;
}
 
开发者ID:SlideKB,项目名称:SlideBar,代码行数:5,代码来源:Volume.java

示例14: main

import org.aeonbits.owner.ConfigFactory; //导入依赖的package包/类
public static void main(String[] args) {
    TestConfig cfg = ConfigFactory.create(TestConfig.class);
    System.out.println("Server " + cfg.hostname() + ":" + cfg.port() + " will run " + cfg.maxThreads());
}
 
开发者ID:SlideKB,项目名称:SlideBar,代码行数:5,代码来源:ConfigurationTest.java

示例15: conf

import org.aeonbits.owner.ConfigFactory; //导入依赖的package包/类
public static VideoConfiguration conf() {
  ConfigFactory.setProperty("os.type", getOsType());
  return ConfigFactory.create(VideoConfiguration.class, System.getProperties());
}
 
开发者ID:SergeyPirogov,项目名称:video-recorder-java,代码行数:5,代码来源:VideoRecorder.java


注:本文中的org.aeonbits.owner.ConfigFactory类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。