/*********************************************************************/ /* */ /* 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; using System.Reflection; namespace AgentService.Platform.Modules { /// /// Enum StorageActions. Defines all the /// possible requests that can be issued /// to the storage module. /// public enum StorageActions { /// /// Identifies the request of adding an /// assembly to the platform storage. /// AddAssembly, /// /// Identifies the request of copying an /// assembly from the storage /// CopyAssembly, /// /// Identifies the request of removing an /// assembly to the platform storage. /// RemoveAssembly, /// /// Identifies the request of a list of /// all the templates stored in the storage. /// QueryTemplates, /// /// Identifies the request of a list of /// assemblies stored in the storage. /// QueryAssemblies, /// /// Identifies the request of a list of /// all the knowledge types stored in the /// storage. /// QueryKnowledges, /// /// Identifies the request of a list of /// all the behaviour types stored in the /// storage. /// QueryBehaviours, /// /// Identifies the request of a type information /// abobut a given type. /// QueryType } /// /// Class StorageSinkEvent. Wraps all possible events /// that can be processed by the storage module. /// public class StorageSinkEvent : PlatformSinkEvent { /// /// action selected /// private StorageActions action; /// /// Gets, sets the selected action. /// public StorageActions Action { get { return this.action; } set { this.action = value; } } /// /// optional parameter /// private string param; /// /// Gets, sets the optional parameter /// used to process the event. /// public string Param { get { return this.param; } set { this.param = value; } } /// /// second optional parameter. Used only in CopyAssembly event to /// specify the path where to copy assembly /// private string param2; /// /// Gets, sets the optional second parameter /// used to process the event. /// public string Param2 { get { return this.param2; } set { this.param2 = value; } } /// /// array of type descriptor objects /// private TypeDescriptor[] types; /// /// Gets, sets the list of type descriptors. /// This field is not null when the event is /// related to QueryXXX (except QueryAssemblies) /// actions. /// public TypeDescriptor[] Types { get { return this.types; } set { this.types = value; } } /// /// list of assemblies hold by the /// storage. /// private AssemblyName[] assemblies; /// /// Gets, sets the list of assembly /// hold by the storage.(Not null only /// in case of a QueryAssemblies action). /// public AssemblyName[] Assemblies { get { return this.assemblies; } set { this.assemblies = value; } } /// /// Constructs a StorageSinkEvent instance for the copy assembly action. /// /// selected action /// parameter needed to perform the action: name of the assembly to copy /// parameter needed to perform the action: new path of the copied assembly public StorageSinkEvent(StorageActions action, string param, string param2) { this.action = action; this.param = param; this.param2 = param2; } /// /// Constructs a StorageSinkEvent instance. /// /// selected action /// parameter needed to perform the action public StorageSinkEvent(StorageActions action, string param) { this.action = action; this.param = param; } /// /// Constructs a StorageSinkEvent instance. /// /// selected action public StorageSinkEvent(StorageActions action) { this.action = action; } /// /// Gets a descriptor for this event. /// /// Descriptor of the event public static EventSinkDescriptor GetDescriptor() { EventSinkDescriptor descriptor = new EventSinkDescriptor("StorageSinkEvent", typeof(StorageSinkEvent)); return descriptor; } } }