]> git.mxchange.org Git - hub.git/commitdiff
Prepared for listener classes (TCP/UDP and listener pool)
authorRoland Häder <roland@mxchange.org>
Tue, 7 Jul 2009 18:02:19 +0000 (18:02 +0000)
committerRoland Häder <roland@mxchange.org>
Tue, 7 Jul 2009 18:02:19 +0000 (18:02 +0000)
.gitattributes
application/hub/config.php
application/hub/main/class_BaseHubSystem.php [new file with mode: 0644]
application/hub/main/connectors/class_BaseConnector.php
application/hub/main/listener/.htaccess [new file with mode: 0644]
application/hub/main/listener/class_ [new file with mode: 0644]
application/hub/main/listener/class_BaseListener.php [new file with mode: 0644]
application/hub/main/listener/pool/.htaccess [new file with mode: 0644]
application/hub/main/listener/tcp/.htaccess [new file with mode: 0644]
application/hub/main/listener/udp/.htaccess [new file with mode: 0644]
application/hub/main/nodes/class_BaseHubNode.php

index 86daee16cc79d1bfa317dfcbc54e9590b9ab3ab8..ef90428068c894ebe6725aea8b3d9782667c471b 100644 (file)
@@ -20,6 +20,7 @@ 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/class_BaseHubSystem.php -text
 application/hub/main/connectors/.htaccess -text
 application/hub/main/connectors/class_BaseConnector.php -text
 application/hub/main/connectors/query/.htaccess -text
@@ -35,6 +36,12 @@ application/hub/main/connectors/queues/local/class_LocalQueueConnector.php -text
 application/hub/main/database/.htaccess -text
 application/hub/main/database/wrapper/.htaccess -text
 application/hub/main/database/wrapper/class_NodeInformationDatabaseWrapper.php -text
+application/hub/main/listener/.htaccess -text
+application/hub/main/listener/class_ -text
+application/hub/main/listener/class_BaseListener.php -text
+application/hub/main/listener/pool/.htaccess -text
+application/hub/main/listener/tcp/.htaccess -text
+application/hub/main/listener/udp/.htaccess -text
 application/hub/main/nodes/.htaccess -text
 application/hub/main/nodes/boot/.htaccess -text
 application/hub/main/nodes/boot/class_HubBootNode.php -text
index ce9a200012cabc486e8770cfdd099253da640ffc..b1bac59bc29729068e31b76bd936963f2b8b1114 100644 (file)
@@ -57,6 +57,9 @@ $cfg->setConfigEntry('query_connector_class', "LocalQueryConnector");
 // CFG: QUEUE-CONNECTOR-CLASS
 $cfg->setConfigEntry('queue_connector_class', "LocalQueueConnector");
 
+// CFG: LISTENER-POOL-CLAS
+$cfg->setConfigEntry('listener_pool_class', "ListenerPool");
+
 // CFG: TCP-LISTENER-CLASS
 $cfg->setConfigEntry('tcp_listener_class', "TcpListener");
 
