DbStorage.primitives
Class DbManager

java.lang.Object
  extended byDbStorage.primitives.DbManager

public final class DbManager
extends java.lang.Object

This class implements athomic operations for a semiestructured data base.

Author:
Egar Arturo García Cárdenas.

Constructor Summary
DbManager(DbStorageManager dbsm, DbUnitAddress dictionaryDescriptor)
          Constructs a new Database manager.
 
Method Summary
 void add(PhysicalID parent, ssdbms.ssd.Label childsLabel, PhysicalID child, long transactionNumber)
          Adds a labeled semistructured datum in other's content.
 void addSSDTable(ssdbms.ssd.Label name, PhysicalID root, long transactionNumber)
          Adds a SSD Table in the database.
 boolean belongs(PhysicalID child, PhysicalID parent, long transactionNumber)
          Checks if a given semistructured belongs to another given datum.
 boolean contains(PhysicalID parent, PhysicalID child, long transactionNumber)
          Checks if a given semistructured datum owns another given datum in its content.
 boolean containsLabel(PhysicalID parent, ssdbms.ssd.Label childLabel, long transactionNumber)
          Checks if a given semistructured datum owns a specified label.
 PhysicalID createBLOB(long transactionNumber)
          Creates a new primitive BLOB datum.
 PhysicalID createByteSequence(ssdbms.ssd.ByteSequenceValue value, long transactionNumber)
          Creates a new primitive byte sequence datum.
 PhysicalID createCLOB(long transactionNumber)
          Creates a new primitive CLOB datum.
 PhysicalID createInteger(ssdbms.ssd.IntegerValue value, long transactionNumber)
          Creates a new primitive integer datum.
 PhysicalID createNonPrimitive(long transactionNumber)
          Creates a new non primitive semistructured datum.
 PhysicalID createReal(ssdbms.ssd.RealValue value, long transactionNumber)
          Creates a new primitive real datum.
 PhysicalID createString(ssdbms.ssd.StringValue value, long transactionNumber)
          Creates a new primitive string datum.
 void drop(PhysicalID id, long transactionNumber)
          Drops a semistructured datum giving its identifier.
 boolean existID(PhysicalID id, long transactionNumber)
          Checks if a specified semistructured datum exist.
 storage.advancedStorage.AdvancedStorageManager getAdvancedStorageManager()
          Returns the enclosed AdvancedStorageManager.
 ssdbms.ssd.ByteSequenceValue getByteSequenceValue(PhysicalID id, long transactionNumber)
          Returns an byte sequence value from a specified datum.
 DbStorageManager getDbStorageManager()
          Returns the enclosed DbStorageManager.
 DbUnitAddress getFirstLabeledSSDCollectionNodeWithID(PhysicalID id, PhysicalID searchingID, long transactionNumber)
          Returns the first node of the labeled ssd collection list ordered by identifier, that contains a specified a datum.
 DbUnitAddress getFirstLabeledSSDCollectionNodeWithLabel(PhysicalID id, ssdbms.ssd.Label searchingLabel, long transactionNumber)
          Returns the first node of the labeled ssd collection list ordered by identifier, that contains a specified a label.
 PhysicalID getFirstParent(PhysicalID id, long transactionNumber)
          Returns the first parent of a datum.
 PhysicalID getIDFromNodeInLabeledSSDCollection(DbUnitAddress node, long transactionNumber)
          Returns the identifier inside a given node in a labeled ssd collection.
 PhysicalID getIDFromNodeInParentsCollection(DbUnitAddress node, long transactionNumber)
          Returns the identifier inside a given node in a parents' collection.
 ssdbms.ssd.IntegerValue getIntegerValue(PhysicalID id, long transactionNumber)
          Returns an integer value from a specified datum.
 DbUnitAddress getLabeledSSDCollectionHeadByID(PhysicalID id, long transactionNumber)
          Returns the head of the labeled ssd collection list ordered by identifier of a datum.
 DbUnitAddress getLabeledSSDCollectionHeadByLabel(PhysicalID id, long transactionNumber)
          Returns the head of the labeled ssd collection list ordered by label of a datum.
 ssdbms.ssd.LabeledSSD getLabeledSSDFromNodeInLabeledSSDCollection(DbUnitAddress node, long transactionNumber)
          Returns the labeled ssd inside a given node in a labeled ssd collection.
 ssdbms.ssd.Label getLabelFromNodeInLabeledSSDCollection(DbUnitAddress node, long transactionNumber)
          Returns the label inside a given node in a labeled ssd collection.
 long getLengthOfBLOB(PhysicalID id, long transactionNumber)
          Returns the length of the BLOB datum.
 long getLengthOfCLOB(PhysicalID id, long transactionNumber)
          Returns the length of the CLOB datum.
 DbUnitAddress getNextNodeInLabeledSSDCollectionByID(DbUnitAddress node, long transactionNumber)
          Returns the next node of a specified node in a labeled ssd collection list ordered by identifier.
 DbUnitAddress getNextNodeInLabeledSSDCollectionByLabel(DbUnitAddress node, long transactionNumber)
          Returns the next node of a specified node in a labeled ssd collection list ordered by label.
 DbUnitAddress getNextNodeInParentsCollection(DbUnitAddress node, long transactionNumber)
          Returns the next node of a given node in a parents' collection.
 DbUnitAddress getParentsCollectionHead(PhysicalID id, long transactionNumber)
          Returns the head of the parents' collection list of a datum.
 ssdbms.ssd.RealValue getRealValue(PhysicalID id, long transactionNumber)
          Returns an real value from a specified datum.
 PhysicalID getRoot(ssdbms.ssd.Label name, long transactionNumber)
          Returns the identifier of the semistructured datum which is the root of the SSD-Table.
 ssdbms.ssd.StringValue getStringValue(PhysicalID id, long transactionNumber)
          Returns an string value from a specified datum.
 int getType(PhysicalID id, long transactionNumber)
          Returns the kind of this semistructured datum.
 boolean isPrimitive(PhysicalID id, long transactionNumber)
          Checks if a semistructured datum with a given identifier is primitive or not.
 int readFromBLOB(PhysicalID id, long from, byte[] b, long transactionNumber)
          Reads from a BLOB datum and stores the readed in a byte array.
 int readFromBLOB(PhysicalID id, long from, int maxLength, byte[] b, int off, long transactionNumber)
          Reads from a BLOB datum and stores the readed in a byte array.
 java.lang.String readFromCLOB(PhysicalID id, long from, int maxLength, long transactionNumber)
          Reads from a CLOB datum and stores the readed in a string.
 void remove(PhysicalID parent, ssdbms.ssd.Label childsLabel, PhysicalID child, long transactionNumber)
          Removes a labeled semistructured datum from other's content.
 void removeID(PhysicalID parent, PhysicalID child, long transactionNumber)
          Removes a datum from other's content.
 void removeLabel(PhysicalID parent, ssdbms.ssd.Label childsLabel, long transactionNumber)
          Removes all subdata from a specified datum with a given label.
 void removeSSDTable(ssdbms.ssd.Label name, long transactionNumber)
          Removes a SSD-Table from the database.
 void removeSSDTablesWithID(PhysicalID id, long transactionNumber)
          Removes the SSD-Tables whith the specified datum.
 void setLengthOfBLOB(PhysicalID id, long newLength, long transactionNumber)
          Changes the length of the BLOB datum.
 void setLengthOfCLOB(PhysicalID id, long newLength, long transactionNumber)
          Changes the length of the CLOB datum.
 int writeInBLOB(PhysicalID id, long from, byte[] b, long transactionNumber)
          Writes a byte array into a BLOB datum.
 int writeInBLOB(PhysicalID id, long from, int maxLength, byte[] b, int off, long transactionNumber)
          Writes a byte array into a BLOB datum.
 int writeInCLOB(PhysicalID id, long from, int maxLength, java.lang.String str, int off, long transactionNumber)
          Writes a byte array into a CLOB datum.
 int writeInCLOB(PhysicalID id, long from, java.lang.String str, long transactionNumber)
          Writes a byte array into a CLOB datum.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DbManager

