public boolean supportsLocalMode() { return siteConfiguration.getCacheStrategy() == CacheStrategy.all && cache != null; }
public boolean supportsLocalMode() { return siteConfiguration.getCacheStrategy() == CacheStrategy.all && cache != null; }
/** * 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; }
/** * 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; }
+ "NULL nor empty!"); if(config.getCacheStrategy() != CacheStrategy.all && dereferencer == null){ throw new IllegalArgumentException("The EntityDerefernencer MUST NOT be NULL if " + "CacheStrategy is NOT FULL (all entities in local Cache)!"); if(config.getCacheStrategy() != CacheStrategy.none && cache == null){ throw new IllegalArgumentException("The Cache MUST NOT be NULL if the " + "CacheStrategy is set to an other value as NONE!");
+ "NULL nor empty!"); if(config.getCacheStrategy() != CacheStrategy.all && dereferencer == null){ throw new IllegalArgumentException("The EntityDerefernencer MUST NOT be NULL if " + "CacheStrategy is NOT FULL (all entities in local Cache)!"); if(config.getCacheStrategy() != CacheStrategy.none && cache == null){ throw new IllegalArgumentException("The Cache MUST NOT be NULL if the " + "CacheStrategy is set to an other value as NONE!");
valid = false; if(config.getCacheStrategy() != CacheStrategy.none && cache == null){ log.debug(" ... Local Cache not available"); valid = false; if(config.getCacheStrategy() != CacheStrategy.all && offlineMode != null){ log.debug(" ... Offline Mode is active and CacheStrategy != ALL");
valid = false; if(config.getCacheStrategy() != CacheStrategy.none && cache == null){ log.debug(" ... Local Cache not available"); valid = false; if(config.getCacheStrategy() != CacheStrategy.all && offlineMode != null){ log.debug(" ... Offline Mode is active and CacheStrategy != ALL");
rep = cache.getRepresentation(id); if (rep == null){ if(siteConfiguration.getCacheStrategy() == CacheStrategy.all) { return null; // do no remote lookups on CacheStrategy.all!!
rep = cache.getRepresentation(id); if (rep == null){ if(siteConfiguration.getCacheStrategy() == CacheStrategy.all) { return null; // do no remote lookups on CacheStrategy.all!!
@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); } }
@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); } }
@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<Entity> findEntities(FieldQuery query) throws SiteException { List<Entity> results; if (siteConfiguration.getCacheStrategy() == CacheStrategy.all) { try {
@Override public QueryResultList<Entity> findEntities(FieldQuery query) throws SiteException { List<Entity> results; if (siteConfiguration.getCacheStrategy() == CacheStrategy.all) { try {
if(refConfig.getCacheStrategy() != null){ rep.add(namespace+"cacheStrategy", valueFactory.createReference(namespace+"cacheStrategy-"+refConfig.getCacheStrategy().name()));