001/* 002 * (C) Copyright 2009-2012 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.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 * Mariana Cedica 016 */ 017package org.nuxeo.ecm.platform.routing.core.listener; 018 019import org.nuxeo.ecm.core.api.CoreSession; 020import org.nuxeo.ecm.core.repository.RepositoryInitializationHandler; 021import org.nuxeo.ecm.platform.routing.api.DocumentRoutingService; 022import org.nuxeo.runtime.api.Framework; 023 024/** 025 * Imports route models in the root folder defined by the current persister from a contributed zip resource. Uses the IO 026 * core service, through @{link FileManager} 027 * 028 * @since 5.6 029 */ 030public class RouteModelsInitializator extends RepositoryInitializationHandler { 031 032 @Override 033 public void doInitializeRepository(CoreSession session) { 034 // This method gets called as a system user 035 // so we have all needed rights to do the check and the creation 036 DocumentRoutingService service = Framework.getLocalService(DocumentRoutingService.class); 037 service.importAllRouteModels(session); 038 session.save(); 039 } 040 041}