[simias-svn] SF.net SVN: simias:[7628] trunk/src/utils
Brought to you by:
srinidhi_bs
|
From: <he...@us...> - 2012-09-18 08:11:59
|
Revision: 7628
http://simias.svn.sourceforge.net/simias/?rev=7628&view=rev
Author: hegdegg
Date: 2012-09-18 08:11:49 +0000 (Tue, 18 Sep 2012)
Log Message:
-----------
ID:#000
Reviewer: Kalidas
Localization Required: No
Documentation Required: No
Description: iFolder database recoverability test tool.
Added Paths:
-----------
trunk/src/utils/checkdb/
trunk/src/utils/checkdb/AssemblyInfo.cs.in
trunk/src/utils/checkdb/ChangeLog
trunk/src/utils/checkdb/CheckSimiasDB.cs
trunk/src/utils/checkdb/CheckSimiasDB.csproj
trunk/src/utils/checkdb/CheckSimiasDB.pidb
trunk/src/utils/checkdb/CheckSimiasDB.sln
trunk/src/utils/checkdb/CheckSimiasDB.userprefs
trunk/src/utils/checkdb/Makefile.am
trunk/src/utils/checkdb/README
trunk/src/utils/checkdb/app.config
trunk/src/utils/checkdb/ifolder-database-check.8
trunk/src/utils/checkdb/ifolder-database-check.in
Added: trunk/src/utils/checkdb/AssemblyInfo.cs.in
===================================================================
--- trunk/src/utils/checkdb/AssemblyInfo.cs.in (rev 0)
+++ trunk/src/utils/checkdb/AssemblyInfo.cs.in 2012-09-18 08:11:49 UTC (rev 7628)
@@ -0,0 +1,59 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+
+//
+// General Information about an assembly is controlled through the following
+// set of attributes.
+//
+
+[assembly: AssemblyTitle("Novell-iFolder")]
+[assembly: AssemblyDescription("Simple and Secure storage solution")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Novell, Inc.")]
+[assembly: AssemblyProduct("iFolder")]
+[assembly: AssemblyCopyright("(c) 2004-2012 Novell, Inc.")]
+[assembly: AssemblyTrademark("iFolder")]
+[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("@_VERSION_@")]
+[assembly: AssemblyInformationalVersion("@_VERSION_@")]
+
+//
+// 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: AssemblyKeyName("")]
Added: trunk/src/utils/checkdb/ChangeLog
===================================================================
--- trunk/src/utils/checkdb/ChangeLog (rev 0)
+++ trunk/src/utils/checkdb/ChangeLog 2012-09-18 08:11:49 UTC (rev 7628)
@@ -0,0 +1,2 @@
+2012-05-16 Hegde GG <he...@no...>
+ * Created the initial code for iFolder simias database recoveraility test.
Added: trunk/src/utils/checkdb/CheckSimiasDB.cs
===================================================================
--- trunk/src/utils/checkdb/CheckSimiasDB.cs (rev 0)
+++ trunk/src/utils/checkdb/CheckSimiasDB.cs 2012-09-18 08:11:49 UTC (rev 7628)
@@ -0,0 +1,484 @@
+/*****************************************************************************
+*
+* Copyright (c) [2012] Novell, Inc.
+* All Rights Reserved.
+*
+* This program is free software; you can redistribute it and/or
+* modify it under the terms of version 2 of the GNU General Public License as
+* published by the Free Software Foundation.
+*
+* 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, contact Novell, Inc.
+*
+* To contact Novell about this file by physical or electronic mail,
+* you may find current contact information at www.novell.com
+*
+*-----------------------------------------------------------------------------
+*
+* $Author: Hegde G. G.
+* $Modified by: he...@no...
+* $Mod Date: May 01, 2012
+
+*-----------------------------------------------------------------------------
+* This module is used to:
+* Check the readability of the simias database
+*******************************************************************************/
+
+using System;
+using System.Net;
+using System.IO;
+using System.Collections;
+using System.Text;
+using System.Text.RegularExpressions;
+using System.Xml;
+using System.Security.Cryptography;
+using System.Diagnostics;
+
+using Simias;
+using Simias.Storage;
+using Persist = Simias.Storage.Provider;
+using Simias.Authentication;
+using Simias.DomainServices;
+using Simias.Policy;
+using Simias.Security.Web.AuthenticationService;
+using Simias.Sync;
+using Simias.Server;
+using Simias.Client;
+using Simias.Web;
+
+
+namespace Simias.Storage.CheckSimisDB
+{
+ public class BrowserNode
+ {
+ private string nodeData;
+ public string NodeData
+ {
+ get { return nodeData; }
+ set { nodeData = value; }
+ }
+ public BrowserNode()
+ {
+ this.nodeData = String.Empty;
+ }
+ public BrowserNode( string nodeData )
+ {
+ this.nodeData = nodeData;
+ }
+ }
+ public class Relationship
+ {
+ private const string RootID = "a9d9a742-fd42-492c-a7f2-4ec4f023c625";
+ private string collectionID;
+ private string nodeID;
+ public string CollectionID
+ {
+ get { return collectionID; }
+ }
+
+ public bool IsRoot
+ {
+ get { return ( nodeID == RootID ) ? true : false; }
+ }
+
+ public string NodeID
+ {
+ get { return nodeID; }
+ }
+ public Relationship( string relationString )
+ {
+ int index = relationString.IndexOf( ':' );
+ if ( index == -1 )
+ {
+ throw new ApplicationException( String.Format( "Invalid relationship format: {0}.", relationString ) );
+ }
+ nodeID = relationString.Substring( 0, index );
+ collectionID = relationString.Substring( index + 1 );
+ }
+ }
+ public class DisplayProperty
+ {
+ private static string FlagTag = "flags";
+ private static string NameTag = "name";
+ private static string TypeTag = "type";
+
+ internal const uint Local = 0x00020000;
+ internal const uint MultiValued = 0x00040000;
+ private XmlElement element;
+
+ public string Name
+ {
+ get { return element.GetAttribute(NameTag); }
+ }
+ public string Type
+ {
+ get { return element.GetAttribute(TypeTag); }
+ }
+ public string Value
+ {
+ get { return (Type == "XmlDocument") ? element.InnerXml : element.InnerText; }
+ }
+ public uint Flags
+ {
+ get
+ {
+ string flagValue = element.GetAttribute( FlagTag );
+ return (flagValue != null && flagValue != String.Empty) ? Convert.ToUInt32(flagValue) : 0;
+ }
+ }
+ public bool IsLocal
+ {
+ get { return ((Flags & Local) == Local) ? true : false; }
+ }
+ public bool IsMultiValued
+ {
+ get { return ((Flags & MultiValued) == MultiValued) ? true : false; }
+ }
+ public DisplayProperty( XmlElement element )
+ {
+ this.element = element;
+ }
+ }
+ public class DisplayNode : IEnumerable
+ {
+ private static string CollectionIDTag = "CollectionId";
+ private static string IDTag = "id";
+ private static string NameTag = "name";
+ private static string ObjectTag = "Object";
+ private static string TypeTag = "type";
+
+ private XmlDocument document;
+
+ public virtual string Name
+ {
+ get { return document.DocumentElement[ ObjectTag ].GetAttribute( NameTag ); }
+ }
+ public virtual string ID
+ {
+ get { return document.DocumentElement[ ObjectTag ].GetAttribute( IDTag ); }
+ }
+ public virtual string Type
+ {
+ get { return document.DocumentElement[ ObjectTag ].GetAttribute( TypeTag ); }
+ }
+ public virtual string CollectionID
+ {
+ get { return FindSingleValue( CollectionIDTag ); }
+ }
+ public virtual bool IsCollection
+ {
+ get { return ( CollectionID == ID ) ? true : false; }
+ }
+ public virtual XmlDocument Document
+ {
+ get { return document; }
+ set { document = value; }
+ }
+ protected DisplayNode()
+ {
+ document = null;
+ }
+ public DisplayNode( BrowserNode bNode )
+ {
+ document = new XmlDocument();
+ document.LoadXml( bNode.NodeData );
+ }
+ internal string FindSingleValue( string name )
+ {
+ string singleValue = null;
+
+ // Create a regular expression to use as the search string.
+ Regex searchName = new Regex( "^" + name + "$", RegexOptions.IgnoreCase );
+
+ // Walk each property node and do a case-insensitive compare on the names.
+ foreach ( XmlElement x in document.DocumentElement[ ObjectTag ] )
+ {
+ if ( searchName.IsMatch( x.GetAttribute( NameTag ) ) )
+ {
+ DisplayProperty p = new DisplayProperty( x );
+ singleValue = p.Value;
+ break;
+ }
+ }
+
+ return singleValue;
+ }
+ public IEnumerator GetEnumerator()
+ {
+ return ( document != null ) ? new DisplayNodeEnum( document ) : null;
+ }
+ private class DisplayNodeEnum : IEnumerator
+ {
+ private IEnumerator e;
+ public DisplayNodeEnum( XmlDocument document )
+ {
+ e = document.DocumentElement[ ObjectTag ].GetEnumerator();
+ }
+ public void Reset()
+ {
+ e.Reset();
+ }
+ public object Current
+ {
+ get { return new DisplayProperty( e.Current as XmlElement ); }
+ }
+ public bool MoveNext()
+ {
+ return e.MoveNext();
+ }
+ }
+ }
+ public class CheckSimiasDB
+ {
+ public static bool dbg = false;
+ public static int level = 1;
+
+ public const string CollectionTag = "Collection";
+ public const string DirNodeTag = "DirNode" ;
+ public const string FileNodeTag = "FileNode" ;
+ public const string MemberTag = "Member";
+ public const string PolicyTag = "Policy";
+ public const string StoreFileNodeTag = "StoreFileNode";
+ public const string TombStoneTag = "Tombstone";
+
+ public static string SimiasDataPath = null;
+ public static string catalogID = "a93266fd-55de-4590-b1c7-428f2fed815d";
+
+ public static Collection catalog ;
+ public static StreamWriter sw = null;
+
+ public static void writeXml(XmlDocument doc, TextWriter tw)
+ {
+ if (doc != null)
+ {
+ XmlTextWriter w = new XmlTextWriter(tw);
+ w.Formatting = Formatting.Indented;
+ doc.WriteTo(w);
+ }
+ }
+
+ public static void LogIt(string format, params object[] args)
+ {
+ //sw.WriteLine(String.Format(format, args));
+ Console.WriteLine(String.Format(format, args));
+ }
+
+ public static void BasicRead (Store store)
+ {
+ LogIt ("Starting basic check");
+ Domain domain = store.GetDomain(store.DefaultDomain);
+ Collection c = domain;
+
+ //# Check for the existance of domain.
+ LogIt("Reading domains");
+ ICSList domainList = store.GetDomainList();
+ foreach (ShallowNode snd in domainList)
+ {
+ LogIt("\t{0} : {1}", snd.Name, snd.ID);
+ }
+ LogIt("Done");
+ LogIt("Reading user information");
+ ICSList members = c.GetMemberList();
+ int i = 1;
+ catalog = store.GetCollectionByID( catalogID );
+ LogIt("\tTotal Users : {0}", members.Count);
+ foreach (ShallowNode sn in members)
+ {
+ Member member = new Member(c, sn);
+ if (dbg)LogIt("\t{0} : {1}", i++, member.FN);
+
+ ICSList cList = store.GetCollectionsByUser(member.UserID);
+ foreach (ShallowNode sn1 in cList)
+ {
+ Collection c1 = new Collection(store, sn1);
+ if (c1.IsType("iFolder"))
+ {
+ if (dbg) LogIt("\t\tiFolder : {0} : {1}", sn1.ID, sn1.Name);
+ }
+ }
+ }
+ LogIt("Done");
+ LogIt("Reading iFolder information");
+ i=1;
+ ICSList iFolderList = null;
+ iFolderList = store.GetCollectionsByType("iFolder");
+ LogIt("\tTotal iFolders : {0}", iFolderList.Count);
+ LogIt("Reading iFolders and owners");
+ foreach (ShallowNode sn in iFolderList)
+ {
+ Collection ifolder = store.GetCollectionByID(sn.ID);
+ Member owner = domain.GetMemberByID(ifolder.Owner.UserID);
+ if(dbg) LogIt("\t{0} : {1} : {2} : {3}", i++, ifolder.Name, ifolder.ID, owner.Name);
+ }
+ LogIt("Done");
+ LogIt("Basic test successful.");
+ }
+
+ public static void CompleteRead (Store store)
+ {
+ long collectionCount = 0;
+ long dirNodeCount = 0;
+ long fileNodeCount = 0;
+ long memberCount = 0;
+ long otherNodeCount = 0;
+ long policyCount = 0;
+ long storeFileNodeCount = 0;
+ long tombStoneCount = 0;
+
+ LogIt ("Starting advanced check");
+ LogIt("Reading the whole store record by record");
+ foreach(ShallowNode sn in store)
+ {
+ if(dbg) LogIt("\t{0} : {1} : {2}", sn.Name, sn.ID, sn.Type);
+ Collection c2 = store.GetCollectionByID(sn.CollectionID);
+ if ( c2 != null )
+ {
+
+ Node n = c2.GetNodeByID(sn.ID);
+ if ( n != null)
+ {
+ BrowserNode bNode = new BrowserNode(n.Properties.ToString());
+ DisplayNode dspNode = new DisplayNode(bNode);
+ if (dbg)
+ {
+ foreach (DisplayProperty p in dspNode)
+ {
+ if(dbg) LogIt("\t\t{0} : {1} : {2} : {3} : {4} : {5}",
+ p.Name, p.Type, p.Value, p.Flags, p.IsLocal, p.IsMultiValued);
+ }
+ LogIt("");
+ }
+ }
+ foreach(ShallowNode sn1 in c2)
+ {
+ if(dbg) LogIt("\t\t{0} : {1} : {2}", sn1.Name, sn1.ID, sn1.Type);
+
+ switch ( sn1.Type )
+ {
+ case CollectionTag:
+ collectionCount++;
+ break;
+ case DirNodeTag:
+ dirNodeCount++;
+ break;
+ case FileNodeTag:
+ fileNodeCount++;
+ break;
+ case MemberTag:
+ memberCount++;
+ break;
+ case PolicyTag:
+ policyCount++;
+ break;
+ case StoreFileNodeTag:
+ storeFileNodeCount++;
+ break;
+ case TombStoneTag:
+ tombStoneCount++;
+ break;
+ default:
+ otherNodeCount++;
+ break;
+ }
+ Collection c3 = store.GetCollectionByID(sn1.CollectionID);
+ if ( c3 != null )
+ {
+ Node n2 = c3.GetNodeByID(sn1.ID);
+ if ( n2 != null)
+ {
+ BrowserNode bNode2 = new BrowserNode(n2.Properties.ToString());
+ DisplayNode dspNode2 = new DisplayNode(bNode2);
+ if ( dbg)
+ {
+ foreach (DisplayProperty p in dspNode2)
+ {
+ if(dbg) LogIt("\t\t\t{0} : {1} : {2} : {3} : {4} : {5}",
+ p.Name, p.Type, p.Value, p.Flags, p.IsLocal, p.IsMultiValued);
+ }
+ LogIt("");
+ }
+ }
+ }
+ }
+ }
+ }
+ LogIt ("\t{0, -30}: {1}", CollectionTag, collectionCount);
+ LogIt ("\t{0, -30}: {1}", DirNodeTag, dirNodeCount);
+ LogIt ("\t{0, -30}: {1}", FileNodeTag, fileNodeCount);
+ LogIt ("\t{0, -30}: {1}", MemberTag , memberCount);
+ LogIt ("\t{0, -30}: {1}", PolicyTag, policyCount);
+ LogIt ("\t{0, -30}: {1}", StoreFileNodeTag, storeFileNodeCount);
+ LogIt ("\t{0, -30}: {1}", TombStoneTag, tombStoneCount);
+ LogIt ("\t{0, -30}: {1}", "OtherNodes", otherNodeCount);
+ LogIt("Done");
+ LogIt("Advanced check successful.");
+ }
+
+ static int Main(string[] args)
+ {
+ int returnValue = 0;
+ if (args.Length == 1)
+ {
+ SimiasDataPath = args[0];
+ }
+ else if (args.Length == 2)
+ {
+ SimiasDataPath = args[0];
+ level = int.Parse(args[1]);
+ if (level != 2) level = 1; // any number other than 2 is treated as 1
+ }
+ else
+ {
+ LogIt("Usage : ifolder-database-check <storepath> <level>");
+ return 1;
+ }
+ string var = Environment.GetEnvironmentVariable("IFDBDBG");
+ if ( var != null )
+ {
+ dbg = true;
+ }
+ LogIt ("{0} - START - iFolder recoverability test.", DateTime.Now.ToString());
+ string logFile = "/tmp/recoverability.log";
+ DateTime startTime = DateTime.Now;
+ TimeSpan brTs, crTs;
+ sw = File.CreateText(logFile);
+ try
+ {
+ LogIt ("Trying to read simias database");
+ Store.Initialize(SimiasDataPath, false, -1);//# Initialize the database
+ LogIt("Done");
+ Store store = Store.GetStore();
+ DateTime brStartTime = DateTime.Now;
+ BasicRead (store);
+ DateTime brEndTime = DateTime.Now;
+ brTs = brEndTime - brStartTime;
+ if (level == 2)
+ {
+ DateTime crStartTime = DateTime.Now;
+ CompleteRead (store);
+ DateTime crEndTime = DateTime.Now;
+ crTs = crEndTime - crStartTime;
+ }
+ Store.DeleteInstance();//# Closing the db
+ }
+ catch(Exception ex)
+ {
+ LogIt("Unable to check simias db. {0}", ex.StackTrace);
+ returnValue = 1;
+ }
+ DateTime endTime = DateTime.Now;
+ LogIt("Total time taken : {0}", endTime - startTime);
+ LogIt("Time taken for basic read : {0}", brTs);
+ //LogIt("Time taken for complete read : {0}", crTs);
+ LogIt("Simias Database is intact, this could be backed up for later recovery.");
+ sw.Close();
+ LogIt ("{0} - END - iFolder recoverability test.", DateTime.Now.ToString());
+ return returnValue;
+ }
+ }
+}
Added: trunk/src/utils/checkdb/CheckSimiasDB.csproj
===================================================================
--- trunk/src/utils/checkdb/CheckSimiasDB.csproj (rev 0)
+++ trunk/src/utils/checkdb/CheckSimiasDB.csproj 2012-09-18 08:11:49 UTC (rev 7628)
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{03D71AFB-0FD4-4431-B09E-178069C8C9A4}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>CheckSimiasDB</RootNamespace>
+ <AssemblyName>CheckSimiasDB</AssemblyName>
+ <FileAlignment>512</FileAlignment>
+ <PublishUrl>publish\</PublishUrl>
+ <Install>true</Install>
+ <InstallFrom>Disk</InstallFrom>
+ <UpdateEnabled>false</UpdateEnabled>
+ <UpdateMode>Foreground</UpdateMode>
+ <UpdateInterval>7</UpdateInterval>
+ <UpdateIntervalUnits>Days</UpdateIntervalUnits>
+ <UpdatePeriodically>false</UpdatePeriodically>
+ <UpdateRequired>false</UpdateRequired>
+ <MapFileExtensions>true</MapFileExtensions>
+ <ApplicationRevision>0</ApplicationRevision>
+ <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
+ <IsWebBootstrapper>false</IsWebBootstrapper>
+ <UseApplicationTrust>false</UseApplicationTrust>
+ <BootstrapperEnabled>true</BootstrapperEnabled>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <PlatformTarget>x64</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="CheckSimiasDB.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <None Include="app.config" />
+ </ItemGroup>
+ <ItemGroup>
+ <BootstrapperPackage Include=".NETFramework,Version=v4.0">
+ <Visible>False</Visible>
+ <ProductName>Microsoft .NET Framework 4 %28x86 and x64%29</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
+ <Visible>False</Visible>
+ <ProductName>.NET Framework 3.5 SP1</ProductName>
+ <Install>false</Install>
+ </BootstrapperPackage>
+ <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
+ <Visible>False</Visible>
+ <ProductName>Windows Installer 3.1</ProductName>
+ <Install>true</Install>
+ </BootstrapperPackage>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Added: trunk/src/utils/checkdb/CheckSimiasDB.pidb
===================================================================
(Binary files differ)
Property changes on: trunk/src/utils/checkdb/CheckSimiasDB.pidb
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: trunk/src/utils/checkdb/CheckSimiasDB.sln
===================================================================
--- trunk/src/utils/checkdb/CheckSimiasDB.sln (rev 0)
+++ trunk/src/utils/checkdb/CheckSimiasDB.sln 2012-09-18 08:11:49 UTC (rev 7628)
@@ -0,0 +1,20 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CheckSimiasDB", "CheckSimiasDB.csproj", "{03D71AFB-0FD4-4431-B09E-178069C8C9A4}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|x86 = Debug|x86
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {03D71AFB-0FD4-4431-B09E-178069C8C9A4}.Debug|x86.ActiveCfg = Debug|x86
+ {03D71AFB-0FD4-4431-B09E-178069C8C9A4}.Debug|x86.Build.0 = Debug|x86
+ {03D71AFB-0FD4-4431-B09E-178069C8C9A4}.Release|x86.ActiveCfg = Release|x86
+ {03D71AFB-0FD4-4431-B09E-178069C8C9A4}.Release|x86.Build.0 = Release|x86
+ EndGlobalSection
+ GlobalSection(MonoDevelopProperties) = preSolution
+ StartupItem = CheckSimiasDB.csproj
+ EndGlobalSection
+EndGlobal
Added: trunk/src/utils/checkdb/CheckSimiasDB.userprefs
===================================================================
--- trunk/src/utils/checkdb/CheckSimiasDB.userprefs (rev 0)
+++ trunk/src/utils/checkdb/CheckSimiasDB.userprefs 2012-09-18 08:11:49 UTC (rev 7628)
@@ -0,0 +1,12 @@
+<Properties>
+ <MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" />
+ <MonoDevelop.Ide.Workbench ActiveDocument="CheckSimiasDB.cs">
+ <Files>
+ <File FileName="CheckSimiasDB.cs" Line="483" Column="1" />
+ </Files>
+ </MonoDevelop.Ide.Workbench>
+ <MonoDevelop.Ide.DebuggingService.Breakpoints>
+ <BreakpointStore />
+ </MonoDevelop.Ide.DebuggingService.Breakpoints>
+ <MonoDevelop.Ide.DebuggingService.PinnedWatches />
+</Properties>
Added: trunk/src/utils/checkdb/Makefile.am
===================================================================
--- trunk/src/utils/checkdb/Makefile.am (rev 0)
+++ trunk/src/utils/checkdb/Makefile.am 2012-09-18 08:11:49 UTC (rev 7628)
@@ -0,0 +1,64 @@
+export MONO_PATH := $(MONO_PATH)
+SUBDIRS =
+checkdb_CSFILES = \
+ $(srcdir)/CheckSimiasDB.cs
+
+dist_man_MANS=ifolder-database-check.8
+
+checkdb_CSFILES_CSC := $(subst /,$(SEP),$(checkdb_CSFILES))
+oldserveragent_CSFILES_CSC := $(subst /,$(SEP),$(oldserveragent_CSFILES))
+#checkdb_FLAGS = $(CSC_EXEFLAG)
+checkdb_FLAGS = /optimize+ /d:LINUX /d:MONO /warn:4 /d:TRACE /d:MONONATIVE
+checkdb_LIBS = \
+ /r:System.dll \
+ /r:System.Data.dll \
+ /r:System.Security.dll \
+ /r:System.Runtime.Remoting.dll \
+ /r:System.Web.dll \
+ /r:Mono.Posix.dll
+checkdb_LIBPATH = \
+ ../../core/SimiasClient/ \
+ ../../core/SimiasLib.dll/ \
+ ../../server/Simias.Server/
+checkdb_LIBS = \
+ /r:SimiasClient.dll \
+ /r:SimiasLib.dll \
+ /r:Simias.Server.dll
+
+EXTRA_DIST = $(checkdb_CSFILES) ifolder-database-check
+
+AssemblyInfo.cs: $(srcdir)/AssemblyInfo.cs.in Makefile
+ sed -e 's,@_VERSION_@,@VERSION@,g' $< > $@
+ chmod +x $@
+
+all: CheckSimiasDB.exe ifolder-database-check
+
+CheckSimiasDB.exe: $(checkdb_CSFILES) AssemblyInfo.cs
+ gmcs /out:CheckSimiasDB.exe $(checkdb_FLAGS) /target:exe $(checkdb_LIBS) $(checkdb_LIBPATH:%=/lib:%) $(checkdb_LIBS) $(checkdb_CSFILES_CSC) AssemblyInfo.cs
+
+ifolder-database-check: $(srcdir)/ifolder-database-check.in
+ sed -e 's,@_webbindir_@,@webbindir@,g' -e 's,@_bindir_@,@bindir@,g' $< > $@
+ chmod +x $@
+
+install-exec-local: CheckSimiasDB.exe ifolder-database-check
+ $(mkinstalldirs) $(DESTDIR)$(bindir)
+ $(INSTALL_PROGRAM) CheckSimiasDB.exe $(DESTDIR)$(bindir)
+ $(INSTALL_PROGRAM) ifolder-database-check $(DESTDIR)$(bindir)
+
+uninstall-local:
+ cd $(DESTDIR)$(bindir); rm -f CheckSimiasDB.exe ifolder-database-check
+
+installcheck-local: install
+
+CLEAN_FILES = CheckSimiasDB.exe AssemblyInfo.cs ifolder-database-check
+
+clean-local:
+ rm -rf $(CLEAN_FILES) $(COMMON_CLEAN_FILES)
+
+distclean: distclean-local
+
+distclean-local:
+ rm -rf $(COMMON_DISTCLEAN_FILES)
+
+maintainer-clean-local:
+ rm -rf $(COMMON_MAINTAINER_CLEAN_FILES)
Added: trunk/src/utils/checkdb/README
===================================================================
Added: trunk/src/utils/checkdb/app.config
===================================================================
--- trunk/src/utils/checkdb/app.config (rev 0)
+++ trunk/src/utils/checkdb/app.config 2012-09-18 08:11:49 UTC (rev 7628)
@@ -0,0 +1,3 @@
+<?xml version="1.0"?>
+<configuration>
+<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup></configuration>
Added: trunk/src/utils/checkdb/ifolder-database-check.8
===================================================================
--- trunk/src/utils/checkdb/ifolder-database-check.8 (rev 0)
+++ trunk/src/utils/checkdb/ifolder-database-check.8 2012-09-18 08:11:49 UTC (rev 7628)
@@ -0,0 +1,70 @@
+.\" Title: ifolder-database-check
+.\" Author: [he...@no...] [see http://docbook.sf.net/el/author]
+.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
+.\" Date: 05/01/2012
+.\" Manual: ifolder-database-check(8)
+.\" Source: Novell
+.\" Language: English
+.\"
+.TH "IFOLDER\-DATABASE\-CHECK" "8" "05/01/2012" "Novell" "ifolder-database-check(8)"
+.\" -----------------------------------------------------------------
+.\" * set default formatting
+.\" -----------------------------------------------------------------
+.\" disable hyphenation
+.nh
+.\" disable justification (adjust text to left margin only)
+.ad l
+.\" -----------------------------------------------------------------
+.\" * MAIN CONTENT STARTS HERE *
+.\" -----------------------------------------------------------------
+.SH "NAME"
+ifolder-database-check \- iFolder Database Recoverability Test Tool
+.SH "SYNTAX"
+
+.sp
+.if n \{\
+.RS 3
+.\}
+
+ifolder\-database\-check <\fIoptions\fR>
+
+.fi
+.if n \{\
+.RE
+.\}
+.SH "DESCRIPTION"
+.PP
+Use this tool to check the simias data integrity, Run this before taking the daily backup, if this is successful, you will be sure that when the restore operation is attempted we have the database that is in a state to revover.\&.
+.PP
+To check the database integrity using the tool, just run the tool \&.
+.SH "OPERATIONS"
+.PP
+\-\-p
+.RS 3
+Path where the simias database is present.
+.RE
+.PP
+\-\-v
+.RS 3
+Verbose mode, detailed debug information is logged.
+.RE
+.PP
+\-\-l
+.RS 3
+Level of check 1- basic, and 2- detailed.
+.RE
+.PP
+\-\-help
+.RS 3
+Displays help for the operation, options, and usage
+.RE
+.SH "EXAMPLES"
+.PP
+ifolder-database-check - read the simias.config file and do the database integrity tests.\&.
+.PP
+ifolder-database-check -p /path_to_simias_db - run the integrity test on the database present in the given path.\&.
+.PP
+ifolder-database-check -v -Verbose mode.\&.
+.PP
+ifolder-database-check -v -l 2 - run the test in verbose mode and do the detailed test.\&.
+.PP
\ No newline at end of file
Added: trunk/src/utils/checkdb/ifolder-database-check.in
===================================================================
--- trunk/src/utils/checkdb/ifolder-database-check.in (rev 0)
+++ trunk/src/utils/checkdb/ifolder-database-check.in 2012-09-18 08:11:49 UTC (rev 7628)
@@ -0,0 +1,169 @@
+#!/bin/bash
+#/*****************************************************************************
+#*
+#* Copyright (c) [2012] Novell, Inc.
+#* All Rights Reserved.
+#*
+#* This program is free software; you can redistribute it and/or
+#* modify it under the terms of version 2 of the GNU General Public License as
+#* published by the Free Software Foundation.
+#*
+#* 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, contact Novell, Inc.
+#*
+#* To contact Novell about this file by physical or electronic mail,
+#* you may find current contact information at www.novell.com
+#*
+#*-----------------------------------------------------------------------------
+#*
+#* $Author: Hegde G. G. ( he...@no...)
+#* $Modified by: he...@no...
+#* $Mod Date: May 01, 2012
+#* $Revision: 0.1
+#*-----------------------------------------------------------------------------
+#* This module is:
+#* Wrapper script, ifolder-database-check, that is used to test the
+#* recoverability of simias database.
+#*******************************************************************************/
+#set -x
+
+InitializeDataPath()
+{
+ datapath=""
+ datapath=`grep SimiasDataDir /etc/apache2/conf.d/simias.conf | gawk 'BEGIN { RS=";|\"" } { if (/^SimiasDataDir/) print gensub(/SimiasDataDir=/, "", 1) }'`
+ backupdir=$datapath/MetaDataBackup
+ tempdir=$datapath/MetaDataBackupTemp
+
+ if [ -d $tempdir ] ; then
+ rm -rf $tempdir/* ;
+ else
+ mkdir $tempdir;
+ fi
+
+ debuglog=$tempdir/debug.log
+ errlog=$tempdir/err.log
+ touch $debuglog $errlog
+
+ if [ -n "$datapath" ]; then
+ Log "Simias datapath read from config file"
+ else
+ Log "Unable to read datapath from simias config file"
+ exit -1
+ fi
+}
+
+SetMonoPath()
+{
+ #rpm -q mono-addon-core > /dev/null 2>&1
+ export MONO_PATH=/opt/novell/ifolder3/lib64/simias/web/bin:/opt/novell/ifolder3/bin:/usr/lib/mono/log4net
+ rpm -q mono-addon-core > /dev/null 2>&1
+
+ if [ $? -gt 0 ]; then
+ cd /opt/novell/ifolder3/bin
+ else
+ MONO_RUNTIME_PATH=/opt/novell/mono/bin
+ source $MONO_RUNTIME_PATH/mono-addon-environment.sh
+ cd /opt/novell/ifolder3/bin
+ fi
+}
+
+CopyFiles()
+{
+ cp -rpf $datapath/FlaimSimias* $tempdir/
+ cp -rpf $datapath/Simias.config $tempdir/
+}
+
+BackupFiles()
+{
+ if [ -d $backupdir ] ; then
+ rm -rf $backupdir;
+ fi
+ mv $tempdir $backupdir
+ md5sum $backupdir/FlaimSimias.* > $backupdir/files.md5 2>/dev/null
+ md5sum $backupdir/FlaimSimias.rfl/* >> $backupdir/files.md5 2>/dev/null
+}
+
+UpdateAdmin()
+{
+ /bin/mail -s "iFolder backup check failed" he...@no... < " Failed database check"
+}
+
+PrintUsage()
+{
+ Log "Usage:";
+}
+
+Log()
+{
+ if [ $DEBUG -eq 1 ]; then
+ message="$1 $2"
+ echo $message >> $debuglog;
+ fi
+}
+NoStopping()
+{
+ echo "Termination may cause Simias DB to be corrupt, ignoring the request"
+}
+##############################################################
+# Main execution starts here
+usage=$(
+cat <<EOF
+$0 [OPTION]
+-v set the verbose flag for detailed log
+-p path simias database path
+-l level select 1 for basic tests and 2 for detailed tests
+)
+
+ #define default values
+ while getopts "vp:l:" OPTION; do
+ case "$OPTION" in
+ v)
+ DEBUG=1
+ ;;
+ p)
+ DBPATH="$OPTARG"
+ ;;
+ l)
+ LEVEL="$OPTARG"
+ ;;
+ *)
+ echo "$usage"
+ ;;
+ esac
+ done
+
+ # set default val:
+ # VARIABLE when it is returned
+ : ${DEBUG=0}
+ : ${DBPATH=''}
+ : ${LEVEL=1}
+
+SetMonoPath
+
+trap NoStopping 1 2 5
+
+if [ ! -z "$DBPATH" ]; then
+ backupfiles=false
+ mono /opt/novell/ifolder3/bin/CheckSimiasDB.exe "$DBPATH" $LEVEL
+ if [ $? -eq 0 ] ; then
+ Log "Simias data in backed up location is readable"
+ else
+ Log "Simias database in backed up location is not readable"
+ fi
+else
+ InitializeDataPath
+ CopyFiles
+ mono /opt/novell/ifolder3/bin/CheckSimiasDB.exe $tempdir $LEVEL > $tempdir/recoverability.log 2>$errlog
+ if [ $? -eq 0 ] ; then
+ Log "Simias data in backed up location is readable"
+ BackupFiles
+ else
+ Log "Simias database in backed up location is not readable"
+ fi
+fi
+exit $?;
Property changes on: trunk/src/utils/checkdb/ifolder-database-check.in
___________________________________________________________________
Added: svn:executable
+ *
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|