1 7 8 package org.enhydra.snapper.business; 9 10 11 import org.enhydra.dods.DODS; 12 import org.enhydra.dods.DODSException; 13 import org.enhydra.snapper.SnapperManager; 14 import org.enhydra.snapper.spec.Index; 15 import org.enhydra.snapper.spec.IndexAll; 16 import org.enhydra.snapper.spec.IndexFactory; 17 18 import com.lutris.appserver.server.sql.DatabaseManager; 19 20 21 23 29 30 public class IndexAllImpl implements IndexAll, Runnable { 31 32 private String [] ids; 33 private DatabaseManager dbm; 34 35 public void run(){ 36 try { 37 for (int numSites = 0; numSites < ids.length; numSites++) { 38 try{ 39 Index index = IndexFactory.getIndex("org.enhydra.snapper.business.IndexImpl"); 40 String id = ids[numSites]; 41 index.index(id, dbm); 42 SnapperManager.getInstance().addThread(id, index); 43 44 DatabaseManager tempDbManager = DODS.getDatabaseManager(Thread.currentThread()); 45 new Thread ((Runnable ) index, id).run(); 46 DODS.register(Thread.currentThread(),tempDbManager); 47 48 } catch (Exception e){SnapperManager.getInstance().getLoggingManager().error("Could not index site");} 49 } 50 } finally { 51 try { 52 DODS.unregister(Thread.currentThread()); 53 } catch (DODSException e) { 54 e.printStackTrace(); 55 } 56 } 57 } 58 59 public void stop(){}; 60 61 public IndexAllImpl() { 62 } 63 64 public void index(String [] ids, DatabaseManager dbm){ 65 this.ids = ids; 66 this.dbm = dbm; 67 } 68 69 } | Popular Tags |