@Override public Object load(Object... parameters) throws Exception { return callback.execute(); }
protected boolean isBinary(String path) { return RegexUtils.matchesAny(path, binaryPathPatterns); }
protected String createBaseUrl(String serviceUrl) { return UrlUtils.concat(serverUrl, URL_ROOT, serviceUrl); }
@Override @SuppressWarnings("unchecked") public Map<String, Object> search(String indexId, SolrQuery query) throws SearchException { String searchUrl = createBaseUrl(URL_SEARCH, indexId); searchUrl = UrlUtils.addQueryStringFragment(searchUrl, query.toUrlQueryString()); try { return restTemplate.getForObject(new URI(searchUrl), Map.class); } catch (URISyntaxException e) { throw new SearchException(indexId, "Invalid URI: " + searchUrl, e); } catch (HttpStatusCodeException e) { throw new SearchException(indexId, "Search for query " + query + " failed: [" + e.getStatusText() + "] " + e.getResponseBodyAsString()); } catch (Exception e) { throw new SearchException(indexId, "Search for query " + query + " failed: " + e.getMessage(), e); } }
public static String addParam(String url, String name, Object value) { try { return UrlUtils.addParam(url, name, value.toString(), "UTF-8"); } catch (UnsupportedEncodingException e) { // Shouldn't happen, UTF-8 is a valid encoding throw new IllegalStateException(e); } }
protected boolean isMetadata(String path) { return RegexUtils.matchesAny(path, metadataPathPatterns); }
@Override public <T> T getObject(Context context, CachingOptions cachingOptions, Callback<T> callback, Object... keyElements) { Object key = getKey(keyElements); T obj = doGet(context, callback, key); if (obj == null) { obj = callback.execute(); if (obj != null) { if (cachingOptions == null) { cachingOptions = CachingOptions.DEFAULT_CACHING_OPTIONS; } obj = doPut(context, cachingOptions, callback, key, obj); } } return obj; }
protected String createBaseUrl(String serviceUrl) { return UrlUtils.concat(serverUrl, URL_ROOT, serviceUrl); }
@Override @SuppressWarnings("unchecked") public Map<String, Object> search(String indexId, SolrQuery query) throws SearchException { String searchUrl = createBaseUrl(URL_SEARCH, indexId); searchUrl = UrlUtils.addQueryStringFragment(searchUrl, query.toUrlQueryString()); try { return restTemplate.getForObject(new URI(searchUrl), Map.class); } catch (URISyntaxException e) { throw new SearchException(indexId, "Invalid URI: " + searchUrl, e); } catch (HttpStatusCodeException e) { throw getSearchException(indexId, "Search for query " + query + " failed: [" + e.getStatusText() + "] " + e.getResponseBodyAsString(), e); } catch (Exception e) { throw new SearchException(indexId, "Search for query " + query + " failed: " + e.getMessage(), e); } }
protected boolean isChildBinary(String path) { return RegexUtils.matchesAny(path, childBinaryPathPatterns); }
protected boolean include(String path) { return (CollectionUtils.isEmpty(includePathPatterns) || RegexUtils.matchesAny(path, includePathPatterns)) && (CollectionUtils.isEmpty(excludePathPatterns) || !RegexUtils.matchesAny(path, excludePathPatterns)); }
protected boolean shouldIncludeProperty(String name) { return (CollectionUtils.isEmpty(includePropertyPatterns) || RegexUtils.matchesAny(name, includePropertyPatterns)) && (CollectionUtils.isEmpty(excludePropertyPatterns) || !RegexUtils.matchesAny(name, excludePropertyPatterns)); }
private boolean isUrlAllowed(String url) { return (ArrayUtils.isEmpty(allowedUrlPatterns) || RegexUtils.matchesAny(url, allowedUrlPatterns)) && (ArrayUtils.isEmpty(forbiddenUrlPatterns) || !RegexUtils.matchesAny(url, forbiddenUrlPatterns)); }
protected boolean isWhitelistedAndNotBlacklisted(String target) { return (ArrayUtils.isEmpty(whitelistRegexes) || RegexUtils.matchesAny(target, Arrays.asList(whitelistRegexes), matchFullInput)) && (ArrayUtils.isEmpty(blacklistRegexes) || !RegexUtils.matchesAny(target, Arrays.asList(blacklistRegexes), matchFullInput)); }
@Override public boolean accepts(Item item, List<Item> acceptedItems, List<Item> rejectedItems, boolean runningBeforeProcessing) { return ArrayUtils.isEmpty(excludeRegexes) || !RegexUtils.matchesAny(item.getUrl(), excludeRegexes); }
@Override public boolean accepts(Item item, List<Item> acceptedItems, List<Item> rejectedItems, boolean runningBeforeProcessing) { return ArrayUtils.isEmpty(includeRegexes) || RegexUtils.matchesAny(item.getUrl(), includeRegexes); }