List of usage examples for javax.naming ConfigurationException ConfigurationException
public ConfigurationException()
From source file:org.apache.cloudstack.network.contrail.management.ContrailManagerImpl.java
@Override public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { File configFile = PropertiesUtil.findConfigFile(configuration); FileInputStream fileStream = null; try {/*from w ww. j a v a 2s. c o m*/ String hostname = null; int port = 0; if (configFile == null) { return false; } else { final Properties configProps = new Properties(); fileStream = new FileInputStream(configFile); configProps.load(fileStream); String value = configProps.getProperty("management.db_sync_interval"); if (value != null) { _dbSyncInterval = Integer.parseInt(value); } hostname = configProps.getProperty("api.hostname"); String portStr = configProps.getProperty("api.port"); if (portStr != null && portStr.length() > 0) { port = Integer.parseInt(portStr); } } _api = ApiConnectorFactory.build(hostname, port); } catch (IOException ex) { s_logger.warn("Unable to read " + configuration, ex); throw new ConfigurationException(); } catch (Exception ex) { s_logger.debug("Exception in configure: " + ex); ex.printStackTrace(); throw new ConfigurationException(); } finally { IOUtils.closeQuietly(fileStream); } _controller = new ModelController(this, _api, _vmDao, _networksDao, _nicDao, _vlanDao, _ipAddressDao); try { _routerOffering = locateNetworkOffering(routerOfferingName, routerOfferingDisplayText, Provider.JuniperContrailRouter); _routerPublicOffering = locatePublicNetworkOffering(routerPublicOfferingName, routerPublicOfferingDisplayText, Provider.JuniperContrailRouter); _vpcRouterOffering = locateNetworkOffering(vpcRouterOfferingName, vpcRouterOfferingDisplayText, Provider.JuniperContrailVpcRouter); _vpcOffering = locateVpcOffering(); } catch (Exception ex) { s_logger.debug("Exception in locating network offerings: " + ex); ex.printStackTrace(); throw new ConfigurationException(); } _eventHandler.subscribe(); initializeDefaultVirtualNetworkModels(); return true; }