3 * A general hub system class
5 * @author Roland Haeder <webmaster@ship-simu.org>
7 * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009, 2010 Hub Developer Team
8 * @license GNU GPL 3.0 or any newer version
9 * @link http://www.ship-simu.org
11 * This program is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation, either version 3 of the License, or
14 * (at your option) any later version.
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
21 * You should have received a copy of the GNU General Public License
22 * along with this program. If not, see <http://www.gnu.org/licenses/>.
24 class BaseHubSystem extends BaseFrameworkSystem {
26 * An instance of a node
28 private $nodeInstance = null;
33 private $listenerInstance = null;
36 * A network package handler instance
38 private $packageInstance = null;
41 * Protected constructor
43 * @param $className Name of the class
46 protected function __construct ($className) {
47 // Call parent constructor
48 parent::__construct($className);
52 * Setter for listener instance
54 * @param $listenerInstance A Listenable instance
57 protected final function setListenerInstance (Listenable $listenerInstance) {
58 $this->listenerInstance = $listenerInstance;
62 * Getter for listener instance
64 * @return $listenerInstance A Listenable instance
66 protected final function getListenerInstance () {
67 return $this->listenerInstance;
71 * Setter for node instance
73 * @param $nodeInstance An instance of a node node
76 protected final function setNodeInstance (NodeHelper $nodeInstance) {
77 $this->nodeInstance = $nodeInstance;
81 * Getter for node instance
83 * @return $nodeInstance An instance of a node node
85 public final function getNodeInstance () {
86 return $this->nodeInstance;
90 * Setter for network package handler instance
92 * @param $packageInstance The network package handler instance we shall set
95 protected final function setPackageInstance (Networkable $packageInstance) {
96 $this->packageInstance = $packageInstance;
100 * Getter for network package handler instance
102 * @return $packageInstance The network package handler instance we shall set
104 protected final function getPackageInstance () {
105 return $this->packageInstance;
109 * Shuts down a given socket resource. This method does only ease calling
112 * @param $socketResource A valid socket resource
115 public function shutdownSocket ($socketResource) {
117 $this->debugOutput('Shutting down socket ' . $socketResource . ' ...');
119 // Set socket resource
120 $this->setSocketResource($socketResource);
122 // Get a visitor instance
123 $visitorInstance = ObjectFactory::createObjectByConfiguredName('shutdown_socket_visitor_class');
126 $this->accept($visitorInstance);