Update of /cvsroot/archive-access/archive-access/projects/wayback/src/java/org/archive/wayback/localbdbresourceindex In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv901/src/java/org/archive/wayback/localbdbresourceindex Modified Files: BDBResourceIndexWriter.java LocalBDBResourceIndex.java BDBResourceIndex.java Log Message: lots of javadoc comments Index: BDBResourceIndex.java =================================================================== RCS file: /cvsroot/archive-access/archive-access/projects/wayback/src/java/org/archive/wayback/localbdbresourceindex/BDBResourceIndex.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BDBResourceIndex.java 18 Oct 2005 02:30:50 -0000 1.1 --- BDBResourceIndex.java 19 Oct 2005 01:22:37 -0000 1.2 *************** *** 1,2 **** --- 1,25 ---- + /* BDBResourceIndex + * + * Created on 2005/10/18 14:00:00 + * + * Copyright (C) 2005 Internet Archive. + * + * This file is part of the Wayback Machine (crawler.archive.org). + * + * Wayback Machine is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * any later version. + * + * Wayback Machine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser Public License for more details. + * + * You should have received a copy of the GNU Lesser Public License + * along with Wayback Machine; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + package org.archive.wayback.localbdbresourceindex; *************** *** 8,21 **** import org.archive.wayback.core.ResourceResults; ! //import com.sleepycat.bind.tuple.TupleBinding; ! //import com.sleepycat.bind.tuple.TupleInput; ! //import com.sleepycat.bind.tuple.TupleOutput; import com.sleepycat.je.Cursor; ! //import com.sleepycat.je.CursorConfig; import com.sleepycat.je.Database; import com.sleepycat.je.DatabaseConfig; import com.sleepycat.je.DatabaseEntry; import com.sleepycat.je.DatabaseException; ! //import com.sleepycat.je.DatabaseNotFoundException; import com.sleepycat.je.Environment; import com.sleepycat.je.EnvironmentConfig; --- 31,44 ---- import org.archive.wayback.core.ResourceResults; ! // import com.sleepycat.bind.tuple.TupleBinding; ! // import com.sleepycat.bind.tuple.TupleInput; ! // import com.sleepycat.bind.tuple.TupleOutput; import com.sleepycat.je.Cursor; ! // import com.sleepycat.je.CursorConfig; import com.sleepycat.je.Database; import com.sleepycat.je.DatabaseConfig; import com.sleepycat.je.DatabaseEntry; import com.sleepycat.je.DatabaseException; ! // import com.sleepycat.je.DatabaseNotFoundException; import com.sleepycat.je.Environment; import com.sleepycat.je.EnvironmentConfig; *************** *** 23,26 **** --- 46,55 ---- import com.sleepycat.je.OperationStatus; + /** + * ResourceResults-specific wrapper on top of the BDBJE database. + * + * @author Brad Tofel + * @version $Date$, $Revision$ + */ public class BDBResourceIndex { private String path; *************** *** 32,37 **** Database db = null; ! // Cursor cursor = null; public BDBResourceIndex(final String thePath, final String theDbName) throws Exception { --- 61,75 ---- Database db = null; ! // Cursor cursor = null; + /** + * Constructor + * + * @param thePath + * directory where BDBJE files are stored + * @param theDbName + * name of BDB database + * @throws Exception + */ public BDBResourceIndex(final String thePath, final String theDbName) throws Exception { *************** *** 84,88 **** LockMode.DEFAULT); while (status == OperationStatus.SUCCESS) { ! // String keyString = new String(key.getData()); String valueString = new String(value.getData()); --- 122,126 ---- LockMode.DEFAULT); while (status == OperationStatus.SUCCESS) { ! // String keyString = new String(key.getData()); String valueString = new String(value.getData()); *************** *** 108,112 **** dbe.printStackTrace(); } catch (ParseException e) { - // TODO Auto-generated catch block e.printStackTrace(); } --- 146,149 ---- *************** *** 152,156 **** dbe.printStackTrace(); } catch (ParseException e) { - // TODO Auto-generated catch block e.printStackTrace(); } --- 189,192 ---- *************** *** 179,183 **** cursor.close(); } catch (DatabaseException e) { - // TODO Auto-generated catch block e.printStackTrace(); } --- 215,218 ---- *************** *** 188,192 **** */ public static void main(String[] args) { - // TODO Auto-generated method stub } --- 223,226 ---- Index: BDBResourceIndexWriter.java =================================================================== RCS file: /cvsroot/archive-access/archive-access/projects/wayback/src/java/org/archive/wayback/localbdbresourceindex/BDBResourceIndexWriter.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** BDBResourceIndexWriter.java 18 Oct 2005 02:30:50 -0000 1.1 --- BDBResourceIndexWriter.java 19 Oct 2005 01:22:37 -0000 1.2 *************** *** 1,2 **** --- 1,25 ---- + /* BDBResourceIndexWriter + * + * Created on 2005/10/18 14:00:00 + * + * Copyright (C) 2005 Internet Archive. + * + * This file is part of the Wayback Machine (crawler.archive.org). + * + * Wayback Machine is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * any later version. + * + * Wayback Machine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser Public License for more details. + * + * You should have received a copy of the GNU Lesser Public License + * along with Wayback Machine; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + package org.archive.wayback.localbdbresourceindex; *************** *** 9,18 **** import com.sleepycat.je.DatabaseException; public class BDBResourceIndexWriter { private BDBResourceIndex db = null; public BDBResourceIndexWriter() { super(); - // TODO Auto-generated constructor stub } --- 32,49 ---- import com.sleepycat.je.DatabaseException; + /** + * Implements updates to a BDBResourceIndex + * + * @author Brad Tofel + * @version $Date$, $Revision$ + */ public class BDBResourceIndexWriter { private BDBResourceIndex db = null; + /** + * Constructor + */ public BDBResourceIndexWriter() { super(); } *************** *** 30,33 **** --- 61,72 ---- } + /** + * reads all ResourceResult objects from CDX at filePath, and merges them + * into the BDBResourceIndex. + * + * @param filePath + * to CDX file + * @throws Exception + */ public void importFile(String filePath) throws Exception { ResourceResults results = readFile(filePath); *************** *** 68,72 **** idx.shutdown(); } catch (Exception e) { - // TODO Auto-generated catch block e.printStackTrace(); } --- 107,110 ---- Index: LocalBDBResourceIndex.java =================================================================== RCS file: /cvsroot/archive-access/archive-access/projects/wayback/src/java/org/archive/wayback/localbdbresourceindex/LocalBDBResourceIndex.java,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** LocalBDBResourceIndex.java 18 Oct 2005 02:30:50 -0000 1.1 --- LocalBDBResourceIndex.java 19 Oct 2005 01:22:37 -0000 1.2 *************** *** 1,2 **** --- 1,25 ---- + /* LocalBDBResourceIndex + * + * Created on 2005/10/18 14:00:00 + * + * Copyright (C) 2005 Internet Archive. + * + * This file is part of the Wayback Machine (crawler.archive.org). + * + * Wayback Machine is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * any later version. + * + * Wayback Machine is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser Public License for more details. + * + * You should have received a copy of the GNU Lesser Public License + * along with Wayback Machine; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + package org.archive.wayback.localbdbresourceindex; *************** *** 12,15 **** --- 35,44 ---- import org.archive.wayback.exception.WaybackException; + /** + * Implements ResourceIndex interface using a BDBResourceIndex + * + * @author Brad Tofel + * @version $Date$, $Revision$ + */ public class LocalBDBResourceIndex implements ResourceIndex { private static Thread indexUpdateThread = null; *************** *** 29,32 **** --- 58,64 ---- private BDBResourceIndex db = null; + /** + * Constructor + */ public LocalBDBResourceIndex() { super(); *************** *** 56,60 **** if (runPipeline != null) { - // QUESTION: are we sure there will be a single instace System.out .println("LocalDBDResourceIndex starting pipeline thread..."); --- 88,91 ---- *************** *** 70,74 **** public ResourceResults query(WMRequest request) throws IOException, WaybackException { - // TODO add check of WMRequest and call different methods: String searchHost = request.getRequestURI().getHostBasename(); String searchPath = request.getRequestURI().getEscapedPathQuery(); --- 101,104 ---- *************** *** 102,105 **** --- 132,142 ---- } + /** + * Thread that repeatedly runs processing of an IndexPipeline and merges new + * data into a BDBResourceIndex + * + * @author Brad Tofel + * @version $Date$, $Revision$ + */ private class IndexUpdateThread extends Thread { private final static int SLEEP_MILLISECONDS = 10000; *************** *** 109,112 **** --- 146,157 ---- IndexPipeline pipeline = null; + /** + * Constructor + * + * @param bdb + * initialized BDBResourceIndex + * @param pipeline + * initialized IndexPipeline + */ public IndexUpdateThread(final BDBResourceIndex bdb, IndexPipeline pipeline) { *************** *** 126,130 **** sleep(SLEEP_MILLISECONDS); } catch (InterruptedException e) { - // TODO Auto-generated catch block e.printStackTrace(); } --- 171,174 ---- *************** *** 138,142 **** // System.out.println("Indexed..."); } catch (IOException e) { - // TODO Auto-generated catch block e.printStackTrace(); } --- 182,185 ---- *************** *** 145,152 **** private void mergeIndex() { int numMerged = 0; ! String newFiles[] = pipeline.mergeDir.list(); for (int i = 0; i < newFiles.length; i++) { // TODO: Special handling of encoding and date. ! File newFile = new File(pipeline.mergeDir.getAbsolutePath() + "/" + newFiles[i]); --- 188,196 ---- private void mergeIndex() { int numMerged = 0; ! String newFiles[] = pipeline.getMergeDir().list(); for (int i = 0; i < newFiles.length; i++) { // TODO: Special handling of encoding and date. ! File newFile = new File(pipeline.getMergeDir() ! .getAbsolutePath() + "/" + newFiles[i]); *************** *** 160,164 **** numMerged++; } catch (Exception e) { - // TODO Auto-generated catch block e.printStackTrace(); } --- 204,207 ---- *************** *** 170,180 **** } } - - /** - * @param args - */ - public static void main(String[] args) { - // TODO Auto-generated method stub - - } } --- 213,215 ---- |