001/*
002 * (C) Copyright 2006-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 *     Nuxeo - initial API and implementation
016 *
017 */
018
019package org.nuxeo.runtime.deployment.preprocessor.install;
020
021import java.io.File;
022import java.util.HashMap;
023
024import org.nuxeo.common.utils.TextTemplate;
025
026/**
027 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a>
028 */
029public class CommandContextImpl extends HashMap<String, String> implements CommandContext {
030
031    private static final long serialVersionUID = 3020720283855802969L;
032
033    protected final File baseDir;
034
035    public CommandContextImpl(File baseDir) {
036        this.baseDir = baseDir;
037    }
038
039    @Override
040    public File getBaseDir() {
041        return baseDir;
042    }
043
044    @Override
045    public String expandVars(String text) {
046        return new TextTemplate(this).processText(text);
047    }
048
049}