Revision: 1787 http://archive-access.svn.sourceforge.net/archive-access/?rev=1787&view=rev Author: bradtofel Date: 2007-07-16 16:21:27 -0700 (Mon, 16 Jul 2007) Log Message: ----------- REFACTOR: now uses empty constructor and getters and setters for Spring TWEAK: now uses CaptureSearchResults and UrlSearchResults as appropriate. Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/bdb/BDBIndex.java Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/bdb/BDBIndex.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/bdb/BDBIndex.java 2007-07-16 23:19:43 UTC (rev 1786) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/bdb/BDBIndex.java 2007-07-16 23:21:27 UTC (rev 1787) @@ -33,8 +33,9 @@ import org.archive.wayback.WaybackConstants; import org.archive.wayback.bdb.BDBRecordSet; +import org.archive.wayback.core.CaptureSearchResults; import org.archive.wayback.core.SearchResult; -import org.archive.wayback.core.SearchResults; +import org.archive.wayback.exception.ConfigurationException; import org.archive.wayback.exception.ResourceIndexNotAvailableException; import org.archive.wayback.resourceindex.SearchResultSource; import org.archive.wayback.resourceindex.indexer.ArcIndexer; @@ -50,6 +51,20 @@ * @version $Date$, $Revision$ */ public class BDBIndex extends BDBRecordSet implements SearchResultSource { + private String bdbPath = null; + private String bdbName = null; + private BDBIndexUpdater updater = null; + /** + * @throws DatabaseException + * @throws ConfigurationException + */ + public void init() throws DatabaseException, ConfigurationException { + initializeDB(bdbPath,bdbName); + if(updater != null) { + updater.setIndex(this); + updater.startup(); + } + } private CloseableIterator adaptIterator(Iterator itr) { return new AdaptedIterator(itr,new BDBRecordToSearchResultAdapter()); @@ -128,7 +143,7 @@ if(op.compareTo("-r") == 0) { PrintWriter pw = new PrintWriter(System.out); - SearchResults results = new SearchResults(); + CaptureSearchResults results = new CaptureSearchResults(); if(args.length == 4) { String prefix = args[3]; CloseableIterator itr = null; @@ -152,7 +167,7 @@ e.printStackTrace(); System.exit(2); } - results = new SearchResults(); + results = new CaptureSearchResults(); } } if(results.getResultCount() > 0) { @@ -181,7 +196,7 @@ e.printStackTrace(); System.exit(2); } - results = new SearchResults(); + results = new CaptureSearchResults(); } } if(results.getResultCount() > 0) { @@ -244,4 +259,42 @@ USAGE(); } } + /** + * @return the bdbPath + */ + public String getBdbPath() { + return bdbPath; + } + /** + * @param bdbPath the bdbPath to set + */ + public void setBdbPath(String bdbPath) { + this.bdbPath = bdbPath; + } + /** + * @return the bdbName + */ + public String getBdbName() { + return bdbName; + } + /** + * @param bdbName the bdbName to set + */ + public void setBdbName(String bdbName) { + this.bdbName = bdbName; + } + + /** + * @return the updater + */ + public BDBIndexUpdater getUpdater() { + return updater; + } + + /** + * @param updater the updater to set + */ + public void setUpdater(BDBIndexUpdater updater) { + this.updater = updater; + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
Revision: 2316 http://archive-access.svn.sourceforge.net/archive-access/?rev=2316&view=rev Author: bradtofel Date: 2008-06-24 17:16:59 -0700 (Tue, 24 Jun 2008) Log Message: ----------- REFACTOR: all update functionality was moved out into LocalResourceIndexUpdater class, so there are no longer dependencies from this class to the updater. Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/bdb/BDBIndex.java Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/bdb/BDBIndex.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/bdb/BDBIndex.java 2008-06-25 00:15:28 UTC (rev 2315) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/resourceindex/bdb/BDBIndex.java 2008-06-25 00:16:59 UTC (rev 2316) @@ -39,7 +39,6 @@ import org.archive.wayback.resourceindex.UpdatableSearchResultSource; import org.archive.wayback.resourceindex.cdx.CDXLineToSearchResultAdapter; import org.archive.wayback.resourceindex.cdx.SearchResultToCDXLineAdapter; -import org.archive.wayback.resourceindex.updater.BDBIndexUpdater; import org.archive.wayback.util.AdaptedIterator; import org.archive.wayback.util.Adapter; import org.archive.wayback.util.CloseableIterator; @@ -59,17 +58,12 @@ private String bdbPath = null; private String bdbName = null; - private BDBIndexUpdater updater = null; /** * @throws DatabaseException * @throws ConfigurationException */ public void init() throws DatabaseException, ConfigurationException { initializeDB(bdbPath,bdbName); - if(updater != null) { - updater.setIndex(this); - updater.startup(); - } } private CloseableIterator<SearchResult> adaptIterator( @@ -224,14 +218,6 @@ Iterator<SearchResult> itrSR = new AdaptedIterator<String,SearchResult>(itrS,adapterStoSR); -// Adapter<SearchResult,BDBRecord> adapterSRtoBDB = -// new SearchResultToBDBRecordAdapter(); -// -// Iterator<BDBRecord> itrBDB = -// new AdaptedIterator<SearchResult,BDBRecord>(itrSR, -// adapterSRtoBDB); -// -// index.insertRecords(itrBDB); try { index.addSearchResults(itrSR, canonicalizer); } catch (IOException e) { @@ -242,24 +228,28 @@ USAGE(); } } + /** * @return the bdbPath */ public String getBdbPath() { return bdbPath; } + /** * @param bdbPath the bdbPath to set */ public void setBdbPath(String bdbPath) { this.bdbPath = bdbPath; } + /** * @return the bdbName */ public String getBdbName() { return bdbName; } + /** * @param bdbName the bdbName to set */ @@ -267,20 +257,6 @@ this.bdbName = bdbName; } - /** - * @return the updater - */ - public BDBIndexUpdater getUpdater() { - return updater; - } - - /** - * @param updater the updater to set - */ - public void setUpdater(BDBIndexUpdater updater) { - this.updater = updater; - } - public void shutdown() throws IOException { try { shutdownDB(); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |