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 * bstefanescu, jcarsique 016 */ 017package org.nuxeo.connect.update.task.standalone; 018 019import java.io.File; 020import java.util.Map; 021 022import org.nuxeo.connect.update.LocalPackage; 023import org.nuxeo.connect.update.PackageException; 024import org.nuxeo.connect.update.PackageState; 025import org.nuxeo.connect.update.PackageUpdateService; 026 027/** 028 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a> 029 */ 030public class InstallTask extends CommandsTask { 031 032 public InstallTask(PackageUpdateService pus) { 033 super(pus); 034 } 035 036 @Override 037 public boolean isInstallTask() { 038 return true; 039 } 040 041 @Override 042 protected File getCommandsFile() throws PackageException { 043 return pkg.getInstallFile(); 044 } 045 046 @Override 047 protected void doRun(Map<String, String> params) throws PackageException { 048 try { 049 super.doRun(params); 050 } finally { 051 // generate the uninstall.xml file 052 File file = pkg.getData().getEntry(LocalPackage.UNINSTALL); 053 writeLog(file); 054 // No reload of components in standalone mode 055 } 056 } 057 058 @Override 059 protected void rollbackDone() throws PackageException { 060 service.setPackageState(pkg, PackageState.DOWNLOADED); 061 } 062 063 @Override 064 protected void taskDone() throws PackageException { 065 service.setPackageState(pkg, PackageState.STARTED); 066 } 067 068 @Override 069 protected void flush() throws PackageException { 070 // standalone mode: nothing to do 071 } 072 073}