public DbManager(DbStorageManager dbsm,
                 DbUnitAddress dictionaryDescriptor)
Constructs a new Database manager.

Method Detail

getDbStorageManager

public DbStorageManager getDbStorageManager()
Returns the enclosed DbStorageManager.


getAdvancedStorageManager

public storage.advancedStorage.AdvancedStorageManager getAdvancedStorageManager()
Returns the enclosed AdvancedStorageManager.


createNonPrimitive

public PhysicalID createNonPrimitive(long transactionNumber)
                              throws ssdbms.manager.primitives.BadFunctionException,
                                     ssdbms.manager.primitives.FatalErrorException
Creates a new non primitive semistructured datum.

Parameters:
transactionNumber - The number of transaction.
Returns:
The identifier of the created semistructured datum.
Throws:
ssdbms.manager.primitives.BadFunctionException
ssdbms.manager.primitives.FatalErrorException

createInteger

public PhysicalID createInteger(ssdbms.ssd.IntegerValue value,
                                long transactionNumber)
                         throws ssdbms.manager.primitives.BadFunctionException,
                                ssdbms.manager.primitives.FatalErrorException
Creates a new primitive integer datum.

Parameters:
value - The integer value of the semistructured datum to be created.
transactionNumber - The number of transaction.
Returns:
The identifier of the created semistructured datum.
Throws:
ssdbms.manager.primitives.BadFunctionException
ssdbms.manager.primitives.FatalErrorException

createReal

public PhysicalID createReal(ssdbms.ssd.RealValue value,
                             long transactionNumber)
                      throws ssdbms.manager.primitives.BadFunctionException,
                             ssdbms.manager.primitives.FatalErrorException
Creates a new primitive real datum.

