} catch (SiteException e) { String message = String.format("Unable to Query Site '%s' (message: %s)", site.getId(),e.getMessage()); log.error(message, e); return Response.status(Status.INTERNAL_SERVER_ERROR)
@Override public InputStream getContent(String id, String contentType) throws SiteException { if (siteConfiguration.getEntityDereferencerType() == null) { throw new SiteException( String.format( "Unable to get Content for Entity %s because No dereferencer configured for ReferencedSite %s", id, getId())); } if (dereferencer == null) { throw new SiteException(String.format("Dereferencer %s for remote site %s is not available", siteConfiguration.getEntityDereferencerType(), siteConfiguration.getAccessUri())); } try { return dereferencer.dereference(id, contentType); } catch (IOException e) { throw new SiteException( String.format( "Unable to load content for Entity %s and mediaType %s from remote site %s by using dereferencer %s", id, contentType, siteConfiguration.getAccessUri(), siteConfiguration.getEntityDereferencerType()), e); } }
} catch (YardException e) { if (entitySearcher == null) { throw new SiteException("Unable to execute query on Cache " + siteConfiguration.getCacheId(), e); } else { throw new SiteException(String.format("The ReferencedSite %s does not support queries!", getId())); entityIds = entitySearcher.findEntities(query); } catch (IOException e) { throw new SiteException(String.format( "Unable to execute query on remote site %s with entitySearcher %s!", siteConfiguration.getQueryUri(), siteConfiguration.getEntitySearcherType()), e); log.warn(String.format("Unable to get Representation for Entity " + "%s. -> %d Error%s for %d Entities in QueryResult (Reason:%s)", id, errors, errors > 1 ? "s" : "", entityIds.size(), e.getMessage())); throw new SiteException("Unable to get anly Representations for " + "Entities selected by the parsed Query (Root-Cause is the " + "last Exception trown)", lastError);
} catch (YardException e) { if (entitySearcher == null) { throw new SiteException("Unable to execute query on Cache " + siteConfiguration.getCacheId(), e); } else { throw new SiteException(String.format("The ReferencedSite %s does not support queries!", getId())); entityIds = entitySearcher.findEntities(query); } catch (IOException e) { throw new SiteException(String.format( "Unable to execute query on remote site %s with entitySearcher %s!", siteConfiguration.getQueryUri(), siteConfiguration.getEntitySearcherType()), e); log.warn(String.format("Unable to get Representation for Entity " + "%s. -> %d Error%s for %d Entities in QueryResult (Reason:%s)", id, errors, errors > 1 ? "s" : "", entityIds.size(), e.getMessage())); throw new SiteException("Unable to get anly Representations for " + "Entities selected by the parsed Query (Root-Cause is the " + "last Exception trown)", lastError);
log.error(message,e); builder = Response.status(Status.INTERNAL_SERVER_ERROR) .entity(message + ' '+ e.getClass().getSimpleName()+": "+ e.getMessage()) .header(HttpHeaders.ACCEPT, accepted);
@Override public InputStream getContent(String id, String contentType) throws SiteException { if (siteConfiguration.getEntityDereferencerType() == null) { throw new SiteException( String.format( "Unable to get Content for Entity %s because No dereferencer configured for ReferencedSite %s", id, getId())); } if (dereferencer == null) { throw new SiteException(String.format("Dereferencer %s for remote site %s is not available", siteConfiguration.getEntityDereferencerType(), siteConfiguration.getAccessUri())); } try { return dereferencer.dereference(id, contentType); } catch (IOException e) { throw new SiteException( String.format( "Unable to load content for Entity %s and mediaType %s from remote site %s by using dereferencer %s", id, contentType, siteConfiguration.getAccessUri(), siteConfiguration.getEntityDereferencerType()), e); } }
"an Error while checking the current version of that" + "Entity within the Entityhub (Message: %s)", entry.getKey(),e.getMessage())) .header(HttpHeaders.ACCEPT, accepted);
@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); } }
} catch (SiteException e) { String message = String.format("Unable to Query Site '%s' (message: %s)", site.getId(),e.getMessage()); log.error(message, e); return Response.status(Status.INTERNAL_SERVER_ERROR)
@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<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); } }
throw new SiteException(String.format("Unable to get Represetnation %s form Cache %s", id, siteConfiguration.getCacheId()), e); } else { rep = dereferencer.dereference(id); } catch (IOException e) { throw new SiteException(String.format( "Unable to load Representation for entity %s form remote site %s with dereferencer %s", id, siteConfiguration.getAccessUri(), siteConfiguration.getEntityDereferencerType()), e);
throw new SiteException(String.format("Unable to get Represetnation %s form Cache %s", id, siteConfiguration.getCacheId()), e); } else { rep = dereferencer.dereference(id); } catch (IOException e) { throw new SiteException(String.format( "Unable to load Representation for entity %s form remote site %s with dereferencer %s", id, siteConfiguration.getAccessUri(), siteConfiguration.getEntityDereferencerType()), e);