@Test public void testGetForeignSources() throws Exception { FileSystemBuilder bldr = new FileSystemBuilder("target", "testGetForeignSources"); File fsDir = bldr.dir("foreignSource").file("test.xml", fs("test")).pop(); File reqDir = bldr.dir("requisitions").file("test.xml").file("pending.xml").pop(); FasterFilesystemForeignSourceRepository repo = repo(fsDir, reqDir); Set<ForeignSource> foreignSources = repo.getForeignSources(); assertEquals(1, foreignSources.size()); ForeignSource testFS = foreignSources.iterator().next(); assertEquals("test", testFS.getName()); assertEquals(Duration.standardDays(1), testFS.getScanInterval()); }
public Set<ForeignSource> getForeignSources() throws ForeignSourceRepositoryException { m_readLock.lock(); try { Set<ForeignSource> foreignSources = new LinkedHashSet<ForeignSource>(); for(String baseName : m_foreignSources.getBaseNamesWithExtension(".xml")) { try { ForeignSource contents = m_foreignSources.getContents(baseName+".xml"); foreignSources.add(contents); } catch (FileNotFoundException e) { LogUtils.infof(this, e, "Unable to load foreignSource %s: It must have been deleted by another thread", baseName); } } return foreignSources; } finally { m_readLock.unlock(); } }
FasterFilesystemForeignSourceRepository extends AbstractForeignSourceRepository implements InitializingBean { public Set<ForeignSource> getForeignSources() throws ForeignSourceRepositoryException { m_readLock.lock(); try { Set<ForeignSource> foreignSources = new LinkedHashSet<ForeignSource>(); for(String baseName : m_foreignSources.getBaseNamesWithExtension(".xml")) { try { ForeignSource contents = m_foreignSources.getContents(baseName+".xml"); foreignSources.add(contents); } catch (FileNotFoundException e) { LogUtils.infof(this, e, "Unable to load foreignSource %s: It must have been deleted by another thread", baseName); } } return foreignSources; } finally { m_readLock.unlock(); } } }
FasterFilesystemForeignSourceRepository extends AbstractForeignSourceRepository implements InitializingBean { public Set<ForeignSource> getForeignSources() throws ForeignSourceRepositoryException { m_readLock.lock(); try { Set<ForeignSource> foreignSources = new LinkedHashSet<ForeignSource>(); for(String baseName : m_foreignSources.getBaseNamesWithExtension(".xml")) { try { ForeignSource contents = m_foreignSources.getContents(baseName+".xml"); foreignSources.add(contents); } catch (FileNotFoundException e) { LogUtils.infof(this, e, "Unable to load foreignSource %s: It must have been deleted by another thread", baseName); } } return foreignSources; } finally { m_readLock.unlock(); } } FasterFilesystemForeignSourceRepository(); }
FasterFilesystemForeignSourceRepository extends AbstractForeignSourceRepository implements InitializingBean { public Set<ForeignSource> getForeignSources() throws ForeignSourceRepositoryException { m_readLock.lock(); try { Set<ForeignSource> foreignSources = new LinkedHashSet<ForeignSource>(); for(String baseName : m_foreignSources.getBaseNamesWithExtension(".xml")) { try { ForeignSource contents = m_foreignSources.getContents(baseName+".xml"); foreignSources.add(contents); } catch (FileNotFoundException e) { LogUtils.infof(this, e, "Unable to load foreignSource %s: It must have been deleted by another thread", baseName); } } return foreignSources; } finally { m_readLock.unlock(); } } FasterFilesystemForeignSourceRepository(); @Override void afterPropertiesSet(); Set<String> getActiveForeignSourceNames(); int getForeignSourceCount(); Set<ForeignSource> getForeignSources(); ForeignSource getForeignSource(final String foreignSourceName); void save(final ForeignSource foreignSource); void delete(final ForeignSource foreignSource); Set<Requisition> getRequisitions(); Requisition getRequisition(final String foreignSourceName); Requisition getRequisition(final ForeignSource foreignSource); void save(final Requisition requisition); void delete(final Requisition requisition); void setRequisitionPath(final String path); void setForeignSourcePath(final String path); @Override Date getRequisitionDate(final String foreignSource); @Override URL getRequisitionURL(final String foreignSource); @Override void flush(); }
FasterFilesystemForeignSourceRepository extends AbstractForeignSourceRepository implements InitializingBean { public Set<ForeignSource> getForeignSources() throws ForeignSourceRepositoryException { m_readLock.lock(); try { Set<ForeignSource> foreignSources = new LinkedHashSet<ForeignSource>(); for(String baseName : m_foreignSources.getBaseNamesWithExtension(".xml")) { try { ForeignSource contents = m_foreignSources.getContents(baseName+".xml"); foreignSources.add(contents); } catch (FileNotFoundException e) { LogUtils.infof(this, e, "Unable to load foreignSource %s: It must have been deleted by another thread", baseName); } } return foreignSources; } finally { m_readLock.unlock(); } } FasterFilesystemForeignSourceRepository(); @Override void afterPropertiesSet(); Set<String> getActiveForeignSourceNames(); int getForeignSourceCount(); Set<ForeignSource> getForeignSources(); ForeignSource getForeignSource(final String foreignSourceName); void save(final ForeignSource foreignSource); void delete(final ForeignSource foreignSource); Set<Requisition> getRequisitions(); Requisition getRequisition(final String foreignSourceName); Requisition getRequisition(final ForeignSource foreignSource); void save(final Requisition requisition); void delete(final Requisition requisition); void setRequisitionPath(final String path); void setForeignSourcePath(final String path); @Override Date getRequisitionDate(final String foreignSource); @Override URL getRequisitionURL(final String foreignSource); @Override void flush();  }