// Import framework stuff
use Org\Mxchange\CoreFramework\Bootstrap\FrameworkBootstrap;
-use Org\Mxchange\CoreFramework\Compressor\Compressor;
-use Org\Mxchange\CoreFramework\Connection\Database\DatabaseConnection;
use Org\Mxchange\CoreFramework\Criteria\Criteria;
use Org\Mxchange\CoreFramework\Criteria\Local\LocalSearchCriteria;
use Org\Mxchange\CoreFramework\Criteria\Local\LocalUpdateCriteria;
use Org\Mxchange\CoreFramework\Localization\ManageableLanguage;
use Org\Mxchange\CoreFramework\Manager\ManageableApplication;
use Org\Mxchange\CoreFramework\Menu\RenderableMenu;
-use Org\Mxchange\CoreFramework\Middleware\Compressor\CompressorChannel;
use Org\Mxchange\CoreFramework\Middleware\Debug\DebugMiddleware;
use Org\Mxchange\CoreFramework\Parser\Parseable;
use Org\Mxchange\CoreFramework\Registry\GenericRegistry;
*/
private $stackInstance = NULL;
- /**
- * A Compressor instance
- */
- private $compressorInstance = NULL;
-
/**
* A Parseable instance
*/
private $parserInstance = NULL;
- /**
- * A database wrapper instance
- */
- private $databaseInstance = NULL;
-
/**
* A helper instance for the form
*/
return $webOutputInstance;
}
- /**
- * Setter for database instance
- *
- * @param $databaseInstance The instance for the database connection (forced DatabaseConnection)
- * @return void
- */
- public final function setDatabaseInstance (DatabaseConnection $databaseInstance) {
- GenericRegistry::getRegistry()->addInstance('db_instance', $databaseInstance);
- }
-
- /**
- * Getter for database layer
- *
- * @return $databaseInstance The database layer instance
- */
- public final function getDatabaseInstance () {
- // Get instance
- $databaseInstance = GenericRegistry::getRegistry()->getInstance('db_instance');
-
- // Return instance
- return $databaseInstance;
- }
-
- /**
- * Setter for compressor channel
- *
- * @param $compressorInstance An instance of CompressorChannel
- * @return void
- */
- public final function setCompressorChannel (CompressorChannel $compressorInstance) {
- GenericRegistry::getRegistry()->addInstance('compressor', $compressorInstance);
- }
-
- /**
- * Getter for compressor channel
- *
- * @return $compressorInstance The compressor channel
- */
- public final function getCompressorChannel () {
- $compressorInstance = GenericRegistry::getRegistry()->getInstance('compressor');
- return $compressorInstance;
- }
-
/**
* Private getter for language instance
*
return $this->stackInstance;
}
- /**
- * Setter for compressor instance
- *
- * @param $compressorInstance An instance of an compressor
- * @return void
- */
- public final function setCompressorInstance (Compressor $compressorInstance) {
- $this->compressorInstance = $compressorInstance;
- }
-
- /**
- * Getter for compressor instance
- *
- * @return $compressorInstance An instance of an compressor
- */
- public final function getCompressorInstance () {
- return $this->compressorInstance;
- }
-
/**
* Setter for Parseable instance
*
use Org\Mxchange\CoreFramework\Filesystem\FileNotFoundException;
use Org\Mxchange\CoreFramework\Generic\FrameworkException;
use Org\Mxchange\CoreFramework\Handler\Stream\IoHandler;
+use Org\Mxchange\CoreFramework\Middleware\Compressor\CompressorChannel;
// Import SPL stuff
use \SplFileInfo;
*/
private $fileIoInstance = NULL;
+ /**
+ * A Compressor instance
+ */
+ private $compressorChannelInstance = NULL;
+
/**
* The protected constructor. Do never instance from outside! You need to
* set a local file path. The class will then validate it.
$databaseInstance = new CachedLocalFileDatabase();
// Get a new compressor channel instance
- $compressorInstance = ObjectFactory::createObjectByConfiguredName('compressor_channel_class');
+ $compressorChannelInstance = ObjectFactory::createObjectByConfiguredName('compressor_channel_class');
// Set the compressor channel
- $databaseInstance->setCompressorChannel($compressorInstance);
+ $databaseInstance->setCompressorChannelInstance($compressorChannelInstance);
// Get a file IO handler
$fileIoInstance = ObjectFactory::createObjectByConfiguredName('file_io_class');
$this->fileIoInstance = $fileIoInstance;
}
+ /**
+ * Setter for compressor channel
+ *
+ * @param $compressorChannelInstance An instance of a CompressorChannel class
+ * @return void
+ */
+ protected final function setCompressorChannelInstance (CompressorChannel $compressorChannelInstance) {
+ $this->compressorChannelInstance = $compressorChannelInstance;
+ }
+
+ /**
+ * Getter for compressor channel
+ *
+ * @return $compressorChannelInstance An instance of a CompressorChannel class
+ */
+ protected final function getCompressorChannelInstance () {
+ return $this->compressorChannelInstance;
+ }
+
/**
* Reads a local data file and returns it's contents in an array
*
$compressedData = $compressedData['data'];
// Decompress it
- $serializedData = $this->getCompressorChannel()->getCompressor()->decompressStream($compressedData);
+ $serializedData = $this->getCompressorChannelInstance()->getCompressor()->decompressStream($compressedData);
// Unserialize it
$dataArray = json_decode($serializedData, true);
// Serialize and compress it
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CACHED-LFDB: Flushing ' . count($dataArray) . ' elements to database file ' . $infoInstance . ' ...');
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CACHED-LFDB: dataArray=' . print_r($dataArray, true));
- $compressedData = $this->getCompressorChannel()->getCompressor()->compressStream(json_encode($dataArray));
+ $compressedData = $this->getCompressorChannelInstance()->getCompressor()->compressStream(json_encode($dataArray));
// Write this data BASE64 encoded to the file
//* NOISY-DEBUG: */ self::createDebugInstance(__CLASS__, __LINE__)->debugOutput('CACHED-LFDB: Writing ' . strlen($compressedData) . ' bytes ...');