107 lines
3.0 KiB
C#
107 lines
3.0 KiB
C#
/***********************************************************************
|
|
*
|
|
* Copyright (C) 2005-2006 Novell, Inc.
|
|
*
|
|
* 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
|
|
* Library 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., 675 Mass Ave, Cambridge, MA 02139, USA.
|
|
*
|
|
* To contact Novell about this file by physical or electronic mail,
|
|
* you may find current contact information at www.novell.com.
|
|
*
|
|
***********************************************************************/
|
|
|
|
using System;
|
|
using System.Collections;
|
|
using System.Xml;
|
|
using System.Xml.Serialization;
|
|
|
|
namespace Novell.CASA.CASAPolicy
|
|
{
|
|
public class PersistencePol : CASAPol
|
|
{
|
|
string os;
|
|
public string OS
|
|
{
|
|
get
|
|
{
|
|
return os;
|
|
}
|
|
}
|
|
string filePath;
|
|
public string FilePath
|
|
{
|
|
get
|
|
{
|
|
return filePath;
|
|
}
|
|
}
|
|
int pollInterval;
|
|
public int PollInterval
|
|
{
|
|
get
|
|
{
|
|
return pollInterval;
|
|
}
|
|
}
|
|
|
|
public PersistencePol(string osName,string path, int time)
|
|
{
|
|
policyType = CASAPolType.PERSISTENCE_POL;
|
|
os = osName;
|
|
filePath = path;
|
|
pollInterval = time;
|
|
}
|
|
|
|
public override void DumpPol()
|
|
{
|
|
Console.WriteLine("\nPersistent Policy");
|
|
Console.WriteLine("os = " + os);
|
|
Console.WriteLine("filePath = " + filePath);
|
|
Console.WriteLine("pollInterval = " + pollInterval);
|
|
}
|
|
internal override void AppendToDoc(XmlDocument doc)
|
|
{
|
|
XmlElement elem;
|
|
XmlAttribute attr;
|
|
string xPath = "";
|
|
try
|
|
{
|
|
xPath = "//" + XmlConsts.CASAPolicyNode;
|
|
XmlNode rootElem = doc.SelectSingleNode(xPath);
|
|
|
|
XmlElement persistPolElem = doc.CreateElement(XmlConsts.PersistencePolicyNode);
|
|
rootElem.AppendChild(persistPolElem);
|
|
|
|
elem = doc.CreateElement(XmlConsts.StoreFileLocationAttr);
|
|
elem.InnerText = filePath;
|
|
|
|
attr = doc.CreateAttribute(XmlConsts.OSAttr);
|
|
attr.Value = os;
|
|
elem.SetAttributeNode(attr);
|
|
|
|
persistPolElem.AppendChild(elem);
|
|
|
|
elem = doc.CreateElement(XmlConsts.PollIntervalNode);
|
|
elem.InnerText = pollInterval.ToString();
|
|
|
|
persistPolElem.AppendChild(elem);
|
|
}
|
|
catch(Exception e)
|
|
{
|
|
//Console.WriteLine(e.ToString());
|
|
}
|
|
}
|
|
}
|
|
}
|