atg.sitemap
Class DynamicSitemapGenerator

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.sitemap.DynamicSitemapGenerator
All Implemented Interfaces:
NameContextBindingListener, NameContextElement, NameResolver, AdminableService, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, SitemapGenerator, java.util.EventListener
Direct Known Subclasses:
CatalogSitemapGenerator

public class DynamicSitemapGenerator
extends GenericService
implements SitemapGenerator

Sitemap generator service for dynamic items. Typically, this generator should generate sitemap information for repository items which don't have static pages and use page templates, for example products, skus, categories, etc.

This is an example of what will be generated:

 <?xml version="1.0" encoding="UTF-8"?>
 <urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
 <url>
   <loc>http://www.example.com/</loc>
   <changefreq>monthly</changefreq>
   <priority>0.8</priority>
 </url>
 </urlset>
 

The available tags are described below:

For additional information see Sitemap protocol


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
static java.lang.String SITEMAP_FOOTER
           
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
Fields inherited from interface atg.sitemap.SitemapGenerator
MAX_SITEMAPS, MAX_SIZE, MAX_URLS
 
Fields inherited from interface atg.nucleus.logging.TraceApplicationLogging
DEFAULT_LOG_TRACE_STATUS
 
Fields inherited from interface atg.nucleus.logging.ApplicationLogging
DEFAULT_LOG_DEBUG_STATUS, DEFAULT_LOG_ERROR_STATUS, DEFAULT_LOG_INFO_STATUS, DEFAULT_LOG_WARNING_STATUS
 
Constructor Summary
DynamicSitemapGenerator()
           
 
Method Summary
 void generateSitemap(SitemapGeneratorService pSitemapGeneratorService)
          This method generates sitemaps.
 void generateSitemapUrls(java.lang.String pItemDescriptorName, SitemapGeneratorService pSitemapGeneratorService)
          This method generates sitemap repository items for pItemDescriptorName If number of URLs exceeds limits set in MaxSitemapSize or in MaxUrlsPerSitemap then generator split up sitemap into several sitemaps.
 void generateSitemapUrls(java.lang.String pItemDescriptorName, SitemapGeneratorService pSitemapGeneratorService, java.lang.String pSiteId)
          This method generates sitemap repository items for pItemDescriptorName If number of URLs exceeds limits set in MaxSitemapSize or in MaxUrlsPerSitemap then generator split up sitemap into several sitemaps.
 java.lang.String getChangeFrequency()
          Returns how frequently the page is likely to change.
 java.lang.String getItemDescriptorName()
          Returns item descriptor name.
 int getNumberOfItemsPerTransaction()
          Returns number of items per transaction.
 java.lang.Float getPriority()
          Returns the priority of URL relative to other URLs on site.
protected  Query getQuery(Repository pRepository, java.lang.String pItemDescriptorName)
          Gets unconstrained query for retrieving all repository items of specified type from repository.
 java.lang.String getSitemapFilePrefix()
          Returns sitemap file prefix.
 java.lang.String getSitemapURL(RepositoryItem pRepositoryItem)
          Returns sitemap URL for pRepositoryItem generated using direct/indirect template specified in components template property
 java.lang.String getSitemapURL(RepositoryItem pRepositoryItem, RepositoryItem pSite, SitemapGeneratorService pSitemapGeneratorService)
          Returns sitemap URL for pRepositoryItem generated using direct/indirect template specified in components template property
protected  SortDirectives getSortDirectives()
          Gets sort directives to use for repository items querying from source repository.
 atg.adapter.gsa.GSARepository getSourceRepository()
          Returns repository where generator retrieves information to build sitemap.
 UrlTemplate getTemplate()
          Returns template used to generate URL for repository item.
 javax.transaction.TransactionManager getTransactionManager()
          Returns current transaction manager.
protected  UrlParameterLookup getUrlParameterLookup(java.lang.String pLookupItemName, RepositoryItem pItem)
          Creates lookup for URL parameters with item name pLookupItemName and for the specified repository item.
 java.lang.String getUrlPrefix()
          Returns URL prefix to the application with protocol, host, port
 WebApp getWebApp()
          Returns representation of web application in WebApp.
protected  void populateUrlParameters(UrlParameter[] pParameters, UrlParameterLookup[] pLookups)
          Finds best matching lookups for URL parameters based on their names and populates parameters with values.
