use of co.cask.cdap.data2.dataset2.DatasetDefinitionRegistryFactory in project cdap by caskdata.
the class AbstractDatasetFrameworkTest method setup.
@BeforeClass
public static void setup() throws Exception {
cConf = CConfiguration.create();
File dataDir = new File(TMP_FOLDER.newFolder(), "data");
cConf.set(Constants.CFG_LOCAL_DATA_DIR, dataDir.getAbsolutePath());
final Injector injector = Guice.createInjector(new ConfigModule(cConf), new NonCustomLocationUnitTestModule().getModule(), new TransactionInMemoryModule(), new NamespaceClientRuntimeModule().getInMemoryModules(), new AuditModule().getInMemoryModules(), new AbstractModule() {
@Override
protected void configure() {
bind(OwnerStore.class).to(InMemoryOwnerStore.class).in(Scopes.SINGLETON);
bind(OwnerAdmin.class).to(DefaultOwnerAdmin.class);
}
});
locationFactory = injector.getInstance(LocationFactory.class);
namespacedLocationFactory = injector.getInstance(NamespacedLocationFactory.class);
txExecutorFactory = injector.getInstance(TransactionExecutorFactory.class);
registryFactory = new DatasetDefinitionRegistryFactory() {
@Override
public DatasetDefinitionRegistry create() {
DefaultDatasetDefinitionRegistry registry = new DefaultDatasetDefinitionRegistry();
injector.injectMembers(registry);
return registry;
}
};
namespaceAdmin = injector.getInstance(NamespaceAdmin.class);
namespaceQueryAdmin = injector.getInstance(NamespaceQueryAdmin.class);
ownerAdmin = injector.getInstance(OwnerAdmin.class);
inMemoryAuditPublisher = injector.getInstance(InMemoryAuditPublisher.class);
namespaceAdmin.create(new NamespaceMeta.Builder().setName(NAMESPACE_ID).build());
}
use of co.cask.cdap.data2.dataset2.DatasetDefinitionRegistryFactory in project cdap by caskdata.
the class DataMigration method createRegisteredDatasetFramework.
/**
* Sets up a {@link DatasetFramework} instance for standalone usage. NOTE: should NOT be used by applications!!!
*/
public static DatasetFramework createRegisteredDatasetFramework(Injector injector) throws DatasetManagementException, IOException {
DatasetDefinitionRegistryFactory registryFactory = injector.getInstance(DatasetDefinitionRegistryFactory.class);
DatasetFramework datasetFramework = new InMemoryDatasetFramework(registryFactory);
// TODO: this doesn't sound right. find out why its needed.
datasetFramework.addModule(NamespaceId.SYSTEM.datasetModule("table"), new HBaseTableModule());
datasetFramework.addModule(NamespaceId.SYSTEM.datasetModule("metricsTable"), new HBaseMetricsTableModule());
datasetFramework.addModule(NamespaceId.SYSTEM.datasetModule("core"), new CoreDatasetsModule());
datasetFramework.addModule(NamespaceId.SYSTEM.datasetModule("fileSet"), new FileSetModule());
return datasetFramework;
}
Aggregations