Parameters:
value - The real value of the semistructured datum to be created.
transactionNumber - The number of transaction.
Returns:
The identifier of the created semistructured datum.
Throws:
ssdbms.manager.primitives.BadFunctionException
ssdbms.manager.primitives.FatalErrorException

createString

public PhysicalID createString(ssdbms.ssd.StringValue value,
                               long transactionNumber)
                        throws ssdbms.manager.primitives.BadFunctionException,
                               ssdbms.manager.primitives.FatalErrorException
Creates a new primitive string datum.

Parameters:
value - The string value of the semistructured datum to be created.
transactionNumber - The number of transaction.
Returns:
The identifier of the created semistructured datum.
Throws:
ssdbms.manager.primitives.BadFunctionException
ssdbms.manager.primitives.FatalErrorException

createByteSequence

public PhysicalID createByteSequence(ssdbms.ssd.ByteSequenceValue value,
                                     long transactionNumber)
                              throws ssdbms.manager.primitives.BadFunctionException,
                                     ssdbms.manager.primitives.FatalErrorException
Creates a new primitive byte sequence datum.

Parameters:
value - The byte sequence value of the semistructured datum to be created.
transactionNumber - The number of transaction.
Returns:
The identifier of the created semistructured datum.
Throws:
ssdbms.manager.primitives.BadFunctionException
ssdbms.manager.primitives.FatalErrorException

createBLOB

public PhysicalID createBLOB(long transactionNumber)
                      throws ssdbms.manager.primitives.BadFunctionException,
                             ssdbms.manager.primitives.FatalErrorException
Creates a new primitive BLOB datum.

Parameters:
transactionNumber - The number of transaction.
Returns:
The identifier of the created semistructured datum.
Throws:
ssdbms.manager.primitives.BadFunctionException
ssdbms.manager.primitives.FatalErrorException

createCLOB

public PhysicalID createCLOB(long transactionNumber)
                      throws ssdbms.manager.primitives.BadFunctionException,
                             ssdbms.manager.primitives.FatalErrorException
Creates a new primitive CLOB datum.

Parameters:
transactionNumber - The number of transaction.
Returns:
The identifier of the created semistructured datum.
Throws:
ssdbms.manager.primitives.BadFunctionException
ssdbms.manager.primitives.FatalErrorException

existID

public boolean existID(PhysicalID id,
                       long transactionNumber)
                throws ssdbms.manager.primitives.FatalErrorException
Checks if a specified semistructured datum exist.

Parameters:
transactionNumber - The number of transaction.
Returns:
true If the datum exists, false otherwise.
Throws:
ssdbms.manager.primitives.FatalErrorException

getType

public int getType(PhysicalID id,
                   long transactionNumber)
            throws ssdbms.manager.primitives.NotExistingDatumException,
                   ssdbms.manager.primitives.FatalErrorException
Returns the kind of this semistructured datum.

Parameters:
id - The identifier of the datum to check.
transactionNumber - The number of transaction.
Returns:
The numeric constant that represents the kind of value of this semistructured datum.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.FatalErrorException

isPrimitive

public boolean isPrimitive(PhysicalID id,
                           long transactionNumber)
                    throws ssdbms.manager.primitives.NotExistingDatumException,
                           ssdbms.manager.primitives.FatalErrorException
Checks if a semistructured datum with a given identifier is primitive or not.

Parameters:
id - The datum's identifier to be checked.
transactionNumber - The number of transaction.
Returns:
true if the datum is primitive, false otherwise.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.FatalErrorException

add

public void add(PhysicalID parent,
                ssdbms.ssd.Label childsLabel,
                PhysicalID child,
                long transactionNumber)
         throws ssdbms.manager.primitives.NotExistingDatumException,
                ssdbms.manager.primitives.InvalidDatumOperationException,
                ssdbms.manager.primitives.BadFunctionException,
                ssdbms.manager.primitives.FatalErrorException
Adds a labeled semistructured datum in other's content.

Parameters:
parent - The identifier of the semistructured datum which its content will be modified, this has to be non-primitive.
childsLabel - The label of the datum to be added.
child - The identifier of the datum to be added.
transactionNumber - The number of transaction.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.InvalidDatumOperationException
ssdbms.manager.primitives.BadFunctionException
ssdbms.manager.primitives.FatalErrorException

remove

public void remove(PhysicalID parent,
                   ssdbms.ssd.Label childsLabel,
                   PhysicalID child,
                   long transactionNumber)
            throws ssdbms.manager.primitives.NotExistingDatumException,
                   ssdbms.manager.primitives.InvalidDatumOperationException,
                   ssdbms.manager.primitives.FatalErrorException
Removes a labeled semistructured datum from other's content.

Parameters:
parent - The identifier of the semistructured datum which its content will be modified.
childsLabel - The label of the datum to be removed.
child - The identifier of the datum to be removed.
transactionNumber - The number of transaction.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.InvalidDatumOperationException
ssdbms.manager.primitives.FatalErrorException

removeID

