84 lines
2.0 KiB
C#
84 lines
2.0 KiB
C#
|
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());
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
}
|