1 package com.daffodilwoods.daffodildb.server.datasystem.indexsystem; 2 3 import com.daffodilwoods.daffodildb.server.datasystem.interfaces.*; 4 import com.daffodilwoods.database.resource.DException; 5 import com.daffodilwoods.database.general.QualifiedIdentifier; 6 import java.util.*; 7 public class IndexDatabaseUser implements _DatabaseUser { 8 9 private _DatabaseUser user; 10 private ArrayList tablesList; 11 private IndexDatabase indexDatabase; 12 13 public IndexDatabaseUser(_DatabaseUser user0,IndexDatabase indexDatabase0) { 14 user = user0; 15 indexDatabase = indexDatabase0; 16 tablesList = new ArrayList(); 17 } 18 19 public boolean writeToFile() throws DException { 20 return user.writeToFile(); 21 } 22 23 public void rollback() throws DException { 24 QualifiedIdentifier[] tableNames = (QualifiedIdentifier[])getTableNames().toArray(new QualifiedIdentifier[0]); 25 user.rollback(); 26 for(int i = 0,len = tableNames.length ; i < len ; i++){ 27 ColumnObjectsTable table = (ColumnObjectsTable)indexDatabase.getTable(tableNames[i]); 28 table.rollback(); 29 } 30 } 31 32 33 public ArrayList getTableNames() throws DException{ 34 return tablesList; 35 } 36 37 public void releaseCluster() throws com.daffodilwoods.database.resource.DException { 38 user.releaseCluster(); 39 } 40 41 public void addCluster(Object cluster)throws DException{ 42 user.addCluster(cluster); 43 } 44 45 public void addTable(QualifiedIdentifier parm1) throws DException{ 46 tablesList.add(parm1); 47 ColumnObjectsTable indexTable = (ColumnObjectsTable)indexDatabase.getTable(parm1); 48 _IndexInformation[] iinfs = indexTable.getIndexInformations(); 49 for (int i = 0; i < iinfs.length; i++) { 50 user.addTable(iinfs[i].getIndexTableName()); 51 } 52 } 53 54 public final void removeCluster(Object clusterCC) throws DException{ 55 user.removeCluster(clusterCC); 56 } 57 58 public boolean writeToFileWithLock() throws DException{ 59 return user.writeToFileWithLock(); 60 } 61 62 public int getSize() throws DException{ 63 return user.getSize(); 64 } 65 66 67 } 68 | Popular Tags |