@Override public boolean equals(Object obj) { if (obj instanceof Site) { SiteConfiguration osc = ((Site) obj).getConfiguration(); // this will return false if one of the two sites is not activated // -> this should be OK return siteConfiguration != null && osc != null && getId().equals(osc.getId()); } else { return false; } }
@Override public boolean equals(Object obj) { if (obj instanceof Site) { SiteConfiguration osc = ((Site) obj).getConfiguration(); // this will return false if one of the two sites is not activated // -> this should be OK return siteConfiguration != null && osc != null && getId().equals(osc.getId()); } else { return false; } }
/** * Removes the prefixes of the parsed Site to the Map holding the according mappings * @param referencedSite */ private void removeEntityPrefixes(Site referencedSite) { String[] prefixes = referencedSite.getConfiguration().getEntityPrefixes(); if(prefixes == null || prefixes.length < 1){ synchronized (prefixMap) { noPrefixSites.remove(referencedSite); } } else { for(String prefix : prefixes){ synchronized (prefixMap) { Collection<Site> sites = prefixMap.get(prefix); if(sites != null){ sites.remove(referencedSite); if(sites.isEmpty()){ //remove key from the Map prefixMap.remove(prefix); //remove also the prefix from the List prefixList.remove(prefix); } } } } } } @Override
/** * Removes the prefixes of the parsed Site to the Map holding the according mappings * @param referencedSite */ private void removeEntityPrefixes(Site referencedSite) { String[] prefixes = referencedSite.getConfiguration().getEntityPrefixes(); if(prefixes == null || prefixes.length < 1){ synchronized (prefixMap) { noPrefixSites.remove(referencedSite); } } else { for(String prefix : prefixes){ synchronized (prefixMap) { Collection<Site> sites = prefixMap.get(prefix); if(sites != null){ sites.remove(referencedSite); if(sites.isEmpty()){ //remove key from the Map prefixMap.remove(prefix); //remove also the prefix from the List prefixList.remove(prefix); } } } } } } @Override
String[] prefixArray = referencedSite.getConfiguration().getEntityPrefixes(); if(prefixArray == null || prefixArray.length < 1){ synchronized (prefixMap) {
String[] prefixArray = referencedSite.getConfiguration().getEntityPrefixes(); if(prefixArray == null || prefixArray.length < 1){ synchronized (prefixMap) {
@Override public Entity getEntity(String entityId) { Collection<Site> sites = getSitesByEntityPrefix(entityId); if(sites.isEmpty()){ log.info("No Referenced Site registered for Entity {}",entityId); log.debug("Registered Prefixes {}",prefixList); return null; } for(Site site : sites){ Entity entity; try { entity = site.getEntity(entityId); if(entity != null){ log.debug("Return Representation of Site {} for Entity {}", site.getConfiguration().getName(),entityId); return entity; } } catch (SiteException e) { log.warn("Unable to access Site "+site.getConfiguration().getName()+ " (id = "+site.getId()+")",e); } } log.debug("Entity {} not found on any of the following Sites {}",entityId,sites); return null; }
@Override public Entity getEntity(String entityId) { Collection<Site> sites = getSitesByEntityPrefix(entityId); if(sites.isEmpty()){ log.info("No Referenced Site registered for Entity {}",entityId); log.debug("Registered Prefixes {}",prefixList); return null; } for(Site site : sites){ Entity entity; try { entity = site.getEntity(entityId); if(entity != null){ log.debug("Return Representation of Site {} for Entity {}", site.getConfiguration().getName(),entityId); return entity; } } catch (SiteException e) { log.warn("Unable to access Site "+site.getConfiguration().getName()+ " (id = "+site.getId()+")",e); } } log.debug("Entity {} not found on any of the following Sites {}",entityId,sites); return null; }
@Override public InputStream getContent(String entityId, String contentType) { Collection<Site> sites = getSitesByEntityPrefix(entityId); if(sites.isEmpty()){ log.info("No Referenced Site registered for Entity {}",entityId); log.debug("Registered Prefixes {}",prefixList); return null; } for(Site site : sites){ InputStream content; try { content = site.getContent(entityId, contentType); if(content != null){ log.debug("Return Content of type {} for Entity {} from referenced site {}", new Object[]{contentType,entityId,site.getConfiguration().getName()}); return content; } } catch (SiteException e) { log.warn("Unable to access Site "+site.getConfiguration().getName()+ " (id = "+site.getId()+")",e); } } log.debug("Entity {} not found on any of the following Sites {}",entityId,sites); return null; } @Override
@Override public InputStream getContent(String entityId, String contentType) { Collection<Site> sites = getSitesByEntityPrefix(entityId); if(sites.isEmpty()){ log.info("No Referenced Site registered for Entity {}",entityId); log.debug("Registered Prefixes {}",prefixList); return null; } for(Site site : sites){ InputStream content; try { content = site.getContent(entityId, contentType); if(content != null){ log.debug("Return Content of type {} for Entity {} from referenced site {}", new Object[]{contentType,entityId,site.getConfiguration().getName()}); return content; } } catch (SiteException e) { log.warn("Unable to access Site "+site.getConfiguration().getName()+ " (id = "+site.getId()+")",e); } } log.debug("Entity {} not found on any of the following Sites {}",entityId,sites); return null; } @Override
if(site.getConfiguration().getLicenses() != null){ for(License license : site.getConfiguration().getLicenses()){ if(license.getUrl() == null){ count++;
log.info("Entity {} found on more than one Referenced Site" + " -> Representation of Site {} is ignored", rep.getId(),site.getConfiguration().getName()); log.warn("Unable to access Site "+site.getConfiguration().getName()+ " (id = "+site.getId()+")",e);
rep.getId(),site.getConfiguration().getName()); log.warn("Unable to access Site "+site.getConfiguration().getName()+ " (id = "+site.getId()+")",e);
log.info("Entity {} found on more than one Referenced Site" + " -> Representation of Site {} is ignored", rep.getId(),site.getConfiguration().getName()); log.warn("Unable to access Site "+site.getConfiguration().getName()+ " (id = "+site.getId()+")",e);
log.warn("Unable to access Site "+site.getConfiguration().getName()+ " (id = "+site.getId()+")",e);
log.warn("Unable to access Site "+site.getConfiguration().getName()+ " (id = "+site.getId()+")",e);
ValueFactory valueFactory) { SiteConfiguration siteConfig = site.getConfiguration(); ManagedEntityState state; state = siteConfig.getDefaultManagedEntityState(); managedEntity.addAttributionLink(site.getConfiguration().getAttributionUrl()); managedEntity.addAttributionText(site.getConfiguration().getAttribution(), null); managedEntity.addContributorName(site.getConfiguration().getName());
ValueFactory valueFactory) { SiteConfiguration siteConfig = site.getConfiguration(); ManagedEntityState state; state = siteConfig.getDefaultManagedEntityState(); managedEntity.addAttributionLink(site.getConfiguration().getAttributionUrl()); managedEntity.addAttributionText(site.getConfiguration().getAttribution(), null); managedEntity.addContributorName(site.getConfiguration().getName());
SiteConfiguration siteConfig = site.getConfiguration(); MappingState mappingState = siteConfig.getDefaultMappedEntityState(); if(mappingState == null){
SiteConfiguration siteConfig = site.getConfiguration(); MappingState mappingState = siteConfig.getDefaultMappedEntityState(); if(mappingState == null){