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


Java ConfigException.Missing方法代码示例

本文整理汇总了Java中com.typesafe.config.ConfigException.Missing方法的典型用法代码示例。如果您正苦于以下问题:Java ConfigException.Missing方法的具体用法?Java ConfigException.Missing怎么用?Java ConfigException.Missing使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.typesafe.config.ConfigException的用法示例。


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

示例1: MiningSettingsFactory

import com.typesafe.config.ConfigException; //导入方法依赖的package包/类
public MiningSettingsFactory(Config config) {
    String minerAddress = null;
    try {
        Config c = config.getConfig("mining");
        if (c != null) {
            boolean enabled = c.getBoolean("enabled");
            if (!c.hasPath("minerAddress")) {
                throw new ConfigException.Missing("mining.minerAddress");
            }
            minerAddress = c.getString("minerAddress");
            if (enabled) {
                int delayBetweenMiningBlocksSecs = c.getInt("delayBetweenMiningBlocksSecs");
                miningConfig = new MiningConfig(true, minerAddress, delayBetweenMiningBlocksSecs);
            } else {
                miningConfig = new MiningConfig(false, minerAddress, 0);
            }
        } else {
            miningConfig = MiningConfig.DISABLED;
        }
    } catch (HyperLedgerException e) {
        throw new ConfigException.BadValue(config.origin(), "mining.minerAddress", "Cannot decode the minerAddress: " + minerAddress);
    }
}
 
开发者ID:DigitalAssetCom,项目名称:-deprecated-hlp-candidate,代码行数:24,代码来源:CoreAssemblyFactory.java

示例2: getBaseUrl

import com.typesafe.config.ConfigException; //导入方法依赖的package包/类
/**
 * Gets env base url based on the queried channel.
 *
 * @param channel the channel to query
 * @param secure  whether to serve SSL protocol (if available for configured Environment) or not.
 *
 * @return the env base url (no trailing slash)
 */
public String getBaseUrl(Channels channel, boolean secure) {

  Config envConf = getEnvironmentConfiguration( getEnvironment() );

  String protocol = secure ? envConf.getString( channel + ".protocol" ) : "http";
  String host = getEnvHost( channel );

  String port = "";
  try {
    port = ":" + envConf.getString( channel + ".port" );
  } catch ( ConfigException.Missing e ) {
    // Silent fail, default service port will be used
  }

  return protocol + "://" + host + port;
}
 
开发者ID:icoretech,项目名称:audiobox-jlib,代码行数:25,代码来源:Configuration.java

示例3: onReceive

