From 9e29c40258d287d2fe93aa8ef0e1ea814399419f Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= Date: Fri, 20 Jun 2008 16:21:53 +0000 Subject: [PATCH] A lot more old methods deprecated and already deprecated methods removed --- .../personell/class_SimulatorPersonell.php | 19 ---- .../company/class_CompanyEmployee.php | 14 --- .../ships/passenger/class_PassengerShip.php | 16 +-- .../class_DatabaseFrontendInterface.php | 12 -- .../extended/class_LimitableObject.php | 1 + .../database/class_BaseDatabaseFrontend.php | 30 +---- .../databases/class_LocalFileDatabase.php | 107 ++---------------- 7 files changed, 10 insertions(+), 189 deletions(-) diff --git a/application/ship-simu/main/personell/class_SimulatorPersonell.php b/application/ship-simu/main/personell/class_SimulatorPersonell.php index 2aabd8b..f0b33b8 100644 --- a/application/ship-simu/main/personell/class_SimulatorPersonell.php +++ b/application/ship-simu/main/personell/class_SimulatorPersonell.php @@ -386,25 +386,6 @@ class SimulatorPersonell extends BasePersonell { return $surname; } - /** - * Saves only the personell list to the database - * - * @return void - */ - public function saveObjectToDatabase () { - // Get the database - $dbInstance = $this->getDatabaseInstance(); - - // Prepare the limitation object. We just need the personellList array object. - $limitInstance = ObjectLimits::createObjectLimits(array("personellList")); - - // Limitate the saving amount - $dbInstance->limitObject($limitInstance); - - // Save this object - $dbInstance->saveObject($this); - } - /** * Getter for personell list * diff --git a/application/ship-simu/main/personell/company/class_CompanyEmployee.php b/application/ship-simu/main/personell/company/class_CompanyEmployee.php index 4677218..06fcd7c 100644 --- a/application/ship-simu/main/personell/company/class_CompanyEmployee.php +++ b/application/ship-simu/main/personell/company/class_CompanyEmployee.php @@ -94,20 +94,6 @@ class CompanyEmployee extends SimulatorPersonell { } unset($this->employeeList); } - - /** - * Call parent method - */ - public function saveObjectToDatabase () { - parent::saveObjectToDatabase(); - } - - /** - * Limits this object with an ObjectLimits instance - */ - public function limitObject (ObjectLimits $limitInstance) { - parent::limitObject($limitInstance); - } } // [EOF] diff --git a/application/ship-simu/main/ships/passenger/class_PassengerShip.php b/application/ship-simu/main/ships/passenger/class_PassengerShip.php index cbe0a22..f2ac31a 100644 --- a/application/ship-simu/main/ships/passenger/class_PassengerShip.php +++ b/application/ship-simu/main/ships/passenger/class_PassengerShip.php @@ -22,7 +22,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -class PassengerShip extends BaseShip implements ConstructableShip, LimitableObject { +class PassengerShip extends BaseShip implements ConstructableShip { // Konstruktor protected function __construct () { // Eltern-Kontruktor aufrufen @@ -121,20 +121,6 @@ class PassengerShip extends BaseShip implements ConstructableShip, LimitableObje // Anzahl zurueckliefern return $numBeds; } - - /** - * Reduces the volume of a processed object. - * - * @param $limitInstance An instance to ObjectLimits which holds - * attribute names that we want to include in the processing phase. - * Other attributes except $uniqueID and $realClass will be ignored - * and keept out. - * @return void - */ - function limitObject (ObjectLimits $limitInstance) { - // Work in progress - $this->partialStub("Unfinished method called."); - } } // [EOF] diff --git a/inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php b/inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php index 81ca81d..78f30ff 100644 --- a/inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php +++ b/inc/classes/interfaces/database/frontend/class_DatabaseFrontendInterface.php @@ -26,18 +26,6 @@ * along with this program. If not, see . */ interface DatabaseFrontendInterface extends FrameworkDatabaseInterface { - /** - * Loads data saved with saveObject from the database and re-creates a - * full object from it. - * If limitObject() was called before a new object ObjectContainer with - * all requested attributes will be returned instead. - * - * @return Object The fully re-created object or instance to - * ObjectContainer - * @deprecated - */ - function loadObject (); - /** * Makes sure that the database connection is up and alive * diff --git a/inc/classes/interfaces/extended/class_LimitableObject.php b/inc/classes/interfaces/extended/class_LimitableObject.php index d4eea0f..9c03202 100644 --- a/inc/classes/interfaces/extended/class_LimitableObject.php +++ b/inc/classes/interfaces/extended/class_LimitableObject.php @@ -8,6 +8,7 @@ * @copyright Copyright(c) 2007, 2008 Roland Haeder, this is free software * @license GNU GPL 3.0 or any newer version * @link http://www.ship-simu.org + * @deprecated * * 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 diff --git a/inc/classes/main/database/class_BaseDatabaseFrontend.php b/inc/classes/main/database/class_BaseDatabaseFrontend.php index 2d2e04b..56041e6 100644 --- a/inc/classes/main/database/class_BaseDatabaseFrontend.php +++ b/inc/classes/main/database/class_BaseDatabaseFrontend.php @@ -22,7 +22,7 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ -abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implements DatabaseFrontendInterface, LimitableObject { +abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implements DatabaseFrontendInterface { // Constants for exceptions const EXCEPTION_SQL_QUERY = 0x050; @@ -43,34 +43,6 @@ abstract class BaseDatabaseFrontend extends BaseFrameworkSystem implements Datab // Clean up a little $this->removeNumberFormaters(); } - - /** - * Getter for limitation instance - * - * @return $limitInstance The instance to the object ObjectLimits - */ - public final function getLimitInstance () { - return $this->limitInstance; - } - - /** - * Setup limitation for the saving process - * - * @param $limitInstance An instance of ObjectLimits which contains - * elements we shall exclusivly include in - * saving process - * @return void - */ - public final function limitObject (ObjectLimits $limitInstance) { - // Get limitArray for validation - $array = $limitInstance->getLimitArray(); - - // Sanity-check if some limitations are in the object - if ($array->count() > 0) { - // Okay, there is enougth - $this->limitInstance = $limitInstance; - } - } } // [EOF] diff --git a/inc/classes/main/database/databases/class_LocalFileDatabase.php b/inc/classes/main/database/databases/class_LocalFileDatabase.php index 27ba98e..417c861 100644 --- a/inc/classes/main/database/databases/class_LocalFileDatabase.php +++ b/inc/classes/main/database/databases/class_LocalFileDatabase.php @@ -150,60 +150,6 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend return $this->lastException; } - /** - * Saves a given object to the local file system by serializing and - * transparently compressing it - * - * @param $object The object we shall save to the local file system - * @return void - * @deprecated - */ - public final function saveObject (FrameworkInterface $object) { - // Get a string containing the serialized object. We cannot exchange - // $this and $object here because $object does not need to worry - // about it's limitations... ;-) - $serialized = $this->serializeObject($object); - - // Get a path name plus file name and append the extension - $fqfn = $this->getSavePath() . $object->getPathFileNameFromObject() . "." . $this->getFileExtension(); - - // Save the file to disc we don't care here if the path is there, - // this must be done in later methods. - $this->getFileIoInstance()->saveFile($fqfn, array($this->getCompressorChannel()->getCompressorExtension(), $serialized)); - } - - /** - * Get a serialized string from the given object - * - * @param $object The object we want to serialize and transparently - * compress - * @return $serialized A string containing the serialzed/compressed object - * @see ObjectLimits An object holding limition information - * @see SerializationContainer A special container class for e.g. - * attributes from limited objects - * @deprecated - */ - private function serializeObject (FrameworkInterface $object) { - // If there is no limiter instance we serialize the whole object - // otherwise only in the limiter object (ObjectLimits) specified - // attributes summarized in a special container class - if ($this->getLimitInstance() === null) { - // Serialize the whole object. This tribble call is the reason - // why we need a fall-back implementation in CompressorChannel - // of the methods compressStream() and decompressStream(). - $serialized = $this->getCompressorChannel()->getCompressor()->compressStream(serialize($object)); - } else { - // Serialize only given attributes in a special container - $container = SerializationContainer::createSerializationContainer($this->getLimitInstance(), $object); - - // Serialize the container - $serialized = $this->getCompressorChannel()->getCompressor()->compressStream(serialize($container)); - } - - // Return the serialized object string - return $serialized; - } - /** * Analyses if a unique ID has already been used or not by search in the * local database folder. @@ -371,6 +317,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend * is not an object instance * @throws MissingMethodException If the required method * toString() is missing + * @deprecated */ public final function getObjectFromCachedData ($uniqueID) { // Get instance for file handler @@ -416,13 +363,14 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend /** * Private method for re-gathering (repairing) the FQFN * - * @param $fqfn The current FQFN we shall validate - * @param $uniqueID The unique ID number + * @param $fqfn The current FQFN we shall validate + * @param $uniqueID The unique ID number * @return $fqfn The repaired FQFN when it is empty * @throws NoArrayCreatedException If explode() has not - * created an array + * created an array * @throws InvalidArrayCountException If the array count is not - * as the expected + * as the expected + * @deprecated */ private function repairFQFN ($fqfn, $uniqueID) { // Cast both strings @@ -461,6 +409,7 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend * @param $contents The (maybe) already cached contents as an array * @param $fqfn The current FQFN we shall validate * @return $contents The repaired contents from the given file + * @deprecated */ private function repairContents ($contents, $fqfn) { // Is there some content and header (2 indexes) in? @@ -533,48 +482,6 @@ class LocalFileDatabase extends BaseDatabaseFrontend implements DatabaseFrontend /* @TODO Do some checks on the database directory and files here */ } - /** - * Loads data saved with saveObject from the database and re-creates a - * full object from it. - * If limitObject() was called before a new object ObjectContainer with - * all requested attributes will be returned instead. - * - * @return Object The fully re-created object or instance to - * ObjectContainer - * @throws SavePathIsEmptyException If the given save path is an - * empty string - * @throws SavePathIsNoDirectoryException If the save path is no - * path (e.g. a file) - * @throws SavePathReadProtectedException If the save path is read- - * protected - * @throws SavePathWriteProtectedException If the save path is write- - * protected - */ - public function loadObject () { - // Already connected? Then abort here - if ($this->alreadyConnected === true) return true; - - // Get the save path - $savePath = $this->getSavePath(); - - if (empty($savePath)) { - // Empty string - throw new SavePathIsEmptyException($dbInstance, self::EXCEPTION_UNEXPECTED_EMPTY_STRING); - } elseif (!is_dir($savePath)) { - // Is not a dir - throw new SavePathIsNoDirectoryException($savePath, self::EXCEPTION_INVALID_PATH_NAME); - } elseif (!is_readable($savePath)) { - // Path not readable - throw new SavePathReadProtectedException($savePath, self::EXCEPTION_READ_PROTECED_PATH); - } elseif (!is_writeable($savePath)) { - // Path not writeable - throw new SavePathWriteProtectedException($savePath, self::EXCEPTION_WRITE_PROTECED_PATH); - } - - // "Connection" established... ;-) - $this->alreadyConnected = true; - } - /** * Starts a SELECT query on the database by given return type, table name * and search criteria -- 2.39.5