]> git.mxchange.org Git - hub.git/commitdiff
More connector classes added
authorRoland Häder <roland@mxchange.org>
Mon, 6 Jul 2009 18:43:29 +0000 (18:43 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 6 Jul 2009 18:43:29 +0000 (18:43 +0000)
17 files changed:
.gitattributes
application/hub/config.php
application/hub/interfaces/query/.htaccess [new file with mode: 0644]
application/hub/interfaces/query/class_Queryable.php [new file with mode: 0644]
application/hub/main/connectors/class_BaseConnector.php
application/hub/main/connectors/query/.htaccess [new file with mode: 0644]
application/hub/main/connectors/query/class_ [new file with mode: 0644]
application/hub/main/connectors/query/class_BaseQueryConnector.php [new file with mode: 0644]
application/hub/main/connectors/query/local/.htaccess [new file with mode: 0644]
application/hub/main/connectors/query/local/class_LocalQueryConnector.php [new file with mode: 0644]
application/hub/main/connectors/queues/class_
application/hub/main/connectors/queues/local/class_LocalQueueConnector.php
application/hub/main/nodes/boot/class_HubBootNode.php
application/hub/main/nodes/class_BaseHubNode.php
application/hub/main/nodes/list/class_HubListNode.php
application/hub/main/nodes/master/class_HubMasterNode.php
application/hub/main/nodes/regular/class_HubRegularNode.php

index aa7e5161fce335ba0345a2707f210b16bea19b10..86daee16cc79d1bfa317dfcbc54e9590b9ab3ab8 100644 (file)
@@ -14,12 +14,19 @@ application/hub/interfaces/connectors/.htaccess -text
 application/hub/interfaces/connectors/class_Connectable.php -text
 application/hub/interfaces/nodes/.htaccess -text
 application/hub/interfaces/nodes/class_NodeHelper.php -text
+application/hub/interfaces/query/.htaccess -text
+application/hub/interfaces/query/class_Queryable.php -text
 application/hub/interfaces/queues/.htaccess -text
 application/hub/interfaces/queues/class_Queueable.php -text
 application/hub/loader.php -text
 application/hub/main/.htaccess -text
 application/hub/main/connectors/.htaccess -text
 application/hub/main/connectors/class_BaseConnector.php -text
+application/hub/main/connectors/query/.htaccess -text
+application/hub/main/connectors/query/class_ -text
+application/hub/main/connectors/query/class_BaseQueryConnector.php -text
+application/hub/main/connectors/query/local/.htaccess -text
+application/hub/main/connectors/query/local/class_LocalQueryConnector.php -text
 application/hub/main/connectors/queues/.htaccess -text
 application/hub/main/connectors/queues/class_ -text
 application/hub/main/connectors/queues/class_BaseQueueConnector.php -text
index c52c6dbe74219ed59b76c7dd529f4f2dd1830065..6c7bc5c99a6e53c514d5d75ee534e6c4715077cd 100644 (file)
@@ -48,8 +48,11 @@ $cfg->setConfigEntry('node_info_db_wrapper_class', "NodeInformationDatabaseWrapp
 // CFG: WEB-CONTENT-TYPE
 $cfg->setConfigEntry('web_content_type', "");
 
+// CFG: QUERY-CONNECTOR
+$cfg->setConfigEntry('query_connector_class', "LocalQueryConnector");
+
 // CFG: QUEUE-CONNECTOR
-$cfg->setConfigEntry('queue_connector', "LocalQueueConnector");
+$cfg->setConfigEntry('queue_connector_class', "LocalQueueConnector");
 
 // [EOF]
 ?>
diff --git a/application/hub/interfaces/query/.htaccess b/application/hub/interfaces/query/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/interfaces/query/class_Queryable.php b/application/hub/interfaces/query/class_Queryable.php
new file mode 100644 (file)
index 0000000..29ecd46
--- /dev/null
@@ -0,0 +1,28 @@
+<?php
+/**
+ * An interface for querys
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Core 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 Queryable extends FrameworkInterface {
+}
+
+//
+?>
index 592a6ba7e82e2f05e44aca4f7800c2b932697877..1945a65292430dd04d909d0ee702d3220b40cfb5 100644 (file)
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 class BaseConnector extends BaseFrameworkSystem {
+       /**
+        * An instance of a node
+        */
+       private $nodeInstance = null;
+
        /**
         * Protected constructor
         *
@@ -36,6 +41,25 @@ class BaseConnector extends BaseFrameworkSystem {
                $this->removeNumberFormaters();
                $this->removeSystemArray();
        }
+
+       /**
+        * Setter for node instance
+        *
+        * @param       $nodeInstance   An instance of a node node
+        * @return      void
+        */
+       protected final function setNodeInstance (NodeHelper $nodeInstance) {
+               $this->nodeInstance = $nodeInstance;
+       }
+
+       /**
+        * Getter for node instance
+        *
+        * @return      $nodeInstance   An instance of a node node
+        */
+       public final function getNodeInstance () {
+               return $this->nodeInstance;
+       }
 }
 
 // [EOF]
diff --git a/application/hub/main/connectors/query/.htaccess b/application/hub/main/connectors/query/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/connectors/query/class_ b/application/hub/main/connectors/query/class_
new file mode 100644 (file)
index 0000000..dc72d3a
--- /dev/null
@@ -0,0 +1,50 @@
+<?php
+/**
+ * A ??? queue connector class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Core 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 ???QueueConnector extends BaseQueueConnector implements Connectable, Queueable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this queue connector class
+        *
+        * @return      $connectorInstance      An instance of this queue connector class
+        */
+       public final static function create???QueueConnector () {
+               // Create the instance
+               $connectorInstance = new ???QueueConnector();
+
+               // Finally return it
+               return $connectorInstance;
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/connectors/query/class_BaseQueryConnector.php b/application/hub/main/connectors/query/class_BaseQueryConnector.php
new file mode 100644 (file)
index 0000000..df6df0a
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+/**
+ * A general query connector class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Core 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 BaseQueryConnector extends BaseConnector {
+       /**
+        * 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/connectors/query/local/.htaccess b/application/hub/main/connectors/query/local/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/connectors/query/local/class_LocalQueryConnector.php b/application/hub/main/connectors/query/local/class_LocalQueryConnector.php
new file mode 100644 (file)
index 0000000..69a6efb
--- /dev/null
@@ -0,0 +1,54 @@
+<?php
+/**
+ * A local query connector class
+ *
+ * @author             Roland Haeder <webmaster@ship-simu.org>
+ * @version            0.0.0
+ * @copyright  Copyright (c) 2007, 2008 Roland Haeder, 2009 Core 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 LocalQueryConnector extends BaseQueryConnector implements Connectable, Queryable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this query connector class
+        *
+        * @param       $nodeInstance           An instance of a node
+        * @return      $connectorInstance      An instance of this query connector class
+        */
+       public final static function createLocalQueryConnector (NodeHelper $nodeInstance) {
+               // Create the instance
+               $connectorInstance = new LocalQueryConnector();
+
+               // Set the node instance
+               $connectorInstance->setNodeInstance($nodeInstance);
+
+               // Finally return it
+               return $connectorInstance;
+       }
+}
+
+// [EOF]
+?>
index c9d1d522f7469df23d21fc30ec9397251b2caa8f..dc72d3a0975e1ebb20fc5771c470b667d9b6eac7 100644 (file)
@@ -25,12 +25,11 @@ class ???QueueConnector extends BaseQueueConnector implements Connectable, Queue
        /**
         * Protected constructor
         *
-        * @param       $className      Name of the class
         * @return      void
         */
-       protected function __construct ($className) {
+       protected function __construct () {
                // Call parent constructor
-               parent::__construct($className);
+               parent::__construct(__CLASS__);
        }
 
        /**
index 29f30077de623d42576d686f56d2ad1fc1170f9c..4c03caf2a7ffd4d847ac17fb92d850b728f25198 100644 (file)
@@ -28,20 +28,24 @@ class LocalQueueConnector extends BaseQueueConnector implements Connectable, Que
         * @param       $className      Name of the class
         * @return      void
         */
-       protected function __construct ($className) {
+       protected function __construct () {
                // Call parent constructor
-               parent::__construct($className);
+               parent::__construct(__CLASS__);
        }
 
        /**
         * Creates an instance of this queue connector class
         *
+        * @param       $nodeInstance           An instance of a hub node
         * @return      $connectorInstance      An instance of this queue connector class
         */
-       public final static function createLocalQueueConnector () {
+       public final static function createLocalQueueConnector (NodeHelper $nodeInstance) {
                // Create the instance
                $connectorInstance = new LocalQueueConnector();
 
+               // Set the node instance
+               $connectorInstance->setNodeInstance($nodeInstance);
+
                // Finally return it
                return $connectorInstance;
        }
index 93befa3422e8dd2873ecba0c79e6bc95c0253a48..e3d294aaaeee3d114968d69e062198dee0502498 100644 (file)
@@ -91,9 +91,6 @@ class HubBootNode extends BaseHubNode implements NodeHelper {
 
                // This might not be all...
                $this->partialStub('Please implement more bootsrapping steps.');
-
-               // This should be the last thing to do: output teaser lines
-               $this->outputConsoleTeaser();
        }
 
        /**
index b6ff400aaee01030ed47874c2a9a80a6fefcd750..a47136f62d60006e7537b71aa49b296c7ba18e4e 100644 (file)
@@ -32,6 +32,11 @@ class BaseHubNode extends BaseFrameworkSystem implements Updateable {
         */
        private $bootIpPort = '';
 
+       /**
+        * Query connector instance
+        */
+       private $queryInstance = null;
+
        /**
         * Protected constructor
         *
@@ -143,7 +148,10 @@ class BaseHubNode extends BaseFrameworkSystem implements Updateable {
         * @todo        This method is maybe not yet finished.
         */
        protected function doGenericBootstrapping () {
-               // @TODO Empty method
+               // This should be the last line: output teaser
+               $this->outputConsoleTeaser();
+
+               // @TODO Add some generic bootstrap steps
                $this->partialStub('Add some generic bootstrap steps here.');
        }
 
@@ -206,7 +214,8 @@ class BaseHubNode extends BaseFrameworkSystem implements Updateable {
         * @return      void
         */
        protected function initGenericQueues () {
-               $this->partialStub('Init query queue here.');
+               // Set it
+               $this->queryInstance = ObjectFactory::createObjectByConfiguredName('query_connector_class', array($this));
        }
        
        /**
@@ -236,7 +245,7 @@ class BaseHubNode extends BaseFrameworkSystem implements Updateable {
         */
        public function updateDatabaseField ($fieldName, $fieldValue) {
                // Unfinished
-               $this->partialStub("Unfinished!");
+               $this->partialStub('Unfinished!');
                return;
 
                // Get a critieria instance
index c490782db58a5a840e2a5dc5e57cdedb05c93903..e1375702b393a6141e27e14f049a72c784f5e0ed 100644 (file)
@@ -68,9 +68,6 @@ class HubListNode extends BaseHubNode implements NodeHelper {
                // Call generic (parent) bootstrapping method first
                parent::doGenericBootstrapping();
                $this->partialStub('Please implement this method.');
-
-               // This should be the last line: output teaser
-               $this->outputConsoleTeaser();
        }
 
        /**
index 98328175693d7a05b9d6520254d7efbba9b3d8a2..803bc8926737c2a3478003ca1e89c28a0395ad24 100644 (file)
@@ -68,9 +68,6 @@ class HubMasterNode extends BaseHubNode implements NodeHelper {
                // Call generic (parent) bootstrapping method first
                parent::doGenericBootstrapping();
                $this->partialStub('Please implement this method.');
-
-               // This should be the last line: output teaser
-               $this->outputConsoleTeaser();
        }
 
        /**
index 20ae415d42d4f224da882419be0383013080410f..b6cb2d36ad167bb6c0592869afa95b3e69880e0d 100644 (file)
@@ -69,9 +69,6 @@ class HubRegularNode extends BaseHubNode implements NodeHelper {
                // Call generic (parent) bootstrapping method first
                parent::doGenericBootstrapping();
                $this->partialStub('Please implement this method.');
-
-               // This is the last line: output teaser
-               $this->outputConsoleTeaser();
        }
 
        /**