import com.typesafe.config.ConfigException; //导入方法依赖的package包/类
@Override
public void onReceive(Object msg) throws Exception {
	if(msg instanceof TransactionCreated) {
		log.debug("transaction created");
		
		try {
			databaseScheme = databaseConfig.getString("scheme");
		} catch(ConfigException.Missing cem) {
			databaseScheme = "SDE";
		}
		
		log.debug("database scheme before calling get fetch table: " + databaseScheme);
		
		transaction = ((TransactionCreated)msg).getActor();
		transaction.tell(SDEUtils.getFetchTable(SDEUtils.getItemsFilter(), databaseScheme), getSelf());
		
		getContext().become(onReceiveStreaming());
	} else if(msg instanceof ReceiveTimeout) {
		log.error("timeout received");
		getContext().stop(getSelf());
	} else {
		unhandled(msg);
	}
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:25,代码来源:SDEListDatasetInfoHandler.java

示例4: main

import com.typesafe.config.ConfigException; //导入方法依赖的package包/类
public static void main(String[] args) {
    try {
        final Config config = ConfigFactory.load().getConfig("billow");
        try {
            System.setProperty("aws.accessKeyId", config.getString("aws.accessKeyId"));
            System.setProperty("aws.secretKey", config.getString("aws.secretKeyId"));
        } catch (ConfigException.Missing _) {
            System.clearProperty("aws.accessKeyId");
            System.clearProperty("aws.secretKey");
        }
        Main.log.debug("Loaded config: {}", config);
        new Main(config);
    } catch (Throwable t) {
        Main.log.error("Failure in main thread, getting out!", t);
        System.exit(1);
    }
}
 
开发者ID:airbnb,项目名称:billow,代码行数:18,代码来源:Main.java

示例5: buildProperties

import com.typesafe.config.ConfigException; //导入方法依赖的package包/类
private Set<Entry<String, ConfigValue>> buildProperties(BeanDefinitionBuilder beanDefinition) {
    Set<String> paths = beanDefinitions.keySet();
    Set<Entry<String, ConfigValue>> entries = new HashSet<>();
    try {
        for (Entry<String, ConfigValue> entry : config.getConfig(path).root().entrySet()) {
            String fullPath = path.concat(".").concat(entry.getKey());
            if (paths.contains(fullPath)) {
                beanDefinition.addPropertyReference(entry.getKey(), beanDefinitions.get(fullPath).getId());
            } else {
                entries.add(entry);
            }
        }
    } catch (ConfigException.Missing e) {
        this.log.debug(format("No configuration found on path %s", path));
    }
    return entries;
}
 
开发者ID:yyvess,项目名称:jsconf,代码行数:18,代码来源:BeanFactory.java

示例6: setup

import com.typesafe.config.ConfigException; //导入方法依赖的package包/类
@Override
public void setup(final FragmentContext context, final BufferAllocator allocator, final SelectionVector4 vector4, final VectorContainer hyperBatch) throws SchemaChangeException{
  // we pass in the local hyperBatch since that is where we'll be reading data.
  Preconditions.checkNotNull(vector4);
  this.vector4 = vector4.createNewWrapperCurrent();
  this.context = context;
  vector4.clear();
  doSetup(context, hyperBatch, null);
  runStarts.add(0);
  int batch = 0;
  final int totalCount = this.vector4.getTotalCount();
  for (int i = 0; i < totalCount; i++) {
    final int newBatch = this.vector4.get(i) >>> 16;
    if (newBatch == batch) {
      continue;
    } else if (newBatch == batch + 1) {
      runStarts.add(i);
      batch = newBatch;
    } else {
      throw new UnsupportedOperationException("Missing batch");
    }
  }
  final DrillBuf drillBuf = allocator.buffer(4 * totalCount);

  try {
    desiredRecordBatchCount = context.getConfig().getInt(ExecConstants.EXTERNAL_SORT_MSORT_MAX_BATCHSIZE);
  } catch(ConfigException.Missing e) {
    // value not found, use default value instead
    desiredRecordBatchCount = Character.MAX_VALUE;
  }
  aux = new SelectionVector4(drillBuf, totalCount, desiredRecordBatchCount);
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:33,代码来源:MSortTemplate.java

示例7: newPStoreProvider

import com.typesafe.config.ConfigException; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public PStoreProvider newPStoreProvider() throws ExecutionSetupException {
  try {
    String storeProviderClassName = config.getString(ExecConstants.SYS_STORE_PROVIDER_CLASS);
    logger.info("Using the configured PStoreProvider class: '{}'.", storeProviderClassName);
    Class<? extends PStoreProvider> storeProviderClass = (Class<? extends PStoreProvider>) Class.forName(storeProviderClassName);
    Constructor<? extends PStoreProvider> c = storeProviderClass.getConstructor(PStoreRegistry.class);
    return new CachingStoreProvider(c.newInstance(this));
  } catch (ConfigException.Missing | ClassNotFoundException | NoSuchMethodException | SecurityException
      | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
    logger.error(e.getMessage(), e);
    throw new ExecutionSetupException("A System Table provider was either not specified or could not be found or instantiated", e);
  }
}
 
开发者ID:skhalifa,项目名称:QDrill,代码行数:15,代码来源:PStoreRegistry.java

示例8: getConfString

import com.typesafe.config.ConfigException; //导入方法依赖的package包/类
public static String getConfString(String key) {
	log.debug("getConfString(" + key + ")");
	String confString = "";
	try {
		confString = conf.getString(key);
	} catch(ConfigException.Missing cfeMissing) {
		log.error("Ignoring: " + cfeMissing.toString());
	}
	return confString;
}
 
开发者ID:kenahrens,项目名称:newrelic-api-client-java,代码行数:11,代码来源:APIApplication.java

示例9: setup

import com.typesafe.config.ConfigException; //导入方法依赖的package包/类
@Override
public void setup(final FragmentContext context, final BufferAllocator allocator, final SelectionVector4 vector4, final VectorContainer hyperBatch) throws SchemaChangeException{
  // we pass in the local hyperBatch since that is where we'll be reading data.
  Preconditions.checkNotNull(vector4);
  this.vector4 = vector4.createNewWrapperCurrent();
  this.context = context;
  vector4.clear();
  doSetup(context, hyperBatch, null);
  runStarts.add(0);
  int batch = 0;
  final int totalCount = this.vector4.getTotalCount();
  for (int i = 0; i < totalCount; i++) {
    final int newBatch = this.vector4.get(i) >>> 16;
    if (newBatch == batch) {
      continue;
    } else if (newBatch == batch + 1) {
      runStarts.add(i);
      batch = newBatch;
    } else {
      throw new UnsupportedOperationException(String.format("Missing batch. batch: %d newBatch: %d", batch, newBatch));
    }
  }
  final DrillBuf drillBuf = allocator.buffer(4 * totalCount);

  try {
    desiredRecordBatchCount = context.getConfig().getInt(ExecConstants.EXTERNAL_SORT_MSORT_MAX_BATCHSIZE);
  } catch(ConfigException.Missing e) {
    // value not found, use default value instead
    desiredRecordBatchCount = Character.MAX_VALUE;
  }
  aux = new SelectionVector4(drillBuf, totalCount, desiredRecordBatchCount);
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:33,代码来源:MSortTemplate.java

示例10: newPStoreProvider

import com.typesafe.config.ConfigException; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public PersistentStoreProvider newPStoreProvider() throws ExecutionSetupException {
  try {
    String storeProviderClassName = config.getString(ExecConstants.SYS_STORE_PROVIDER_CLASS);
    logger.info("Using the configured PStoreProvider class: '{}'.", storeProviderClassName);
    Class<? extends PersistentStoreProvider> storeProviderClass = (Class<? extends PersistentStoreProvider>) Class.forName(storeProviderClassName);
    Constructor<? extends PersistentStoreProvider> c = storeProviderClass.getConstructor(PersistentStoreRegistry.class);
    return new CachingPersistentStoreProvider(c.newInstance(this));
  } catch (ConfigException.Missing | ClassNotFoundException | NoSuchMethodException | SecurityException
      | InstantiationException | IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
    logger.error(e.getMessage(), e);
    throw new ExecutionSetupException("A System Table provider was either not specified or could not be found or instantiated", e);
  }
}
 
开发者ID:axbaretto,项目名称:drill,代码行数:15,代码来源:PersistentStoreRegistry.java

示例11: getScenarioIndexConfig

import com.typesafe.config.ConfigException; //导入方法依赖的package包/类
private int getScenarioIndexConfig() throws ConfigException.WrongType{
  int scenarioIndex = -1;
  try {
    scenarioIndex = Detective.getConfig().getNumber("detective.runner.scenario.index").intValue();
  } catch (ConfigException.Missing e1) {
    
  }
  return scenarioIndex;
}
 
开发者ID:detectiveframework,项目名称:detective,代码行数:10,代码来源:SimpleStoryRunner.java

示例12: createD2Client

import com.typesafe.config.ConfigException; //导入方法依赖的package包/类
private Client createD2Client(Config config) {
  String zkhosts = config.getString(ZOOKEEPER_HOSTS);
  if (zkhosts == null || zkhosts.length() == 0) {
    throw new ConfigException.Missing(ZOOKEEPER_HOSTS);
  }

  D2ClientBuilder d2Builder = new D2ClientBuilder().setZkHosts(zkhosts);

  boolean isSSLEnabled = config.getBoolean(SSL_ENABLED);
  if (isSSLEnabled) {
    d2Builder.setIsSSLEnabled(true);
    SSLContext sslContext = SSLContextFactory.createInstance(config);
    d2Builder.setSSLContext(sslContext);
    d2Builder.setSSLParameters(sslContext.getDefaultSSLParameters());
  }

  if (config.hasPath(CLIENT_SERVICES_CONFIG)) {
    Config clientServiceConfig = config.getConfig(CLIENT_SERVICES_CONFIG);
    Map<String, Map<String, Object>> result = new HashMap<>();
    for (String key: clientServiceConfig.root().keySet()) {
      Config value = clientServiceConfig.getConfig(key);
      result.put(key, toMap(value));
    }
    d2Builder.setClientServicesConfig(result);
  }

  return new D2ClientProxy(d2Builder, isSSLEnabled);
}
 
开发者ID:apache,项目名称:incubator-gobblin,代码行数:29,代码来源:R2ClientFactory.java

示例13: getProperty

import com.typesafe.config.ConfigException; //导入方法依赖的package包/类
@Override
public Optional<String> getProperty(String name) {
    try {
        return Optional.of(config.getString(name));
    } catch(ConfigException.Missing e) {
        return Optional.empty();
    }
}
 
开发者ID:backuity,项目名称:p2s,代码行数:9,代码来源:HoconDotCaseProperties.java

示例14: getHandler

import com.typesafe.config.ConfigException; //导入方法依赖的package包/类
@Override
public Handler getHandler(Config config) throws Exception {
    PrintStream target = System.out;
    try {
        final String targetDescription = config.getString("target");
        if (targetDescription.toLowerCase().equals("stderr")) {
            target = System.err;
        }
    } catch (ConfigException.Missing ignored) {
    }

    return new ConsoleOutputHandler(target);
}
 
开发者ID:airbnb,项目名称:plog,代码行数:14,代码来源:ConsoleOutputProvider.java

示例15: onReceive

import com.typesafe.config.ConfigException; //导入方法依赖的package包/类
@Override
public void onReceive(Object msg) throws Exception {
	if(msg instanceof TransactionCreated) {
		transaction = ((TransactionCreated)msg).getActor();
		ActorRef recordsReceiver = getContext().actorOf(
			SDEReceiveSingleItemInfo.props(getSelf()), 
			"item-records-receiver");
		
		try {
			databaseScheme = databaseConfig.getString("scheme");
		} catch(ConfigException.Missing cem) {
			databaseScheme = "SDE";
		}
		
		log.debug("database scheme before calling get fetch table: " + databaseScheme);
		
		transaction.tell(
			SDEUtils.getFetchTable(SDEUtils.getItemsFilter(originalMsg.getIdentification()), databaseScheme),
			recordsReceiver);
		getContext().become(onReceiveItemRecords());
	} else if(msg instanceof ReceiveTimeout) {
		log.error("timeout received");
		unavailable();
	} else {
		unhandled(msg);
	}
}
 
开发者ID:IDgis,项目名称:geo-publisher,代码行数:28,代码来源:SDEGetRasterDatasetHandler.java


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