KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > daffodilwoods > daffodildb > server > sessionsystem > RowIdFetcher


1 package com.daffodilwoods.daffodildb.server.sessionsystem;
2
3 import com.daffodilwoods.database.resource.*;
4 import com.daffodilwoods.database.general.*;
5 import com.daffodilwoods.daffodildb.server.datasystem.interfaces.*;
6 import java.util.*;
7 import com.daffodilwoods.daffodildb.utils.comparator.CTusjohDbtfJoTfotjujwfDpnqbsbups;
8 public class RowIdFetcher {
9   private _Database cacheDatabase;
10   private WeakOrderedKeyList tableRowIdGetterList = new WeakOrderedKeyList( new CTusjohDbtfJoTfotjujwfDpnqbsbups());
11   public RowIdFetcher( _Database cacheDatabase ) throws DException {
12     this.cacheDatabase = cacheDatabase;
13   }
14
15   /**
16    * Returns Table Row ids for a table <tableName>
17    */

18
19   public synchronized TableRowIdGetter getTableRowIdGetter( QualifiedIdentifier tableName ) throws DException {
20           TableRowIdGetter tableRowIdGetter = ( TableRowIdGetter ) tableRowIdGetterList.get(tableName.getIdentifier());
21           if( tableRowIdGetter != null )
22               return tableRowIdGetter;
23           _Table cacheTable = cacheDatabase.getTable( tableName);
24           tableRowIdGetter = new TableRowIdGetter( tableName.getIdentifier(), cacheTable );
25           tableRowIdGetterList.put( tableName.getIdentifier(), tableRowIdGetter );
26           return tableRowIdGetter;
27   }
28
29   public void removeTable(QualifiedIdentifier tableName) throws DException{
30      tableRowIdGetterList.remove(tableName.getIdentifier());
31   }
32
33 }
34
Popular Tags