DatasetModulesDeployer(DatasetFramework datasetFramework, DatasetFramework inMemoryDatasetFramework, CConfiguration cConf) { this.datasetFramework = datasetFramework; this.systemDatasetFramework = inMemoryDatasetFramework; this.allowDatasetUncheckedUpgrade = cConf.getBoolean(Constants.Dataset.DATASET_UNCHECKED_UPGRADE); }
/** * Checks if authorization is enabled */ public static boolean isSecurityAuthorizationEnabled(CConfiguration cConf) { return cConf.getBoolean(Constants.Security.ENABLED) && cConf.getBoolean(Constants.Security.Authorization.ENABLED); }
@Override public AuditPublisher get() { if (cConf.getBoolean(Constants.Audit.ENABLED, false)) { return injector.getInstance(DefaultAuditPublisher.class); } return injector.getInstance(NoOpAuditPublisher.class); } }
@Inject @VisibleForTesting public AuthorizerInstantiator(CConfiguration cConf, AuthorizationContextFactory authorizationContextFactory) { this.cConf = cConf; this.authenticationEnabled = cConf.getBoolean(Constants.Security.ENABLED); this.authorizationEnabled = cConf.getBoolean(Constants.Security.Authorization.ENABLED); this.instantiatorFactory = new InstantiatorFactory(false); this.authorizationContextFactory = authorizationContextFactory; }
/** * Check that if Explore is enabled, the correct jars are present on master node, * and that the distribution of Hive is supported. */ private void checkExploreRequirements() { if (cConf.getBoolean(Constants.Explore.EXPLORE_ENABLED)) { // This check will throw an exception if Hive is not present or if it's distribution is unsupported ExploreServiceUtils.checkHiveSupport(cConf); } }
private void checkPruningAndReplication(Set<String> problemKeys) { String hbaseDDLExtensionDir = cConf.get(Constants.HBaseDDLExecutor.EXTENSIONS_DIR); boolean pruningEnabled = cConf.getBoolean(TxConstants.TransactionPruning.PRUNE_ENABLE); if (hbaseDDLExtensionDir != null && pruningEnabled) { LOG.error(" Invalid transaction list cannot be automatically pruned when replication is in use. " + "Please disable pruning by setting {} to false, or remove your custom HBase DDL executor from {}.", TxConstants.TransactionPruning.PRUNE_ENABLE, Constants.HBaseDDLExecutor.EXTENSIONS_DIR); problemKeys.add(Constants.HBaseDDLExecutor.EXTENSIONS_DIR); problemKeys.add(TxConstants.TransactionPruning.PRUNE_ENABLE); } }
@Inject TokenSecureStoreRenewer(YarnConfiguration yarnConf, CConfiguration cConf, LocationFactory locationFactory, SecureStore secureStore) { this.yarnConf = yarnConf; this.cConf = cConf; this.locationFactory = locationFactory; this.secureStore = secureStore; this.secureExplore = cConf.getBoolean(Constants.Explore.EXPLORE_ENABLED) && UserGroupInformation.isSecurityEnabled(); }
@Inject public ExploreFacade(ExploreClient exploreClient, CConfiguration cConf) { this.exploreClient = exploreClient; this.exploreEnabled = cConf.getBoolean(Constants.Explore.EXPLORE_ENABLED); if (!exploreEnabled) { LOG.warn("Explore functionality for datasets is disabled. All calls to enable explore will be no-ops"); } this.httpTimeout = cConf.getInt(Constants.Explore.HTTP_TIMEOUT); }
@Inject public ExploreFacade(ExploreClient exploreClient, CConfiguration cConf) { this.exploreClient = exploreClient; this.exploreEnabled = cConf.getBoolean(Constants.Explore.EXPLORE_ENABLED); if (!exploreEnabled) { LOG.warn("Explore functionality for datasets is disabled. All calls to enable explore will be no-ops"); } this.httpTimeout = cConf.getInt(Constants.Explore.HTTP_TIMEOUT); }
private boolean writesEnabled() { try { CConfiguration cConf = ConfigurationUtil.get(getConf(), Constants.Explore.CCONF_KEY, CConfCodec.INSTANCE); return cConf.getBoolean(Constants.Explore.WRITES_ENABLED); } catch (IOException e) { LOG.error("Unable to get CDAP Configuration to check if writes are enabled.", e); throw Throwables.propagate(e); } } }
/** * Returns a JDBC connection that allows the running of SQL queries over data sets. * * @param namespace namespace for the connection * @return Connection to use to run queries */ protected final Connection getQueryClient(NamespaceId namespace) throws Exception { if (!cConf.getBoolean(Constants.Explore.EXPLORE_ENABLED)) { throw new UnsupportedOperationException("Explore service is disabled. QueryClient not supported."); } return getTestManager().getQueryClient(namespace); }
private MetricsCollectionService getMetricsService(CConfiguration cConf, MetricsCollectionService metricsService, Map<String, String> runtimeArgs) { boolean emitMetrics = SystemArguments.isProgramMetricsEnabled(runtimeArgs, cConf.getBoolean(Constants.Metrics.PROGRAM_METRICS_ENABLED)); return emitMetrics ? metricsService : new NoOpMetricsCollectionService(); }
/** * Calculates the secure token update interval based on the given configurations. * * @param cConf the CDAP configuration * @param hConf the YARN configuration * @return time in millisecond that the secure token should be updated */ public static long calculateUpdateInterval(CConfiguration cConf, Configuration hConf) { boolean secureExplore = cConf.getBoolean(Constants.Explore.EXPLORE_ENABLED) && UserGroupInformation.isSecurityEnabled(); return calculateUpdateInterval(hConf, secureExplore); }
private static int getPort(CConfiguration cConf) { return cConf.getBoolean(Constants.Security.SSL.EXTERNAL_ENABLED) ? cConf.getInt(Constants.Security.AuthenticationServer.SSL_PORT) : cConf.getInt(Constants.Security.AUTH_SERVER_BIND_PORT); } }
private MetricsCollectionService getMetricsService(CConfiguration cConf, MetricsCollectionService metricsService, Map<String, String> runtimeArgs) { boolean emitMetrics = SystemArguments.isProgramMetricsEnabled(runtimeArgs, cConf.getBoolean(Constants.Metrics.PROGRAM_METRICS_ENABLED)); return emitMetrics ? metricsService : new NoOpMetricsCollectionService(); }
DatasetServiceClient(final DiscoveryServiceClient discoveryClient, NamespaceId namespaceId, CConfiguration cConf, AuthenticationContext authenticationContext) { this.remoteClient = new RemoteClient( discoveryClient, Constants.Service.DATASET_MANAGER, new DefaultHttpRequestConfig(false), String.format("%s/namespaces/%s/data", Constants.Gateway.API_VERSION_3, namespaceId.getNamespace())); this.namespaceId = namespaceId; this.securityEnabled = cConf.getBoolean(Constants.Security.ENABLED); this.kerberosEnabled = SecurityUtil.isKerberosEnabled(cConf); this.authorizationEnabled = cConf.getBoolean(Constants.Security.Authorization.ENABLED); this.authenticationContext = authenticationContext; this.masterShortUserName = AuthorizationUtil.getEffectiveMasterUser(cConf); }
DatasetServiceClient(final DiscoveryServiceClient discoveryClient, NamespaceId namespaceId, CConfiguration cConf, AuthenticationContext authenticationContext) { this.remoteClient = new RemoteClient( discoveryClient, Constants.Service.DATASET_MANAGER, new DefaultHttpRequestConfig(false), String.format("%s/namespaces/%s/data", Constants.Gateway.API_VERSION_3, namespaceId.getNamespace())); this.namespaceId = namespaceId; this.securityEnabled = cConf.getBoolean(Constants.Security.ENABLED); this.kerberosEnabled = SecurityUtil.isKerberosEnabled(cConf); this.authorizationEnabled = cConf.getBoolean(Constants.Security.Authorization.ENABLED); this.authenticationContext = authenticationContext; this.masterShortUserName = AuthorizationUtil.getEffectiveMasterUser(cConf); }
/** * For guice injecting configuration object to this singleton. */ @Inject public void setConfiguration(CConfiguration config) { basePath = config.get(Constants.CFG_DATA_LEVELDB_DIR); Preconditions.checkNotNull(basePath, "No base directory configured for LevelDB."); blockSize = config.getInt(Constants.CFG_DATA_LEVELDB_BLOCKSIZE, Constants.DEFAULT_DATA_LEVELDB_BLOCKSIZE); cacheSize = config.getLong(Constants.CFG_DATA_LEVELDB_CACHESIZE, Constants.DEFAULT_DATA_LEVELDB_CACHESIZE); writeOptions = new WriteOptions().sync( config.getBoolean(Constants.CFG_DATA_LEVELDB_FSYNC, Constants.DEFAULT_DATA_LEVELDB_FSYNC)); }
public AuthenticationHandler(CConfiguration cConf, TokenValidator tokenValidator, DiscoveryServiceClient discoveryServiceClient, AccessTokenTransformer tokenTransformer) { this.cConf = cConf; this.realm = cConf.get(Constants.Security.CFG_REALM); this.tokenValidator = tokenValidator; this.bypassPattern = createBypassPattern(cConf); this.auditLogEnabled = cConf.getBoolean(Constants.Router.ROUTER_AUDIT_LOG_ENABLED); this.authServerURLs = getConfiguredAuthServerURLs(cConf); this.discoveryServiceClient = discoveryServiceClient; this.tokenTransformer = tokenTransformer; }
@Inject RemotePluginFinder(CConfiguration cConf, DiscoveryServiceClient discoveryServiceClient, AuthenticationContext authenticationContext, LocationFactory locationFactory) { this.remoteClient = new RemoteClient(discoveryServiceClient, Constants.Service.APP_FABRIC_HTTP, new DefaultHttpRequestConfig(false), String.format("%s", Constants.Gateway.API_VERSION_3)); this.authorizationEnabled = cConf.getBoolean(Constants.Security.Authorization.ENABLED); this.authenticationContext = authenticationContext; this.locationFactory = locationFactory; this.retryStrategy = RetryStrategies.limit(30, RetryStrategies.fixDelay(2, TimeUnit.SECONDS)); }