void download(ResourceDescriptor rds, File path) throws Exception { logger.debug("starting download {}", path); Exception exception = new Exception(); event(TYPE.START_DOWNLOAD, rds, null); for (int i = 0; i < 3; sleep(3000), i++) try { download0(rds.url, path, rds.id); event(TYPE.END_DOWNLOAD, rds, null); logger.debug("succesful download {}", path); failures.remove(rds.url); return; } catch (FileNotFoundException e) { logger.debug("no such file download {}", path); exception = e; break; // no use retrying } catch (Exception e) { logger.debug("exception download {}", path); exception = e; } failures.put(rds.url, System.currentTimeMillis()); logger.debug("failed download {}", path, exception); event(TYPE.ERROR, rds, exception); event(TYPE.END_DOWNLOAD, rds, exception); throw exception; }
void download(ResourceDescriptor rds, File path) throws Exception { logger.debug("starting download {}", path); Exception exception = new Exception(); event(TYPE.START_DOWNLOAD, rds, null); for (int i = 0; i < 3; sleep(3000), i++) try { download0(rds.url, path, rds.id); event(TYPE.END_DOWNLOAD, rds, null); logger.debug("succesful download {}", path); failures.remove(rds.url); return; } catch (FileNotFoundException e) { logger.debug("no such file download {}", path); exception = e; break; // no use retrying } catch (Exception e) { logger.debug("exception download {}", path); exception = e; } failures.put(rds.url, System.currentTimeMillis()); logger.debug("failed download {}", path, exception); event(TYPE.ERROR, rds, exception); event(TYPE.END_DOWNLOAD, rds, exception); throw exception; }
/** * Delete a resource from the text file (not from the cache) */ void delete(byte[] id) throws Exception { for (Iterator<ResourceDescriptorImpl> i = getIndex().descriptors.iterator(); i.hasNext();) { ResourceDescriptorImpl d = i.next(); if (Arrays.equals(id, d.id)) { i.remove(); logger.debug("removing resource {} from index", d); event(TYPE.REMOVE, d, null); setDirty(); } } save(); }
/** * Delete a resource from the text file (not from the cache) */ void delete(byte[] id) throws Exception { for (Iterator<ResourceDescriptorImpl> i = getIndex().descriptors.iterator(); i.hasNext();) { ResourceDescriptorImpl d = i.next(); if (Arrays.equals(id, d.id)) { i.remove(); logger.debug("removing resource {} from index", d); event(TYPE.REMOVE, d, null); setDirty(); } } save(); }
/** * Delete a resource from the text file (not from the cache) */ void delete(byte[] id) throws Exception { for (Iterator<ResourceDescriptorImpl> i = getIndex().descriptors.iterator(); i.hasNext();) { ResourceDescriptorImpl d = i.next(); if (Arrays.equals(id, d.id)) { i.remove(); reporter.trace("removing resource %s from index", d); event(TYPE.REMOVE, d, null); setDirty(); } } save(); }
/** * Delete a resource from the text file (not from the cache) */ void delete(byte[] id) throws Exception { for (Iterator<ResourceDescriptorImpl> i = getIndex().descriptors.iterator(); i.hasNext();) { ResourceDescriptorImpl d = i.next(); if (Arrays.equals(id, d.id)) { i.remove(); reporter.trace("removing resource %s from index", d); event(TYPE.REMOVE, d, null); setDirty(); } } save(); }
void download(ResourceDescriptor rds, File path) throws Exception { reporter.trace("starting download %s", path); Exception exception = new Exception(); event(TYPE.START_DOWNLOAD, rds, null); for (int i = 0; i < 3; sleep(3000), i++) try { download0(rds.url, path, rds.id); event(TYPE.END_DOWNLOAD, rds, null); reporter.trace("succesful download %s", path); failures.remove(rds.url); return; } catch (FileNotFoundException e) { reporter.trace("no such file download %s", path); exception = e; break; // no use retrying } catch (Exception e) { reporter.trace("exception download %s", path); exception = e; } failures.put(rds.url, System.currentTimeMillis()); reporter.trace("failed download %s", path); event(TYPE.ERROR, rds, exception); event(TYPE.END_DOWNLOAD, rds, exception); throw exception; }
void download(ResourceDescriptor rds, File path) throws Exception { reporter.trace("starting download %s", path); Exception exception = new Exception(); event(TYPE.START_DOWNLOAD, rds, null); for (int i = 0; i < 3; sleep(3000), i++) try { download0(rds.url, path, rds.id); event(TYPE.END_DOWNLOAD, rds, null); reporter.trace("succesful download %s", path); failures.remove(rds.url); return; } catch (FileNotFoundException e) { reporter.trace("no such file download %s", path); exception = e; break; // no use retrying } catch (Exception e) { reporter.trace("exception download %s", path); exception = e; } failures.put(rds.url, System.currentTimeMillis()); reporter.trace("failed download %s", path); event(TYPE.ERROR, rds, exception); event(TYPE.END_DOWNLOAD, rds, exception); throw exception; }
/** * Add a resource descriptor to the index. */ @Override public boolean add(String repoId, ResourceDescriptor rd) throws Exception { ResourceDescriptorImpl rdi = getResourceDescriptor(rd.id); boolean add = false; if (rdi != null) { add = true; logger.debug("adding repo {} to resource {} to index", repoId, rdi); } else { rdi = new ResourceDescriptorImpl(rd); getIndex().descriptors.add(rdi); logger.debug("adding resource {} to index", rdi); } rdi.repositories.add(repoId); event(TYPE.ADD, rdi, null); setDirty(); save(); return add; }
/** * Add a resource descriptor to the index. */ @Override public boolean add(String repoId, ResourceDescriptor rd) throws Exception { ResourceDescriptorImpl rdi = getResourceDescriptor(rd.id); boolean add = false; if (rdi != null) { add = true; logger.debug("adding repo {} to resource {} to index", repoId, rdi); } else { rdi = new ResourceDescriptorImpl(rd); getIndex().descriptors.add(rdi); logger.debug("adding resource {} to index", rdi); } rdi.repositories.add(repoId); event(TYPE.ADD, rdi, null); setDirty(); save(); return add; }
/** * Add a resource descriptor to the index. */ public boolean add(String repoId, ResourceDescriptor rd) throws Exception { ResourceDescriptorImpl rdi = getResourceDescriptor(rd.id); boolean add = false; if (rdi != null) { add = true; reporter.trace("adding repo %s to resource %s to index", repoId, rdi); } else { rdi = new ResourceDescriptorImpl(rd); getIndex().descriptors.add(rdi); reporter.trace("adding resource %s to index", rdi); } rdi.repositories.add(repoId); event(TYPE.ADD, rdi, null); setDirty(); save(); return add; }
/** * Add a resource descriptor to the index. */ public boolean add(String repoId, ResourceDescriptor rd) throws Exception { ResourceDescriptorImpl rdi = getResourceDescriptor(rd.id); boolean add = false; if (rdi != null) { add = true; reporter.trace("adding repo %s to resource %s to index", repoId, rdi); } else { rdi = new ResourceDescriptorImpl(rd); getIndex().descriptors.add(rdi); reporter.trace("adding resource %s to index", rdi); } rdi.repositories.add(repoId); event(TYPE.ADD, rdi, null); setDirty(); save(); return add; }