A site area is a logical grouping of
pages within your site. The pages could be identified by having similar urls, for example they may all start with
/products/ or it could be based on query parameters or a combination of both. Nearly all sites (of any size) have these logical groupings.
polliwog is able to resolve each page url and referer url (if present) into a site area by using a
site area resolver. The resolver examines the url and returns the associated site area.
A site area resolver is created by implementing the
org.polliwog.resolvers.SiteAreaResolver interface.
polliwog only creates a single instance of the resolver that is then used for the entire log, the instance is intialized by calling the init(org.polliwog.data.VisitorEnvironment) method.
The site area will only be resolved if a site area resolver is provided in the
properties file for property:
siteAreaResolverClass
A basic implementation of the site area resolver is provided by the
org.polliwog.resolvers.BasicSiteAreaResolver class. This class uses a xml file to provide the mappings between urls and the site areas. It is a simple implementation and may to be used where there is a straight forward mapping between the two.
The format of the xml file is as follows:
XML Definition Help
The Children column shows the child elements that can be used within the specified element. Child elements can appear in any order (there is no enforcement via a DTD).
- A + after the element name indicates that at least 1 child element with that name must be present.
- A * after the element name indicates that 0 or more elements can be present.
- A ? after the element name indicates that either 1 or no elements with that name can be present.
If no symbol is provided after the name then one element must be provided.
The Attributes column shows the attribute that can be used on the specified element. Attribute definitions are defined as: name(value_type,required|optional), where value_type is one of:
- string - A string value, this can be anything.
- integer - An integer value.
- class - A fully qualified classname.
- enum{values} - A specific value, one or more of those given in the brackets, which will be comma-separated.
- boolean - Either
true or false .
Required and optional are represented as: R and O respectively.
|
Name | Root | Children | Parent(s) | Attributes | Description |
---|
site-areas | Y | type+, area+ | NONE | default(string,R) | The root element, each child area element defines a set of mappings between a url and a site area. Each child type element defines the type of match that can be used within each area element. The default attribute provides the name of the site area that cannot be matched to any area in the file. |
area | N | match+ | site-areas | name(string,R) | Defines a mapping. The name attribute defines the name of the area. |
match | N | TEXT | area | type(string,R) | Defines a match. The type attribute should map to one of the type elements (via the id attribute on the type element) so that the resolver knows what kind of match to create. When a JoSQLMatchType is used the content of the match element should be a JoSQL WHERE clause that will be executed to determine whether the url maps to the site area. The class available to the WHERE clause is: AbstractURIField. |
type | N | NONE | site-areas | id(string,R) class(string,R) | Defines a match type. The id attribute is basically the name of the match type, the type attribute on the match element should map to one of the ids. The class attribute should be a fully qualified classname that polliwog should create when a match is created. The class specified should implement the MatchType interface. |
The resolver uses property:
basicSiteAreaResolverFile
to define the location of the xml file to use.
Example
<site-areas default="Unknown">
<type id="josql"
class="org.polliwog.resolvers.JoSQLMatchType" />
<area name="Front Page">
<match type="josql">
path IN ('/index.html', '/')
</match>
</area>
</site-areas>