/** * returns the actual NamespaceConfiguration that corresponds to the current parent namespace. */ public NamespaceConfiguration getNamespaceConfiguration() { return context.getServerConfFactory().getNamespaceConfiguration(parent.namespaceId); }
ServerConfigurationFactory loadConfFactory(VolumeChooserEnvironment env) { // This local variable is an intentional component of the single-check idiom. ServerConfigurationFactory localConf = lazyConfFactory; if (localConf == null) { // If we're under contention when first getting here we'll throw away some initializations. localConf = env.getServerContext().getServerConfFactory(); lazyConfFactory = localConf; } return localConf; }
TableConfWatcher(ServerContext context) { this.context = context; tablesPrefix = context.getZooKeeperRoot() + Constants.ZTABLES + "/"; scf = context.getServerConfFactory(); }
@Override public void propertyChanged(String key) { parseConfiguration(context.getServerConfFactory()); }
@Override public AccumuloConfiguration getConfiguration() { return getServerConfFactory().getSystemConfiguration(); }
@Override public void propertiesChanged() { parseConfiguration(context.getServerConfFactory()); }
ServerConfigurationFactory loadConfFactory(VolumeChooserEnvironment env) { // Get the current table's properties, and find the preferred volumes property // This local variable is an intentional component of the single-check idiom. ServerConfigurationFactory localConf = lazyConfFactory; if (localConf == null) { // If we're under contention when first getting here we'll throw away some initializations. localConf = env.getServerContext().getServerConfFactory(); lazyConfFactory = localConf; } return localConf; } }
@Override public void init(ServerContext context) { super.init(context); parseConfiguration(context.getServerConfFactory()); }
@Override public void run() { Set<String> contextProperties = context.getServerConfFactory().getSystemConfiguration() .getAllPropertiesWithPrefix(Property.VFS_CONTEXT_CLASSPATH_PROPERTY).keySet(); Set<String> configuredContexts = new HashSet<>(); for (String prop : contextProperties) { configuredContexts .add(prop.substring(Property.VFS_CONTEXT_CLASSPATH_PROPERTY.name().length())); } try { AccumuloVFSClassLoader.getContextManager().removeUnusedContexts(configuredContexts); } catch (IOException e) { log.warn("{}", e.getMessage(), e); } } };
ScanFileManager(KeyExtent tablet) { tabletReservedReaders = new ArrayList<>(); dataSources = new ArrayList<>(); this.tablet = tablet; continueOnFailure = context.getServerConfFactory().getTableConfiguration(tablet.getTableId()) .getBoolean(Property.TABLE_FAILURES_IGNORE); if (tablet.isMeta()) { continueOnFailure = false; } }
@Override protected long getWaitTime() { Map<String,String> customProps = context.getServerConfFactory().getTableConfiguration(tableId) .getAllPropertiesWithPrefix(Property.TABLE_ARBITRARY_PROP_PREFIX); if (customProps.containsKey(WAIT_TIME_PROPERTY)) { return ConfigurationTypeHelper.getTimeInMillis(customProps.get(WAIT_TIME_PROPERTY)); } return super.getWaitTime(); }
private TabletBalancer constructNewBalancerForTable(String clazzName, Table.ID tableId) throws Exception { String context = null; context = this.context.getServerConfFactory().getTableConfiguration(tableId) .get(Property.TABLE_CLASSPATH); Class<? extends TabletBalancer> clazz; if (context != null && !context.equals("")) clazz = AccumuloVFSClassLoader.getContextManager().loadClass(context, clazzName, TabletBalancer.class); else clazz = AccumuloVFSClassLoader.loadClass(clazzName, TabletBalancer.class); Constructor<? extends TabletBalancer> constructor = clazz.getConstructor(Table.ID.class); return constructor.newInstance(tableId); }
@Override public Map<String,String> getTableConfiguration(TInfo tinfo, TCredentials credentials, String tableName) throws TException, ThriftTableOperationException { Table.ID tableId = checkTableId(context, tableName, null); AccumuloConfiguration config = context.getServerConfFactory().getTableConfiguration(tableId); return conf(credentials, config); }
public static void main(String[] args) { try (ServerContext context = new ServerContext(new SiteConfiguration())) { context.getServerConfFactory().getSystemConfiguration(); } }
@Override public SaslServerConnectionParams getSaslParams() { AccumuloConfiguration conf = getServerConfFactory().getSiteConfiguration(); if (!conf.getBoolean(Property.INSTANCE_RPC_SASL_ENABLED)) { return null; } return new SaslServerConnectionParams(conf, getCredentials().getToken(), secretManager); }
@Override public Map<String,String> getConfiguration(TInfo tinfo, TCredentials credentials, ConfigurationType type) throws TException { ServerConfigurationFactory factory = context.getServerConfFactory(); switch (type) { case CURRENT: return conf(credentials, factory.getSystemConfiguration()); case SITE: return conf(credentials, factory.getSiteConfiguration()); case DEFAULT: return conf(credentials, factory.getDefaultConfiguration()); } throw new RuntimeException("Unexpected configuration type " + type); }
protected String getLoadBalancerClassNameForTable(Table.ID table) { TableState tableState = context.getTableManager().getTableState(table); if (tableState == null) return null; if (tableState.equals(TableState.ONLINE)) return this.context.getServerConfFactory().getTableConfiguration(table) .get(Property.TABLE_LOAD_BALANCER); return null; }
private ScanDispatcher getScanDispatcher(KeyExtent extent) { if (extent.isRootTablet() || extent.isMeta()) { // dispatcher is only for user tables return null; } return context.getServerConfFactory().getTableConfiguration(extent.getTableId()) .getScanDispatcher(); }
public void setupServer(String appName, String appClassName, String hostname) { applicationName = appName; applicationClassName = appClassName; this.hostname = hostname; SecurityUtil.serverLogin(info.getSiteConfiguration()); log.info("Version " + Constants.VERSION); log.info("Instance " + info.getInstanceID()); ServerUtil.init(this, applicationName); MetricsSystemHelper.configure(applicationClassName); DistributedTrace.enable(hostname, applicationName, getServerConfFactory().getSystemConfiguration()); if (getSaslParams() != null) { // Server-side "client" check to make sure we're logged in as a user we expect to be enforceKerberosLogin(); } }
@Override public TSummaries startGetSummariesForPartition(TInfo tinfo, TCredentials credentials, TSummaryRequest request, int modulus, int remainder) throws ThriftSecurityException, TException { // do not expect users to call this directly, expect other tservers to call this method if (!security.canPerformSystemActions(credentials)) { throw new AccumuloSecurityException(credentials.getPrincipal(), SecurityErrorCode.PERMISSION_DENIED).asThriftException(); } ServerConfigurationFactory factory = context.getServerConfFactory(); ExecutorService spe = resourceManager.getSummaryRemoteExecutor(); Future<SummaryCollection> future = new Gatherer(context, request, factory.getTableConfiguration(Table.ID.of(request.getTableId())), context.getCryptoService()).processPartition(spe, modulus, remainder); return startSummaryOperation(credentials, future); }