public void removeID(PhysicalID parent,
                     PhysicalID child,
                     long transactionNumber)
              throws ssdbms.manager.primitives.NotExistingDatumException,
                     ssdbms.manager.primitives.InvalidDatumOperationException,
                     ssdbms.manager.primitives.FatalErrorException
Removes a datum from other's content.

Parameters:
parent - The identifier of the semistructured datum which its content will be modified.
child - The identifier of the datum to be removed.
transactionNumber - The number of transaction.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.InvalidDatumOperationException
ssdbms.manager.primitives.FatalErrorException

removeLabel

public void removeLabel(PhysicalID parent,
                        ssdbms.ssd.Label childsLabel,
                        long transactionNumber)
                 throws ssdbms.manager.primitives.NotExistingDatumException,
                        ssdbms.manager.primitives.InvalidDatumOperationException,
                        ssdbms.manager.primitives.FatalErrorException
Removes all subdata from a specified datum with a given label.

Parameters:
parent - The identifier of the semistructured datum which its content will be modified.
childsLabel - The label of the data to be removed.
transactionNumber - The number of transaction.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.InvalidDatumOperationException
ssdbms.manager.primitives.FatalErrorException

getIntegerValue

public ssdbms.ssd.IntegerValue getIntegerValue(PhysicalID id,
                                               long transactionNumber)
                                        throws ssdbms.manager.primitives.NotExistingDatumException,
                                               ssdbms.manager.primitives.InvalidDatumOperationException,
                                               ssdbms.manager.primitives.FatalErrorException
Returns an integer value from a specified datum.

Parameters:
id - The identifier of the datum.
transactionNumber - The number of transaction.
Returns:
The content of the datum as an integer value.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.InvalidDatumOperationException
ssdbms.manager.primitives.FatalErrorException

getRealValue

public ssdbms.ssd.RealValue getRealValue(PhysicalID id,
                                         long transactionNumber)
                                  throws ssdbms.manager.primitives.NotExistingDatumException,
                                         ssdbms.manager.primitives.InvalidDatumOperationException,
                                         ssdbms.manager.primitives.FatalErrorException
Returns an real value from a specified datum.

Parameters:
id - The identifier of the datum.
transactionNumber - The number of transaction.
Returns:
The content of the datum as a real value.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.InvalidDatumOperationException
ssdbms.manager.primitives.FatalErrorException

getStringValue

public ssdbms.ssd.StringValue getStringValue(PhysicalID id,
                                             long transactionNumber)
                                      throws ssdbms.manager.primitives.NotExistingDatumException,
                                             ssdbms.manager.primitives.InvalidDatumOperationException,
                                             ssdbms.manager.primitives.BadFunctionException,
                                             ssdbms.manager.primitives.FatalErrorException
Returns an string value from a specified datum.

Parameters:
id - The identifier of the datum.
transactionNumber - The number of transaction.
Returns:
The content of the datum as a string value.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.InvalidDatumOperationException
ssdbms.manager.primitives.BadFunctionException
ssdbms.manager.primitives.FatalErrorException

getByteSequenceValue

public ssdbms.ssd.ByteSequenceValue getByteSequenceValue(PhysicalID id,
                                                         long transactionNumber)
                                                  throws ssdbms.manager.primitives.NotExistingDatumException,
                                                         ssdbms.manager.primitives.InvalidDatumOperationException,
                                                         ssdbms.manager.primitives.BadFunctionException,
                                                         ssdbms.manager.primitives.FatalErrorException
Returns an byte sequence value from a specified datum.

Parameters:
id - The identifier of the datum.
transactionNumber - The number of transaction.
Returns:
The content of the datum as a byte sequence value.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.InvalidDatumOperationException
ssdbms.manager.primitives.BadFunctionException
ssdbms.manager.primitives.FatalErrorException

contains

public boolean contains(PhysicalID parent,
                        PhysicalID child,
                        long transactionNumber)
                 throws ssdbms.manager.primitives.NotExistingDatumException,
                        ssdbms.manager.primitives.FatalErrorException
Checks if a given semistructured datum owns another given datum in its content.

Parameters:
parent - The datum's identifier which content will be analized.
child - The datum's identifier will be searched in parent's content.
transactionNumber - The number of transaction.
Returns:
true if child is in parents's content, false otherwise. Note: If parent is primitive this method returns false.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.FatalErrorException

belongs

public boolean belongs(PhysicalID child,
                       PhysicalID parent,
                       long transactionNumber)
                throws ssdbms.manager.primitives.NotExistingDatumException,
                       ssdbms.manager.primitives.FatalErrorException
Checks if a given semistructured belongs to another given datum.

Parameters:
child - The datum's identifier will be searched in parent's content.
parent - The datum's identifier which content will be analized.
transactionNumber - The number of transaction.
Returns:
true if child is in parents's content, false otherwise. Note: If parent is primitive this method returns false.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.FatalErrorException

containsLabel

