Continued with refacturing:
authorRoland Häder <haeder@hmmdeutschland.de>
Mon, 12 Jan 2015 08:00:48 +0000 (09:00 +0100)
committerRoland Häder <haeder@hmmdeutschland.de>
Mon, 12 Jan 2015 08:00:48 +0000 (09:00 +0100)
- Added missing method getConnectionType() + a few commented out debug lines

Signed-off-by: Roland Häder <haeder@hmmdeutschland.de>
application/hub/interfaces/helper/connections/class_ConnectionHelper.php
application/hub/interfaces/listener/class_Listenable.php
application/hub/main/listener/class_BaseListener.php
application/hub/main/listener/class_BaseListenerDecorator.php
application/hub/main/pools/class_BasePool.php
application/hub/main/registry/connection/class_ConnectionRegistry.php
application/hub/main/registry/socket/class_SocketRegistry.php

index 6bf7b5cd341b777339116626ae8e1cc10446a574..1117f3188f015f57484c0cf426afbb840ede894b 100644 (file)
@@ -48,6 +48,13 @@ interface ConnectionHelper extends HubHelper {
         */
        function getConnectionPort ();
 
+       /**
+        * Getter for connection type
+        *
+        * @return      $type   Type of connection
+        */
+       function getConnectionType ();
+
        /**
         * Getter for IP address
         *
index ec878cc538ffe69823c904c3b88d092d5e6e49df..652f03e643d9334dce0fefc6f27d20289b891935 100644 (file)
@@ -67,6 +67,13 @@ interface Listenable extends FrameworkInterface {
         */
        function getListenPort ();
 
+       /**
+        * Getter for connection type
+        *
+        * @return      $connectionType         Connection type for this listener
+        */
+       function getConnectionType ();
+
        /**
         * Getter for peer pool instance
         *
index 2aa6c6a9eb10b2eff2ac0f784d99a6b06f7fc7ff..13e6449e197ea62c88f0a2b8c0041701a856e405 100644 (file)
@@ -184,6 +184,16 @@ class BaseListener extends BaseHubSystem implements Visitable {
                return $this->poolInstance;
        }
 
+       /**
+        * Getter for connection type
+        *
+        * @return      $connectionType         Connection type for this listener
+        */
+       public final function getConnectionType () {
+               // Wrap the real getter
+               return $this->getProtocolName();
+       }
+
        /**
         * Registeres the given socket resource for "this" listener instance. This
         * will be done in a seperate class to allow package writers to use it
index e45a78111342945810eacaff0416fe9e8ca9787c..bd09e8c745a6bf30d3ce902ca6f2423845904c23 100644 (file)
@@ -56,6 +56,15 @@ class BaseListenerDecorator extends BaseDecorator implements Visitable {
                return $this->getListenerInstance()->getListenPort();
        }
 
+       /**
+        * Getter for connection type
+        *
+        * @return      $connectionType         Connection type for this listener
+        */
+       public final function getConnectionType () {
+               return $this->getListenerInstance()->getConnectionType();
+       }
+
        /**
         * Accepts the visitor to process the visit "request"
         *
index 9090a8be640f65461b3e7e5fe1ba99c8d47781c3..a6befaa75949b9bb9b998a35d06899a708c98a9c 100644 (file)
@@ -77,7 +77,8 @@ class BasePool extends BaseHubSystem implements Visitable {
         * @return      void
         */
        protected final function addInstance ($group, $poolName, Visitable $visitableInstance) {
-               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ']: group=' . $group . ',poolName=' . $poolName . ',visitableInstance=' . $visitableInstance->__toString() . ' - CALLED!');
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ']: group=' . $group . ',poolName=' . $poolName . ',visitableInstance=' . $visitableInstance->__toString() . ' - CALLED!');
 
                // Make sure the group is not 'invalid'
                assert($group != 'invalid');
@@ -90,6 +91,9 @@ class BasePool extends BaseHubSystem implements Visitable {
 
                // Add it to given pool group
                $this->getPoolEntriesInstance()->addInstance($group, $poolName, $visitableInstance);
+
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('POOL[' . __METHOD__ . ':' . __LINE__ . ']: EXIT!');
        }
 
        /**
index 2caf8fc76c882cdc17fab6acd57113bf7841b526..5d663f171588e07664abb50caab2b25e1afd7ce0 100644 (file)
@@ -64,6 +64,9 @@ class ConnectionRegistry extends BaseRegistry implements Register, RegisterableC
         * @return      $key                                    A string representation of the socket for the registry
         */
        private function getSubRegistryKey (ConnectionHelper $connectionInstance) {
+               // Debug message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: connectionInstance=' . $connectionInstance->__toString() . ' CALLED!');
+
                // Get connection type and port number and add both together
                $key = sprintf('%s:%s:%s',
                        $connectionInstance->__toString(),
@@ -71,6 +74,9 @@ class ConnectionRegistry extends BaseRegistry implements Register, RegisterableC
                        $connectionInstance->getConnectionPort()
                );
 
+               // Debug message
+               /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('CONNECTION-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: key=' . $key . ' - EXIT!');
+
                // Return resulting key
                return $key;
        }
index e20b0f98a04fad37b0a341d76bd9595bdd9f6793..9b55d9cd79ca6e4171a609f40dc760c0625ea07e 100644 (file)
@@ -64,6 +64,9 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke
         * @return      $key                            A string representation of the socket for the registry
         */
        private function getSubRegistryKey (Listenable $connectionInstance) {
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: connectionInstance=' . $connectionInstance->__toString() . ' - ENTERED!');
+
                // Default address is invalid
                $address = '*invalid*';
                $port    = 0;
@@ -83,6 +86,9 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke
                        $this->debugBackTrace('Unsupported connectionInstance=' . $connectionInstance->__toString() . ' detected. Please fix this!');
                }
 
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: address=' . $address . ',port=' . $port);
+
                // Get connection type and port number and add both together
                $key = sprintf('%s:%s:%s:%s',
                        $connectionInstance->__toString(),
@@ -91,6 +97,9 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke
                        $port
                );
 
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: key=' .  $key . ' - EXIT!');
+
                // Return resulting key
                return $key;
        }
@@ -102,9 +111,15 @@ class SocketRegistry extends BaseRegistry implements Register, RegisterableSocke
         * @return      $key                            A string representation of the listener for the registry
         */
        private function getRegistryKeyFromListener (Listenable $listenerInstance) {
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: listenerInstance=' . $listenerInstance->__toString() . ' - ENTERED!');
+
                // Get the key
                $key = $listenerInstance->getConnectionType();
 
+               // Debug message
+               //* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__)->debugOutput('SOCKET-REGISTRY[' . __METHOD__ . ':' . __LINE__ . ']: key=' .  $key . ' - EXIT!');
+
                // Return resulting key
                return $key;
        }