diff --git a/application/hub/main/class_BaseHubSystem.php b/application/hub/main/class_BaseHubSystem.php
new file mode 100644 (file)
index 0000000..53ed8c0
--- /dev/null
@@ -0,0 +1,66 @@
+<?php
+/**
+ * A general hub system 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 BaseHubSystem extends BaseFrameworkSystem {
+       /**
+        * An instance of a node
+        */
+       private $nodeInstance = null;
+
+       /**
+        * Protected constructor
+        *
+        * @param       $className      Name of the class
+        * @return      void
+        */
+       protected function __construct ($className) {
+               // Call parent constructor
+               parent::__construct($className);
+
+               // Clean up a little
+               $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]
+?>
index 1945a65292430dd04d909d0ee702d3220b40cfb5..70356f57b865fa0fa6202571929e228811a5ae5b 100644 (file)
  * 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 BaseConnector extends BaseFrameworkSystem {
-       /**
-        * An instance of a node
-        */
-       private $nodeInstance = null;
-
+class BaseConnector extends BaseHubSystem {
        /**
         * Protected constructor
         *
@@ -36,29 +31,6 @@ class BaseConnector extends BaseFrameworkSystem {
        protected function __construct ($className) {
                // Call parent constructor
                parent::__construct($className);
-
-               // Clean up a little
-               $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;
        }
 }
 
diff --git a/application/hub/main/listener/.htaccess b/application/hub/main/listener/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/listener/class_ b/application/hub/main/listener/class_
new file mode 100644 (file)
index 0000000..6eb013c
--- /dev/null
@@ -0,0 +1,54 @@
+<?php
+/**
+ * 
+ *
+ * @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 ???Listener extends BaseListener implements Listenerable {
+       /**
+        * Protected constructor
+        *
+        * @return      void
+        */
+       protected function __construct () {
+               // Call parent constructor
+               parent::__construct(__CLASS__);
+       }
+
+       /**
+        * Creates an instance of this class
+        *
+        * @param       $nodeInstance           A NodeHelper instance
+        * @return      $listenerInstance       An instance a prepared listener class
+        */
+       public final static function create???Listener (NodeHelper $nodeInstance) {
+               // Get new instance
+               $listenerInstance = new ???Listener();
+
+               // Set the application instance
+               $listenerInstance->setNodeInstance($nodeInstance);
+
+               // Return the prepared instance
+               return $listenerInstance;
+       }
+}
+
+// [EOF]
+?>
diff --git a/application/hub/main/listener/class_BaseListener.php b/application/hub/main/listener/class_BaseListener.php
new file mode 100644 (file)
index 0000000..ababd57
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+/**
+ * A general listener 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 BaseListener 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/listener/pool/.htaccess b/application/hub/main/listener/pool/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/listener/tcp/.htaccess b/application/hub/main/listener/tcp/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
diff --git a/application/hub/main/listener/udp/.htaccess b/application/hub/main/listener/udp/.htaccess
new file mode 100644 (file)
index 0000000..3a42882
--- /dev/null
@@ -0,0 +1 @@
+Deny from all
index 590aaa8fed363865a74d7855d7287bd0808da376..a52541a2e8e8119cb2d1ed7a61875f3d17cf3e0a 100644 (file)
@@ -21,7 +21,7 @@
  * 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 BaseHubNode extends BaseFrameworkSystem implements Updateable {
+class BaseHubNode extends BaseHubSystem implements Updateable {
        /**
         * Node id
         */
@@ -56,10 +56,6 @@ class BaseHubNode extends BaseFrameworkSystem implements Updateable {
        protected function __construct ($className) {
                // Call parent constructor
                parent::__construct($className);
-
-               // Clean up a little
-               $this->removeNumberFormaters();
-               $this->removeSystemArray();
        }
 
        /**
@@ -305,6 +301,8 @@ class BaseHubNode extends BaseFrameworkSystem implements Updateable {
        /**
         * Activates the hub by doing some final preparation and setting
         * $hubIsActive to true
+        *
+        * @return      void
         */
        public function activateHub () {
                // Checks wether a listener is still active and shuts it down if one
@@ -325,6 +323,22 @@ class BaseHubNode extends BaseFrameworkSystem implements Updateable {
                $this->hubIsActive = true;
                // ---------------------- Last step until here ------------------------
        }
+
+       /**
+        * Initializes the listener pool (class)
+        *
+        * @return      void
+        */
+       private function initializeListenerPool () {
+               // Get a new pool instance
+               $this->listenerPoolInstance = ObjectFactory::createObjectByConfiguredName('listener_pool_class', array($this));
+
+               // Initialize the TCP listener
+               $tcpListenerInstance = ObjectFactory::createObjectByConfiguredName('tcp_listener_class', array($this));
+
+               // Initialize the UDP listener
+               $udpListenerInstance = ObjectFactory::createObjectByConfiguredName('udp_listener_class', array($this));
+       }
 }
 
 // [EOF]