]> git.mxchange.org Git - hub.git/commitdiff
Added more classes (source for anything 'sourced', etc):
authorRoland Häder <roland@mxchange.org>
Tue, 29 Mar 2011 15:55:38 +0000 (15:55 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 29 Mar 2011 15:55:38 +0000 (15:55 +0000)
- Added some (partly unused) more classes for creating test units
- CryptoRandomMessageHelper is currently unused
- Added factory to create unit source classes
- TODOs.txt updated

22 files changed:
.gitattributes
application/hub/config.php
application/hub/interfaces/messages/.htaccess [new file with mode: 0644]
application/hub/interfaces/messages/class_MessageHelper.php [new file with mode: 0644]
application/hub/interfaces/source/.htaccess [new file with mode: 0644]
application/hub/interfaces/source/class_Sourceable.php [new file with mode: 0644]
application/hub/main/factories/source/.htaccess [new file with mode: 0644]
application/hub/main/factories/source/units/.htaccess [new file with mode: 0644]
application/hub/main/factories/source/units/class_UnitSourceFactory.php [new file with mode: 0644]
application/hub/main/helper/messages/.htaccess [new file with mode: 0644]
application/hub/main/helper/messages/class_ [new file with mode: 0644]
application/hub/main/helper/messages/class_BaseMessageHelper.php [new file with mode: 0644]
application/hub/main/helper/messages/crypto/.htaccess [new file with mode: 0644]
application/hub/main/helper/messages/crypto/class_CryptoRandomMessageHelper.php [new file with mode: 0644]
application/hub/main/producer/class_BaseProducer.php
application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php
application/hub/main/source/.htaccess [new file with mode: 0644]
application/hub/main/source/class_ [new file with mode: 0644]
application/hub/main/source/class_BaseSource.php [new file with mode: 0644]
application/hub/main/source/units/.htaccess [new file with mode: 0644]
application/hub/main/source/units/class_TestUnitSource.php [new file with mode: 0644]
docs/TODOs.txt

index aff797b2c56f12f561c205ab049945dde1235f67..420e1e446ed8c2bf93dd965bd75529a63eb6833e 100644 (file)
@@ -54,6 +54,8 @@ application/hub/interfaces/lookup/.htaccess -text svneol=unset#text/plain
 application/hub/interfaces/lookup/class_Lookupable.php svneol=native#text/plain
 application/hub/interfaces/lookup/peer_states/.htaccess -text svneol=unset#text/plain
 application/hub/interfaces/lookup/peer_states/class_LookupablePeerState.php -text svneol=unset#text/plain
+application/hub/interfaces/messages/.htaccess svneol=native#text/plain
+application/hub/interfaces/messages/class_MessageHelper.php svneol=native#text/plain
 application/hub/interfaces/nodes/.htaccess -text svneol=unset#text/plain
 application/hub/interfaces/nodes/class_NodeHelper.php -text svneol=unset#text/plain
 application/hub/interfaces/package/.htaccess -text svneol=unset#text/plain
@@ -78,6 +80,8 @@ application/hub/interfaces/queues/.htaccess -text svneol=unset#text/plain
 application/hub/interfaces/queues/class_Queueable.php -text svneol=unset#text/plain
 application/hub/interfaces/socket/.htaccess -text svneol=unset#text/plain
 application/hub/interfaces/socket/class_SocketTag.php svneol=native#text/plain
+application/hub/interfaces/source/.htaccess svneol=native#text/plain
+application/hub/interfaces/source/class_Sourceable.php svneol=native#text/plain
 application/hub/interfaces/states/.htaccess -text svneol=unset#text/plain
 application/hub/interfaces/states/class_ -text svneol=unset#text/plain
 application/hub/interfaces/states/class_Stateable.php -text svneol=unset#text/plain
@@ -178,6 +182,9 @@ application/hub/main/factories/package/.htaccess -text svneol=unset#text/plain
 application/hub/main/factories/package/class_NetworkPackageFactory.php svneol=native#text/plain
 application/hub/main/factories/socket/.htaccess -text svneol=unset#text/plain
 application/hub/main/factories/socket/class_SocketFactory.php svneol=native#text/plain
+application/hub/main/factories/source/.htaccess svneol=native#text/plain
+application/hub/main/factories/source/units/.htaccess svneol=native#text/plain
+application/hub/main/factories/source/units/class_UnitSourceFactory.php svneol=native#text/plain
 application/hub/main/factories/states/.htaccess -text svneol=unset#text/plain
 application/hub/main/factories/states/class_StateFactory.php -text svneol=unset#text/plain
 application/hub/main/factories/states/peer/.htaccess -text svneol=unset#text/plain
@@ -279,6 +286,11 @@ application/hub/main/helper/hub/class_ -text svneol=unset#text/plain
 application/hub/main/helper/hub/class_BaseHubHelper.php -text svneol=unset#text/plain
 application/hub/main/helper/hub/connection/.htaccess -text svneol=unset#text/plain
 application/hub/main/helper/hub/connection/class_HubSelfConnectHelper.php svneol=native#text/plain
+application/hub/main/helper/messages/.htaccess svneol=native#text/plain
+application/hub/main/helper/messages/class_ -text
+application/hub/main/helper/messages/class_BaseMessageHelper.php svneol=native#text/plain
+application/hub/main/helper/messages/crypto/.htaccess svneol=native#text/plain
+application/hub/main/helper/messages/crypto/class_CryptoRandomMessageHelper.php svneol=native#text/plain
 application/hub/main/helper/work_units/.htaccess svneol=native#text/plain
 application/hub/main/helper/work_units/class_ -text
 application/hub/main/helper/work_units/class_BaseWorkUnitHelper.php svneol=native#text/plain
@@ -394,6 +406,11 @@ application/hub/main/resolver/state/.htaccess -text svneol=unset#text/plain
 application/hub/main/resolver/state/class_BaseStateResolver.php -text svneol=unset#text/plain
 application/hub/main/resolver/state/network/.htaccess -text svneol=unset#text/plain
 application/hub/main/resolver/state/network/class_NetworkStateResolver.php -text svneol=unset#text/plain
+application/hub/main/source/.htaccess svneol=native#text/plain
+application/hub/main/source/class_ -text
+application/hub/main/source/class_BaseSource.php svneol=native#text/plain
+application/hub/main/source/units/.htaccess svneol=native#text/plain
+application/hub/main/source/units/class_TestUnitSource.php svneol=native#text/plain
 application/hub/main/states/.htaccess -text svneol=unset#text/plain
 application/hub/main/states/class_ -text svneol=unset#text/plain
 application/hub/main/states/class_BaseState.php -text svneol=unset#text/plain
index 198cf29ef67226291dfc7f261645f5343f939f99..3377f8b2bd2ae517128559accb77e6d81baf6910 100644 (file)
@@ -565,10 +565,13 @@ $cfg->setConfigEntry('cruncher_test_unit_max_count', 1000);
 $cfg->setConfigEntry('cruncher_unit_db_wrapper_class', 'CruncherUnitDatabaseWrapper');
 
 // CFG: CRUNCHER-RANDOM-SECRET-MESSAGE-LENGTH
-$cfg->setConfigEntry('cruncher_random_secret_message_length', 100);
+$cfg->setConfigEntry('random_secret_message_length', 100);
 
 // CFG: CRUNCHER-RANDOM-SECRET-KEY-LENGTH
-$cfg->setConfigEntry('cruncher_random_secret_key_length', 8);
+$cfg->setConfigEntry('random_secret_key_length', 8);
+
+// CFG: TEST-UNIT-SOURCE-CLASS
+$cfg->setConfigEntry('test_unit_source_class', 'TestUnitSource');
 
 // [EOF]
 ?>
diff --git a/application/hub/interfaces/messages/.htaccess b/application/hub/interfaces/messages/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/interfaces/messages/class_MessageHelper.php b/application/hub/interfaces/messages/class_MessageHelper.php
new file mode 100644 (file)
index 0000000..987d10d
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+/**
+ * An interface for message helper
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 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/>.
+ */
+interface MessageHelper extends FrameworkInterface {
+}
+
+// [EOF]
+?>
diff --git a/application/hub/interfaces/source/.htaccess b/application/hub/interfaces/source/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/interfaces/source/class_Sourceable.php b/application/hub/interfaces/source/class_Sourceable.php
new file mode 100644 (file)
index 0000000..53acfd5
--- /dev/null
@@ -0,0 +1,34 @@
+<?php
+/**
+ * An interface for sources
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 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/>.
+ */
+interface Sourceable extends FrameworkInterface {
+       /**
+        * "Getter" or generator for a message
+        *
+        * @return      $message        A message from our source
+        */
+       function generateMessageFromSource ();
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/factories/source/.htaccess b/application/hub/main/factories/source/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/factories/source/units/.htaccess b/application/hub/main/factories/source/units/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/factories/source/units/class_UnitSourceFactory.php b/application/hub/main/factories/source/units/class_UnitSourceFactory.php
new file mode 100644 (file)
index 0000000..6c9ded7
--- /dev/null
@@ -0,0 +1,62 @@
+<?php
+/**
+ * A factory class for unit sources
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 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 UnitSourceFactory extends ObjectFactory {
+       /**
+        * Source instances
+        */
+       private static $sourceInstances = array();
+
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of a configurable and singleton unit source
+        *
+        * @param       $unitType                       Type of the unit source
+        * @return      $sourceInstance         A Sourceable class instance
+        */
+       public static final function createUnitSourceInstance ($unitType) {
+               // Do we have cache?
+               if (!isset(self::$sourceInstances[$unitType])) {
+                       // Then construct the class' configuraton entry
+                       $className = '' . $unitType . '_unit_source_class';
+
+                       // Get a class from that configuration entry
+                       self::$sourceInstances[$unitType] = self::createObjectByConfiguredName($className);
+               } // END - if
+
+               // For any purposes, return the source instance
+               return self::$sourceInstances[$unitType];
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/helper/messages/.htaccess b/application/hub/main/helper/messages/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/helper/messages/class_ b/application/hub/main/helper/messages/class_
new file mode 100644 (file)
index 0000000..ef16279
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/**
+ * A ??? message helper
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 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 ???MessageHelper extends BaseMessageHelper implements MessageHelper {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $messageInstance        An instance of a UnitHelper class
+        */
+       public final static function create???MessageHelper () {
+               // Get new instance
+               $messageInstance = new ???MessageHelper();
+
+               // Return the prepared instance
+               return $messageInstance;
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/helper/messages/class_BaseMessageHelper.php b/application/hub/main/helper/messages/class_BaseMessageHelper.php
new file mode 100644 (file)
index 0000000..8d1b579
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+/**
+ * A general Message class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 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/>.
+ */
+abstract class BaseMessageHelper extends BaseFrameworkSystem {
+       /**
+        * 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/helper/messages/crypto/.htaccess b/application/hub/main/helper/messages/crypto/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/helper/messages/crypto/class_CryptoRandomMessageHelper.php b/application/hub/main/helper/messages/crypto/class_CryptoRandomMessageHelper.php
new file mode 100644 (file)
index 0000000..ac725f6
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/**
+ * A CryptoRandom message helper
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 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 CryptoRandomMessageHelper extends BaseMessageHelper implements MessageHelper {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $messageInstance        An instance of a UnitHelper class
+        */
+       public final static function createCryptoRandomMessageHelper () {
+               // Get new instance
+               $messageInstance = new CryptoRandomMessageHelper();
+
+               // Return the prepared instance
+               return $messageInstance;
+       }
+}
+
+// [EOF]
+?>
index 2b20adeea3e121ea4fbc2a034d7f458fc9dacdce..81c21284a219fd63261fb1ff30445e8f01566d06 100644 (file)
@@ -27,6 +27,11 @@ abstract class BaseProducer extends BaseFrameworkSystem {
         */
        private $outgoingQueueInstance = null;
 
+       /**
+        * Every procuded item/unit/etc. usually have a source
+        */
+       private $sourceInstance = null;
+
        /**
         * Protected constructor
         *
@@ -45,7 +50,7 @@ abstract class BaseProducer extends BaseFrameworkSystem {
        }
 
        /**
-        * Setter for out-going work queue 
+        * Setter for out-going work queue
         *
         * @param       $outgoingQueueInstance  The out-going work queue instance
         * @return      void
@@ -55,7 +60,7 @@ abstract class BaseProducer extends BaseFrameworkSystem {
        }
 
        /**
-        * Getter for out-going work queue 
+        * Getter for out-going work queue
         *
         * @param       $outgoingQueueInstance  The out-going work queue instance
         */
@@ -63,6 +68,25 @@ abstract class BaseProducer extends BaseFrameworkSystem {
                return $this->outgoingQueueInstance;
        }
 
+       /**
+        * Setter for a Sourceable instance
+        *
+        * @param       $sourceInstance The Sourceable instance
+        * @return      void
+        */
+       protected function setSourceInstance (Sourceable $sourceInstance) {
+               $this->sourceInstance = $sourceInstance;
+       }
+
+       /**
+        * Getter for a Sourceable instance
+        *
+        * @param       $sourceInstance The Sourceable instance
+        */
+       protected function getSourceInstance () {
+               return $this->sourceInstance;
+       }
+
        /**
         * Initializes this producer, this method must be overwritten.
         *
index efd3109ce59683d3b60370478bd22c53cdd56cd8..02d7052ef89745cdf27542a49ad5ab375c86033f 100644 (file)
@@ -41,6 +41,12 @@ class CruncherTestUnitProducer extends BaseUnitProducer implements UnitProducer,
                // Get new instance
                $producerInstance = new CruncherTestUnitProducer();
 
+               // Test units have a 'test' source
+               $sourceInstance = UnitSourceFactory::createUnitSourceInstance('test');
+
+               // So set it in the producer
+               $producerInstance->setSourceInstance($sourceInstance);
+
                // Return the prepared instance
                return $producerInstance;
        }
@@ -79,7 +85,7 @@ class CruncherTestUnitProducer extends BaseUnitProducer implements UnitProducer,
                $searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
 
                // Add criteria for looking up already created and available test units
-               $searchInstance->addCriteria(CruncherUnitDatabaseWrapper::DB_COLUMN_UNIT_TYPE, BaseUnitProducer::UNIT_TYPE_TEST_UNIT);
+               $searchInstance->addCriteria(CruncherUnitDatabaseWrapper::DB_COLUMN_UNIT_TYPE  , BaseUnitProducer::UNIT_TYPE_TEST_UNIT);
                $searchInstance->addCriteria(CruncherUnitDatabaseWrapper::DB_COLUMN_UNIT_STATUS, BaseUnitProducer::UNIT_STATUS_AVAILABLE);
                $searchInstance->setLimit($this->getConfigInstance()->getConfigEntry('cruncher_test_unit_max_count'));
 
@@ -92,21 +98,8 @@ class CruncherTestUnitProducer extends BaseUnitProducer implements UnitProducer,
                        // @TODO Unfinished work here
                        $this->debugInstance();
                } else {
-                       // No entries found, so generate some. First we need a very secret message (a random string) ...
-                       $rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class');
-                       $secretMessage = base64_encode($rngInstance->randomString($this->getConfigInstance()->getConfigEntry('cruncher_random_secret_message_length')));
-
-                       // Second, we need a secret key
-                       $secretKey = $rngInstance->randomString($this->getConfigInstance()->getConfigEntry('cruncher_random_secret_key_length'));
-
-                       // Now encrypt the message with our key and a good (strong) cipher
-                       $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class');
-                       $encryptedMessage = base64_encode($cryptoInstance->encryptString($secretMessage, $secretKey));
-
-                       // Make sure the secret key and message are removed from memory
-                       unset($secretKey);
-                       unset($secretMessage);
-                       die($encryptedMessage);
+                       // Get an encrypted, random message from our source
+                       $encryptedMessage = $this->getSourceInstance()->generateMessageFromSource();
                }
        }
 }
diff --git a/application/hub/main/source/.htaccess b/application/hub/main/source/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/source/class_ b/application/hub/main/source/class_
new file mode 100644 (file)
index 0000000..eac4b8c
--- /dev/null
@@ -0,0 +1,60 @@
+<?php
+/**
+ * A ??? source class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 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 ???Source extends BaseSource implements Sourceable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $sourceInstance         An instance of a Sourceable class
+        */
+       public final static function create???Source () {
+               // Get new instance
+               $sourceInstance = new ???Source();
+
+               // Return the prepared instance
+               return $sourceInstance;
+       }
+
+       /**
+        * "Getter" or generator for a message
+        *
+        * @return      $message        A message from our source
+        * @todo        0% done
+        */
+       public function generateMessageFromSource () {
+               $this->partialStub('Please implement this method.');
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/source/class_BaseSource.php b/application/hub/main/source/class_BaseSource.php
new file mode 100644 (file)
index 0000000..e48c542
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+/**
+ * A general Source class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 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 BaseSource 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/source/units/.htaccess b/application/hub/main/source/units/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/source/units/class_TestUnitSource.php b/application/hub/main/source/units/class_TestUnitSource.php
new file mode 100644 (file)
index 0000000..5a6f188
--- /dev/null
@@ -0,0 +1,77 @@
+<?php
+/**
+ * A TestUnit source class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 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 TestUnitSource extends BaseSource implements Sourceable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @return      $sourceInstance         An instance of a Sourceable class
+        */
+       public final static function createTestUnitSource () {
+               // Get new instance
+               $sourceInstance = new TestUnitSource();
+
+               // Create a RNG instance and set it in this source
+               $rngInstance = ObjectFactory::createObjectByConfiguredName('rng_class');
+               $sourceInstance->setRngInstance($rngInstance);
+
+               // And also a crypto instance (for our encrypted messages)
+               $cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class');
+               $sourceInstance->setCryptoInstance($cryptoInstance);
+
+               // Return the prepared instance
+               return $sourceInstance;
+       }
+
+       /**
+        * Generates an encrypted random message
+        *
+        * @return      $encryptedMessage       The encrypted random message
+        */
+       public function generateMessageFromSource () {
+               // Get a very secret message by encoding and random string with BASE64
+               $secretMessage = base64_encode($this->getRngInstance()->randomString($this->getConfigInstance()->getConfigEntry('random_secret_message_length')));
+
+               // Get a random, secret key
+               $secretKey = $this->getRngInstance()->randomString($this->getConfigInstance()->getConfigEntry('random_secret_key_length'));
+
+               // Now encrypt the message with our key and a good (strong) cipher
+               $encryptedMessage = base64_encode($this->getCryptoInstance()->encryptString($secretMessage, $secretKey));
+
+               // Return it
+               return $encryptedMessage;
+       }
+}
+
+// [EOF]
+?>
index d7f5b79bbb74671c9501cbfac22c87f23d414dd7..9d26adc3cbd086c0569cb8a3c94f7b7b1f5fdcea 100644 (file)
@@ -70,7 +70,8 @@
 ./application/hub/main/package/class_NetworkPackage.php:383:                   // @TODO Add some logging here
 ./application/hub/main/package/class_NetworkPackage.php:409:                   // @TODO Add some logging here
 ./application/hub/main/pools/peer/class_DefaultPeerPool.php:148:                       // @TODO Check for IP
-./application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php:72:      * @todo        0% done
+./application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php:78:      * @todo        ~30% done
+./application/hub/main/producer/cruncher/work_units/class_CruncherTestUnitProducer.php:98:                     // @TODO Unfinished work here
 ./application/hub/main/resolver/state/network/class_NetworkStateResolver.php:68:        * @todo        ~30% done
 ./application/hub/main/resolver/state/network/class_NetworkStateResolver.php:80:                       // @TODO On some systems it is 134, on some 107?
 ./application/hub/main/tasks/cruncher/class_CruncherTestUnitProducerTask.php:53:        * @todo        Maybe visit some sub-objects
@@ -87,7 +88,7 @@
 ./application/hub/main/template/objects/class_XmlObjectRegistryTemplateEngine.php:251:  * @todo        Find something useful with this!
 ./application/hub/main/template/objects/class_XmlObjectRegistryTemplateEngine.php:324:  * @todo        Handle $objectCount
 ./application/hub/main/template/producer/test_units/class_XmlCruncherTestUnitTemplateEngine.php:10: * @todo            This template engine does not make use of setTemplateType()
-./application/hub/main/template/producer/test_units/class_XmlCruncherTestUnitTemplateEngine.php:391:    * @todo        Handle $keyCount
+./application/hub/main/template/producer/test_units/class_XmlCruncherTestUnitTemplateEngine.php:433:    * @todo        Handle $keyCount
 ./application/hub/main/tools/class_HubTools.php:128:                           // @TODO We may want to encapsulate this PHP call into an own class
 ./application/hub/main/visitor/tasks/class_ActiveTaskVisitor.php:105:   * @todo        Does a query needs to perform some actions as an active task?
 ./application/hub/main/visitor/tasks/class_ActiveTaskVisitor.php:116:   * @todo        Does a queue needs to perform some actions as an active task?
 ./inc/classes/exceptions/main/class_MissingMethodException.php:13: * @todo             Try to rewrite user/guest login classes and mark this exception as deprecated
 ./inc/classes/exceptions/main/class_NoConfigEntryException.php:10: * @todo             Rename this class to NoFoundEntryException
 ./inc/classes/interfaces/class_FrameworkInterface.php:11: * @todo              Find a better name for this interface
-./inc/classes/main/class_BaseFrameworkSystem.php:1133:  * @todo        Write a logging mechanism for productive mode
-./inc/classes/main/class_BaseFrameworkSystem.php:1147:                 // @TODO Finish this part!
-./inc/classes/main/class_BaseFrameworkSystem.php:154:  // @todo Try to clean these constants up
-./inc/classes/main/class_BaseFrameworkSystem.php:233:   * @todo        This is old code. Do we still need this old lost code?
-./inc/classes/main/class_BaseFrameworkSystem.php:301:   * @todo        SearchableResult and UpdateableResult shall have a super interface to use here
+./inc/classes/main/class_BaseFrameworkSystem.php:1168:  * @todo        Write a logging mechanism for productive mode
+./inc/classes/main/class_BaseFrameworkSystem.php:1182:                 // @TODO Finish this part!
+./inc/classes/main/class_BaseFrameworkSystem.php:159:  // @todo Try to clean these constants up
+./inc/classes/main/class_BaseFrameworkSystem.php:345:   * @todo        SearchableResult and UpdateableResult shall have a super interface to use here
 ./inc/classes/main/commands/web/class_WebLoginAreaCommand.php:64:       * @todo        Add some stuff here: Some personal data, app/game related data
 ./inc/classes/main/commands/web/class_WebProblemCommand.php:58:         * @todo        0% done
 ./inc/classes/main/commands/web/class_WebStatusCommand.php:58:  * @todo        0% done
 ./inc/classes/main/response/image/class_ImageResponse.php:91:   * @todo        this will send only one cookie out, the first one.
 ./inc/classes/main/result/class_DatabaseResult.php:226:         * @todo        0% done
 ./inc/classes/main/result/class_DatabaseResult.php:379:4        * @todo        Find a caching way without modifying the result array
-./inc/classes/main/rng/class_RandomNumberGenerator.php:150:     * @todo        I had a better random number generator here but now it is somewhere lost :(
+./inc/classes/main/rng/class_RandomNumberGenerator.php:152:     * @todo        I had a better random number generator here but now it is somewhere lost :(
 ./inc/classes/main/rng/class_RandomNumberGenerator.php:83:      * @todo        Add site key for stronger salt!
 ./inc/classes/main/template/class_BaseTemplateEngine.php:1055:                 // @TODO This silent abort should be logged, maybe.
 ./inc/classes/main/template/class_BaseTemplateEngine.php:1063:                 // @TODO Old behaviour, will become obsolete!
 ./inc/selector.php:11: * @todo         We should minimize these includes
 ./index.php:59:         * @todo        This method is old code and needs heavy rewrite
 ### ### DEPRECATION FOLLOWS: ### ###
+./application/hub/main/database/wrapper/class_NodeInformationDatabaseWrapper.php:2:// @DEPRECATED
+./application/hub/main/database/wrapper/class_NodeListDatabaseWrapper.php:2:// @DEPRECATED
+./application/hub/main/database/wrapper/class_PeerStateLookupDatabaseWrapper.php:2:// @DEPRECATED
 ./application/hub/main/filter/activation/class_HubActivationSelfAnnouncementFilter.php:2:// @DEPRECATED
 ./application/hub/main/filter/bootstrap/class_HubBootstrapAquireHubIdFilter.php:2:// @DEPRECATED
 ./application/hub/main/filter/bootstrap/class_HubBootstrapExtraBootstrappingFilter.php:2:// @DEPRECATED