namespace Org\Shipsimu\Hub\Generic;
// Import application-specific stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Shipsimu\Hub\Container\Socket\StorableSocket;
use Org\Shipsimu\Hub\Handler\Network\RawData\HandleableRawData;
use Org\Shipsimu\Hub\Network\Delivery\Deliverable;
);
// ... and return it
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-SYSTEM: isset=%d - EXIT!', intval($isset)));
return $isset;
}
*/
protected final function setNodeId ($nodeId) {
// Set it config now
- $this->getConfigInstance()->setConfigEntry('node_id', (string) $nodeId);
+ FrameworkBootstrap::getConfigurationInstance()->setConfigEntry('node_id', (string) $nodeId);
}
/**
*/
public final function getNodeId () {
// Get it from config
- return $this->getConfigInstance()->getConfigEntry('node_id');
+ return FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('node_id');
}
/**
*/
protected final function setPrivateKey (string $privateKey) {
// Set it config now
- $this->getConfigInstance()->setConfigEntry('private_key', (string) $privateKey);
+ FrameworkBootstrap::getConfigurationInstance()->setConfigEntry('private_key', (string) $privateKey);
}
/**
*/
public final function getPrivateKey () {
// Get it from config
- return $this->getConfigInstance()->getConfigEntry('private_key');
+ return FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('private_key');
}
/**
*/
protected final function setNodePrivateKeyHash (string $privateKeyHash) {
// Set it config now
- $this->getConfigInstance()->setConfigEntry('private_key_hash', $privateKeyHash);
+ FrameworkBootstrap::getConfigurationInstance()->setConfigEntry('private_key_hash', $privateKeyHash);
}
/**
*/
public final function getNodePrivateKeyHash () {
// Get it from config
- return $this->getConfigInstance()->getConfigEntry('private_key_hash');
+ return FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('private_key_hash');
}
/**
* @return void
*/
protected final function setSessionId (string $sessionId) {
- $this->getConfigInstance()->setConfigEntry('session_id', $sessionId);
+ FrameworkBootstrap::getConfigurationInstance()->setConfigEntry('session_id', $sessionId);
}
/**
* @return $sessionId Current session id
*/
public final function getSessionId () {
- return $this->getConfigInstance()->getConfigEntry('session_id');
+ return FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('session_id');
}
/**
// Open connection
if ($helperInstance->isProxyUsed() === true) {
// Resolve hostname into IP address
- $ip = ConsoleTools::resolveIpAddress($helperInstance->getConfigInstance()->getConfigEntry('proxy_host'));
+ $ip = ConsoleTools::resolveIpAddress(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('proxy_host'));
// @TODO Handle $ip = false
// Connect to host through proxy connection
- $socketResource = fsockopen($ip, $helperInstance->getConfigInstance()->getConfigEntry('proxy_port'), $errorNo, $errorStr, 30);
+ $socketResource = fsockopen($ip, FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('proxy_port'), $errorNo, $errorStr, 30);
} else {
// Connect to host directly
$socketResource = fsockopen('188.138.90.169', 80, $errorNo, $errorStr, 30);
// Open connection
if ($helperInstance->isProxyUsed() === true) {
// Resolve hostname into IP address
- $ip = ConsoleTools::resolveIpAddress($helperInstance->getConfigInstance()->getConfigEntry('proxy_host'));
+ $ip = ConsoleTools::resolveIpAddress(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('proxy_host'));
// @TODO Handle $ip = false
// Connect to host through proxy connection
- $socketResource = fsockopen($ip, $helperInstance->getConfigInstance()->getConfigEntry('proxy_port'), $errorNo, $errorStr, 30);
+ $socketResource = fsockopen($ip, FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('proxy_port'), $errorNo, $errorStr, 30);
} else {
// Connect to host directly
$socketResource = fsockopen('188.138.90.169', 80, $errorNo, $errorStr, 30);
// Do we use proxy?
if ($helperInstance->isProxyUsed() === true) {
// CONNECT method?
- if ($helperInstance->getConfigInstance()->getConfigEntry('proxy_connect_method') == 'Y') {
+ if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('proxy_connect_method') == 'Y') {
// Setup proxy tunnel
$response = $helperInstance->setupProxyTunnel('shipsimu.org', 80, $socketResource);
// Own namespace
namespace Org\Mxchange\CoreFramework\Client\Http;
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+
/**
* A HTTP client class
*
// Determine it
$GLOBALS[__METHOD__] = (
(
- $this->getConfigInstance()->getConfigEntry('proxy_host') != ''
+ FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('proxy_host') != ''
) && (
- $this->getConfigInstance()->getConfigEntry('proxy_port') > 0
+ FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('proxy_port') > 0
)
);
} // END - if
$rawRequest .= 'Host: ' . $host . ':' . $port . self::HTTP_EOL;
// Use login data to proxy? (username at least)
- if ($this->getConfigInstance()->getConfigEntry('proxy_username') != '') {
+ if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('proxy_username') != '') {
// Add it as well
- $encodedAuth = base64_encode($this->getConfigInstance()->getConfigEntry('proxy_username') . ':' . $this->getConfigInstance()->getConfigEntry('proxy_password'));
+ $encodedAuth = base64_encode(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('proxy_username') . ':' . FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('proxy_password'));
$rawRequest .= 'Proxy-Authorization: Basic ' . $encodedAuth . self::HTTP_EOL;
} // END - if
use Org\Shipsimu\Hub\Handler\Package\NetworkPackageHandler;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Generic\NullPointerException;
use Org\Mxchange\CoreFramework\Registry\Registerable;
parent::__construct(__CLASS__);
// Init value
- $this->socketSelectTimeout = $this->getConfigInstance()->getConfigEntry('socket_select_timeout_usec');
+ $this->socketSelectTimeout = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('socket_select_timeout_usec');
// Init array of connection types
$this->connectionTypes = array(
* PHP_NORMAL_READ, this line will endless block. This script does only
* provide simultanous or faked threads, not real.
*/
- $rawData = socket_read($this->getSocketResource(), $this->getConfigInstance()->getConfigEntry('tcp_buffer_length'), PHP_BINARY_READ);
+ $rawData = socket_read($this->getSocketResource(), FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('tcp_buffer_length'), PHP_BINARY_READ);
// Return it
/* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s,rawData[%s]=%s - EXIT!', strtoupper($this->getSocketProtocol()), $this->getSocketResource(), gettype($rawData), $rawData));
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s - CALLED!', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
$result = $this->setSocketOption(SOL_SOCKET, SO_RCVTIMEO, [
// Seconds
- 'sec' => $this->getConfigInstance()->getConfigEntry($this->getSocketProtocol() . '_socket_accept_wait_sec'),
+ 'sec' => FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($this->getSocketProtocol() . '_socket_accept_wait_sec'),
// Milliseconds
- 'usec' => $this->getConfigInstance()->getConfigEntry($this->getSocketProtocol() . '_socket_accept_wait_usec'),
+ 'usec' => FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($this->getSocketProtocol() . '_socket_accept_wait_usec'),
]);
// Return result
use Org\Shipsimu\Hub\Generic\BaseHubSystem;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Database\Updateable;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
*/
protected function isInBufferQueueFilled () {
// Determine it
- $isFilled = ($this->bufferInstance->getStackCount(self::STACKER_NAME_IN_QUEUE) > $this->getConfigInstance()->getConfigEntry('cruncher_in_buffer_min_threshold'));
+ $isFilled = ($this->bufferInstance->getStackCount(self::STACKER_NAME_IN_QUEUE) > FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('cruncher_in_buffer_min_threshold'));
// And return the result
return $isFilled;
$this->fillInBufferQueueWithWorkUnits();
// Is the buffer still not filled and are test-packages allowed?
- if ((!$this->isInBufferQueueFilled()) && ($this->getConfigInstance()->getConfigEntry('cruncher_test_units_enabled') == 'Y')) {
+ if ((!$this->isInBufferQueueFilled()) && (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('cruncher_test_units_enabled') == 'Y')) {
// Then fill the in-buffer with (one) test-unit(s)
$this->fillInBufferQueueWithTestUnits();
} // END - if
use Org\Shipsimu\Hub\Helper\Cruncher\CruncherHelper;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Controller\Controller;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Registry\Registerable;
*/
protected function fillInBufferQueueWithTestUnits () {
// Are test units enabled?
- if ($this->getConfigInstance()->getConfigEntry('cruncher_test_units_enabled') == 'N') {
+ if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('cruncher_test_units_enabled') == 'N') {
// They are disabled, so skip any further steps
return;
} elseif ($this->getStateInstance()->isCruncherStateVirgin()) {
$generatorInstance = ObjectFactory::createObjectByConfiguredName('cruncher_test_unit_generator_class');
// We don't need an iterator here because we just need to generate some test units
- for ($idx = 0; $idx < $this->getConfigInstance()->getConfigEntry('cruncher_max_text_unit_amount'); $idx++) {
+ for ($idx = 0; $idx < FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('cruncher_max_text_unit_amount'); $idx++) {
// Get a test unit from it
$unitInstance = $generatorInstance->generateNextUnitInstance();
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-WRAPPER: CALLED!');
// Get max recipients
- $maxRecipients = $this->getConfigInstance()->getConfigEntry('max_dht_recipients');
+ $maxRecipients = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('max_dht_recipients');
// First creata a search instance
$searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
}
// Get max recipients
- $maxRecipients = $this->getConfigInstance()->getConfigEntry('max_dht_recipients');
+ $maxRecipients = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('max_dht_recipients');
// First creata a search instance
$searchInstance = ObjectFactory::createObjectByConfiguredName('search_criteria_class');
use Org\Shipsimu\Hub\Helper\Dht\HelpableDht;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Result\Search\SearchableResult;
*/
public function updateDhtData () {
// Set some dummy configuration entries, e.g. dht_status
- $this->getConfigInstance()->setConfigEntry('dht_status', $this->getStateInstance()->getStateName());
+ FrameworkBootstrap::getConfigurationInstance()->setConfigEntry('dht_status', $this->getStateInstance()->getStateName());
}
/**
use Org\Shipsimu\Hub\Network\Package\DeliverablePackage;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Factory\Database\Wrapper\DatabaseWrapperFactory;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Handler\DataSet\HandleableDataSet;
$searchInstance->addExcludeCriteria(str_replace('my-', '', $excludeKey), $messageData[$excludeKey]);
// Only X entries are fine
- $searchInstance->setLimit($this->getConfigInstance()->getConfigEntry('node_dht_list_limit'));
+ $searchInstance->setLimit(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('node_dht_list_limit'));
// Run the query
$resultInstance = $this->getWrapperInstance()->doSelectByCriteria($searchInstance);
namespace Org\Shipsimu\Hub\Factory\Node;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
use Org\Mxchange\CoreFramework\Request\Requestable;
} elseif (($requestInstance instanceof Requestable) && ($responseInstance instanceof Responseable)) {
// The default node-mode is from our configuration
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('NODE-FACTORY: requestInstance and responseInstance are both set.');
- $nodeMode = $factoryInstance->getConfigInstance()->getConfigEntry('node_default_mode');
+ $nodeMode = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('node_default_mode');
// Is the node 'mode' parameter set?
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-FACTORY: nodeMode=%s - from CONFIG', $nodeMode));
*/
public static final function createListenFileSocket (Listenable $listenerInstance) {
// Create SplFileInfo
- $fileInfo = new SplFileInfo($listenerInstance->getConfigInstance()->getConfigEntry('ipc_socket_file_name'));
+ $fileInfo = new SplFileInfo(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('ipc_socket_file_name'));
// Create file name
$socketFile = self::createTempPathForFile($fileInfo);
namespace Org\Shipsimu\Hub\Feature\CoinReward;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Feature\BaseFeature;
use Org\Mxchange\CoreFramework\Feature\Feature;
use Org\Mxchange\CoreFramework\Feature\FrameworkFeature;
public function isFeatureAvailable () {
// Testing this feature is pretty simple:
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: CALLED!', __METHOD__, __LINE__));
- $isAvailable = (($this->getConfigInstance()->getConfigEntry('extension_scrypt_loaded') === TRUE) && (extension_loaded('scrypt')) && (is_callable('scrypt')));
+ $isAvailable = ((FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('extension_scrypt_loaded') === TRUE) && (extension_loaded('scrypt')) && (is_callable('scrypt')));
// Return status
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('[%s:%d]: isAvailable=%d - EXIT!', __METHOD__, __LINE__, intval($isAvailable)));
use Org\Shipsimu\Hub\Cruncher\Filter\BaseCruncherFilter;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Filter\Filterable;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
// The default cruncher-mode is from our configuration
- $cruncherMode = $this->getConfigInstance()->getConfigEntry('cruncher_default_mode');
+ $cruncherMode = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('cruncher_default_mode');
// Is the cruncher 'mode' parameter set?
if ($requestInstance->isRequestElementSet('mode')) {
// Own namespace
namespace Org\Shipsimu\Hub\Miner\Filter\Initialization;
+// Import application-specific stuff
+use Org\Shipsimu\Hub\Miner\Filter\BaseMinerFilter;
+
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Filter\Filterable;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
use Org\Mxchange\CoreFramework\Request\Requestable;
use Org\Mxchange\CoreFramework\Response\Responseable;
-// Import application-specific stuff
-use Org\Shipsimu\Hub\Miner\Filter\BaseMinerFilter;
-
/**
* A Initialization filter for miners
*
*/
public function execute (Requestable $requestInstance, Responseable $responseInstance) {
// The default miner-mode is from our configuration
- $minerMode = $this->getConfigInstance()->getConfigEntry('miner_default_mode');
+ $minerMode = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('miner_default_mode');
// Is the miner 'mode' parameter set?
if ($requestInstance->isRequestElementSet('mode')) {
// Own namespace
namespace Org\Shipsimu\Hub\Miner\Filter\Requirements;
+// Import application-specific stuff
+use Org\Shipsimu\Hub\Miner\Filter\BaseMinerFilter;
+
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Filter\Filterable;
use Org\Mxchange\CoreFramework\Request\Requestable;
use Org\Mxchange\CoreFramework\Response\Responseable;
-// Import application-specific stuff
-use Org\Shipsimu\Hub\Miner\Filter\BaseMinerFilter;
-
/**
* A PhpRequirements filter for miners
*
if ((extension_loaded('scrypt')) && (is_callable('scrypt'))) {
// Mark it as working
self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER: ext-scrypt and a callable scrypt() function found. "Hubcoin reward" feature possible.');
- $this->getConfigInstance()->setConfigEntry('extension_scrypt_loaded', TRUE);
+ FrameworkBootstrap::getConfigurationInstance()->setConfigEntry('extension_scrypt_loaded', TRUE);
} else {
// Not working (not all have ext-scrypt installed
self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER: ext-scrypt not found or scrypt() function not found. "Hubcoin reward" feature disabled.');
throw new FilterChainException($this, self::FILTER_CHAIN_INTERCEPTED);
} // END - if
}
-}
-// [EOF]
-?>
+}
use Org\Shipsimu\Hub\Filter\Node\BaseNodeFilter;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Filter\Filterable;
use Org\Mxchange\CoreFramework\Request\Requestable;
use Org\Mxchange\CoreFramework\Response\Responseable;
if ((extension_loaded('scrypt')) && (is_callable('scrypt'))) {
// Mark it as working
self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER: ext-scrypt and a callable scrypt() function found. "Hubcoin reward" feature possible.');
- $this->getConfigInstance()->setConfigEntry('extension_scrypt_loaded', TRUE);
+ FrameworkBootstrap::getConfigurationInstance()->setConfigEntry('extension_scrypt_loaded', TRUE);
} else {
// Not working (not all have ext-scrypt installed
self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER: ext-scrypt not found or scrypt() function not found. "Hubcoin reward" feature disabled.');
if ((extension_loaded('uuid')) && (is_callable('uuid_create'))) {
// Mark it as working
self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER: ext-uuid and a callable uuid_create() function found. UUID "entropy" available.');
- $this->getConfigInstance()->setConfigEntry('extension_uuid_loaded', TRUE);
+ FrameworkBootstrap::getConfigurationInstance()->setConfigEntry('extension_uuid_loaded', TRUE);
} else {
// Not working (not all have ext-uuid installed
self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('FILTER: ext-uuid not found or uuid_create() function not found. UUID "entropy" disabled.');
throw new FilterChainException($this, self::EXCEPTION_FILTER_CHAIN_INTERCEPTED);
} // END - if
}
-}
-// [EOF]
-?>
+}
use Org\Shipsimu\Hub\Crawler\Filter\BaseCrawlerFilter;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Filter\Filterable;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
$handlerInstance->registerTask('crawler_ping', $taskInstance);
// 10) URL sources
- foreach (explode(':', $this->getConfigInstance()->getConfigEntry('crawler_url_stacks')) as $stack) {
+ foreach (explode(':', FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('crawler_url_stacks')) as $stack) {
// Init task instance
$taskInstance = ObjectFactory::createObjectByConfiguredName('crawler_url_source_' . $stack . '_task_class');
use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
use Org\Mxchange\CoreFramework\Handler\BaseHandler;
use Org\Mxchange\CoreFramework\Handler\Handleable;
+use Org\Mxchange\CoreFramework\Registry\Register;
/**
* A general hub handler
*/
private $assemblerInstance = NULL;
+ /**
+ * Registry instance (implementing Register)
+ */
+ private $registryInstance = NULL;
+
/**
* Protected constructor
*
*/
public final function ifStartEndMarkersSet ($data) {
// Trace message
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-HANDLER: data()=%d - CALLED!', strlen($data)));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-HANDLER: data(%d)=%s - CALLED!', strlen($data), $data));
// Determine it
$isset = ((substr($data, 0, strlen(HandleableRawData::STREAM_START_MARKER)) == HandleableRawData::STREAM_START_MARKER) && (substr($data, -1 * strlen(HandleableRawData::STREAM_END_MARKER), strlen(HandleableRawData::STREAM_END_MARKER)) == HandleableRawData::STREAM_END_MARKER));
// ... and return it
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('HUB-HANDLER: isset=%d - EXIT!', intval($isset)));
return $isset;
}
return $this->assemblerInstance;
}
+ /**
+ * Setter for registry instance
+ *
+ * @param $registryInstance An instance of a Register class
+ * @return void
+ */
+ protected final function setRegistryInstance (Register $registryInstance) {
+ $this->registryInstance = $registryInstance;
+ }
+
+ /**
+ * Getter for registry instance
+ *
+ * @return $registryInstance The debug registry instance
+ */
+ protected final function getRegistryInstance () {
+ return $this->registryInstance;
+ }
+
}
use Org\Shipsimu\Hub\Template\Engine\Xml\Answer\Announcement\XmlAnnouncementAnswerTemplateEngine;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
use Org\Mxchange\CoreFramework\Registry\Registerable;
$objectList = $nodeInstance->getListFromAcceptedObjectTypes();
// Add missing (temporary) configuration 'accepted_object_types'
- $this->getConfigInstance()->setConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ACCEPTED_OBJECTS, implode(BaseHubNode::OBJECT_LIST_SEPARATOR, $objectList));
+ FrameworkBootstrap::getConfigurationInstance()->setConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ACCEPTED_OBJECTS, implode(BaseHubNode::OBJECT_LIST_SEPARATOR, $objectList));
}
/**
*/
protected function removeMessageConfigurationData (DeliverableMessage $messageInstance) {
// Remove temporay configuration
- $this->getConfigInstance()->unsetConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ACCEPTED_OBJECTS);
+ FrameworkBootstrap::getConfigurationInstance()->unsetConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ACCEPTED_OBJECTS);
}
}
use Org\Shipsimu\Hub\Template\Engine\Xml\Answer\Announcement\XmlAnnouncementAnswerTemplateEngine;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Criteria\Storing\StoreableCriteria;
use Org\Mxchange\CoreFramework\Registry\Registerable;
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANNOUNCEMENT-HANDLER: Setting messageKey=' . $messageKey . ',configKey=' . $configKey . ':' . $messageData[$messageKey]);
// Set the element in configuration
- $this->getConfigInstance()->setConfigEntry($configKey, $messageData[$messageKey]);
+ FrameworkBootstrap::getConfigurationInstance()->setConfigEntry($configKey, $messageData[$messageKey]);
} // END - foreach
// "Walk" throught the config-copy array
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('ANNOUNCEMENT-HANDLER: Copying from sourceKey=' . $sourceKey . ' to targetKey=' . $targetKey . '...');
// Copy from source to targetKey
- $this->getConfigInstance()->setConfigEntry($targetKey, $this->getConfigInstance()->getConfigEntry($sourceKey));
+ FrameworkBootstrap::getConfigurationInstance()->setConfigEntry($targetKey, FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($sourceKey));
} // END - foreach
// Translate last exception into a status code
$statusCode = $this->getTranslatedStatusFromLastException();
// Set it in configuration (temporarily)
- $this->getConfigInstance()->setConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ANSWER_STATUS, $statusCode);
+ FrameworkBootstrap::getConfigurationInstance()->setConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ANSWER_STATUS, $statusCode);
}
/**
// "Walk" throught the translation array again
foreach ($this->messageToConfig as $dummy => $configKey) {
// Now unset this configuration entry (to save some memory)
- $this->getConfigInstance()->unsetConfigEntry($configKey);
+ FrameworkBootstrap::getConfigurationInstance()->unsetConfigEntry($configKey);
} // END - foreach
// "Walk" throught the config-copy array again
foreach ($this->configCopy as $configKey => $dummy) {
// Now unset this configuration entry (to save some memory again)
- $this->getConfigInstance()->unsetConfigEntry($configKey);
+ FrameworkBootstrap::getConfigurationInstance()->unsetConfigEntry($configKey);
} // END - foreach
// Remove NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ANSWER_STATUS as well
- $this->getConfigInstance()->unsetConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ANSWER_STATUS);
+ FrameworkBootstrap::getConfigurationInstance()->unsetConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ANSWER_STATUS);
}
}
use Org\Shipsimu\Hub\Template\Engine\Xml\Dht\Bootstrap\XmlDhtBootstrapTemplateEngine;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Criteria\Storing\StoreableCriteria;
use Org\Mxchange\CoreFramework\Registry\Registerable;
foreach ($this->messageToConfig as $messageKey => $configKey) {
// Set the element in configuration
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-BOOTSTRAP-HANDLER: Setting messageKey=' . $messageKey . ',configKey=' . $configKey . ':' . $messageData[$messageKey]);
- $this->getConfigInstance()->setConfigEntry($configKey, $messageData[$messageKey]);
+ FrameworkBootstrap::getConfigurationInstance()->setConfigEntry($configKey, $messageData[$messageKey]);
} // END - foreach
// "Walk" throught the config-copy array
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('DHT-BOOTSTRAP-HANDLER: Copying from sourceKey=' . $sourceKey . ' to targetKey=' . $targetKey . '...');
// Copy from source to target key
- $this->getConfigInstance()->setConfigEntry($targetKey, $this->getConfigInstance()->getConfigEntry($sourceKey));
+ FrameworkBootstrap::getConfigurationInstance()->setConfigEntry($targetKey, FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($sourceKey));
} // END - foreach
// Translate last exception into a status code
$statusCode = $this->getTranslatedStatusFromLastException();
// Set it in configuration (temporarily)
- $this->getConfigInstance()->setConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ANSWER_STATUS, $statusCode);
+ FrameworkBootstrap::getConfigurationInstance()->setConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ANSWER_STATUS, $statusCode);
/*
* Use the DHT instance to get a list of recipients. This means that all
assert(count($nodeList) > 0);
// Set it in configuration
- $this->getConfigInstance()->setConfigEntry('dht_nodes', base64_encode(json_encode($nodeList)));
+ FrameworkBootstrap::getConfigurationInstance()->setConfigEntry('dht_nodes', base64_encode(json_encode($nodeList)));
}
/**
// "Walk" throught the translation array again
foreach ($this->messageToConfig as $dummy => $configKey) {
// Now unset this configuration entry (to save some memory)
- $this->getConfigInstance()->unsetConfigEntry($configKey);
+ FrameworkBootstrap::getConfigurationInstance()->unsetConfigEntry($configKey);
} // END - foreach
// "Walk" throught the config-copy array again
foreach ($this->configCopy as $configKey => $dummy) {
// Now unset this configuration entry (to save some memory again)
- $this->getConfigInstance()->unsetConfigEntry($configKey);
+ FrameworkBootstrap::getConfigurationInstance()->unsetConfigEntry($configKey);
} // END - foreach
// Remove temporary "special" values as well
- $this->getConfigInstance()->unsetConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ANSWER_STATUS);
- $this->getConfigInstance()->unsetConfigEntry('dht_nodes');
+ FrameworkBootstrap::getConfigurationInstance()->unsetConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ANSWER_STATUS);
+ FrameworkBootstrap::getConfigurationInstance()->unsetConfigEntry('dht_nodes');
}
}
use Org\Shipsimu\Hub\Template\Engine\Xml\Request\NodeList\XmlRequestNodeListTemplateEngine;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Criteria\Storing\StoreableCriteria;
use Org\Mxchange\CoreFramework\Registry\Registerable;
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('REQUEST-HANDLER: Copying from sourceKey=' . $sourceKey . ' to targetKey=' . $targetKey . '...');
// Copy from source to targetKey
- $this->getConfigInstance()->setConfigEntry($targetKey, $this->getConfigInstance()->getConfigEntry($sourceKey));
+ FrameworkBootstrap::getConfigurationInstance()->setConfigEntry($targetKey, FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($sourceKey));
} // END - foreach
// Query local DHT for nodes except given session id
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('REQUEST-HANDLER: Got a node list of ' . count($nodeList) . ' entry/-ies back.');
// Set it serialized in configuration (temporarily)
- $this->getConfigInstance()->setConfigEntry('node_list', base64_encode(json_encode($nodeList)));
+ FrameworkBootstrap::getConfigurationInstance()->setConfigEntry('node_list', base64_encode(json_encode($nodeList)));
// Translate last exception into a status code
$statusCode = $this->getTranslatedStatusFromLastException();
// Set it in configuration (temporarily)
- $this->getConfigInstance()->setConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ANSWER_STATUS, $statusCode);
+ FrameworkBootstrap::getConfigurationInstance()->setConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ANSWER_STATUS, $statusCode);
}
/**
// "Walk" throught the config-copy array again
foreach ($this->configCopy as $configKey => $dummy) {
// Now unset this configuration entry (to save some memory again)
- $this->getConfigInstance()->unsetConfigEntry($configKey);
+ FrameworkBootstrap::getConfigurationInstance()->unsetConfigEntry($configKey);
} // END - foreach
// Remove answer status/node list as well
- $this->getConfigInstance()->unsetConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ANSWER_STATUS);
- $this->getConfigInstance()->unsetConfigEntry('node_list');
+ FrameworkBootstrap::getConfigurationInstance()->unsetConfigEntry(NodeDistributedHashTableDatabaseWrapper::DB_COLUMN_ANSWER_STATUS);
+ FrameworkBootstrap::getConfigurationInstance()->unsetConfigEntry('node_list');
}
}
use Org\Shipsimu\Hub\Network\Package\Delivery\Fragment\Fragmentable;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
// Calculate buffer size
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-HELPER: rawData()=%d - after loop ...', strlen($rawData)));
- $bufferSize = $this->getConfigInstance()->getConfigEntry($this->getProtocolName() . '_buffer_length');
+ $bufferSize = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($this->getProtocolName() . '_buffer_length');
// Encode the raw data with our output-stream
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-HELPER: bufferSize=%d', $bufferSize));
use Org\Shipsimu\Hub\Helper\Connection\BaseConnectionHelper;
use Org\Shipsimu\Hub\Locator\Node\LocateableNode;
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+
/**
* A ??? connection helper class
*
assert($this->isInitialized());
// "Cache" socket resource and timeout config
- $timeout = $this->getConfigInstance()->getConfigEntry('socket_timeout_seconds');
+ $timeout = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('socket_timeout_seconds');
// Debug output
self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-HELPER: Trying to connect to %s with socketResource[%s]=%s ...', $this->getSocketInstance()->getSocketRecipient(), gettype($this->getSocketInstance()->getSocketResource()), $this->getSocketInstance()->getSocketResource()));
use Org\Shipsimu\Hub\Tools\HubTools;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
/**
* A TCP connection helper class
self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CONNECTION-HELPER: Failed to resolve ' . $packageInstance->getRecipientUnl() . ':' . $e->getMessage());
// Is the recipient equal as configured UNL?
- if (substr($packageInstance->getRecipientUnl(), 0, strlen($helperInstance->getConfigInstance()->getConfigEntry('external_address'))) == $helperInstance->getConfigInstance()->getConfigEntry('external_address')) {
+ if (substr($packageInstance->getRecipientUnl(), 0, strlen(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('external_address'))) == FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('external_address')) {
// This may connect to shipsimu.org and requests 'ip.php' which will return our external IP address
$unlAddress = HubTools::determineExternalAddress();
__METHOD__,
__LINE__,
$packageInstance->getRecipientUnl(),
- $helperInstance->getConfigInstance()->getConfigEntry('external_address')
+ FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('external_address')
));
}
}
*/
public function fillWithConnectionHelperInformation (ConnectionHelper $helperInstance) {
// Fill the generic array with several data from the listener:
- /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-INFO: protocolName=%s,helperInstance=%s,socketResource=%s - CALLED!', $helperInstance->getProtocolName(), $helperInstance->__toString(), $helperInstance->getSocketResource()));
+ /* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CONNECTION-INFO: protocolName=%s,helperInstance=%s - CALLED!', $helperInstance->getProtocolName(), $helperInstance->__toString()));
$this->setProtocolName($helperInstance->getSocketInstance()->getSocketProtocol());
$this->setGenericArrayElement('connection', 'dummy', 'dummy', LocateableNode::UNL_PART_ADDRESS, $helperInstance->getSocketInstance()->getSocketRecipientAddress());
$this->setGenericArrayElement('connection', 'dummy', 'dummy', LocateableNode::UNL_PART_PORT , $helperInstance->getSocketInstance()->getSocketRecipientPort());
namespace Org\Shipsimu\Hub\Iterator\Producer\Key\TestUnit;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Generic\UnsupportedOperationException;
use Org\Mxchange\CoreFramework\Iterator\BaseIterator;
parent::__construct(__CLASS__);
// Get key length
- $this->keyLength = $this->getConfigInstance()->getConfigEntry('test_unit_random_secret_key_length');
+ $this->keyLength = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('test_unit_random_secret_key_length');
// Make sure the key length isn't getting to big (32 byte = 256 bit is really, really a lot!)
assert($this->keyLength <= (8 * 32));
public function valid () {
return ($this->currentIteration <= $this->maxBits);
}
-}
-// [EOF]
-?>
+}
use Org\Shipsimu\Hub\Pool\Poolable;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Factory\Registry\Socket\SocketRegistryFactory;
use Org\Mxchange\CoreFramework\Generic\NullPointerException;
+use Org\Mxchange\CoreFramework\Registry\Register;
use Org\Mxchange\CoreFramework\Socket\InvalidServerSocketException;
use Org\Mxchange\CoreFramework\Socket\SocketAlreadyRegisteredException;
use Org\Mxchange\CoreFramework\Visitor\Visitable;
*/
private $protocolName = 'invalid';
+ /**
+ * Registry instance (implementing Register)
+ */
+ private $registryInstance = NULL;
+
/**
* Protected constructor
*
* @return void
*/
public final function setListenAddressByConfiguration (string $configEntry) {
- $this->setListenAddress($this->getConfigInstance()->getConfigEntry($configEntry));
+ $this->setListenAddress(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($configEntry));
}
/**
* @return void
*/
public final function setListenPortByConfiguration (string $configEntry) {
- $this->setListenPort($this->getConfigInstance()->getConfigEntry($configEntry));
+ $this->setListenPort(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($configEntry));
}
/**
$this->protocolName = $protocolName;
}
+ /**
+ * Setter for registry instance
+ *
+ * @param $registryInstance An instance of a Register class
+ * @return void
+ */
+ protected final function setRegistryInstance (Register $registryInstance) {
+ $this->registryInstance = $registryInstance;
+ }
+
+ /**
+ * Getter for registry instance
+ *
+ * @return $registryInstance The debug registry instance
+ */
+ protected final function getRegistryInstance () {
+ return $this->registryInstance;
+ }
+
/**
* Registeres the given socket resource for "this" listener instance. This
* will be done in a seperate class to allow package writers to use it
use Org\Shipsimu\Hub\Helper\Miner\MinerHelper;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Controller\Controller;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Registry\Registerable;
*/
protected function fillInBufferQueueWithTestUnits () {
// Are test units enabled?
- if ($this->getConfigInstance()->getConfigEntry('miner_test_units_enabled') == 'N') {
+ if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('miner_test_units_enabled') == 'N') {
// They are disabled, so skip any further steps
return;
} elseif ($this->getStateInstance()->isMinerStateVirgin()) {
$generatorInstance = ObjectFactory::createObjectByConfiguredName('miner_test_unit_generator_class');
// We don't need an iterator here because we just need to generate some test units
- for ($idx = 0; $idx < $this->getConfigInstance()->getConfigEntry('miner_max_text_unit_amount'); $idx++) {
+ for ($idx = 0; $idx < FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('miner_max_text_unit_amount'); $idx++) {
// Get a test unit from it
$unitInstance = $generatorInstance->generateNextUnitInstance();
use Org\Shipsimu\Hub\Producer\Block\BlockProducer;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Database\Updateable;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
*/
protected function isInBufferQueueFilled () {
// Determine it
- $isFilled = ($this->bufferInstance->getStackCount(self::STACKER_NAME_IN_QUEUE) > $this->getConfigInstance()->getConfigEntry('miner_in_buffer_min_threshold'));
+ $isFilled = ($this->bufferInstance->getStackCount(self::STACKER_NAME_IN_QUEUE) > FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('miner_in_buffer_min_threshold'));
// And return the result
return $isFilled;
$this->fillInBufferQueueWithWorkUnits();
// Is the buffer still not filled and are test-packages allowed?
- if ((!$this->isInBufferQueueFilled()) && ($this->getConfigInstance()->getConfigEntry('miner_test_units_enabled') == 'Y')) {
+ if ((!$this->isInBufferQueueFilled()) && (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('miner_test_units_enabled') == 'Y')) {
// Then fill the in-buffer with (one) test-unit(s)
$this->fillInBufferQueueWithTestUnits();
} // END - if
// Now check if the IP address matches one of the bootstrap nodes
if ($this->ifAddressMatchesBootstrapNodes($unl)) {
// Get our port from configuration
- $ourPort = $this->getConfigInstance()->getConfigEntry('node_listen_port');
+ $ourPort = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('node_listen_port');
// Extract port
$bootPort = substr($this->getBootUniversalNodeLocator(), -strlen($ourPort), strlen($ourPort));
$isFound = FALSE;
// Run through all configured IPs
- foreach (explode(BaseHubSystem::BOOTSTRAP_NODES_SEPARATOR, $this->getConfigInstance()->getConfigEntry('hub_bootstrap_nodes')) as $unl) {
+ foreach (explode(BaseHubSystem::BOOTSTRAP_NODES_SEPARATOR, FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('hub_bootstrap_nodes')) as $unl) {
// Does it match?
if ($unl == $remoteAddr) {
// Found it!
// Stop further searching
break;
- } elseif ($unl == $this->getConfigInstance()->getConfigEntry('node_listen_addr')) {
+ } elseif ($unl == FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('node_listen_addr')) {
/*
* IP matches listen address. At this point we really don't care
* if we can really listen on that address
} // END - if
// There are 2 UNLs, internal and external.
- if ($this->getConfigInstance()->getConfigEntry('allow_publish_internal_address') == 'N') {
+ if (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('allow_publish_internal_address') == 'N') {
// Public "external" UNL address
$GLOBALS[__METHOD__] = $locatorInstance->getExternalUnl();
} else {
*/
public function updateNodeData () {
// Set some dummy configuration entries, e.g. node_status
- $this->getConfigInstance()->setConfigEntry('node_status', $this->getStateInstance()->getStateName());
+ FrameworkBootstrap::getConfigurationInstance()->setConfigEntry('node_status', $this->getStateInstance()->getStateName());
}
/**
// Import framework stuff
use Org\Mxchange\CoreFramework\Assertion\AssertionException;
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Registry\Registerable;
// Load some configuration entries and "cache" them:
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: CALLED!');
// - Chunk size in bits
- $this->chunkSize = $this->getConfigInstance()->getConfigEntry('package_chunk_size');
+ $this->chunkSize = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('package_chunk_size');
// - Maximum serial number
$this->maxSerialNumber = $this->hex2dec(str_repeat('f', self::MAX_SERIAL_LENGTH));
use Org\Shipsimu\Hub\Generic\BaseHubSystem;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Stacker\Stackable;
* @return $isReached Whether the limit is reached
*/
protected function isOutgoingQueueLimitReached ($configEntry) {
- return ($this->getConfigInstance()->getConfigEntry($configEntry) <= $this->getOutgoingQueueInstance()->getStackCount(self::STACKER_NAME_OUT_QUEUE));
+ return (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($configEntry) <= $this->getOutgoingQueueInstance()->getStackCount(self::STACKER_NAME_OUT_QUEUE));
}
/**
* @return $isReached Whether the limit is reached
*/
protected function isIncomingQueueLimitReached($configEntry) {
- return ($this->getConfigInstance()->getConfigEntry($configEntry) <= $this->getIncomingQueueInstance()->getStackCount(self::STACKER_NAME_IN_QUEUE));
+ return (FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($configEntry) <= $this->getIncomingQueueInstance()->getStackCount(self::STACKER_NAME_IN_QUEUE));
}
}
use Org\Shipsimu\Hub\Tools\HubTools;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Lists\Listable;
/**
$recipients = explode(NetworkPackageHandler::PACKAGE_RECIPIENT_SEPARATOR, $recipientUnl);
// Is maximum reached?
- assert(count($recipients) <= $this->getConfigInstance()->getConfigEntry('package_recipient_max_count'));
+ assert(count($recipients) <= FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('package_recipient_max_count'));
// Try it on all
foreach ($recipients as $recipient) {
use Org\Shipsimu\Hub\Network\Recipient\Recipient;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Lists\Listable;
/**
assert($recipientUnl == NetworkPackageHandler::RECIPIENT_TYPE_UPPER);
// Get all bootstrap nodes
- foreach (explode(BaseHubSystem::BOOTSTRAP_NODES_SEPARATOR, $this->getConfigInstance()->getConfigEntry('hub_bootstrap_nodes')) as $unlData) {
+ foreach (explode(BaseHubSystem::BOOTSTRAP_NODES_SEPARATOR, FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('hub_bootstrap_nodes')) as $unlData) {
// Is maximum reached?
- if ($listInstance->count() == $this->getConfigInstance()->getConfigEntry('package_recipient_max_count')) {
+ if ($listInstance->count() == FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('package_recipient_max_count')) {
// Then stop adding more
- /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UPPER-RECIPIENT: Going to abort at maximum of ' . $this->getConfigInstance()->getConfigEntry('package_recipient_max_count') . ' recipients!');
+ /* DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('UPPER-RECIPIENT: Going to abort at maximum of ' . FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('package_recipient_max_count') . ' recipients!');
break;
} // END - if
use Org\Mxchange\Hub\Resolver\Protocol\BaseProtocolResolver;
use Org\Mxchange\Hub\Resolver\Protocol\ProtocolResolver;
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+
/**
* A !!! protocol resolver class
*
// Put all together
$unl = sprintf('%s://%s',
$this->getProtocolName(),
- $this->getConfigInstance()->getConfigEntry($configKey . '_address')
+ FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($configKey . '_address')
);
/*
*/
return $unl;
}
-}
-// [EOF]
-?>
+}
use Org\Shipsimu\Hub\Resolver\Protocol\ProtocolResolver;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Console\Tools\ConsoleTools;
use Org\Mxchange\CoreFramework\Criteria\Search\SearchCriteria;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
*/
public function resolveUniversalNodeLocatorFromConfigKey ($configKey) {
// Get address
- $address = $this->getConfigInstance()->getConfigEntry($configKey . '_address');
+ $address = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($configKey . '_address');
// Is the address empty?
if (empty($address)) {
$unl = sprintf('%s://%s:%s',
$this->getProtocolName(),
$address,
- $this->getConfigInstance()->getConfigEntry('node_listen_port')
+ FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('node_listen_port')
);
/*
use Org\Shipsimu\Hub\Crawler\Source\BaseSource;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Registry\Registerable;
*/
public function generateMessageFromSource () {
// Get a very secret message by encoding and random string with BASE64
- $secretMessage = base64_encode($this->getRngInstance()->randomString($this->getConfigInstance()->getConfigEntry('random_secret_message_length')));
+ $secretMessage = base64_encode($this->getRngInstance()->randomString(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('random_secret_message_length')));
// Get a random, secret key
- $secretKey = $this->getRngInstance()->randomString($this->getConfigInstance()->getConfigEntry('test_unit_random_secret_key_length') / 8);
+ $secretKey = $this->getRngInstance()->randomString(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('test_unit_random_secret_key_length') / 8);
// Now encrypt the message with our key and a good (strong) cipher
$encryptedMessage = base64_encode($this->getCryptoInstance()->encryptString($secretMessage, $secretKey));
use Org\Shipsimu\Hub\Crawler\Source\Url\UrlSource;
// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Generic\NullPointerException;
use Org\Mxchange\CoreFramework\Registry\Registerable;
parent::__construct(__CLASS__);
// "Cache" CSV path for faster usage
- $this->csvFilePath = $this->getConfigInstance()->getConfigEntry('root_base_path') . $this->getConfigInstance()->getConfigEntry('crawler_csv_file_path');
+ $this->csvFilePath = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('root_base_path') . FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('crawler_csv_file_path');
// Initialize directory instance
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('CRAWLER-UPLOADED-LIST-URL-SOURCE: this->csvFilePath=%s', $this->csvFilePath));
}
// "Cache" column separator
- $this->columnSeparator = $this->getConfigInstance()->getConfigEntry('crawler_url_list_column_separator');
+ $this->columnSeparator = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('crawler_url_list_column_separator');
// Trace message
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CRAWLER-UPLOADED-LIST-URL-SOURCE: Finished contructing object.');
use Org\Shipsimu\Hub\Generic\BaseHubSystem;
use Org\Shipsimu\Hub\Helper\Connection\ConnectionHelper;
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
+
/**
* A helper class for maintaining connection statistics, no instance is
* required to use this class.
(
isset(self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['retry_count'])
) && (
- self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['retry_count'] >= $helperInstance->getConfigInstance()->getConfigEntry($configEntry)
+ self::$connectionStatistics[$helperInstance->getProtocolName()][$helperInstance->__toString()]['retry_count'] >= FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($configEntry)
)
);
$applicationInstance = GenericRegistry::getRegistry()->getInstance('application');
// Determine base path
- $templateBasePath = $this->getConfigInstance()->getConfigEntry('application_base_path') . FrameworkBootstrap::getRequestInstance()->getRequestElement('app') . '/';
+ $templateBasePath = FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('application_base_path') . FrameworkBootstrap::getRequestInstance()->getRequestElement('app') . '/';
// Is the base path valid?
if (empty($templateBasePath)) {
$this->setTemplateBasePath($templateBasePath);
// Set template extensions
- $this->setRawTemplateExtension($this->getConfigInstance()->getConfigEntry('raw_template_extension'));
- $this->setCodeTemplateExtension($this->getConfigInstance()->getConfigEntry($typePrefix . '_message_template_extension'));
+ $this->setRawTemplateExtension(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('raw_template_extension'));
+ $this->setCodeTemplateExtension(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($typePrefix . '_message_template_extension'));
// Absolute output path for compiled templates
$this->setCompileOutputPath(sprintf('%s%s',
$templateBasePath,
- $this->getConfigInstance()->getConfigEntry('compile_output_path')
+ FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('compile_output_path')
));
// Init a variable stacker
} // END - if
// Set template type
- $this->setTemplateType($this->getConfigInstance()->getConfigEntry($templateName));
+ $this->setTemplateType(FrameworkBootstrap::getConfigurationInstance()->getConfigEntry($templateName));
// Load the special template
$this->loadTemplate($this->xmlTemplateType);
parent::__construct(__CLASS__);
// Init salt length
- $this->sessionIdLength = 32 + $this->getConfigInstance()->getConfigEntry('salt_length');
+ $this->sessionIdLength = 32 + FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('salt_length');
}
/**
// Is the session id the same?
if ($nodeInstance->getSessionId() == $sessionId) {
// Then get an instance of a LocateableNode class from it, assume TCP by default
- $recipientUnl = self::determineOwnExternalAddress() . ':' . $nodeInstance->getConfigInstance()->getConfigEntry('node_listen_port');
+ $recipientUnl = self::determineOwnExternalAddress() . ':' . FrameworkBootstrap::getConfigurationInstance()->getConfigEntry('node_listen_port');
} // END - if
}
-Subproject commit c1aadb61b45c15273c07c366887c8f58c53155e3
+Subproject commit 9128348f96854b318a9bf8884b1ee035f3f94e6c