const DB_COLUMN_PRIVATE_KEY_HASH = 'private_key_hash';
const DB_COLUMN_NODE_MODE = 'node_mode';
const DB_COLUMN_ACCEPTED_OBJECTS = 'accepted_object_types';
+ const DB_COLUMN_NODE_LIST = 'node_list';
+
+ // Exception codes
+ const EXCEPTION_NODE_ALREADY_REGISTERED = 0x800;
+ const EXCEPTION_NODE_NOT_REGISTERED = 0x801;
/**
* Protected constructor
$handlerInstance->addArrayToDataSet($dataSetInstance, $messageData);
// Remove 'node_list'
- $dataSetInstance->unsetCriteria('node_list');
+ $dataSetInstance->unsetCriteria(self::DB_COLUMN_NODE_LIST);
// Run the "INSERT" query
$this->queryInsertDataSet($dataSetInstance);
$handlerInstance->addArrayToDataSet($dataSetInstance, $messageData);
// Remove 'node_list'
- $dataSetInstance->unsetCriteria('node_list');
+ $dataSetInstance->unsetCriteria(self::DB_COLUMN_NODE_LIST);
// Run the "UPDATE" query
$this->queryUpdateDataSet($dataSetInstance);
* @throws NodeAlreadyRegisteredException If the node is already registered
*/
public function registerNode (array $nodeData) {
+ // Is the node registered?
+ if ($this->isNodeRegistered($nodeData)) {
+ // Throw an exception
+ throw new NodeAlreadyRegisteredException(array($this, $nodeData), self::EXCEPTION_NODE_ALREADY_REGISTERED);
+ } // END - if
+
+ // @TODO Unimplemented part
$this->partialStub('nodeData=' . print_r($nodeData, TRUE));
}
* @throws NodeDataMissingException If the node's data is missing
*/
public function updateNode (array $nodeData) {
+ // Is the node registered?
+ if (!$this->isNodeRegistered($nodeData)) {
+ // No, then throw an exception
+ throw new NodeDataMissingException(array($this, $nodeData), self::EXCEPTION_NODE_NOT_REGISTERED);
+ } // END - if
+
+ // @TODO Unimplemented part
$this->partialStub('nodeData=' . print_r($nodeData, TRUE));
}
}