Data source definition

Data source definition specifies a data source and defines its parameters. A data source represents a persistence layer that a Magnolia component can read from or write to. In the Magnolia 6 UI framework, apps, subapps and some fields can be connected to a data source via data source definition.

Data source definition is part of the Magnolia 6 UI framework. The fully qualified class name is info.magnolia.ui.datasource.BaseDatasourceDefinition.

If you work with the Magnolia 5 UI framework, see Content connector instead.

From content connector to data source

Content connectors were introduced in Magnolia 5 UI to make content apps less JCR-dependent. They provided the interface for converting data entries between three forms: location fragment (string), id (arbitrary object) and Vaadin item (pre-Vaadin 8 abstraction that provides a universal bridge between Vaadin components and the back end). Content connector definition would also typically provide the data source configuration (e.g. a workspace name, root node path and node types in case of JCR).

With data source definition in Magnolia 6 UI, a special abstraction for data conversion is no longer needed (due to the fact that Vaadin items do not exist anymore, apps can work directly with domain objects via Lambda-centric data API that comes with Vaadin 8). Data source definitions can now be simply injected in their respective UI contexts (e.g. an app, subapp or select field) and be used for domain-specific implementations of UI components or back-end connectors (e.g. Vaadin 8 data providers and various pluggable interfaces for select fields such as icons and captions).

A data source can be flexibly configured as follows:

  • Data source definitions can be shared with child contexts (a subapp will inherit an app data source unless the subapp has its own defined data source).

  • Module component mappings can be defined in the context of the current data source (a component section should have an id in the form of <id>datasource-<ds-name></id>, where <ds-name> is configured in the definition).

Data source types

$type class








For more information, refer to the following pages:

If you are looking for a bean-based content app implementation that uses data source definition, check out Tasks app, Notifications app and Definitions app.