//check if all the Enumerated values are valid strings and convert them
//to enumeration instances
try {
setCacheStrategy(getCacheStrategy());
} catch (IllegalArgumentException e) {
throw new ConfigurationException(CACHE_STRATEGY,
String.format("Unknown CachStrategy (%s=%s) for Site %s! Valid values are %s ",
CACHE_STRATEGY,config.get(CACHE_STRATEGY),getId(),
Arrays.toString(CacheStrategy.values()),e));
}
//check that a cacheId is set if the CacheStrategy != none
if(CacheStrategy.none != getCacheStrategy() && getCacheId() == null){
throw new ConfigurationException(CACHE_ID,
String.format("The CacheID (%s) MUST NOT be NULL nor empty if the the CacheStrategy != %s",
CACHE_ID,CacheStrategy.none));
}
//check that a accessUri and an entity dereferencer is set if the
//cacheStrategy != CacheStrategy.all
if(CacheStrategy.all != getCacheStrategy()){
if(getAccessUri() == null){
throw new ConfigurationException(ACCESS_URI,
String.format("An AccessUri (%s) MUST be configured if the CacheStrategy != %s",
ACCESS_URI,CacheStrategy.all));
}
if(getEntityDereferencerType() == null){
throw new ConfigurationException(ENTITY_DEREFERENCER_TYPE,
String.format("An EntityDereferencer (%s) MUST be configured if the CacheStrategy != %s",
ENTITY_DEREFERENCER_TYPE,CacheStrategy.all));
}
}
}