001/*
002 * (C) Copyright 2015 Nuxeo SA (http://nuxeo.com/) and contributors.
003 *
004 * All rights reserved. This program and the accompanying materials
005 * are made available under the terms of the GNU Lesser General Public License
006 * (LGPL) version 2.1 which accompanies this distribution, and is available at
007 * http://www.gnu.org/licenses/lgpl-2.1.html
008 *
009 * This library is distributed in the hope that it will be useful,
010 * but WITHOUT ANY WARRANTY; without even the implied warranty of
011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
012 * Lesser General Public License for more details.
013 *
014 * Contributors:
015 *     Antoine Taillefer <ataillefer@nuxeo.com>
016 */
017package org.nuxeo.drive.service.impl;
018
019import org.nuxeo.drive.service.NuxeoDriveManager;
020import org.nuxeo.runtime.api.Framework;
021import org.nuxeo.runtime.reload.ReloadService;
022import org.nuxeo.runtime.services.event.Event;
023import org.nuxeo.runtime.services.event.EventListener;
024
025/**
026 * Runtime listener for handling reload of {@code changeFinder} contributions.
027 *
028 * @author Antoine Taillefer
029 * @see NuxeoDriveManagerImpl
030 * @since 7.3
031 */
032public class ChangeFinderReloadListener implements EventListener {
033
034    @Override
035    public void handleEvent(Event event) {
036        if (ReloadService.RELOAD_EVENT_ID.equals(event.getId())) {
037            NuxeoDriveManagerImpl nuxeoDriveManager = (NuxeoDriveManagerImpl) Framework.getService(NuxeoDriveManager.class);
038            nuxeoDriveManager.initChangeFinder();
039        }
040    }
041
042    @Override
043    public boolean aboutToHandleEvent(Event event) {
044        return false;
045    }
046
047}