Search in sources :

Example 1 with SparkLocatorService

use of com.thinkbiganalytics.spark.service.SparkLocatorService in project kylo by Teradata.

the class SparkShellApp method jerseyConfig.

/**
 * Gets the resource configuration for setting up Jersey.
 *
 * @return the Jersey configuration
 */
@Bean
public ResourceConfig jerseyConfig(final TransformService transformService, final FileSystem fileSystem, final SparkLocatorService sparkLocatorService) {
    final ResourceConfig config = new ResourceConfig(ApiListingResource.class, SwaggerSerializers.class);
    config.packages("com.thinkbiganalytics.spark.rest");
    config.register(new AbstractBinder() {

        @Override
        protected void configure() {
            bind(fileSystem).to(FileSystem.class);
            bind(transformService).to(TransformService.class);
            bind(sparkLocatorService).to(SparkLocatorService.class);
        }
    });
    return config;
}
Also used : AbstractBinder(org.glassfish.hk2.utilities.binding.AbstractBinder) FileSystem(org.apache.hadoop.fs.FileSystem) ResourceConfig(org.glassfish.jersey.server.ResourceConfig) TransformService(com.thinkbiganalytics.spark.service.TransformService) SparkLocatorService(com.thinkbiganalytics.spark.service.SparkLocatorService) Bean(org.springframework.context.annotation.Bean)

Example 2 with SparkLocatorService

use of com.thinkbiganalytics.spark.service.SparkLocatorService in project kylo by Teradata.

the class SparkShellApp method sparkLocatorService.

/**
 * Creates a Spark locator service.
 */
@Bean
public SparkLocatorService sparkLocatorService(final SparkContext sc, @Value("${spark.shell.datasources.exclude}") final String excludedDataSources, @Value("${spark.shell.datasources.include}") final String includedDataSources) {
    final SparkLocatorService service = new SparkLocatorService();
    if (excludedDataSources != null && !excludedDataSources.isEmpty()) {
        final List<String> dataSources = Arrays.asList(excludedDataSources.split(","));
        service.excludeDataSources(dataSources);
    }
    if (includedDataSources != null && !includedDataSources.isEmpty()) {
        final List<String> dataSources = Arrays.asList(includedDataSources.split(","));
        service.includeDataSources(dataSources);
    }
    return service;
}
Also used : SparkLocatorService(com.thinkbiganalytics.spark.service.SparkLocatorService) Bean(org.springframework.context.annotation.Bean)

Aggregations

SparkLocatorService (com.thinkbiganalytics.spark.service.SparkLocatorService)2 Bean (org.springframework.context.annotation.Bean)2 TransformService (com.thinkbiganalytics.spark.service.TransformService)1 FileSystem (org.apache.hadoop.fs.FileSystem)1 AbstractBinder (org.glassfish.hk2.utilities.binding.AbstractBinder)1 ResourceConfig (org.glassfish.jersey.server.ResourceConfig)1