Another Custom Property Locator: a Library of Books

Posted by Cindy McMullen on Oracle Blogs See other posts from Oracle Blogs or by Cindy McMullen
Published on Fri, 17 Jun 2011 07:33:56 -0700 Indexed on 2011/06/20 16:32 UTC
Read the original article Hit count: 247

Filed under:

Introduction

The previous post gave an introduction to custom property locators and showed how create one using JDeveloper.  This post continues on the custom locator theme, with a slightly more complex locator: a library of books.  It demonstrates using the DAO pattern to delegate data access from the Locator, which is likely how many actual backing stores will integrate with the Locator.  You can imagine, rather than a library of books, the data store might be a user database of sorts.  The same sort of pattern would apply.

This post uses the BookLocator example originally shown in the WebCenter documentation, but has:

  • updated the source code to reflect the final Property APIs
  • includes the steps for generating the namespace and property definition files via JDeveloper
  • detailed usage of the PropertyService APIs

Getting Started

If you're new to JDeveloper, you might want to check out this tutorial.  There is also the "Jump-Start to using Personalization" blog post that you might find useful.  Otherwise, if you're already familiar with both, you can skip those tutorials and jump right in to using JDeveloper.

Download the BookLocator.zip file (which has been updated from the original post) and unzip it to a new directory.  Start JDeveloper, navigate to the BookLocator.jws file, and open it.   It should look something like this:


The Properties Namespace file contains the property definitions and property set definitions you define.  It is explained more in detail in the Namespace documentation

Although this example doesn't show it, the property set definitions have the ability to reference multiple locators per property.   This can be done by right-clicking on the 'Locator Info' box.  Configure the contents of the Locator Map  by editing locators and mapping them to available property names in the property set definition.

Compiling, deploying, and running your locator

The rest of the steps in this tutorial basically follow those in the previous blog on custom locators, and won't be repeated here.   A scenario to invoke your locator is included with the sample app: see BookProperties.scenarios_diagram above. 

Summary

This post demonstrates a simple library of books accessed by the BookPropertyLocator via the DAO layer.  This is a useful pattern for more realistic property retrievals, such as a backing user store.  It also points out the possibility of retrieving properties from multiple locators, which would be quite handy to retrieve user attributes from multiple sources.

© Oracle Blogs or respective owner

Related posts about /Oracle