use Org\Shipsimu\Hub\Generic\BaseHubSystem;
use Org\Shipsimu\Hub\Network\Delivery\Deliverable;
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Stacker\Stackable;
+
/**
* A general Decoder class
*
*/
private $packageHandlerInstance = NULL;
+ /**
+ * Instance of the stacker
+ */
+ private $stackInstance = NULL;
+
/**
* Protected constructor
*
return $this->packageHandlerInstance;
}
+ /**
+ * Setter for stacker instance
+ *
+ * @param $stackInstance An instance of an stacker
+ * @return void
+ */
+ protected final function setStackInstance (Stackable $stackInstance) {
+ $this->stackInstance = $stackInstance;
+ }
+
+ /**
+ * Getter for stacker instance
+ *
+ * @return $stackInstance An instance of an stacker
+ */
+ public final function getStackInstance () {
+ return $this->stackInstance;
+ }
+
}
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Result\Search\SearchableResult;
+use Org\Mxchange\CoreFramework\Stacker\Stackable;
/**
* A general DHT class
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
abstract class BaseDht extends BaseHubSystem implements Distributable {
+ /**
+ * Stacker name for "INSERT" node data
+ */
+ const STACKER_NAME_INSERT_NODE = 'dht_insert_node';
+ const STACKER_NAME_PENDING_PUBLISHING = 'dht_pending_publish';
+
/**
* "Cached" instance of a publish helper
*/
private $publishHelperInstance = NULL;
/**
- * Stacker name for "INSERT" node data
+ * Instance of the stacker
*/
- const STACKER_NAME_INSERT_NODE = 'dht_insert_node';
- const STACKER_NAME_PENDING_PUBLISHING = 'dht_pending_publish';
+ private $stackInstance = NULL;
/**
* Protected constructor
DhtStateFactory::createDhtStateInstanceByName('init', $this);
}
+ /**
+ * Setter for stacker instance
+ *
+ * @param $stackInstance An instance of an stacker
+ * @return void
+ */
+ protected final function setStackInstance (Stackable $stackInstance) {
+ $this->stackInstance = $stackInstance;
+ }
+
+ /**
+ * Getter for stacker instance
+ *
+ * @return $stackInstance An instance of an stacker
+ */
+ public final function getStackInstance () {
+ return $this->stackInstance;
+ }
+
/**
* Initializes all stackers
*
*
* @param $messageType Type of message
* @param $messageInstance An instance of a DeliverableMessage class
- * @param $packageInstance An instance of a Receivable class
+ * @param $handlerInstance An instance of a Receivable class
* @return void
* @todo Exceptions from renderXmlContent() are currently unhandled
*/
- protected function genericProcessMessage ($messageType, DeliverableMessage $messageInstance, Receivable $packageInstance) {
+ protected function genericProcessMessage ($messageType, DeliverableMessage $messageInstance, Receivable $handlerInstance) {
// Get a template instance from the factory
$templateInstance = XmlTemplateEngineFactory::createXmlTemplateEngineInstance(sprintf('node_%s_template_class', $messageType));
);
// Push the processed message back on stack
- $packageInstance->getStackInstance()->pushNamed(NetworkPackageHandler::STACKER_NAME_PROCESSED_MESSAGE, $messageArray);
+ $handlerInstance->getStackInstance()->pushNamed(NetworkPackageHandler::STACKER_NAME_PROCESSED_MESSAGE, $messageArray);
}
}
use Org\Mxchange\CoreFramework\Handler\BaseHandler;
use Org\Mxchange\CoreFramework\Handler\Handleable;
use Org\Mxchange\CoreFramework\Registry\Register;
+use Org\Mxchange\CoreFramework\Stacker\Stackable;
/**
* A general hub handler
*/
private $registryInstance = NULL;
+ /**
+ * Instance of the stacker
+ */
+ private $stackInstance = NULL;
+
/**
* Protected constructor
*
return $this->registryInstance;
}
+ /**
+ * Setter for stacker instance
+ *
+ * @param $stackInstance An instance of an stacker
+ * @return void
+ */
+ protected final function setStackInstance (Stackable $stackInstance) {
+ $this->stackInstance = $stackInstance;
+ }
+
+ /**
+ * Getter for stacker instance
+ *
+ * @return $stackInstance An instance of an stacker
+ */
+ public final function getStackInstance () {
+ return $this->stackInstance;
+ }
+
}
*/
private $compressorInstance = NULL;
+ /**
+ * Visitor handler instance
+ */
+ private $visitorInstance = NULL;
+
/**
* Protected constructor
*
* Creates an instance of this class
*
* @param $compressorInstance A Compressor instance for compressing the content
- * @return $packageInstance An instance of a Deliverable class
+ * @return $handlerInstance An instance of a Deliverable class
*/
public static final function createNetworkPackageHandler (Compressor $compressorInstance) {
// Get new instance
- $packageInstance = new NetworkPackageHandler();
+ $handlerInstance = new NetworkPackageHandler();
// Now set the compressor instance
- $packageInstance->setCompressorInstance($compressorInstance);
+ $handlerInstance->setCompressorInstance($compressorInstance);
/*
* We need to initialize a stack here for our packages even for those
$stackInstance = ObjectFactory::createObjectByConfiguredName('network_package_stacker_class');
// At last, set it in this class
- $packageInstance->setStackInstance($stackInstance);
+ $handlerInstance->setStackInstance($stackInstance);
// Init all stacker
- $packageInstance->initStacks();
+ $handlerInstance->initStacks();
// Get a visitor instance for speeding up things and set it
$visitorInstance = ObjectFactory::createObjectByConfiguredName('node_raw_data_monitor_visitor_class');
- $packageInstance->setVisitorInstance($visitorInstance);
+ $handlerInstance->setVisitorInstance($visitorInstance);
// Get crypto instance and set it, too
$cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class');
- $packageInstance->setCryptoInstance($cryptoInstance);
+ $handlerInstance->setCryptoInstance($cryptoInstance);
// Get a singleton package assembler instance from factory and set it here, too
- $assemblerInstance = PackageAssemblerFactory::createAssemblerInstance($packageInstance);
- $packageInstance->setAssemblerInstance($assemblerInstance);
+ $assemblerInstance = PackageAssemblerFactory::createAssemblerInstance($handlerInstance);
+ $handlerInstance->setAssemblerInstance($assemblerInstance);
// Get node instance
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NETWORK-PACKAGE-HANDLER: Creating node instance ...');
$nodeInstance = NodeObjectFactory::createNodeInstance();
// Set it locally
- $packageInstance->setNodeInstance($nodeInstance);
+ $handlerInstance->setNodeInstance($nodeInstance);
// Get pool instance from node
$poolInstance = $nodeInstance->getListenerPoolInstance();
// And set it here
- $packageInstance->setListenerPoolInstance($poolInstance);
+ $handlerInstance->setListenerPoolInstance($poolInstance);
// Return the prepared instance
- return $packageInstance;
+ return $handlerInstance;
}
/**
return $this->compressorInstance;
}
+ /**
+ * Setter for visitor instance
+ *
+ * @param $visitorInstance A Visitor instance
+ * @return void
+ */
+ protected final function setVisitorInstance (Visitor $visitorInstance) {
+ $this->visitorInstance = $visitorInstance;
+ }
+
+ /**
+ * Getter for visitor instance
+ *
+ * @return $visitorInstance A Visitor instance
+ */
+ protected final function getVisitorInstance () {
+ return $this->visitorInstance;
+ }
+
/**
* Initialize all stackers
*
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Registry\Registerable;
use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
+use Org\Mxchange\CoreFramework\Stacker\Stackable;
use Org\Mxchange\CoreFramework\Visitor\Visitable;
use Org\Mxchange\CoreFramework\Visitor\Visitor;
*/
private $packageHandlerInstance = NULL;
+ /**
+ * Instance of the stacker
+ */
+ private $stackInstance = NULL;
+
/**
* Protected constructor
*
return $this->packageHandlerInstance;
}
+ /**
+ * Setter for stacker instance
+ *
+ * @param $stackInstance An instance of an stacker
+ * @return void
+ */
+ protected final function setStackInstance (Stackable $stackInstance) {
+ $this->stackInstance = $stackInstance;
+ }
+
+ /**
+ * Getter for stacker instance
+ *
+ * @return $stackInstance An instance of an stacker
+ */
+ public final function getStackInstance () {
+ return $this->stackInstance;
+ }
+
/**
* Checks whether the input buffer (stacker to be more preceise) is empty.
*
// Import framework stuff
use Org\Mxchange\CoreFramework\Factory\Stack\FileStackFactory;
+use Org\Mxchange\CoreFramework\Stacker\Stackable;
/**
* A general URL source class
const CRAWL_JOB_ARRAY_DEPTH = 'start_depth';
const CRAWL_JOB_ARRAY_EXTERNAL_DEPTH = 'external_depth';
+ /**
+ * Instance of the stacker
+ */
+ private $stackInstance = NULL;
+
/**
* Protected constructor
*
parent::__construct($className);
}
+ /**
+ * Setter for stacker instance
+ *
+ * @param $stackInstance An instance of an stacker
+ * @return void
+ */
+ protected final function setStackInstance (Stackable $stackInstance) {
+ $this->stackInstance = $stackInstance;
+ }
+
+ /**
+ * Getter for stacker instance
+ *
+ * @return $stackInstance An instance of an stacker
+ */
+ public final function getStackInstance () {
+ return $this->stackInstance;
+ }
+
/**
* Initalizes this source
*
// Import framework stuff
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+use Org\Mxchange\CoreFramework\Crypto\RandomNumber\RandomNumberGenerator;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Registry\Registerable;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class TestUnitSource extends BaseSource implements UnitSource, Registerable {
+ /**
+ * Instance of a RNG
+ */
+ private $rngInstance = NULL;
+
/**
* Protected constructor
*
return $sourceInstance;
}
+ /**
+ * Setter for RNG instance
+ *
+ * @param $rngInstance An instance of a random number generator (RNG)
+ * @return void
+ */
+ protected final function setRngInstance (RandomNumberGenerator $rngInstance) {
+ $this->rngInstance = $rngInstance;
+ }
+
+ /**
+ * Getter for RNG instance
+ *
+ * @return $rngInstance An instance of a random number generator (RNG)
+ */
+ public final function getRngInstance () {
+ return $this->rngInstance;
+ }
+
/**
* Generates an encrypted random message
*
return $encryptedMessage;
}
}
-
-// [EOF]
-?>
-Subproject commit a1dfd448376c05e2a5ee2af1538c2e38f42983e4
+Subproject commit c2e22b6c3806033f8a1935010cf875c1f243fa4a