atg.sitemap
Class SitemapGeneratorService

java.lang.Object
  extended by atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
      extended by atg.nucleus.GenericService
          extended by atg.service.scheduler.SchedulableService
              extended by atg.service.scheduler.SingletonSchedulableService
                  extended by atg.sitemap.SitemapGeneratorService
All Implemented Interfaces:
atg.naming.AbsoluteNameable, NameContextBindingListener, NameContextElement, atg.naming.NameContextParentable, NameResolver, AdminableService, atg.nucleus.Configured, ApplicationLogging, atg.nucleus.logging.ApplicationLoggingSender, atg.nucleus.logging.TraceApplicationLogging, VariableArgumentApplicationLogging, ComponentNameResolver, Service, ServiceListener, Schedulable, java.util.EventListener

public class SitemapGeneratorService
extends SingletonSchedulableService

This service is responsible for sitemap and siteindex generation. It could be run by schedule or manually using ATG Dynamo Admin UI.

This service iterates over the array of SitemapGenerator and invoke SitemapGenerator.generateSitemap() method. Each generator creates repository items of type sitemap.

After sitemap generators are done, SitemapGeneratorService invokes SitemapIndexGenerator. This component generates special repository item if type siteindex. This repository item contains of links to every sitemap was generated.

To allow schedule this service extends SingletonSchedulableService what guarateed that only one instance of SitemapGeneratorService wiil run.


Field Summary
static java.lang.String CLASS_VERSION
          Class version string
 
Fields inherited from class atg.service.scheduler.SchedulableService
mJobId
 
Fields inherited from class atg.nucleus.GenericService
SERVICE_INFO_KEY
 
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
SitemapGeneratorService()
           
 
Method Summary
 void doScheduledTask(Scheduler pScheduler, ScheduledJob pJob)
          Generate sitemap and siteindex repository items by schedule.
 void generateSitemaps()
          This method is responsible for sitemap and siteindex generation.
 int getMaxSitemapSize()
          Returns maximum allowed sitemap size in bytes.
 int getMaxUrlsPerSitemap()
          Returns maximum allowed count of URLs per sitemap.
 SiteContextManager getSiteContextManager()
          get SiteContextManager - the SiteContext management component
 SitemapGenerator[] getSitemapGenerators()
          Returns array of sitemap generators.
 SitemapIndexGenerator getSitemapIndexGenerator()
          Returns sitemap index generator.
 SitemapPropertiesManager getSitemapPropertiesManager()
          Returns SitemapPropertiesManager - utility class which provide property names for SitemapRepository.
 MutableRepository getSitemapRepository()
          Returns current sitemap repository.
 SitemapTools getSitemapTools()
          Returns utility class for handling repository items of types sitemap and siteindex.
 java.util.List<java.lang.String> getSites()
          Returns list of site IDs for which sitemaps should be generated
 SiteURLManager getSiteURLManager()
          Returns SiteURLManager - the Site URL manager
 java.lang.String getUrlPrefix()
          Returns URL prefix to the application with protocol, host, port.
 java.lang.String getWarDir()
          Returns path where applications's war is located.
 WebApp getWebApp()
          Returns representation of web application in WebApp.
 boolean isActiveSitesOnly()
           
 boolean isDebugMode()
           
 boolean isEnabledSitesOnly()
           
 void setActiveSitesOnly(boolean pActiveSitesOnly)
          Sets ActiveSitesOnly boolean.
 void setDebugMode(boolean pDebugMode)
          Sets debugMode for sitemap and siteindex generation.
 void setEnabledSitesOnly(boolean pEnabledSitesOnly)
          Sets EnabledSitesOnly boolean.
 void setMaxSitemapSize(int pMaxSitemapSize)
          Sets maximum allowed sitemap size in bytes.
 void setMaxUrlsPerSitemap(int pMaxUrlsPerSitemap)
          Sets maximum allowed count of URLs per sitemap.
 void setSiteContextManager(SiteContextManager pSiteContextManager)
          set SiteContextManager - the SiteContext management component
 void setSitemapGenerators(SitemapGenerator[] pSitemapGenerators)
          Sets an array of sitemap generators.
 void setSitemapIndexGenerator(SitemapIndexGenerator pSitemapIndexGenerator)
          Sets new SitemapIndexGenerator service.
 void setSitemapPropertiesManager(SitemapPropertiesManager pSitemapPropertiesManager)
          Sets new property manager - utility class which provide property names for SitemapRepository.
 void setSitemapRepository(MutableRepository pSitemapRepository)
          Sets new sitemap repository.
 void setSitemapTools(SitemapTools pSitemapTools)
          Sets new SitemapTools.
 void setSiteURLManager(SiteURLManager pSiteURLManager)
          Sets new SiteURLManager
 void setUrlPrefix(java.lang.String pUrlPrefix)
          Sets new URL prefix with protocol, host, port.
 void setWarDir(java.lang.String pWarDir)
          Sets new path where to war directory.
 void setWebApp(WebApp pWebApp)
          Sets new web application.
 
