private Configuration createDefaultConfiguration() { BaseConfiguration baseConfiguration = new BaseConfiguration(); baseConfiguration.addProperty(LOG_STREAM, "false"); baseConfiguration.addProperty(LOG_FILE, "server.xml.log"); /* FIXME WHAT IT IS THE BETTER METHOD PASS STRING OR BOOL */ baseConfiguration.addProperty(KEEPALIVE, true); return baseConfiguration; }
@Parameterized.Parameters public static Collection<Object[]> configs() { List<Object[]> configurations = new ArrayList<Object[]>(); BaseConfiguration c = new BaseConfiguration(); c.addProperty(IDAUTHORITY_RETRY_COUNT_KEY, 50); c.addProperty(IDAUTHORITY_WAIT_MS_KEY, 100); configurations.add(new Object[]{c}); c = new BaseConfiguration(); c.addProperty(IDAUTHORITY_RETRY_COUNT_KEY, 50); c.addProperty(IDAUTHORITY_WAIT_MS_KEY, 100); c.addProperty(IDAUTHORITY_UNIQUE_ID_BITS_KEY,9); c.addProperty(IDAUTHORITY_UNIQUE_ID_KEY,511); configurations.add(new Object[]{c}); c = new BaseConfiguration(); c.addProperty(IDAUTHORITY_RETRY_COUNT_KEY, 10); c.addProperty(IDAUTHORITY_WAIT_MS_KEY, 100); c.addProperty(IDAUTHORITY_UNIQUE_ID_BITS_KEY,7); c.addProperty(IDAUTHORITY_RANDOMIZE_UNIQUE_ID_KEY,true); configurations.add(new Object[]{c}); return configurations; }
/** * Adds a new property to this configuration. This implementation checks if * the auto save mode is enabled and saves the configuration if necessary. * * @param key the key of the new property * @param value the value */ @Override public void addProperty(String key, Object value) { synchronized (reloadLock) { super.addProperty(key, value); possiblySave(); } }
/** * Adds a new property to this configuration. This implementation checks if * the auto save mode is enabled and saves the configuration if necessary. * * @param key the key of the new property * @param value the value */ @Override public void addProperty(String key, Object value) { synchronized (reloadLock) { super.addProperty(key, value); possiblySave(); } }
@Override public Configuration asCommonsConfiguration() { BaseConfiguration configuration = new BaseConfiguration(); for (Entry<String, Object> entry : this.asMap().entrySet()) { configuration.addProperty(entry.getKey(), entry.getValue()); } return configuration; }
public void clopen(Map<String, ? extends Object> settings) { super.close(); BaseConfiguration newConfig = new BaseConfiguration(); newConfig.copy(config); for (Map.Entry<String,? extends Object> entry : settings.entrySet()) newConfig.addProperty(entry.getKey(),entry.getValue()); graph = (StandardTitanGraph) TitanFactory.open(newConfig); tx = graph.newTransaction(); }
/** * Sets the properties relevant to this implementation to the given * configuration. * * @param configuration the configuration to add properties to. */ public static final void provideProperties( final BaseConfiguration configuration) { configuration.addProperty( ExceptionContextProperty.EXCEPTION_THROWABLE_HANDLE_MODE.getName(), ExceptionContextProperty.EXCEPTION_THROWABLE_HANDLE_MODE .getDefaultValue()); configuration.addProperty( ExceptionContextProperty.ID_FACTORY_CLASS.getName(), ExceptionContextProperty.ID_FACTORY_CLASS.getDefaultValue()); configuration.addProperty( ExceptionContextProperty.CODE_MESSAGE_FORMATTER_CLASS.getName(), ExceptionContextProperty.CODE_MESSAGE_FORMATTER_CLASS.getDefaultValue()); }
private static Configuration createConfiguration() { BaseConfiguration config = new BaseConfiguration(); config.addProperty("foo", "foobar"); return config; }
BaseConfiguration config = new BaseConfiguration(); config.setListDelimiter('/'); config.addProperty(fullPropertyKey(ArangoDBGraph.PROPERTY_KEY_DB_NAME), dbName); config.addProperty(fullPropertyKey(ArangoDBGraph.PROPERTY_KEY_GRAPH_NAME), graphName); config.addProperty(fullPropertyKey(ArangoDBGraph.PROPERTY_KEY_VERTICES), vertices); config.addProperty(fullPropertyKey(ArangoDBGraph.PROPERTY_KEY_EDGES), edges); List<String> rels = new ArrayList<>(); for (Triple<String, Set<String>, Set<String>> r : relations) { config.addProperty(fullPropertyKey(ArangoDBGraph.PROPERTY_KEY_RELATIONS), rels.stream().collect(Collectors.joining("/"))); config.addProperty(fullPropertyKey(PROPERTY_KEY_USER), user); config.addProperty(fullPropertyKey(PROPERTY_KEY_PASSWORD), password); if (hostList) { config.addProperty(fullPropertyKey(PROPERTY_KEY_ACQUIRE_HOST_LIST), Boolean.toString(hostList)); config.addProperty(fullPropertyKey(PROPERTY_KEY_USE_SSL), Boolean.toString(useSsl)); config.addProperty(fullPropertyKey(PROPERTY_KEY_MAX_CONNECTIONS), connections); config.addProperty(fullPropertyKey(PROPERTY_KEY_TIMEOUT), timeout); config.addProperty(fullPropertyKey(PROPERTY_KEY_V_STREAM_CHUNK_CONTENT_SIZE), velocyStreamChunk); config.addProperty(fullPropertyKey(PROPERTY_KEY_CONNECTION_TTL), connectionTtl); config.addProperty(fullPropertyKey(PROPERTY_KEY_PROTOCOL), protocol.name()); config.addProperty(fullPropertyKey(PROPERTY_KEY_LOAD_BALANCING_STRATEGY), strategy.name());
@Override public void actionPerformed(ActionEvent e) { showLoadingPanel(); final int rowCount = tableModel.getRowCount(); final List<Optional<LogImporter>> logImporters = tableModel.getData() .stream() .map(l -> l.getPossibleLogImporters().getLogImporter()) .collect(toList()); final LogViewPanelWrapper logViewPanelWrapper = new LogViewPanelWrapper( "Multiple log files " + rowCount, null, mergeColumns(logImporters), otrosApplication); final LogLoader logLoader = otrosApplication.getLogLoader(); logViewPanelWrapper.goToLiveMode(); BaseConfiguration configuration = new BaseConfiguration(); configuration.addProperty(ConfKeys.TAILING_PANEL_PLAY, true); configuration.addProperty(ConfKeys.TAILING_PANEL_FOLLOW, true); final SwingWorker<List<LoadingBean>, Progress> swingWorker = new ImportSwingWorker(logViewPanelWrapper, logLoader, otrosApplication); swingWorker.execute(); } };
configuration.addProperty(ConfKeys.TAILING_PANEL_PLAY, true); configuration.addProperty(ConfKeys.TAILING_PANEL_FOLLOW, true); LogDataCollector logDataCollector = logViewPanelWrapper.getDataTableModel();
configuration.addProperty(ConfKeys.TAILING_PANEL_PLAY, true); configuration.addProperty(ConfKeys.TAILING_PANEL_FOLLOW, true); BufferingLogDataCollectorProxy logDataCollector = new BufferingLogDataCollectorProxy(logViewPanelWrapper.getDataTableModel(), 4000, configuration);
configuration.addProperty(ConfKeys.TAILING_PANEL_PLAY, true); configuration.addProperty(ConfKeys.TAILING_PANEL_FOLLOW, true); logViewPanelWrapper = new LogViewPanelWrapper(tabName, null, visibleColumns, pluginContext.getOtrosApplication()); BufferingLogDataCollectorProxy logDataCollector = new BufferingLogDataCollectorProxy(logViewPanelWrapper.getDataTableModel(), 4000, configuration);
public void open() throws StorageException { manager = new KeyColumnValueStoreManager[CONCURRENCY]; idAuthorities = new IDAuthority[CONCURRENCY]; for (int i = 0; i < CONCURRENCY; i++) { manager[i] = openStorageManager(i); StoreFeatures storeFeatures = manager[i].getFeatures(); BaseConfiguration sc = new BaseConfiguration(); sc.copy(baseStoreConfiguration); sc.addProperty(GraphDatabaseConfiguration.INSTANCE_RID_SHORT_KEY, (short) i); KeyColumnValueStore idStore = manager[i].openDatabase("ids"); if (storeFeatures.supportsTransactions()) idAuthorities[i] = new TransactionalIDManager(idStore, manager[i], sc); else if (storeFeatures.supportsConsistentKeyOperations()) idAuthorities[i] = new ConsistentKeyIDManager(idStore, manager[i], sc); else throw new IllegalArgumentException("Cannot open id store"); } }
@Override protected void actionPerformedHook(ActionEvent arg0) { LogImporterAndPort chooseLogImporter = chooseLogImporter(); if (chooseLogImporter == null) { return; } StatusObserver observer = getOtrosApplication().getStatusObserver(); if (logViewPanelWrapper == null) { logViewPanelWrapper = new LogViewPanelWrapper("Socket", null, TableColumns.values(), getOtrosApplication()); logViewPanelWrapper.goToLiveMode(); BaseConfiguration configuration = new BaseConfiguration(); configuration.addProperty(ConfKeys.TAILING_PANEL_PLAY, true); configuration.addProperty(ConfKeys.TAILING_PANEL_FOLLOW, true); logDataCollector = new BufferingLogDataCollectorProxy(logViewPanelWrapper.getDataTableModel(), 4000, configuration); } getOtrosApplication().addClosableTab("Socket listener", "Socket listener", Icons.PLUGIN_CONNECT, logViewPanelWrapper, true); //TODO solve this warning SocketLogReader logReader = null; if (logReader == null || logReader.isClosed()) { logReader = new SocketLogReader(chooseLogImporter.logImporter, logDataCollector, observer, getOtrosApplication().getLogLoader(), chooseLogImporter.port); try { logReader.start(); logReaders.add(logReader); observer.updateStatus(String.format("Socket opened on port %d with %s.", chooseLogImporter.port, chooseLogImporter.logImporter)); } catch (Exception e) { LOGGER.error("Failed to open Socket listener", e); observer.updateStatus("Failed to open listener " + e.getMessage(), StatusObserver.LEVEL_ERROR); } } }
/** * Asserts that when a property is requested from the configruation, and it fires an error event (ex. Database is not available), the previously stored * values are not cleared. */ @Test public void testAssertGetPropertyErrorReturnPreviousValue() throws Exception { // Get a reloadable property source that loads properties from the configuration every time a property is read. BaseConfiguration configuration = new BaseConfiguration() { @Override public Object getProperty(String key) { fireError(EVENT_READ_PROPERTY, key, null, new IllegalStateException("test exception")); return null; } }; configuration.addProperty(TEST_KEY, TEST_VALUE_1); ReloadablePropertySource reloadablePropertySource = getNewReloadablePropertiesSource(0L, configuration); verifyPropertySourceValue(reloadablePropertySource, TEST_VALUE_1); }
private MailetConfigImpl spamAssassinMailetConfig() { BaseConfiguration baseConfiguration = new BaseConfiguration(); Host host = Host.from(spamAssassinExtension.getSpamAssassin().getIp(), spamAssassinExtension.getSpamAssassin().getBindingPort()); baseConfiguration.addProperty(org.apache.james.transport.mailets.SpamAssassin.SPAMD_HOST, host.getHostName()); baseConfiguration.addProperty(org.apache.james.transport.mailets.SpamAssassin.SPAMD_PORT, host.getPort()); MailetConfigImpl mailetConfig = new MailetConfigImpl(); mailetConfig.setConfiguration(baseConfiguration); return mailetConfig; }