public abstract class AbstractDatasetProvider extends Object implements DatasetProvider
Dataset instances using methods implemented by subclasses.
Used by RemoteDatasetFramework and DatasetInstanceService.
Use this when you want to control how dataset instances are created. For example, when
you want to obtain a Dataset instance without having to make remote calls.| Modifier | Constructor and Description |
|---|---|
protected |
AbstractDatasetProvider(DatasetDefinitionRegistryFactory registryFactory) |
| Modifier and Type | Method and Description |
|---|---|
abstract void |
createIfNotExists(Id.DatasetInstance instance,
String type,
co.cask.cdap.api.dataset.DatasetProperties creationProps)
Creates the dataset if it doesn't already exist.
|
<T extends co.cask.cdap.api.dataset.Dataset> |
get(Id.DatasetInstance instance,
ClassLoader classLoader,
Map<String,String> arguments)
Gets a dataset.
|
<T extends co.cask.cdap.api.dataset.Dataset> |
get(Id.DatasetInstance instance,
DatasetTypeMeta typeMeta,
co.cask.cdap.api.dataset.DatasetSpecification spec,
DatasetClassLoaderProvider classLoaderProvider,
ClassLoader classLoader,
Map<String,String> arguments) |
abstract DatasetMeta |
getMeta(Id.DatasetInstance instance)
Gets the
DatasetMeta for a dataset. |
<T extends co.cask.cdap.api.dataset.Dataset> |
getOrCreate(Id.DatasetInstance instance,
String type,
co.cask.cdap.api.dataset.DatasetProperties creationProps,
ClassLoader classLoader,
Map<String,String> arguments)
Gets a dataset, and creates it first if it doesn't yet exist.
|
<T extends DatasetType> |
getType(DatasetTypeMeta implementationInfo,
ClassLoader classLoader,
DatasetClassLoaderProvider classLoaderProvider)
Return an instance of the
DatasetType corresponding to given dataset modules. |
protected AbstractDatasetProvider(DatasetDefinitionRegistryFactory registryFactory)
@Nullable public abstract DatasetMeta getMeta(Id.DatasetInstance instance) throws Exception
DatasetMeta for a dataset.instance - the datasetDatasetMetaExceptionpublic abstract void createIfNotExists(Id.DatasetInstance instance, String type, co.cask.cdap.api.dataset.DatasetProperties creationProps) throws Exception
instance - the datasettype - the type of dataset to createcreationProps - creation propertiesExceptionpublic <T extends co.cask.cdap.api.dataset.Dataset> T getOrCreate(Id.DatasetInstance instance, String type, co.cask.cdap.api.dataset.DatasetProperties creationProps, @Nullable ClassLoader classLoader, @Nullable Map<String,String> arguments) throws Exception
DatasetProvidergetOrCreate in interface DatasetProviderT - the type of datasetinstance - the dataset IDtype - the type of datasetcreationProps - the creation propertiesclassLoader - the classloader to usearguments - the runtime arguments for the datasetExceptionpublic <T extends co.cask.cdap.api.dataset.Dataset> T get(Id.DatasetInstance instance, @Nullable ClassLoader classLoader, @Nullable Map<String,String> arguments) throws Exception
DatasetProviderget in interface DatasetProviderT - the type of datasetinstance - the dataset IDclassLoader - the classloader to usearguments - the runtime arguments for the datasetExceptionpublic <T extends co.cask.cdap.api.dataset.Dataset> T get(Id.DatasetInstance instance, DatasetTypeMeta typeMeta, co.cask.cdap.api.dataset.DatasetSpecification spec, DatasetClassLoaderProvider classLoaderProvider, @Nullable ClassLoader classLoader, @Nullable Map<String,String> arguments) throws IOException
IOExceptionpublic <T extends DatasetType> T getType(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.