Package org.ametys.web.robots
Class PingSitemapTask
- java.lang.Object
-
- java.util.TimerTask
-
- org.ametys.web.robots.PingSitemapTask
-
- All Implemented Interfaces:
Runnable,Disposable,Initializable,Component,LogEnabled,Serviceable
public class PingSitemapTask extends TimerTask implements Component, Initializable, LogEnabled, Serviceable, Disposable
Periodically ping three search engine : Google, Yahoo and Bing
-
-
Field Summary
Fields Modifier and Type Field Description private Logger_loggerprivate SiteManager_siteManagerprivate Timer_timerprivate static StringBING_URLprivate static StringEXECUTION_HOUR_PARAMETERprivate static StringGOOGLE_URLprivate static StringPING_ACTIVATED_SITE_PARAMprivate static StringPING_SITEMAP_TIMER_NAMEstatic StringROLEAvalon roleprivate static StringSITEMAP_XML_PATH
-
Constructor Summary
Constructors Constructor Description PingSitemapTask()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddispose()voidenableLogging(Logger logger)private CloseableHttpClientgetHttpClient()private StringgetSitemapUrl(Site site)private voidhandleResponse(String uri, HttpGet pingRrequest, org.apache.http.HttpResponse response)voidinitialize()private voidpingSearchEngine(String searchEngineUrl, String sitemapUrl)voidrun()voidservice(ServiceManager manager)-
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
-
-
-
-
Field Detail
-
EXECUTION_HOUR_PARAMETER
private static final String EXECUTION_HOUR_PARAMETER
- See Also:
- Constant Field Values
-
PING_SITEMAP_TIMER_NAME
private static final String PING_SITEMAP_TIMER_NAME
- See Also:
- Constant Field Values
-
PING_ACTIVATED_SITE_PARAM
private static final String PING_ACTIVATED_SITE_PARAM
- See Also:
- Constant Field Values
-
BING_URL
private static final String BING_URL
- See Also:
- Constant Field Values
-
GOOGLE_URL
private static final String GOOGLE_URL
- See Also:
- Constant Field Values
-
SITEMAP_XML_PATH
private static final String SITEMAP_XML_PATH
- See Also:
- Constant Field Values
-
_siteManager
private SiteManager _siteManager
-
-
Constructor Detail
-
PingSitemapTask
public PingSitemapTask()
-
-
Method Detail
-
getHttpClient
private CloseableHttpClient getHttpClient()
-
getSitemapUrl
private String getSitemapUrl(Site site)
-
handleResponse
private void handleResponse(String uri, HttpGet pingRrequest, org.apache.http.HttpResponse response)
-
pingSearchEngine
private void pingSearchEngine(String searchEngineUrl, String sitemapUrl) throws Exception
- Throws:
Exception
-
dispose
public void dispose()
- Specified by:
disposein interfaceDisposable
-
enableLogging
public void enableLogging(Logger logger)
- Specified by:
enableLoggingin interfaceLogEnabled
-
initialize
public void initialize() throws Exception
- Specified by:
initializein interfaceInitializable- Throws:
Exception
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
servicein interfaceServiceable- Throws:
ServiceException
-
-