public boolean containsLabel(PhysicalID parent,
                             ssdbms.ssd.Label childLabel,
                             long transactionNumber)
                      throws ssdbms.manager.primitives.NotExistingDatumException,
                             ssdbms.manager.primitives.FatalErrorException
Checks if a given semistructured datum owns a specified label.

Parameters:
parent - The datum's identifier which content will be analized.
childLabel - The label to be searched in parent's content.
transactionNumber - The number of transaction.
Returns:
true if childLabel is in parents's content, false otherwise. Note: If parent is primitive this method returns false.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.FatalErrorException

addSSDTable

public void addSSDTable(ssdbms.ssd.Label name,
                        PhysicalID root,
                        long transactionNumber)
                 throws ssdbms.manager.primitives.NotExistingDatumException,
                        ssdbms.manager.primitives.AlreadyDefinedSSDTableException,
                        ssdbms.manager.primitives.BadFunctionException,
                        ssdbms.manager.primitives.FatalErrorException
Adds a SSD Table in the database.

Parameters:
name - The name of the new table.
root - The identifier of the semistructured datum which will be the root of.
transactionNumber - The number of transaction. the new SSD-Table.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.AlreadyDefinedSSDTableException
ssdbms.manager.primitives.BadFunctionException
ssdbms.manager.primitives.FatalErrorException

getRoot

public PhysicalID getRoot(ssdbms.ssd.Label name,
                          long transactionNumber)
                   throws ssdbms.manager.primitives.NotDefinedSSDTableException,
                          ssdbms.manager.primitives.FatalErrorException
Returns the identifier of the semistructured datum which is the root of the SSD-Table.

Parameters:
name - The name of the SSD-Table to get its root.
transactionNumber - The number of transaction.
Returns:
The root of the SSD-Table.
Throws:
ssdbms.manager.primitives.NotDefinedSSDTableException
ssdbms.manager.primitives.FatalErrorException

removeSSDTable

public void removeSSDTable(ssdbms.ssd.Label name,
                           long transactionNumber)
                    throws ssdbms.manager.primitives.NotDefinedSSDTableException,
                           ssdbms.manager.primitives.FatalErrorException
Removes a SSD-Table from the database.

Parameters:
name - The name of the SSD-Table to be removed.
transactionNumber - The number of transaction.
Throws:
ssdbms.manager.primitives.NotDefinedSSDTableException
ssdbms.manager.primitives.FatalErrorException

removeSSDTablesWithID

public void removeSSDTablesWithID(PhysicalID id,
                                  long transactionNumber)
                           throws ssdbms.manager.primitives.NotExistingDatumException,
                                  ssdbms.manager.primitives.NotDefinedSSDTableException,
                                  ssdbms.manager.primitives.FatalErrorException
Removes the SSD-Tables whith the specified datum.

Parameters:
id - The identifier of the root of the SSD-Tables to be removed.
transactionNumber - The number of transaction.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.NotDefinedSSDTableException
ssdbms.manager.primitives.FatalErrorException

drop

public void drop(PhysicalID id,
                 long transactionNumber)
          throws ssdbms.manager.primitives.NotExistingDatumException,
                 ssdbms.manager.primitives.NotIsolatedDatumException,
                 ssdbms.manager.primitives.FatalErrorException
Drops a semistructured datum giving its identifier. The semistructured datum to be droped must be empty (i.e. without subdata) or primitive and isolated (i.e. without parents and dictionary references).

Parameters:
id - The identifier of the semistructured datum to be dropped.
transactionNumber - The number of transaction.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.NotIsolatedDatumException
ssdbms.manager.primitives.FatalErrorException

setLengthOfBLOB

public void setLengthOfBLOB(PhysicalID id,
                            long newLength,
                            long transactionNumber)
                     throws ssdbms.manager.primitives.NotExistingDatumException,
                            ssdbms.manager.primitives.InvalidDatumOperationException,
                            ssdbms.manager.primitives.OutOfBoundsException,
                            ssdbms.manager.primitives.FatalErrorException
Changes the length of the BLOB datum.

Parameters:
transactionNumber - The number of transaction.
id - The identifier of the datum to resize.
newLength - The new length of the datum.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.InvalidDatumOperationException
ssdbms.manager.primitives.OutOfBoundsException
ssdbms.manager.primitives.FatalErrorException

getLengthOfBLOB

public long getLengthOfBLOB(PhysicalID id,
                            long transactionNumber)
                     throws ssdbms.manager.primitives.NotExistingDatumException,
                            ssdbms.manager.primitives.InvalidDatumOperationException,
                            ssdbms.manager.primitives.FatalErrorException
Returns the length of the BLOB datum.

Parameters:
transactionNumber - The number of transaction.
id - The identifier of the datum to resize.
Returns:
The length of the datum.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.InvalidDatumOperationException
ssdbms.manager.primitives.FatalErrorException

writeInBLOB

