001/* 002 * (C) Copyright 2006-2010 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 * bstefanescu 016 */ 017package org.nuxeo.connect.update.xml; 018 019import org.nuxeo.common.xmap.annotation.XNode; 020import org.nuxeo.common.xmap.annotation.XObject; 021import org.nuxeo.connect.update.model.TaskDefinition; 022import org.nuxeo.connect.update.task.Task; 023 024/** 025 * Describe an install / uninstall task 026 * 027 * @author <a href="mailto:bs@nuxeo.com">Bogdan Stefanescu</a> 028 */ 029@XObject 030public class TaskDefinitionImpl implements TaskDefinition { 031 032 /** 033 * A class implementing {@link Task} 034 */ 035 @XNode("@class") 036 protected String type; 037 038 /** 039 * Whether the platform must be restarted after executing the task. 040 */ 041 @XNode("@restart") 042 protected boolean restart; 043 044 public TaskDefinitionImpl() { 045 } 046 047 public TaskDefinitionImpl(boolean restart) { 048 this.restart = restart; 049 } 050 051 public TaskDefinitionImpl(String type, boolean restart) { 052 this.type = type; 053 this.restart = restart; 054 } 055 056 public void setRequireRestart(boolean isRestartRequired) { 057 restart = isRestartRequired; 058 } 059 060 public boolean getRequireRestart() { 061 return restart; 062 } 063 064 public void setType(String type) { 065 this.type = type; 066 } 067 068 public String getType() { 069 return type; 070 } 071 072 @Override 073 public String toString() { 074 return type; 075 } 076}