Thread: [simias-svn] SF.net SVN: simias:[7382] trunk/src/utils/restore/iFolderServer.cs
Brought to you by:
srinidhi_bs
|
From: <sp...@us...> - 2010-05-27 06:43:30
|
Revision: 7382
http://simias.svn.sourceforge.net/simias/?rev=7382&view=rev
Author: spkumar
Date: 2010-05-27 06:43:24 +0000 (Thu, 27 May 2010)
Log Message:
-----------
updated the code with a review comment to consider the scenario of
retry during the restore
Modified Paths:
--------------
trunk/src/utils/restore/iFolderServer.cs
Modified: trunk/src/utils/restore/iFolderServer.cs
===================================================================
--- trunk/src/utils/restore/iFolderServer.cs 2010-05-27 06:15:20 UTC (rev 7381)
+++ trunk/src/utils/restore/iFolderServer.cs 2010-05-27 06:43:24 UTC (rev 7382)
@@ -2460,7 +2460,7 @@
retval = RestoreiFolderData(iFolderID, OldServer, oldUnManagedPath, NewServer,
newifolderDetails.UnManagedPath, relativepath, MainClass.UseWebAccess);
}
- if( (retval == 0) && (MainClass.OverwritePolicies == true) && (MainClass.Operation != (int)Command.Retry))
+ if( (retval == 0) && (MainClass.OverwritePolicies == true))
{
retval = RestoreiFolderPolicy(iFolderID, OldServer, NewServer);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-06-02 13:53:18
|
Revision: 7386
http://simias.svn.sourceforge.net/simias/?rev=7386&view=rev
Author: spkumar
Date: 2010-06-02 13:53:05 +0000 (Wed, 02 Jun 2010)
Log Message:
-----------
fixed an issue while restoring ifolder policies for non admin users
Modified Paths:
--------------
trunk/src/utils/restore/iFolderServer.cs
Modified: trunk/src/utils/restore/iFolderServer.cs
===================================================================
--- trunk/src/utils/restore/iFolderServer.cs 2010-06-02 13:42:40 UTC (rev 7385)
+++ trunk/src/utils/restore/iFolderServer.cs 2010-06-02 13:53:05 UTC (rev 7386)
@@ -1317,6 +1317,35 @@
return retval;
}
/// <summary>
+ /// Retrieves the User policy from the given User ID.
+ /// </summary>
+ /// <param name="userId"> ID of the User for whom policy needs to be retreived.</param>
+ ///
+ /// <returns>returns UserPolicy object on Success and null on Failures.</returns>
+
+ public UserPolicy GetUserPolicy( string userId )
+ {
+ UserPolicy usrPolicy = null;
+ try {
+ int count = 0;
+ while (count < MaxCount){
+ try {
+ return this.admin.GetUserPolicy(userId, null);
+
+ } catch(Exception ex) {
+ if(ex.Message.IndexOf("InvalidOperation") >= 0 || ex.StackTrace.IndexOf("InvalidOperation") >= 0 ) {
+ count++;
+ continue;
+ }
+ throw ex;
+ }
+ }
+ } catch(Exception ex){
+ MainClass.DebugLog.Write(string.Format("Exception while fetching User policy {0}--{1}", ex.Message, ex.StackTrace));
+ }
+ return usrPolicy;
+ }
+ /// <summary>
/// Retrieves the iFolder policy from the given iFolder ID.
/// </summary>
/// <param name="iFolderID"> ID of the iFolder for which policy needs to be retreived.</param>
@@ -1333,8 +1362,8 @@
{
try
{
- ifdPolicy = this.web.GetiFolderPolicy(ifolderid);
- break;
+ return this.admin.GetiFolderPolicy(ifolderid, null);
+
}
catch(Exception ex)
{
@@ -1371,7 +1400,7 @@
{
try
{
- this.web.SetiFolderPolicy(ifdPolicy);
+ this.admin.SetiFolderPolicy(ifdPolicy);
break;
}
catch(Exception ex)
@@ -1723,13 +1752,13 @@
if (MainClass.useSameAdminName == true)
{
- newAdminPassword = ForPasswordString(string.Format("| Password for user( {0} ):",MainClass.newAdminName),null);
+ newAdminPassword = ForPasswordString(string.Format("| Password for iFolder server admin (user={0}):",MainClass.newAdminName),null);
oldAdminPassword = newAdminPassword;
}
else
{
- oldAdminPassword = ForPasswordString(string.Format("| Password for user( {0} ):",MainClass.oldAdminName),null);
- newAdminPassword = ForPasswordString(string.Format("\n| Password for user( {0} ):",MainClass.newAdminName),null);
+ oldAdminPassword = ForPasswordString(string.Format("| Password for backup iFolder server admin (user={0}):",MainClass.oldAdminName),null);
+ newAdminPassword = ForPasswordString(string.Format("\n| Password for current iFolder server admin (user={0}):",MainClass.newAdminName),null);
}
}
@@ -2466,10 +2495,10 @@
}
//This check needs to be done unconditionally. Policy violation can happen
- // during a partial or a full restore.
- checkiFolderPolicyStatus(iFolderID, NewServer);
+ // during a partial or a full restore.
+ CheckiFolderPolicyStatus(iFolderID, NewServer);
+ CheckUserPolicyStatus(userName,NewServer);
-
}
return retval;
}
@@ -2869,6 +2898,30 @@
ifdPolicy.SyncInterval, ifdPolicy.SharingStatus, ifdPolicy.FileSizeLimit, includeFilter.ToString(), excludeFilter.ToString()));
}
+ /// <summary>
+ /// Checks the Userr policy voilations after the data is restored.
+ /// </summary>
+ /// <param name="UserID"> User ID.</param>
+ /// <param name="oldserver">iFolderServer object where the iFolder exists..</param>
+ ///
+ /// <returns>void.</returns>
+
+ public static void CheckUserPolicyStatus(string userName, iFolderServer ifServer){
+ UserPolicy usrPolicy = null;
+ String userID = ifServer.GetUserIDFromName(userName);
+ if( userID != null) {
+ Console.WriteLine("| Checking user policies post data restore. |");
+ usrPolicy = ifServer.GetUserPolicy(userID);
+ if( (usrPolicy != null) && !usrPolicy.LoginEnabled) {
+ Console.WriteLine("| Warning: Data is restored into a iFolder owned by disabled User. |");
+ Console.WriteLine("| User - {0} needs to be enabled to access the data. |",userName);
+ }
+ } else {
+ Console.WriteLine("| Warning: User - {0} does not exist on current iFolder server. |",userName);
+ }
+
+
+ }
/// <summary>
/// Checks the iFolder policy voilations after the data is restored.
/// </summary>
@@ -2877,7 +2930,7 @@
///
/// <returns>void.</returns>
- public static void checkiFolderPolicyStatus(string iFolderID, iFolderServer ifServer)
+ public static void CheckiFolderPolicyStatus(string iFolderID, iFolderServer ifServer)
{
iFolderPolicy currentPolicy = null;
@@ -2888,7 +2941,8 @@
return;
}
- if(( currentPolicy.SpaceUsed > currentPolicy.SpaceLimitEffective )
+ if( currentPolicy.SpaceLimitEffective != -1)//-1 means Policies are not set
+ if( ( currentPolicy.SpaceUsed > currentPolicy.SpaceLimitEffective )
|| (currentPolicy.SpaceAvailable == 0))
{
Console.WriteLine("| |");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-07-20 12:28:53
|
Revision: 7433
http://simias.svn.sourceforge.net/simias/?rev=7433&view=rev
Author: spkumar
Date: 2010-07-20 12:28:46 +0000 (Tue, 20 Jul 2010)
Log Message:
-----------
ID: bug#605468, bug#610575
Reviewer: Vikash, Shaju
Localization Required: No
Documentation Required: No
Modified the description for few help messages for restore tool options
Modified Paths:
--------------
trunk/src/utils/restore/iFolderServer.cs
Modified: trunk/src/utils/restore/iFolderServer.cs
===================================================================
--- trunk/src/utils/restore/iFolderServer.cs 2010-07-15 10:45:38 UTC (rev 7432)
+++ trunk/src/utils/restore/iFolderServer.cs 2010-07-20 12:28:46 UTC (rev 7433)
@@ -221,6 +221,7 @@
MainClass.DebugLog.Write(string.Format("Authorized with multibyte encoding..."));
}
+ MainClass.DebugLog.Write(string.Format("The public url is: {0}", this.PublicUrl));
if( redirect )
{
try
@@ -244,22 +245,28 @@
admin.Credentials = new NetworkCredential(this.adminNameForAuth, this.adminPasswordForAuth);
admin.Url = this.PublicUrl + "/iFolderAdmin.asmx";
admin.PreAuthenticate = true;
+ MainClass.DebugLog.Write(string.Format("iFolderAdmin object is created " ));
/*TBD: web is already initialized above. The following lines look invalid*/
web = new iFolderWeb();
web.Credentials = new NetworkCredential(this.adminNameForAuth, this.adminPasswordForAuth);
web.Url = this.PublicUrl + "/iFolderWeb.asmx";
web.PreAuthenticate = true;
+ MainClass.DebugLog.Write(string.Format("iFolderWeb object is created " ));
simws = new SimiasWebService();
simws.Credentials = new NetworkCredential(this.adminNameForAuth, this.adminPasswordForAuth);
simws.Url = this.PublicUrl + "/Simias.asmx";
simws.PreAuthenticate = true;
+ MainClass.DebugLog.Write(string.Format("SimiasWebService object is created " ));
try
{
iFolderUser AdminUser = null;
+ MainClass.DebugLog.Write(string.Format("Calling GetAutheticated User " ));
AdminUser = GetAuthenticatedUser();
if( AdminUser != null)
adminName = AdminUser.UserName;
+ else
+ MainClass.DebugLog.Write(string.Format("Failed to get Admin user using GetAuthenticatedUser"));
}
catch(Exception ex)
{
@@ -291,20 +298,19 @@
iFolderUser adminUser = this.GetAuthenticatedUser();
if( adminUser != null)
status = true;
+ MainClass.DebugLog.Write(string.Format("GetAuthenticatedUser Success"));
break;
}
- catch(Exception ex)
+ catch(InvalidOperationException /*inOpEx*/) {
+ MainClass.DebugLog.Write(string.Format("GetAuthenticatedUser Failed with Invalid Op"));
+ count++;
+ continue;
+ }
+ catch(Exception /*ex*/)
{
- if (ex.Message.IndexOf("InvalidOperation") >= 0)
- {
- count++;
- continue;
- }
- else
- {
- status = false;
- break;
- }
+ MainClass.DebugLog.Write(string.Format("GetAuthenticatedUser Failed with Exception"));
+ status = false;
+ break;
}
}
return status;
@@ -334,6 +340,8 @@
}
catch(Exception ex)
{
+
+ MainClass.DebugLog.Write(string.Format("Exception in Pingsimias: {0}--{1}", ex.Message, ex.StackTrace));
count++;
}
}
@@ -358,17 +366,10 @@
ifolder = this.admin.CreateiFolderWithID(iFolderName, OwnerUserID, description, iFolderID);
break;
}
- catch(Exception ex)
+ catch(InvalidOperationException /*inOpEx*/)
{
- if(ex.Message.IndexOf("InvalidOperation") >= 0)
- {
count++;
continue;
- }
- else
- {
- throw ex;
- }
}
}
if( ifolder != null)
@@ -401,17 +402,10 @@
ifolder = this.admin.CreateEncryptediFolderWithID(iFolderName, OwnerUserID, description, iFolderID, eKey, eBlob, eAlgorithm, rKey);
break;
}
- catch(Exception ex)
+ catch(InvalidOperationException /*inOpEx*/)
{
- if(ex.Message.IndexOf("InvalidOperation") >= 0)
- {
count++;
continue;
- }
- else
- {
- throw ex;
- }
}
}
if( ifolder != null)
@@ -450,15 +444,10 @@
homeServer = dom.GetHomeServer(userName).PublicAddress;
break;
}
- catch(Exception ex)
+ catch(InvalidOperationException /*inOpEx*/)
{
- if(ex.Message.IndexOf("InvalidOperation") >= 0)
- {
- count++;
- continue;
- }
- else
- throw ex;
+ count++;
+ continue;
}
}
}
@@ -495,15 +484,10 @@
users = this.admin.GetUsersBySearch(SearchProperty.UserName, SearchOperation.Equals, UserName, 0,1);
break;
}
- catch(Exception ex)
+ catch(InvalidOperationException /*inOpEx*/)
{
- if(ex.Message.IndexOf("InvalidOperation") >= 0 || ex.StackTrace.IndexOf("InvalidOperation") >= 0)
- {
count++;
continue;
- }
- else
- throw ex;
}
}
if( users == null || users.Items == null)
@@ -536,16 +520,15 @@
userList = this.admin.GetUsersBySearch( 0, 0, "*", currentOffset, count );
break;
}
- catch(Exception ex)
+ catch(InvalidOperationException /*inOpEx*/)
{
- if(ex.Message.IndexOf("InvalidOperation") >= 0)
- {
- count++;
- continue;
- }
- else
- break;
+ count++;
+ continue;
}
+ catch( Exception /*ex*/)
+ {
+ break;
+ }
}
MainClass.DebugLog.Write("Exit: Function GetUsersBySearch");
return userList;
@@ -572,16 +555,15 @@
collections = discService.GetAllCollectionIDsByUser( userID );
break;
}
- catch( Exception ex)
+ catch(InvalidOperationException /*inOpEx*/)
{
- if(ex.Message.IndexOf("InvalidOperation") >= 0)
- {
- count++;
- continue;
- }
- else
- break;
+ count++;
+ continue;
}
+ catch( Exception /*ex*/)
+ {
+ break;
+ }
}
MainClass.DebugLog.Write("Exit: Function GetAllCollectionIDsByUser");
return collections;
@@ -604,18 +586,17 @@
folder= this.admin.GetiFolder(iFolderID);
break;
}
- catch(Exception ex)
+ catch(InvalidOperationException /*inOpEx*/)
{
- if(ex.Message.IndexOf("InvalidOperation") >= 0)
- {
- count++;
- continue;
- }
- else
- break;
+ count++;
+ continue;
}
+ catch( Exception /*ex*/)
+ {
+ break;
+ }
}
- MainClass.DebugLog.Write("Exit: Function GetiFolder");
+ MainClass.DebugLog.Write("Exit: Function GetiFolder");
return folder;
}
//TBD: Need to provide the correct comments
@@ -638,14 +619,10 @@
users = this.admin.GetMembers( iFolderID, offset, count );
break;
}
- catch(Exception ex)
+ catch(InvalidOperationException /*inOpEx*/)
{
- if(ex.Message.IndexOf("InvalidOperation") >= 0)
- {
- count++;
- continue;
- }
- throw ex;
+ count++;
+ continue;
}
}
}
@@ -665,7 +642,7 @@
/// <returns>.</returns>
public bool RemoveMember( string iFolderID, string UserName)
{
- MainClass.DebugLog.Write("Enter: Function RemoveMember");
+ MainClass.DebugLog.Write("Enter: Function RemoveMember");
bool status = false;
try
{
@@ -678,14 +655,10 @@
this.admin.RemoveMember(iFolderID, UserID);
break;
}
- catch(Exception ex)
+ catch(InvalidOperationException /*inOpEx*/)
{
- if(ex.Message.IndexOf("InvalidOperation") >= 0)
- {
- count++;
+ count++;
continue;
- }
- throw ex;
}
}
status = true;
@@ -694,7 +667,7 @@
{
MainClass.DebugLog.Write(string.Format("Exception while removing membership: {0}--{1}", ex.Message, ex.StackTrace));
}
- MainClass.DebugLog.Write("Exit: Function RemoveMember");
+ MainClass.DebugLog.Write("Exit: Function RemoveMember");
return status;
}
//TBD: Need to provide the correct comments
@@ -720,14 +693,10 @@
this.admin.AddMember(iFolderID, UserID, rights);
break;
}
- catch(Exception ex)
+ catch(InvalidOperationException /*inOpEx*/)
{
- if( ex.Message.IndexOf("InvalidOperation") >= 0)
- {
- count++;
- continue;
- }
- throw ex;
+ count++;
+ continue;
}
}
MainClass.DebugLog.Write(string.Format("Successfully added member {0} to {1}", UserName, iFolderID));
@@ -755,14 +724,10 @@
entry = this.web.GetEntry(ifolderid, nodeid);
break;
}
- catch(Exception ex)
+ catch(InvalidOperationException /*inOpEx*/)
{
- if(ex.Message.IndexOf("InvalidOperation") >= 0 || ex.StackTrace.IndexOf("InvalidOperation") >= 0 )
- {
- count++;
- continue;
- }
- throw ex;
+ count++;
+ continue;
}
}
}
@@ -786,14 +751,10 @@
entries = this.web.GetEntries(ifolderid, nodeid, start, end);
break;
}
- catch(Exception ex)
+ catch(InvalidOperationException /*inOpEx*/)
{
- if(ex.Message.IndexOf("InvalidOperation") >= 0 || ex.StackTrace.IndexOf("InvalidOperation") >= 0 )
- {
- count++;
- continue;
- }
- throw ex;
+ count++;
+ continue;
}
}
}
@@ -817,14 +778,10 @@
ifolder = this.admin.GetiFolderDetails(ifolderid);
break;
}
- catch(Exception ex)
+ catch(InvalidOperationException /*inOpEx*/)
{
- if(ex.Message.IndexOf("InvalidOperation") >= 0 || ex.StackTrace.IndexOf("InvalidOperation") >= 0 )
- {
- count++;
- continue;
- }
- throw ex;
+ count++;
+ continue;
}
}
}
@@ -848,16 +805,14 @@
user= web.GetAuthenticatedUser();
break;
}
- catch (Exception ex)
+ catch(InvalidOperationException Ex)
{
- MainClass.DebugLog.Write(string.Format("Exception: {0}--{1}", ex.Message, ex.StackTrace));
- if(ex.StackTrace.IndexOf("InvalidOperation") >= 0)
- {
- count++;
- continue;
- }
- throw ex;
- }
+
+ MainClass.DebugLog.Write(string.Format("InvalidOperation Exception in GetAuthenticatedUser: {0}--{1}", Ex.Message, Ex.StackTrace));
+ count++;
+ continue;
+ }
+
}
}
catch(Exception ex)
@@ -881,16 +836,11 @@
retval= simws.SetRestoreStatusForCollection(ifolderid, restorestatus, totalcount, finishedcount);
break;
}
- catch (Exception ex)
+ catch(InvalidOperationException /*inOpEx*/)
{
- MainClass.DebugLog.Write(string.Format("Exception: {0}--{1}", ex.Message, ex.StackTrace));
- if(ex.Message.IndexOf("InvalidOperation") >= 0 || ex.StackTrace.IndexOf("InvalidOperation") >= 0)
- {
- count++;
- continue;
- }
- throw ex;
- }
+ count++;
+ continue;
+ }
}
}
@@ -920,16 +870,11 @@
retval= admin.GetRestoreStatusForCollection(ifolderid, out totalcount, out finishedcount);
break;
}
- catch (Exception ex)
+ catch(InvalidOperationException /*inOpEx*/)
{
- MainClass.DebugLog.Write(string.Format("Exception: {0}--{1}", ex.Message, ex.StackTrace));
- if(ex.Message.IndexOf("InvalidOperation") >= 0 || ex.StackTrace.IndexOf("InvalidOperation") >= 0)
- {
- count++;
- continue;
- }
- throw ex;
- }
+ count++;
+ continue;
+ }
}
}
@@ -954,14 +899,10 @@
entry = this.web.GetEntryByPath(ifolderid, parentdir);
break;
}
- catch(Exception ex)
+ catch(InvalidOperationException /*inOpEx*/)
{
- if(ex.Message.IndexOf("InvalidOperation") >= 0 || ex.StackTrace.IndexOf("InvalidOperation") >= 0 )
- {
- count++;
- continue;
- }
- throw ex;
+ count++;
+ continue;
}
}
}
@@ -985,14 +926,10 @@
entry = this.web.CreateEntry(ifolderid, ParentEntryID, type, name);
break;
}
- catch(Exception ex)
+ catch(InvalidOperationException /*inOpEx*/)
{
- if(ex.Message.IndexOf("InvalidOperation") >= 0 || ex.StackTrace.IndexOf("InvalidOperation") >= 0 )
- {
- count++;
- continue;
- }
- throw ex;
+ count++;
+ continue;
}
}
}
@@ -1248,16 +1185,10 @@
{
entryset = this.simws.GetEntries(ifolderID, type, relPath, index, max, accessID);
}
- catch(Exception ex)
+ catch(InvalidOperationException /*inOpEx*/)
{
- if(ex.Message.IndexOf("InvalidOperation") >= 0 || ex.StackTrace.IndexOf("InvalidOperation") >= 0 )
- {
- MainClass.DebugLog.Write(string.Format("Invalid operation exception. {0}--{1}", ex.Message, ex.StackTrace));
- count++;
- continue;
- }
- break;
-
+ count++;
+ continue;
}
break;
}while(count < MaxCount);
@@ -1275,15 +1206,10 @@
MainClass.DebugLog.Write(string.Format("Calling RestoreiFolderData"));
retval = this.admin.RestoreiFolderData(url, adminname, adminpassword, ifolderid, relativepath, basepath, startindex, MainClass.FailedLog.LogFile);
}
- catch(Exception ex)
+ catch(InvalidOperationException /*inOpEx*/)
{
- if(ex.Message.IndexOf("InvalidOperation") >= 0 || ex.StackTrace.IndexOf("InvalidOperation") >= 0 )
- {
- count++;
- continue;
- }
- break;
-
+ count++;
+ continue;
}
break;
}
@@ -1303,15 +1229,10 @@
MainClass.DebugLog.Write(string.Format("Calling GetRestoreStatusForCollection for {0}", ifolderid));
retval = this.admin.GetRestoreStatusForCollection( ifolderid, out totalcount, out finishedcount);
}
- catch(Exception ex)
+ catch(InvalidOperationException /*inOpEx*/)
{
- if(ex.Message.IndexOf("InvalidOperation") >= 0 || ex.StackTrace.IndexOf("InvalidOperation") >= 0 )
- {
- count++;
- continue;
- }
- break;
-
+ count++;
+ continue;
}
break;
}while(count < MaxCount);
@@ -1333,12 +1254,11 @@
try {
return this.admin.GetUserPolicy(userId, null);
- } catch(Exception ex) {
- if(ex.Message.IndexOf("InvalidOperation") >= 0 || ex.StackTrace.IndexOf("InvalidOperation") >= 0 ) {
- count++;
- continue;
- }
- throw ex;
+ }
+ catch(InvalidOperationException /*inOpEx*/)
+ {
+ count++;
+ continue;
}
}
} catch(Exception ex){
@@ -1346,7 +1266,6 @@
}
return usrPolicy;
}
- /// <summary>
/// Retrieves the iFolder policy from the given iFolder ID.
/// </summary>
/// <param name="iFolderID"> ID of the iFolder for which policy needs to be retreived.</param>
@@ -1366,14 +1285,10 @@
return this.admin.GetiFolderPolicy(ifolderid, null);
}
- catch(Exception ex)
+ catch(InvalidOperationException /*inOpEx*/)
{
- if(ex.Message.IndexOf("InvalidOperation") >= 0 || ex.StackTrace.IndexOf("InvalidOperation") >= 0 )
- {
- count++;
- continue;
- }
- throw ex;
+ count++;
+ continue;
}
}
}
@@ -1404,14 +1319,10 @@
this.admin.SetiFolderPolicy(ifdPolicy);
break;
}
- catch(Exception ex)
+ catch(InvalidOperationException /*inOpEx*/)
{
- if(ex.Message.IndexOf("InvalidOperation") >= 0 || ex.StackTrace.IndexOf("InvalidOperation") >= 0 )
- {
- count++;
- continue;
- }
- throw ex;
+ count++;
+ continue;
}
}
}
@@ -1471,7 +1382,7 @@
UseWebAccessOption.OnOptionEntered = new Option.OptionEnteredHandler( OnUseWebAccess);
RecoverOption.OnOptionEntered = new Option.OptionEnteredHandler( OnRecover);
RetryOption.OnOptionEntered = new Option.OptionEnteredHandler( OnRetry);
- PolicyOption.OnOptionEntered = new Option.OptionEnteredHandler( OnPolicy);
+ PolicyOption.OnOptionEntered = new Option.OptionEnteredHandler( OnRestorePolicy);
LogLocationOption.OnOptionEntered = new Option.OptionEnteredHandler( OnLogLocation);
} //End of function CommandParsing Constructor
@@ -1628,11 +1539,11 @@
return true;
}
- private bool OnPolicy()
- {
- MainClass.OverwritePolicies = true;
- return true;
- }
+ private bool OnRestorePolicy()
+ {
+ MainClass.OverwritePolicies = true;
+ return true;
+ }
private bool OnLogLocation()
{
@@ -1704,7 +1615,7 @@
public static int Main(string[] args)
{
int RestoreStatus = (int)status.Failed;
- CertPolicy certPolicy = new CertPolicy();
+ CertPolicy certPolicy = new CertPolicy();
try
{
string loglocation = Utility.ReadModMonoConfiguration();
@@ -2029,7 +1940,7 @@
{
Utility.Execute( "chmod", "0777 {0}", path);
}
- catch(Exception ex)
+ catch(Exception /*ex*/)
{
MainClass.DebugLog.Write(string.Format("Grant rights failed for path {0}", path));
}
@@ -2293,7 +2204,7 @@
{
OldServer = new iFolderServer( OldServerUrl,oldAdminName, oldAdminPassword, false);
}
- catch(Exception e1)
+ catch(Exception /*e1*/)
{
OldServer = null;
Console.WriteLine("| Unable to contact the backup server. |");
@@ -2315,13 +2226,13 @@
{
NewServer = new iFolderServer( currentServerUrl, newAdminName, newAdminPassword);
}
- catch(Exception e2)
+ catch(Exception /*e2*/)
{
NewServer = null;
MainClass.DebugLog.Write(string.Format("Unable to contact the new server."));
}
if( NewServer == null || NewServer.PingServer() == false)
- return (int)status.BackupServerNotRunning;
+ return (int)status.CurrentServerNotRunning;
if( NewServer.GetAuthenticatedUser() == null)
return (int)status.InvalidCredentials;
}
@@ -2447,19 +2358,16 @@
newifolderDetails = NewServer.GetiFolderDetails( iFolderID );
break;
}
- catch(Exception ex)
+ catch(InvalidOperationException /*inOpEx*/)
{
- if(ex.Message.IndexOf("InvalidOperation") >= 0)
- {
- MainClass.DebugLog.Write(string.Format("Exception: at call webacess GetiFolderDetails: count:{0}",count.ToString()));
- count++;
- continue;
- }
- else
- {
- break;
- }
+ count++;
+ continue;
}
+ catch(Exception /*ex*/)
+ {
+ break;
+
+ }
}
string iFolderLocation = null;
@@ -2491,7 +2399,7 @@
retval = RestoreiFolderData(iFolderID, OldServer, oldUnManagedPath, NewServer,
newifolderDetails.UnManagedPath, relativepath, MainClass.UseWebAccess);
}
- if( (retval == 0) && (MainClass.OverwritePolicies == true))
+ if( (retval == 0) && MainClass.OverwritePolicies )
{
retval = RestoreiFolderPolicy(iFolderID, OldServer, NewServer);
}
@@ -2577,7 +2485,7 @@
retval = true;
}
}
- catch(Exception ex)
+ catch(Exception /*ex*/)
{
retval = false;
}
@@ -2895,9 +2803,9 @@
}
}
- MainClass.DebugLog.Write(string.Format(" iFolderID-{0},\n\tLocked-{1} \n\tSpaceLimit - {2}, \n\tSyncInterval - {3},\n\tSharingStatus - {4},\n\tFileSizeLimit-{5},\n\tFileTypesIncludes - {6},\n\tFileTypesExcludes - {7} ",
+ MainClass.DebugLog.Write(string.Format(" iFolderID-{0},\n\tLocked-{1} \n\tSpaceLimit - {2}, \n\tSyncInterval - {3},\n\tSharingStatus - {4},\n\tFileSizeLimit-{5},\n\tFileTypesIncludes - {6},\n\tFileTypesExcludes - {7} ,\n\tEffectiveSpaceLimit={8},\n\tSpaceAvailable={9}",
ifdPolicy.iFolderID, ifdPolicy.Locked, ifdPolicy.SpaceLimit,
- ifdPolicy.SyncInterval, ifdPolicy.SharingStatus, ifdPolicy.FileSizeLimit, includeFilter.ToString(), excludeFilter.ToString()));
+ ifdPolicy.SyncInterval, ifdPolicy.SharingStatus, ifdPolicy.FileSizeLimit, includeFilter.ToString(), excludeFilter.ToString(),ifdPolicy.SpaceLimitEffective,ifdPolicy.SpaceAvailable));
}
/// <summary>
@@ -3094,20 +3002,20 @@
{
Console.WriteLine("Command For Execution: $ifolder-data-recovery <Operation> <Arguments>\n");
- Console.WriteLine("Operation:\n\t-l, --list\tLists iFolders owned by the specified user and details such as Name,\n\t\t\t\tiFolderID, and Path (at the time of backup)");
+ Console.WriteLine("Operation:\n\t-l, --list\tLists iFolders owned by the specified user and details such as Name,\n\t\t\tiFolderID, and Path (at the time of backup)");
Console.WriteLine("\t-r, --restore\tRestore requested data (File/Folder/iFolder) from specified backup store.");
- Console.WriteLine("\t--retry\t\tRetry restore opreation for failed data in last run.");
+ Console.WriteLine("\t--retry\t\tRetry restore operation for failed data in last run.");
Console.WriteLine("\t-h, --help\tPrint help regarding Operation, argument and usage.");
- Console.WriteLine("\t\nArguments:\n\t--path\t\t\tpath for simias file in backup store");
- Console.WriteLine("\t-U, --backup-admin\tLogin name of the Administrator who performed the backup");
- Console.WriteLine("\t-u,--current-admin\tAdministrator login name for the current server. Use this Option if backup \n\t\t\t\t admin is different from current admin.");
- Console.WriteLine("\t--server-url\t\tURL of the server where data is to be restored");
+ Console.WriteLine("\t\nArguments:\n\t--path\t\t\tPath of simias directory that has the iFolder backup store, FlaimSimias.db");
+ Console.WriteLine("\t-U, --backup-admin\tLogin name of iFolder administrator who performed the backup");
+ Console.WriteLine("\t-u,--current-admin\tiFolder administrator login name for the current server. Use this Option if backup \n\t\t\t\tadministrator is different from current administrator.");
+ Console.WriteLine("\t--server-url\t\tPublic URL of the iFolder server where data is to be restored");
Console.WriteLine("\t--user\t\t\tUsername of the user for whom the specified operation is to be performed");
Console.WriteLine("\t--ifolder-id\t\tID of the iFolder for which the specified operation is to be performed");
- Console.WriteLine("\t--ifolder-path\t\tAbsolute path (excluding the iFolder name) of the actual data to be restored");
+ Console.WriteLine("\t--ifolder-path\t\tAbsolute path (excluding the iFolder name) to the location where iFolder backup data is available. ");
Console.WriteLine("\t--relative-path\t\tRelative path of file/folder to be restored, starting from iFolder name");
Console.WriteLine("\t--usewebaccess\t\tSpecifies the mode to restore. Does not take any value.");
- Console.WriteLine("\t--restore-policies\tOverwrites current iFolder policies with the policies of the iFolder from backup");
+ Console.WriteLine("\t--restore-policies\tOverwrites current iFolder policies with the policies of the iFolder from backup");
Console.WriteLine("\t\nExamples:");
Console.WriteLine("\n\tFor Help:");
Console.WriteLine("\t\t$./ifolder-data-recovery --help");
@@ -3116,9 +3024,9 @@
Console.WriteLine("\t\t$./ifolder-data-recovery --list --path=/home/recovery/data/ --backup-admin=admin --user=user1");
Console.WriteLine("\n\tFor Restoring iFolder:");
- Console.WriteLine("\t\t$./ifolder-data-recovery --restore --path=/home/recovery/data/ --backup-admin=oldadmin --current-admin=admin --server-url=http://192.162.1.10 --ifolder-id=7fe6cd5d-40d4-4982-bfa3-94292d4e36ab --ifolder-path=/home/ifolder/7fe6cd5d-40d4-4982-bfa3-94292d4e36ab");
+ Console.WriteLine("\t\t$./ifolder-data-recovery --restore --path=/home/recovery/data/ --backup-admin=oldadmin --current-admin=admin --server-url=https://192.162.1.10 --ifolder-id=7fe6cd5d-40d4-4982-bfa3-94292d4e36ab --ifolder-path=/home/ifolder/7fe6cd5d-40d4-4982-bfa3-94292d4e36ab");
- Console.WriteLine("\n\tFor Restoring Folder:");
+ Console.WriteLine("\n\tFor Restoring directory inside a iFolder:");
Console.WriteLine("\t\t$./ifolder-data-recovery --restore --path=/home/recovery/data/ --backup-admin=admin --server-url=http://192.162.1.10 --ifolder-id=7fe6cd5d-40d4-4982-bfa3-94292d4e36ab --ifolder-path=/home/ifolder/7fe6cd5d-40d4-4982-bfa3-94292d4e36ab --relative-path=MyiFolder/Subdir");
Console.WriteLine("\n\tFor Restoring File:");
@@ -3260,7 +3168,7 @@
public static long NumberOfLines(string fileName)
{
MainClass.DebugLog.Write(string.Format("Enter Function NumberOfLines for file:{0}",fileName));
- string line = null;
+ //string line = null;
long numOfLines = 0;
TextReader reader = null;
if(fileName != null || fileName != string.Empty)
@@ -3268,7 +3176,7 @@
try{
using( reader = (TextReader)File.OpenText(fileName) )
{
- while( ( line = reader.ReadLine() ) != null )
+ while( reader.ReadLine() != null )
{
numOfLines++;
}
@@ -3365,7 +3273,7 @@
char[] trimchar= {'"'};
string[] entryset = null;
string logpath= null;
- string simiasDir = null;
+ //string simiasDir = null;
while ((line = sr.ReadLine()) != null)
{
@@ -3439,7 +3347,7 @@
}
}
- public string ToString()
+ public override string ToString()
{
if( this.logFile == null)
{
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-08-04 12:58:38
|
Revision: 7451
http://simias.svn.sourceforge.net/simias/?rev=7451&view=rev
Author: spkumar
Date: 2010-08-04 12:58:32 +0000 (Wed, 04 Aug 2010)
Log Message:
-----------
ID: Bug#607075
Reviewer: Ramesh
Localization Required: No
Documentation Required: No
Description: Fixed an issue in restore tool during the user policy check
Modified Paths:
--------------
trunk/src/utils/restore/iFolderServer.cs
Modified: trunk/src/utils/restore/iFolderServer.cs
===================================================================
--- trunk/src/utils/restore/iFolderServer.cs 2010-08-04 12:57:14 UTC (rev 7450)
+++ trunk/src/utils/restore/iFolderServer.cs 2010-08-04 12:58:32 UTC (rev 7451)
@@ -2407,7 +2407,7 @@
//This check needs to be done unconditionally. Policy violation can happen
// during a partial or a full restore.
CheckiFolderPolicyStatus(iFolderID, NewServer);
- CheckUserPolicyStatus(userName,NewServer);
+ CheckUserPolicyStatus(iFolderID, OldServer, NewServer);
}
return retval;
@@ -2816,9 +2816,12 @@
///
/// <returns>void.</returns>
- public static void CheckUserPolicyStatus(string userName, iFolderServer ifServer){
+ public static void CheckUserPolicyStatus(string ifolderID, iFolderServer oldServer, iFolderServer ifServer){
UserPolicy usrPolicy = null;
- String userID = ifServer.GetUserIDFromName(userName);
+ //Get the Owner from the iFolder and check if there is any violation in the user policies.
+ iFolder ifld = oldServer.GetiFolder(ifolderID);
+ String userID = ifld.OwnerID;
+ String userName = ifld.OwnerUserName;
if( userID != null) {
Console.WriteLine("| Checking user policies post data restore. |");
usrPolicy = ifServer.GetUserPolicy(userID);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-08-11 11:26:12
|
Revision: 7459
http://simias.svn.sourceforge.net/simias/?rev=7459&view=rev
Author: spkumar
Date: 2010-08-11 11:26:05 +0000 (Wed, 11 Aug 2010)
Log Message:
-----------
ID: Bug#612830
Reviewer: Vikash
Localization Required: No
Documentation Required: No
Description: To fix an issue in restore tool when invalid path is
provided for ifolder backup store.
Modified Paths:
--------------
trunk/src/utils/restore/iFolderServer.cs
Modified: trunk/src/utils/restore/iFolderServer.cs
===================================================================
--- trunk/src/utils/restore/iFolderServer.cs 2010-08-11 10:48:10 UTC (rev 7458)
+++ trunk/src/utils/restore/iFolderServer.cs 2010-08-11 11:26:05 UTC (rev 7459)
@@ -154,6 +154,10 @@
/// Failed to restore iFolder policy
/// </summary>
PolicyRestoreFailed,
+ /// <summary>
+ /// Invalid Path Specified
+ /// </summary>
+ InvalidBackupPath,
}
public enum Command
@@ -2169,6 +2173,21 @@
Console.WriteLine("| The backup datapath does not exist |");
return (int)status.DataPathDoesNotExist;
}
+ else {
+ //Check for mandatory files in the given simias path
+ string simiasPath = DataPath+"/simias";
+ if( !Directory.Exists(simiasPath)) {
+ Console.WriteLine("| Error: simias directory does not exist at the specified path: {0} .|",DataPath);
+ return (int)status.InvalidBackupPath;
+ }
+ string flaimdb= DataPath+"/simias/FlaimSimias.db";
+ if(!File.Exists (flaimdb) ){
+
+ Console.WriteLine("| Error: iFolder simias database ({0}) does not exist at the specified path.|",flaimdb);
+ return (int)status.InvalidBackupPath;
+ }
+
+ }
if( Operation == (int)Command.Restore )
{
if(relativePath != string.Empty && relativePath != null) {
@@ -3055,8 +3074,11 @@
case (int)status.Failed:
Console.WriteLine("\n| Restore Operation failed. |");
break;
- case (int)status.InvalidInput:
- Console.WriteLine("\n| Restore Operation failed,Input data is Invalid. |");
+ case (int)status.InvalidInput:
+ Console.WriteLine("\n| Restore Operation failed,Input data is Invalid. |");
+ break;
+ case (int)status.InvalidBackupPath:
+ Console.WriteLine("| Invalid path specified for option --path | ");
break;
case (int)status.InvalidFormat:
Console.WriteLine("\n| Restore Operation failed , Input data Format is invalid. |");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-08-25 08:15:07
|
Revision: 7477
http://simias.svn.sourceforge.net/simias/?rev=7477&view=rev
Author: spkumar
Date: 2010-08-25 08:15:01 +0000 (Wed, 25 Aug 2010)
Log Message:
-----------
ID: Bug#626261
Reviewer: Johnny,Vikash
Localization Required: No
Documentation Required: No
Description: Fixed an issue while handling user password options in the
command line
Modified Paths:
--------------
trunk/src/utils/restore/iFolderServer.cs
Modified: trunk/src/utils/restore/iFolderServer.cs
===================================================================
--- trunk/src/utils/restore/iFolderServer.cs 2010-08-25 08:12:32 UTC (rev 7476)
+++ trunk/src/utils/restore/iFolderServer.cs 2010-08-25 08:15:01 UTC (rev 7477)
@@ -231,7 +231,7 @@
try
{
String RedirectedUrl = this.GetHomeServer(adminUserName);
- if( RedirectedUrl != null && RedirectedUrl != string.Empty)
+ if( ! String.IsNullOrEmpty(RedirectedUrl))
{
this.PublicUrl = RedirectedUrl;
}
@@ -953,9 +953,9 @@
{
MainClass.DebugLog.Write("Enter: Function CreateDirectory");
string parentdir = Path.GetDirectoryName(relativepath);
- if( parentdir == null || parentdir == string.Empty)
+ if( String.IsNullOrEmpty(parentdir))
{
- MainClass.DebugLog.Write("Creatinmg the directory node for root level node which will be created as part of iFolder creation. ");
+ MainClass.DebugLog.Write("Creating the directory node for root level node which will be created as part of iFolder creation. ");
return true;
}
iFolderEntry NewEntry = null;
@@ -1668,15 +1668,25 @@
if (MainClass.useSameAdminName == true)
{
+ if ( String.IsNullOrEmpty(oldAdminPassword) ) {
+ oldAdminPassword = ForPasswordString(string.Format("| Password for iFolder server admin (user={0}):",MainClass.newAdminName),null);
+ }
+ newAdminPassword = oldAdminPassword;
- newAdminPassword = ForPasswordString(string.Format("| Password for iFolder server admin (user={0}):",MainClass.newAdminName),null);
- oldAdminPassword = newAdminPassword;
}
else
{
+ if ( String.IsNullOrEmpty(oldAdminPassword ))
oldAdminPassword = ForPasswordString(string.Format("| Password for backup iFolder server admin (user={0}):",MainClass.oldAdminName),null);
- newAdminPassword = ForPasswordString(string.Format("\n| Password for current iFolder server admin (user={0}):",MainClass.newAdminName),null);
+ if ( String.IsNullOrEmpty(newAdminPassword))
+ newAdminPassword = ForPasswordString(string.Format("\n| Password for current iFolder server admin (user={0}):",MainClass.newAdminName),null);
}
+ // Ensure the password has a valid string
+ if ( String.IsNullOrEmpty(newAdminPassword) || String.IsNullOrEmpty(oldAdminPassword)) {
+ Console.WriteLine("| Error: Invalid value for Password |");
+ return (int)status.MissingFields;
+
+ }
}
if( (RestoreStatus = ValidateInput(PrecheckFlag)) != 0)
@@ -1713,7 +1723,7 @@
string newAdminID = NewServer.GetUserIDFromName(newAdminName);
MainClass.DebugLog.Write(string.Format("The new admin ID is: {0}", newAdminID));
- if( oldAdminID == string.Empty || oldAdminID == null || newAdminID == string.Empty || newAdminID == null)
+ if( String.IsNullOrEmpty(oldAdminID) || String.IsNullOrEmpty(newAdminID))
{
MainClass.DebugLog.Write(string.Format("Incorrect Admin Credential Or iFolder Server is not accessible and exit status is:{0}.","EmptyAdminID"));
RestoreStatus = (int)status.EmptyAdminID;
@@ -1751,7 +1761,7 @@
string OwnerUserID = ifolder.OwnerID;
RedirectedNewServerUrl = NewServer.GetHomeServer(ifolder.OwnerUserName);
- if( RedirectedNewServerUrl == null || RedirectedNewServerUrl == String.Empty )
+ if( String.IsNullOrEmpty(RedirectedNewServerUrl) )
{
MainClass.DebugLog.Write(string.Format("Failed, fetching Home information for ifolder owner user:{0} on current server with exit status as: {1}",ifolder.OwnerUserName, "EmptyNewServerUrl"));
RestoreStatus = (int)status.EmptyNewServerUrl;
@@ -1843,7 +1853,7 @@
if( runpreviousiter == false)
WriteDetailsToXML( relativePath );
- if( relativePath == null || relativePath == string.Empty)
+ if( String.IsNullOrEmpty(relativePath))
fullrecovery = true;
bool retStatus = false;
@@ -2103,7 +2113,7 @@
try
{
- if( EncryptionAlgorithm != null && EncryptionAlgorithm != string.Empty)
+ if( !String.IsNullOrEmpty(EncryptionAlgorithm))
{
string eKey = null, eBlob = null, eAlgorithm = null, rKey = null;
bool encrSettings = OldServer.simws.GetEncryptionDetails(iFolderID, out eKey, out eBlob, out eAlgorithm, out rKey);
@@ -2190,7 +2200,7 @@
}
if( Operation == (int)Command.Restore )
{
- if(relativePath != string.Empty && relativePath != null) {
+ if(!String.IsNullOrEmpty(relativePath)) {
if( !File.Exists(Path.Combine(FolderLocation,relativePath) )
&& !Directory.Exists(Path.Combine(FolderLocation,relativePath) ))
{
@@ -2205,14 +2215,14 @@
}
/// In case of listing, we should have the temporary server up and running, and old server credentials should be proper. User name is expected.
- if( ListingFlag && (userName == null || userName == string.Empty))
+ if( ListingFlag && String.IsNullOrEmpty(userName))
{
Console.WriteLine("| The input has some fields missing. |");
return (int)status.MissingFields;
}
- if( oldAdminName == null || oldAdminName == string.Empty)
+ if( String.IsNullOrEmpty(oldAdminName))
return (int)status.MissingFields;
- if( !ListingFlag && ( newAdminName == null || newAdminName == string.Empty || currentServerUrl == null || currentServerUrl == string.Empty
+ if( !ListingFlag && ( String.IsNullOrEmpty(newAdminName) || String.IsNullOrEmpty(currentServerUrl)
|| collectionid == null || FolderLocation == null))
return (int)status.MissingFields;
@@ -3036,7 +3046,8 @@
Console.WriteLine("\t--ifolder-id\t\tID of the iFolder for which the specified operation is to be performed");
Console.WriteLine("\t--ifolder-path\t\tAbsolute path (excluding the iFolder name) to the location where iFolder backup data is available. ");
Console.WriteLine("\t--relative-path\t\tRelative path of file/folder to be restored, starting from iFolder name");
- Console.WriteLine("\t--usewebaccess\t\tSpecifies the mode to restore. Does not take any value.");
+// Console.WriteLine("\t--usewebaccess\t\tSpecifies the mode to restore. Does not take any value.");
+ Console.WriteLine("\t--usewebaccess\t\tSpecifies the mode of restore. Use this option while restoring the data to a remote iFolder Server.");
Console.WriteLine("\t--restore-policies\tOverwrites current iFolder policies with the policies of the iFolder from backup");
Console.WriteLine("\t\nExamples:");
Console.WriteLine("\n\tFor Help:");
@@ -3196,7 +3207,7 @@
//string line = null;
long numOfLines = 0;
TextReader reader = null;
- if(fileName != null || fileName != string.Empty)
+ if( !String.IsNullOrEmpty(fileName) )
{
try{
using( reader = (TextReader)File.OpenText(fileName) )
@@ -3302,7 +3313,7 @@
while ((line = sr.ReadLine()) != null)
{
- if(line != null && line != String.Empty && line.StartsWith(SearchStr) == true )
+ if( !String.IsNullOrEmpty(line) && line.StartsWith(SearchStr) == true )
{
int startIndex = line.LastIndexOf('=');
dataPath = line.Substring(startIndex+1,(line.Length - startIndex - 2 ));
@@ -3395,7 +3406,7 @@
{
try
{
- if( this.logFile == null || this.logFile == String.Empty )
+ if( String.IsNullOrEmpty(this.logFile))
{
//MainClass.DebugLog.Write(string.Format("{0}: {1}", DateTime.Now.ToString("f"), Message));
}
@@ -3422,7 +3433,7 @@
{
try
{
- if( this.logFile == null || this.logFile == string.Empty)
+ if( String.IsNullOrEmpty (this.logFile))
return;
if( stream == null)
return;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-08-25 08:36:23
|
Revision: 7480
http://simias.svn.sourceforge.net/simias/?rev=7480&view=rev
Author: spkumar
Date: 2010-08-25 08:36:17 +0000 (Wed, 25 Aug 2010)
Log Message:
-----------
ID: Bug#631462
Reviewer: Ramesh,Vikash
Localization Required: No
Documentation Required: No
Description: Modified the warning messages during policy violations
Modified Paths:
--------------
trunk/src/utils/restore/iFolderServer.cs
Modified: trunk/src/utils/restore/iFolderServer.cs
===================================================================
--- trunk/src/utils/restore/iFolderServer.cs 2010-08-25 08:24:36 UTC (rev 7479)
+++ trunk/src/utils/restore/iFolderServer.cs 2010-08-25 08:36:17 UTC (rev 7480)
@@ -2185,12 +2185,12 @@
}
else {
//Check for mandatory files in the given simias path
- string simiasPath = DataPath+"/simias";
+ string simiasPath = Path.Combine(DataPath, "/simias");;
if( !Directory.Exists(simiasPath)) {
Console.WriteLine("| Error: simias directory does not exist at the specified path: {0} .|",DataPath);
return (int)status.InvalidBackupPath;
}
- string flaimdb= DataPath+"/simias/FlaimSimias.db";
+ string flaimdb= Path.Combine(DataPath, "/simias/FlaimSimias.db");
if(!File.Exists (flaimdb) ){
Console.WriteLine("| Error: iFolder simias database ({0}) does not exist at the specified path.|",flaimdb);
@@ -2433,6 +2433,7 @@
retval = RestoreiFolderPolicy(iFolderID, OldServer, NewServer);
}
+ Console.WriteLine("| Checking policies post data restore |");
//This check needs to be done unconditionally. Policy violation can happen
// during a partial or a full restore.
CheckiFolderPolicyStatus(iFolderID, NewServer);
@@ -2852,7 +2853,6 @@
String userID = ifld.OwnerID;
String userName = ifld.OwnerUserName;
if( userID != null) {
- Console.WriteLine("| Checking user policies post data restore. |");
usrPolicy = ifServer.GetUserPolicy(userID);
if( (usrPolicy != null) && !usrPolicy.LoginEnabled) {
Console.WriteLine("| Warning: Data is restored into a iFolder owned by disabled User. |");
@@ -2864,6 +2864,26 @@
}
+ public static string ConvertSizeToString(long size) {
+ long OneKB = 1024;
+ long OneMB = 1024*OneKB;
+ long OneGB = 1024*OneMB;
+
+ if (size > OneGB) {
+ float Gbs = (float)size/OneGB;
+ return String.Format("{0:F}G",Gbs);
+ } else if (size > OneMB){
+ float Mbs = (float)size/OneMB;
+ return String.Format("{0:F}M",Mbs);
+ } else if (size > OneKB) {
+ float Kbs = (float)size/OneKB;
+ return String.Format("{0:F}K",Kbs);
+ } else {
+ return String.Format("{0}",size);
+ }
+
+
+ }
/// <summary>
/// Checks the iFolder policy voilations after the data is restored.
/// </summary>
@@ -2890,7 +2910,7 @@
Console.WriteLine("| |");
Console.WriteLine("| Warning: Restoring the data resulted in violation of the space limit |");
Console.WriteLine("| policy for the iFolder. User should delete unused data to reduce used |");
- Console.WriteLine("| space to permissible limits. Space Used = {0}, Effective Space Limit={1} |",currentPolicy.SpaceUsed, currentPolicy.SpaceLimitEffective);
+ Console.WriteLine("| space to permissible limits. Space Used = {0}, Effective Space Limit={1} |",ConvertSizeToString(currentPolicy.SpaceUsed), ConvertSizeToString(currentPolicy.SpaceLimitEffective));
}
@@ -2917,7 +2937,7 @@
iFolderPolicy newPolicy = null;
int retval = 0;
MainClass.DebugLog.Write(string.Format(" iFolderID-{0}, oldserver-{1}, newserver-{2}",iFolderID.ToString(), oldserver.ToString(), newserver.ToString()));
- Console.WriteLine("| Processing iFolder policies |");
+ Console.WriteLine("| Restoring iFolder policies |");
MainClass.DebugLog.Write(string.Format("Fetching iFolder policy details from backup"));
oldPolicy = oldserver.GetiFolderPolicy(iFolderID);
@@ -2985,7 +3005,7 @@
MainClass.DebugLog.Write(string.Format("Calling RestoreDataLocally"));
retval = RestoreDataLocally(iFolderID, oldserver, oldpath, newserver, newpath, relativepath, startindex, FailedLog.LogFile);
if( retval == 0)
- Console.WriteLine("\n| Restored process Successful. |");
+ Console.WriteLine("\n| Restore process Successful. |");
else
Console.WriteLine("\n| Restore process failed. |");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-08-25 08:48:00
|
Revision: 7482
http://simias.svn.sourceforge.net/simias/?rev=7482&view=rev
Author: spkumar
Date: 2010-08-25 08:47:53 +0000 (Wed, 25 Aug 2010)
Log Message:
-----------
ID: Bug#613137
Reviewer: Vikash
Localization Required: No
Documentation Required: No
Description: To include a check to validate the number of ifolders per
user policy after the data restore
Modified Paths:
--------------
trunk/src/utils/restore/iFolderServer.cs
Modified: trunk/src/utils/restore/iFolderServer.cs
===================================================================
--- trunk/src/utils/restore/iFolderServer.cs 2010-08-25 08:36:54 UTC (rev 7481)
+++ trunk/src/utils/restore/iFolderServer.cs 2010-08-25 08:47:53 UTC (rev 7482)
@@ -1243,6 +1243,36 @@
return retval;
}
/// <summary>
+ /// Invokes the GetiFolderLimitPolicyStatus method to check the status of iFolder limits
+ /// </summary>
+ /// <param name="userId"> ID of the User for whom policy needs to be checked.</param>
+ ///
+ /// <returns> 0 if there are no violations
+ /// 1 in case of violations
+ /// -1 if there is any exception while execting the api .</returns>
+
+ public int GetiFolderLimitPolicyStatus( string userId )
+ {
+ try {
+ int count = 0;
+ while (count < MaxCount){
+ try {
+ return this.admin.GetiFolderLimitPolicyStatus(userId);
+
+ }
+ catch(InvalidOperationException /*inOpEx*/)
+ {
+ count++;
+ continue;
+ }
+ }
+ } catch(Exception ex){
+ MainClass.DebugLog.Write(string.Format("Exception while checking the iFolder limit policy {0}--{1}", ex.Message, ex.StackTrace));
+ }
+ return -1;
+ }
+
+ /// <summary>
/// Retrieves the User policy from the given User ID.
/// </summary>
/// <param name="userId"> ID of the User for whom policy needs to be retreived.</param>
@@ -2854,9 +2884,18 @@
String userName = ifld.OwnerUserName;
if( userID != null) {
usrPolicy = ifServer.GetUserPolicy(userID);
- if( (usrPolicy != null) && !usrPolicy.LoginEnabled) {
- Console.WriteLine("| Warning: Data is restored into a iFolder owned by disabled User. |");
- Console.WriteLine("| User - {0} needs to be enabled to access the data. |",userName);
+ if( usrPolicy != null) {
+ if( !usrPolicy.LoginEnabled) {
+ Console.WriteLine("| Warning: Data is restored into a iFolder owned by disabled User. |");
+ Console.WriteLine("| User - {0} needs to be enabled to access the data. |",userName);
+ }
+ int ifCountPolicyStatus = ifServer.GetiFolderLimitPolicyStatus(userID);
+ if ( ifCountPolicyStatus == 0){
+ Console.WriteLine("| Warning: Restoring the data resulted in violation of iFolders per user policy. |");
+ Console.WriteLine("| Check the number of iFolders owned by user {0} |", userName);
+ } else if ( ifCountPolicyStatus == -1){
+ Console.WriteLine("| Warning: Error while checking the iFolder limit policy. |");
+ }
}
} else {
Console.WriteLine("| Warning: User - {0} does not exist on current iFolder server. |",userName);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-09-01 08:32:53
|
Revision: 7506
http://simias.svn.sourceforge.net/simias/?rev=7506&view=rev
Author: spkumar
Date: 2010-09-01 08:32:47 +0000 (Wed, 01 Sep 2010)
Log Message:
-----------
ID: Bug#636117
Reviewer: Ramesh
Localization Required: No
Documentation Required: No
Description: To fix an issue while validating the input paths
Modified Paths:
--------------
trunk/src/utils/restore/iFolderServer.cs
Modified: trunk/src/utils/restore/iFolderServer.cs
===================================================================
--- trunk/src/utils/restore/iFolderServer.cs 2010-09-01 08:29:05 UTC (rev 7505)
+++ trunk/src/utils/restore/iFolderServer.cs 2010-09-01 08:32:47 UTC (rev 7506)
@@ -2215,12 +2215,12 @@
}
else {
//Check for mandatory files in the given simias path
- string simiasPath = Path.Combine(DataPath, "/simias");;
+ string simiasPath = Path.Combine(DataPath, "simias");;
if( !Directory.Exists(simiasPath)) {
Console.WriteLine("| Error: simias directory does not exist at the specified path: {0} .|",DataPath);
return (int)status.InvalidBackupPath;
}
- string flaimdb= Path.Combine(DataPath, "/simias/FlaimSimias.db");
+ string flaimdb= Path.Combine(DataPath, "simias/FlaimSimias.db");
if(!File.Exists (flaimdb) ){
Console.WriteLine("| Error: iFolder simias database ({0}) does not exist at the specified path.|",flaimdb);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <sp...@us...> - 2010-09-21 11:39:07
|
Revision: 7516
http://simias.svn.sourceforge.net/simias/?rev=7516&view=rev
Author: spkumar
Date: 2010-09-21 11:39:00 +0000 (Tue, 21 Sep 2010)
Log Message:
-----------
ID: #607394
Reviewer: Vikash
Localization Required: No
Documentation Required: Yes
Description: Error message changes
Modified Paths:
--------------
trunk/src/utils/restore/iFolderServer.cs
Modified: trunk/src/utils/restore/iFolderServer.cs
===================================================================
--- trunk/src/utils/restore/iFolderServer.cs 2010-09-21 10:36:43 UTC (rev 7515)
+++ trunk/src/utils/restore/iFolderServer.cs 2010-09-21 11:39:00 UTC (rev 7516)
@@ -1793,9 +1793,11 @@
if( String.IsNullOrEmpty(RedirectedNewServerUrl) )
{
- MainClass.DebugLog.Write(string.Format("Failed, fetching Home information for ifolder owner user:{0} on current server with exit status as: {1}",ifolder.OwnerUserName, "EmptyNewServerUrl"));
+ MainClass.DebugLog.Write(string.Format("Failed, fetching Home Server information for ifolder owner user:{0} on current server with exit status as: {1}",ifolder.OwnerUserName, "EmptyNewServerUrl"));
+ //Restore tool does not allow to restore the data if the owner does not exist on the server.
+ Console.WriteLine("| Error: Unable to get the home server information for the user: \'{0}\'. |",ifolder.OwnerUserName);
RestoreStatus = (int)status.EmptyNewServerUrl;
- return (int)status.EmptyNewServerUrl;
+ return (int)status.EmptyNewServerUrl;
}
MainClass.DebugLog.Write(string.Format("The redirected url is: {0}", RedirectedNewServerUrl));
@@ -3208,7 +3210,7 @@
Console.WriteLine("\n| Invalid User Name, User name does not exist in old data path. |");
break;
case (int)status.EmptyNewServerUrl:
- Console.WriteLine("\n| Input Current Server IP is Empty. |");
+ Console.WriteLine("| Restore Operation failed, iFolder owner does not exist on the iFolder Server |");
break;
case (int)status.PolicyRestoreFailed:
Console.WriteLine("\n| iFolder Policy Restore Failed. |");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mv...@us...> - 2011-03-16 11:47:43
|
Revision: 7577
http://simias.svn.sourceforge.net/simias/?rev=7577&view=rev
Author: mvikash
Date: 2011-03-16 11:47:37 +0000 (Wed, 16 Mar 2011)
Log Message:
-----------
ID:#678861
Reviewer: Ramesh
Localization Required: No
Documentation Required: No
Description: Changes done to pass encoded crdentials.
Modified Paths:
--------------
trunk/src/utils/restore/iFolderServer.cs
Modified: trunk/src/utils/restore/iFolderServer.cs
===================================================================
--- trunk/src/utils/restore/iFolderServer.cs 2011-03-09 08:17:36 UTC (rev 7576)
+++ trunk/src/utils/restore/iFolderServer.cs 2011-03-16 11:47:37 UTC (rev 7577)
@@ -215,7 +215,7 @@
adminNameForAuth = Convert.ToBase64String(EncodedCredInByte);
EncodedCredInByte = utf8Name.GetBytes(adminPassword);
adminPasswordForAuth = Convert.ToBase64String(EncodedCredInByte);
- web.Credentials = new NetworkCredential(this.adminNameForAuth, this.adminPasswordForAuth);
+ web.Credentials = new NetworkCredential(this.adminNameForAuth, this.adminPasswordForAuth);
if( !this.CheckCredentials() )
{
@@ -2482,8 +2482,8 @@
{
MainClass.DebugLog.Write(string.Format("url: {0}", OldServerUrl));
string url = OldServerUrl+"/Simias.asmx";
- string adminname = oldserver.adminName;
- string adminpassword = oldserver.adminPassword;
+ string adminname = oldserver.adminNameForAuth;
+ string adminpassword = oldserver.adminPasswordForAuth;
MainClass.DebugLog.Write(string.Format("Url: {0} relativepath: {1} oldpath: {2} ", url, relativepath, oldpath));
retval = newserver.RestoreiFolderData(url, adminname, adminpassword, ifolderid, relativepath, oldpath, startindex);
if( retval != 0)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <mv...@us...> - 2011-05-11 13:57:38
|
Revision: 7599
http://simias.svn.sourceforge.net/simias/?rev=7599&view=rev
Author: mvikash
Date: 2011-05-11 13:57:31 +0000 (Wed, 11 May 2011)
Log Message:
-----------
ID: #688409
Reviewer: GG
Localization Required: No
Documentation Required: Yes
Description: Changes are done to support only long option for restore
tool.
Modified Paths:
--------------
trunk/src/utils/restore/iFolderServer.cs
Modified: trunk/src/utils/restore/iFolderServer.cs
===================================================================
--- trunk/src/utils/restore/iFolderServer.cs 2011-05-11 13:23:01 UTC (rev 7598)
+++ trunk/src/utils/restore/iFolderServer.cs 2011-05-11 13:57:31 UTC (rev 7599)
@@ -3095,13 +3095,13 @@
{
Console.WriteLine("Command For Execution: $ifolder-data-recovery <Operation> <Arguments>\n");
- Console.WriteLine("Operation:\n\t-l, --list\tLists iFolders owned by the specified user and details such as Name,\n\t\t\tiFolderID, and Path (at the time of backup)");
- Console.WriteLine("\t-r, --restore\tRestore requested data (File/Folder/iFolder) from specified backup store.");
+ Console.WriteLine("Operation:\n\t--list\tLists iFolders owned by the specified user and details such as Name,\n\t\t\tiFolderID, and Path (at the time of backup)");
+ Console.WriteLine("\t--restore\tRestore requested data (File/Folder/iFolder) from specified backup store.");
Console.WriteLine("\t--retry\t\tRetry restore operation for failed data in last run.");
- Console.WriteLine("\t-h, --help\tPrint help regarding Operation, argument and usage.");
+ Console.WriteLine("\t--help\tPrint help regarding Operation, argument and usage.");
Console.WriteLine("\t\nArguments:\n\t--path\t\t\tPath of simias directory that has the iFolder backup store, FlaimSimias.db");
- Console.WriteLine("\t-U, --backup-admin\tLogin name of iFolder administrator who performed the backup");
- Console.WriteLine("\t-u,--current-admin\tiFolder administrator login name for the current server. Use this Option if backup \n\t\t\t\tadministrator is different from current administrator.");
+ Console.WriteLine("\t--backup-admin\tLogin name of iFolder administrator who performed the backup");
+ Console.WriteLine("\t--current-admin\tiFolder administrator login name for the current server. Use this Option if backup \n\t\t\t\tadministrator is different from current administrator.");
Console.WriteLine("\t--server-url\t\tPublic URL of the iFolder server where data is to be restored");
Console.WriteLine("\t--user\t\t\tUsername of the user for whom the specified operation is to be performed");
Console.WriteLine("\t--ifolder-id\t\tID of the iFolder for which the specified operation is to be performed");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|