/** * Create a {@link SystemDatasetInstantiator} using the system classloader as the parent classloader. * * @return a {@link SystemDatasetInstantiator} using the system classloader as the parent classloader */ public SystemDatasetInstantiator create() { return create(null); }
public <T extends Dataset> T getDataset(DatasetId datasetId) throws DatasetInstantiationException { return getDataset(datasetId, DatasetDefinition.NO_ARGUMENTS); }
@Override public void close() throws IOException { datasetInstantiator.close(); context.close(); } }
@Override public DynamicDatasetCache get() { SystemDatasetInstantiator dsInstantiator = new SystemDatasetInstantiator(dsFramework); return new MultiThreadDatasetCache( dsInstantiator, txClient, NamespaceId.SYSTEM, ImmutableMap.of(), metricsCollectionService.getContext(ImmutableMap.of()), ImmutableMap.of() ); } }
private String generateEnableStatement(DatasetId datasetId, DatasetSpecification spec, boolean truncating) throws UnsupportedTypeException, ExploreException { try (SystemDatasetInstantiator datasetInstantiator = datasetInstantiatorFactory.create()) { Dataset dataset = datasetInstantiator.getDataset(datasetId); try { return generateEnableStatement(dataset, spec, datasetId, tableNaming.getTableName(datasetId, spec.getProperties()), truncating); } finally { Closeables.closeQuietly(dataset); } } catch (IOException e) { throw new ExploreException("Exception while trying to instantiate dataset " + datasetId, e); } }
private <T> T performDatasetAdmin(final DatasetId datasetInstanceId, Operation<T> operation) throws Exception { try (SystemDatasetInstantiator datasetInstantiator = datasetInstantiatorFactory.create()) { DatasetAdmin admin = impersonator.doAs(datasetInstanceId, (Callable<DatasetAdmin>) () -> { DatasetAdmin admin1 = datasetInstantiator.getDatasetAdmin(datasetInstanceId); if (admin1 == null) { throw new NotFoundException("Couldn't obtain DatasetAdmin for dataset instance " + datasetInstanceId); } // returns a DatasetAdmin that executes operations as a particular user, for a particular namespace return new ImpersonatingDatasetAdmin(admin1, impersonator, datasetInstanceId); }); try { return operation.perform(admin); } finally { Closeables.closeQuietly(admin); } } }
@Override public DynamicDatasetCache get() { SystemDatasetInstantiator dsInstantiator = new SystemDatasetInstantiator(dsFramework); return new MultiThreadDatasetCache( dsInstantiator, txClient, NamespaceId.SYSTEM, ImmutableMap.of(), metricsCollectionService.getContext(ImmutableMap.of()), ImmutableMap.of() ); } }
private String generateEnableStatement(DatasetId datasetId, DatasetSpecification spec, boolean truncating) throws UnsupportedTypeException, ExploreException { try (SystemDatasetInstantiator datasetInstantiator = datasetInstantiatorFactory.create()) { Dataset dataset = datasetInstantiator.getDataset(datasetId); try { return generateEnableStatement(dataset, spec, datasetId, tableNaming.getTableName(datasetId, spec.getProperties()), truncating); } finally { Closeables.closeQuietly(dataset); } } catch (IOException e) { throw new ExploreException("Exception while trying to instantiate dataset " + datasetId, e); } }
public <T extends Dataset> T getDataset(DatasetId datasetId, Map<String, String> arguments) throws DatasetInstantiationException { return getDataset(datasetId, arguments, AccessType.UNKNOWN); }
private <T> T performDatasetAdmin(final DatasetId datasetInstanceId, Operation<T> operation) throws Exception { try (SystemDatasetInstantiator datasetInstantiator = datasetInstantiatorFactory.create()) { DatasetAdmin admin = impersonator.doAs(datasetInstanceId, (Callable<DatasetAdmin>) () -> { DatasetAdmin admin1 = datasetInstantiator.getDatasetAdmin(datasetInstanceId); if (admin1 == null) { throw new NotFoundException("Couldn't obtain DatasetAdmin for dataset instance " + datasetInstanceId); } // returns a DatasetAdmin that executes operations as a particular user, for a particular namespace return new ImpersonatingDatasetAdmin(admin1, impersonator, datasetInstanceId); }); try { return operation.perform(admin); } finally { Closeables.closeQuietly(admin); } } }
/** * Create a {@link SystemDatasetInstantiator} using the system classloader as the parent classloader. * * @return a {@link SystemDatasetInstantiator} using the system classloader as the parent classloader */ public SystemDatasetInstantiator create() { return create(null); }
@Override public void close() throws IOException { datasetInstantiator.close(); context.close(); } }
/** * Create a {@link SystemDatasetInstantiator} that uses the given classloader as the parent when instantiating * datasets. * * @param parentClassLoader the parent classloader to use when instantiating datasets. If null, the system * classloader will be used * @return a {@link SystemDatasetInstantiator} using the given classloader as the parent classloader */ public SystemDatasetInstantiator create(@Nullable ClassLoader parentClassLoader) { return new SystemDatasetInstantiator(datasetFramework, parentClassLoader, new DirectoryClassLoaderProvider(cConf, locationFactory), null); }
public <T extends Dataset> T getDataset(DatasetId datasetId, Map<String, String> arguments) throws DatasetInstantiationException { return getDataset(datasetId, arguments, AccessType.UNKNOWN); }
/** * Create a {@link SystemDatasetInstantiator} that uses the given classloader as the parent when instantiating * datasets. * * @param parentClassLoader the parent classloader to use when instantiating datasets. If null, the system * classloader will be used * @return a {@link SystemDatasetInstantiator} using the given classloader as the parent classloader */ public SystemDatasetInstantiator create(@Nullable ClassLoader parentClassLoader) { return new SystemDatasetInstantiator(datasetFramework, parentClassLoader, new DirectoryClassLoaderProvider(cConf, locationFactory), null); }
public <T extends Dataset> T getDataset(DatasetId datasetId) throws DatasetInstantiationException { return getDataset(datasetId, DatasetDefinition.NO_ARGUMENTS); }
@Inject DefaultNamespaceStore(TransactionSystemClient txClient, DatasetFramework framework) { this.dsFramework = framework; this.transactional = Transactions.createTransactional( new MultiThreadDatasetCache(new SystemDatasetInstantiator(dsFramework), new TransactionSystemClientAdapter(txClient), NamespaceId.SYSTEM, null, null, null) ); }
public void initialize() throws IOException, DatasetManagementException, DatasetNotFoundException, ClassNotFoundException { dataset = datasetInstantiator.getDataset(datasetId); if (dataset instanceof TransactionAware) { ((TransactionAware) dataset).startTx(transaction); } }
@Inject DefaultNamespaceStore(TransactionSystemClient txClient, DatasetFramework framework) { this.dsFramework = framework; this.transactional = Transactions.createTransactional( new MultiThreadDatasetCache(new SystemDatasetInstantiator(dsFramework), new TransactionSystemClientAdapter(txClient), NamespaceId.SYSTEM, null, null, null) ); }
public void initialize() throws IOException, DatasetManagementException, DatasetNotFoundException, ClassNotFoundException { dataset = datasetInstantiator.getDataset(datasetId); if (dataset instanceof TransactionAware) { ((TransactionAware) dataset).startTx(transaction); } }