The Digital Data Connector (DDC) uses the following constructs to achieve what it is designed to do:
- DDC Plug-in
- This is a Java plugin that works in the DDC framework to load external data and transform it into a format that can be rendered with the list design components.
- DDC ships with two plug-ins, a social data plug-in for consuming IBM Connections data, and a generic XML plug-in.
- Bean List
- The bean list is the result of the DDC plug-in that may result from processing a remote document along with a List Rendering Profile.
- List-Rendering Profile
- A list-rendering profile defines the attributes in the bean list generated by the plug-in. For the generic XML plug-in, list-rendering profiles are used to map the XML data structure to actual attribute values available in the BeanList.
- DDC Selection Rule
- Created as a rule or rules configured in Portal or WCM Personalization components, the selection rule is used to trigger the DDC framework at render time.
- List Appearance
- A WCM PZN component that references the DDC selection rule and defines the visualization components to be applied to the list. It encompasses the header markup, footer markup, the result markup, and the list's pagination rules.
- List-Rendering Context
- The context generated by the rendering plug-in. Usually it provides all information necessary for processing the remote documents which is the source of the document, the id of the DDC Plugin to be used as well as the List Rendering Profile that is to be used for processing documents.
- When used in social lists, it includes information about the instance of the social list and ensures the social query contains an appropriate set of remote information. The WCM tag [Plugin:ListRenderingContext] must be included in the presentation templates before the DDC design components.
- List Definition
- This is the content item that represents the list. It provides the information to establish the list-rendering context.
- It maps the appearance component to the list for rendering the desired UI.
- Is what the Web Content Viewer portlet is configured to render to display the list on a page.
One needs these components to render data properly with DDC. The modular nature of this design enables web developers to work on the rendering components installed from the data definition. It also allows for context aware calls to data sources that include ACLs, like IBM Connections so that the security in the data source system is respected by the Portal. This design can be extended to Commerce sites, CRM data, etc. with great potential and possibilities.
You can use one of the following approaches to connecting to external data:
1. Leverage the existing XML Plug-in. This is the simplest method as it does not require the development or deployment of any Java code. It does, however, require that your data source is already in a consumable XML format. You create a list-rendering profile to use this method or reuse the existing ATOM List Rendering Profile that comes with DDC.
2. Develop a custom DDC Plug-in. Extremely flexible, but requires that a Java developer write code that implements the
com.ibm.portal.wcm.plr.BeanListProvider Java interface as defined by the public Digital Data Connector Java API.
3. Combine the two approaches. A custom plugin may internally dispatch to the first approach that is described. In addition, it allows a flexible way for enriching the bean information that is directly available in the remote XML Document with data that need to be computed explicitly. This could for instance be data fragments that depend on the user that is currently logged in to the portal system.
We will use method one for our example.
We will connect to an XML data source and render a list of items for sale, simulating the consumption of a web service. The sample xml file will be provided for download.
Assume the following:
- Portal is the host: wpnextbeta.srdemo.com
- Web service is located at: cnx.srdemo.com/demo/items.xml
- The list will be placed on a portal page by itself, and you already created the target page for this list
NOTE: It is often considered a best practice to place all of your custom elements into a separate WCM library, but for the purpose of this example, all elements are simply stored in the Portal Site library.
1. To enable DDC to render the list from the source feed, the feed needs to be accessible through the Ajax Proxy. Add the URL to Portal's proxy-config.xml according to the documentation. For this example, the URL added was "http://cnx.srdemo.com/demo/*"
2. Two foundational elements need to be created, the List Definition Authoring Template and the List Definition Presentation Template, and then a series of elements specific to our unique list. Navigate to Applications -> Content -> Web Content Authoring to create the components in WCM that will make up our new list.
3. Within the WCM Authoring Portlet, browse to the library which will contain all of the elements.
4. Create the Presentation Template by selecting New -> Presentation Template.
5. Give the item a name and click on Save.
6. In the Markup field, define the ListrenderingContext. By using dynamic references to the values we just created in the authoring template, the list definitions will be able to be used by any similar DDC list. The value in the markup field should look something like this:
[Plugin:ListRenderingContext compute="always" extension-id="[Element context='current' type='content' key='provider']" profile="[Element context='current' type='content' key='profile']" attribute="source=[Element context='current' type='content' key='source']"][Element context="current" type="content" key="List Appearance" compute="always"]
7. Save and close the element.
8. Create a new Authoring Template from the default Content Template.
9. Give the component a name and click on Save. Then click on Manage Elements.
Add the following elements:
10. Disable workflow for the Authoring Template and associate the presentation template just created with this element.
11. Save and close the component.
12. The next few elements will define the source of the list and the list presentation. These elements will be unique for almost any DDC list you create.
13. Create an HTML component to be used as the Query URL for the list.
14. Populate the HTML element with the ResourceURL plugin statement defining the URL of your web service then save and close the HTML component.
15. The list appearance is governed by the PZN component. Create a new PZN component now.
16. Give the component a name and save it.
17. The Personalization Element must contain a Select Pluggable Resources. Click on new and modify as necessary. Save your rule.
18. Complete the Header, Footer, Result, and No Results fields to contain basic HTML. For more advanced list design, see Customizing the display of a DDC List.
19. Save and close the component.
20. Navigate to where in the WCM library you would like to create the content item that will represent your list and create a new content item based on the Authoring Template created earlier.
21. Give the content item a name and complete the four fields as defined in the table below the figure:
The PZN Component you created
The HTML Component containing the Query URL
Save and Close the content item.
22. Place the Web Content Viewer portlet on the intended page and configure it to render the created piece of content. You will see your list.