/**
* A NetworkPackageWriter task
*
- * @author Roland Haeder <webmaster@ship-simu.org>
+ * @author Roland Haeder <webmaster@shipsimu.org>
* @version 0.0.0
- * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2011 Hub Developer Team
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2015 Hub Developer Team
* @license GNU GPL 3.0 or any newer version
- * @link http://www.ship-simu.org
+ * @link http://www.shipsimu.org
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
/**
* Creates an instance of this class
*
- * @return $taskInstance An instance of a Visitable class
+ * @return $taskInstance An instance of a Taskable/Visitable class
*/
public static final function createNetworkPackageWriterTask () {
// Get new instance
}
/**
- * Accepts the visitor to process the visit "request"
+ * Accepts the visitor to process the visitor
*
* @param $visitorInstance An instance of a Visitor class
* @return void
+ * @todo Also visit some sub-objects?
*/
public function accept (Visitor $visitorInstance) {
// Visit this task
* @return void
*/
public function executeTask () {
- // Get a singleton network package instance
+ // "Cache" package instance
$packageInstance = NetworkPackageFactory::createNetworkPackageInstance();
// Do we have something to deliver?
- if ($packageInstance->isPackageEnqueued()) {
- // Okay, then deliver (better discover its recipients) this package
- $packageInstance->declareEnqueuedPackage();
- } elseif ($packageInstance->isPackageDeclared()) {
- // Prepare package for delivery
- $packageInstance->deliverDeclaredPackage();
+ if ($packageInstance->isEncodedDataPending()) {
+ // Sent encoded (raw) data
+ $packageInstance->sendEncodedData();
} elseif ($packageInstance->isPackageWaitingForDelivery()) {
// Sent it finally out
$packageInstance->sendWaitingPackage();
+ } elseif ($packageInstance->isPackageDeclared()) {
+ // Prepare package for delivery
+ $packageInstance->processDeclaredPackage();
+ } elseif ($packageInstance->isPackageEnqueued()) {
+ // Okay, then deliver (better discover its recipients) this package
+ $packageInstance->declareEnqueuedPackage();
}
}
+
+ /**
+ * Shuts down the task
+ *
+ * @return void
+ * @todo 0% done
+ */
+ public function doShutdown () {
+ self::createDebugInstance(__CLASS__)->debugOutput('TASK[' . __METHOD__ . ':' . __LINE__ . ']: Shutting down...');
+ }
}
// [EOF]