major source structure and module name changes

This commit is contained in:
soochoi
2006-06-07 16:34:19 +00:00
parent 5c75241b4b
commit 1fa6f07e83
651 changed files with 0 additions and 0 deletions

124
policy/AggregationPol.cs Normal file
View File

@@ -0,0 +1,124 @@
/***********************************************************************
*
* Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved.
*
* 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 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, Novell, Inc.
*
* 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 Store
{
string storeName;
public string StoreName
{
get
{
return storeName;
}
set
{
storeName = value;
}
}
string storeId;
public string StoreId
{
get
{
return storeId;
}
set
{
storeId = value;
}
}
public Store(string name,string id)
{
storeId = id;
storeName = name;
}
}
public class AggregationPol : CASAPol
{
ArrayList storeList;
public ArrayList StoreList
{
get
{
return storeList;
}
}
public AggregationPol(ArrayList stores)
{
policyType = CASAPolType.AGGREGATION_POL;
storeList = stores;
}
public override void DumpPol()
{
Console.WriteLine("\nAggregation Policy");
IEnumerator enumerator = storeList.GetEnumerator();
while(enumerator.MoveNext())
{
Console.WriteLine("StoreName = " + ((Store)(enumerator.Current)).StoreName + " StoreId = " + ((Store)(enumerator.Current)).StoreId);
}
}
internal override void AppendToDoc(XmlDocument doc)
{
try
{
XmlElement storeElem;
XmlAttribute storeNameAttr;
XmlAttribute storeIdAttr;
string xPath = "";
xPath = "//" + XmlConsts.CASAPolicyNode;
XmlNode rootElem = doc.SelectSingleNode(xPath);
XmlElement aggPolElem = doc.CreateElement(XmlConsts.AggregationPolicyNode);
rootElem.AppendChild(aggPolElem);
IEnumerator enumerator = storeList.GetEnumerator();
while(enumerator.MoveNext())
{
storeElem = doc.CreateElement(XmlConsts.StoreAttr);
storeNameAttr = doc.CreateAttribute(XmlConsts.StoreNameAttr);
storeNameAttr.Value = ((Store)(enumerator.Current)).StoreName;
storeElem.SetAttributeNode(storeNameAttr);
storeIdAttr = doc.CreateAttribute(XmlConsts.StoreIdAttr);
storeIdAttr.Value = ((Store)(enumerator.Current)).StoreId;
storeElem.SetAttributeNode(storeIdAttr);
aggPolElem.AppendChild(storeElem);
}
}
catch(Exception e)
{
//Console.WriteLine(e.ToString());
}
}
}
}

80
policy/AssemblyInfo.cs Normal file
View File

@@ -0,0 +1,80 @@
/***********************************************************************
*
* Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved.
*
* 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 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, Novell, Inc.
*
* To contact Novell about this file by physical or electronic mail,
* you may find current contact information at www.novell.com.
*
***********************************************************************/
using System.Reflection;
using System.Runtime.CompilerServices;
//
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
//
[assembly: AssemblyTitle("Novell.CASA.CASAPolicy.dll")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Novell, Inc")]
[assembly: AssemblyProduct("CASA")]
[assembly: AssemblyCopyright("")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
//
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.6.*")]
//
// In order to sign your assembly you must specify a key to use. Refer to the
// Microsoft .NET Framework documentation for more information on assembly signing.
//
// Use the attributes below to control which key is used for signing.
//
// Notes:
// (*) If no key is specified, the assembly is not signed.
// (*) KeyName refers to a key that has been installed in the Crypto Service
// Provider (CSP) on your machine. KeyFile refers to a file which contains
// a key.
// (*) If the KeyFile and the KeyName values are both specified, the
// following processing occurs:
// (1) If the KeyName can be found in the CSP, that key is used.
// (2) If the KeyName does not exist and the KeyFile does exist, the key
// in the KeyFile is installed into the CSP and used.
// (*) In order to create a KeyFile, you can use the sn.exe (Strong Name) utility.
// When specifying the KeyFile, the location of the KeyFile should be
// relative to the project output directory which is
// %Project Directory%\obj\<configuration>. For example, if your KeyFile is
// located in the project directory, you would specify the AssemblyKeyFile
// attribute as [assembly: AssemblyKeyFile("..\\..\\mykey.snk")]
// (*) Delay Signing is an advanced option - see the Microsoft .NET Framework
// documentation for more information on this.
//
[assembly: AssemblyDelaySign(false)]
[assembly: AssemblyKeyFile("")]
[assembly: AssemblyKeyName("")]

107
policy/Makefile.am Normal file
View File

@@ -0,0 +1,107 @@
#######################################################################
#
# Copyright (C) 2006 Novell, Inc.
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation; either
# version 2 of the License, or (at your option) any later version.
#
# This program 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
# General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#
#
#######################################################################
if DEBUG
TARGET_CFG = Debug
CFLAGS += -v -w
CS_EXTRA_FLAGS = $(CSCFLAGS_DEBUG)
else
TARGET_CFG = Release
endif
SUBDIRS =
DIST_SUBDIRS =
EXTRA_DIST = *.cs $(CSFILES)
CASAROOT = ..
CASALIBDIR = $(CASAROOT)/$(LIB)
# handle Mono secondary dependencies
export MONO_PATH := $(MONO_PATH)
PLATFORMINDEPENDENTSOURCEDIR =
PLATFORMDEPENDENTSOURCEDIR = .
MODULE_NAME =Novell.CASA.CASAPolicy
MODULE_EXT =dll
CSFILES = $(srcdir)/AssemblyInfo.cs \
$(srcdir)/Policy.cs \
$(srcdir)/PolicyImpl.cs \
$(srcdir)/PolicyConstants.cs \
$(srcdir)/AggregationPol.cs \
$(srcdir)/PersistencePol.cs \
$(srcdir)/UIPol.cs \
$(srcdir)/SynchPol.cs
CSFILES_CSC := $(subst /,$(SEP),$(CSFILES))
CS_FLAGS = $(CSC_LIBFLAG)
CS_RESOURCES =
CS_LIBS =
CS_LIBPATH =
OBJDIR = ./$(TARGET_CFG)/$(LIB)
#OBJS = $(addprefix $(OBJDIR)/, $(CSFILES:%.dll=%.cs))
CUR_DIR := $(shell pwd)
all: $(OBJDIR)/$(MODULE_NAME).$(MODULE_EXT)
#
# Pattern based rules.
#
vpath %.c $(PLATFORMDEPENDENTSOURCEDIR) $(PLATFORMINDEPENDENTSOURCEDIR)
vpath %.cpp $(PLATFORMDEPENDENTSOURCEDIR) $(PLATFORMINDEPENDENTSOURCEDIR)
vpath %.cs $(PLATFORMDEPENDENTSOURCEDIR) $(PLATFORMINDEPENDENTSOURCEDIR)
$(OBJDIR)/$(MODULE_NAME).$(MODULE_EXT): $(OBJDIR) $(CSFILES)
$(CSC) $(CS_FLAGS) $(CS_EXTRA_FLAGS) -out:$@ $(CSFILES_CSC)
cp -f $(OBJDIR)/$(MODULE_NAME).$(MODULE_EXT) $(CASALIBDIR)/$(TARGET_CFG)/$(MODULE_NAME).$(MODULE_EXT)
$(OBJDIR):
[ -d $(OBJDIR) ] || mkdir -p $(OBJDIR)
[ -d $(CASALIBDIR) ] || mkdir -p $(CASALIBDIR)
[ -d $(CASALIBDIR)/$(TARGET_CFG) ] || mkdir -p $(CASALIBDIR)/$(TARGET_CFG)
install-exec-local: $(OBJDIR)/$(MODULE_NAME).$(MODULE_EXT)
$(mkinstalldirs) $(DESTDIR)$(libdir)
$(INSTALL_PROGRAM) $(OBJDIR)/$(MODULE_NAME).$(MODULE_EXT) $(DESTDIR)$(libdir)/
uninstall-local:
cd $(DESTDIR)$(libdir); rm -f $(OBJDIR)/$(MODULE_NAME).$(MODULE_EXT)
rmdir $(DESTDIR)$(libdir)
#installcheck-local: install
# $(mkinstalldirs) $(DESTDIR)$(libdir)
# $(INSTALL_PROGRAM) $(DESTDIR)$(libdir)
# cd $(DESTDIR)$(libdir); $(MONO)
clean-local:
if [ -d $(TARGET_CFG) ]; then rm -rf $(TARGET_CFG); fi
distclean-local:
maintainer-clean-local:
rm -f Makefile.in

View File

@@ -0,0 +1,135 @@
<VisualStudioProject>
<CSHARP
ProjectType = "Local"
ProductVersion = "7.10.3077"
SchemaVersion = "2.0"
ProjectGuid = "{636A9D7E-BFB5-4EB9-96F8-51FF85A98826}"
>
<Build>
<Settings
ApplicationIcon = ""
AssemblyKeyContainerName = ""
AssemblyName = "Novell.CASA.CASAPol"
AssemblyOriginatorKeyFile = ""
DefaultClientScript = "JScript"
DefaultHTMLPageLayout = "Grid"
DefaultTargetSchema = "IE50"
DelaySign = "false"
OutputType = "Library"
PreBuildEvent = ""
PostBuildEvent = ""
RootNamespace = "Novell.CASA.CASAPol"
RunPostBuildEvent = "OnBuildSuccess"
StartupObject = ""
>
<Config
Name = "Debug"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "DEBUG;TRACE"
DocumentationFile = ""
DebugSymbols = "true"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "false"
OutputPath = "bin\Debug\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
<Config
Name = "Release"
AllowUnsafeBlocks = "false"
BaseAddress = "285212672"
CheckForOverflowUnderflow = "false"
ConfigurationOverrideFile = ""
DefineConstants = "TRACE"
DocumentationFile = ""
DebugSymbols = "false"
FileAlignment = "4096"
IncrementalBuild = "false"
NoStdLib = "false"
NoWarn = ""
Optimize = "true"
OutputPath = "bin\Release\"
RegisterForComInterop = "false"
RemoveIntegerChecks = "false"
TreatWarningsAsErrors = "false"
WarningLevel = "4"
/>
</Settings>
<References>
<Reference
Name = "System"
AssemblyName = "System"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.dll"
/>
<Reference
Name = "System.XML"
AssemblyName = "System.Xml"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.XML.dll"
/>
<Reference
Name = "System.Data"
AssemblyName = "System.Data"
HintPath = "C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\System.Data.dll"
/>
</References>
</Build>
<Files>
<Include>
<File
RelPath = "AggregationPol.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "AssemblyInfo.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "PersistencePol.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Policy.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "PolicyConstants.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "PolicyImpl.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "SynchPol.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "Test.cs"
SubType = "Code"
BuildAction = "Compile"
/>
<File
RelPath = "UIPol.cs"
SubType = "Code"
BuildAction = "Compile"
/>
</Include>
</Files>
</CSHARP>
</VisualStudioProject>

View File

@@ -0,0 +1,48 @@
<VisualStudioProject>
<CSHARP LastOpenVersion = "7.10.3077" >
<Build>
<Settings ReferencePath = "" >
<Config
Name = "Debug"
EnableASPDebugging = "false"
EnableASPXDebugging = "false"
EnableUnmanagedDebugging = "false"
EnableSQLServerDebugging = "false"
RemoteDebugEnabled = "false"
RemoteDebugMachine = ""
StartAction = "Project"
StartArguments = ""
StartPage = ""
StartProgram = ""
StartURL = ""
StartWorkingDirectory = ""
StartWithIE = "true"
/>
<Config
Name = "Release"
EnableASPDebugging = "false"
EnableASPXDebugging = "false"
EnableUnmanagedDebugging = "false"
EnableSQLServerDebugging = "false"
RemoteDebugEnabled = "false"
RemoteDebugMachine = ""
StartAction = "Project"
StartArguments = ""
StartPage = ""
StartProgram = ""
StartURL = ""
StartWorkingDirectory = ""
StartWithIE = "true"
/>
</Settings>
</Build>
<OtherProjectSettings
CopyProjectDestinationFolder = ""
CopyProjectUncPath = ""
CopyProjectOption = "0"
ProjectView = "ProjectFiles"
ProjectTrust = "0"
/>
</CSHARP>
</VisualStudioProject>

105
policy/PersistencePol.cs Normal file
View File

@@ -0,0 +1,105 @@
/***********************************************************************
*
* Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved.
*
* 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 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, Novell, Inc.
*
* 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());
}
}
}
}

52
policy/Policy.cs Normal file
View File

@@ -0,0 +1,52 @@
/***********************************************************************
*
* Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved.
*
* 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 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, Novell, Inc.
*
* 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 enum CASAPolType
{
AGGREGATION_POL = 1,
PERSISTENCE_POL,
UI_POL,
SYNCH_POL
}
public abstract class CASAPol
{
protected CASAPolType policyType;
public CASAPolType PolicyType
{
get
{
return policyType;
}
}
abstract internal void AppendToDoc(XmlDocument doc);
abstract public void DumpPol();
}
}

59
policy/PolicyConstants.cs Normal file
View File

@@ -0,0 +1,59 @@
/***********************************************************************
*
* Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved.
*
* 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 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, Novell, Inc.
*
* To contact Novell about this file by physical or electronic mail,
* you may find current contact information at www.novell.com.
*
***********************************************************************/
using System;
namespace Novell.CASA.CASAPolicy
{
class XmlConsts
{
internal static string policyFileName = "/.CASAPolicy.xml";
internal static string MicasaStoreName = "miCASA";
internal static string KwalletStoreName = "Kwallet";
internal static string GnomeKeyringStoreName = "Gnome-Keyring";
internal static string FirefoxStoreName = "Firefox";
internal static string MozillaStoreName = "Mozilla";
internal static string CASAPolicyNode = "CASAPolicy";
internal static string AggregationPolicyNode = "AggregationPolicy";
internal static string PersistencePolicyNode = "PersistencePolicy";
internal static string UIPolicyNode = "UIPolicy";
internal static string SynchPolicyNode = "SynchPolicy";
internal static string StoreAttr = "Store";
internal static string StoreNameAttr = "StoreName";
internal static string StoreIdAttr = "StoreId";
internal static string FolderIdAttr = "FolderId";
internal static string SecretIdAttr = "SecretId";
internal static string KeyAttr = "Key";
internal static string StoreFileLocationAttr = "StoreFileLocation";
internal static string OSAttr = "OS";
internal static string PollIntervalNode = "PollInterval";
internal static string ShowInTaskBarAttr = "ShowInTaskBar";
internal static string ShowSecretValueAttr = "ShowSecretValue";
internal static string ShowSecretInClearTextAttr = "ShowSecretInClearText";
internal static string SynchEngineStartModeNode = "SynchEngineStartMode";
internal static string LinkKeyNode = "LinkKey";
internal static string LinkNode = "Link";
internal static string LinkGroupNode = "LinkGroup";
}
}

409
policy/PolicyImpl.cs Normal file
View File

@@ -0,0 +1,409 @@
/***********************************************************************
*
* Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved.
*
* 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 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, Novell, Inc.
*
* 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;
using System.IO;
using System.Text;
namespace Novell.CASA.CASAPolicy
{
public class ICASAPol
{
static string GetPolicyFilePath()
{
try
{
/* There needs to be a better way to get the HOME dir,
* if this is used by miCASAd(as it runs as root).
*/
int platform = (int)Environment.OSVersion.Platform;
string homeDir;
if ( (platform == 128) || ( platform == 4) )
{
homeDir = System.Environment.GetEnvironmentVariable("HOME");
}
else
{
homeDir = (System.Environment.GetEnvironmentVariable("USERPROFILE"));
}
string path = homeDir + XmlConsts.policyFileName;
return path;
}
catch(Exception e)
{
//Console.WriteLine(e.ToString());
}
return "";
}
static public CASAPol[] GetPolicies()
{
try
{
if(!File.Exists(GetPolicyFilePath()))
return null;
CASAPol[] policies = new CASAPol[4];
policies[0] = GetPolicy(CASAPolType.AGGREGATION_POL);
policies[1] = GetPolicy(CASAPolType.PERSISTENCE_POL);
policies[2] = GetPolicy(CASAPolType.UI_POL);
policies[3] = GetPolicy(CASAPolType.SYNCH_POL);
return policies;
}
catch(Exception e)
{
//Console.WriteLine(e.ToString());
}
return null;
}
static public bool SetPolicies(CASAPol[] polList)
{
try
{
XmlDocument doc = new XmlDocument();
XmlElement rootElem = doc.CreateElement(XmlConsts.CASAPolicyNode);
doc.AppendChild(rootElem);
for(int i = 0; i < polList.Length; i++)
{
if(polList[i] != null)
polList[i].AppendToDoc(doc);
}
/*
FileStream fs = new FileStream(GetPolicyFilePath(),FileMode.Create);
XmlTextWriter writer = new XmlTextWriter(fs,null);
writer.Formatting = Formatting.Indented;
doc.Save(writer);
fs.Close();
writer.Close();
*/
XmlTextWriter writer = new XmlTextWriter(GetPolicyFilePath(),null);
writer.Formatting = Formatting.Indented;
doc.Save(writer);
writer.Close();
return true;
}
catch(Exception e)
{
//Console.WriteLine(e.ToString());
}
return false;
}
static private AggregationPol GetAggPol(XmlDocument doc)
{
string xpath = "";
try
{
xpath = "//" + XmlConsts.AggregationPolicyNode;
XmlNode aggNode = doc.SelectSingleNode(xpath);
Store store = null;
ArrayList storeList = new ArrayList();
if( null != aggNode )
{
XmlNodeList storeNodeList = aggNode.SelectNodes("descendant::Store");
foreach( XmlNode node in storeNodeList )
{
XmlAttributeCollection attrList = node.Attributes;
string storeName = (attrList[XmlConsts.StoreNameAttr]).Value;
attrList = node.Attributes;
string storeId = (attrList[XmlConsts.StoreIdAttr]).Value;
store = new Store(storeName, storeId);
storeList.Add(store);
}
AggregationPol aggPol = new AggregationPol(storeList);
return aggPol;
}
}
catch(Exception e)
{
//Console.WriteLine(e.ToString());
}
return null;
}
static private PersistencePol GetPersistencePol(XmlDocument doc)
{
string xpath = "";
try
{
xpath = "//" + XmlConsts.PersistencePolicyNode;
XmlNode persistenceNode = doc.SelectSingleNode(xpath);
if( null != persistenceNode )
{
xpath = "//" + XmlConsts.StoreFileLocationAttr;
XmlNode storeFileLocationNode = persistenceNode.SelectSingleNode(xpath);
string storeFileLocation = storeFileLocationNode.InnerText;
XmlAttributeCollection attrColl = storeFileLocationNode.Attributes;
string os = (attrColl[XmlConsts.OSAttr]).Value;
xpath = "//" + XmlConsts.PollIntervalNode;
XmlNode pollIntervalNode = persistenceNode.SelectSingleNode(xpath);
int pollInterval = Convert.ToInt32(pollIntervalNode.InnerText);
PersistencePol persistencePol = new PersistencePol(os,storeFileLocation, pollInterval);
return persistencePol;
}
}
catch(Exception e)
{
//Console.WriteLine(e.ToString());
}
return null;
}
static private UIPol GetUIPol(XmlDocument doc)
{
string xpath = "";
try
{
xpath = "//" + XmlConsts.UIPolicyNode;
XmlNode uiNode = doc.SelectSingleNode(xpath);
if( null != uiNode )
{
XmlAttributeCollection attrColl = uiNode.Attributes;
bool showInTaskBar = Convert.ToBoolean((attrColl[XmlConsts.ShowInTaskBarAttr]).Value);
bool showSecretValue = Convert.ToBoolean((attrColl[XmlConsts.ShowSecretValueAttr]).Value);
bool showSecretInClearText = Convert.ToBoolean((attrColl[XmlConsts.ShowSecretInClearTextAttr]).Value);
xpath = "//" + XmlConsts.SynchEngineStartModeNode;
XmlNode modeNode = uiNode.SelectSingleNode(xpath);
string mode = modeNode.InnerText;
UIPol uiPol = new UIPol(showInTaskBar, showSecretValue, showSecretInClearText, mode);
return uiPol;
}
}
catch(Exception e)
{
//Console.WriteLine(e.ToString());
}
return null;
}
static private SynchPol GetSynchPol(XmlDocument doc)
{
SynchPol synchPol = null;
ArrayList linkGrpList = new ArrayList();
ArrayList linksList = new ArrayList();
ArrayList linkKeyList;// = new ArrayList();
LinkKey linkKey = null;
Link link = null;
LinkGroup linkGrp = null;
try
{
XmlNode synchNode = doc.SelectSingleNode("//SynchPolicy");
if( null != synchNode )
{
XmlNodeList grpNodeList = synchNode.SelectNodes("descendant::LinkGroup");
foreach( XmlNode node in grpNodeList )
{
XmlNodeList linkNodeList = node.SelectNodes("descendant::Link");
foreach( XmlNode linkNode in linkNodeList )
{
XmlNodeList linkKeyNodeList = linkNode.SelectNodes("descendant::LinkKey");
linkKeyList = new ArrayList();
foreach( XmlNode linkKeyNode in linkKeyNodeList )
{
linkKey = GetLinkKey(linkKeyNode);
linkKeyList.Add(linkKey);
}
link = new Link(linkKeyList);
linksList.Add(link);
}//end of linkNodeList loop
linkGrp = new LinkGroup(linksList);
linkGrpList.Add(linkGrp);
}//end of grpNodeList loop
synchPol = new SynchPol(linkGrpList);
}
}
catch(Exception e)
{
//Console.WriteLine(e.ToString());
}
return synchPol;
}
static private LinkKey GetLinkKey(XmlNode keyNode)
{
LinkKey linkKey = null;
try
{
XmlAttributeCollection attrList = keyNode.Attributes;
string storeName = (attrList[XmlConsts.StoreNameAttr]).Value;
string storeId = (attrList[XmlConsts.StoreIdAttr]).Value;
string secretId = (attrList[XmlConsts.SecretIdAttr]).Value;
string keyId = (attrList[XmlConsts.KeyAttr]).Value;
string folderId;
if(storeName == XmlConsts.KwalletStoreName)
{
folderId = (attrList[XmlConsts.FolderIdAttr]).Value;
linkKey = new KWLinkKey(storeId,folderId,secretId,keyId);
}
else if(storeName == XmlConsts.GnomeKeyringStoreName)
{
linkKey = new GKLinkKey(storeId,secretId,keyId);
}
else if(storeName == XmlConsts.MozillaStoreName)
{
linkKey = new MZLinkKey(storeId,secretId,keyId);
}
else if(storeName == XmlConsts.FirefoxStoreName)
{
linkKey = new FXLinkKey(storeId,secretId,keyId);
}
else if(storeName == XmlConsts.MicasaStoreName)
{
linkKey = new CASALinkKey(secretId,keyId);
}
}
catch(Exception e)
{
//Console.WriteLine(e.ToString());
}
return linkKey;
}
static public CASAPol GetPolicy(CASAPolType policyType)
{
CASAPol pol = null;
try
{
XmlDocument doc = new XmlDocument();
if(!File.Exists(GetPolicyFilePath()))
return null;
doc.Load(GetPolicyFilePath());
switch(policyType)
{
case CASAPolType.AGGREGATION_POL:
{
pol = GetAggPol(doc);
break;
}
case CASAPolType.PERSISTENCE_POL:
{
pol = GetPersistencePol(doc);
break;
}
case CASAPolType.UI_POL:
{
pol = GetUIPol(doc);
break;
}
case CASAPolType.SYNCH_POL:
{
pol = GetSynchPol(doc);
break;
}
}
}
catch(Exception e)
{
//Console.WriteLine(e.ToString());
}
return pol;
}
static public bool SetPolicy(CASAPol policy)
{
try
{
XmlDocument doc = new XmlDocument();
if(File.Exists(GetPolicyFilePath()))
doc.Load(GetPolicyFilePath());
CASAPolType policyType = policy.PolicyType;
AggregationPol aggPol = null;
PersistencePol persistencePol = null;
UIPol uiPol = null;
SynchPol synchPol = null;
switch(policyType)
{
case CASAPolType.AGGREGATION_POL:
{
persistencePol = GetPersistencePol(doc);
uiPol = GetUIPol(doc);
synchPol = GetSynchPol(doc);
aggPol = (AggregationPol)policy;
break;
}
case CASAPolType.PERSISTENCE_POL:
{
aggPol = GetAggPol(doc);
uiPol = GetUIPol(doc);
synchPol = GetSynchPol(doc);
persistencePol = (PersistencePol)policy;
break;
}
case CASAPolType.UI_POL:
{
aggPol = GetAggPol(doc);
persistencePol = GetPersistencePol(doc);
synchPol = GetSynchPol(doc);
uiPol = (UIPol)policy;
break;
}
case CASAPolType.SYNCH_POL:
{
aggPol = GetAggPol(doc);
persistencePol = GetPersistencePol(doc);
uiPol = GetUIPol(doc);
synchPol = (SynchPol)policy;
break;
}
}
CASAPol[] policies = new CASAPol[4];
policies[0] = aggPol;
policies[1] = persistencePol;
policies[2] = uiPol;
policies[3] = synchPol;
SetPolicies(policies);
return true;
}
catch(Exception e)
{
//Console.WriteLine(e.ToString());
}
return false;
}
/* Should we support this? TBD later if required.
*/
static public bool RemovePolicy(CASAPolType policyType, CASAPol policy)
{
return true;
}
}
}

