private void checkScopeMaps() throws JPValidationException { if (scopeFileTransformerMap.keySet().stream().anyMatch(k -> scopeFileTransformerMap.containsKey(k))) { throw new JPValidationException("The same scope occurs multiple times in the file transformers."); } if (scopeIdMap.keySet().stream().anyMatch(k -> scopeFileTransformerMap.keySet().stream().filter(k2 -> k == k2).count() > 1)) { throw new JPValidationException("The same scope appeared in the file transformers and the registry transformers."); } if (scopeIdMap.keySet().stream().anyMatch(k -> scopeIdMap.keySet().stream().filter(k2 -> k == k2).count() > 1)) { throw new JPValidationException("The same scope appeared multiple times in the registry."); } }
/** * {@inheritDoc} * * @throws JPValidationException {@inheritDoc} */ @Override protected void validate() throws JPValidationException { super.validate(); for (String s : getValue()) { if (!s.matches(FULL_REGEX)) { throw new JPValidationException("Every argument has to be a unit id and thus match \"" + FULL_REGEX + "\""); } } } }
@Override public void validate() throws JPValidationException { final File value = getValue(); if (value == null) { throw new JPValidationException(getClass().getSimpleName() + " is not defined but can be set manually with " + getDefaultExample(), getErrorReport()); } try { FileHandler.handle(value, type, existenceHandling, autoCreateMode); } catch (Exception ex) { throw new JPValidationException("Could not handle " + type.name() + "[" + value + "]!", ex); } }
/** * {@inheritDoc} * * @throws JPValidationException {@inheritDoc} */ @Override protected void validate() throws JPValidationException { super.validate(); for (String s : getValue()) { if (!s.matches(FULL_REGEX)) { throw new JPValidationException("Every argument has to be a unit id and thus match \"" + FULL_REGEX + "\""); } } } }
/** * {@inheritDoc} * * @throws JPValidationException {@inheritDoc} */ @Override public void validate() throws JPValidationException { try { for (File f : getValue().values()) { FileHandler.handle(f, FileType.File, EXISTENCE_HANDLING, AUTO_CREATE_MODE); } } catch (Exception ex) { throw new JPValidationException("There was an invalid file in " + getValue() + "!", ex); } } }
@Override public void validate() throws JPValidationException { super.validate(); if (getValueType().equals((ValueType.CommandLine))) { logger.warn("WARNING: OVERWRITING CURRENT SETTINGS!!!"); try { if (JPService.getProperty(JPTestMode.class).getValue()) { return; } } catch (JPServiceException ex) { JPService.printError("Could not access java property!", ex); } logger.warn("=== Type y and press enter to continue ==="); try { if (!(System.in.read() == 'y')) { throw new JPValidationException("Execution aborted by user!"); } } catch (IOException ex) { throw new JPValidationException("Validation failed because of invalid input state!", ex); } } }
@Override public void validate() throws JPValidationException { super.validate(); if (getValueType().equals((AbstractJavaProperty.ValueType.CommandLine))) { logger.warn("WARNING: OVERWRITING CURRENT CREDENTIALS!!!"); try { if (JPService.getProperty(JPTestMode.class).getValue()) { return; } } catch (JPServiceException ex) { ExceptionPrinter.printHistory(new CouldNotPerformException("Could not access java property!", ex), logger); } logger.warn("=== Type y and press enter to contine ==="); try { if (!(System.in.read() == 'y')) { throw new JPValidationException("Execution aborted by user!"); } } catch (IOException ex) { throw new JPValidationException("Validation failed because of invalid input state!", ex); } } }
@Override public void validate() throws JPValidationException { super.validate(); // during tests the registry generation is skipped because the mock registry is handling the db initialization. if (!JPService.testMode()) { try { BCORegistryLoader.prepareRegistry(getValue()); } catch (CouldNotPerformException ex) { throw new JPValidationException(ex); } } }
|| JPService.getProperty(JPFileTransformers.class).isParsed() && JPService.getProperty(JPFileTransformers.class).getValue().size() > 1 || JPService.getProperty(JPRegistryTransformers.class).isParsed() && JPService.getProperty(JPRegistryTransformers.class).getValue().size() > 1) { throw new JPValidationException("So far, only one transformer can be specified via -r or -f, as merging is not yet implemented."); throw new JPValidationException("At least one of --registry-id or --transform-file has to be specified");