protected  void preGenerateSitemapUrls(SitemapGeneratorService pSitemapGeneratorService, java.lang.String pSiteId)
          Configure some context before sitemap generating.
 void setChangeFrequency(java.lang.String pChangeFrequency)
          Sets how frequently the page is likely to change.
 void setItemDescriptorName(java.lang.String pItemDescriptorName)
          Sets new item descriptor name.
 void setNumberOfItemsPerTransaction(int pNumberOfItemsPerTransaction)
          Sets number of items per transaction.
 void setPriority(java.lang.Float pPriority)
          Sets the priority of URL relative to other URLs on site.
 void setSitemapFilePrefix(java.lang.String pSitemapFilePrefix)
          Sets sitemap file prefix.
 void setSourceRepository(atg.adapter.gsa.GSARepository pSourceRepository)
          Sets repository where generator retrieves information to build sitemap.
 void setTemplate(UrlTemplate pTemplate)
          Sets new URL template.
 void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
          Sets new TransactionManager.
 void setUrlPrefix(java.lang.String pUrlPrefix)
          Sets new URL prefix to the application with protocol, host, port
 void setWebApp(WebApp pWebApp)
          Sets new WebApp web application representation.
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, doStartService, doStopService, getAbsoluteName, getAdminServlet, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isLoggingDebug, isLoggingError, isLoggingInfo, isLoggingTrace, isLoggingWarning, isRunning, logDebug, logDebug, logDebug, logError, logError, logError, logInfo, logInfo, logInfo, logTrace, logTrace, logTrace, logWarning, logWarning, logWarning, nameContextElementBound, nameContextElementUnbound, removeLogListener, reResolveThis, resolveName, resolveName, resolveName, resolveName, sendLogEvent, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogError, vlogError, vlogError, vlogError, vlogInfo, vlogInfo, vlogInfo, vlogInfo, vlogTrace, vlogTrace, vlogTrace, vlogTrace, vlogWarning, vlogWarning, vlogWarning, vlogWarning
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLASS_VERSION

public static java.lang.String CLASS_VERSION
Class version string


SITEMAP_FOOTER

public static final java.lang.String SITEMAP_FOOTER
See Also:
Constant Field Values
Constructor Detail

DynamicSitemapGenerator

public DynamicSitemapGenerator()
Method Detail

getSourceRepository

public atg.adapter.gsa.GSARepository getSourceRepository()
Returns repository where generator retrieves information to build sitemap.

Returns:
the GSARepository source repository

setSourceRepository

public void setSourceRepository(atg.adapter.gsa.GSARepository pSourceRepository)
Sets repository where generator retrieves information to build sitemap.

Parameters:
pSourceRepository - source repository

getSitemapFilePrefix

public java.lang.String getSitemapFilePrefix()
Returns sitemap file prefix. Sitemap file must have no more than 50,000 URLs and must be no larger than 10MB (10,485,760 bytes). If we list more page than this limitations, generator will split information into several files with names sitemapFilePrefix.xml, sitemapFilePrefix2.xml and so on.

Returns:
the String with sitemap file prefix.

setSitemapFilePrefix

public void setSitemapFilePrefix(java.lang.String pSitemapFilePrefix)
Sets sitemap file prefix.

Parameters:
SitemapFilePrefix - new sitemap file prefix.

getItemDescriptorName

public java.lang.String getItemDescriptorName()
Returns item descriptor name. Generator will build sitemap for every item of this item descriptor name.

Returns:
item descriptor name for items from SourceRepository.

setItemDescriptorName

public void setItemDescriptorName(java.lang.String pItemDescriptorName)
Sets new item descriptor name. Generator will build sitemap for every item of this item descriptor name.

Parameters:
ItemDescriptorName - item descriptor for items from SourceRepository

getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()
Returns current transaction manager.

Returns:
the TransactionManager instance

setTransactionManager

public void setTransactionManager(javax.transaction.TransactionManager pTransactionManager)
Sets new TransactionManager.

Parameters:
TransactionManager - new transaction manager instance

getNumberOfItemsPerTransaction

public int getNumberOfItemsPerTransaction()
Returns number of items per transaction. Generator use this property when retrieves items from SourceProperty

Returns:
the number of item per transaction

setNumberOfItemsPerTransaction

public void setNumberOfItemsPerTransaction(int pNumberOfItemsPerTransaction)
Sets number of items per transaction. Generator use this property when retrieves items from SourceProperty

Parameters:
NumberOfItemsPerTransaction - number of items per transaction.

getWebApp

public WebApp getWebApp()
Returns representation of web application in WebApp.

Returns:
the WebApp - component which represents web application

setWebApp

public void setWebApp(WebApp pWebApp)
Sets new WebApp web application representation.

Parameters:
WebApp - new WebApp component

getUrlPrefix

public java.lang.String getUrlPrefix()
Returns URL prefix to the application with protocol, host, port

Returns:
URL prefix to the application with protocol, host, port

setUrlPrefix

public void setUrlPrefix(java.lang.String pUrlPrefix)
Sets new URL prefix to the application with protocol, host, port

Parameters:
UrlPrefix - new URL prefix to the application with protocol, host, port

getPriority

public java.lang.Float getPriority()
Returns the priority of URL relative to other URLs on site.

Returns:
the priority of URL relative to other URLs on site.

setPriority

public void setPriority(java.lang.Float pPriority)
Sets the priority of URL relative to other URLs on site.

Parameters:
pPriority - the priority of URL relative to other URLs on site.

