public static void addInformationCapability(ResourceBuilder rb, String name, String from, Throwable error) { addInformationCapability(rb, name, Version.LOWEST, from, error == null ? null : error.toString()); }
public Resource get(String bsn, Version version) throws Exception { ResourceInfo resourceInfo = getInfo(bsn, version); if (resourceInfo == null) return null; return resourceInfo.resource; }
BridgeRepository getBridge() { try { return bridge.getValue(); } catch (InvocationTargetException e) { reporter.exception(e.getTargetException(), "Getting bridge failed"); } catch (InterruptedException e) { logger.info("Interrupted"); Thread.currentThread() .interrupt(); } return new BridgeRepository(); }
String tooltip(Object[] target) throws Exception { String tooltip = getBridge().tooltip(target); switch (target.length) { case 2 : ResourceInfo info = getBridge().getInfo((String) target[0], (Version) target[1]); Archive archive = getArchive(info.getResource()); if (archive != null) { tooltip += "Coordinates: " + archive + "\n"; } } return tooltip; }
Map<Requirement, Collection<Capability>> findProviders(Collection<? extends Requirement> requirements) throws Exception { return getBridge().getRepository() .findProviders(requirements); } }
@Override public List<String> list(String pattern) throws Exception { init(); return bridge.list(pattern); }
private Promise<File> get(final String bsn, final Version version) throws Exception { logger.debug("{}: get {} {}", getName(), bsn, version); Resource resource = getBridge().get(bsn, version); if (resource == null) { logger.debug("{}: resource not found {} {}", getName(), bsn, version); return null; } ContentCapability content = ResourceUtils.getContentCapability(resource); if (content == null) { logger.warn("{}: No content capability for {}", getName(), resource); return null; } URI uri = content.url(); if (uri == null) { logger.warn("{}: No content URI for {}", getName(), resource); return null; } logger.debug("{}: get returning {}", getName(), uri); return promiseFactory.resolved(new File(uri)); }
@Override public String title(Object... target) throws Exception { init(); return bridge.title(target); }
@Override public String tooltip(Object... target) throws Exception { init(); return bridge.tooltip(target); }
public BridgeRepository(Repository repository) throws Exception { this.repository = repository; index(); }
Map<Requirement, Collection<Capability>> findProviders(Collection<? extends Requirement> requirements) throws Exception { return getBridge().getRepository() .findProviders(requirements); } }
String tooltip(Object[] target) throws Exception { String tooltip = getBridge().tooltip(target); switch (target.length) { case 2 : ResourceInfo info = getBridge().getInfo((String) target[0], (Version) target[1]); Archive archive = getArchive(info.getResource()); if (archive != null) { tooltip += "Coordinates: " + archive + "\n"; } } return tooltip; }
@Override public List<String> list(String pattern) throws Exception { init(); return bridge.list(pattern); }
private Promise<File> get(final String bsn, final Version version) throws Exception { logger.debug("{}: get {} {}", getName(), bsn, version); Resource resource = getBridge().get(bsn, version); if (resource == null) { logger.debug("{}: resource not found {} {}", getName(), bsn, version); return null; } ContentCapability content = ResourceUtils.getContentCapability(resource); if (content == null) { logger.warn("{}: No content capability for {}", getName(), resource); return null; } URI uri = content.url(); if (uri == null) { logger.warn("{}: No content URI for {}", getName(), resource); return null; } logger.debug("{}: get returning {}", getName(), uri); return promiseFactory.resolved(new File(uri)); }
@Override public String title(Object... target) throws Exception { init(); return bridge.title(target); }
@Override public String tooltip(Object... target) throws Exception { init(); return bridge.tooltip(target); }
public BridgeRepository(Repository repository) throws Exception { this.repository = repository; index(); }
public Resource get(String bsn, Version version) throws Exception { ResourceInfo resourceInfo = getInfo(bsn, version); if (resourceInfo == null) return null; return resourceInfo.resource; }