Methods inherited from class atg.service.scheduler.SingletonSchedulableService
acquireLock, getClientLockManager, getLockName, getLockTimeOut, performScheduledTask, releaseLock, setClientLockManager, setLockName, setLockTimeOut
 
Methods inherited from class atg.service.scheduler.SchedulableService
doStartService, doStopService, getJobDescription, getJobId, getJobName, getSchedule, getScheduler, getThreadMethod, getThreadMethodString, isTransactional, setJobDescription, setJobName, setSchedule, setScheduler, setThreadMethod, setThreadMethodString, setTransactional, startScheduledJob, stopScheduledJob
 
Methods inherited from class atg.nucleus.GenericService
addLogListener, createAdminServlet, getAbsoluteName, getAdminServlet, getAdminServletOutputStreamEncoding, getLoggingForVlogging, getLogListenerCount, getLogListeners, getName, getNameContext, getNucleus, getRoot, getServiceConfiguration, getServiceInfo, isAdminServletUseServletOutputStream, 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, setAdminServletOutputStreamEncoding, setAdminServletUseServletOutputStream, setLoggingDebug, setLoggingError, setLoggingInfo, setLoggingTrace, setLoggingWarning, setNucleus, setServiceInfo, startService, stopService
 
Methods inherited from class atg.nucleus.logging.VariableArgumentApplicationLoggingImpl
vlogDebug, vlogDebug, vlogDebug, vlogDebug, vlogDebugTrace, 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

Constructor Detail

SitemapGeneratorService

public SitemapGeneratorService()
Method Detail

getSitemapRepository

public MutableRepository getSitemapRepository()
Returns current sitemap repository. This is special repository where generators save their information for sitemap and siteindex files.

Returns:
the current SitemapRepository.

setSitemapRepository

public void setSitemapRepository(MutableRepository pSitemapRepository)
Sets new sitemap repository. This is special repository where generators save their information for sitemap and siteindex files.

Parameters:
SitemapRepository - the MutableRepository to set.

getSitemapGenerators

public SitemapGenerator[] getSitemapGenerators()
Returns array of sitemap generators. Typically, each generator create repository item of type sitemap where containts information for definite type, e.g. product, category, etc.

Returns:
SitemapGenerator[] - the array of sitemap generators.

setSitemapGenerators

public void setSitemapGenerators(SitemapGenerator[] pSitemapGenerators)
Sets an array of sitemap generators.

Parameters:
pSitemapGenerators[] - - the array of sitemap generators to set.

getSitemapIndexGenerator

public SitemapIndexGenerator getSitemapIndexGenerator()
Returns sitemap index generator. This generator are used to create repository item of type siteindex which contains links to sitemaps.

Returns:
sitemap index generator instance

setSitemapIndexGenerator

public void setSitemapIndexGenerator(SitemapIndexGenerator pSitemapIndexGenerator)
Sets new SitemapIndexGenerator service. This generator are used to create repository item of type siteindex which contains links to sitemaps.

Parameters:
pSitemapIndexGenerator - - new sitemap index generator

getWarDir

public java.lang.String getWarDir()
Returns path where applications's war is located.

Returns:
directory where application's war is located.

setWarDir

public void setWarDir(java.lang.String pWarDir)
Sets new path where to war directory.

Parameters:
WarDir - directory where application's war is located.

getUrlPrefix

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

Returns:
URL prefix.

setUrlPrefix

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

Parameters:
UrlPrefix - new URL prefix

getMaxSitemapSize

public int getMaxSitemapSize()
Returns maximum allowed sitemap size in bytes.

Returns:
the maxSitemapSize maximum allowed sitemap size in bytes

setMaxSitemapSize

