/*********************************************************************/ /* */ /* AgentService Framework */ /* www.agentservice.it */ /* */ /* Copyright (C) 2007 l.i.d.o. - DIST, University of Genoa, Italy */ /* GNU Lesser General Public License */ /* */ /* This library is free software; you can redistribute it and/or */ /* modify it under the terms of the GNU Lesser General Public */ /* License as published by the Free Software Foundation, */ /* version 2.1 of the License. */ /* */ /* This library is distributed in the hope that it will be useful, */ /* but WITHOUT ANY WARRANTY; without even the implied warranty of */ /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU */ /* Lesser General Public License for more details. */ /* */ /* You should have received a copy of the GNU Lesser General Public */ /* License along with this library; if not, write to the */ /* Free Software Foundation, Inc., 59 Temple Place - Suite 330, */ /* Boston, MA 02111-1307, USA. */ /* */ /*********************************************************************/ using System; namespace AgentService.Platform.Commands { /// /// Class PlatformCommand. Abstracts a command issued to a platform. /// public abstract class PlatformCommand { /// /// command level /// private PlatformState state; /// /// Gets the level of the command /// public PlatformState State { get { return this.state; } } /// /// stores the match exact flag /// private bool bMatchExact; /// /// Gets the command behaviour, if true the command can be /// executed if only if the state of the platform is the same /// of the one specified by the command, if false the specified /// command is a minimum requirement /// public bool MatchExact { get { return this.bMatchExact; } } /// /// Constructs a PlatformCommand object, with the state set to /// PlatformState.FailStart and the match exact flag to true. /// public PlatformCommand() { this.state = PlatformState.FailStart; this.bMatchExact = true; } /// /// Constructs a PlatformCommand object of the given type. /// /// state of the command /// if true the command requires exactly the given state public PlatformCommand(PlatformState state, bool bMatchExact) { this.state = state; this.bMatchExact = bMatchExact; } /// /// Performs the command task /// /// refence to the context object used by commands to perform their task public abstract void Execute(ICommandContext cmdCtx); /// /// Parse the string set up the command arguments /// /// /// true if the parsing has been successful public abstract bool ParseArguments(string args); } }