From: Roland Haeder Date: Tue, 24 Mar 2015 17:19:17 +0000 (+0100) Subject: Continued: X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=4b5300bc90a764fb235c1f55aced07a9097ef335;p=hub.git Continued: - Moved classes from wrapper to database/frontend - Removed BaseSate class as this now is in 'core' - Updated 'core' to latest commit Signed-off-by: Roland Haeder --- diff --git a/application/hub/interfaces/database/.htaccess b/application/hub/interfaces/database/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/interfaces/database/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/interfaces/database/frontend/.htaccess b/application/hub/interfaces/database/frontend/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/interfaces/database/frontend/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/interfaces/database/frontend/class_NodeDhtWrapper.php b/application/hub/interfaces/database/frontend/class_NodeDhtWrapper.php new file mode 100644 index 000000000..ae1101b4c --- /dev/null +++ b/application/hub/interfaces/database/frontend/class_NodeDhtWrapper.php @@ -0,0 +1,171 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +interface NodeDhtWrapper extends DatabaseWrapper { + /** + * Static getter for an array of all DHT database entries + * + * @return $elements All elements for the DHT dabase + */ + static function getAllElements (); + + /** + * Getter for result instance for unpublished entries + * + * @return $unpublishedEntriesInstance Result instance + */ + function getUnpublishedEntriesInstance (); + + /** + * Checks whether the local (*this*) node is registered in the DHT by + * checking if the external address is found. + * + * @return $isRegistered Whether *this* node is registered in the DHT + */ + function isLocalNodeRegistered (); + + /** + * Registeres the local (*this*) node with its data in the DHT. + * + * @return void + */ + function registerLocalNode (); + + /** + * Updates local (*this*) node data in DHT, this is but not limited to the + * session id, ip number (and/or hostname) and port number. + * + * @return void + */ + function updateLocalNode (); + + /** + * Finds a node locally by given session id + * + * @param $sessionId Session id to lookup + * @return $nodeData Node data array + */ + function findNodeLocalBySessionId ($sessionId); + + /** + * Registeres a node by given message data. + * + * @param $messageData An array of all message data + * @param $handlerInstance An instance of a HandleableDataSet class + * @return void + */ + function registerNodeByMessageData (array $messageData, HandleableDataSet $handlerInstance); + + /** + * Updates an existing entry in node list + * + * @param $messageData An array of all message data + * @param $handlerInstance An instance of a HandleableDataSet class + * @param $searchInstance An instance of LocalSearchCriteria class + * @return void + */ + function updateNodeByMessageData (array $messageData, HandleableDataSet $handlerInstance, LocalSearchCriteria $searchInstance); + + /** + * Determines whether the given node data is already inserted in the DHT + * + * @param $nodeData An array with valid node data + * @return $isRegistered Whether the given node data is already inserted + */ + function isNodeRegistered (array $nodeData); + + /** + * Registers a node with given data in the DHT. If the node is already + * registered this method shall throw an exception. + * + * @param $nodeData An array with valid node data + * @return void + * @throws NodeAlreadyRegisteredException If the node is already registered + */ + function registerNode (array $nodeData); + + /** + * Updates a node's entry in the DHT with given data. This will enrich or + * just update already exsiting data. If the node is not found this method + * shall throw an exception. + * + * @param $nodeData An array with valid node data + * @return void + * @throws NodeDataMissingException If the node's data is missing + */ + function updateNode (array $nodeData); + + /** + * Checks whether there are unpublished entries + * + * @return $hasUnpublished Whether there are unpublished entries + * @todo Add minimum/maximum age limitations + */ + function hasUnpublishedEntries (); + + /** + * Initializes publication of DHT entries. This does only prepare + * publication. The next step is to pickup such prepared entries and publish + * them by uploading to other (recently appeared) DHT members. + * + * @return void + * @todo Add timestamp to dataset instance + */ + function initEntryPublication (); + + /** + * Removes non-data from given array. + * + * @param $data An array with possible non-data that needs to be removed. + * @return $data A cleaned up array with only data. + */ + function removeNonPublicDataFromArray(array $data); + + /** + * Find recipients for given package data and returns it as a result instance + * + * @param $packageData An array of valid package data + * @return $recipients An indexed array with DHT recipients + */ + function getResultFromExcludedSender (array $packageData); + + /** + * Find recopients by given key/value pair. First look for the key and if it + * matches, compare the value. + * + * @param $key Key to look for + * @param $value Value to compare if key matches + * @return $recipients An indexed array with DHT recipients + */ + function getResultFromKeyValue ($key, $value); + + /** + * Enable DHT bootstrap request acceptance for local node + * + * @return void + */ + function enableAcceptDhtBootstrap (); +} + +// [EOF] +?> diff --git a/application/hub/interfaces/database/frontend/class_NodeInformationWrapper.php b/application/hub/interfaces/database/frontend/class_NodeInformationWrapper.php new file mode 100644 index 000000000..047f67805 --- /dev/null +++ b/application/hub/interfaces/database/frontend/class_NodeInformationWrapper.php @@ -0,0 +1,59 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +interface NodeInformationWrapper extends DatabaseWrapper { + /** + * 'Registers' a new node id along with data provided in the node instance. + * This may sound confusing but avoids double code very nicely... + * + * @param $nodeInstance A node instance + * @param $requestInstance An instance of a Requestable class + * @return void + */ + function registerNodeId (BaseHubNode $nodeInstance, Requestable $requestInstance); + + /** + * 'Registers' a new session id along with data provided in the node instance. + * This may sound confusing but avoids double code very nicely... + * + * @param $nodeInstance An instance of a BaseHubNode class + * @param $requestInstance An instance of a Requestable class + * @param $searchInstance An instance of a LocalSearchCriteria class + * @return void + */ + function registerSessionId (BaseHubNode $nodeInstance, Requestable $requestInstance, LocalSearchCriteria $searchInstance); + + /** + * 'Registers' a private key along with data provided in the node instance. + * This may sound confusing but avoids double code very nicely... + * + * @param $nodeInstance An instance of a BaseHubNode class + * @param $requestInstance An instance of a Requestable class + * @param $searchInstance An instance of a LocalSearchCriteria class + * @return void + */ + function registerPrivateKey (BaseHubNode $nodeInstance, Requestable $requestInstance, LocalSearchCriteria $searchInstance); +} + +// [EOF] +?> diff --git a/application/hub/interfaces/database/frontend/class_UnitDatabaseWrapper.php b/application/hub/interfaces/database/frontend/class_UnitDatabaseWrapper.php new file mode 100644 index 000000000..4afde2d7f --- /dev/null +++ b/application/hub/interfaces/database/frontend/class_UnitDatabaseWrapper.php @@ -0,0 +1,34 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team + * @license GNU GPL 3.0 or any newer version + * @link http://www.shipsimu.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 . + */ +interface UnitDatabaseWrapper extends DatabaseWrapper { + /** + * Checks whether a test unit has been produced + * + * @return $isProduced Whether a test unit has already been produced + */ + function isTestUnitProduced (); +} + +// [EOF] +?> diff --git a/application/hub/interfaces/wrapper/.htaccess b/application/hub/interfaces/wrapper/.htaccess deleted file mode 100644 index 3a4288278..000000000 --- a/application/hub/interfaces/wrapper/.htaccess +++ /dev/null @@ -1 +0,0 @@ -Deny from all diff --git a/application/hub/interfaces/wrapper/class_NodeDhtWrapper.php b/application/hub/interfaces/wrapper/class_NodeDhtWrapper.php deleted file mode 100644 index ae1101b4c..000000000 --- a/application/hub/interfaces/wrapper/class_NodeDhtWrapper.php +++ /dev/null @@ -1,171 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -interface NodeDhtWrapper extends DatabaseWrapper { - /** - * Static getter for an array of all DHT database entries - * - * @return $elements All elements for the DHT dabase - */ - static function getAllElements (); - - /** - * Getter for result instance for unpublished entries - * - * @return $unpublishedEntriesInstance Result instance - */ - function getUnpublishedEntriesInstance (); - - /** - * Checks whether the local (*this*) node is registered in the DHT by - * checking if the external address is found. - * - * @return $isRegistered Whether *this* node is registered in the DHT - */ - function isLocalNodeRegistered (); - - /** - * Registeres the local (*this*) node with its data in the DHT. - * - * @return void - */ - function registerLocalNode (); - - /** - * Updates local (*this*) node data in DHT, this is but not limited to the - * session id, ip number (and/or hostname) and port number. - * - * @return void - */ - function updateLocalNode (); - - /** - * Finds a node locally by given session id - * - * @param $sessionId Session id to lookup - * @return $nodeData Node data array - */ - function findNodeLocalBySessionId ($sessionId); - - /** - * Registeres a node by given message data. - * - * @param $messageData An array of all message data - * @param $handlerInstance An instance of a HandleableDataSet class - * @return void - */ - function registerNodeByMessageData (array $messageData, HandleableDataSet $handlerInstance); - - /** - * Updates an existing entry in node list - * - * @param $messageData An array of all message data - * @param $handlerInstance An instance of a HandleableDataSet class - * @param $searchInstance An instance of LocalSearchCriteria class - * @return void - */ - function updateNodeByMessageData (array $messageData, HandleableDataSet $handlerInstance, LocalSearchCriteria $searchInstance); - - /** - * Determines whether the given node data is already inserted in the DHT - * - * @param $nodeData An array with valid node data - * @return $isRegistered Whether the given node data is already inserted - */ - function isNodeRegistered (array $nodeData); - - /** - * Registers a node with given data in the DHT. If the node is already - * registered this method shall throw an exception. - * - * @param $nodeData An array with valid node data - * @return void - * @throws NodeAlreadyRegisteredException If the node is already registered - */ - function registerNode (array $nodeData); - - /** - * Updates a node's entry in the DHT with given data. This will enrich or - * just update already exsiting data. If the node is not found this method - * shall throw an exception. - * - * @param $nodeData An array with valid node data - * @return void - * @throws NodeDataMissingException If the node's data is missing - */ - function updateNode (array $nodeData); - - /** - * Checks whether there are unpublished entries - * - * @return $hasUnpublished Whether there are unpublished entries - * @todo Add minimum/maximum age limitations - */ - function hasUnpublishedEntries (); - - /** - * Initializes publication of DHT entries. This does only prepare - * publication. The next step is to pickup such prepared entries and publish - * them by uploading to other (recently appeared) DHT members. - * - * @return void - * @todo Add timestamp to dataset instance - */ - function initEntryPublication (); - - /** - * Removes non-data from given array. - * - * @param $data An array with possible non-data that needs to be removed. - * @return $data A cleaned up array with only data. - */ - function removeNonPublicDataFromArray(array $data); - - /** - * Find recipients for given package data and returns it as a result instance - * - * @param $packageData An array of valid package data - * @return $recipients An indexed array with DHT recipients - */ - function getResultFromExcludedSender (array $packageData); - - /** - * Find recopients by given key/value pair. First look for the key and if it - * matches, compare the value. - * - * @param $key Key to look for - * @param $value Value to compare if key matches - * @return $recipients An indexed array with DHT recipients - */ - function getResultFromKeyValue ($key, $value); - - /** - * Enable DHT bootstrap request acceptance for local node - * - * @return void - */ - function enableAcceptDhtBootstrap (); -} - -// [EOF] -?> diff --git a/application/hub/interfaces/wrapper/class_NodeInformationWrapper.php b/application/hub/interfaces/wrapper/class_NodeInformationWrapper.php deleted file mode 100644 index 047f67805..000000000 --- a/application/hub/interfaces/wrapper/class_NodeInformationWrapper.php +++ /dev/null @@ -1,59 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -interface NodeInformationWrapper extends DatabaseWrapper { - /** - * 'Registers' a new node id along with data provided in the node instance. - * This may sound confusing but avoids double code very nicely... - * - * @param $nodeInstance A node instance - * @param $requestInstance An instance of a Requestable class - * @return void - */ - function registerNodeId (BaseHubNode $nodeInstance, Requestable $requestInstance); - - /** - * 'Registers' a new session id along with data provided in the node instance. - * This may sound confusing but avoids double code very nicely... - * - * @param $nodeInstance An instance of a BaseHubNode class - * @param $requestInstance An instance of a Requestable class - * @param $searchInstance An instance of a LocalSearchCriteria class - * @return void - */ - function registerSessionId (BaseHubNode $nodeInstance, Requestable $requestInstance, LocalSearchCriteria $searchInstance); - - /** - * 'Registers' a private key along with data provided in the node instance. - * This may sound confusing but avoids double code very nicely... - * - * @param $nodeInstance An instance of a BaseHubNode class - * @param $requestInstance An instance of a Requestable class - * @param $searchInstance An instance of a LocalSearchCriteria class - * @return void - */ - function registerPrivateKey (BaseHubNode $nodeInstance, Requestable $requestInstance, LocalSearchCriteria $searchInstance); -} - -// [EOF] -?> diff --git a/application/hub/interfaces/wrapper/class_UnitDatabaseWrapper.php b/application/hub/interfaces/wrapper/class_UnitDatabaseWrapper.php deleted file mode 100644 index 4afde2d7f..000000000 --- a/application/hub/interfaces/wrapper/class_UnitDatabaseWrapper.php +++ /dev/null @@ -1,34 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -interface UnitDatabaseWrapper extends DatabaseWrapper { - /** - * Checks whether a test unit has been produced - * - * @return $isProduced Whether a test unit has already been produced - */ - function isTestUnitProduced (); -} - -// [EOF] -?> diff --git a/application/hub/main/states/class_ b/application/hub/main/states/class_ deleted file mode 100644 index a64903978..000000000 --- a/application/hub/main/states/class_ +++ /dev/null @@ -1,40 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 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 . - */ -class ???State extends BaseState implements ??Stateable { - /** - * Protected constructor - * - * @return void - */ - protected function __construct () { - // Call parent constructor - parent::__construct(__CLASS__); - - // Set state name - $this->setStateName('!!!'); - } -} - -// [EOF] -?> diff --git a/application/hub/main/states/class_BaseState.php b/application/hub/main/states/class_BaseState.php deleted file mode 100644 index 2feff48d2..000000000 --- a/application/hub/main/states/class_BaseState.php +++ /dev/null @@ -1,77 +0,0 @@ - - * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team - * @license GNU GPL 3.0 or any newer version - * @link http://www.shipsimu.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 . - */ -class BaseState extends BaseHubSystem implements Stateable { - // Exception code constants - const EXCEPTION_INVALID_STATE = 0xc00; - - /** - * State name for printing out (except debug output where you want to use - * $stateInstance->__toString() instead of this). - */ - private $stateName = ''; - - /** - * Protected constructor - * - * @param $className Name of the class - * @return void - */ - protected function __construct ($className) { - // Call parent constructor - parent::__construct($className); - } - - /** - * Getter for state name - * - * @return $stateName Name of this state in a printable maner - */ - public final function getStateName () { - return $this->stateName; - } - - /** - * Setter for state name - * - * @param $stateName Name of this state in a printable maner - * @return void - */ - protected final function setStateName ($stateName) { - $this->stateName = $stateName; - } - - /** - * Executes the state with given Executor instance - * - * @param $executorInstance An instance of a Executor class - * @return void - * @throws UnsupportedOperationException This method should be overwritten - */ - public function executeState (Executor $executorInstance) { - throw new UnsupportedOperationException(array($this, __FUNCTION__, $executorInstance), self::EXCEPTION_UNSPPORTED_OPERATION); - } -} - -// [EOF] -?> diff --git a/core b/core index 87b2be57b..c0922d6cc 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 87b2be57b63b6e923aab40e0fbba2ff86db88a86 +Subproject commit c0922d6cccd0fb0f1b5221585748e92d02ad1cee