001/* 002 * (C) Copyright 2011 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 * tdelprat 016 * 017 */ 018package org.nuxeo.wizard.helpers; 019 020import java.io.File; 021import java.io.IOException; 022 023import org.nuxeo.launcher.config.ConfigurationGenerator; 024import org.nuxeo.wizard.context.Context; 025import org.nuxeo.wizard.context.ParamCollector; 026 027public class PackageDownloaderHelper { 028 029 public static final String MARKER_FILE = "packageSelection.done"; 030 031 protected static File getMarkerFile(Context ctx) { 032 ParamCollector collector = ctx.getCollector(); 033 ConfigurationGenerator cg = collector.getConfigurationGenerator(); 034 File mpDir = cg.getDistributionMPDir(); 035 return new File(mpDir, MARKER_FILE); 036 } 037 038 public static void markPackageSelectionDone(Context ctx) throws IOException { 039 File marker = getMarkerFile(ctx); 040 marker.createNewFile(); 041 } 042 043 public static boolean isPackageSelectionDone(Context ctx) { 044 File marker = getMarkerFile(ctx); 045 return marker.exists(); 046 } 047 048}