public class RemoteDatasetFramework extends Object implements DatasetFramework
DatasetFramework implementation that talks to DatasetFramework Service| Constructor and Description |
|---|
RemoteDatasetFramework(CConfiguration cConf,
DiscoveryServiceClient discoveryClient,
DatasetDefinitionRegistryFactory registryFactory) |
| 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.
|
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 parentClassLoader,
DatasetClassLoaderProvider classLoaderProvider)
Gets dataset instance admin to be used to perform administrative operations.
|
<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 classLoader,
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 |
<T extends DatasetType> |
getDatasetType(DatasetTypeMeta implementationInfo,
ClassLoader classLoader,
DatasetClassLoaderProvider classLoaderProvider)
Return an instance of the
DatasetType corresponding to given dataset modules. |
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.
|
@Inject public RemoteDatasetFramework(CConfiguration cConf, DiscoveryServiceClient discoveryClient, DatasetDefinitionRegistryFactory registryFactory)
public void addModule(Id.DatasetModule moduleId, co.cask.cdap.api.dataset.module.DatasetModule module) throws DatasetManagementException
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 typesDatasetManagementException - in case of problemspublic 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) throws DatasetManagementException
DatasetFrameworkdeleteModule in interface DatasetFrameworkmoduleId - dataset module idModuleConflictException - when module cannot be deleted because of its dependant modules or instancesDatasetManagementExceptionpublic void deleteAllModules(Id.Namespace namespaceId) throws DatasetManagementException
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 instancesDatasetManagementExceptionpublic void addInstance(String datasetType, Id.DatasetInstance datasetInstanceId, co.cask.cdap.api.dataset.DatasetProperties props) throws DatasetManagementException
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 existsDatasetManagementExceptionpublic void updateInstance(Id.DatasetInstance datasetInstanceId, co.cask.cdap.api.dataset.DatasetProperties props) throws DatasetManagementException
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 propertiesDatasetManagementExceptionpublic Collection<DatasetSpecificationSummary> getInstances(Id.Namespace namespaceId) throws DatasetManagementException
DatasetFrameworkgetInstances in interface DatasetFrameworknamespaceId - the specified namespace idDatasetSpecifications for all datasets in the specified namespaceDatasetManagementException@Nullable public co.cask.cdap.api.dataset.DatasetSpecification getDatasetSpec(Id.DatasetInstance datasetInstanceId) throws DatasetManagementException
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 existDatasetManagementExceptionpublic boolean hasInstance(Id.DatasetInstance datasetInstanceId) throws DatasetManagementException
hasInstance in interface DatasetFrameworkdatasetInstanceId - the Id.DatasetInstance to check for existenceDatasetManagementExceptionpublic boolean hasSystemType(String typeName) throws DatasetManagementException
DatasetFrameworkhasSystemType in interface DatasetFrameworkDatasetManagementExceptionpublic boolean hasType(Id.DatasetType datasetTypeId) throws DatasetManagementException
DatasetFrameworkhasType in interface DatasetFrameworkDatasetManagementExceptionpublic void deleteInstance(Id.DatasetInstance datasetInstanceId) throws DatasetManagementException
DatasetFrameworkdeleteInstance in interface DatasetFrameworkdatasetInstanceId - dataset instance nameInstanceConflictException - if dataset instance cannot be deleted because of its dependenciesDatasetManagementExceptionpublic 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, ClassLoader classLoader) throws DatasetManagementException, 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.DatasetManagementException - when there's trouble getting dataset meta infoIOException - when there's trouble to instantiate DatasetAdmin@Nullable public <T extends co.cask.cdap.api.dataset.DatasetAdmin> T getAdmin(Id.DatasetInstance datasetInstanceId, @Nullable ClassLoader parentClassLoader, DatasetClassLoaderProvider classLoaderProvider) throws DatasetManagementException, IOException
DatasetFrameworkgetAdmin in interface DatasetFrameworkT - dataset admin typedatasetInstanceId - dataset instance nameparentClassLoader - 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.DatasetManagementException - when there's trouble getting dataset meta infoIOException - 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 DatasetManagementException, 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.DatasetManagementException - when there's trouble getting dataset meta infoIOException - 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 DatasetManagementException, 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.DatasetManagementException - when there's trouble getting dataset meta infoIOException - 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 classLoader, DatasetClassLoaderProvider classLoaderProvider, @Nullable Iterable<? extends Id> owners) throws DatasetManagementException, IOException
DatasetFrameworkgetDataset in interface DatasetFrameworkT - dataset type to be returneddatasetInstanceId - dataset instance idarguments - runtime arguments for the dataset instanceclassLoader - 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.DatasetManagementException - when there's trouble getting dataset meta infoIOException - 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 createDatasetManagementExceptionpublic <T extends DatasetType> T getDatasetType(DatasetTypeMeta implementationInfo, ClassLoader classLoader, DatasetClassLoaderProvider classLoaderProvider)
DatasetType corresponding to given dataset modules. Uses the given
classloader as a parent for all dataset modules, and the given classloader provider to get classloaders for
each dataset module in given the dataset type meta. Order of dataset modules in the given
DatasetTypeMeta is important. The classloader for the first dataset module is used as the parent of
the second dataset module and so on until the last dataset module. The classloader for the last dataset module
is then used as the classloader for the returned DatasetType.T - the type of DatasetTypeimplementationInfo - the dataset type metadata to instantiate the type fromclassLoader - the parent classloader to use for dataset modulesclassLoaderProvider - the classloader provider to get classloaders for each dataset moduleCopyright © 2016 Cask Data, Inc. Licensed under the Apache License, Version 2.0.