2006-01-19 00:34:21 +01:00
|
|
|
/***********************************************************************
|
|
|
|
*
|
2006-02-01 18:48:29 +01:00
|
|
|
* Copyright (C) 2005-2006 Novell, Inc. All Rights Reserved.
|
2006-01-19 00:34:21 +01:00
|
|
|
*
|
|
|
|
* 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
|
2006-01-31 23:01:47 +01:00
|
|
|
* Library Lesser General Public License for more details.
|
2006-01-19 00:34:21 +01:00
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
2006-01-31 23:01:47 +01:00
|
|
|
* License along with this library; if not, Novell, Inc.
|
2006-01-19 00:34:21 +01:00
|
|
|
*
|
|
|
|
* To contact Novell about this file by physical or electronic mail,
|
|
|
|
* you may find current contact information at www.novell.com.
|
|
|
|
*
|
|
|
|
***********************************************************************/
|
|
|
|
|
2005-10-11 21:51:00 +02:00
|
|
|
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();
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|