001/* 002 * (C) Copyright 2006-20012 Nuxeo SAS (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 * Nuxeo - initial API and implementation 016 * 017 */ 018 019package org.nuxeo.template.samples.importer; 020 021import org.apache.commons.logging.Log; 022import org.apache.commons.logging.LogFactory; 023import org.nuxeo.ecm.core.api.CoreSession; 024import org.nuxeo.ecm.platform.content.template.service.PostContentCreationHandler; 025 026/** 027 * Called by the ContentTemplateService at repository init time to trigger the models and samples import 028 * 029 * @author <a href="mailto:tdelprat@nuxeo.com">Tiry</a> 030 */ 031public class InitListener implements PostContentCreationHandler { 032 033 protected final static Log log = LogFactory.getLog(InitListener.class); 034 035 @Override 036 public void execute(CoreSession session) { 037 ModelImporter importer = new ModelImporter(session); 038 int nbImportedDocs = importer.importModels(); 039 log.info("Template sample import done : " + nbImportedDocs + " documents imported"); 040 } 041 042}