View Javadoc
1   /*
2    * Copyright (C) 2003-2009 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.portal;
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.javascript.XJavascriptService;
24  import org.exoplatform.services.wcm.skin.XSkinService;
25  import org.exoplatform.services.wcm.utils.WCMCoreUtils;
26  
27  /**
28   * Created by The eXo Platform SAS
29   * Author : eXoPlatform
30   * benjamin.paillereau@exoplatform.com
31   * Nov 28, 2009
32   */
33  public class XScriptJob extends BaseJob {
34  
35    /** The log. */
36    private static final Log LOG = ExoLogger.getLogger(XScriptJob.class.getName());
37  
38    /* (non-Javadoc)
39     * @see org.exoplatform.services.scheduler.BaseJob#execute(org.exoplatform.services.scheduler.JobContext)
40     */
41    public void execute(JobContext arg0) throws Exception {
42      XJavascriptService jsService = WCMCoreUtils.getService(XJavascriptService.class);
43      XSkinService skinService = WCMCoreUtils.getService(XSkinService.class);
44      if(jsService == null || skinService == null) return;
45      try {
46        jsService.start();
47        skinService.start();
48      } catch (Exception e) {
49        if (LOG.isErrorEnabled()) {
50          LOG.error("Error when execute Javascript service updater", e);
51        }
52      }
53    }
54  }