@Override public void execute(final OperationParams params) { computeResults(params); }
@Override public void execute(final OperationParams params) { computeResults(params); }
@Override public void execute(final OperationParams params) { computeResults(params); }
/** Prep the driver & run the operation. */ @Override public void execute(final OperationParams params) { // Ensure we have all the required arguments if (parameters.size() != 1) { throw new ParameterException("Requires arguments: <store name>"); } final String inputStoreName = parameters.get(0); // Attempt to load input store. if (inputStoreOptions == null) { final StoreLoader inputStoreLoader = new StoreLoader(inputStoreName); if (!inputStoreLoader.loadFromConfig(getGeoWaveConfigFile(params))) { throw new ParameterException("Cannot find store name: " + inputStoreLoader.getStoreName()); } inputStoreOptions = inputStoreLoader.getDataStorePlugin(); } // Get all statistics, remove all statistics, then re-add final DataStatisticsStore statsStore = inputStoreOptions.createDataStatisticsStore(); final InternalAdapterStore internalAdapterStore = inputStoreOptions.createInternalAdapterStore(); inputStoreOptions.createDataStoreOperations().mergeStats(statsStore, internalAdapterStore); }
@Override public Void computeResults(final OperationParams params) { if (parameters.size() < 1) { throw new ParameterException("Must specify store name"); } final String inputStoreName = parameters.get(0); // Attempt to load store. final File configFile = getGeoWaveConfigFile(params); // Attempt to load input store. final StoreLoader inputStoreLoader = new StoreLoader(inputStoreName); if (!inputStoreLoader.loadFromConfig(configFile)) { throw new ParameterException("Cannot find store name: " + inputStoreLoader.getStoreName()); } inputStoreOptions = inputStoreLoader.getDataStorePlugin(); LOGGER.info("Deleting everything in store: " + inputStoreName); inputStoreOptions.createDataStore().delete(QueryBuilder.newBuilder().build()); return null; } }
@Override public Void computeResults(final OperationParams params) { // Ensure we have all the required arguments if (parameters.size() != 2) { throw new ParameterException("Requires arguments: <store name> <type name>"); } final String inputStoreName = parameters.get(0); final String typeName = parameters.get(1); // Attempt to load store. final File configFile = getGeoWaveConfigFile(params); final StoreLoader inputStoreLoader = new StoreLoader(inputStoreName); if (!inputStoreLoader.loadFromConfig(configFile)) { throw new ParameterException("Cannot find store name: " + inputStoreLoader.getStoreName()); } inputStoreOptions = inputStoreLoader.getDataStorePlugin(); LOGGER.info("Deleting everything in store: " + inputStoreName + " with type name: " + typeName); inputStoreOptions.createDataStore().delete( QueryBuilder.newBuilder().addTypeName(typeName).build()); return null; } }
@Override public String computeResults(final OperationParams params) { if (parameters.size() < 1) { throw new ParameterException("Must specify store name"); } final String inputStoreName = parameters.get(0); // Attempt to load store. final File configFile = getGeoWaveConfigFile(params); // Attempt to load input store. final StoreLoader inputStoreLoader = new StoreLoader(inputStoreName); if (!inputStoreLoader.loadFromConfig(configFile)) { throw new ParameterException("Cannot find store name: " + inputStoreLoader.getStoreName()); } inputStoreOptions = inputStoreLoader.getDataStorePlugin(); final String[] typeNames = inputStoreOptions.createInternalAdapterStore().getTypeNames(); final StringBuffer buffer = new StringBuffer(); for (final String typeName : typeNames) { buffer.append(typeName).append(' '); } return buffer.toString(); } }
@Override public void clearCommand( org.locationtech.geowave.service.grpc.protobuf.ClearCommandParametersProtos request, StreamObserver<org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.VoidResponseProtos> responseObserver) { ClearCommand cmd = new ClearCommand(); Map<FieldDescriptor, Object> m = request.getAllFields(); GeoWaveGrpcServiceCommandUtil.setGrpcToCommandFields(m, cmd); final File configFile = GeoWaveGrpcServiceOptions.geowaveConfigFile; final OperationParams params = new ManualOperationParams(); params.getContext().put(ConfigOptions.PROPERTIES_FILE_CONTEXT, configFile); cmd.prepare(params); LOGGER.info("Executing ClearCommand..."); try { cmd.computeResults(params); final VoidResponseProtos resp = VoidResponseProtos.newBuilder().build(); responseObserver.onNext(resp); responseObserver.onCompleted(); } catch (final Exception e) { LOGGER.error("Exception encountered executing command", e); } }
@Override protected boolean performStatsCommand( final DataStorePluginOptions storeOptions, final InternalDataAdapter<?> adapter, final StatsCommandLineOptions statsOptions) throws IOException { // Remove the stat final DataStatisticsStore statStore = storeOptions.createDataStatisticsStore(); final String[] authorizations = getAuthorizations(statsOptions.getAuthorizations()); if (!statStore.removeStatistics( adapter.getAdapterId(), fieldName, new BaseStatisticsType<>(statType), authorizations)) { throw new RuntimeException("Unable to remove statistic: " + statType); } return true; }
private static void verifyStats(final DataStorePluginOptions dataStore) throws Exception { final ListStatsCommand listStats = new ListStatsCommand(); listStats.setParameters("test", null); final File configFile = File.createTempFile("test_stats", null); final ManualOperationParams params = new ManualOperationParams(); params.getContext().put(ConfigOptions.PROPERTIES_FILE_CONTEXT, configFile); final AddStoreCommand addStore = new AddStoreCommand(); addStore.setParameters("test"); addStore.setPluginOptions(dataStore); addStore.execute(params); try { listStats.execute(params); } catch (final ParameterException e) { throw new RuntimeException(e); } }
@Override public void removeTypeCommand( org.locationtech.geowave.service.grpc.protobuf.RemoveTypeCommandParametersProtos request, StreamObserver<org.locationtech.geowave.service.grpc.protobuf.GeoWaveReturnTypesProtos.VoidResponseProtos> responseObserver) { RemoveTypeCommand cmd = new RemoveTypeCommand(); Map<FieldDescriptor, Object> m = request.getAllFields(); GeoWaveGrpcServiceCommandUtil.setGrpcToCommandFields(m, cmd); final File configFile = GeoWaveGrpcServiceOptions.geowaveConfigFile; final OperationParams params = new ManualOperationParams(); params.getContext().put(ConfigOptions.PROPERTIES_FILE_CONTEXT, configFile); cmd.prepare(params); LOGGER.info("Executing RemoveAdapterCommand..."); try { cmd.computeResults(params); final VoidResponseProtos resp = VoidResponseProtos.newBuilder().build(); responseObserver.onNext(resp); responseObserver.onCompleted(); } catch (final Exception e) { LOGGER.error("Exception encountered executing command", e); } }
@Override public void execute(final OperationParams params) { computeResults(params); }
@Override public void execute(final OperationParams params) { computeResults(params); }
@Override public void execute(final OperationParams params) throws TargetNotFoundException { computeResults(params); }
@Override public void execute(final OperationParams params) { JCommander.getConsole().println("Available types: " + computeResults(params)); }
@Override public void execute(final OperationParams params) throws TargetNotFoundException { JCommander.getConsole().println(computeResults(params)); }
@Override public Void computeResults(final OperationParams params) { // Ensure we have all the required arguments if (parameters.size() != 3) { throw new ParameterException("Requires arguments: <store name> <datatype name> <stat type>"); } statType = parameters.get(2); super.run(params, parameters); return null; } }
@Override public Void computeResults(final OperationParams params) { // Ensure we have all the required arguments if (parameters.size() != 3) { throw new ParameterException("Requires arguments: <store name> <datatype name> <stat type>"); } statType = parameters.get(2); super.run(params, parameters); return null; } }
@Override public Void computeResults(final OperationParams params) { // Ensure we have all the required arguments if (parameters.size() < 1) { throw new ParameterException("Requires arguments: <store name>"); } if ((typeName != null) && !typeName.trim().isEmpty()) { parameters.add(typeName); } super.run(params, parameters); return null; } }
@Override public String computeResults(final OperationParams params) throws TargetNotFoundException { // Ensure we have all the required arguments if (parameters.size() < 1) { throw new ParameterException("Requires arguments: <store name>"); } if ((typeName != null) && !typeName.trim().isEmpty()) { parameters.add(typeName); } super.run(params, parameters); if (!retValue.equals("")) { return retValue; } else { return "No Data Found"; } } }