001/* 002 * (C) Copyright 2006-2008 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 * Nuxeo - initial API and implementation 016 * 017 * $Id$ 018 * 019 */ 020 021package org.nuxeo.ecm.platform.commandline.executor.api; 022 023import java.io.Serializable; 024 025/** 026 * Represents the availability status of a command. If command is not available, {@link CommandAvailability} contains 027 * the errorMessage and some installation instructions. 028 * 029 * @author tiry 030 */ 031public class CommandAvailability implements Serializable { 032 033 private static final long serialVersionUID = 1L; 034 035 protected final String installMessage; 036 037 protected final String errorMessage; 038 039 protected final boolean available; 040 041 public CommandAvailability(String installMessage, String errorMessage) { 042 available = false; 043 this.installMessage = installMessage; 044 this.errorMessage = errorMessage; 045 } 046 047 public CommandAvailability(String errorMessage) { 048 this(null, errorMessage); 049 } 050 051 public CommandAvailability() { 052 available = true; 053 installMessage = null; 054 errorMessage = null; 055 } 056 057 public String getInstallMessage() { 058 return installMessage; 059 } 060 061 public String getErrorMessage() { 062 return errorMessage; 063 } 064 065 public boolean isAvailable() { 066 return available; 067 } 068 069}