public int writeInBLOB(PhysicalID id,
                       long from,
                       int maxLength,
                       byte[] b,
                       int off,
                       long transactionNumber)
                throws ssdbms.manager.primitives.NotExistingDatumException,
                       ssdbms.manager.primitives.InvalidDatumOperationException,
                       ssdbms.manager.primitives.OutOfBoundsException,
                       ssdbms.manager.primitives.FatalErrorException
Writes a byte array into a BLOB datum.

Parameters:
transactionNumber - The number of transaction.
id - The identifier of the datum to wrote.
from - The position of the BLOB from which the witting starts.
maxLength - The maximum number of bytes to write.
b - The array contains the bytes to write.
off - The offset of b from which the bytes are retrieved.
Returns:
The number of written bytes.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.InvalidDatumOperationException
ssdbms.manager.primitives.OutOfBoundsException
ssdbms.manager.primitives.FatalErrorException

writeInBLOB

public int writeInBLOB(PhysicalID id,
                       long from,
                       byte[] b,
                       long transactionNumber)
                throws ssdbms.manager.primitives.NotExistingDatumException,
                       ssdbms.manager.primitives.InvalidDatumOperationException,
                       ssdbms.manager.primitives.OutOfBoundsException,
                       ssdbms.manager.primitives.FatalErrorException
Writes a byte array into a BLOB datum.

Parameters:
transactionNumber - The number of transaction.
id - The identifier of the datum to wrote.
from - The position of the BLOB from which the witting starts.
b - The array contains the bytes to write.
Returns:
The number of written bytes.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.InvalidDatumOperationException
ssdbms.manager.primitives.OutOfBoundsException
ssdbms.manager.primitives.FatalErrorException

readFromBLOB

public int readFromBLOB(PhysicalID id,
                        long from,
                        int maxLength,
                        byte[] b,
                        int off,
                        long transactionNumber)
                 throws ssdbms.manager.primitives.NotExistingDatumException,
                        ssdbms.manager.primitives.InvalidDatumOperationException,
                        ssdbms.manager.primitives.OutOfBoundsException,
                        ssdbms.manager.primitives.FatalErrorException
Reads from a BLOB datum and stores the readed in a byte array.

Parameters:
transactionNumber - The number of transaction.
id - The identifier of the datum to read.
from - The position of the BLOB from which the reading starts.
maxLength - The maximum number of bytes to read.
b - The array where the readed bytes will be stored.
off - The offset of b from which the readed bytes are stored.
Returns:
The number of readed bytes.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.InvalidDatumOperationException
ssdbms.manager.primitives.OutOfBoundsException
ssdbms.manager.primitives.FatalErrorException

readFromBLOB

public int readFromBLOB(PhysicalID id,
                        long from,
                        byte[] b,
                        long transactionNumber)
                 throws ssdbms.manager.primitives.NotExistingDatumException,
                        ssdbms.manager.primitives.InvalidDatumOperationException,
                        ssdbms.manager.primitives.OutOfBoundsException,
                        ssdbms.manager.primitives.FatalErrorException
Reads from a BLOB datum and stores the readed in a byte array.

Parameters:
transactionNumber - The number of transaction.
id - The identifier of the datum to read.
from - The position of the BLOB from which the reading starts.
b - The array where the readed bytes will be stored.
Returns:
The number of readed bytes.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.InvalidDatumOperationException
ssdbms.manager.primitives.OutOfBoundsException
ssdbms.manager.primitives.FatalErrorException

setLengthOfCLOB

public void setLengthOfCLOB(PhysicalID id,
                            long newLength,
                            long transactionNumber)
                     throws ssdbms.manager.primitives.NotExistingDatumException,
                            ssdbms.manager.primitives.InvalidDatumOperationException,
                            ssdbms.manager.primitives.OutOfBoundsException,
                            ssdbms.manager.primitives.FatalErrorException
Changes the length of the CLOB datum.

Parameters:
transactionNumber - The number of transaction.
id - The identifier of the datum to resize.
newLength - The new length of the datum (in characters).
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.InvalidDatumOperationException
ssdbms.manager.primitives.OutOfBoundsException
ssdbms.manager.primitives.FatalErrorException

getLengthOfCLOB

public long getLengthOfCLOB(PhysicalID id,
                            long transactionNumber)
                     throws ssdbms.manager.primitives.NotExistingDatumException,
                            ssdbms.manager.primitives.InvalidDatumOperationException,
                            ssdbms.manager.primitives.FatalErrorException
Returns the length of the CLOB datum.

Parameters:
transactionNumber - The number of transaction.
id - The identifier of the datum to resize.
Returns:
The length of the datum (in characters).
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.InvalidDatumOperationException
ssdbms.manager.primitives.FatalErrorException

writeInCLOB

public int writeInCLOB(PhysicalID id,
                       long from,
                       int maxLength,
                       java.lang.String str,
                       int off,
                       long transactionNumber)
                throws ssdbms.manager.primitives.NotExistingDatumException,
                       ssdbms.manager.primitives.InvalidDatumOperationException,
                       ssdbms.manager.primitives.OutOfBoundsException,
                       ssdbms.manager.primitives.FatalErrorException