481
policy/SynchPol.cs Normal file
View File

@@ -0,0 +1,481 @@
/***********************************************************************
*
* Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved.
*
* 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 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, Novell, Inc.
*
* 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 enum StoreKeyType
{
KW_KEY = 1,
GK_KEY,
MZ_KEY,
FX_KEY,
CASA_KEY
}
abstract public class LinkKey
{
protected StoreKeyType keyType;
public StoreKeyType KeyType
{
get
{
return keyType;
}
}
protected string storeName;
public string StoreName
{
get
{
return storeName;
}
set
{
storeName = value;
}
}
protected string storeId;
public string StoreId
{
get
{
return storeId;
}
set
{
storeId = value;
}
}
protected string secretId;
public string SecretId
{
get
{
return secretId;
}
set
{
secretId = value;
}
}
protected string keyId;
public string KeyId
{
get
{
return keyId;
}
set
{
keyId = value;
}
}
abstract public void AppendToDoc(XmlDocument doc, XmlElement linkKeyElem);
abstract public void Dump();
}
public class KWLinkKey : LinkKey
{
string folderId;
public string FolderId
{
get
{
return folderId;
}
set
{
folderId = value;
}
}
public KWLinkKey(string wallet, string folder,string secret,string key)
{
keyType = StoreKeyType.KW_KEY;
storeName = XmlConsts.KwalletStoreName;
storeId = wallet;
folderId = folder;
secretId = secret;
keyId = key;
}
public override void Dump()
{
Console.WriteLine("StoreName = " + storeName + " StoreId = " + storeId + " FolderId = " + folderId + " SecretId = " + secretId + " Key = " + keyId);
}
public override void AppendToDoc(XmlDocument doc, XmlElement linkKeyElem)
{
XmlAttribute attr;
try
{
attr = doc.CreateAttribute(XmlConsts.StoreNameAttr);
attr.Value = storeName;
linkKeyElem.SetAttributeNode(attr);
attr = doc.CreateAttribute(XmlConsts.StoreIdAttr);
attr.Value = storeId;
linkKeyElem.SetAttributeNode(attr);
attr = doc.CreateAttribute(XmlConsts.FolderIdAttr);
attr.Value = folderId;
linkKeyElem.SetAttributeNode(attr);
attr = doc.CreateAttribute(XmlConsts.SecretIdAttr);
attr.Value = secretId;
linkKeyElem.SetAttributeNode(attr);
attr = doc.CreateAttribute(XmlConsts.KeyAttr);
attr.Value = keyId;
linkKeyElem.SetAttributeNode(attr);
}
catch(Exception e)
{
//Console.WriteLine(e.ToString());
}
}
}
public class GKLinkKey : LinkKey
{
public GKLinkKey(string keyring, string secret, string key)
{
keyType = StoreKeyType.GK_KEY;
storeName = XmlConsts.GnomeKeyringStoreName;
storeId = keyring;
secretId = secret;
keyId = key;
}
public override void Dump()
{
Console.WriteLine("StoreName = " + storeName + " StoreId = " + storeId + " SecretId = " + secretId + " Key = " + keyId);
}
public override void AppendToDoc(XmlDocument doc, XmlElement linkKeyElem)
{
XmlAttribute attr;
try
{
attr = doc.CreateAttribute(XmlConsts.StoreNameAttr);
attr.Value = storeName;
linkKeyElem.SetAttributeNode(attr);
attr = doc.CreateAttribute(XmlConsts.StoreIdAttr);
attr.Value = storeId;
linkKeyElem.SetAttributeNode(attr);
attr = doc.CreateAttribute(XmlConsts.SecretIdAttr);
attr.Value = secretId;
linkKeyElem.SetAttributeNode(attr);
attr = doc.CreateAttribute(XmlConsts.KeyAttr);
attr.Value = keyId;
linkKeyElem.SetAttributeNode(attr);
}
catch(Exception e)
{
//Console.WriteLine(e.ToString());
}
}
}
public class MZLinkKey : LinkKey
{
public MZLinkKey(string profile, string url, string key)
{
keyType = StoreKeyType.MZ_KEY;
storeName = XmlConsts.MozillaStoreName;
storeId = profile;
secretId = url;
keyId = key;
}
public override void Dump()
{
Console.WriteLine("StoreName = " + storeName + " StoreId = " + storeId + " SecretId = " + secretId + " Key = " + keyId);
}
public override void AppendToDoc(XmlDocument doc, XmlElement linkKeyElem)
{
XmlAttribute attr;
try
{
attr = doc.CreateAttribute(XmlConsts.StoreNameAttr);
attr.Value = storeName;
linkKeyElem.SetAttributeNode(attr);
attr = doc.CreateAttribute(XmlConsts.StoreIdAttr);
attr.Value = storeId;
linkKeyElem.SetAttributeNode(attr);
attr = doc.CreateAttribute(XmlConsts.SecretIdAttr);
attr.Value = secretId;
linkKeyElem.SetAttributeNode(attr);
attr = doc.CreateAttribute(XmlConsts.KeyAttr);
attr.Value = keyId;
linkKeyElem.SetAttributeNode(attr);
}
catch(Exception e)
{
//Console.WriteLine(e.ToString());
}
}
}
public class FXLinkKey : LinkKey
{
public FXLinkKey(string profile,string url,string key)
{
keyType = StoreKeyType.FX_KEY;
storeName = XmlConsts.FirefoxStoreName;
storeId = profile;
secretId = url;
keyId = key;
}
public override void Dump()
{
Console.WriteLine("StoreName = " + storeName + " StoreId = " + storeId + " SecretId = " + secretId + " Key = " + keyId);
}
public override void AppendToDoc(XmlDocument doc, XmlElement linkKeyElem)
{
XmlAttribute attr;
try
{
attr = doc.CreateAttribute(XmlConsts.StoreNameAttr);
attr.Value = storeName;
linkKeyElem.SetAttributeNode(attr);
attr = doc.CreateAttribute(XmlConsts.StoreIdAttr);
attr.Value = storeId;
linkKeyElem.SetAttributeNode(attr);
attr = doc.CreateAttribute(XmlConsts.SecretIdAttr);
attr.Value = secretId;
linkKeyElem.SetAttributeNode(attr);
attr = doc.CreateAttribute(XmlConsts.KeyAttr);
attr.Value = keyId;
linkKeyElem.SetAttributeNode(attr);
}
catch(Exception e)
{
//Console.WriteLine(e.ToString());
}
}
}
public class CASALinkKey : LinkKey
{
public CASALinkKey(string secret, string key)
{
storeName = XmlConsts.MicasaStoreName;
secretId = secret;
keyId = key;
}
public override void Dump()
{
Console.WriteLine("StoreName = " + storeName + "SecretId = " + secretId + "Key = " + keyId);
}
public override void AppendToDoc(XmlDocument doc, XmlElement linkKeyElem)
{
XmlAttribute attr;
try
{
attr = doc.CreateAttribute(XmlConsts.StoreNameAttr);
attr.Value = storeName;
linkKeyElem.SetAttributeNode(attr);
attr = doc.CreateAttribute(XmlConsts.SecretIdAttr);
attr.Value = secretId;
linkKeyElem.SetAttributeNode(attr);
attr = doc.CreateAttribute(XmlConsts.KeyAttr);
attr.Value = keyId;
linkKeyElem.SetAttributeNode(attr);
}
catch(Exception e)
{
//Console.WriteLine(e.ToString());
}
}
}
public class Link
{
ArrayList linkKeys;
public ArrayList LinkKeys
{
get
{
return linkKeys;
}
}
public Link(ArrayList linkList)
{
linkKeys = linkList;
}
public void Dump()
{
IEnumerator etor = linkKeys.GetEnumerator();
while(etor.MoveNext())
{
((LinkKey)(etor.Current)).Dump();
}
}
public void AppendToDoc(XmlDocument doc, XmlElement linkElem)
{
try
{
IEnumerator enumerator = linkKeys.GetEnumerator();
while(enumerator.MoveNext())
{
XmlElement linkKeyElem = doc.CreateElement(XmlConsts.LinkKeyNode);
((LinkKey)(enumerator.Current)).AppendToDoc(doc,linkKeyElem);
linkElem.AppendChild(linkKeyElem);
}
}
catch(Exception e)
{
//Console.WriteLine(e.ToString());
}
}
}
public class LinkGroup
{
ArrayList links;
public ArrayList Links
{
get
{
return links;
}
}
public LinkGroup(ArrayList linksList)
{
links = linksList;
}
public void Dump()
{
IEnumerator enumerator = links.GetEnumerator();
while(enumerator.MoveNext())
{
Console.WriteLine("Link");
((Link)(enumerator.Current)).Dump();
}
}
internal void AppendToDoc(XmlDocument doc, XmlElement synchPolElem)
{
try
{
XmlElement linkGroupElem = doc.CreateElement(XmlConsts.LinkGroupNode);
synchPolElem.AppendChild(linkGroupElem);
IEnumerator enumerator = links.GetEnumerator();
while(enumerator.MoveNext())
{
XmlElement linkElem = doc.CreateElement(XmlConsts.LinkNode);
((Link)(enumerator.Current)).AppendToDoc(doc,linkElem);
linkGroupElem.AppendChild(linkElem);
}
}
catch(Exception e)
{
//Console.WriteLine(e.ToString());
}
}
}
public class SynchPol: CASAPol
{
ArrayList linkGroups;
public ArrayList LinkGroups
{
get
{
return linkGroups;
}
}
public SynchPol( ArrayList grps)
{
policyType = CASAPolType.SYNCH_POL;
linkGroups = grps;
}
public override void DumpPol()
{
Console.WriteLine("\nSynch Policy");
IEnumerator grpEtor = linkGroups.GetEnumerator();
while(grpEtor.MoveNext())
{
Console.WriteLine("\nLink Group\n");
((LinkGroup)(grpEtor.Current)).Dump();
} //end of while grpEtor
}
internal override void AppendToDoc(XmlDocument doc)
{
string xPath = "";
try
{
xPath = "//" + XmlConsts.CASAPolicyNode;
XmlNode rootElem = doc.SelectSingleNode(xPath);
XmlElement synchPolElem = doc.CreateElement(XmlConsts.SynchPolicyNode);
rootElem.AppendChild(synchPolElem);
IEnumerator enumerator = linkGroups.GetEnumerator();
while(enumerator.MoveNext())
{
((LinkGroup)(enumerator.Current)).AppendToDoc(doc,synchPolElem);
// linkGroups[i].AppendToDoc(doc);
}
}
catch(Exception e)
{
//Console.WriteLine(e.ToString());
}
}
}
}

120
policy/Test.cs Normal file
View File

@@ -0,0 +1,120 @@
/***********************************************************************
*
* Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved.
*
* 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 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, Novell, Inc.
*
* 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 Novell.CASA.CASAPolicy;
class Test
{
public static void Main()
{
ArrayList storeList = new ArrayList();
Store store = new Store("kwallet","walletid");
storeList.Add(store);
store = new Store("gnome-keyring","keyring1");
storeList.Add(store);
AggregationPol aggPol = new AggregationPol(storeList);
PersistencePol persistPol = new PersistencePol("linux","myfile.xml",10);
UIPol uiPol = new UIPol(true,false,true,"auto");
ArrayList linkKeyList = new ArrayList();
KWLinkKey kwLinkKey = new KWLinkKey("wallet1","folder1","kw-secret","kw-passwd");
linkKeyList.Add(kwLinkKey);
GKLinkKey gkLinkKey = new GKLinkKey("keyring1","gk-secret","gk-passwd");
linkKeyList.Add(gkLinkKey);
Link link1 = new Link(linkKeyList);
linkKeyList = new ArrayList();
kwLinkKey = new KWLinkKey("wallet1","folder1","kw-secret","kw-username");
linkKeyList.Add(kwLinkKey);
gkLinkKey = new GKLinkKey("keyring1","gk-secret","gk-username");
linkKeyList.Add(gkLinkKey);
/*
MZLinkKey mzLinkKey = new MZLinkKey("profile1","mz-secret","mz-username");
linkKeyList.Add(mzLinkKey);
*/
Link link2 = new Link(linkKeyList);
ArrayList grp = new ArrayList();
grp.Add(link1);
grp.Add(link2);
LinkGroup linkGrp = new LinkGroup(grp);
ArrayList grpList = new ArrayList();
grpList.Add(linkGrp);
SynchPol synchPol = new SynchPol(grpList);
CASAPol[] policies = new CASAPol[4];
policies[0] = aggPol;
policies[1] = persistPol;
policies[2] = uiPol;
policies[3] = synchPol;
ICASAPol.SetPolicies(policies);
policies = ICASAPol.GetPolicies();
for(int i = 0; i < policies.Length; i++)
{
if(policies[i] != null)
policies[i].DumpPol();
}
aggPol = (AggregationPol) ICASAPol.GetPolicy(CASAPolType.AGGREGATION_POL);
aggPol.DumpPol();
{
Console.WriteLine("AGGPOL \n");
ArrayList stores = aggPol.StoreList;
IEnumerator enumerator = stores.GetEnumerator();
while(enumerator.MoveNext())
{
Console.WriteLine("StoreName = " + ((Store)(enumerator.Current)).StoreName + " StoreId = " + ((Store)(enumerator.Current)).StoreId);
}
}
persistPol = (PersistencePol)ICASAPol.GetPolicy(CASAPolType.PERSISTENCE_POL);
persistPol.DumpPol();
{
Console.WriteLine("PERSISTENCE POL \n");
Console.WriteLine("persistPol.OS = " + persistPol.OS);
Console.WriteLine("persistPol.FilePath = " + persistPol.FilePath);
Console.WriteLine("persistPol.PollInterval = " + persistPol.PollInterval);
}
uiPol = (UIPol)ICASAPol.GetPolicy(CASAPolType.UI_POL);
uiPol.DumpPol();
{
Console.WriteLine("UIPOL \n");
Console.WriteLine("uiPol.showInTaskBar = " + uiPol.ShowInTaskBar);
Console.WriteLine("uiPol.showSecretValue = " + uiPol.ShowSecretValue);
Console.WriteLine("uiPol.showSecretInClearText = " + uiPol.ShowSecretInClearText);
Console.WriteLine("uiPol.synchEngineStartMode = " + uiPol.SynchEngineStartMode);
}
persistPol = new PersistencePol("win","winfile.xml",100);
ICASAPol.SetPolicy(persistPol);
persistPol = (PersistencePol) ICASAPol.GetPolicy(CASAPolType.PERSISTENCE_POL);
persistPol.DumpPol();
}
}

