/** * Stores the exception which holds information if, and where, the Windup stopped (typically on an external request). * If windup was stopped, this must be called. */ public void setWindupStopException(WindupStopException windupStopException) { if (this.windupStopException != null) throw new WindupException("Trying to set the stop exception while it was already set." + " The cause contains the original one.", this.windupStopException); this.windupStopException = windupStopException; }
private void validateWrappedCondition(Object wrappedCondition) { if(! (wrappedCondition instanceof GraphCondition)) { throw new WindupException("The <" + ELEMENT_NAME + "> element must wrap GraphConditions only." ); } }
/** * Stores the exception which holds information if, and where, the Windup stopped (typically on an external request). * If windup was stopped, this must be called. */ public void setWindupStopException(WindupStopException windupStopException) { if (this.windupStopException != null) throw new WindupException("Trying to set the stop exception while it was already set." + " The cause contains the original one.", this.windupStopException); this.windupStopException = windupStopException; }
private void validateAttributes(String size) throws WindupException{ if(!Pattern.matches("[0-9]+",size)) { throw new WindupException("The <" + ELEMENT_NAME + "> element's '" +IterableFilterHandler.SIZE_ATTRIBUTE + " attribute is not a valid number." ); } }
private void validateChildren(List<Element> children) throws WindupException{ if(children.size() != 1) { throw new WindupException("The <" + ELEMENT_NAME + "> element must have exactly 1 child." ); } } }
private Object setAndWarnIfDifferent(String what, Object existing, Object newOne) { if (existing == null) return newOne; if (existing.equals(newOne) || newOne == null) return existing; throw new WindupException(String.format("Trait '%s' was expected to be new or same as previously seen, but were:" + "\n Existing: %s" + "\n New: %s", what, existing, newOne)); } }
protected Path castToPath(Object file) { if (file instanceof File) return ((File) file).toPath(); else if (file instanceof Path) return (Path) file; else throw new WindupException("Unrecognized type: " + file.getClass().getCanonicalName()); }
public Tag getTag(String tagName) { Tag tag = findTag(tagName); if (null == tag) throw new WindupException("Tag does not exist: " + tagName); return tag; }
public Tag getTag(String tagName) { Tag tag = findTag(tagName); if (null == tag) throw new WindupException("Tag does not exist: " + tagName); return tag; }
@Override public AnnotationLiteralCondition processElement(ParserContext handlerManager, Element element) throws ConfigurationException { String pattern = element.getAttribute(PATTERN); if (StringUtils.isBlank(pattern)) throw new WindupException(ANNOTATION_LITERAL + " element requires a " + PATTERN + " attribute!"); return new AnnotationLiteralCondition(pattern); } }
@Override public <E> DynamicType.Builder<E> processMethod(final DynamicType.Builder<E> builder, final Method method, final Annotation annotation) { String methodName = method.getName(); if (methodName.startsWith("get")) return createInterceptor(builder, method); else if (methodName.startsWith("set")) return createInterceptor(builder, method); throw new WindupException("Only get* and set* method names are supported for @" + MapInAdjacentProperties.class.getSimpleName()); }
@Override public TypeReferenceLocation processElement(ParserContext handlerManager, Element element) throws ConfigurationException { String location = $(element).text(); if (StringUtils.isBlank(location)) { throw new WindupException("Error, 'location' element must have non-empty contents"); } return Enum.valueOf(TypeReferenceLocation.class, location.trim()); } }
@Override public String processElement(ParserContext handlerManager, Element element) throws ConfigurationException { String message = $(element).text(); if (StringUtils.isBlank(message)) { throw new WindupException("Error, 'message' element must not be blank"); } return message; } }
public void replaceWindupDirectoryWithLatestDistribution() { Coordinate coord = updater.queryLatestWindupRelease(); if(coord == null) throw new WindupException("No "+ Util.WINDUP_BRAND_NAME_ACRONYM +" release found."); log.info("Latest "+ Util.WINDUP_BRAND_NAME_ACRONYM +" version available: " + coord.getVersion()); log.fine("Latest "+ Util.WINDUP_BRAND_NAME_ACRONYM +" version available: " + coord); replaceWindupDirectoryWithDistribution(coord); }
@Override public TechnologyTagExists processElement(ParserContext handlerManager, Element element) throws ConfigurationException { String technologyTagPattern = $(element).attr(NAME); String in = $(element).attr("in"); if (StringUtils.isBlank(technologyTagPattern)) { throw new WindupException("Error, '" + ELEMENT_NAME + "' element must have a non-empty '" + NAME + "' attribute"); } return TechnologyTagExists.withName(technologyTagPattern).in(in); } }
@Override public TechnologyTagExists processElement(ParserContext handlerManager, Element element) throws ConfigurationException { String technologyTagPattern = $(element).attr(NAME); String in = $(element).attr("in"); if (StringUtils.isBlank(technologyTagPattern)) { throw new WindupException("Error, '" + ELEMENT_NAME + "' element must have a non-empty '" + NAME + "' attribute"); } return TechnologyTagExists.withName(technologyTagPattern).in(in); } }
@Override public void perform(GraphRewrite event, EvaluationContext context, WindupConfigurationModel payload) { ProjectModel projectModel = payload.getInputPath().getProjectModel(); if (projectModel == null) { throw new WindupException("Error, no project found in: " + payload.getInputPath().getFilePath()); } createApplicationReport(event.getGraphContext(), projectModel); }
@Override public void perform(GraphRewrite event, EvaluationContext context, WindupConfigurationModel payload) { ProjectModel projectModel = payload.getInputPath().getProjectModel(); if (projectModel == null) { throw new WindupException("Error, no project found in: " + payload.getInputPath().getFilePath()); } createApplicationReport(event.getGraphContext(), projectModel); }
@Override public void perform(GraphRewrite event, EvaluationContext context) { WindupConfigurationModel windupConfiguration = WindupConfigurationService.getConfigurationModel(event.getGraphContext()); for(FileModel fileModel : windupConfiguration.getInputPaths()) { ProjectModel application = fileModel.getProjectModel(); if (application == null) throw new WindupException("Error, no project found in: " + fileModel.getFilePath()); createReportModel(event.getGraphContext(), application); } }
@Override public void perform(GraphRewrite event, EvaluationContext context) { WindupConfigurationModel windupConfiguration = WindupConfigurationService.getConfigurationModel(event.getGraphContext()); ProjectModel projectModel = windupConfiguration.getInputPath().getProjectModel(); if (projectModel == null) { throw new WindupException("Error, no project found in: " + windupConfiguration.getInputPath().getFilePath()); } createSpringBeanReport(event.getGraphContext(), projectModel); }