View Javadoc
1   /*
2    * Copyright (C) 2003-2008 eXo Platform SAS.
3    *
4    * This program is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU Affero General Public License
6    * as published by the Free Software Foundation; either version 3
7    * of the License, or (at your option) any later version.
8    *
9    * This program is distributed in the hope that it will be useful,
10   * but WITHOUT ANY WARRANTY; without even the implied warranty of
11   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12   * GNU General Public License for more details.
13   *
14   * You should have received a copy of the GNU General Public License
15   * along with this program; if not, see<http://www.gnu.org/licenses/>.
16   */
17  package org.exoplatform.services.wcm.link;
18  
19  import org.exoplatform.services.log.ExoLogger;
20  import org.exoplatform.services.log.Log;
21  import org.exoplatform.services.scheduler.BaseJob;
22  import org.exoplatform.services.scheduler.JobContext;
23  import org.exoplatform.services.wcm.utils.WCMCoreUtils;
24  
25  /**
26   * Created by The eXo Platform SAS
27   * Author : Phan Le Thanh Chuong
28   *          chuong_phan@exoplatform.com
29   * Aug 4, 2008
30   */
31  public class LinkValidatorJob extends BaseJob {
32  
33    private static final Log LOG = ExoLogger.getLogger(LinkValidatorJob.class.getName());
34  
35    public void execute(JobContext arg0) throws Exception {
36      LiveLinkManagerService linkManagerService = WCMCoreUtils.getService(LiveLinkManagerService.class);
37      if(linkManagerService == null) return;
38      try {
39        linkManagerService.updateLinks();
40      } catch (Exception e) {
41        if (LOG.isErrorEnabled()) {
42          LOG.error("Error when execute link validator job by scheduler", e);
43        }
44      }
45    }
46  
47  }