Writes a byte array into a CLOB datum.

Parameters:
transactionNumber - The number of transaction.
id - The identifier of the datum to wrote.
from - The position of the CLOB from which the witting starts.
maxLength - The maximum number of characters to write.
str - The string contains the characters to write.
off - The offset of str from which the characters are retrieved.
Returns:
The number of written characters.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.InvalidDatumOperationException
ssdbms.manager.primitives.OutOfBoundsException
ssdbms.manager.primitives.FatalErrorException

writeInCLOB

public int writeInCLOB(PhysicalID id,
                       long from,
                       java.lang.String str,
                       long transactionNumber)
                throws ssdbms.manager.primitives.NotExistingDatumException,
                       ssdbms.manager.primitives.InvalidDatumOperationException,
                       ssdbms.manager.primitives.OutOfBoundsException,
                       ssdbms.manager.primitives.FatalErrorException
Writes a byte array into a CLOB datum.

Parameters:
transactionNumber - The number of transaction.
id - The identifier of the datum to wrote.
from - The position of the CLOB from which the witting starts.
str - The string contains the characters to write.
Returns:
The number of written characters.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.InvalidDatumOperationException
ssdbms.manager.primitives.OutOfBoundsException
ssdbms.manager.primitives.FatalErrorException

readFromCLOB

public java.lang.String readFromCLOB(PhysicalID id,
                                     long from,
                                     int maxLength,
                                     long transactionNumber)
                              throws ssdbms.manager.primitives.NotExistingDatumException,
                                     ssdbms.manager.primitives.InvalidDatumOperationException,
                                     ssdbms.manager.primitives.OutOfBoundsException,
                                     ssdbms.manager.primitives.FatalErrorException
Reads from a CLOB datum and stores the readed in a string.

Parameters:
transactionNumber - The number of transaction.
id - The identifier of the datum to read.
from - The position of the CLOB from which the reading starts.
maxLength - The maximum number of characters to read.
Returns:
A string contains the readed characters.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.InvalidDatumOperationException
ssdbms.manager.primitives.OutOfBoundsException
ssdbms.manager.primitives.FatalErrorException

getFirstParent

public PhysicalID getFirstParent(PhysicalID id,
                                 long transactionNumber)
                          throws ssdbms.manager.primitives.NotExistingDatumException,
                                 ssdbms.manager.primitives.FatalErrorException
Returns the first parent of a datum.

Parameters:
id - The identifier of the datum.
transactionNumber - The number of transaction.
Returns:
The identifier of the first parent.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.FatalErrorException

getParentsCollectionHead

public DbUnitAddress getParentsCollectionHead(PhysicalID id,
                                              long transactionNumber)
                                       throws ssdbms.manager.primitives.NotExistingDatumException,
                                              ssdbms.manager.primitives.FatalErrorException
Returns the head of the parents' collection list of a datum.

Parameters:
id - The identifier of the datum.
transactionNumber - The number of transaction.
Returns:
The address of the head node in the PARENTS segment.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.FatalErrorException

getNextNodeInParentsCollection

public DbUnitAddress getNextNodeInParentsCollection(DbUnitAddress node,
                                                    long transactionNumber)
                                             throws InvalidUnitException,
                                                    ssdbms.manager.primitives.FatalErrorException
Returns the next node of a given node in a parents' collection.

Parameters:
node - The node in the parents' collection.
transactionNumber - The number of transaction.
Returns:
The address of the next node in the PARENTS segment.
Throws:
InvalidUnitException
ssdbms.manager.primitives.FatalErrorException

getIDFromNodeInParentsCollection

public PhysicalID getIDFromNodeInParentsCollection(DbUnitAddress node,
                                                   long transactionNumber)
                                            throws InvalidUnitException,
                                                   ssdbms.manager.primitives.FatalErrorException
Returns the identifier inside a given node in a parents' collection.

Parameters:
node - The node in the parents' collection.
transactionNumber - The number of transaction.
Returns:
The identifier inside the node.
Throws:
InvalidUnitException
ssdbms.manager.primitives.FatalErrorException

getLabeledSSDCollectionHeadByID

public DbUnitAddress getLabeledSSDCollectionHeadByID(PhysicalID id,
                                                     long transactionNumber)
                                              throws ssdbms.manager.primitives.NotExistingDatumException,
                                                     ssdbms.manager.primitives.FatalErrorException
Returns the head of the labeled ssd collection list ordered by identifier of a datum.

Parameters:
id - The identifier of the datum.
transactionNumber - The number of transaction.
Returns:
The address of the head node in the CONTENT segment.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.FatalErrorException

getLabeledSSDCollectionHeadByLabel

public DbUnitAddress getLabeledSSDCollectionHeadByLabel(PhysicalID id,
                                                        long transactionNumber)
                                                 throws ssdbms.manager.primitives.NotExistingDatumException,
                                                        ssdbms.manager.primitives.FatalErrorException
