VectorIngestRunner extends AnalyzeRunner { @Override protected void runInternal(final OperationParams params) throws Exception { try { if (parameters.size() != 2) { throw new ParameterException( "Requires arguments: <store name> <comma delimited index list>"); } final String inputStoreName = parameters.get(0); final String indexList = parameters.get(1); final File configFile = (File) params.getContext().get(ConfigOptions.PROPERTIES_FILE_CONTEXT); final StoreLoader inputStoreLoader = new StoreLoader(inputStoreName); if (!inputStoreLoader.loadFromConfig(configFile, params.getConsole())) { throw new ParameterException("Cannot find store name: " + inputStoreLoader.getStoreName()); } final DataStorePluginOptions storeOptions = inputStoreLoader.getDataStorePlugin(); final DataStore store = storeOptions.createDataStore(); final Index[] indices = DataStoreUtils.loadIndices(storeOptions.createIndexStore(), indexList).toArray( new Index[0]); sceneType = SceneFeatureIterator.createFeatureType(); final FeatureDataAdapter sceneAdapter = new FeatureDataAdapter(sceneType); store.addType(sceneAdapter, indices); sceneWriter = store.createWriter(sceneAdapter.getTypeName()); final SimpleFeatureType bandType = BandFeatureIterator.createFeatureType(sceneType); final FeatureDataAdapter bandAdapter = new FeatureDataAdapter(bandType); store.addType(bandAdapter, indices); bandWriter = store.createWriter(bandAdapter.getTypeName()); super.runInternal(params); } finally { if (sceneWriter != null) { sceneWriter.close(); } if (bandWriter != null) { bandWriter.close(); } } } VectorIngestRunner(
      final Landsat8BasicCommandLineOptions analyzeOptions,
      final List<String> parameters); static void writeScene(
      final SimpleFeatureType sceneType,
      final SimpleFeature firstBandOfScene,
      final Writer sceneWriter);  }
@Test public void testIngest() throws Exception { JAIExt.initJAIEXT(); final Landsat8BasicCommandLineOptions analyzeOptions = new Landsat8BasicCommandLineOptions(); analyzeOptions.setNBestScenes(1); analyzeOptions.setCqlFilter( "BBOX(shape,-76.6,42.34,-76.4,42.54) and band='BQA' and sizeMB < 1"); analyzeOptions.setUseCachedScenes(true); analyzeOptions.setWorkspaceDir(Tests.WORKSPACE_DIR); final Landsat8DownloadCommandLineOptions downloadOptions = new Landsat8DownloadCommandLineOptions(); downloadOptions.setOverwriteIfExists(false); final Landsat8RasterIngestCommandLineOptions ingestOptions = new Landsat8RasterIngestCommandLineOptions(); ingestOptions.setRetainImages(true); ingestOptions.setCreatePyramid(true); ingestOptions.setCreateHistogram(true); final ManualOperationParams params = new ManualOperationParams(); params.getContext().put( ConfigOptions.PROPERTIES_FILE_CONTEXT, new File( VectorIngestRunnerTest.class.getClassLoader().getResource( "geowave-config.properties").toURI())); createIndices(params); final VectorIngestRunner runner = new VectorIngestRunner(analyzeOptions, Arrays.asList("memorystore", "spatialindex")); runner.runInternal(params); try (CloseableIterator<Object> results = getStorePluginOptions(params).createDataStore().query(QueryBuilder.newBuilder().build())) { assertTrue("Store is not empty", results.hasNext()); } }