public void setMaxSitemapSize(int pMaxSitemapSize)
Sets maximum allowed sitemap size in bytes.

Parameters:
maxSitemapSize - maximum allowed sitemap size in bytes

getMaxUrlsPerSitemap

public int getMaxUrlsPerSitemap()
Returns maximum allowed count of URLs per sitemap.

Returns:
the maxUrlsPerSitemap maximum allowed count of URLs per sitemap

setMaxUrlsPerSitemap

public void setMaxUrlsPerSitemap(int pMaxUrlsPerSitemap)
Sets maximum allowed count of URLs per sitemap.

Parameters:
maxUrlsPerSitemap - maximum allowed count of URLs per sitemap

getWebApp

public WebApp getWebApp()
Returns representation of web application in WebApp. Used to retrieve application's context root.

Returns:
the WebApp - component which represents web application

setWebApp

public void setWebApp(WebApp pWebApp)
Sets new web application. Used to retrieve application's context root.

Parameters:
WebApp - new WebApp component

getSitemapPropertiesManager

public SitemapPropertiesManager getSitemapPropertiesManager()
Returns SitemapPropertiesManager - utility class which provide property names for SitemapRepository.

Returns:
properties manager

setSitemapPropertiesManager

public void setSitemapPropertiesManager(SitemapPropertiesManager pSitemapPropertiesManager)
Sets new property manager - utility class which provide property names for SitemapRepository.

Parameters:
SitemapPropertiesManager - properties manager to set

getSitemapTools

public SitemapTools getSitemapTools()
Returns utility class for handling repository items of types sitemap and siteindex.

Returns:
the SitemapTools component

setSitemapTools

public void setSitemapTools(SitemapTools pSitemapTools)
Sets new SitemapTools.

Parameters:
SitemapTools - the SitemapTools to set

getSiteURLManager

public SiteURLManager getSiteURLManager()
Returns SiteURLManager - the Site URL manager

Returns:
Site URL manager

setSiteURLManager

public void setSiteURLManager(SiteURLManager pSiteURLManager)
Sets new SiteURLManager

Parameters:
SiteURLManager - Site URL manager to set

setSiteContextManager

public void setSiteContextManager(SiteContextManager pSiteContextManager)
set SiteContextManager - the SiteContext management component

Parameters:
pSiteContextManager - the SiteContextManager

getSiteContextManager

public SiteContextManager getSiteContextManager()
get SiteContextManager - the SiteContext management component

Returns:
the SiteContextManager

isDebugMode

public boolean isDebugMode()
Returns:
true if debug mode turned on.

setDebugMode

public void setDebugMode(boolean pDebugMode)
Sets debugMode for sitemap and siteindex generation. If pDebugMode=true the generators will produce formatted sitemaps and siteindex items.

Parameters:
DebugMode - the boolean value to set

isEnabledSitesOnly

public boolean isEnabledSitesOnly()
Returns:
true if only enabled sites should be used for sitemap generation.

setEnabledSitesOnly

public void setEnabledSitesOnly(boolean pEnabledSitesOnly)
Sets EnabledSitesOnly boolean.

Parameters:
pEnabledSitesOnly - the boolean value to set

isActiveSitesOnly

public boolean isActiveSitesOnly()
Returns:
true if only active sites should be used for sitemap generation.

setActiveSitesOnly

public void setActiveSitesOnly(boolean pActiveSitesOnly)
Sets ActiveSitesOnly boolean.

Parameters:
pActiveSitesOnly - the boolean value to set

generateSitemaps

public void generateSitemaps()
This method is responsible for sitemap and siteindex generation.

Before generators are started, remove old items from SitemapRepository.

Iterate over the array of SitemapGenerator and invoke SitemapGenerator.generateSitemap() method. Each generator creates repository items of type sitemap.

After sitemap generators are done, SitemapGeneratorService invokes SitemapIndexGenerator. This component generates special repository item if type siteindex. This repository item contains of links to every sitemap was generated.


doScheduledTask

public void doScheduledTask(Scheduler pScheduler,
                            ScheduledJob pJob)
Generate sitemap and siteindex repository items by schedule.

Specified by:
doScheduledTask in class SingletonSchedulableService
Parameters:
pScheduler - scheduler instance
pJob - scheduled job

getSites

public java.util.List<java.lang.String> getSites()
Returns list of site IDs for which sitemaps should be generated

Returns:
the List of sites IDs