Welcome to EMC Consulting Blogs Sign in | Join | Help

Liam Dooley's blog

ATG from a Java developers perspective

Art Technology Group AKA ATG

ATG is one of the market leaders in enterprise eCommerce platform solutions, and has been around for nearly two decades now, making it a dinosaur in internet years. It is arguably the market leader in its domain, according to the last Forrester eCommerce platforms report, and sits alongside IBM at the top of Gartner’s not-so-magic quadrant. It provides an impressive sounding modular set of capabilities, from personalisation, recommendations, targeting, content and customer management tools, campaign management, search and click to chat/call. ATG can run on JBoss, Websphere and Weblogic, and integrates with Oracle, MS SQL, DB2 and MySQL (though only for development purposes). ATG comprises a very large suite of products, of which I'm only going to comment on its core application framework (Dynamo Application Framework - DAF), and its primary commerce package B2C.

Nucleus - The heart of the (dark) matter

Nucleus is what lies at the heart of ATG. It’s essentially an object container that manages the lifecycle of POJOs using reflection and dependency injection. It's responsible for instantiating objects and setting their properties based on a very flexible but well defined configuration layering hierarchy using simple properties text files. In ATG world, these objects are called components (basically named JavaBeans and Servlets) that can be linked together via these configuration files by a developer to create an ATG application. Nucleus also maintains a name hierarchy and is responsible for resolving these names to components, which can be request, session or globally scoped.

Configuration layering is quite a useful feature of Dynamo. It lets you easily override settings in different application modules you are using, by e.g. creating a component properties file with the same path and name as that component in the corresponding folder in your own module, or in a corresponding folder in a localconfig folder. You can also use this localconfig folder to specify environment specific settings, allowing for the creation of environment agnostic builds without having to store all environment specific information in e.g. some database, or doing different builds for different environments. Another nice feature of Nucleus is that it comes with several web based tools that let you browse components in a running application and inspect properties or change their values on the fly, or invoke methods on those components (somewhat similar to a JMX console).

The following diagram gives an example of setting (and overriding) component properties at different layers on the configuration path. The first two files would be part of the application build, but the third file would be placed directly on the production file system to over-write some prebuilt settings.

configuration_layering_diagram2

 

The building blocks...

Repositories

Repositories are an abstraction on any data store, which is typically a database, but could be LDAP, file system, etc. The data model itself is mapped out in xml configuration files, with the same layering principle as is used for configuring components, only cleverer as it combines xml files at different configuration layers into a single composite file, such that you can easily extend, over-ride or remove out of the box properties and settings. Every unit in your repository is called a repository item, which is kind of like a dynamic bean, and you use the supplied repository API to query and modify those items. This framework lets you model any complex data model in a very generic way. ATG Repositories also comes with its own query language (RQL) allowing you to write abstract queries on your data structure without being tied to any particular type of data source. ATG calls this whole setup the Data Anywhere Architecture. Caching is also built into this repository architecture and the component browser I mentioned before also provides more stats than you’d ever need to tune your caches appropriately.

Droplets / DSP tag library

Droplets are ATG servlet beans that are used to dynamically generate HTML. ATG provides numerous droplets to perform lots of common tasks (e.g. display all the error messages for a form), but it’s possible to write your own custom ones also. The DSP (dynamo server pages) tag library is somewhat equivalent to JSTL but with the added ability that they naturally interact with Nucleus components.

Droplets tend to be a bit verbose. For example, compare the following piece of hypothetical code to display the contents of a shopping cart written using ATG droplets with what it might look like if written in a bespoke JEE application.

<h1>ATG shopping cart example</h1>

<dsp:droplet name="/atg/dynamo/droplet/ForEach"> <dsp:param name="array"

    bean="/atg/commerce/ShoppingCart.current.commerceItems" />
  <dsp:param name="elementName" value="commerceItem" />
  <dsp:oparam name="output">
    <dsp:getvalueof var="commerceItemId" param="commerceItem.id" />
    <dsp:droplet name="SkuLookupDroplet">
      <dsp:param name="id" param="commerceItem.catalogRefId" />
      <dsp:param name="elementName" value="sku" />
      <dsp:oparam name="output">
        <dsp:getvalueof param="sku.displayName" var="skuDisplayName" />
      </dsp:oparam>
    </dsp:droplet>
    <td><dsp:valueof param="skuDisplayName" />&nbsp; <dsp:valueof
      param="commerceItem.priceInfo.amount" converter="currency"
      locale="${someCustomlocale}">0.00</dsp:valueof></td>
    <td><dsp:a href="deliveryOptions.page"
      bean="DeliveryOptionsFormHandler.value.itemId"
      value="${commerceItemId}">Delivery Options</dsp:a></td>
  </dsp:oparam>
</dsp:droplet>

 

 

<h1>Bespoke shopping cart example</h1>
<c:forEach var="commerceItem"
  items="${shoppingCart.current.commerceItems}">
  <td><customtag:getSkuDisplayName id="${commerceItem.catalogRefId}" />
  <fmt:formatNumber type="currency" minFractionDigits="2"
    value="${commerceItem.priceInfo.amount}" /></td>
  <td><a href="deliveryOptions?itemId=${commerceItem.id}">Delivery Options</a></td>
</c:forEach>

Of course, there is no reason why you can't mix and match tag libraries and only use the ATG tags and droplets where necessary.

Form Handlers

ATG Form Handlers are components for validating and processing html forms, calling business components and managing flow between a limited set of pages (e.g. success/error), so a bit like Struts Action classes in that they mediate between the view and model. ATG provides hundreds of readymade form handlers for performing all sorts of tasks, like updating a customer profile, managing your shopping cart, checking out, or interacting with a repository. If you need some custom behaviour for any of these functions you just extend one of the form handlers provided by ATG.

Logging

ATG also provides a logging framework which is essentially a wrapper over log4j. I don’t see the point of this, as log4j is already extremely powerful and flexible on its own, although a nice feature of this is that you can turn on logging for a particular component within a web browser. ATG also provides an unobtrusive performance logging framework which you can plug into components, and is very useful for identifying bottlenecks or problem areas in your code as it lets you browse and drill down into the performance timings and memory usage of components.

Conclusion

As a technology company, ATG has been quite innovative – Its dependency injection model predates Spring. ATG even invented a precursor to jsp, called jhtml, parts of which were subsequently licensed by Sun for the jsp standard. Where it is really lacking though from a developers perspective, is that it doesn’t have any real overall MVC model, or a decent validation framework.

ATG is a rather large beast. It has its own way of doing practically everything: object relational mapping, transactions, scheduling, caching, dependency injection, content admin, versioning, servlet filtering, the list goes on... As a result, it requires a lot of specialist knowledge to get anything done, so manna for consultancies and contractors then!

Published Friday, March 19, 2010 11:27 AM by liam.dooley
Filed under: , , , , ,

Comments

No Comments
Anonymous comments are disabled
Powered by Community Server (Personal Edition), by Telligent Systems