Search in sources :

Example 1 with PropertyFieldExtractor

use of co.cask.cdap.internal.specification.PropertyFieldExtractor in project cdap by caskdata.

the class DefaultCustomActionConfigurer method createSpecification.

private DefaultCustomActionSpecification createSpecification() {
    Set<String> datasets = new HashSet<>();
    Reflections.visit(customAction, customAction.getClass(), new PropertyFieldExtractor(properties), new DataSetFieldExtractor(datasets));
    return new DefaultCustomActionSpecification(customAction.getClass().getName(), name, description, properties, datasets);
}
Also used : PropertyFieldExtractor(co.cask.cdap.internal.specification.PropertyFieldExtractor) DataSetFieldExtractor(co.cask.cdap.internal.specification.DataSetFieldExtractor) DefaultCustomActionSpecification(co.cask.cdap.internal.customaction.DefaultCustomActionSpecification) HashSet(java.util.HashSet)

Example 2 with PropertyFieldExtractor

use of co.cask.cdap.internal.specification.PropertyFieldExtractor in project cdap by caskdata.

the class DefaultHttpServiceHandlerConfigurer method createSpecification.

/**
   * Creates a {@link HttpServiceHandlerSpecification} from the parameters stored in this class.
   *
   * @return a new specification from the parameters stored in this instance
   */
public HttpServiceHandlerSpecification createSpecification() {
    List<ServiceHttpEndpoint> endpoints = new ArrayList<>();
    // Inspect the handler to grab all @UseDataset, @Property and endpoints.
    Reflections.visit(handler, handler.getClass(), new DataSetFieldExtractor(datasets), new PropertyFieldExtractor(properties), new ServiceEndpointExtractor(endpoints));
    return new HttpServiceHandlerSpecification(handler.getClass().getName(), name, "", properties, datasets, endpoints);
}
Also used : ServiceHttpEndpoint(co.cask.cdap.api.service.http.ServiceHttpEndpoint) ArrayList(java.util.ArrayList) DataSetFieldExtractor(co.cask.cdap.internal.specification.DataSetFieldExtractor) PropertyFieldExtractor(co.cask.cdap.internal.specification.PropertyFieldExtractor) HttpServiceHandlerSpecification(co.cask.cdap.api.service.http.HttpServiceHandlerSpecification)

Example 3 with PropertyFieldExtractor

use of co.cask.cdap.internal.specification.PropertyFieldExtractor in project cdap by caskdata.

the class DefaultSparkConfigurer method createSpecification.

public SparkSpecification createSpecification() {
    Preconditions.checkArgument(mainClassName != null, "Spark main class is not set. Make sure setMainClass or setMainClassName is called.");
    Set<String> datasets = new HashSet<>();
    // Grab all @Property and @Dataset fields
    Reflections.visit(spark, spark.getClass(), new PropertyFieldExtractor(properties), new DataSetFieldExtractor(datasets));
    return new SparkSpecification(spark.getClass().getName(), name, description, mainClassName, datasets, properties, clientResources, driverResources, executorResources);
}
Also used : SparkSpecification(co.cask.cdap.api.spark.SparkSpecification) PropertyFieldExtractor(co.cask.cdap.internal.specification.PropertyFieldExtractor) DataSetFieldExtractor(co.cask.cdap.internal.specification.DataSetFieldExtractor) HashSet(java.util.HashSet)

Example 4 with PropertyFieldExtractor

use of co.cask.cdap.internal.specification.PropertyFieldExtractor in project cdap by caskdata.

the class DefaultMapReduceConfigurer method createSpecification.

public MapReduceSpecification createSpecification() {
    Set<String> datasets = new HashSet<>();
    Reflections.visit(mapReduce, mapReduce.getClass(), new PropertyFieldExtractor(properties), new DataSetFieldExtractor(datasets));
    return new MapReduceSpecification(mapReduce.getClass().getName(), name, description, inputDataset, outputDataset, datasets, properties, driverResources, mapperResources, reducerResources);
}
Also used : MapReduceSpecification(co.cask.cdap.api.mapreduce.MapReduceSpecification) PropertyFieldExtractor(co.cask.cdap.internal.specification.PropertyFieldExtractor) DataSetFieldExtractor(co.cask.cdap.internal.specification.DataSetFieldExtractor) HashSet(java.util.HashSet)

Aggregations

DataSetFieldExtractor (co.cask.cdap.internal.specification.DataSetFieldExtractor)4 PropertyFieldExtractor (co.cask.cdap.internal.specification.PropertyFieldExtractor)4 HashSet (java.util.HashSet)3 MapReduceSpecification (co.cask.cdap.api.mapreduce.MapReduceSpecification)1 HttpServiceHandlerSpecification (co.cask.cdap.api.service.http.HttpServiceHandlerSpecification)1 ServiceHttpEndpoint (co.cask.cdap.api.service.http.ServiceHttpEndpoint)1 SparkSpecification (co.cask.cdap.api.spark.SparkSpecification)1 DefaultCustomActionSpecification (co.cask.cdap.internal.customaction.DefaultCustomActionSpecification)1 ArrayList (java.util.ArrayList)1