Develop > Business logic layer > Work with the data service layer
Overview of the get-data-config.xml file
The get-data-config.xml file is used to configure expression builders that are used by the getData JSTL tag configured by the WebSphere Commerce getData action. When using the getData data, you specify an expression builder name and a data-type-name. This information is used when looking up the configuration in the get-data-config.xml file to determine which XPath Expression to execute.
You should:
- Create a new get-data-config.xml file when creating a new service module and the configuration file has not been provided for you. Creating a new configuration file enables you to build the own expression builders.
- Extend the get-data-config.xml file when the configuration file has been provided for you. You should not directly modify the provided get-data-config.xml file when making changes, as the changes are lost when configuration files are replaced, for example, when updating WebSphere Commerce. By extending the configuration, you can override the properties of the expression builder.
The get-data-config.xml configuration files must adhere to the following rules:
- They must have get-data-config as the root element.
- There should be one configuration file for each component that is configured for use with the getData action.
- Base component configuration files are expected in WEB-INF/config/base/component/get-data-config.xml, where component is a directory that is unique to the component.
- Client extensions must be located in WEB-INF/config/ext/.global/get-data-config. Client extensions are loaded after base component configurations.
All paths in this file are relative to the installed location of the Web application, such as the Portlet WAR (MVCPortlet.war).
All expression builders are defined in the get-data-config.xml files. The data-type element declares a supported data type for the getData action. The client-facade element declares the component client facade that invokes the service to fetch the data. The expression builder handles building the XPath expression with the published input parameters.
Each expression builder has the following properties:
- The <name> node uniquely identifies the expression builder, and are used by getData tags in the project JSPs when referring to an expression builder.
- The <data-type-name> node contains the noun type which is returned by this expression builder.
- The <expression template> node refers to an XPath query defined in the project query template file, which is used to retrieve specific information from the database. Parameters such as $projectID$ can be passed to the expression builder by a getData tag.
- Each <param> node contains a pair of <name> and <value> child nodes which define a parameter to be passed to the query template file. Here we associate each expression builder with a specific Access Profile. This Access Profile, together with the XPath query defined above, uniquely identifies a query in the query template file.
The pre-built get-data-config.xml file contains:
- The <data-type> element, which defines a Java interface to the logical SDO.
- The <client-facade> element, which defines a Java interface to the client facade code.
- The <expression-builder> element, which defines an XPath expression template, along with an access profile and the data type of the returning nouns; that is CustomAppProperties noun defined in the <data-type> element before.
Extend the get-data-config file can also change the behavior of business components. For example, the Catalog component, by default, enables search by part number and name (case sensitive). You can change this behavior to only enable catalog searching by part number, or to only allow searching by name, to improve the performance of the site searches.
The Management Center Web applications uses the get-data-config.xml file to configure the wcf:getData tag defined in the Get controller JSPs, and define:
- The Java interfaces to the logical SDOs.
- The Java interfaces to the client facades to interact with the WebSphere Commerce services.
- A list of XPath expression templates that are used by Management Center client application.