001/*
002 *  Copyright 2010 Anyware Services
003 *
004 *  Licensed under the Apache License, Version 2.0 (the "License");
005 *  you may not use this file except in compliance with the License.
006 *  You may obtain a copy of the License at
007 *
008 *      http://www.apache.org/licenses/LICENSE-2.0
009 *
010 *  Unless required by applicable law or agreed to in writing, software
011 *  distributed under the License is distributed on an "AS IS" BASIS,
012 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 *  See the License for the specific language governing permissions and
014 *  limitations under the License.
015 */
016package org.ametys.web.content.consistency;
017
018
019/**
020 * Content consistency scheduler: launches a cron which generates a content consistency report on all the sites.
021 */
022public class ContentConsistencyScheduler extends org.ametys.cms.content.consistency.ContentConsistencyScheduler
023{
024    
025    @Override
026    public void run()
027    {
028        ContentConsistencyEngine contentConsistencyEngine = new ContentConsistencyEngine();
029        
030        try
031        {
032            // Initialize and configure the engine.
033            contentConsistencyEngine.initialize(_manager, _context, null);
034            contentConsistencyEngine.configure(_configuration);
035        }
036        catch (Exception e)
037        {
038            throw new RuntimeException("Unable to initialize the content consistency engine", e);
039        }
040        
041        // The thread will be started as daemon, as the scheduler is marked daemon itself.
042        new Thread(contentConsistencyEngine, "ContentConsistencyEngine").start();
043    }
044    
045}