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
} // 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
*/
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(),
*/
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(),
*/
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]
*/
public function __construct ($sessionId, $code) {
// Construct the message
- $message = sprintf("Session id %s is invalid.",
+ $message = sprintf('Session id %s is invalid.',
$sessionId
);
*/
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],
*/
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]
*/
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]
*/
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()
);
*/
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],
*/
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],
*/
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]),
*/
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],
*/
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],
*/
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]
*/
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]
);
*/
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()
);
*/
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]
*/
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()
);
--- /dev/null
+Deny from all
--- /dev/null
+<?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]
+?>
--- /dev/null
+<?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]
+?>
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));
}
}
*/
class BaseConnectionHelper extends BaseHubSystemHelper implements Registerable, ProtocolHandler {
// Exception codes
- const EXCEPTION_UNSUPPORTED_ERROR_HANDLER = 0x900;
+ const EXCEPTION_UNSUPPORTED_ERROR_HANDLER = 0x9100;
/**
* Connection type 'incoming'
*/
class SocketRegistry extends BaseRegistry implements Register, RegisterableSocket {
// Exception constants
- const SOCKET_NOT_REGISTERED = 0xd00;
+ const SOCKET_NOT_REGISTERED = 0xd200;
/**
* Instance of this class
*/
class BaseXmlAnswerTemplateEngine extends BaseXmlTemplateEngine implements CompileableTemplate, Registerable {
/**
- * Generic 'answer_status' field
+ * Generic 'answer-status' field
*/
const ANSWER_STATUS = 'answer-status';
// Is a message set?
if (empty($message)) {
// No message provided
- $message = 'No message provided!';
+ $message = 'No message provided.';
} // END - if
// Get config instance