Free since 2005 · No login required
AT

Academic Tutorials

Learn at your own pace

site-mobile-top-banner · 320x50

Basic Solution Architecture

Added 30 Jul 2008

In this section we will cover the basic architectural elements of the solution. A key factor in determining the architecture is that we want to be able to swap different implementations for generating a site map without a lot of effort as well as reuse code where possible. Since the display and caching of the site map is identical between the two solutions it makes sense to isolate the implementation of the two options to the generation of the sitemap itself and share code for everything else.

As a result, we create a basic implementation of an interface called SiteMapFactory that represents the contract for a specific implementation for generating a site map. This interface is quite simple and contains a single method, the definition of the interface is as follows:

/**
* An interface that defines a factory for building a sitemap.
*/
public interface SiteMapFactory {

/**
* Returns the sitemap for the current request.
* @param request
* @param response
* @return A list of sites.
* @throws SiteMapException
*/
public SiteMap getSiteMap(HttpServletRequest request, HttpServletResponse response) throws SiteMapException;
}

Now that we have this interface we can go ahead and implement two concrete implementations that represents the two options in question. These implementations are called ContextSiteMapFactory and ViewSiteMapFactory and represent the presentation context and View API options respectively. Each of these implementations will be discussed in more detail in subsequent sections, for now we continue with discussing the common elements shared between these two options.

As per the SiteMapFactory interface, each implementation returns an object implementing the SiteMap interface. The SiteMap interface represents the actual site map and is defined as per below
public interface SiteMap extends Serializable { /** * A list of child sites under this site map. */ public Iterator getSites(); }

xmlns:netuix="http://www.bea.com/servers/netuix/xsd/controls/netuix/1.0.0"
xmlns:portal="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.bea.com/servers/netuix/xsd/portal/support/1.0.0 portal-support-1_0_0.xsd">
title="View Based SiteMap">





contentUri="/portlets/sitemap/sitemap.jsp" />