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
_logger
private SiteManager
_siteManager
private Timer
_timer
private static String
BING_URL
private static String
EXECUTION_HOUR_PARAMETER
private static String
GOOGLE_URL
private static String
PING_ACTIVATED_SITE_PARAM
private static String
PING_SITEMAP_TIMER_NAME
static String
ROLE
Avalon roleprivate static String
SITEMAP_XML_PATH
-
Constructor Summary
Constructors Constructor Description PingSitemapTask()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
dispose()
void
enableLogging(Logger logger)
private CloseableHttpClient
getHttpClient()
private String
getSitemapUrl(Site site)
private void
handleResponse(String uri, HttpGet pingRrequest, org.apache.http.HttpResponse response)
void
initialize()
private void
pingSearchEngine(String searchEngineUrl, String sitemapUrl)
void
run()
void
service(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:
dispose
in interfaceDisposable
-
enableLogging
public void enableLogging(Logger logger)
- Specified by:
enableLogging
in interfaceLogEnabled
-
initialize
public void initialize() throws Exception
- Specified by:
initialize
in interfaceInitializable
- Throws:
Exception
-
service
public void service(ServiceManager manager) throws ServiceException
- Specified by:
service
in interfaceServiceable
- Throws:
ServiceException
-
-