DbStorage.manager
Class DictionaryManager

java.lang.Object
  extended byDbStorage.manager.DictionaryManager

public final class DictionaryManager
extends java.lang.Object

This class manages the content of the dictionary. The dictionary collection is implemented using 4 data structures combined in one, 2 AA-trees and 2 double linked list are used, for ordering the collection by identificator and ssd-table name.


Constructor Summary
DictionaryManager()
           
 
Method Summary
static boolean contains(DbStorageManager dbsm, long transactionNumber, DbUnitAddress header, DictionaryEntry entry)
          Checks if a specified dictionary entry belongs to the collection.
static boolean contains(DbStorageManager dbsm, long transactionNumber, DbUnitAddress header, java.lang.String entryName, PhysicalID entryID)
          Checks if a specified dictionary entry belongs to the collection.
static boolean containsID(DbStorageManager dbsm, long transactionNumber, DbUnitAddress header, PhysicalID matchID)
          Checks if a specified identifier is in some dictionary entry in the collection.
static boolean containsName(DbStorageManager dbsm, long transactionNumber, DbUnitAddress header, java.lang.String matchName)
          Checks if a specified nameed is in some dictionary entry in the collection.
static void delete(DbStorageManager dbsm, long transactionNumber, DbUnitAddress header, DictionaryEntry entry)
          Deletes a specified dictionary entry from the collection.
static void delete(DbStorageManager dbsm, long transactionNumber, DbUnitAddress header, java.lang.String entryName, PhysicalID entryID)
          Deletes a specified dictionary entry from the collection.
static void deleteID(DbStorageManager dbsm, long transactionNumber, DbUnitAddress header, PhysicalID deletedID)
          Deletes a specified dictionary entry from the collection.
static void deleteName(DbStorageManager dbsm, long transactionNumber, DbUnitAddress header, java.lang.String deletedName)
          Deletes a specified dictionary entry from the collection.
static void formatHeader(DbStorageManager dbsm, long transactionNumber, DbUnitAddress header)
          Sets the initial values for the dictionary header.
static DictionaryEntry getDictionaryEntryFromNode(DbStorageManager dbsm, long transactionNumber, DbUnitAddress nodeAddress)
          Returns the dictionary entry of a specified node of the collection.
static void getFirstWithID(DbStorageManager dbsm, long transactionNumber, DbUnitAddress header, PhysicalID matchID, DbUnitAddress destiny)
          Finds the first node in the collection with the specified identifier.
static void getID(DbStorageManager dbsm, long transactionNumber, DbUnitAddress header, java.lang.String matchName, PhysicalID id)
          Finds the first identifier in the collection with the specified name.
static java.lang.String getNameFromNode(DbStorageManager dbsm, long transactionNumber, DbUnitAddress nodeAddress)
          Returns the name of a specified node of the collection.
static void insert(DbStorageManager dbsm, long transactionNumber, DbUnitAddress header, DictionaryEntry entry)
          Inserts a specified dictionary entry to the collection.
static void insert(DbStorageManager dbsm, long transactionNumber, DbUnitAddress header, java.lang.String entryName, PhysicalID entryID)
          Inserts a specified dictionary entry to the collection.
static void remove(DbStorageManager dbsm, long transactionNumber, DbUnitAddress header, DbUnitAddress node)
          Removes a specified node from the dictionary collection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DictionaryManager

public DictionaryManager()
Method Detail

formatHeader

public static void formatHeader(DbStorageManager dbsm,
                                long transactionNumber,
                                DbUnitAddress header)
                         throws storage.StorageException,
                                java.io.IOException
Sets the initial values for the dictionary header.

Parameters:
dbsm - The data base storage manager where the operation will be performed.
transactionNumber - The number of transaction.
header - The address of the dictionary header.
Throws:
storage.StorageException
java.io.IOException

getNameFromNode

public static java.lang.String getNameFromNode(DbStorageManager dbsm,
                                               long transactionNumber,
                                               DbUnitAddress nodeAddress)
                                        throws storage.StorageException,
                                               java.io.IOException
Returns the name of a specified node of the collection.

