/*********************************************************************/ /* */ /* 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.Xml; using System.Xml.Serialization; namespace AgentService.Install.XmlDataModel { /// /// Class XmlCoreInfo. Wrapper class /// for the XML tag lt;core /gt;. It /// Contains the information about /// the selected core modules. /// [Serializable] [XmlRoot(ElementName="core")] public class XmlCoreInfo : ICloneable { /// /// directory where the modules /// are stored. /// protected string binPath; /// /// Gets, set the directory where /// the modules are stored. /// [XmlAttribute(AttributeName="bin-path")] public string BinPath { get { return this.binPath; } set { this.binPath = value; } } /// /// directory where che configuration /// files of the modules are stored. /// protected string confPath; /// /// Gets, sets the directory where the /// configuration files of the modules /// are stored. /// [XmlAttribute(AttributeName="conf-path")] public string ConfPath { get { return this.confPath; } set { this.confPath = value; } } /// /// installation information for /// the platform storage module. /// protected XmlModuleInfo storage; /// /// Gets, sets the installation /// information for the platform /// storage module. /// [XmlElement(ElementName="storage")] public XmlModuleInfo Storage { get { return this.storage; } set { this.storage = value; } } /// /// installation information for /// the platform peristence module. /// protected XmlModuleInfo persistence; /// /// Gets, sets the installation /// information for the platform /// persistence module. /// [XmlElement(ElementName="persistence")] public XmlModuleInfo Persistence { get { return this.persistence; } set { this.persistence = value; } } /// /// installation information for /// the platform messaging module. /// protected XmlModuleInfo messaging; /// /// Gets, sets the installation /// information for the platform /// messaging module. /// [XmlElement(ElementName="messaging")] public XmlModuleInfo Messaging { get { return this.messaging; } set { this.messaging = value; } } /// /// installation information for /// the platform peristence module. /// protected XmlModuleInfo logging; /// /// Gets, sets the installation /// information for the platform /// logging module. /// [XmlElement(ElementName="logging")] public XmlModuleInfo Logging { get { return this.logging; } set { this.logging = value; } } /// /// Dummy default constructor used by /// the XML deserializer to create empty /// instances and the sets their properties /// reading them from the XML stream. /// public XmlCoreInfo() { this.storage = new XmlModuleInfo(); this.persistence = new XmlModuleInfo(); this.logging = new XmlModuleInfo(); this.messaging = new XmlModuleInfo(); } /// /// Constructs an instance of the XmlCoreInfo /// with the given parameters. /// /// platform storage installation information /// platform persistence installation information /// platform messaging installation information /// platform logging installation information public XmlCoreInfo(XmlModuleInfo storage, XmlModuleInfo persistence, XmlModuleInfo messaging, XmlModuleInfo logging) { this.storage = storage; this.persistence = persistence; this.messaging = messaging; this.logging = logging; } #region ICloneable Members /// /// Clones this instance of the XmlCoreInfo. /// /// identical copy of the instance public object Clone() { XmlCoreInfo clone = new XmlCoreInfo(this.storage.Clone() as XmlModuleInfo, this.persistence.Clone() as XmlModuleInfo, this.messaging.Clone() as XmlModuleInfo, this.logging.Clone() as XmlModuleInfo); clone.binPath = (this.binPath != null ? this.binPath.Clone() as string : null); clone.confPath = (this.confPath != null ? this.confPath.Clone() as string : null); return clone; } #endregion /// /// Compares the current instance with a /// given one. /// /// other instance /// true i the core modules of the two instances are the same public override bool Equals(object obj) { XmlCoreInfo core = obj as XmlCoreInfo; if (core != null) { return ((this.storage.Equals(core.storage) == true) && (this.persistence.Equals(core.persistence) == true) && (this.messaging.Equals(core.messaging) == true) && (this.logging.Equals(core.logging) == true)); } return false; } /// /// Gets the hash code for this XmlCoreInfo instance. /// /// base hash code funcation public override int GetHashCode() { return base.GetHashCode(); } } }