122
policy/UIPol.cs Normal file
View File

@@ -0,0 +1,122 @@
/***********************************************************************
*
* Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved.
*
* 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 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, Novell, Inc.
*
* 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 UIPol : CASAPol
{
bool showInTaskBar;
public bool ShowInTaskBar
{
get
{
return showInTaskBar;
}
}
bool showSecretValue;
public bool ShowSecretValue
{
get
{
return showSecretValue;
}
}
bool showSecretInClearText;
public bool ShowSecretInClearText
{
get
{
return showSecretInClearText;
}
}
string synchEngineStartMode;
public string SynchEngineStartMode
{
get
{
return synchEngineStartMode;
}
}
public UIPol(bool inTrayIcon, bool inShowVals,bool inClearText,string startMode)
{
policyType = CASAPolType.UI_POL;
showInTaskBar = inTrayIcon;
showSecretValue = inShowVals;
showSecretInClearText = inClearText;
synchEngineStartMode = startMode;
}
public override void DumpPol()
{
Console.WriteLine("\nUIPolicy");
Console.WriteLine("showInTaskBar = " + showInTaskBar);
Console.WriteLine("showSecretValue = " + showSecretValue);
Console.WriteLine("showSecretInClearText = " + showSecretInClearText);
Console.WriteLine("synchEngineStartMode = " + synchEngineStartMode);
}
internal override void AppendToDoc(XmlDocument doc)
{
XmlElement elem;
XmlAttribute attr;
string xPath = "";
try
{
xPath = "//" + XmlConsts.CASAPolicyNode;
XmlNode rootElem = doc.SelectSingleNode(xPath);
XmlElement uiPolElem = doc.CreateElement(XmlConsts.UIPolicyNode);
attr = doc.CreateAttribute(XmlConsts.ShowInTaskBarAttr);
attr.Value = showInTaskBar.ToString();
uiPolElem.SetAttributeNode(attr);
attr = doc.CreateAttribute(XmlConsts.ShowSecretValueAttr);
attr.Value = showSecretValue.ToString();
uiPolElem.SetAttributeNode(attr);
attr = doc.CreateAttribute(XmlConsts.ShowSecretInClearTextAttr);
attr.Value = showSecretInClearText.ToString();
uiPolElem.SetAttributeNode(attr);
rootElem.AppendChild(uiPolElem);
elem = doc.CreateElement(XmlConsts.SynchEngineStartModeNode);
elem.InnerText = synchEngineStartMode;
uiPolElem.AppendChild(elem);
}
catch(Exception e)
{
//Console.WriteLine(e.ToString());
}
}
}
}

10
policy/objs.lux Normal file
View File

@@ -0,0 +1,10 @@
OBJS=\
AssemblyInfo\
Policy\
PolicyImpl\
PolicyConstants\
AggregationPol\
PersistencePol\
UIPol\
SynchPol

10
policy/objs.w32 Normal file
View File

@@ -0,0 +1,10 @@
OBJS=\
AssemblyInfo\
Policy\
PolicyImpl\
PolicyConstants\
AggregationPol\
PersistencePol\
UIPol\
SynchPol

10
policy/src.lux Normal file
View File

@@ -0,0 +1,10 @@
SRC=\
AssemblyInfo.cs\
Policy.cs\
PolicyImpl.cs\
PolicyConstants.cs\
AggregationPol.cs\
PersistencePol.cs\
UIPol.cs\
SynchPol.cs

10
policy/src.w32 Normal file
View File

@@ -0,0 +1,10 @@
SRC=\
AssemblyInfo.cs\
Policy.cs\
PolicyImpl.cs\
PolicyConstants.cs\
AggregationPol.cs\
PersistencePol.cs\
UIPol.cs\
SynchPol.cs