]> git.mxchange.org Git - hub.git/commitdiff
Added exceptions + some code:
authorRoland Häder <roland@mxchange.org>
Thu, 25 Jul 2013 02:21:20 +0000 (02:21 +0000)
committerRoland Häder <roland@mxchange.org>
Thu, 25 Jul 2013 02:21:20 +0000 (02:21 +0000)
- Added two more exceptions for DHT database wrapper
- Added some code that will check for correct conditions in registerNode() and
  updateNode() and makes use of above mentioned exceptions
- Converted more double-quotes to single

28 files changed:
.gitattributes
application/hub/class_ApplicationHelper.php
application/hub/exceptions/announcement/class_AnnouncementNotAcceptedException.php
application/hub/exceptions/announcement/class_NoAnnouncementAttemptedException.php
application/hub/exceptions/connection/class_InvalidConnectionTypeException.php
application/hub/exceptions/ids/class_InvalidSessionIdException.php
application/hub/exceptions/lists/class_InvalidListHashException.php
application/hub/exceptions/lists/class_ListGroupAlreadyAddedException.php
application/hub/exceptions/lists/class_NoListGroupException.php
application/hub/exceptions/node/class_NodeAlreadyAnnouncedException.php
application/hub/exceptions/node/class_NodeSessionIdVerficationException.php
application/hub/exceptions/package/class_FinalChunkVerificationException.php
application/hub/exceptions/package/class_InvalidDataChecksumException.php
application/hub/exceptions/package/class_UnexpectedPackageStatusException.php
application/hub/exceptions/package/class_UnsupportedPackageCodeHandlerException.php
application/hub/exceptions/peer/class_PeerAlreadyRegisteredException.php
application/hub/exceptions/resolver/class_NoValidHostnameException.php
application/hub/exceptions/state/class_InvalidStateException.php
application/hub/exceptions/tags/class_InvalidTagException.php
application/hub/exceptions/tasks/class_InvalidTaskException.php
application/hub/exceptions/wrapper/.htaccess [new file with mode: 0644]
application/hub/exceptions/wrapper/class_NodeAlreadyRegisteredException.php [new file with mode: 0644]
application/hub/exceptions/wrapper/class_NodeDataMissingException.php [new file with mode: 0644]
application/hub/main/database/wrapper/node/class_NodeDistributedHashTableDatabaseWrapper.php
application/hub/main/helper/connection/class_BaseConnectionHelper.php
application/hub/main/registry/socket/class_SocketRegistry.php
application/hub/main/template/answer/class_BaseXmlAnswerTemplateEngine.php
index.php

index 166d3d5b6753c36d3f46d039243ed41d857024c7..f632eae55a50d765af728855f5ecc5c44dd525df 100644 (file)
@@ -42,6 +42,9 @@ application/hub/exceptions/tags/.htaccess -text svneol=unset#text/plain
 application/hub/exceptions/tags/class_InvalidTagException.php svneol=native#text/plain
 application/hub/exceptions/tasks/.htaccess -text svneol=unset#text/plain
 application/hub/exceptions/tasks/class_InvalidTaskException.php svneol=native#text/plain
 application/hub/exceptions/tags/class_InvalidTagException.php svneol=native#text/plain
 application/hub/exceptions/tasks/.htaccess -text svneol=unset#text/plain
 application/hub/exceptions/tasks/class_InvalidTaskException.php svneol=native#text/plain
+application/hub/exceptions/wrapper/.htaccess -text svneol=unset#text/plain
+application/hub/exceptions/wrapper/class_NodeAlreadyRegisteredException.php svneol=native#text/plain
+application/hub/exceptions/wrapper/class_NodeDataMissingException.php svneol=native#text/plain
 application/hub/init.php svneol=native#text/plain
 application/hub/interfaces/.htaccess -text svneol=unset#text/plain
 application/hub/interfaces/apt-proxy/.htaccess svneol=native#text/plain
 application/hub/init.php svneol=native#text/plain
 application/hub/interfaces/.htaccess -text svneol=unset#text/plain
 application/hub/interfaces/apt-proxy/.htaccess svneol=native#text/plain
index 6c1f8858bf6e6ce42cb006d2a57a2cc523b6fb28..afadcc1b038bbbf1f2c810249928705947866c34 100644 (file)
@@ -176,7 +176,7 @@ class ApplicationHelper extends BaseFrameworkSystem implements ManageableApplica
                } // END - if
 
                // ... and a new response object
                } // END - if
 
                // ... and a new response object
