@Test public void testGetForeignSource() throws Exception { FileSystemBuilder bldr = new FileSystemBuilder("target", "testGetForeignSource"); File fsDir = bldr.dir("foreignSource").file("test.xml", fs("test")).file("noreq.xml", fs("noreq")).pop(); File reqDir = bldr.dir("requisitions").file("test.xml").file("pending.xml").pop(); FasterFilesystemForeignSourceRepository repo = repo(fsDir, reqDir); ForeignSource testFS = repo.getForeignSource("test"); assertEquals("test", testFS.getName()); assertEquals(Duration.standardDays(1), testFS.getScanInterval()); }
public ForeignSource getForeignSource(final String foreignSourceName) throws ForeignSourceRepositoryException { if (foreignSourceName == null) { throw new ForeignSourceRepositoryException("can't get a foreign source with a null name!"); } m_readLock.lock(); try { return m_foreignSources.getContents(foreignSourceName+".xml"); } catch (FileNotFoundException e) { final ForeignSource fs = getDefaultForeignSource(); fs.setName(foreignSourceName); return fs; } finally { m_readLock.unlock(); } }
FasterFilesystemForeignSourceRepository extends AbstractForeignSourceRepository implements InitializingBean { public ForeignSource getForeignSource(final String foreignSourceName) throws ForeignSourceRepositoryException { if (foreignSourceName == null) { throw new ForeignSourceRepositoryException("can't get a foreign source with a null name!"); } m_readLock.lock(); try { return m_foreignSources.getContents(foreignSourceName+".xml"); } catch (FileNotFoundException e) { final ForeignSource fs = getDefaultForeignSource(); fs.setName(foreignSourceName); return fs; } finally { m_readLock.unlock(); } } }
FasterFilesystemForeignSourceRepository extends AbstractForeignSourceRepository implements InitializingBean { public ForeignSource getForeignSource(final String foreignSourceName) throws ForeignSourceRepositoryException { if (foreignSourceName == null) { throw new ForeignSourceRepositoryException("can't get a foreign source with a null name!"); } m_readLock.lock(); try { return m_foreignSources.getContents(foreignSourceName+".xml"); } catch (FileNotFoundException e) { final ForeignSource fs = getDefaultForeignSource(); fs.setName(foreignSourceName); return fs; } finally { m_readLock.unlock(); } } FasterFilesystemForeignSourceRepository(); }
FasterFilesystemForeignSourceRepository extends AbstractForeignSourceRepository implements InitializingBean { public ForeignSource getForeignSource(final String foreignSourceName) throws ForeignSourceRepositoryException { if (foreignSourceName == null) { throw new ForeignSourceRepositoryException("can't get a foreign source with a null name!"); } m_readLock.lock(); try { return m_foreignSources.getContents(foreignSourceName+".xml"); } catch (FileNotFoundException e) { final ForeignSource fs = getDefaultForeignSource(); fs.setName(foreignSourceName); return fs; } 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 ForeignSource getForeignSource(final String foreignSourceName) throws ForeignSourceRepositoryException { if (foreignSourceName == null) { throw new ForeignSourceRepositoryException("can't get a foreign source with a null name!"); } m_readLock.lock(); try { return m_foreignSources.getContents(foreignSourceName+".xml"); } catch (FileNotFoundException e) { final ForeignSource fs = getDefaultForeignSource(); fs.setName(foreignSourceName); return fs; } 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();  }