Parameters:
dbsm - The data base storage manager where the operation will be performed.
transactionNumber - The number of transaction.
nodeAddress - The addres of the node in the DICTIONARY segment.
Returns:
The name in a String object.
Throws:
storage.StorageException
java.io.IOException

getDictionaryEntryFromNode

public static DictionaryEntry getDictionaryEntryFromNode(DbStorageManager dbsm,
                                                         long transactionNumber,
                                                         DbUnitAddress nodeAddress)
                                                  throws storage.StorageException,
                                                         java.io.IOException
Returns the dictionary entry of a specified node of the collection.

Parameters:
dbsm - The data base storage manager where the operation will be performed.
transactionNumber - The number of transaction.
nodeAddress - The addres of the node in the DICTIONARY segment.
Returns:
The dictionary entry in a DictionaryEntry onject.
Throws:
storage.StorageException
java.io.IOException

remove

public static void remove(DbStorageManager dbsm,
                          long transactionNumber,
                          DbUnitAddress header,
                          DbUnitAddress node)
                   throws storage.StorageException,
                          java.io.IOException
Removes a specified node from the dictionary collection.

Parameters:
dbsm - The data base storage manager where the operation will be performed.
transactionNumber - The number of transaction.
header - The address of the dictionary header.
node - The node to remove.
Throws:
storage.StorageException
java.io.IOException

contains

public static boolean contains(DbStorageManager dbsm,
                               long transactionNumber,
                               DbUnitAddress header,
                               DictionaryEntry entry)
                        throws storage.StorageException,
                               java.io.IOException
Checks if a specified dictionary entry belongs to the collection.

Parameters:
dbsm - The data base storage manager where the operation will be performed.
transactionNumber - The number of transaction.
header - The address of the dictionary header.
entry - The dictionary entry.
Returns:
true if the dictionary entry is in the collection, false otherwise.
Throws:
storage.StorageException
java.io.IOException

contains

public static boolean contains(DbStorageManager dbsm,
                               long transactionNumber,
                               DbUnitAddress header,
                               java.lang.String entryName,
                               PhysicalID entryID)
                        throws storage.StorageException,
                               java.io.IOException
Checks if a specified dictionary entry belongs to the collection.

Parameters:
dbsm - The data base storage manager where the operation will be performed.
transactionNumber - The number of transaction.
header - The address of the dictionary header.
entryName - The name of the dictionary entry.
entryID - The identifier of the dictionary entry.
Returns:
true if the dictionary entry is in the collection, false otherwise.
Throws:
storage.StorageException
java.io.IOException

insert

public static void insert(DbStorageManager dbsm,
                          long transactionNumber,
                          DbUnitAddress header,
                          DictionaryEntry entry)
                   throws storage.StorageException,
                          java.io.IOException,
                          UnavailableUnitException,
                          AlreadyExistingException
Inserts a specified dictionary entry to the collection.

Parameters:
dbsm - The data base storage manager where the operation will be performed.
transactionNumber - The number of transaction.
header - The address of the dictionary header.
entry - The dictionary entry.
Throws:
storage.StorageException
java.io.IOException
UnavailableUnitException
AlreadyExistingException

insert

public static void insert(DbStorageManager dbsm,
                          long transactionNumber,
                          DbUnitAddress header,
                          java.lang.String entryName,
                          PhysicalID entryID)
                   throws storage.StorageException,
                          java.io.IOException,
                          UnavailableUnitException,
                          AlreadyExistingException
Inserts a specified dictionary entry to the collection.

Parameters:
dbsm - The data base storage manager where the operation will be performed.
transactionNumber - The number of transaction.
header - The address of the dictionary header.
entryName - The name of the dictionary entry.
entryID - The identifier of the dictionary entry.
Throws:
storage.StorageException
java.io.IOException
UnavailableUnitException
AlreadyExistingException

getFirstWithID

public static void getFirstWithID(DbStorageManager dbsm,
                                  long transactionNumber,
                                  DbUnitAddress header,
                                  PhysicalID matchID,
                                  DbUnitAddress destiny)
                           throws storage.StorageException,
                                  java.io.IOException
Finds the first node in the collection with the specified identifier.

