public abstract class Plugin<K,V>
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Plugin.Builder<K,V>
Builder class for a
Plugin . |
Modifier and Type | Field and Description |
---|---|
protected SubmitterLifecycle |
cdapPluginObj |
protected Configuration |
hadoopConfiguration |
protected PluginConfig |
pluginConfig |
Constructor and Description |
---|
Plugin() |
Modifier and Type | Method and Description |
---|---|
static <K,V> Plugin.Builder<K,V> |
builder()
Creates a plugin builder instance.
|
static <K,V> Plugin<K,V> |
createBatch(java.lang.Class<?> newPluginClass,
java.lang.Class<?> newFormatClass,
java.lang.Class<?> newFormatProviderClass)
Creates a batch plugin instance.
|
static <K,V> Plugin<K,V> |
createStreaming(java.lang.Class<?> newPluginClass,
SerializableFunction<V,java.lang.Long> getOffsetFn,
java.lang.Class<? extends org.apache.spark.streaming.receiver.Receiver<V>> receiverClass)
Creates a streaming plugin instance with default function for getting args for
Receiver . |
static <K,V> Plugin<K,V> |
createStreaming(java.lang.Class<?> newPluginClass,
SerializableFunction<V,java.lang.Long> getOffsetFn,
java.lang.Class<? extends org.apache.spark.streaming.receiver.Receiver<V>> receiverClass,
SerializableFunction<PluginConfig,java.lang.Object[]> getReceiverArgsFromConfigFn)
Creates a streaming plugin instance.
|
abstract BatchContextImpl |
getContext()
Gets the context of a plugin.
|
abstract java.lang.Class<?> |
getFormatClass()
Gets InputFormat or OutputFormat class for a plugin.
|
abstract java.lang.Class<?> |
getFormatProviderClass()
Gets InputFormatProvider or OutputFormatProvider class for a plugin.
|
abstract SerializableFunction<V,java.lang.Long> |
getGetOffsetFn()
Gets a
SerializableFunction that defines how to get record offset for CDAP Plugin class. |
abstract SerializableFunction<PluginConfig,java.lang.Object[]> |
getGetReceiverArgsFromConfigFn()
Gets a
SerializableFunction that defines how to get constructor arguments for Receiver using PluginConfig . |
Configuration |
getHadoopConfiguration()
Gets a plugin Hadoop configuration.
|
abstract java.lang.Class<?> |
getPluginClass()
Gets the main class of a plugin.
|
PluginConfig |
getPluginConfig()
Gets a plugin config.
|
abstract PluginConstants.PluginType |
getPluginType()
Gets a plugin type.
|
ReceiverBuilder<V,? extends org.apache.spark.streaming.receiver.Receiver<V>> |
getReceiverBuilder()
Gets a
ReceiverBuilder . |
abstract java.lang.Class<? extends org.apache.spark.streaming.receiver.Receiver<V>> |
getReceiverClass()
Gets Spark
Receiver class for a CDAP plugin. |
static BatchContextImpl |
initContext(java.lang.Class<?> cdapPluginClass)
Initializes
BatchContextImpl for CDAP plugin. |
static PluginConstants.PluginType |
initPluginType(java.lang.Class<?> pluginClass)
Gets value of a plugin type.
|
java.lang.Boolean |
isUnbounded()
Gets value of a plugin type.
|
void |
prepareRun()
Calls
SubmitterLifecycle.prepareRun(Object) method on the cdapPluginObj
passing needed configuration object as a parameter. |
Plugin<K,V> |
withConfig(PluginConfig pluginConfig)
Sets a plugin config.
|
Plugin<K,V> |
withHadoopConfiguration(java.lang.Class<K> formatKeyClass,
java.lang.Class<V> formatValueClass)
Sets a plugin Hadoop configuration.
|
Plugin<K,V> |
withHadoopConfiguration(Configuration hadoopConfiguration)
Sets a plugin Hadoop configuration.
|
@Nullable protected PluginConfig pluginConfig
@Nullable protected Configuration hadoopConfiguration
@Nullable protected SubmitterLifecycle cdapPluginObj
public abstract BatchContextImpl getContext()
public abstract java.lang.Class<?> getPluginClass()
@Nullable public abstract java.lang.Class<?> getFormatClass()
@Nullable public abstract java.lang.Class<?> getFormatProviderClass()
@Nullable public abstract java.lang.Class<? extends org.apache.spark.streaming.receiver.Receiver<V>> getReceiverClass()
Receiver
class for a CDAP plugin.@Nullable public abstract SerializableFunction<V,java.lang.Long> getGetOffsetFn()
SerializableFunction
that defines how to get record offset for CDAP Plugin
class.@Nullable public abstract SerializableFunction<PluginConfig,java.lang.Object[]> getGetReceiverArgsFromConfigFn()
SerializableFunction
that defines how to get constructor arguments for Receiver
using PluginConfig
.public Plugin<K,V> withConfig(PluginConfig pluginConfig)
@Nullable public PluginConfig getPluginConfig()
public void prepareRun()
SubmitterLifecycle.prepareRun(Object)
method on the cdapPluginObj
passing needed configuration object as a parameter. This method is needed for
validating connection to the CDAP sink/source and performing initial tuning.public Plugin<K,V> withHadoopConfiguration(java.lang.Class<K> formatKeyClass, java.lang.Class<V> formatValueClass)
public Plugin<K,V> withHadoopConfiguration(Configuration hadoopConfiguration)
public Configuration getHadoopConfiguration()
public abstract PluginConstants.PluginType getPluginType()
public static PluginConstants.PluginType initPluginType(java.lang.Class<?> pluginClass) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public static BatchContextImpl initContext(java.lang.Class<?> cdapPluginClass)
BatchContextImpl
for CDAP plugin.public java.lang.Boolean isUnbounded()
public ReceiverBuilder<V,? extends org.apache.spark.streaming.receiver.Receiver<V>> getReceiverBuilder()
ReceiverBuilder
.public static <K,V> Plugin<K,V> createBatch(java.lang.Class<?> newPluginClass, java.lang.Class<?> newFormatClass, java.lang.Class<?> newFormatProviderClass)
newPluginClass
- class of the CDAP plugin Plugin
.newFormatClass
- Hadoop Input or Output format class.newFormatProviderClass
- Hadoop Input or Output format provider class.public static <K,V> Plugin<K,V> createStreaming(java.lang.Class<?> newPluginClass, SerializableFunction<V,java.lang.Long> getOffsetFn, java.lang.Class<? extends org.apache.spark.streaming.receiver.Receiver<V>> receiverClass, SerializableFunction<PluginConfig,java.lang.Object[]> getReceiverArgsFromConfigFn)
newPluginClass
- class of the CDAP plugin Plugin
.getOffsetFn
- SerializableFunction
that defines how to get record offset for CDAP
Plugin
class.receiverClass
- Spark Receiver
class for a CDAP plugin.getReceiverArgsFromConfigFn
- SerializableFunction
that defines how to get
constructor arguments for Receiver
using PluginConfig
.public static <K,V> Plugin<K,V> createStreaming(java.lang.Class<?> newPluginClass, SerializableFunction<V,java.lang.Long> getOffsetFn, java.lang.Class<? extends org.apache.spark.streaming.receiver.Receiver<V>> receiverClass)
Receiver
.newPluginClass
- class of the CDAP plugin Plugin
.getOffsetFn
- SerializableFunction
that defines how to get record offset for CDAP
Plugin
class.receiverClass
- Spark Receiver
class for a CDAP plugin.public static <K,V> Plugin.Builder<K,V> builder()