* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class BaseHubNode extends BaseHubSystem implements Updateable {
+ // Exception constants
+ const EXCEPTION_HUB_ALREADY_ANNOUNCED = 0xe00;
+
/**
* Node id
*/
*/
private $hubIsActive = false;
+ /**
+ * Wether this node is anncounced (KEEP ON false!)
+ */
+ private $hubIsAnnounced = false;
+
/**
* Protected constructor
*
// Debug message
$this->debugOutput('BOOTSTRAP: Initialize queues: FINISHED');
}
-
+
/**
* Adds hub data elements to a given dataset instance
*
$this->hubIsActive = $hubIsActive;
}
+ /**
+ * Announces this hub to the upper (bootstrap or list) hubs. After this is
+ * successfully done the given task is unregistered from the handler.
+ *
+ * @param $taskInstance The task instance running this announcement
+ * @return void
+ * @throws HubAlreadyAnnouncedException If this hub is already announced
+ */
+ public function announceSelfToUpperNodes (Taskable $taskInstance) {
+ // Is this hub node announced?
+ if ($this->hubIsAnnounced === true) {
+ // Already announced!
+ throw new HubAlreadyAnnouncedException($this, self::EXCEPTION_HUB_ALREADY_ANNOUNCED);
+ } // END - if
+
+ // Get a helper instance
+ $helperInstance = ObjectFactory::createObjectByConfiguredName('hub_descriptor_class', array($this));
+
+ die("\n");
+ }
+
/**
* Activates the hub by doing some final preparation and setting
* $hubIsActive to true
if ($resultInstance->next()) {
$this->partialStub('Do something for restoring the list.');
// Output message
- //$this->debugOutput('BOOTSTRAP: ');
- } // END - if
+ //$this->debugOutput('HUB: ');
+ } else {
+ // No previously saved node list found!
+ $this->debugOutput('HUB: No previously saved node list found. This is fine.');
+ }
// Debug output
$this->debugOutput('HUB: Restore node list: FINISHED.');