Feature added: Allow user to change the persistence location

This commit is contained in:
Jim Norman
2006-08-29 18:26:30 +00:00
parent bcc833a1bd
commit 24fdfe7f5e
17 changed files with 1111 additions and 117 deletions

View File

@@ -31,8 +31,18 @@ namespace Novell.CASA.CASAPolicy
{
public class ICASAPol
{
static string GetPolicyFilePath()
static string GetPolicyFilePath()
{
return GetPolicyFilePath(null);
}
static string GetPolicyFilePath(string sUserDir)
{
if (sUserDir != null)
{
return sUserDir + XmlConsts.policyFileName;
}
try
{
/* There needs to be a better way to get the HOME dir,
@@ -313,15 +323,21 @@ public class ICASAPol
return linkKey;
}
static public CASAPol GetPolicy(CASAPolType policyType)
static public CASAPol GetPolicy(CASAPolType policyType)
{
return GetPolicy(policyType, null);
}
static public CASAPol GetPolicy(CASAPolType policyType, string sDir)
{
CASAPol pol = null;
try
{
XmlDocument doc = new XmlDocument();
if(!File.Exists(GetPolicyFilePath()))
if(!File.Exists(GetPolicyFilePath(sDir)))
return null;
doc.Load(GetPolicyFilePath());
doc.Load(GetPolicyFilePath(sDir));
switch(policyType)
{
case CASAPolType.AGGREGATION_POL:
@@ -348,7 +364,7 @@ public class ICASAPol
}
catch(Exception e)
{
//Console.WriteLine(e.ToString());
System.Diagnostics.Trace.WriteLine("POLICY: " + e.ToString());
}
return pol;
}