Esempio n. 1
0
 /// <summary>
 /// A method used to resolve a conflict.
 /// </summary>
 /// <param name="col">The collection containing the conflict.</param>
 /// <param name="node">The conflicting node.</param>
 /// <param name="localChangesWin">Set to <b>True</b> to overwrite the server node (or file) with the local node (or file),
 /// set to <b>False</b> to overwrite the local node (or file) with the server node (or file).</param>
 public static void Resolve(Collection col, Node node, bool localChangesWin)
 {
     Simias.Sync.Conflict conflict = new Simias.Sync.Conflict(col, node);
     if (conflict.IsFileNameConflict)
     {
         throw new Exception("Resolve must be called with a new file name in the case of a Name Conflict");
     }
     else
     {
         conflict.Resolve(localChangesWin);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// A method used to rename a conflicting (local) file and resolve the conflicted (server) file
 /// to the same name.
 /// </summary>
 /// <param name="col">The collection containing the conflict.</param>
 /// <param name="node">The conflicted node.</param>
 /// <param name="newFileName">The new name to assign to the conflicting file.</param>
 public static void RenameConflictingAndResolve(Collection col, Node node, string newFileName)
 {
     Simias.Sync.Conflict conflict = new Simias.Sync.Conflict(col, node);
     if ((conflict != null) && conflict.IsFileNameConflict)
     {
         conflict.RenameConflictingFile(newFileName);
         conflict.Resolve(Path.GetFileName(conflict.NonconflictedPath));
     }
     else
     {
         throw new Exception("RenameConflictingAndResolve can only be called on a name collision conflict.");
     }
 }
Esempio n. 3
0
 /// <summary>
 /// A method used to resolve a name conflict.
 /// </summary>
 /// <param name="col">The collection containing the conflict.</param>
 /// <param name="node">The conflicting node.</param>
 /// <param name="newNodeName">The new name to assign the node (file).</param>
 public static void Resolve(Collection col, Node node,
                            string newNodeName)
 {
     Simias.Sync.Conflict conflict = new Simias.Sync.Conflict(col, node);
     if (conflict.IsFileNameConflict)
     {
         conflict.Resolve(newNodeName);
     }
     else
     {
         throw new Exception("Resolve must be called with a boolean option of which version wins, server or local.  This call is for Name conflicts");
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Remove the exitsing conflict for the file
        /// </summary>
        public void RemoveConflict(bool commit)
        {
            Node DiskNode = collection.GetNodeByID(node.ID);

            if (DiskNode != null && collection.HasCollisions(DiskNode))
            {
                Log.log.Debug("Disk node has collisions for node:{0}", node.ID);

                Conflict conflict = new Simias.Sync.Conflict(collection, DiskNode);

                // version conflict
                if (collection.GetCollisionType(DiskNode) == CollisionType.Node)
                {
                    //Since we got a new file  from server to discard the old server file, always say localChangeswin=true
                    conflict.Resolve(true);                     //localChangesWin(true)
                    Log.log.Debug("Conflict removed for the disk node :{0}", node.ID);

                    // Now decrement the local version which was incremented during conflict.Resolve()
                    if (commit == false)
                    {
                        Log.log.Debug("Decrement the local version since commit is false for :{0}", node.ID);
                        Property p = new Property(PropertyTags.Rollback, true);
                        p.LocalProperty = true;
                        DiskNode.Properties.ModifyProperty(p);
                        //This commit will decremet the local incarnation and and remove the property
                        node.Properties.State = PropertyList.PropertyListState.Update;
                        collection.Commit(DiskNode);
                    }
                }
                //Name conflict, For name conlfict open will fail, commit=true means(open succeded) name conflict already resolved

                /*else if(collection.GetCollisionType(DiskNode) == CollisionType.File)
                 * {
                 *      //if(commit == true)
                 *      //conflict.RenameConflictingFile(true); //localChangesWin(true)
                 *      //Log.log.Debug("This is a Name Conflict .....not removed");
                 * }*/
            }
            else
            {
                Log.log.Debug("Disk node has no collisions");
            }
        }
Esempio n. 5
0
 public static void Resolve(Collection col, Node node,
   string newNodeName)
 {
     Simias.Sync.Conflict conflict = new Simias.Sync.Conflict(col, node);
        if(conflict.IsFileNameConflict)
        {
     conflict.Resolve(newNodeName);
        }
        else
     throw new Exception("Resolve must be called with a boolean option of which version wins, server or local.  This call is for Name conflicts");
 }
Esempio n. 6
0
 public static void Resolve(Collection col, Node node, bool localChangesWin,
   string conflictBinPath)
 {
     Simias.Sync.Conflict conflict = new Simias.Sync.Conflict(col, node);
        if(conflict.IsFileNameConflict)
        {
     throw new Exception("Resolve must be called with a new file name in the case of a Name Conflict");
        }
        else
     conflict.Resolve(localChangesWin, conflictBinPath);
 }
Esempio n. 7
0
 public static void RenameConflictingAndResolve(Collection col, Node node, string newFileName)
 {
     Simias.Sync.Conflict conflict = new Simias.Sync.Conflict(col, node);
        if ((conflict != null) && conflict.IsFileNameConflict)
        {
     conflict.RenameConflictingFile(newFileName);
     conflict.Resolve(Path.GetFileName(conflict.NonconflictedPath));
        }
        else
        {
     throw new Exception("RenameConflictingAndResolve can only be called on a name collision conflict.");
        }
 }