javax.naming.ConfigurationException Java Examples
The following examples show how to use
javax.naming.ConfigurationException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ClusterServiceServletAdapter.java From cloudstack with Apache License 2.0 | 6 votes |
@Override public String getServiceEndpointName(String strPeer) { try { init(); } catch (ConfigurationException e) { s_logger.error("Unable to init ClusterServiceServletAdapter"); return null; } long msid = Long.parseLong(strPeer); ManagementServerHostVO mshost = _mshostDao.findByMsid(msid); if (mshost == null) return null; return composeEndpointName(mshost.getServiceIP(), mshost.getServicePort()); }
Example #2
Source File: VmwareServerDiscoverer.java From cloudstack with Apache License 2.0 | 6 votes |
@Override public ServerResource reloadResource(HostVO host) { String resourceName = host.getResource(); ServerResource resource = getResource(resourceName); if (resource != null) { _hostDao.loadDetails(host); HashMap<String, Object> params = buildConfigParams(host); try { resource.configure(host.getName(), params); } catch (ConfigurationException e) { s_logger.warn("Unable to configure resource due to " + e.getMessage()); return null; } if (!resource.start()) { s_logger.warn("Unable to start the resource"); return null; } } return resource; }
Example #3
Source File: LibvirtVifDriverTest.java From cosmic with Apache License 2.0 | 6 votes |
@Test public void testOverrideSomeTrafficTypes() throws ConfigurationException { final Map<String, Object> params = new HashMap<>(); params.put(this.LibVirtVifDriver + "." + "Public", this.FakeVifDriverClassName); params.put(this.LibVirtVifDriver + "." + "Guest", LibvirtComputingResource.DEFAULT_OVS_VIF_DRIVER_CLASS); this.res.setBridgeType(BridgeType.NATIVE); configure(params); // Initially, set all traffic types to use default for (final TrafficType trafficType : TrafficType.values()) { this.assertions.put(trafficType, this.bridgeVifDriver); } this.assertions.put(TrafficType.Public, this.fakeVifDriver); this.assertions.put(TrafficType.Guest, this.ovsVifDriver); checkAssertions(); }
Example #4
Source File: ServiceDiscoveryServiceTest.java From smarthome with Eclipse Public License 2.0 | 6 votes |
@Test public void testDiscovery() throws ConfigurationException { // Setting the MqttService will enable the background scanner MqttServiceDiscoveryService d = new MqttServiceDiscoveryService(); d.addDiscoveryListener(discoverListener); d.setMqttService(service); d.startScan(); // We expect 3 discoveries. An embedded thing, a textual configured one, a non-textual one ArgumentCaptor<DiscoveryResult> discoveryCapture = ArgumentCaptor.forClass(DiscoveryResult.class); verify(discoverListener, times(2)).thingDiscovered(eq(d), discoveryCapture.capture()); List<DiscoveryResult> discoveryResults = discoveryCapture.getAllValues(); assertThat(discoveryResults.size(), is(2)); assertThat(discoveryResults.get(0).getThingTypeUID(), is(MqttBindingConstants.BRIDGE_TYPE_SYSTEMBROKER)); assertThat(discoveryResults.get(1).getThingTypeUID(), is(MqttBindingConstants.BRIDGE_TYPE_SYSTEMBROKER)); // Add another thing d.brokerAdded("anotherone", new MqttBrokerConnection("tcp://123.123.123.123", null, false, null)); discoveryCapture = ArgumentCaptor.forClass(DiscoveryResult.class); verify(discoverListener, times(3)).thingDiscovered(eq(d), discoveryCapture.capture()); discoveryResults = discoveryCapture.getAllValues(); assertThat(discoveryResults.size(), is(3)); assertThat(discoveryResults.get(2).getThingTypeUID(), is(MqttBindingConstants.BRIDGE_TYPE_SYSTEMBROKER)); }
Example #5
Source File: BuildFarmInstances.java From bazel-buildfarm with Apache License 2.0 | 6 votes |
public BuildFarmInstances( String session, List<InstanceConfig> instanceConfigs, String defaultInstanceName, Runnable onStop) throws InterruptedException, ConfigurationException { instances = new HashMap<String, Instance>(); createInstances(session, instanceConfigs, onStop); if (!defaultInstanceName.isEmpty()) { if (!instances.containsKey(defaultInstanceName)) { throw new ConfigurationException( defaultInstanceName + " not specified in instance configs."); } defaultInstance = instances.get(defaultInstanceName); } else { defaultInstance = null; } }
Example #6
Source File: ClusteredAgentManagerImpl.java From cosmic with Apache License 2.0 | 6 votes |
@Override public boolean configure(final String name, final Map<String, Object> xmlParams) throws ConfigurationException { this._peers = new HashMap<>(7); this._sslEngines = new HashMap<>(7); this._nodeId = ManagementServerNode.getManagementServerId(); s_logger.info("Configuring ClusterAgentManagerImpl. management server node id(msid): " + this._nodeId); ClusteredAgentAttache.initialize(this); this._clusterMgr.registerListener(this); this._clusterMgr.registerDispatcher(new ClusterDispatcher()); this._gson = GsonHelper.getGson(); return super.configure(name, xmlParams); }
Example #7
Source File: SnapshotManagerImpl.java From cosmic with Apache License 2.0 | 6 votes |
@Override public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException { this._configDao.getValue(Config.BackupSnapshotWait.toString()); Type.HOURLY.setMax(NumbersUtil.parseInt(this._configDao.getValue("snapshot.max.hourly"), HOURLYMAX)); Type.DAILY.setMax(NumbersUtil.parseInt(this._configDao.getValue("snapshot.max.daily"), DAILYMAX)); Type.WEEKLY.setMax(NumbersUtil.parseInt(this._configDao.getValue("snapshot.max.weekly"), WEEKLYMAX)); Type.MONTHLY.setMax(NumbersUtil.parseInt(this._configDao.getValue("snapshot.max.monthly"), MONTHLYMAX)); this._totalRetries = NumbersUtil.parseInt(this._configDao.getValue("total.retries"), 4); this._pauseInterval = 2 * NumbersUtil.parseInt(this._configDao.getValue("ping.interval"), 60); s_logger.info("Snapshot Manager is configured."); return true; }
Example #8
Source File: SnapshotSchedulerImpl.java From cloudstack with Apache License 2.0 | 6 votes |
@Override public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException { _snapshotPollInterval = NumbersUtil.parseInt(_configDao.getValue("snapshot.poll.interval"), 300); final boolean snapshotsRecurringTest = Boolean.parseBoolean(_configDao.getValue("snapshot.recurring.test")); if (snapshotsRecurringTest) { // look for some test values in the configuration table so that snapshots can be taken more frequently (QA test code) final int minutesPerHour = NumbersUtil.parseInt(_configDao.getValue("snapshot.test.minutes.per.hour"), 60); final int hoursPerDay = NumbersUtil.parseInt(_configDao.getValue("snapshot.test.hours.per.day"), 24); final int daysPerWeek = NumbersUtil.parseInt(_configDao.getValue("snapshot.test.days.per.week"), 7); final int daysPerMonth = NumbersUtil.parseInt(_configDao.getValue("snapshot.test.days.per.month"), 30); final int weeksPerMonth = NumbersUtil.parseInt(_configDao.getValue("snapshot.test.weeks.per.month"), 4); final int monthsPerYear = NumbersUtil.parseInt(_configDao.getValue("snapshot.test.months.per.year"), 12); _testTimerTask = new TestClock(this, minutesPerHour, hoursPerDay, daysPerWeek, daysPerMonth, weeksPerMonth, monthsPerYear); } _currentTimestamp = new Date(); s_logger.info("Snapshot Scheduler is configured."); return true; }
Example #9
Source File: DataCenterVnetDaoImpl.java From cloudstack with Apache License 2.0 | 6 votes |
@Override public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { 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; }
Example #10
Source File: DataCenterDaoImpl.java From cosmic with Apache License 2.0 | 6 votes |
@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; }
Example #11
Source File: KafkaEventBus.java From cosmic with Apache License 2.0 | 6 votes |
@Override public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { final Properties props = new Properties(); try { final FileInputStream is = new FileInputStream(PropertiesUtil.findConfigFile("kafka.producer.properties")); props.load(is); is.close(); } catch (Exception e) { // Fallback to default properties props.setProperty("bootstrap.servers", "192.168.22.1:9092"); props.setProperty("acks", "all"); props.setProperty("retries", "1"); props.setProperty("topic", "cosmic"); props.setProperty("key.serializer", "org.apache.kafka.common.serialization.StringSerializer"); props.setProperty("value.serializer", "org.apache.kafka.common.serialization.StringSerializer"); } _producer = new KafkaProducer<String,String>(props); _name = name; return true; }
Example #12
Source File: ClusterServiceServletAdapter.java From cosmic with Apache License 2.0 | 6 votes |
@Override public String getServiceEndpointName(final String strPeer) { try { init(); } catch (final ConfigurationException e) { s_logger.error("Unable to init ClusterServiceServletAdapter"); return null; } final long msid = Long.parseLong(strPeer); final ManagementServerHostVO mshost = _mshostDao.findByMsid(msid); if (mshost == null) { return null; } return composeEndpointName(mshost.getServiceIP(), mshost.getServicePort()); }
Example #13
Source File: BrocadeVcsResourceTest.java From cloudstack with Apache License 2.0 | 6 votes |
@Test public void testPingCommandStatusFail() throws ConfigurationException, BrocadeVcsApiException { resource.configure("BrocadeVcsResource", parameters); final VcsNodeInfo nodeInfo = mock(VcsNodeInfo.class); when(nodeInfo.getNodeState()).thenReturn("Offline"); List<VcsNodeInfo> nodes = new ArrayList<VcsNodeInfo>(); nodes.add(nodeInfo); final VcsNodes vcsNodes = mock(VcsNodes.class); final Output output = mock(Output.class); when(output.getVcsNodes()).thenReturn(vcsNodes); when(vcsNodes.getVcsNodeInfo()).thenReturn(nodes); when(api.getSwitchStatus()).thenReturn(output); final PingCommand ping = resource.getCurrentStatus(42); assertTrue(ping == null); }
Example #14
Source File: DiscovererBase.java From cosmic with Apache License 2.0 | 6 votes |
@Override public ServerResource reloadResource(final HostVO host) { final String resourceName = host.getResource(); final ServerResource resource = getResource(resourceName); if (resource != null) { this._hostDao.loadDetails(host); updateNetworkLabels(host); final HashMap<String, Object> params = buildConfigParams(host); try { resource.configure(host.getName(), params); } catch (final ConfigurationException e) { s_logger.warn("Unable to configure resource due to " + e.getMessage()); return null; } if (!resource.start()) { s_logger.warn("Unable to start the resource"); return null; } } return resource; }
Example #15
Source File: Ovm3ConfigurationTest.java From cloudstack with Apache License 2.0 | 5 votes |
@Test public void testValidatePool() throws ConfigurationException { HashMap<String, Object> par = new HashMap<String,Object>(params); par.put("cluster", "1"); par.put("ovm3vip", "this is not an IP!"); ovm3config = new Ovm3Configuration(par); results.basicBooleanTest(ovm3config.getAgentInOvm3Pool(), false); results.basicBooleanTest(ovm3config.getAgentInOvm3Cluster(), false); results.basicStringTest(ovm3config.getOvm3PoolVip(), ""); }
Example #16
Source File: StartTlsRequest.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
private ConfigurationException wrapException(Exception e) { ConfigurationException ce = new ConfigurationException( "Cannot load implementation of javax.naming.ldap.StartTlsResponse"); ce.setRootCause(e); return ce; }
Example #17
Source File: AgentShell.java From cloudstack with Apache License 2.0 | 5 votes |
private void launchAgentFromTypeInfo() throws ConfigurationException { String typeInfo = getProperty(null, "type"); if (typeInfo == null) { s_logger.error("Unable to retrieve the type"); throw new ConfigurationException("Unable to retrieve the type of this agent."); } s_logger.trace("Launching agent based on type=" + typeInfo); }
Example #18
Source File: SecondaryStorageDiscoverer.java From cosmic with Apache License 2.0 | 5 votes |
protected Map<ServerResource, Map<String, String>> createDummySecondaryStorageResource(final long dcId, final Long podId, final URI uri) { final Map<ServerResource, Map<String, String>> srs = new HashMap<>(); DummySecondaryStorageResource storage = new DummySecondaryStorageResource(this._useServiceVM); storage = ComponentContext.inject(storage); final Map<String, String> details = new HashMap<>(); details.put("mount.path", uri.toString()); details.put("orig.url", uri.toString()); final Map<String, Object> params = new HashMap<>(); params.putAll(details); params.put("zone", Long.toString(dcId)); if (podId != null) { params.put("pod", podId.toString()); } params.put("guid", uri.toString()); try { storage.configure("Storage", params); } catch (final ConfigurationException e) { s_logger.warn("Unable to configure the storage ", e); return null; } srs.put(storage, details); return srs; }
Example #19
Source File: AsyncJobMonitor.java From cloudstack with Apache License 2.0 | 5 votes |
@Override public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { _messageBus.subscribe(AsyncJob.Topics.JOB_HEARTBEAT, MessageDispatcher.getDispatcher(this)); _timer.scheduleAtFixedRate(new ManagedContextTimerTask() { @Override protected void runInContext() { heartbeat(); } }, _inactivityCheckIntervalMs, _inactivityCheckIntervalMs); return true; }
Example #20
Source File: Ovm3HypervisorNetworkTest.java From cloudstack with Apache License 2.0 | 5 votes |
@Test public void CheckNetworkCommandPublicFailTest() throws ConfigurationException { hypervisor = support.prepare(configTest.getParams()); List<PhysicalNetworkSetupInfo> setups = new ArrayList<PhysicalNetworkSetupInfo>(); PhysicalNetworkSetupInfo networkInfo = new PhysicalNetworkSetupInfo(); networkInfo.setPublicNetworkName(network.getInterface() + "." + 3000); setups.add(networkInfo); CheckNetworkCommand cmd = new CheckNetworkCommand(setups); Answer ra = hypervisor.executeRequest(cmd); results.basicBooleanTest(ra.getResult(), false); }
Example #21
Source File: ManagementServerImpl.java From cosmic with Apache License 2.0 | 5 votes |
@Override public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException { _configs = _configDao.getConfiguration(); final String value = _configs.get("event.purge.interval"); final int cleanup = NumbersUtil.parseInt(value, 60 * 60 * 24); // 1 day. _purgeDelay = NumbersUtil.parseInt(_configs.get("event.purge.delay"), 0); if (_purgeDelay != 0) { _eventExecutor.scheduleAtFixedRate(new EventPurgeTask(), cleanup, cleanup, TimeUnit.SECONDS); } //Alerts purge configurations final int alertPurgeInterval = NumbersUtil.parseInt(_configDao.getValue(Config.AlertPurgeInterval.key()), 60 * 60 * 24); // 1 day. _alertPurgeDelay = NumbersUtil.parseInt(_configDao.getValue(Config.AlertPurgeDelay.key()), 0); if (_alertPurgeDelay != 0) { _alertExecutor.scheduleAtFixedRate(new AlertPurgeTask(), alertPurgeInterval, alertPurgeInterval, TimeUnit.SECONDS); } final String[] availableIds = TimeZone.getAvailableIDs(); _availableIdsMap = new HashMap<>(availableIds.length); for (final String id : availableIds) { _availableIdsMap.put(id, true); } supportedHypervisors.add(HypervisorType.KVM); supportedHypervisors.add(HypervisorType.XenServer); return true; }
Example #22
Source File: PersistorFactory.java From rdf2x with Apache License 2.0 | 5 votes |
public static Persistor createPersistor(OutputConfig config) { OutputConfig.OutputTarget target = config.getTarget(); switch (target) { case DB: try { String driverClassName = config.getDbConfig().getDriverClassName(); switch (driverClassName) { case "org.postgresql.Driver": return new DbPersistorPostgres(config.getDbConfig(), config.getSaveMode()); case "com.microsoft.sqlserver.jdbc.SQLServerDriver": return new DbPersistorSQLServer(config.getDbConfig(), config.getSaveMode()); } } catch (ConfigurationException ignored) { } return new DbPersistor(config.getDbConfig(), config.getSaveMode()); case CSV: return new CSVPersistor(config.getFileConfig(), config.getSaveMode()); case JSON: return new JSONPersistor(config.getFileConfig(), config.getSaveMode()); case ES: return new ElasticSearchPersistor(config.getEsConfig()); case Preview: return new PreviewPersistor(); case DataFrameMap: return new DataFrameMapPersistor(config.getResultMap()); default: throw new NotImplementedException("Output not supported: " + config); } }
Example #23
Source File: Main.java From rdf2x with Apache License 2.0 | 5 votes |
/** * Get job based on command-line arguments and run it. * * @param args command-line arguments * @throws ConfigurationException in case config is not valid */ public static void main(String args[]) throws ConfigurationException { Runnable job = JobFactory.getJob(args); if (job == null) { return; } job.run(); }
Example #24
Source File: StartTlsRequest.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
private ConfigurationException wrapException(Exception e) { ConfigurationException ce = new ConfigurationException( "Cannot load implementation of javax.naming.ldap.StartTlsResponse"); ce.setRootCause(e); return ce; }
Example #25
Source File: UploadOutputsTest.java From bazel-buildfarm with Apache License 2.0 | 5 votes |
@Before public void setUp() throws ConfigurationException { MockitoAnnotations.initMocks(this); fileSystem = Jimfs.newFileSystem(config); root = Iterables.getFirst(fileSystem.getRootDirectories(), null); resultBuilder = ActionResult.newBuilder(); }
Example #26
Source File: BigSwitchBcfResourceTest.java From cloudstack with Apache License 2.0 | 5 votes |
@Test public void testCreateRouterApiException() throws ConfigurationException, BigSwitchBcfApiException { _resource.configure("BigSwitchBcfResource", _parameters); doThrow(new BigSwitchBcfApiException()).when(_bigswitchBcfApi).createRouter((String)any(), (RouterData)any()); CreateBcfRouterCommand cmd = new CreateBcfRouterCommand("tenantid"); BcfAnswer ans = (BcfAnswer)_resource.executeRequest(cmd); assertFalse(ans.getResult()); verify(_bigswitchBcfApi, times(3)).createRouter((String)any(), (RouterData)any()); }
Example #27
Source File: TARProcessor.java From cosmic with Apache License 2.0 | 5 votes |
@Override public boolean configure(final String name, final Map<String, Object> params) throws ConfigurationException { this._storage = (StorageLayer) params.get(StorageLayer.InstanceConfigKey); if (this._storage == null) { throw new ConfigurationException("Unable to get storage implementation"); } return true; }
Example #28
Source File: UsageAlertManagerImpl.java From cloudstack with Apache License 2.0 | 5 votes |
@Override public boolean configure(String name, Map<String, Object> params) throws ConfigurationException { Map<String, String> configs = _configDao.getConfiguration("management-server", params); // set up the email system for alerts String emailAddressList = configs.get("alert.email.addresses"); String[] emailAddresses = null; if (emailAddressList != null) { emailAddresses = emailAddressList.split(","); } String smtpHost = configs.get("alert.smtp.host"); int smtpPort = NumbersUtil.parseInt(configs.get("alert.smtp.port"), 25); String useAuthStr = configs.get("alert.smtp.useAuth"); boolean useAuth = ((useAuthStr == null) ? false : Boolean.parseBoolean(useAuthStr)); String smtpUsername = configs.get("alert.smtp.username"); String smtpPassword = configs.get("alert.smtp.password"); String emailSender = configs.get("alert.email.sender"); String smtpDebugStr = configs.get("alert.smtp.debug"); boolean smtpDebug = false; if (smtpDebugStr != null) { smtpDebug = Boolean.parseBoolean(smtpDebugStr); } _emailAlert = new EmailAlert(emailAddresses, smtpHost, smtpPort, useAuth, smtpUsername, smtpPassword, emailSender, smtpDebug); return true; }
Example #29
Source File: Ovm3StorageProcessorTest.java From cloudstack with Apache License 2.0 | 5 votes |
private ConnectionTest prepare() throws ConfigurationException { Ovm3Configuration config = new Ovm3Configuration(configTest.getParams()); con = support.prepConnectionResults(); hypervisor.setConnection(con); results.basicBooleanTest(hypervisor.configure(config.getAgentName(), configTest.getParams())); return con; }
Example #30
Source File: Ovm3StorageProcessorTest.java From cloudstack with Apache License 2.0 | 5 votes |
/** * Copy template from secondary to primary template * * @throws ConfigurationException */ @Test public void copyCommandTemplateToTemplateTest() throws ConfigurationException { con = prepare(); con.setMethodResponse("storage_plugin_mount", results.simpleResponseWrapWrapper(storageplugin .getNfsFileSystemInfo())); /* * because the template requires a reference to the name for the uuid... * -sigh- */ String templateid = ovmObject.newUuid(); String targetid = ovmObject.newUuid(); String templatedir = "template/tmpl/1/11" + templateid + ".raw"; String storeUrl = "nfs://" + linux.getRemoteHost() + "/" + linux.getRemoteDir(); TemplateObjectTO src = template(templateid, linux.getRepoId(), storeUrl, templatedir); TemplateObjectTO dest = template(targetid, linux.getRepoId(), linux.getRepoId(), linux.getTemplatesDir()); CopyCommand copy = new CopyCommand(src, dest, 0, true); CopyCmdAnswer ra = (CopyCmdAnswer) hypervisor.executeRequest(copy); TemplateObjectTO vol = (TemplateObjectTO) ra.getNewData(); results.basicStringTest(vol.getUuid(), targetid); results.basicStringTest(vol.getPath(), targetid); results.basicBooleanTest(ra.getResult()); }