X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=application%2Fhub%2Fmain%2Flistener%2Fclass_BaseListener.php;h=16d79a93a95d4944d9fc303ec6b4c97dd236a043;hb=3354cef4df30f6b239c92ec1bda67e5125ae5849;hp=31809ff5a0e80884d8426590bf8d53d58dc553f4;hpb=c01864ce801919ccc69129a9afda4f6805aa11ce;p=hub.git diff --git a/application/hub/main/listener/class_BaseListener.php b/application/hub/main/listener/class_BaseListener.php index 31809ff5a..16d79a93a 100644 --- a/application/hub/main/listener/class_BaseListener.php +++ b/application/hub/main/listener/class_BaseListener.php @@ -4,7 +4,7 @@ * * @author Roland Haeder * @version 0.0.0 - * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 Hub Developer Team + * @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 * @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class BaseListener extends BaseHubSystem { +class BaseListener extends BaseHubSystem implements Visitable { // Exception code constants const EXCEPTION_INVALID_SOCKET = 0xa00; @@ -55,6 +55,11 @@ class BaseListener extends BaseHubSystem { */ private $poolInstance = null; + /** + * A network package handler instance + */ + private $packageInstance = null; + /** * Protected constructor * @@ -111,7 +116,7 @@ class BaseListener extends BaseHubSystem { * @return void */ public final function setListenAddressByConfiguration ($configEntry) { - $this->setListenAddress($this->getConfigInstance()->readConfig($configEntry)); + $this->setListenAddress($this->getConfigInstance()->getConfigEntry($configEntry)); } /** @@ -121,7 +126,7 @@ class BaseListener extends BaseHubSystem { * @return void */ public final function setListenPortByConfiguration ($configEntry) { - $this->setListenPort($this->getConfigInstance()->readConfig($configEntry)); + $this->setListenPort($this->getConfigInstance()->getConfigEntry($configEntry)); } /** @@ -169,7 +174,7 @@ class BaseListener extends BaseHubSystem { * @return void */ protected final function setSocketResource ($socketResource) { - $this->socketResource = $setSocketResource; + $this->socketResource = $socketResource; } /** @@ -177,7 +182,7 @@ class BaseListener extends BaseHubSystem { * * @return $socketResource The socket resource we shall set */ - protected final function getSocketResource () { + public final function getSocketResource () { return $this->socketResource; } @@ -188,7 +193,7 @@ class BaseListener extends BaseHubSystem { * @return void */ protected final function setPoolInstance (PoolableClient $poolInstance) { - $this->poolInstance = $setPoolInstance; + $this->poolInstance = $poolInstance; } /** @@ -199,6 +204,47 @@ class BaseListener extends BaseHubSystem { protected final function getPoolInstance () { return $this->poolInstance; } + + /** + * Setter for network package handler instance + * + * @param $packageInstance The network package handler instance we shall set + * @return void + */ + protected final function setPackageInstance (Networkable $packageInstance) { + $this->packageInstance = $packageInstance; + } + + /** + * Getter for network package handler instance + * + * @return $packageInstance The network package handler instance we shall set + */ + protected final function getPackageInstance () { + return $this->packageInstance; + } + + /** + * Accepts the visitor to process the visit "request" + * + * @param $visitorInstance An instance of a Visitor class + * @return void + */ + public function accept (Visitor $visitorInstance) { + // Debug message + //* DEBUG: */ $this->debugOutput('LISTENER: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - START'); + + // Visit this listener + $visitorInstance->visitListener($this); + + // Visit the pool if set + if ($this->getPoolInstance() instanceof Poolable) { + $this->getPoolInstance()->accept($visitorInstance); + } // END - if + + // Debug message + //* DEBUG: */ $this->debugOutput('LISTENER: ' . $visitorInstance->__toString() . ' has visited ' . $this->__toString() . ' - FINISHED'); + } } // [EOF]