if (cache != null) { try { rep = cache.getRepresentation(id); if (rep == null){ if(siteConfiguration.getCacheStrategy() == CacheStrategy.all) { start = System.currentTimeMillis(); rep = cache.store(rep); cachedVersion = Boolean.TRUE; log.debug(" - cached Representation {} in {} ms", id,
/** * In case {@link CacheStrategy#all} this Method returns the query factory of the Cache. Otherwise it * returns {@link DefaultQueryFactory#getInstance()}. */ @Override public FieldQueryFactory getQueryFactory() { FieldQueryFactory factory = null; if (siteConfiguration.getCacheStrategy() == CacheStrategy.all) { if (cache != null) { factory = cache.getQueryFactory(); } } if (factory == null) { factory = DefaultQueryFactory.getInstance(); } return factory; }
@Override public QueryResultList<Representation> find(FieldQuery query) throws SiteException { if (siteConfiguration.getCacheStrategy() == CacheStrategy.all) { try { return cache.find(query); } catch (YardException e) { if (entitySearcher == null) { throw new SiteException("Unable to execute query on Cache " + siteConfiguration.getCacheId(), e); } else { log.warn( String.format( "Error while performing query on Cache %s! Try to use remote site %s as fallback!", siteConfiguration.getCacheId(), siteConfiguration.getQueryUri()), e); } } } if (entitySearcher == null) { throw new SiteException(String.format("ReferencedSite %s does not support queries!", getId())); } try { return entitySearcher.find(query); } catch (IOException e) { throw new SiteException("Unable execute Query on remote site " + siteConfiguration.getQueryUri(), e); } }
@Override public QueryResultList<String> findReferences(FieldQuery query) throws SiteException { if (siteConfiguration.getCacheStrategy() == CacheStrategy.all) { try { return cache.findReferences(query); } catch (YardException e) { if (entitySearcher == null) { throw new SiteException("Unable to execute query on Cache " + siteConfiguration.getCacheId(), e); } else { log.warn( String.format( "Error while performing query on Cache %s! Try to use remote site %s as fallback!", siteConfiguration.getCacheId(), siteConfiguration.getQueryUri()), e); } } } if (entitySearcher == null) { throw new SiteException(String.format("The referencedSite %s dose not support queries!", getId())); } try { return entitySearcher.findEntities(query); } catch (IOException e) { throw new SiteException("Unable execute Query on remote site " + siteConfiguration.getQueryUri(), e); } }
try { QueryResultList<Representation> representations = cache.findRepresentation((query)); results = new ArrayList<Entity>(representations.size()); for (Representation result : representations) {
if (cache != null) { try { rep = cache.getRepresentation(id); if (rep == null){ if(siteConfiguration.getCacheStrategy() == CacheStrategy.all) { start = System.currentTimeMillis(); rep = cache.store(rep); cachedVersion = Boolean.TRUE; log.debug(" - cached Representation {} in {} ms", id,
/** * In case {@link CacheStrategy#all} this Method returns the query factory of the Cache. Otherwise it * returns {@link DefaultQueryFactory#getInstance()}. */ @Override public FieldQueryFactory getQueryFactory() { FieldQueryFactory factory = null; if (siteConfiguration.getCacheStrategy() == CacheStrategy.all) { if (cache != null) { factory = cache.getQueryFactory(); } } if (factory == null) { factory = DefaultQueryFactory.getInstance(); } return factory; }
@Override public QueryResultList<Representation> find(FieldQuery query) throws SiteException { if (siteConfiguration.getCacheStrategy() == CacheStrategy.all) { try { return cache.find(query); } catch (YardException e) { if (entitySearcher == null) { throw new SiteException("Unable to execute query on Cache " + siteConfiguration.getCacheId(), e); } else { log.warn( String.format( "Error while performing query on Cache %s! Try to use remote site %s as fallback!", siteConfiguration.getCacheId(), siteConfiguration.getQueryUri()), e); } } } if (entitySearcher == null) { throw new SiteException(String.format("ReferencedSite %s does not support queries!", getId())); } try { return entitySearcher.find(query); } catch (IOException e) { throw new SiteException("Unable execute Query on remote site " + siteConfiguration.getQueryUri(), e); } }
@Override public QueryResultList<String> findReferences(FieldQuery query) throws SiteException { if (siteConfiguration.getCacheStrategy() == CacheStrategy.all) { try { return cache.findReferences(query); } catch (YardException e) { if (entitySearcher == null) { throw new SiteException("Unable to execute query on Cache " + siteConfiguration.getCacheId(), e); } else { log.warn( String.format( "Error while performing query on Cache %s! Try to use remote site %s as fallback!", siteConfiguration.getCacheId(), siteConfiguration.getQueryUri()), e); } } } if (entitySearcher == null) { throw new SiteException(String.format("The referencedSite %s dose not support queries!", getId())); } try { return entitySearcher.findEntities(query); } catch (IOException e) { throw new SiteException("Unable execute Query on remote site " + siteConfiguration.getQueryUri(), e); } }
try { QueryResultList<Representation> representations = cache.findRepresentation((query)); results = new ArrayList<Entity>(representations.size()); for (Representation result : representations) {
protected void bindCache(Cache cache){ if(cache != null){ Map<String, Cache> tmp = new HashMap<String, Cache>(caches); tmp.put(cache.getId(),cache); this.caches = Collections.unmodifiableMap(tmp); } } protected void unbindCache(Cache cache){
protected void bindCache(Cache cache){ if(cache != null){ Map<String, Cache> tmp = new HashMap<String, Cache>(caches); tmp.put(cache.getId(),cache); this.caches = Collections.unmodifiableMap(tmp); } } protected void unbindCache(Cache cache){