From dc05e3749a3e69de958725419b83dc878dad0b41 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 28 May 2010 02:33:36 +0000 Subject: [PATCH] Added peer states and lookup table classes/interfaces: - Added new PeerStateable interface for peer states - Added new Lookupable interface for lookup tables - Added new PeerStateFactory class for generating peer states - Added new PeerStateLookupTable class for looking up peer states - Added new NewConnectionPeerState class for new peer connections --- .gitattributes | 9 ++ application/hub/config.php | 9 ++ application/hub/interfaces/lookup/.htaccess | 1 + .../interfaces/lookup/class_Lookupable.php | 28 ++++++ application/hub/interfaces/states/class_ | 28 ++++++ .../hub/interfaces/states/peer/.htaccess | 1 + .../states/peer/class_PeerStateable.php | 28 ++++++ .../class_PeerStateLookupDatabaseWrapper.php | 92 +++++++++++++++++++ .../factories/states/class_StateFactory.php | 2 +- .../hub/main/factories/states/peer/.htaccess | 1 + .../states/peer/class_PeerStateFactory.php | 92 +++++++++++++++++++ application/hub/main/lookup/.htaccess | 1 + application/hub/main/lookup/class_ | 50 ++++++++++ .../hub/main/lookup/class_BaseLookupTable.php | 38 ++++++++ application/hub/main/lookup/peer/.htaccess | 1 + .../peer/class_PeerStateLookupTable.php | 56 +++++++++++ .../network/class_NetworkStateResolver.php | 5 +- application/hub/main/states/peer/class_ | 50 ++++++++++ .../hub/main/states/peer/new/.htaccess | 1 + .../peer/new/class_NewConnectionPeerState.php | 50 ++++++++++ db/peer_states/.htaccess | 1 + 21 files changed, 540 insertions(+), 4 deletions(-) create mode 100644 application/hub/interfaces/lookup/.htaccess create mode 100644 application/hub/interfaces/lookup/class_Lookupable.php create mode 100644 application/hub/interfaces/states/peer/.htaccess create mode 100644 application/hub/interfaces/states/peer/class_PeerStateable.php create mode 100644 application/hub/main/database/wrapper/class_PeerStateLookupDatabaseWrapper.php create mode 100644 application/hub/main/factories/states/peer/.htaccess create mode 100644 application/hub/main/factories/states/peer/class_PeerStateFactory.php create mode 100644 application/hub/main/lookup/.htaccess create mode 100644 application/hub/main/lookup/class_ create mode 100644 application/hub/main/lookup/class_BaseLookupTable.php create mode 100644 application/hub/main/lookup/peer/.htaccess create mode 100644 application/hub/main/lookup/peer/class_PeerStateLookupTable.php create mode 100644 application/hub/main/states/peer/class_ create mode 100644 application/hub/main/states/peer/new/.htaccess create mode 100644 application/hub/main/states/peer/new/class_NewConnectionPeerState.php create mode 100644 db/peer_states/.htaccess diff --git a/.gitattributes b/.gitattributes index 269bdaf92..61dd4b367 100644 --- a/.gitattributes +++ b/.gitattributes @@ -34,6 +34,7 @@ application/hub/interfaces/listener/.htaccess -text application/hub/interfaces/listener/class_Listenable.php -text application/hub/interfaces/lists/.htaccess -text application/hub/interfaces/lists/class_Listable.php -text +application/hub/interfaces/lookup/.htaccess -text application/hub/interfaces/nodes/.htaccess -text application/hub/interfaces/nodes/class_NodeHelper.php -text application/hub/interfaces/package/.htaccess -text @@ -59,6 +60,7 @@ application/hub/interfaces/states/hub/.htaccess -text application/hub/interfaces/states/hub/class_HubStateable.php -text application/hub/interfaces/states/node/.htaccess -text application/hub/interfaces/states/node/class_NodeStateable.php -text +application/hub/interfaces/states/peer/.htaccess -text application/hub/interfaces/tags/.htaccess -text application/hub/interfaces/tasks/.htaccess -text application/hub/interfaces/tasks/class_Taskable.php -text @@ -120,6 +122,7 @@ application/hub/main/factories/lists/.htaccess -text application/hub/main/factories/package/.htaccess -text application/hub/main/factories/states/.htaccess -text application/hub/main/factories/states/class_StateFactory.php -text +application/hub/main/factories/states/peer/.htaccess -text application/hub/main/factories/tags/.htaccess -text application/hub/main/filter/.htaccess -text application/hub/main/filter/activation/.htaccess -text @@ -223,6 +226,9 @@ application/hub/main/lists/query/local/class_LocalQueryList.php -text application/hub/main/lists/recipient/.htaccess -text application/hub/main/lists/tasks/.htaccess -text application/hub/main/lists/tasks/class_TaskList.php -text +application/hub/main/lookup/.htaccess -text +application/hub/main/lookup/class_ -text +application/hub/main/lookup/peer/.htaccess -text application/hub/main/nodes/.htaccess -text application/hub/main/nodes/boot/.htaccess -text application/hub/main/nodes/boot/class_HubBootNode.php -text @@ -284,7 +290,9 @@ application/hub/main/states/node/init/class_NodeInitState.php -text application/hub/main/states/node/virgin/.htaccess -text application/hub/main/states/node/virgin/class_NodeVirginState.php -text application/hub/main/states/peer/.htaccess -text +application/hub/main/states/peer/class_ -text application/hub/main/states/peer/class_BasePeerState.php -text +application/hub/main/states/peer/new/.htaccess -text application/hub/main/tags/.htaccess -text application/hub/main/tags/class_ -text application/hub/main/tags/package/.htaccess -text @@ -335,6 +343,7 @@ db/.htaccess -text db/news/.htaccess -text db/node_data/.htaccess -text db/node_list/.htaccess -text +db/peer_states/.htaccess -text docs/COPYING -text docs/COPYING.documents -text docs/COPYING.software -text diff --git a/application/hub/config.php b/application/hub/config.php index 70ff10389..c7fec7a33 100644 --- a/application/hub/config.php +++ b/application/hub/config.php @@ -51,6 +51,9 @@ $cfg->setConfigEntry('node_info_db_wrapper_class', 'NodeInformationDatabaseWrapp // CFG: NODE-LIST-DB-WRAPPER-CLASS $cfg->setConfigEntry('node_list_db_wrapper_class', 'NodeListDatabaseWrapper'); +// CFG: PEER-LOOKUP-DB-WRAPPER-CLASS +$cfg->setConfigEntry('peer_lookup_db_wrapper_class', 'PeerLookupDatabaseWrapper'); + // CFG: WEB-CONTENT-TYPE $cfg->setConfigEntry('web_content_type', ''); @@ -411,5 +414,11 @@ $cfg->setConfigEntry('tcp_connect_retry_max', 10); // CFG: UDP-CONNECT-RETRY-MAX $cfg->setConfigEntry('udp_connect_retry_max', 10); +// CFG: PEER-STATE-LOOKUP-TABLE-CLASS +$cfg->setConfigEntry('peer_state_lookup_table_class', 'PeerStateLookupTable'); + +// CFG: PEER-STATE-CHECKED-PACKAGE-CLASS +$cfg->setConfigEntry('peer_state_checked_package_class', 'NewConnectionPeerState'); + // [EOF] ?> diff --git a/application/hub/interfaces/lookup/.htaccess b/application/hub/interfaces/lookup/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/interfaces/lookup/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/interfaces/lookup/class_Lookupable.php b/application/hub/interfaces/lookup/class_Lookupable.php new file mode 100644 index 000000000..ccaf19cd3 --- /dev/null +++ b/application/hub/interfaces/lookup/class_Lookupable.php @@ -0,0 +1,28 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 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 . + */ +interface Lookupable extends FrameworkInterface { +} + +// [EOF] +?> diff --git a/application/hub/interfaces/states/class_ b/application/hub/interfaces/states/class_ index e69de29bb..fa5569358 100644 --- a/application/hub/interfaces/states/class_ +++ b/application/hub/interfaces/states/class_ @@ -0,0 +1,28 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 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 . + */ +interface ???Stateable extends Stateable { +} + +// [EOF] +?> diff --git a/application/hub/interfaces/states/peer/.htaccess b/application/hub/interfaces/states/peer/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/interfaces/states/peer/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/interfaces/states/peer/class_PeerStateable.php b/application/hub/interfaces/states/peer/class_PeerStateable.php new file mode 100644 index 000000000..c2b6ac2d0 --- /dev/null +++ b/application/hub/interfaces/states/peer/class_PeerStateable.php @@ -0,0 +1,28 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 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 . + */ +interface PeerStateable extends Stateable { +} + +// [EOF] +?> diff --git a/application/hub/main/database/wrapper/class_PeerStateLookupDatabaseWrapper.php b/application/hub/main/database/wrapper/class_PeerStateLookupDatabaseWrapper.php new file mode 100644 index 000000000..1352626b3 --- /dev/null +++ b/application/hub/main/database/wrapper/class_PeerStateLookupDatabaseWrapper.php @@ -0,0 +1,92 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 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 PeerStateLookupDatabaseWrapper extends BaseDatabaseWrapper { + // Constants for database table names + const DB_TABLE_PEER_LOOKUP = 'peer_states'; + + // Constants for database column names + const DB_COLUMN_PEER_IP = 'peer_ip'; + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this database wrapper by a provided user class + * + * @return $wrapperInstance An instance of the created wrapper class + */ + public final static function createPeerLookupDatabaseWrapper () { + // Get a new instance + $wrapperInstance = new PeerLookupDatabaseWrapper(); + + // Set (primary!) table name + $wrapperInstance->setTableName(self::DB_TABLE_PEER_LOOKUP); + + // Return the instance + return $wrapperInstance; + } + + /** + * Getter for index key + * + * @return $indexKey Index key + */ + public final function getIndexKey () { + return $this->getDatabaseInstance()->getIndexKey(); + } + + /** + * Checks wether given 'sender' is a new peer + * + * @param $packageData Raw package data + * @return $isNewPeer Wether 'sender' is a new peer to this node + */ + public function isSenderNewPeer (array $packageData) { + // Get a search criteria instance + $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class'); + + // Add 'sender' as the peer's IP (this must already be looked up!) + $searchInstance->addCriteria(self::DB_COLUMN_PEER_IP, $packageData['sender']); + $searchInstance->setLimit(1); + + // Count the query + $entries = $this->doSelectCountByCriteria($searchInstance); + + // Is it there? + $isNewPeer = ($entries === 0); + + // Return the result + return $isNewPeer; + } +} + +// [EOF] +?> diff --git a/application/hub/main/factories/states/class_StateFactory.php b/application/hub/main/factories/states/class_StateFactory.php index f39e0cbf3..876e1d0f4 100644 --- a/application/hub/main/factories/states/class_StateFactory.php +++ b/application/hub/main/factories/states/class_StateFactory.php @@ -40,7 +40,7 @@ class StateFactory extends ObjectFactory { * @param $nodeInstance A NodeHelper class instance * @return $stateInstance A Stateable class instance */ - public static final function createStateInstanceByName($stateName, NodeHelper $nodeInstance) { + public static final function createStateInstanceByName ($stateName, NodeHelper $nodeInstance) { // Then construct the class' configuraton entry $className = 'node_' . $stateName . '_state_class'; diff --git a/application/hub/main/factories/states/peer/.htaccess b/application/hub/main/factories/states/peer/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/factories/states/peer/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/factories/states/peer/class_PeerStateFactory.php b/application/hub/main/factories/states/peer/class_PeerStateFactory.php new file mode 100644 index 000000000..d7edad9f7 --- /dev/null +++ b/application/hub/main/factories/states/peer/class_PeerStateFactory.php @@ -0,0 +1,92 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 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 PeerStateFactory extends ObjectFactory { + /** + * Static lookup table instance + */ + private static $tableInstance = null; + + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates a peer state instance based on errorCode if no entry is found in the lookup table + * for the peer given in $packageData 'sender' element or it changes the state if it differs + * from current state. + * + * @param $errorCode The last error code + * @param $packageData Raw package data + * @return $stateInstance A Stateable class instance + */ + public static final function createPeerStateInstanceByErrorCode ($errorCode, array $packageData) { + // So first we need our lookup table + $tableInstance = self::getTableInstance(); + + // Do we have an entry? + if ($tableInstance->isSenderNewPeer($packageData)) { + // Is a new peer so create the state instance based on error code, first we need a config entry + $configEntry = 'peer_state_' . $errorCode . '_class'; + + // Then get it + $stateInstance = ObjectFactory::createObjectByConfiguredName($configEntry); + + // And register it with the lookup table + $tableInstance->registerPeerState($stateInstance, $packageData); + } else { + // It is a known peer, so we need to check if the state has changed + die(__METHOD__ . ': Lookup!' . "\n"); + } + + // For any purposes, return the state instance + die(__METHOD__."\n"); + return $stateInstance; + } + + /** + * Singleton getter for lookup table instances, kept public if we need this + * table somewhere else. + * + * @return $tableInstance An instance of a lookup table + */ + public final static function getTableInstance () { + // Is the instance null? + if (is_null(self::$tableInstance)) { + // Get a new one + self::$tableInstance = ObjectFactory::createObjectByConfiguredName('peer_state_lookup_table_class'); + } // END - if + + // Return it + return self::$tableInstance; + } +} + +// [EOF] +?> diff --git a/application/hub/main/lookup/.htaccess b/application/hub/main/lookup/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/lookup/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/lookup/class_ b/application/hub/main/lookup/class_ new file mode 100644 index 000000000..f54be04e2 --- /dev/null +++ b/application/hub/main/lookup/class_ @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 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 ???LookupTable extends BaseLookupTable implements Lookupable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $tableInstance An instance of a Lookupable class + */ + public final static function create???LookupTable () { + // Get new instance + $tableInstance = new ???LookupTable(); + + // Return the prepared instance + return $tableInstance; + } +} + +// [EOF] +?> diff --git a/application/hub/main/lookup/class_BaseLookupTable.php b/application/hub/main/lookup/class_BaseLookupTable.php new file mode 100644 index 000000000..07318c88b --- /dev/null +++ b/application/hub/main/lookup/class_BaseLookupTable.php @@ -0,0 +1,38 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 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 BaseLookupTable extends BaseHubSystem { + /** + * Protected constructor + * + * @param $className Name of the class + * @return void + */ + protected function __construct ($className) { + // Call parent constructor + parent::__construct($className); + } +} + +// [EOF] +?> diff --git a/application/hub/main/lookup/peer/.htaccess b/application/hub/main/lookup/peer/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/lookup/peer/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/lookup/peer/class_PeerStateLookupTable.php b/application/hub/main/lookup/peer/class_PeerStateLookupTable.php new file mode 100644 index 000000000..35095adb1 --- /dev/null +++ b/application/hub/main/lookup/peer/class_PeerStateLookupTable.php @@ -0,0 +1,56 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 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 PeerStateLookupTable extends BaseLookupTable implements Lookupable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $tableInstance An instance of a Lookupable class + */ + public final static function createPeerLookupTable () { + // Get new instance + $tableInstance = new PeerLookupTable(); + + // Get a database wrapper instance + $wrapperInstance = ObjectFactory::createObjectByConfiguredName('peer_state_lookup_db_wrapper_class'); + + // Set it for later re-use + $tableInstance->setWrapperInstance($wrapperInstance); + + // Return the prepared instance + return $tableInstance; + } +} + +// [EOF] +?> diff --git a/application/hub/main/resolver/state/network/class_NetworkStateResolver.php b/application/hub/main/resolver/state/network/class_NetworkStateResolver.php index cd314f033..203a87149 100644 --- a/application/hub/main/resolver/state/network/class_NetworkStateResolver.php +++ b/application/hub/main/resolver/state/network/class_NetworkStateResolver.php @@ -86,9 +86,8 @@ class NetworkStateResolver extends BaseStateResolver implements StateResolver { $errorCode = BaseNetworkPackageHandler::SOCKET_ERROR_UNKNOWN; } // END - if - // @TODO We need to somehow detect the state/status of the remote peer and still maintain good speed. - // @TODO So maybe some pre-instancing of classes might help here to speedup this I/O intensive process. - $this->partialStub('errorCode=' . $errorCode . ',packageData[] = ' . gettype($packageData) . '(' . count($packageData) . ')'); + // Create a state instance based on $errorCode. This factory does the hard work for us + $stateInstance = PeerStateFactory::createPeerStateInstanceByErrorCode($errorCode, $packageData); // Return the prepared instance return $stateInstance; diff --git a/application/hub/main/states/peer/class_ b/application/hub/main/states/peer/class_ new file mode 100644 index 000000000..3edf26d64 --- /dev/null +++ b/application/hub/main/states/peer/class_ @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 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 ???PeerState extends BasePeerState implements PeerStateable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $stateInstance An instance of a PeerStateable class + */ + public final static function create???PeerState () { + // Get new instance + $stateInstance = new ???PeerState(); + + // Return the prepared instance + return $stateInstance; + } +} + +// [EOF] +?> diff --git a/application/hub/main/states/peer/new/.htaccess b/application/hub/main/states/peer/new/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/application/hub/main/states/peer/new/.htaccess @@ -0,0 +1 @@ +Deny from all diff --git a/application/hub/main/states/peer/new/class_NewConnectionPeerState.php b/application/hub/main/states/peer/new/class_NewConnectionPeerState.php new file mode 100644 index 000000000..261646053 --- /dev/null +++ b/application/hub/main/states/peer/new/class_NewConnectionPeerState.php @@ -0,0 +1,50 @@ + + * @version 0.0.0 + * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 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 NewConnectionPeerState extends BasePeerState implements PeerStateable { + /** + * Protected constructor + * + * @return void + */ + protected function __construct () { + // Call parent constructor + parent::__construct(__CLASS__); + } + + /** + * Creates an instance of this class + * + * @return $stateInstance An instance of a PeerStateable class + */ + public final static function createNewConnectionPeerState () { + // Get new instance + $stateInstance = new NewConnectionPeerState(); + + // Return the prepared instance + return $stateInstance; + } +} + +// [EOF] +?> diff --git a/db/peer_states/.htaccess b/db/peer_states/.htaccess new file mode 100644 index 000000000..3a4288278 --- /dev/null +++ b/db/peer_states/.htaccess @@ -0,0 +1 @@ +Deny from all -- 2.39.2