Parameters:
dbsm - The data base storage manager where the operation will be performed.
transactionNumber - The number of transaction.
header - The address of the dictionary header.
matchID - The identifier to find.
destiny - Where the node's address is stored, it will be a null address if the identifier is not found.
Throws:
storage.StorageException
java.io.IOException

containsID

public static boolean containsID(DbStorageManager dbsm,
                                 long transactionNumber,
                                 DbUnitAddress header,
                                 PhysicalID matchID)
                          throws storage.StorageException,
                                 java.io.IOException
Checks if a specified identifier is in some dictionary entry in the collection.

Parameters:
dbsm - The data base storage manager where the operation will be performed.
transactionNumber - The number of transaction.
header - The address of the dictionary header.
matchID - The identifier to find.
Returns:
true if the identifier is in the collection, false otherwise.
Throws:
storage.StorageException
java.io.IOException

getID

public static void getID(DbStorageManager dbsm,
                         long transactionNumber,
                         DbUnitAddress header,
                         java.lang.String matchName,
                         PhysicalID id)
                  throws storage.StorageException,
                         java.io.IOException,
                         NotExistingException
Finds the first identifier in the collection with the specified name.

Parameters:
dbsm - The data base storage manager where the operation will be performed.
transactionNumber - The number of transaction.
header - The address of the dictionary header.
matchName - The name to find.
id - Where the identificator is stored.
Throws:
storage.StorageException
java.io.IOException
NotExistingException

containsName

public static boolean containsName(DbStorageManager dbsm,
                                   long transactionNumber,
                                   DbUnitAddress header,
                                   java.lang.String matchName)
                            throws storage.StorageException,
                                   java.io.IOException
Checks if a specified nameed is in some dictionary entry in the collection.

Parameters:
dbsm - The data base storage manager where the operation will be performed.
transactionNumber - The number of transaction.
header - The address of the dictionary header.
matchName - The labe to find.
Returns:
true if the name is in the collection, false otherwise.
Throws:
storage.StorageException
java.io.IOException

delete

public static void delete(DbStorageManager dbsm,
                          long transactionNumber,
                          DbUnitAddress header,
                          DictionaryEntry entry)
                   throws storage.StorageException,
                          java.io.IOException,
                          NotExistingException
Deletes a specified dictionary entry from the collection.

Parameters:
dbsm - The data base storage manager where the operation will be performed.
transactionNumber - The number of transaction.
header - The address of the dictionary header.
entry - The dictionary entry.
Throws:
storage.StorageException
java.io.IOException
NotExistingException

delete

public static void delete(DbStorageManager dbsm,
                          long transactionNumber,
                          DbUnitAddress header,
                          java.lang.String entryName,
                          PhysicalID entryID)
                   throws storage.StorageException,
                          java.io.IOException,
                          NotExistingException
Deletes a specified dictionary entry from the collection.

Parameters:
dbsm - The data base storage manager where the operation will be performed.
transactionNumber - The number of transaction.
header - The address of the dictionary header.
entryName - The name of the dictionary entry.
entryID - The identifier of the dictionary entry.
Throws:
storage.StorageException
java.io.IOException
NotExistingException

deleteID

public static void deleteID(DbStorageManager dbsm,
                            long transactionNumber,
                            DbUnitAddress header,
                            PhysicalID deletedID)
                     throws storage.StorageException,
                            java.io.IOException
Deletes a specified dictionary entry from the collection.

Parameters:
dbsm - The data base storage manager where the operation will be performed.
transactionNumber - The number of transaction.
header - The address of the dictionary header.
deletedID - The identifier of the dictionary entries to delete.
Throws:
storage.StorageException
java.io.IOException

deleteName

public static void deleteName(DbStorageManager dbsm,
                              long transactionNumber,
                              DbUnitAddress header,
                              java.lang.String deletedName)
                       throws storage.StorageException,
                              java.io.IOException,
                              NotExistingException
Deletes a specified dictionary entry from the collection.

Parameters:
dbsm - The data base storage manager where the operation will be performed.
transactionNumber - The number of transaction.
header - The address of the dictionary header.
deletedName - The name of the dictionary entry to delete.
Throws:
storage.StorageException
java.io.IOException
NotExistingException