-               $responseClass = sprintf("%sResponse", $this->convertToClassName($response));
+               $responseClass = sprintf('%sResponse', $this->convertToClassName($response));
                $responseInstance = ObjectFactory::createObjectByName($responseClass, array($this));
 
                // Remember response instance here
                $responseInstance = ObjectFactory::createObjectByName($responseClass, array($this));
 
                // Remember response instance here
index 6524cb036c84a4c68e903620df330b6b8dfe39b3..2fbbde8ab3c416b8796ca6609659c91685979bd5 100644 (file)
@@ -32,7 +32,7 @@ class AnnouncementNotAcceptedException extends FrameworkException {
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
-               $message = sprintf("[%s:%d] This node (%s) is not accepting announcements, but got one from session-id=%s,ip=%s/%s,listen port=%s,status=%s,mode=%s",
+               $message = sprintf('[%s:%d] This node (%s) is not accepting announcements, but got one from session-id=%s,ip=%s/%s,listen port=%s,status=%s,mode=%s',
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1]->__toString(),
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1]->__toString(),
index 13a9f29f78e80f7f71fdcec74b5ced7a3fccad5b..3cc4a1d6ed775e8bb9f386b4a3db7f6f3acea64f 100644 (file)
@@ -32,7 +32,7 @@ class NoAnnouncementAttemptedException extends FrameworkException {
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
-               $message = sprintf("[%s:%d] This node (%s) has not attempted to announce itself, but got an answer from session-id=%s,ip=%s/%s,listen port=%s,status=%s.",
+               $message = sprintf('[%s:%d] This node (%s) has not attempted to announce itself, but got an answer from session-id=%s,ip=%s/%s,listen port=%s,status=%s.',
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1]->__toString(),
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1]->__toString(),
index 1c508bd9eee2ea5b84a9d66fc7f625627f812eed..325a48eaeb260684faa5d3703141f81772baeb6f 100644 (file)
@@ -31,7 +31,7 @@ class InvalidConnectionTypeException extends FrameworkException {
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
-               $message = sprintf("[%s:%d] Connection type %s is invalid.",
+               $message = sprintf('[%s:%d] Connection type %s is invalid.',
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1]
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1]
index 65ae417a88e519dcfbcae92edd8ef9571d32c0e6..7cc1a49d4dc4ccee63a3d99afdfc45e3442f1c48 100644 (file)
@@ -31,7 +31,7 @@ class InvalidSessionIdException extends FrameworkException {
         */
        public function __construct ($sessionId, $code) {
                // Construct the message
         */
        public function __construct ($sessionId, $code) {
                // Construct the message
-               $message = sprintf("Session id %s is invalid.",
+               $message = sprintf('Session id %s is invalid.',
                        $sessionId
                );
 
                        $sessionId
                );
 
index 30eb3503bc92c2410f71d7a21a10626034038244..a4d89cf33a7ac8a720476c9d01bfc8c6e32e48f5 100644 (file)
@@ -31,7 +31,7 @@ class InvalidListHashException extends FrameworkException {
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
-               $message = sprintf("[%s:%d] Hash %s with key %s is invalid.",
+               $message = sprintf('[%s:%d] Hash %s with key %s is invalid.',
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1],
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1],
index b9ecfc0a326287f75243c29fd68e1afbcfc171f0..85321a7a56118d2f7fd65189b8e35346ee9c1740 100644 (file)
@@ -31,7 +31,7 @@ class ListGroupAlreadyAddedException extends FrameworkException {
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
-               $message = sprintf("[%s:%d] List group %s has already been added.",
+               $message = sprintf('[%s:%d] List group %s has already been added.',
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1]
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1]
index 55766b26199f1b2c24d4cf74a9ee6658b14359f8..fac04d7210c808600131e40f2858c7a4cd85b2a1 100644 (file)
@@ -31,7 +31,7 @@ class NoListGroupException extends FrameworkException {
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
-               $message = sprintf("[%s:%d] List group %s was not found.",
+               $message = sprintf('[%s:%d] List group %s was not found.',
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1]
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1]
index c0b97043836686aadf7c1c83f90730c9794b8f4c..ccb9fbe496fbec57563d26e6a168fb6d71af629e 100644 (file)
@@ -31,7 +31,7 @@ class NodeAlreadyAnnouncedException extends FrameworkException {
         */
        public function __construct (NodeHelper $nodeInstance, $code) {
                // Construct the message
         */
        public function __construct (NodeHelper $nodeInstance, $code) {
                // Construct the message
-               $message = sprintf("[%s:%d] This node is already announced. Please fix this.",
+               $message = sprintf('[%s:%d] This node is already announced. Please fix this.',
                        $nodeInstance->__toString(),
                        $this->getLine()
                );
                        $nodeInstance->__toString(),
                        $this->getLine()
                );
index 7f4e20646a3500ca5af8ad4f699e76ec47331820..f145dfbe99c3913aee5600aae422a44c89a67b8e 100644 (file)
@@ -33,7 +33,7 @@ class NodeSessionIdVerficationException extends FrameworkException {
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
-               $message = sprintf("[%s:%d] Session id %s cannot be verfied. ip=%s/%s,listen port=%s,status=%s.",
+               $message = sprintf('[%s:%d] Session id %s cannot be verfied. ip=%s/%s,listen port=%s,status=%s.',
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1][XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID],
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1][XmlAnnouncementAnswerTemplateEngine::ANNOUNCEMENT_DATA_SESSION_ID],
index 5fb73545cca4ee89b5c3f0e3e7abf3ea9814427a..d889fe3fdeb7ba4e32c1575797a719424879d06a 100644 (file)
@@ -32,7 +32,7 @@ class FinalChunkVerificationException extends FrameworkException {
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
-               $message = sprintf("[%s:%d] The final chunk %s is not a valid EOP (%s) chunk. Total chunks: %s, cause: %s",
+               $message = sprintf('[%s:%d] The final chunk %s is not a valid EOP (%s) chunk. Total chunks: %s, cause: %s',
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1][count($messageArray[1]) - 1],
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1][count($messageArray[1]) - 1],
index a861b9443e3cba031e615802b457d65e536e600f..5bb084dac06ce7dd13d1893fc8bf092b9b7dde5a 100644 (file)
@@ -32,7 +32,7 @@ class InvalidDataChecksumException extends FrameworkException {
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
-               $message = sprintf("[%s:%d] The checksum %s doesn't match the checksum of the content: %s",
+               $message = sprintf('[%s:%d] The checksum %s doesnt match the checksum of the content: %s',
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[0]->getHashFromContentSessionId($messageArray[1], $messageArray[2][NetworkPackage::PACKAGE_DATA_SENDER]),
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[0]->getHashFromContentSessionId($messageArray[1], $messageArray[2][NetworkPackage::PACKAGE_DATA_SENDER]),
index 9f51fc31328be5d43406319141a125a708dd3c54..58d07d5b25bf1f7cd3bea8bf39134a6a2d48fdf5 100644 (file)
@@ -31,7 +31,7 @@ class UnexpectedPackageStatusException extends FrameworkException {
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
-               $message = sprintf("[%s:%d] Unexpected package status %s!=%s detected, recipient=%s, sender=%s, signature=%s.",
+               $message = sprintf('[%s:%d] Unexpected package status %s!=%s detected, recipient=%s, sender=%s, signature=%s.',
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1][NetworkPackage::PACKAGE_DATA_STATUS],
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1][NetworkPackage::PACKAGE_DATA_STATUS],
index a0daadb778b2f9bed23dd4c8f6722c4bd8af87e5..a469032aa3d668820104d5579ea3f48bcb875439 100644 (file)
@@ -31,7 +31,7 @@ class UnsupportedPackageCodeHandlerException extends FrameworkException {
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
-               $message = sprintf("[%s:%d] Unsupported package code handler %s for package code %s detected.",
+               $message = sprintf('[%s:%d] Unsupported package code handler %s for package code %s detected.',
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1],
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1],
index bfefba3f4576c71704c9a4361e5d47d338967e6b..9890567357069bae03ec54e6d89cc97302a17ead 100644 (file)
@@ -31,7 +31,7 @@ class PeerAlreadyRegisteredException extends FrameworkException {
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
-               $message = sprintf("[%s:%d] Sender %s is already registered.",
+               $message = sprintf('[%s:%d] Sender %s is already registered.',
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1][NetworkPackage::PACKAGE_DATA_SENDER]
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1][NetworkPackage::PACKAGE_DATA_SENDER]
index 2eeb24cacc4d8e51fa29a05e8d2dbfacbbf934b2..5dd3873bc5abfbf9d19e97b07c98bf913cc1ab19 100644 (file)
@@ -31,7 +31,7 @@ class NoValidHostnameException extends FrameworkException {
         */
        public function __construct (array $hostName, $code) {
                // Construct the message
         */
        public function __construct (array $hostName, $code) {
                // Construct the message
-               $message = sprintf("Hostname %s cannot be resolved. Port=%d",
+               $message = sprintf('Hostname %s cannot be resolved. Port=%d',
                        $hostName[0],
                        $hostName[1]
                );
                        $hostName[0],
                        $hostName[1]
                );
index 630fc51d5021cffc9b645d9ca27f7fdc821caacc..0c758a68e91b11b5b8061b48cf9cc5b9d04ba69a 100644 (file)
@@ -31,7 +31,7 @@ class InvalidStateException extends FrameworkException {
         */
        public function __construct (Stateable $stateInstance, $code) {
                // Construct the message
         */
        public function __construct (Stateable $stateInstance, $code) {
                // Construct the message
-               $message = sprintf("[%s:%d] Unexpected state detected.",
+               $message = sprintf('[%s:%d] Unexpected state detected.',
                        $stateInstance->__toString(),
                        $this->getLine()
                );
                        $stateInstance->__toString(),
                        $this->getLine()
                );
index 4549918834a7be7da61587c5671a24f8fae3256f..5e4efd9425d21480832a0b12488d2efb12c83eda 100644 (file)
@@ -31,7 +31,7 @@ class InvalidTagException extends FrameworkException {
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
-               $message = sprintf("[%s:%d] Tag %s is invalid.",
+               $message = sprintf('[%s:%d] Tag %s is invalid.',
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1]
                        $messageArray[0]->__toString(),
                        $this->getLine(),
                        $messageArray[1]
index 41ddc0c2b30a509843b1e88c9ba4678f532dda87..8505fdaca354982063d18690c231ce3379300d09 100644 (file)
@@ -31,7 +31,7 @@ class InvalidTaskException extends FrameworkException {
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
         */
        public function __construct (array $messageArray, $code) {
                // Construct the message
-               $message = sprintf("[%s:%d] Current task is invalid which should not happen.",
+               $message = sprintf('[%s:%d] Current task is invalid which should not happen.',
                        $messageArray[0]->__toString(),
                        $this->getLine()
                );
                        $messageArray[0]->__toString(),
                        $this->getLine()
                );
diff --git a/application/hub/exceptions/wrapper/.htaccess b/application/hub/exceptions/wrapper/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/exceptions/wrapper/class_NodeAlreadyRegisteredException.php b/application/hub/exceptions/wrapper/class_NodeAlreadyRegisteredException.php
new file mode 100644 (file)
index 0000000..5cfb66d
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+/**
+ * This exception is thrown when a node is already registered and registerNode() has been called again
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class NodeAlreadyRegisteredException extends FrameworkException {
+       /**
+        * The super constructor for all exceptions
+        *
+        * @param       $messageArray   Error message array
+        * @param       $code                   Error code
+        * @return      void
+        */
+       public function __construct (array $messageArray, $code) {
+               // Construct the message
+               $message = sprintf('[%s:%d] Node already registered: session-id=%s, external-ip=%s, listen-port=%s',
+                       $messageArray[0]->__toString(),
+                       $this->getLine(),
+                       $msssageArray[1][NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_SESSION_ID],
+                       $msssageArray[1][NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_EXTERNAL_IP],
+                       $msssageArray[1][NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_LISTEN_PORT],
+               );
+
+               // Call parent exception constructor
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/exceptions/wrapper/class_NodeDataMissingException.php b/application/hub/exceptions/wrapper/class_NodeDataMissingException.php
new file mode 100644 (file)
index 0000000..0fbe424
--- /dev/null
@@ -0,0 +1,48 @@
+<?php
+/**
+ * This exception is thrown when a node is not yet registered and updateNode() has been called
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2012 Hub Developer Team
+ * @license            GNU GPL 3.0 or any newer version
+ * @link               http://www.ship-simu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+class NodeDataMissingException extends FrameworkException {
+       /**
+        * The super constructor for all exceptions
+        *
+        * @param       $messageArray   Error message array
+        * @param       $code                   Error code
+        * @return      void
+        */
+       public function __construct (array $messageArray, $code) {
+               // Construct the message
+               $message = sprintf('[%s:%d] Node not registered/missing: session-id=%s, external-ip=%s, listen-port=%s',
+                       $messageArray[0]->__toString(),
+                       $this->getLine(),
+                       $msssageArray[1][NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_SESSION_ID],
+                       $msssageArray[1][NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_EXTERNAL_IP],
+                       $msssageArray[1][NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_LISTEN_PORT],
+               );
+
+               // Call parent exception constructor
+               parent::__construct($message, $code);
+       }
+}
+
+// [EOF]
+?>
index 967941664345a40c6450d2c6f2bb449fbcbee2be..0beb31c0d3f02e1f81520bb205ab4824279a1b51 100644 (file)
@@ -34,6 +34,11 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem
        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_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
 
        /**
         * Protected constructor
@@ -230,7 +235,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem
                $handlerInstance->addArrayToDataSet($dataSetInstance, $messageData);
 
                // Remove 'node_list'
                $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);
 
                // Run the "INSERT" query
                $this->queryInsertDataSet($dataSetInstance);
@@ -258,7 +263,7 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem
                $handlerInstance->addArrayToDataSet($dataSetInstance, $messageData);
 
                // Remove 'node_list'
                $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);
 
                // Run the "UPDATE" query
                $this->queryUpdateDataSet($dataSetInstance);
@@ -297,6 +302,13 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem
         * @throws      NodeAlreadyRegisteredException  If the node is already registered
         */
        public function registerNode (array $nodeData) {
         * @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));
        }
 
                $this->partialStub('nodeData=' . print_r($nodeData, TRUE));
        }
 
@@ -310,6 +322,13 @@ class NodeDistributedHashTableDatabaseWrapper extends BaseDatabaseWrapper implem
         * @throws      NodeDataMissingException        If the node's data is missing
         */
        public function updateNode (array $nodeData) {
         * @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));
        }
 }
                $this->partialStub('nodeData=' . print_r($nodeData, TRUE));
        }
 }
index 116903ec58f972bd33018e00d542e05624b3757c..bf0897653c363cdc58729873b21f86e92d36638b 100644 (file)
@@ -23,7 +23,7 @@
  */
 class BaseConnectionHelper extends BaseHubSystemHelper implements Registerable, ProtocolHandler {
        // Exception codes
  */
 class BaseConnectionHelper extends BaseHubSystemHelper implements Registerable, ProtocolHandler {
        // Exception codes
-       const EXCEPTION_UNSUPPORTED_ERROR_HANDLER = 0x900;
+       const EXCEPTION_UNSUPPORTED_ERROR_HANDLER = 0x9100;
 
        /**
         * Connection type 'incoming'
 
        /**
         * Connection type 'incoming'
index d03d2eead0992095d264f4d335c28a0243e732e7..0041ec956a09bed24f624bcd354478cdfedcd9a8 100644 (file)
@@ -23,7 +23,7 @@
  */
 class SocketRegistry extends BaseRegistry implements Register, RegisterableSocket {
        // Exception constants
  */
 class SocketRegistry extends BaseRegistry implements Register, RegisterableSocket {
        // Exception constants
-       const SOCKET_NOT_REGISTERED = 0xd00;
+       const SOCKET_NOT_REGISTERED = 0xd200;
 
        /**
         * Instance of this class
 
        /**
         * Instance of this class
index 37c3ffe3a6e9fdb2eb34e137e3d56a89b7f22041..008cb684098be72c0c46a0eacc2cac19057ed474 100644 (file)
@@ -24,7 +24,7 @@
  */
 class BaseXmlAnswerTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
        /**
  */
 class BaseXmlAnswerTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
        /**
-        * Generic 'answer_status' field
+        * Generic 'answer-status' field
         */
        const ANSWER_STATUS = 'answer-status';
 
         */
        const ANSWER_STATUS = 'answer-status';
 
index 2f8d830cda176562b0a3e4de4e6ab67e401434f8..b399a6a35b9e4c377477f7db7ed2358491976323 100644 (file)
--- a/index.php
+++ b/index.php
@@ -55,7 +55,7 @@ final class ApplicationEntryPoint {
                // Is a message set?
                if (empty($message)) {
                        // No message provided
                // Is a message set?
                if (empty($message)) {
                        // No message provided
-                       $message = 'No message provided!';
+                       $message = 'No message provided.';
                } // END - if
 
                // Get config instance
                } // END - if
 
                // Get config instance