[!!!][TASK] Driver API has too many crosscutting concerns 20/26520/12
authorSteffen Ritter <info@rs-websystems.de>
Sat, 14 Dec 2013 10:33:35 +0000 (11:33 +0100)
committerBenjamin Mack <benni@typo3.org>
Wed, 15 Jan 2014 13:57:53 +0000 (14:57 +0100)
commitf83eddd5027b74d7f4d28a845521bff3b2dd603d
tree6cbe1821b595c6e687569a19ddb2360216f2ff98
parent9bbad98c0a9d31da28f1b7aa0e15c679140e3d4f
[!!!][TASK] Driver API has too many crosscutting concerns

The Driver within the FileAbstractionLayer is the actual
abstraction of a concrete file-system meant to unify
access to several kind of storage-systems the file data
might reside in. For each way of storing files there
has to be a driver.

Therefore a driver is solely a unique API to interact with
an underlying storage system based upon its own identifier
system.

Opposite to that, the AbstractDriver (defining our Interface)
knows about its storage, file- and folder-objects as well
as indexes. The methods within the current driver need to
implement more FAL-internal logic than one would expect from
what the driver is purposed to. As a result only a few drivers
are existing by now. In addition it's nearly impossible to
change FAL interals without touching every driver out there.

This change deals with these problems. In several steps the
current driver API has been refactored to have less dependencies
and only fullfills it's original purpose: the abstraction of a
file storage system.

The following things are considered:
   1. Change every return value which has been an object to the
      identifier and adapt the ResourceStorage accordingly.
   2. Change every method parameter being FileInterface, File,
      AbstractFile or Folder objects to a string: the identifier.
   3. Get rid of the storage as a member variable, only the uid
      of the storage is needed at two places.
   4. Remove all abstract methods from the AbstractDriver and
      put them in a newly created DriverInterface.
   5. Exchange all references to AbstractDriver to the interface.
   6. Remove unused methods, which came to light doing so.
   7. Merge addFile/removeFile and *Raw since the do the same if
      no objects are in place.
   8. Unify the creation of folder objects and how information
      is retrieved (analogue to files now).
   9. Unify and simplify the methods for retrieving folder
      contents (files / folders).
  10. Adapt the UnitTests of both classes to the changes.
      This also leads to the removal of some tests which are
      superfluous with that change.
  11. Make the DriverRegistry check the implementation of the
      newly created interface.
  12. Unify the parameter names in the methods.

Releases: 6.2
Resolves: #54230
Resolves: #54231
Change-Id: I4a51572c6a10859e6fd5f12f6cb539950444992e
Reviewed-on: https://review.typo3.org/26520
Reviewed-by: Frans Saris
Tested-by: Frans Saris
Reviewed-by: Benjamin Mack
Tested-by: Benjamin Mack
17 files changed:
typo3/sysext/core/Classes/Resource/Driver/AbstractDriver.php
typo3/sysext/core/Classes/Resource/Driver/AbstractHierarchicalFilesystemDriver.php
typo3/sysext/core/Classes/Resource/Driver/DriverInterface.php [new file with mode: 0644]
typo3/sysext/core/Classes/Resource/Driver/DriverRegistry.php
typo3/sysext/core/Classes/Resource/Driver/LocalDriver.php
typo3/sysext/core/Classes/Resource/Filter/FileExtensionFilter.php
typo3/sysext/core/Classes/Resource/Filter/FileNameFilter.php
typo3/sysext/core/Classes/Resource/Folder.php
typo3/sysext/core/Classes/Resource/ResourceFactory.php
typo3/sysext/core/Classes/Resource/ResourceStorage.php
typo3/sysext/core/Classes/Resource/Service/FileProcessingService.php
typo3/sysext/core/Tests/Unit/Resource/Driver/AbstractDriverTest.php
typo3/sysext/core/Tests/Unit/Resource/Driver/DriverRegistryTest.php
typo3/sysext/core/Tests/Unit/Resource/Driver/LocalDriverTest.php
typo3/sysext/core/Tests/Unit/Resource/ResourceStorageTest.php
typo3/sysext/core/Tests/Unit/Resource/Utility/FileExtensionFilterTest.php
typo3/sysext/filelist/Classes/FileList.php