getChangeFrequency

public java.lang.String getChangeFrequency()
Returns how frequently the page is likely to change.

Returns:
how frequently the page is likely to change.

setChangeFrequency

public void setChangeFrequency(java.lang.String pChangeFrequency)
Sets how frequently the page is likely to change.

Parameters:
pChangeFrequency - how frequently the page is likely to change.

getTemplate

public UrlTemplate getTemplate()
Returns template used to generate URL for repository item. Generator uses this template to construct sitemap URL for repository item of type ItemDescriptorName Both direct and indirect templates can be set here. Use indirect template to generate sitemap with static URLs for repository items like http://mywebsite.com/mywebapp/jump/product/12345/Button+collar+Oxford+Shirt/ To generate sitemap with dynamic URLs direct template can be passed here: e.g. http://mywebsite.com/mywebapp/browse/productDetail.jsp?productId=12345

Returns:
the UrlTemplate

setTemplate

public void setTemplate(UrlTemplate pTemplate)
Sets new URL template. Generator use this URL to construct sitemap URL for repository item of type ItemDescriptorName

Parameters:
pTemplate - the UrlTemplate to set

generateSitemap

public void generateSitemap(SitemapGeneratorService pSitemapGeneratorService)
This method generates sitemaps. If number of URLs exceeds limits set in MaxSitemapSize or in MaxUrlsPerSitemap then generator split up sitemap into several sitemaps.

Specified by:
generateSitemap in interface SitemapGenerator

generateSitemapUrls

public void generateSitemapUrls(java.lang.String pItemDescriptorName,
                                SitemapGeneratorService pSitemapGeneratorService)
This method generates sitemap repository items for pItemDescriptorName If number of URLs exceeds limits set in MaxSitemapSize or in MaxUrlsPerSitemap then generator split up sitemap into several sitemaps.

Parameters:
pItemDescriptorName - item descriptor name
pSitemapGeneratorService - Sitemap Generator service that hold all global settings

generateSitemapUrls

public void generateSitemapUrls(java.lang.String pItemDescriptorName,
                                SitemapGeneratorService pSitemapGeneratorService,
                                java.lang.String pSiteId)
This method generates sitemap repository items for pItemDescriptorName If number of URLs exceeds limits set in MaxSitemapSize or in MaxUrlsPerSitemap then generator split up sitemap into several sitemaps.

Parameters:
pItemDescriptorName - item descriptor name
pSitemapGeneratorService - Sitemap Generator service that hold all global settings
pSiteId - site ID for which sitemap should be generated

getSitemapURL

public java.lang.String getSitemapURL(RepositoryItem pRepositoryItem)
                               throws RepositoryException
Returns sitemap URL for pRepositoryItem generated using direct/indirect template specified in components template property

Parameters:
pRepositoryItem - repository item
Returns:
String generated sitemap URL for a given repository item
Throws:
RepositoryException

getSitemapURL

public java.lang.String getSitemapURL(RepositoryItem pRepositoryItem,
                                      RepositoryItem pSite,
                                      SitemapGeneratorService pSitemapGeneratorService)
                               throws RepositoryException
Returns sitemap URL for pRepositoryItem generated using direct/indirect template specified in components template property

Parameters:
pRepositoryItem - repository item
pSite - Site repository item
pSitemapGeneratorService - Sitemap Generator service that holds global settings
Returns:
String generated sitemap URL for a given repository item
Throws:
RepositoryException

getUrlParameterLookup

protected UrlParameterLookup getUrlParameterLookup(java.lang.String pLookupItemName,
                                                   RepositoryItem pItem)
Creates lookup for URL parameters with item name pLookupItemName and for the specified repository item.

Parameters:
pLookupItemName - lookup item name
pItem - repository item to lookup properties of
Returns:

populateUrlParameters

protected void populateUrlParameters(UrlParameter[] pParameters,
                                     UrlParameterLookup[] pLookups)
Finds best matching lookups for URL parameters based on their names and populates parameters with values.

Parameters:
pParameters - array of URL parameters
pLookups - array of lookups

getQuery

protected Query getQuery(Repository pRepository,
                         java.lang.String pItemDescriptorName)
                  throws RepositoryException
Gets unconstrained query for retrieving all repository items of specified type from repository.

Parameters:
pRepository - - source repository.
pItemDescriptorName - - name of the item descriptor.
Returns:
query
Throws:
RepositoryException

getSortDirectives

protected SortDirectives getSortDirectives()
Gets sort directives to use for repository items querying from source repository.

Returns:
sort directives.

preGenerateSitemapUrls

protected void preGenerateSitemapUrls(SitemapGeneratorService pSitemapGeneratorService,
                                      java.lang.String pSiteId)
Configure some context before sitemap generating.

Parameters:
pSitemapGeneratorService - Sitemap Generator service that holds global settings for sitemap generating.
pSiteId - site ID for which sitemap is generated.