/*********************************************************************** * * 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(); } }