private synchronized OSGiIndex getIndex() throws Exception { if (index != null) { return index; } return getIndex(false); }
private synchronized OSGiIndex getIndex() throws Exception { if (index != null) { return index; } return getIndex(false); }
@Override public void prepare() throws Exception { getIndex(); }
@Override public void prepare() throws Exception { getIndex(); }
@Override public synchronized boolean refresh() { try { getIndex(true); return true; } catch (Exception e) { logger.error("Refreshing repository {} failed", this.getName(), e); return false; } }
@Override public synchronized boolean refresh() { try { getIndex(true); return true; } catch (Exception e) { logger.error("Refreshing repository {} failed", this.getName(), e); return false; } }
@Override public File getRoot() throws Exception { return getIndex().getCache(); }
@Override public File getRoot() throws Exception { return getIndex().getCache(); }
@Override public List<String> list(String pattern) throws Exception { return getIndex().getBridge() .list(pattern); }
@Override public Map<Requirement, Collection<Capability>> findProviders(Collection<? extends Requirement> requirements) { try { return getIndex().findProviders(requirements); } catch (Exception e) { throw Exceptions.duck(e); } } }
@Override public Map<Requirement, Collection<Capability>> findProviders(Collection<? extends Requirement> requirements) { try { return getIndex().findProviders(requirements); } catch (Exception e) { throw Exceptions.duck(e); } } }
@Override public SortedSet<Version> versions(String bsn) throws Exception { return getIndex().getBridge() .versions(bsn); }
@Override public List<String> list(String pattern) throws Exception { return getIndex().getBridge() .list(pattern); }
@Override public SortedSet<Version> versions(String bsn) throws Exception { return getIndex().getBridge() .versions(bsn); }
@Override public String getLocation() { try { return Strings.join(getIndex().getURIs()); } catch (Exception e) { return config.locations(); } }
@Override public String title(Object... target) throws Exception { if (target.length == 0 && stale) { return getName() + " [stale]"; } return getIndex().getBridge() .title(target); }
@Override public String getLocation() { try { return Strings.join(getIndex().getURIs()); } catch (Exception e) { return config.locations(); } }
@Override public String title(Object... target) throws Exception { if (target.length == 0 && stale) { return getName() + " [stale]"; } return getIndex().getBridge() .title(target); }
@Override public File get(String bsn, Version version, Map<String, String> properties, DownloadListener... listeners) throws Exception { File target = IO.getFile(getIndex().getCache(), bsn + "-" + version + ".jar"); Promise<File> promise = getIndex().get(bsn, version, target); if (promise == null) return null; if (listeners.length == 0) { return promise.getValue(); } new DownloadListenerPromise(reporter, "Download " + bsn + "-" + version + " into " + config.name(), promise, listeners); return target; }
@Override public File get(String bsn, Version version, Map<String, String> properties, DownloadListener... listeners) throws Exception { File target = IO.getFile(getIndex().getCache(), bsn + "-" + version + ".jar"); Promise<File> promise = getIndex().get(bsn, version, target); if (promise == null) return null; if (listeners.length == 0) { return promise.getValue(); } new DownloadListenerPromise(reporter, "Download " + bsn + "-" + version + " into " + config.name(), promise, listeners); return target; }