public class InMemoryDatasetFramework extends Object implements DatasetFramework
DatasetFramework that keeps its state in
memory| Constructor and Description |
|---|
InMemoryDatasetFramework(DatasetDefinitionRegistryFactory registryFactory,
CConfiguration configuration) |
InMemoryDatasetFramework(DatasetDefinitionRegistryFactory registryFactory,
Map<String,co.cask.cdap.api.dataset.module.DatasetModule> defaultModules,
CConfiguration configuration) |
| Modifier and Type | Method and Description |
|---|---|
void |
addInstance(String datasetType,
Id.DatasetInstance datasetInstanceId,
co.cask.cdap.api.dataset.DatasetProperties props)
Adds information about dataset instance to the system.
|
void |
addModule(Id.DatasetModule moduleId,
co.cask.cdap.api.dataset.module.DatasetModule module)
Adds dataset types by adding dataset module to the system.
|
void |
addModule(Id.DatasetModule moduleId,
co.cask.cdap.api.dataset.module.DatasetModule module,
Location jarLocation)
Adds dataset types by adding dataset module to the system with a jar location containing all dataset classes
needed by the module.
|
void |
createNamespace(Id.Namespace namespaceId)
Creates a namespace in the Storage Providers - HBase/LevelDB, Hive and HDFS/Local File System.
|
protected co.cask.cdap.api.dataset.module.DatasetDefinitionRegistry |
createRegistry(LinkedHashSet<String> availableModuleClasses,
ClassLoader classLoader) |
void |
deleteAllInstances(Id.Namespace namespaceId)
Deletes all dataset instances in the specified namespace.
|
void |
deleteAllModules(Id.Namespace namespaceId)
Deletes dataset modules and its types in the specified namespace.
|
void |
deleteInstance(Id.DatasetInstance datasetInstanceId)
Deletes dataset instance from the system.
|
void |
deleteModule(Id.DatasetModule moduleId)
Deletes dataset module and its types from the system.
|
void |
deleteNamespace(Id.Namespace namespaceId)
Deletes a namespace in the Storage Providers - HBase/LevelDB, Hive and HDFS/Local File System.
|
<T extends co.cask.cdap.api.dataset.DatasetAdmin> |
getAdmin(Id.DatasetInstance datasetInstanceId,
ClassLoader classLoader)
Gets dataset instance admin to be used to perform administrative operations.
|
<T extends co.cask.cdap.api.dataset.DatasetAdmin> |
getAdmin(Id.DatasetInstance datasetInstanceId,
ClassLoader classLoader,
DatasetClassLoaderProvider classLoaderProvider)
Gets dataset instance admin to be used to perform administrative operations.
|
protected LinkedHashSet<String> |
getAvailableModuleClasses(Id.Namespace namespace) |
<T extends co.cask.cdap.api.dataset.Dataset> |
getDataset(Id.DatasetInstance datasetInstanceId,
Map<String,String> arguments,
ClassLoader classLoader)
Gets dataset to be used to perform data operations.
|
<T extends co.cask.cdap.api.dataset.Dataset> |
getDataset(Id.DatasetInstance datasetInstanceId,
Map<String,String> arguments,
ClassLoader parentClassLoader,
DatasetClassLoaderProvider classLoaderProvider,
Iterable<? extends Id> owners)
Gets dataset to be used to perform data operations.
|
<T extends co.cask.cdap.api.dataset.Dataset> |
getDataset(Id.DatasetInstance datasetInstanceId,
Map<String,String> arguments,
ClassLoader classLoader,
Iterable<? extends Id> owners)
Gets dataset to be used to perform data operations.
|
co.cask.cdap.api.dataset.DatasetSpecification |
getDatasetSpec(Id.DatasetInstance datasetInstanceId)
Gets the
DatasetSpecification for the specified dataset instance id |
Collection<DatasetSpecificationSummary> |
getInstances(Id.Namespace namespaceId)
Get all dataset instances in the specified namespace
|
boolean |
hasInstance(Id.DatasetInstance datasetInstanceId) |
boolean |
hasSystemType(String typeName)
Checks if the specified type exists in the 'system' namespace
|
boolean |
hasType(Id.DatasetType datasetTypeId)
Checks if the specified type exists in the specified namespace
|
void |
updateInstance(Id.DatasetInstance datasetInstanceId,
co.cask.cdap.api.dataset.DatasetProperties props)
Updates the existing dataset instance in the system.
|
public InMemoryDatasetFramework(DatasetDefinitionRegistryFactory registryFactory, CConfiguration configuration)
@Inject public InMemoryDatasetFramework(DatasetDefinitionRegistryFactory registryFactory, Map<String,co.cask.cdap.api.dataset.module.DatasetModule> defaultModules, CConfiguration configuration)
public void addModule(Id.DatasetModule moduleId, co.cask.cdap.api.dataset.module.DatasetModule module) throws ModuleConflictException
DatasetFrameworkDatasetModule may
result in tracing class dependencies if the DatasetModule is not a system dataset, which can takes
couple seconds for the tracing. If the jar Location containing the DatasetModule is known, it's
better to call DatasetFramework.addModule(Id.DatasetModule, DatasetModule, Location) instead.addModule in interface DatasetFrameworkmoduleId - dataset module idmodule - dataset moduleModuleConflictException - when module with same name is already registered or this module registers a type
with a same name as one of the already registered by another module typespublic void addModule(Id.DatasetModule moduleId, co.cask.cdap.api.dataset.module.DatasetModule module, Location jarLocation) throws DatasetManagementException
DatasetFrameworkaddModule in interface DatasetFrameworkmoduleId - dataset module idmodule - dataset modulejarLocation - location of the jar file that contains the dataset classes needed by the moduleModuleConflictException - when module with same name is already registered or this module registers a type
with a same name as one of the already registered by another module typesDatasetManagementException - in case of problemspublic void deleteModule(Id.DatasetModule moduleId)
DatasetFrameworkdeleteModule in interface DatasetFrameworkmoduleId - dataset module idpublic void deleteAllModules(Id.Namespace namespaceId) throws ModuleConflictException
DatasetFrameworkdeleteAllModules in interface DatasetFrameworknamespaceId - the Id.Namespace to delete all modules from.ModuleConflictException - when some of modules can't be deleted because of its dependant modules or instancespublic void addInstance(String datasetType, Id.DatasetInstance datasetInstanceId, co.cask.cdap.api.dataset.DatasetProperties props) throws DatasetManagementException, IOException
DatasetFrameworkDatasetDefinition.configure(String, DatasetProperties)
method to build DatasetSpecification which describes dataset instance
and later used to initialize DatasetAdmin and Dataset for the dataset instance.addInstance in interface DatasetFrameworkdatasetType - dataset instance type namedatasetInstanceId - dataset instance nameprops - dataset instance propertiesInstanceConflictException - if dataset instance with this name already existsDatasetManagementExceptionIOException - when creation of dataset instance using its admin failspublic void updateInstance(Id.DatasetInstance datasetInstanceId, co.cask.cdap.api.dataset.DatasetProperties props) throws DatasetManagementException, IOException
DatasetFrameworkDatasetDefinition.configure(String, DatasetProperties)
method to build DatasetSpecification with new properties,
which describes dataset instance and DatasetAdmin is used to upgrade
Dataset for the dataset instance.updateInstance in interface DatasetFrameworkdatasetInstanceId - dataset instance nameprops - dataset instance propertiesDatasetManagementExceptionIOException - when creation of dataset instance using its admin failspublic Collection<DatasetSpecificationSummary> getInstances(Id.Namespace namespaceId)
DatasetFrameworkgetInstances in interface DatasetFrameworknamespaceId - the specified namespace idDatasetSpecifications for all datasets in the specified namespace@Nullable public co.cask.cdap.api.dataset.DatasetSpecification getDatasetSpec(Id.DatasetInstance datasetInstanceId)
DatasetFrameworkDatasetSpecification for the specified dataset instance idgetDatasetSpec in interface DatasetFrameworkdatasetInstanceId - the Id.DatasetInstance for which the DatasetSpecification is desiredDatasetSpecification of the dataset or null if dataset not not existpublic boolean hasInstance(Id.DatasetInstance datasetInstanceId)
hasInstance in interface DatasetFrameworkdatasetInstanceId - the Id.DatasetInstance to check for existencepublic boolean hasSystemType(String typeName)
DatasetFrameworkhasSystemType in interface DatasetFrameworkpublic boolean hasType(Id.DatasetType datasetTypeId)
DatasetFrameworkhasType in interface DatasetFrameworkpublic void deleteInstance(Id.DatasetInstance datasetInstanceId) throws DatasetManagementException, IOException
DatasetFrameworkdeleteInstance in interface DatasetFrameworkdatasetInstanceId - dataset instance nameInstanceConflictException - if dataset instance cannot be deleted because of its dependenciesDatasetManagementExceptionIOException - when deletion of dataset instance using its admin failspublic void deleteAllInstances(Id.Namespace namespaceId) throws DatasetManagementException, IOException
DatasetFrameworkdeleteAllInstances in interface DatasetFrameworknamespaceId - the specified namespace idDatasetManagementExceptionIOException - when deletion of dataset instance using its admin failspublic <T extends co.cask.cdap.api.dataset.DatasetAdmin> T getAdmin(Id.DatasetInstance datasetInstanceId, @Nullable ClassLoader classLoader) throws IOException
DatasetFrameworkgetAdmin in interface DatasetFrameworkT - dataset admin typedatasetInstanceId - dataset instance nameclassLoader - classLoader to be used to load classes or null to use system classLoadernull if dataset instance of this name doesn't exist.IOException - when there's trouble to instantiate DatasetAdmin@Nullable public <T extends co.cask.cdap.api.dataset.DatasetAdmin> T getAdmin(Id.DatasetInstance datasetInstanceId, @Nullable ClassLoader classLoader, DatasetClassLoaderProvider classLoaderProvider) throws IOException
DatasetFrameworkgetAdmin in interface DatasetFrameworkT - dataset admin typedatasetInstanceId - dataset instance nameclassLoader - parent classLoader to be used to load classes or null to use system classLoaderclassLoaderProvider - provider to get classloaders for different dataset modulesnull if dataset instance of this name doesn't exist.IOException - when there's trouble to instantiate DatasetAdminpublic <T extends co.cask.cdap.api.dataset.Dataset> T getDataset(Id.DatasetInstance datasetInstanceId, Map<String,String> arguments, @Nullable ClassLoader classLoader, @Nullable Iterable<? extends Id> owners) throws IOException
DatasetFrameworkgetDataset in interface DatasetFrameworkT - dataset type to be returneddatasetInstanceId - dataset instance idarguments - runtime arguments for the dataset instanceclassLoader - classLoader to be used to load classes or null to use system classLoaderowners - owners of the datasetnull if dataset instance of this name doesn't exist.IOException - when there's trouble to instantiate Datasetpublic <T extends co.cask.cdap.api.dataset.Dataset> T getDataset(Id.DatasetInstance datasetInstanceId, Map<String,String> arguments, @Nullable ClassLoader classLoader) throws IOException
DatasetFrameworkgetDataset in interface DatasetFrameworkT - dataset type to be returneddatasetInstanceId - dataset instance idarguments - runtime arguments for the dataset instanceclassLoader - classLoader to be used to load classes or null to use system classLoadernull if dataset instance of this name doesn't exist.IOException - when there's trouble to instantiate Dataset@Nullable public <T extends co.cask.cdap.api.dataset.Dataset> T getDataset(Id.DatasetInstance datasetInstanceId, @Nullable Map<String,String> arguments, @Nullable ClassLoader parentClassLoader, DatasetClassLoaderProvider classLoaderProvider, @Nullable Iterable<? extends Id> owners) throws IOException
DatasetFrameworkgetDataset in interface DatasetFrameworkT - dataset type to be returneddatasetInstanceId - dataset instance idarguments - runtime arguments for the dataset instanceparentClassLoader - parent classLoader to be used to load classes or null to use system classLoaderclassLoaderProvider - provider to get classloaders for different dataset modulesowners - owners of the datasetnull if dataset instance of this name doesn't exist.IOException - when there's trouble to instantiate Datasetpublic void createNamespace(Id.Namespace namespaceId) throws DatasetManagementException
DatasetFrameworkcreateNamespace in interface DatasetFrameworknamespaceId - the Id.Namespace to createDatasetManagementExceptionpublic void deleteNamespace(Id.Namespace namespaceId) throws DatasetManagementException
DatasetFrameworkdeleteNamespace in interface DatasetFrameworknamespaceId - the Id.Namespace to createDatasetManagementExceptionprotected co.cask.cdap.api.dataset.module.DatasetDefinitionRegistry createRegistry(LinkedHashSet<String> availableModuleClasses, @Nullable ClassLoader classLoader)
protected LinkedHashSet<String> getAvailableModuleClasses(Id.Namespace namespace)
Copyright © 2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.