Returns the head of the labeled ssd collection list ordered by label of a datum.

Parameters:
id - The identifier of the datum.
transactionNumber - The number of transaction.
Returns:
The address of the head node in the CONTENT segment.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.FatalErrorException

getFirstLabeledSSDCollectionNodeWithID

public DbUnitAddress getFirstLabeledSSDCollectionNodeWithID(PhysicalID id,
                                                            PhysicalID searchingID,
                                                            long transactionNumber)
                                                     throws ssdbms.manager.primitives.NotExistingDatumException,
                                                            ssdbms.manager.primitives.FatalErrorException
Returns the first node of the labeled ssd collection list ordered by identifier, that contains a specified a datum.

Parameters:
id - The identifier of the datum.
searchingID - The identifier of the datum to locate.
transactionNumber - The number of transaction.
Returns:
The address of the head node in the CONTENT segment.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.FatalErrorException

getFirstLabeledSSDCollectionNodeWithLabel

public DbUnitAddress getFirstLabeledSSDCollectionNodeWithLabel(PhysicalID id,
                                                               ssdbms.ssd.Label searchingLabel,
                                                               long transactionNumber)
                                                        throws ssdbms.manager.primitives.NotExistingDatumException,
                                                               ssdbms.manager.primitives.FatalErrorException
Returns the first node of the labeled ssd collection list ordered by identifier, that contains a specified a label.

Parameters:
id - The identifier of the datum.
searchingLabel - The label to locate.
transactionNumber - The number of transaction.
Returns:
The address of the head node in the CONTENT segment.
Throws:
ssdbms.manager.primitives.NotExistingDatumException
ssdbms.manager.primitives.FatalErrorException

getNextNodeInLabeledSSDCollectionByID

public DbUnitAddress getNextNodeInLabeledSSDCollectionByID(DbUnitAddress node,
                                                           long transactionNumber)
                                                    throws InvalidUnitException,
                                                           ssdbms.manager.primitives.FatalErrorException
Returns the next node of a specified node in a labeled ssd collection list ordered by identifier.

Parameters:
node - The node in the labeled ssd colection ordered by identifier.
transactionNumber - The number of transaction.
Returns:
The address of the next node in the CONTENT segment.
Throws:
InvalidUnitException
ssdbms.manager.primitives.FatalErrorException

getNextNodeInLabeledSSDCollectionByLabel

public DbUnitAddress getNextNodeInLabeledSSDCollectionByLabel(DbUnitAddress node,
                                                              long transactionNumber)
                                                       throws InvalidUnitException,
                                                              ssdbms.manager.primitives.FatalErrorException
Returns the next node of a specified node in a labeled ssd collection list ordered by label.

Parameters:
node - The node in the labeled ssd colection ordered by label.
transactionNumber - The number of transaction.
Returns:
The address of the next node in the CONTENT segment.
Throws:
InvalidUnitException
ssdbms.manager.primitives.FatalErrorException

getIDFromNodeInLabeledSSDCollection

public PhysicalID getIDFromNodeInLabeledSSDCollection(DbUnitAddress node,
                                                      long transactionNumber)
                                               throws InvalidUnitException,
                                                      ssdbms.manager.primitives.FatalErrorException
Returns the identifier inside a given node in a labeled ssd collection.

Parameters:
node - The node in the parents' collection.
transactionNumber - The number of transaction.
Returns:
The identifier inside the node.
Throws:
InvalidUnitException
ssdbms.manager.primitives.FatalErrorException

getLabelFromNodeInLabeledSSDCollection

public ssdbms.ssd.Label getLabelFromNodeInLabeledSSDCollection(DbUnitAddress node,
                                                               long transactionNumber)
                                                        throws ssdbms.manager.primitives.BadFunctionException,
                                                               InvalidUnitException,
                                                               ssdbms.manager.primitives.FatalErrorException
Returns the label inside a given node in a labeled ssd collection.

Parameters:
node - The node in the parents' collection.
transactionNumber - The number of transaction.
Returns:
The label inside the node.
Throws:
ssdbms.manager.primitives.BadFunctionException
InvalidUnitException
ssdbms.manager.primitives.FatalErrorException

getLabeledSSDFromNodeInLabeledSSDCollection

public ssdbms.ssd.LabeledSSD getLabeledSSDFromNodeInLabeledSSDCollection(DbUnitAddress node,
                                                                         long transactionNumber)
                                                                  throws ssdbms.manager.primitives.BadFunctionException,
                                                                         InvalidUnitException,
                                                                         ssdbms.manager.primitives.FatalErrorException
Returns the labeled ssd inside a given node in a labeled ssd collection.

Parameters:
node - The node in the parents' collection.
transactionNumber - The number of transaction.
Returns:
The labeled ssd inside the node.
Throws:
ssdbms.manager.primitives.BadFunctionException
InvalidUnitException
ssdbms.manager.primitives.FatalErrorException