private void pollTask() { if (inPoll.getAndSet(true)) return; try { poll(); } catch (Exception e) { logger.debug("During polling", e); } finally { inPoll.set(false); } }
public List<Resolution> validate() throws Exception { try (OSGiRepository repository = new OSGiRepository(); HttpClient httpClient = new HttpClient()) { Map<String, String> map = new HashMap<>(); map.put("locations", Strings.join(repositories)); map.put("name", "ResolverValidator"); repository.setProperties(map); Processor registry = new Processor(); registry.addBasicPlugin(httpClient); repository.setRegistry(registry); repository.setReporter(this); Set<Resource> resources = getAllResources(repository); return validateResources(repository, resources); } }
@Override public String tooltip(Object... target) throws Exception { if (target.length == 0) { try (Formatter f = new Formatter()) { if (stale) { f.format("[stale] Needs reload, see menu\n"); } f.format("Name : %s\n", getName()); f.format("Cache : %s\n", getRoot()); f.format("Max stale (secs) : %s\n", config.max_stale(YEAR)); f.format("\n" + "URLs :\n"); for (URI uri : getIndex().getURIs()) { f.format(" %s\n", uri); } return f.toString(); } } return getIndex().getBridge() .tooltip(target); }
private synchronized OSGiIndex getIndex() throws Exception { if (index != null) { return index; } return getIndex(false); }
@Override public Map<String, Runnable> actions(final Object... target) throws Exception { Map<String, Runnable> menu = new LinkedHashMap<>(); switch (target.length) { case 0 : menu.put("Reload Index & Bundles", () -> { try { getIndex(true); } catch (Exception e) { throw Exceptions.duck(e); } }); break; case 2 : menu.put("Reload Bundle", () -> { try { String bsn = (String) target[0]; Version version = (Version) target[1]; File f = get(bsn, version, null); if (f != null) IO.delete(f); } catch (Exception e) { throw Exceptions.duck(e); } }); break; } return menu; }
@Override public void setRegistry(Registry registry) { super.setRegistry(registry); Workspace workspace = registry.getPlugin(Workspace.class); SetLocation location = workspace .warning("FixedIndexedRepository is deprecated, please use " + OSGiRepository.class.getName()); location.header("-plugin.*") .context("FixedIndexedRepository"); } }
void poll() throws Exception { if (stale) { return; } OSGiIndex ix; synchronized (this) { ix = index; } if (ix == null) return; if (ix.isStale()) { stale = true; this.notifyRepositoryListeners(); } }
public List<Resolution> validate() throws Exception { try (OSGiRepository repository = new OSGiRepository(); HttpClient httpClient = new HttpClient()) { Map<String, String> map = new HashMap<>(); map.put("locations", Strings.join(repositories)); map.put("name", "ResolverValidator"); repository.setProperties(map); Processor registry = new Processor(); registry.addBasicPlugin(httpClient); repository.setRegistry(registry); repository.setReporter(this); Set<Resource> resources = getAllResources(repository); return validateResources(repository, resources); } }
@Override public String tooltip(Object... target) throws Exception { if (target.length == 0) { try (Formatter f = new Formatter()) { if (stale) { f.format("[stale] Needs reload, see menu\n"); } f.format("Name : %s\n", getName()); f.format("Cache : %s\n", getRoot()); f.format("Max stale (secs) : %s\n", config.max_stale(YEAR)); f.format("\n" + "URLs :\n"); for (URI uri : getIndex().getURIs()) { f.format(" %s\n", uri); } return f.toString(); } } return getIndex().getBridge() .tooltip(target); }
private synchronized OSGiIndex getIndex() throws Exception { if (index != null) { return index; } return getIndex(false); }
@Override public Map<String, Runnable> actions(final Object... target) throws Exception { Map<String, Runnable> menu = new LinkedHashMap<>(); switch (target.length) { case 0 : menu.put("Reload Index & Bundles", () -> { try { getIndex(true); } catch (Exception e) { throw Exceptions.duck(e); } }); break; case 2 : menu.put("Reload Bundle", () -> { try { String bsn = (String) target[0]; Version version = (Version) target[1]; File f = get(bsn, version, null); if (f != null) IO.delete(f); } catch (Exception e) { throw Exceptions.duck(e); } }); break; } return menu; }
@Override public void setRegistry(Registry registry) { super.setRegistry(registry); Workspace workspace = registry.getPlugin(Workspace.class); SetLocation location = workspace .warning("FixedIndexedRepository is deprecated, please use " + OSGiRepository.class.getName()); location.header("-plugin.*") .context("FixedIndexedRepository"); } }
void poll() throws Exception { if (stale) { return; } OSGiIndex ix; synchronized (this) { ix = index; } if (ix == null) return; if (ix.isStale()) { stale = true; this.notifyRepositoryListeners(); } }
@Override public void prepare() throws Exception { getIndex(); }
private void pollTask() { if (inPoll.getAndSet(true)) return; try { poll(); } catch (Exception e) { logger.debug("During polling", e); } finally { inPoll.set(false); } }