$this->setLanguageInstance($languageInstance);
} // END - if
- // Get a controller resolver
- $resolverClass = sprintf(
- 'Org\Shipsimu\Hub\Resolver\Controller\%s',
- StringUtils::convertToClassName(sprintf(
- '%s_%s_controller_resolver',
- $this->getAppShortName(),
- FrameworkBootstrap::getRequestTypeFromSystem()
- ))
+ // Configuration entry key
+ $configEntry = sprintf(
+ '%s_%s_controller_resolver_class',
+ $this->getAppShortName(),
+ FrameworkBootstrap::getRequestTypeFromSystem()
);
- $resolverInstance = ObjectFactory::createObjectByName($resolverClass, array($commandName, $this));
+
+ // Get a controller resolver instance
+ $resolverInstance = ObjectFactory::createObjectByConfiguredName($configEntry, [
+ $commandName,
+ ]);
// Get a controller instance as well
$this->setControllerInstance($resolverInstance->resolveController());
// This is the last generic shutdown filter
$controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('apt_proxy_shutdown_filter_class'));
}
-}
-// [EOF]
-?>
+}
// This is the last generic shutdown filter
$controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('chat_shutdown_filter_class'));
}
-}
-// [EOF]
-?>
+}
// This is the last generic shutdown filter
$controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('crawler_shutdown_filter_class'));
}
-}
-// [EOF]
-?>
+}
// This is the last generic shutdown filter
$controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('cruncher_shutdown_filter_class'));
}
-}
-// [EOF]
-?>
+}
// This is the last generic shutdown filter
$controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('node_shutdown_node_filter_class'));
}
-}
-// [EOF]
-?>
+}
// This is the last generic shutdown filter
$controllerInstance->addShutdownFilter(ObjectFactory::createObjectByConfiguredName('miner_shutdown_filter_class'));
}
-}
-// [EOF]
-?>
+}
/**
* An array with all valid connection types
*/
- private $connectionTypes = array();
+ private $connectionTypes = [];
/**
* Timeout in usec for socket_select()
// Init all arrays, at least readers
/* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: this->socketResource=%s', strtoupper($this->getSocketProtocol()), $this->getSocketResource()));
- $readers = array($this->getSocketResource());
- $writers = array();
- $excepts = array();
+ $readers = [$this->getSocketResource()];
+ $writers = [];
+ $excepts = [];
// Check if we have some peers left
/* EXTREME-NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('%s-SOCKET: Calling socket_select(%d,%d,%d,0%d) ...', strtoupper($this->getSocketProtocol()), count($readers), count($writers), count($excepts), $this->socketSelectTimeout));
}
// Default is empty data array
- $nodeData = array();
+ $nodeData = [];
/*
* Call the wrapper to do the job and get back a result instance. There
// Default is empty data array
/* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('NODE-DHT-FACADE: locatorInstance=%s - CALLED!', $locatorInstance->__toString()));
//* DEBUG-DIE: */ die(sprintf('[%s:%d]: locatorInstance=%s', __METHOD__, __LINE__, print_r($locatorInstance, TRUE)));
- $nodeData = array();
+ $nodeData = [];
// Query database
$resultInstance = $this->getWrapperInstance()->findNodeLocalByLocatorInstance($locatorInstance);
assert($resultInstance->valid());
// Init array
- $nodeList = array();
+ $nodeList = [];
// Get node list
while ($resultInstance->next()) {
} // END - if
// Init array
- $recipients = array();
+ $recipients = [];
// Search for all recipients
while ($resultInstance->next()) {
assert($resultInstance->valid());
// Init array
- $recipients = array();
+ $recipients = [];
// "Walk" through all entries
while ($resultInstance->next()) {
/**
* Array with all valid types
*/
- private static $validTypes = array();
+ private static $validTypes = [];
/**
* Protected constructor
/**
* Array with all data XML nodes (which hold the actual data) and their values
*/
- protected $dataXmlNodes = array();
+ protected $dataXmlNodes = [];
/**
* Protected constructor
/**
* The final array for assembling the original package back together
*/
- private $finalPackageChunks = array();
+ private $finalPackageChunks = [];
/**
* Array of chunk hashes
*/
- private $chunkHashes = array();
+ private $chunkHashes = [];
/**
* Raw EOP chunk data in an array:
* 0 = Final hash,
* 1 = Hash of last chunk
*/
- private $eopChunk = array();
+ private $eopChunk = [];
/**
* An instance of raw package data
);
// ... chunkHashes:
- $this->chunkHashes = array();
+ $this->chunkHashes = [];
// ... eopChunk:
$this->eopChunk = array(
/**
* Array with search criteria elements
*/
- protected $searchData = array();
+ protected $searchData = [];
/**
* Array with all data XML nodes (which hold the actual data) and their values
*/
- protected $messageDataElements = array();
+ protected $messageDataElements = [];
/**
* Array for translating message data elements (other node's data mostly)
* into configuration elements.
*/
- protected $messageToConfig = array();
+ protected $messageToConfig = [];
/**
* Array for copying configuration entries
*/
- protected $configCopy = array();
+ protected $configCopy = [];
/**
* Protected constructor
// Import application-specific stuff
use Org\Shipsimu\Hub\Generic\BaseHubSystem;
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+
/**
* A general hub helper class. This class does not extend BaseHelper.
*
/**
* Package tags
*/
- private $packageTags = array();
+ private $packageTags = [];
+
+ /**
+ * Template engine instance
+ */
+ private $templateInstance = NULL;
/**
* Protected constructor
$this->packageTags = $packageTags;
}
+ /**
+ * Setter for template engine instances
+ *
+ * @param $templateInstance An instance of a template engine class
+ * @return void
+ */
+ protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
+ $this->templateInstance = $templateInstance;
+ }
+
+ /**
+ * Getter for template engine instances
+ *
+ * @return $templateInstance An instance of a template engine class
+ */
+ public final function getTemplateInstance () {
+ return $this->templateInstance;
+ }
+
/**
* Tries to determine the used protocol for this package (this helper is helping to send out)
*
/**
* Currently queued chunks
*/
- private $queuedChunks = array();
+ private $queuedChunks = [];
/**
* Current final hash
/**
* UNL data array
*/
- private $unlData = array();
+ private $unlData = [];
/**
* Protected constructor
*/
private function initUniversalNodeLocator (array $unlData = array()) {
// Init UNL array
- $this->unlData = array();
+ $this->unlData = [];
// Copy all found entries
foreach (array(
/**
* An array for initialized producers
*/
- private $producersInitialized = array();
+ private $producersInitialized = [];
/**
* Stacker name for incoming queue
/**
* Private call-back methods
*/
- private $callbacks = array();
+ private $callbacks = [];
/**
* A network package handler instance
$properties = $reflectionInstance->getProperties(ReflectionProperty::IS_PRIVATE);
// Init array
- $packageData = array();
+ $packageData = [];
// Loop through all
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput(sprintf('PACKAGE-DATA: properties()=%d', count($properties)));
/**
* Array for chunks
*/
- private $chunks = array();
+ private $chunks = [];
/**
* Array for chunk hashes
*/
- private $chunkHashes = array();
+ private $chunkHashes = [];
/**
* Array for chunk pointers
*/
- private $chunkPointers = array();
+ private $chunkPointers = [];
/**
* Array for processed packages
*/
- private $processedPackages = array();
+ private $processedPackages = [];
/**
* Serial numbers (array key is final hash)
*/
- private $serialNumber = array();
+ private $serialNumber = [];
/**
* Maximum possible serial number, "cache" for speeding up things
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('PACKAGE-FRAGMENTER: CALLED!');
$fragmenterInstance = new PackageFragmenter();
- // Get a crypto instance and set it here
+ // Get a crypto instance
$cryptoInstance = ObjectFactory::createObjectByConfiguredName('crypto_class');
+
+ // Set it here
$fragmenterInstance->setCryptoInstance($cryptoInstance);
// Return the prepared instance
// Is the array there?
if (!isset($this->chunks[$finalHash])) {
// Then initialize it
- $this->chunks[$finalHash] = array();
- $this->chunkHashes[$finalHash] = array();
+ $this->chunks[$finalHash] = [];
+ $this->chunkHashes[$finalHash] = [];
} // END - if
// Add both
$socketArrays = $this->getArrayFromList('pool');
// Init socket array
- $sockets = array();
+ $sockets = [];
// "Walk" through all socket arrays
foreach ($socketArrays as $socketArray) {
$socketArrays = $this->getArrayFromList('pool');
// Init socket array
- $sockets = array();
+ $sockets = [];
// "Walk" through all socket arrays
foreach ($socketArrays as $socketArray) {
// Import application-specific stuff
use Org\Shipsimu\Hub\Producer\Cruncher\BaseCruncherProducer;
+// Import framework stuff
+use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
+
/**
* A general UnitProducer class
*
const UNIT_TYPE_TEST_UNIT = 'test_unit';
const UNIT_TYPE_TEST_WORK = 'work_unit';
+ /**
+ * Template engine instance
+ */
+ private $templateInstance = NULL;
+
/**
* Protected constructor
*
parent::__construct($className);
}
+ /**
+ * Setter for template engine instances
+ *
+ * @param $templateInstance An instance of a template engine class
+ * @return void
+ */
+ protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
+ $this->templateInstance = $templateInstance;
+ }
+
+ /**
+ * Getter for template engine instances
+ *
+ * @return $templateInstance An instance of a template engine class
+ */
+ protected final function getTemplateInstance () {
+ return $this->templateInstance;
+ }
+
}
// Import framework stuff
use Org\Mxchange\CoreFramework\Controller\Controller;
-use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
use Org\Mxchange\CoreFramework\Resolver\Controller\BaseControllerResolver;
use Org\Mxchange\CoreFramework\Resolver\Controller\ControllerResolver;
* Creates an instance of a resolver class with a given command
*
* @param $controllerName The controller we shall resolve
- * @param $applicationInstance An instance of a manageable application helper class
* @return $resolverInstance The prepared controller resolver instance
* @throws EmptyVariableException Thrown if default command is not set
* @throws InvalidControllerException Thrown if default controller is invalid
*/
- public static final function createHubConsoleControllerResolver ($controllerName, ManageableApplication $applicationInstance) {
+ public static final function createHubConsoleControllerResolver ($controllerName) {
// Create the new instance
$resolverInstance = new HubConsoleControllerResolver();
// Import framework stuff
use Org\Mxchange\CoreFramework\Controller\Controller;
-use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
use Org\Mxchange\CoreFramework\Resolver\Controller\BaseControllerResolver;
use Org\Mxchange\CoreFramework\Resolver\Controller\ControllerResolver;
* Creates an instance of a resolver class with a given command
*
* @param $controllerName The controller we shall resolve
- * @param $applicationInstance An instance of a manageable application helper class
* @return $resolverInstance The prepared controller resolver instance
* @throws EmptyVariableException Thrown if default command is not set
* @throws InvalidControllerException Thrown if default controller is invalid
*/
- public static final function createHubHtmlControllerResolver ($controllerName, ManageableApplication $applicationInstance) {
+ public static final function createHubHtmlControllerResolver ($controllerName) {
// Create the new instance
$resolverInstance = new HubHtmlControllerResolver();
/**
* "Imported" CSV files
*/
- private $csvFileImported = array();
+ private $csvFileImported = [];
/**
* "Cached" separator for columns
/**
* Array of booted producers
*/
- private $bootedProducer = array();
+ private $bootedProducer = [];
/**
* Protected constructor
// Import framework stuff
use Org\Mxchange\CoreFramework\Registry\Registerable;
+use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
/**
* A general Tags class
/**
* An array with all tags
*/
- private $tags = array();
+ private $tags = [];
+
+ /**
+ * Template engine instance
+ */
+ private $templateInstance = NULL;
/**
* Protected constructor
return $this->tags;
}
+ /**
+ * Setter for template engine instances
+ *
+ * @param $templateInstance An instance of a template engine class
+ * @return void
+ */
+ protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
+ $this->templateInstance = $templateInstance;
+ }
+
+ /**
+ * Getter for template engine instances
+ *
+ * @return $templateInstance An instance of a template engine class
+ */
+ protected final function getTemplateInstance () {
+ return $this->templateInstance;
+ }
+
}
use Org\Mxchange\CoreFramework\Factory\ObjectFactory;
use Org\Mxchange\CoreFramework\Factory\Template\XmlTemplateEngineFactory;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
+use Org\Mxchange\CoreFramework\Template\CompileableTemplate;
use Org\Mxchange\CoreFramework\Template\Engine\BaseTemplateEngine;
use Org\Mxchange\CoreFramework\Utils\String\StringUtils;
/**
* Main nodes in the XML tree
*/
- private $mainNodes = array();
+ private $mainNodes = [];
/**
* Sub nodes in the XML tree
*/
- private $subNodes = array();
+ private $subNodes = [];
/**
* Current main node
*/
- private $curr = array();
+ private $curr = [];
/**
* XML template type
/**
* Content from dependency
*/
- protected $dependencyContent = array();
+ protected $dependencyContent = [];
+
+ /**
+ * Template engine instance
+ */
+ private $templateInstance = NULL;
/**
* Protected constructor
return $this->subNodes;
}
+ /**
+ * Setter for template engine instances
+ *
+ * @param $templateInstance An instance of a template engine class
+ * @return void
+ */
+ protected final function setTemplateInstance (CompileableTemplate $templateInstance) {
+ $this->templateInstance = $templateInstance;
+ }
+
+ /**
+ * Getter for template engine instances
+ *
+ * @return $templateInstance An instance of a template engine class
+ */
+ protected final function getTemplateInstance () {
+ return $this->templateInstance;
+ }
+
/**
* Read XML variables by calling readVariable() with 'general' as
* variable stack.
/**
* Cache for session ids
*/
- private $sessionIdCache = array();
+ private $sessionIdCache = [];
/**
* Length for session id (should be 32+salt_length
// CFG: DEFAULT-HUB-CONSOLE-COMMAND
$cfg->setConfigEntry('default_hub_console_command', 'main');
+// CFG: HUB-CONSOLE-CONTROLLER_RESOLVER-CLASS
+$cfg->setConfigEntry('hub_console_controller_resolver_class', 'Org\Shipsimu\Hub\Resolver\Controller\HubConsoleControllerResolver');
+
+// CFG: HUB-HTML-CONTROLLER_RESOLVER-CLASS
+$cfg->setConfigEntry('hub_html_controller_resolver_class', 'Org\Shipsimu\Hub\Resolver\Controller\HubHtmlControllerResolver');
+
// CFG: HUB-CONSOLE-CMD-MAIN-RESOLVER-CLASS
$cfg->setConfigEntry('hub_console_cmd_main_resolver_class', 'Org\Shipsimu\Hub\Resolver\Command\HubConsoleCommandResolver');
-Subproject commit 690d7f053ed4420a1aff4387be75d8ae75155bdf
+Subproject commit df3701b7230349ee2bc711caba98809ac943363c