Framework Professional Edition Package


com.prosyst.mbs.services.db
Interface DBNode


public interface DBNode

This is an object-oriented representation of a node in the DB.

Author:
Svetozar Dimov

Method Summary
 void delete()
          Deletes the current node
 void deleteAllBefore()
          Deletes all parent nodes.
 DBNode firstChild()
          Retrieves the first child node of the current one
 java.lang.String getName()
          Retrieves the name of the node
 byte getType()
          Retrieves the type of the node
 java.lang.Object getValue()
          Retrieves the value of the node
 int getValue(byte[] bytes, int offset, int length)
          Reads length bytes from the value, associated with the current node and writes them at off position in the byteArray.
 void getValue(com.prosyst.util.io.Externalizable e)
          Reads the value of the node into an Externalizable object.
 boolean isValid()
          Checks if the node is valid.
 DBNode next()
          Retrieves the next node in the tree at the same level as the current one.
 DBNode parent()
          Retrieves the parent node.
 

Method Detail

getName

java.lang.String getName()
                         throws java.io.IOException
Retrieves the name of the node

Returns:
the node name
Throws:
java.io.IOException

next

DBNode next()
            throws java.io.IOException
Retrieves the next node in the tree at the same level as the current one.

Returns:
the next node
Throws:
java.io.IOException

firstChild

DBNode firstChild()
                  throws java.io.IOException
Retrieves the first child node of the current one

Returns:
the first child node
Throws:
java.io.IOException

parent

DBNode parent()
              throws java.io.IOException
Retrieves the parent node.

Returns:
the parent node
Throws:
java.io.IOException

getValue

java.lang.Object getValue()
                          throws java.io.IOException
Retrieves the value of the node

Returns:
The object associated with the node or null if there is no such node, or the node's type DB.EMPTY.
Throws:
java.io.IOException - on I/O error
java.lang.IllegalArgumentException - if the node is of type DB.EXTERN
See Also:
DB.getValue(String[])

getValue

void getValue(com.prosyst.util.io.Externalizable e)
              throws java.io.IOException
Reads the value of the node into an Externalizable object.

Parameters:
e - an empty Externalizable instance, whose data will be filled in by the DB, if it has properly implemented its Externalizable.readObject(java.io.InputStream) method.
Throws:
java.io.IOException
java.lang.IllegalArgumentException - if the node is of type DB.EMPTY
See Also:
DB.getValue(String[], Externalizable)

getValue

int getValue(byte[] bytes,
             int offset,
             int length)
             throws java.io.IOException
Reads length bytes from the value, associated with the current node and writes them at off position in the byteArray.

Parameters:
bytes - where data is read to
offset - start position to write in byteArray
length - count of bytes to read
Returns:
number of bytes read, or -1 if the node's type is DB.EMPTY or there is no such node
Throws:
java.io.IOException - If an IO error occurs.
java.lang.IndexOutOfBoundsException - If length is not valid for the supplied byteArray and length
See Also:
DB.getValue(String[], byte[], int, int)

getType

byte getType()
             throws java.io.IOException
Retrieves the type of the node

Returns:
the node type
Throws:
java.io.IOException - on I/O error
See Also:
DB.getType(String[])

delete

void delete()
            throws java.io.IOException
Deletes the current node

Throws:
java.io.IOException - on I/O error
See Also:
DB.delete(String[])

deleteAllBefore

void deleteAllBefore()
                     throws java.io.IOException
Deletes all parent nodes.

Throws:
java.io.IOException - on I/O error

isValid

boolean isValid()
                throws java.io.IOException
Checks if the node is valid. A valid node is one,that belong to open Database, exists and is not marked for deletion.

Returns:
true if the node is valid
Throws:
java.io.IOException

Framework Professional Edition Package


Copyright © 1999-2007 ProSyst Software GmbH. All Rights Reserved