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


Java ConfigurationException类代码示例

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


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

示例1: main

import javax.naming.ConfigurationException; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
	ArgsUtil util = ArgsUtil.parser(args);
	Long period = util.getLong("period");
	if(period == null){
		period = 300L;
	}
	final String website = util.getString("website");
	if(website == null || "".equals(website)){
		throw new ConfigurationException("please enter args[website], to configure the reporting website! example:[--website=http://localhost:8080/metric]");
	}
	final String ip = util.getString("ip");
	new Timer().schedule(new TimerTask() {
		@Override
		public void run() {
			try {
				Map<String, String> info = MonitorUtil.getSystemInfo(ip);
				RestTemplate.send(website, info);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
	}, 0, period  * 1000);
}
 
开发者ID:yanfanvip,项目名称:RedisClusterManager,代码行数:24,代码来源:AppMain.java

示例2: Worker

import javax.naming.ConfigurationException; //导入依赖的package包/类
public Worker(WorkerConfig config) throws ConfigurationException {
  this.config = config;

  /* configuration validation */
  root = getValidRoot(config);
  Path casCacheDirectory = getValidCasCacheDirectory(config, root);

  /* initialization */
  instance = new StubInstance(
      config.getInstanceName(),
      createChannel(config.getOperationQueue()));
  InputStreamFactory inputStreamFactory = new InputStreamFactory() {
    @Override
    public InputStream apply(Digest digest) {
      return instance.newStreamInput(instance.getBlobName(digest));
    }
  };
  fileCache = new CASFileCache(
      inputStreamFactory,
      root.resolve(casCacheDirectory),
      config.getCasCacheMaxSizeBytes());
}
 
开发者ID:bazelbuild,项目名称:bazel-buildfarm,代码行数:23,代码来源:Worker.java

示例3: getProperties

import javax.naming.ConfigurationException; //导入依赖的package包/类
/**
 * Prepare Properties object for JDBC Connector
 *
 * @return prepared Properties object for JDBC Connector
 */
public Properties getProperties() {
    Properties dbProperties = new Properties();

    try {
        // specify driver class name, required by Spark to register it on all executors
        dbProperties.put("driver", getDriverClassName());
    } catch (ConfigurationException ignored) {
        // already checked during validation
    }
    dbProperties.put("tcpKeepAlive", "true");
    dbProperties.put("connectTimeout", "0");
    dbProperties.put("socketTimeout", "0");
    dbProperties.setProperty("user", user);
    dbProperties.setProperty("password", password);
    dbProperties.setProperty("batchsize", batchSize.toString());
    if (schema != null) {
        dbProperties.put("searchpath", schema);
        dbProperties.put("currentSchema", schema);
    }
    return dbProperties;
}
 
开发者ID:Merck,项目名称:rdf2x,代码行数:27,代码来源:DbConfig.java

示例4: configure

import javax.naming.ConfigurationException; //导入依赖的package包/类
@Override
@DB()
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
    _name = name;

    final String value = (String) params.get("lock.timeout");
    _timeoutSeconds = NumbersUtil.parseInt(value, 300);

    createCache(params);
    final boolean load = Boolean.parseBoolean((String) params.get("cache.preload"));
    if (load) {
        listAll();
    }

    return true;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:17,代码来源:GenericDaoBase.java

示例5: loadServerResource

import javax.naming.ConfigurationException; //导入依赖的package包/类
private ServerResource loadServerResource(final String resourceClassName) throws ConfigurationException {
    logger.debug("Loading agent resource from class name {}", resourceClassName);
    final String[] names = resourceClassName.split("\\|");
    for (final String name : names) {
        final Class<?> impl;
        try {
            impl = Class.forName(name);
            final Constructor<?> constructor = impl.getDeclaredConstructor();
            constructor.setAccessible(true);
            return (ServerResource) constructor.newInstance();
        } catch (final ClassNotFoundException
                | SecurityException
                | NoSuchMethodException
                | IllegalArgumentException
                | InstantiationException
                | IllegalAccessException
                | InvocationTargetException e) {
            throw new ConfigurationException("Failed to launch agent due to " + e.getClass().getSimpleName() + ": " + e.getMessage());
        }
    }
    throw new ConfigurationException("Could not find server resource class to load in: " + resourceClassName);
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:23,代码来源:AgentShell.java

示例6: testWhenExplicitlySetDifferentDefault

import javax.naming.ConfigurationException; //导入依赖的package包/类
@Test
public void testWhenExplicitlySetDifferentDefault() throws ConfigurationException {

    // Tests when explicitly set vif driver to OVS when using regular bridges and vice versa
    final Map<String, Object> params = new HashMap<>();

    // Switch res' bridge type for test purposes
    params.put(LibVirtVifDriver, LibvirtComputingResource.DEFAULT_OVS_VIF_DRIVER_CLASS);
    res.setBridgeType(BridgeType.NATIVE);
    configure(params);
    checkAllSame(ovsVifDriver);

    params.clear();
    params.put(LibVirtVifDriver, LibvirtComputingResource.DEFAULT_BRIDGE_VIF_DRIVER_CLASS);
    res.setBridgeType(BridgeType.OPENVSWITCH);
    configure(params);
    checkAllSame(bridgeVifDriver);
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:19,代码来源:LibvirtVifDriverTest.java

示例7: parse

import javax.naming.ConfigurationException; //导入依赖的package包/类
private static RouterConfig parse(File configFile) throws Exception{
	RouterConfig config = new RouterConfig();
	SAXReader saxReader = new SAXReader();
	Document document = null;
	try{
		document = saxReader.read(new InputSource(new FileInputStream(configFile)));
	}catch(DocumentException e){
		throw new ConfigurationException("config file parse error");
	}
	if(document != null){
		Element rootElement = document.getRootElement();
		Iterator<?> ie = rootElement.elementIterator();
		while(ie.hasNext()){
			Element element = (Element) ie.next();
			if("action-package".equals(element.getName())){
				config.actionPackages = parseActionPackages(element);
			}else if("namespaces".equals(element.getName())){
				config.namespaces = parseNamespaces(element);
			}
		}
	}
	return config;
}
 
开发者ID:cyfonly,项目名称:nettice,代码行数:24,代码来源:RouterConfig.java

示例8: configure

import javax.naming.ConfigurationException; //导入依赖的package包/类
@Override
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
    super.configure(name, params);
    if (_configDao != null) {
        final Map<String, String> configs = _configDao.getConfiguration(null, params);
        final String globalStorageOverprovisioningFactor = configs.get("storage.overprovisioning.factor");
        _storageOverprovisioningFactor = new BigDecimal(NumbersUtil.parseFloat(globalStorageOverprovisioningFactor, 2.0f));
        _extraBytesPerVolume = 0;
        _rand = new Random(System.currentTimeMillis());
        _dontMatter = Boolean.parseBoolean(configs.get("storage.overwrite.provisioning"));
        final String allocationAlgorithm = configs.get("vm.allocation.algorithm");
        if (allocationAlgorithm != null) {
            _allocationAlgorithm = allocationAlgorithm;
        }
        return true;
    }
    return false;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:19,代码来源:AbstractStoragePoolAllocator.java

示例9: configure

import javax.naming.ConfigurationException; //导入依赖的package包/类
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
    storageLayer = new JavaStorageLayer();
    storageLayer.configure("StorageLayer", params);

    String storageScriptsDir = (String) params.get("storage.scripts.dir");
    if (storageScriptsDir == null) {
        storageScriptsDir = getDefaultStorageScriptsDir();
    }

    createTmplPath = Script.findScript(storageScriptsDir, "createtmplt.sh");
    if (createTmplPath == null) {
        throw new ConfigurationException("Unable to find the createtmplt.sh");
    }

    manageSnapshotPath = Script.findScript(storageScriptsDir, "managesnapshot.sh");
    if (manageSnapshotPath == null) {
        throw new ConfigurationException("Unable to find the managesnapshot.sh");
    }

    cmdsTimeout = ((Integer) params.get("cmds.timeout")) * 1000;
    return true;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:23,代码来源:KvmStorageProcessor.java

示例10: configure

import javax.naming.ConfigurationException; //导入依赖的package包/类
@Override
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
    super.configure(name, params);

    nameSearch = createSearchBuilder();
    nameSearch.and("name", nameSearch.entity().getName(), SearchCriteria.Op.EQ);
    nameSearch.and("role", nameSearch.entity().getRole(), SearchCriteria.Op.EQ);
    nameSearch.done();

    providerSearch = createSearchBuilder();
    providerSearch.and("providerName", providerSearch.entity().getProviderName(), SearchCriteria.Op.EQ);
    providerSearch.and("role", providerSearch.entity().getRole(), SearchCriteria.Op.EQ);
    providerSearch.done();

    regionSearch = createSearchBuilder();
    regionSearch.and("scope", regionSearch.entity().getScope(), SearchCriteria.Op.EQ);
    regionSearch.and("role", regionSearch.entity().getRole(), SearchCriteria.Op.EQ);
    regionSearch.done();

    return true;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:22,代码来源:ImageStoreDaoImpl.java

示例11: configure

import javax.naming.ConfigurationException; //导入依赖的package包/类
@Override
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
    final boolean result = super.configure(name, params);

    countVnetsDedicatedToAccount = createSearchBuilder(Integer.class);
    countVnetsDedicatedToAccount.and("dc", countVnetsDedicatedToAccount.entity().getDataCenterId(), SearchCriteria.Op.EQ);
    countVnetsDedicatedToAccount.and("accountGuestVlanMapId", countVnetsDedicatedToAccount.entity().getAccountGuestVlanMapId(), Op.NNULL);
    AccountGuestVlanMapSearch = _accountGuestVlanMapDao.createSearchBuilder();
    AccountGuestVlanMapSearch.and("accountId", AccountGuestVlanMapSearch.entity().getAccountId(), SearchCriteria.Op.EQ);
    countVnetsDedicatedToAccount.join("AccountGuestVlanMapSearch", AccountGuestVlanMapSearch, countVnetsDedicatedToAccount.entity().getAccountGuestVlanMapId(),
            AccountGuestVlanMapSearch.entity().getId(), JoinBuilder.JoinType.INNER);
    countVnetsDedicatedToAccount.select(null, Func.COUNT, countVnetsDedicatedToAccount.entity().getId());
    countVnetsDedicatedToAccount.done();
    AccountGuestVlanMapSearch.done();

    return result;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:18,代码来源:DataCenterVnetDaoImpl.java

示例12: configure

import javax.naming.ConfigurationException; //导入依赖的package包/类
@Override
public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException {
    if (!super.configure(name, params)) {
        return false;
    }

    final String value = (String) params.get("mac.address.prefix");
    _prefix = (long) NumbersUtil.parseInt(value, 06) << 40;

    if (!_ipAllocDao.configure("Ip Alloc", params)) {
        return false;
    }

    if (!_vnetAllocDao.configure("vnet Alloc", params)) {
        return false;
    }
    return true;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:19,代码来源:DataCenterDaoImpl.java

示例13: setUp

import javax.naming.ConfigurationException; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    try {
        authenticator.configure("SHA256", Collections.<String, Object>emptyMap());
    } catch (final ConfigurationException e) {
        fail(e.toString());
    }

    when(_userAccountDao.getUserAccount("admin", 0L)).thenReturn(adminAccount);
    when(_userAccountDao.getUserAccount("admin20Byte", 0L)).thenReturn(adminAccount20Byte);
    when(_userAccountDao.getUserAccount("fake", 0L)).thenReturn(null);
    //32 byte salt, and password="password"
    when(adminAccount.getPassword()).thenReturn("WS3UHhBPKHZeV+G3jnn7G2N3luXgLSfL+2ORDieXa1U=:VhuFOrOU2IpsjKYH8cH1VDaDBh/VivjMcuADjeEbIig=");
    //20 byte salt, and password="password"
    when(adminAccount20Byte.getPassword()).thenReturn("QL2NsxVEmRuDaNRkvIyADny7C5w=:JoegiytiWnoBAxmSD/PwBZZYqkr746x2KzPrZNw4NgI=");
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:17,代码来源:AuthenticatorTest.java

示例14: connectToHypervisor

import javax.naming.ConfigurationException; //导入依赖的package包/类
private Connect connectToHypervisor() throws ConfigurationException {
    Connect conn = null;
    try {
        conn = LibvirtConnection.getConnection();

        if (getBridgeType() == OPENVSWITCH) {
            if (conn.getLibVirVersion() < 10 * 1000 + 0) {
                throw new ConfigurationException("Libvirt version 0.10.0 required for openvswitch support, but version "
                        + conn.getLibVirVersion() + " detected");
            }
        }
    } catch (final LibvirtException e) {
        throw new CloudRuntimeException(e.getMessage());
    }
    return conn;
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:17,代码来源:LibvirtComputingResource.java

示例15: testDefaultsWhenExplicitlySet

import javax.naming.ConfigurationException; //导入依赖的package包/类
@Test
public void testDefaultsWhenExplicitlySet() throws ConfigurationException {

    final Map<String, Object> params = new HashMap<>();

    // Switch res' bridge type for test purposes
    params.put(LibVirtVifDriver, LibvirtComputingResource.DEFAULT_BRIDGE_VIF_DRIVER_CLASS);
    res.setBridgeType(BridgeType.NATIVE);
    configure(params);
    checkAllSame(bridgeVifDriver);

    params.clear();
    params.put(LibVirtVifDriver, LibvirtComputingResource.DEFAULT_OVS_VIF_DRIVER_CLASS);
    res.setBridgeType(BridgeType.OPENVSWITCH);
    configure(params);
    checkAllSame(ovsVifDriver);
}
 
开发者ID:MissionCriticalCloud,项目名称:cosmic,代码行数:18,代码来源:LibvirtVifDriverTest.java


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