Services
From semantic-mediawiki.org
Services contain object definitions that handle the object build process and provide instance reuse, if necessary.
$smwgServicesFileDir describes the location of the services directory.
Services factory
Object instances are generally accessed using the ServicesFactory locator and its public methods.
ServicesFactory owns a private Wikimedia\Services\ServiceContainer populated from the ServiceWiring.php wiring file. That container holds the no-argument, stateless services (Bucket A). Services that take runtime arguments or are constructed fresh per use (Bucket B and C) are exposed as factory methods on ServicesFactory instead.
Service files and containers
Files
ServiceWiring.phpwiring file for the privateServiceContainer; defines the Bucket-A servicesimporter.phpprovides services for the Importer, consumed byImporterServiceFactorydatavalues.phpprovides services forDataValueobjects, consumed byDataValueServiceFactory
Containers
ServicesContainerlightweight container used to inject services into theDataValueServiceFactoryandImporterServiceFactorydomains
Service specific factories
DataValueServiceFactoryprovides service and factory functions forDataValueobjects that are specified indatavalues.phpImporterServiceFactoryprovides service and factory functions forImporterobjects that are specified inimporter.php
Example for a service[edit]
- Extraneous language − provides "extraneous" language functions independent of MediaWiki required by Semantic MediaWiki and its registration system.