net.sourceforge.openutils.mgnlrules.setup.RuleModuleVersionHandler Maven / Gradle / Ivy
/**
*
* Rules module for Magnolia CMS (http://www.openmindlab.com/lab/products/mgnlrules.html)
* Copyright(C) 2010-2013, Openmind S.r.l. http://www.openmindonline.it
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*/
package net.sourceforge.openutils.mgnlrules.setup;
import info.magnolia.init.MagnoliaConfigurationProperties;
import info.magnolia.module.InstallContext;
import info.magnolia.module.delta.Task;
import info.magnolia.objectfactory.Components;
import it.openutils.mgnltasks.SimpleModuleVersionHandler;
import java.util.ArrayList;
import java.util.List;
import org.apache.commons.lang.StringUtils;
/**
* @author dschivo
* @version $Id: RuleModuleVersionHandler.java 4307 2013-09-15 14:41:50Z fgiust $
*/
public class RuleModuleVersionHandler extends SimpleModuleVersionHandler
{
/**
* {@inheritDoc}
*/
@Override
protected List getStartupTasks(InstallContext installContext)
{
List tasks = new ArrayList();
tasks.add(new FilesExtractionTask()
{
/**
* {@inheritDoc}
*/
@Override
protected boolean accept(String resource)
{
return super.accept(resource) && StringUtils.contains(resource, "/WEB-INF/jsps/");
}
});
if (Components.getComponent(MagnoliaConfigurationProperties.class).getBooleanProperty(
"magnolia.bootstrap.samples"))
{
tasks.add(new FilesExtractionTask("Samples extraction", "Extracts jsp files for samples.")
{
/**
* {@inheritDoc}
*/
@Override
protected boolean accept(String resource)
{
return super.accept(resource) && StringUtils.contains(resource, "/samples-rules/");
}
});
}
return tasks;
}
}