]> git.mxchange.org Git - hub.git/blob - application/hub/main/class_BaseHubSystem.php
Copyright notice updated, our first hub application introduced (which is incomplete)
[hub.git] / application / hub / main / class_BaseHubSystem.php
1 <?php
2 /**
3  * A general hub system class
4  *
5  * @author              Roland Haeder <webmaster@ship-simu.org>
6  * @version             0.0.0
7  * @copyright   Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Hub Developer Team
8  * @license             GNU GPL 3.0 or any newer version
9  * @link                http://www.ship-simu.org
10  *
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.
15  *
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.
20  *
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/>.
23  */
24 class BaseHubSystem extends BaseFrameworkSystem {
25         /**
26          * An instance of a node
27          */
28         private $nodeInstance = null;
29
30         /**
31          * Listener instance
32          */
33         private $listenerInstance = null;
34
35         /**
36          * A network package handler instance
37          */
38         private $packageInstance = null;
39
40         /**
41          * Protected constructor
42          *
43          * @param       $className      Name of the class
44          * @return      void
45          */
46         protected function __construct ($className) {
47                 // Call parent constructor
48                 parent::__construct($className);
49         }
50
51         /**
52          * Setter for listener instance
53          *
54          * @param       $listenerInstance       A Listenable instance
55          * @return      void
56          */
57         protected final function setListenerInstance (Listenable $listenerInstance) {
58                 $this->listenerInstance = $listenerInstance;
59         }
60
61         /**
62          * Getter for listener instance
63          *
64          * @return      $listenerInstance       A Listenable instance
65          */
66         protected final function getListenerInstance () {
67                 return $this->listenerInstance;
68         }
69
70         /**
71          * Setter for node instance
72          *
73          * @param       $nodeInstance   An instance of a node node
74          * @return      void
75          */
76         protected final function setNodeInstance (NodeHelper $nodeInstance) {
77                 $this->nodeInstance = $nodeInstance;
78         }
79
80         /**
81          * Getter for node instance
82          *
83          * @return      $nodeInstance   An instance of a node node
84          */
85         public final function getNodeInstance () {
86                 return $this->nodeInstance;
87         }
88
89         /**
90          * Setter for network package handler instance
91          *
92          * @param       $packageInstance        The network package handler instance we shall set
93          * @return      void
94          */
95         protected final function setPackageInstance (Networkable $packageInstance) {
96                 $this->packageInstance = $packageInstance;
97         }
98
99         /**
100          * Getter for network package handler instance
101          *
102          * @return      $packageInstance        The network package handler instance we shall set
103          */
104         protected final function getPackageInstance () {
105                 return $this->packageInstance;
106         }
107
108         /**
109          * Shuts down a given socket resource. This method does only ease calling
110          * the right visitor.
111          *
112          * @param       $socketResource         A valid socket resource
113          * @return      void
114          */
115         public function shutdownSocket ($socketResource) {
116                 // Debug message
117                 $this->debugOutput('Shutting down socket ' . $socketResource . ' ...');
118
119                 // Set socket resource
120                 $this->setSocketResource($socketResource);
121
122                 // Get a visitor instance
123                 $visitorInstance = ObjectFactory::createObjectByConfiguredName('shutdown_socket_visitor_class');
124
125                 // Call the visitor
126                 $this->accept($visitorInstance);
127         }
128 }
129
130 // [EOF]
131 ?>