public synchronized DefaultConfiguration getDefaultConfiguration() { if (defaultConfig == null) { defaultConfig = DefaultConfiguration.getInstance(); } return defaultConfig; }
private static void exportConfig(ServerContext context, Table.ID tableID, ZipOutputStream zipOut, DataOutputStream dataOut) throws AccumuloException, AccumuloSecurityException, IOException { DefaultConfiguration defaultConfig = DefaultConfiguration.getInstance(); Map<String,String> siteConfig = context.instanceOperations().getSiteConfiguration(); Map<String,String> systemConfig = context.instanceOperations().getSystemConfiguration(); TableConfiguration tableConfig = context.getServerConfFactory().getTableConfiguration(tableID); OutputStreamWriter osw = new OutputStreamWriter(dataOut, UTF_8); // only put props that are different than defaults and higher level configurations zipOut.putNextEntry(new ZipEntry(Constants.EXPORT_TABLE_CONFIG_FILE)); for (Entry<String,String> prop : tableConfig) { if (prop.getKey().startsWith(Property.TABLE_PREFIX.getKey())) { Property key = Property.getPropertyByKey(prop.getKey()); if (key == null || !defaultConfig.get(key).equals(prop.getValue())) { if (!prop.getValue().equals(siteConfig.get(prop.getKey())) && !prop.getValue().equals(systemConfig.get(prop.getKey()))) { osw.append(prop.getKey() + "=" + prop.getValue() + "\n"); } } } } osw.flush(); } }
/** * Gets a default configuration. * * @return default configuration */ public static DefaultConfiguration getInstance() { return new DefaultConfiguration(); }
public Writer(BCFile.Writer bfw, int blockSize) throws IOException { this(bfw, blockSize, (int) DefaultConfiguration.getInstance() .getAsBytes(Property.TABLE_FILE_COMPRESSED_BLOCK_SIZE_INDEX), null, null); }
@Override public void run() { DefaultConfiguration defaultConf = DefaultConfiguration.getInstance(); long defaultDelay = defaultConf.getTimeInMillis(Property.REPLICATION_WORK_PROCESSOR_DELAY); long defaultPeriod = defaultConf.getTimeInMillis(Property.REPLICATION_WORK_PROCESSOR_PERIOD); long delay = conf.getTimeInMillis(Property.REPLICATION_WORK_PROCESSOR_DELAY); long period = conf.getTimeInMillis(Property.REPLICATION_WORK_PROCESSOR_PERIOD); try { DistributedWorkQueue workQueue; if (defaultDelay != delay && defaultPeriod != period) { log.debug("Configuration DistributedWorkQueue with delay and period of {} and {}", delay, period); workQueue = new DistributedWorkQueue( context.getZooKeeperRoot() + ReplicationConstants.ZOO_WORK_QUEUE, conf, delay, period); } else { log.debug("Configuring DistributedWorkQueue with default delay and period"); workQueue = new DistributedWorkQueue( context.getZooKeeperRoot() + ReplicationConstants.ZOO_WORK_QUEUE, conf); } workQueue.startProcessing(new ReplicationProcessor(context, conf, fs), executor); } catch (KeeperException | InterruptedException e) { throw new RuntimeException(e); } } }
private String getDefaultConfigValue(String key) { if (key == null) return null; String defaultValue = null; try { Property p = Property.getPropertyByKey(key); if (p == null) return defaultValue; defaultValue = defaultConfig.get(p); } catch (IllegalArgumentException e) { // ignore } return defaultValue; }
public static org.apache.accumulo.server.fs.VolumeManager getLocal(String localBasePath) throws IOException { AccumuloConfiguration accConf = DefaultConfiguration.getDefaultConfiguration(); Volume defaultLocalVolume = VolumeConfiguration .create(FileSystem.getLocal(CachedConfiguration.getInstance()), localBasePath); // The default volume gets placed in the map, but local filesystem is only used for testing // purposes return new VolumeManagerImpl(Collections.singletonMap(DEFAULT, defaultLocalVolume), defaultLocalVolume, accConf); }
@Override public void run() { DefaultConfiguration defaultConf = DefaultConfiguration.getDefaultConfiguration(); long defaultDelay = defaultConf.getTimeInMillis(Property.REPLICATION_WORK_PROCESSOR_DELAY); long defaultPeriod = defaultConf.getTimeInMillis(Property.REPLICATION_WORK_PROCESSOR_PERIOD); long delay = conf.getTimeInMillis(Property.REPLICATION_WORK_PROCESSOR_DELAY); long period = conf.getTimeInMillis(Property.REPLICATION_WORK_PROCESSOR_PERIOD); try { DistributedWorkQueue workQueue; if (defaultDelay != delay && defaultPeriod != period) { log.debug("Configuration DistributedWorkQueue with delay and period of {} and {}", delay, period); workQueue = new DistributedWorkQueue( ZooUtil.getRoot(inst) + ReplicationConstants.ZOO_WORK_QUEUE, conf, delay, period); } else { log.debug("Configuring DistributedWorkQueue with default delay and period"); workQueue = new DistributedWorkQueue( ZooUtil.getRoot(inst) + ReplicationConstants.ZOO_WORK_QUEUE, conf); } workQueue.startProcessing(new ReplicationProcessor(context, conf, fs), executor); } catch (KeeperException | InterruptedException e) { throw new RuntimeException(e); } } }
/* JOOQ Configuration */ @Bean public DataSourceConnectionProvider dataSourceConnectionProvider() { return new DataSourceConnectionProvider(dataSource()); } @Bean public DefaultConfiguration defaultConfiguration() { DefaultConfiguration defaultConfiguration = new DefaultConfiguration(); defaultConfiguration.setConnectionProvider(dataSourceConnectionProvider()); defaultConfiguration.setSQLDialect(SQLDialect.POSTGRES); return defaultConfiguration; } @Bean public DSLContext dslContext() { return new DefaultDSLContext(defaultConfiguration()); }
DefaultConfiguration cfg = new DefaultConfiguration("barcode"); DefaultConfiguration child = new DefaultConfiguration(type); cfg.addChild(child); DefaultConfiguration attr = new DefaultConfiguration("human-readable"); DefaultConfiguration subAttr = new DefaultConfiguration("placement"); subAttr.setValue("bottom"); attr.addChild(subAttr); child.addChild(attr); return cfg;
new Credentials(getAdminPrincipal(), getAdminToken()), clientConf); long rpcTimeout = DefaultConfiguration .getTimeInMillis(Property.GENERAL_RPC_TIMEOUT.getDefaultValue());
private String getDefaultConfigValue(String key) { if (null == key) return null; String defaultValue = null; try { Property p = Property.getPropertyByKey(key); if (null == p) return defaultValue; defaultValue = defaultConfig.get(p); } catch (IllegalArgumentException e) { // ignore } return defaultValue; }
for (Entry<String,String> entry : DefaultConfiguration.getDefaultConfiguration()) accumuloConf.setIfUnset(entry.getKey(), entry.getValue());
final org.apache.accumulo.core.client.ClientConfiguration config) { final AccumuloConfiguration defaults = DefaultConfiguration.getInstance();
@Override public String get(Property property) { String value = xml.get(property.getKey()); if (value != null) return value; return DefaultConfiguration.getInstance().get(property); } };
private static void exportConfig(Connector conn, String tableID, ZipOutputStream zipOut, DataOutputStream dataOut) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, IOException { DefaultConfiguration defaultConfig = AccumuloConfiguration.getDefaultConfiguration(); Map<String,String> siteConfig = conn.instanceOperations().getSiteConfiguration(); Map<String,String> systemConfig = conn.instanceOperations().getSystemConfiguration(); TableConfiguration tableConfig = ServerConfiguration.getTableConfiguration(conn.getInstance(), tableID); OutputStreamWriter osw = new OutputStreamWriter(dataOut, UTF_8); // only put props that are different than defaults and higher level configurations zipOut.putNextEntry(new ZipEntry(Constants.EXPORT_TABLE_CONFIG_FILE)); for (Entry<String,String> prop : tableConfig) { if (prop.getKey().startsWith(Property.TABLE_PREFIX.getKey())) { Property key = Property.getPropertyByKey(prop.getKey()); if (key == null || !defaultConfig.get(key).equals(prop.getValue())) { if (!prop.getValue().equals(siteConfig.get(prop.getKey())) && !prop.getValue().equals(systemConfig.get(prop.getKey()))) { osw.append(prop.getKey() + "=" + prop.getValue() + "\n"); } } } } osw.flush(); } }
public static void main(String[] args) throws Exception { Configuration conf = CachedConfiguration.getInstance(); Opts opts = new Opts(); opts.parseArgs(CreateEmpty.class.getName(), args); for (String arg : opts.files) { Path path = new Path(arg); log.info("Writing to file '" + path + "'"); FileSKVWriter writer = (new RFileOperations()).newWriterBuilder() .forFile(arg, path.getFileSystem(conf), conf) .withTableConfiguration(DefaultConfiguration.getDefaultConfiguration()) .withCompression(opts.codec).build(); writer.close(); } }
/** * Gets a default configuration. * * @return default configuration */ public static DefaultConfiguration getInstance() { return new DefaultConfiguration(); }
public static CryptoService newDefaultInstance() { return newInstance(DefaultConfiguration.getInstance(), ClassloaderType.JAVA); } }
@Override public String get(Property property) { String value = xml.get(property.getKey()); if (value != null) return value; return DefaultConfiguration.getInstance().get(property); }