/// <summary> /// Already existing object server is selected for further manipulation. (Read/Write) /// </summary> /// <param name="uid"></param> /// <returns></returns> public static PadInt AccessPadInt(int uid) { int modIndex = Common.GetModuloServerIndex(uid, info.ObjectServerMap); PadInt padInt = null; if (modIndex >= 0) { if (workers[modIndex].AccessPadInt(uid)) { padInt = new PadInt(uid); padInt.Worker = workers[modIndex]; UpdatePadIntTrack(uid); Console.WriteLine("PadInt successfully retrieved, UID = " + uid); Common.Logger().LogInfo("PadInt successfully retrieved, UID = " + uid, string.Empty, string.Empty); } else { Console.WriteLine("AccessPadInt for UID = " + uid + " returned null. Not available"); Common.Logger().LogInfo("AccessPadInt for UID = " + uid + " returned null. Not available", string.Empty, string.Empty); } } else { Console.WriteLine("No worker servers found"); Common.Logger().LogInfo("No worker servers found", string.Empty, string.Empty); } return(padInt); }
/// <summary> /// Create a ServerPadInt object in the remote server. /// Returns null if creation failed. /// </summary> /// <param name="uid"></param> /// <returns></returns> public static PadInt CreatePadInt(int uid) { PadInt padInt = null; int modIndex = Common.GetModuloServerIndex(uid, info.ObjectServerMap); if (modIndex >= 0) { if (workers[modIndex].CreatePadInt(uid)) { padInt = new PadInt(uid); padInt.Worker = workers[modIndex]; UpdatePadIntTrack(uid); Console.WriteLine("PadInt successfully created, UID = " + uid); Common.Logger().LogInfo("PadInt successfully created, UID = " + uid, string.Empty, string.Empty); } else { Console.WriteLine("CreatePadInt for UID = " + uid + " returned null. Already exists"); Common.Logger().LogInfo("CreatePadInt for UID = " + uid + " returned null. Already exists", string.Empty, string.Empty); } } else { Console.WriteLine("No worker server found"); Common.Logger().LogInfo("No worker server found", string.Empty, string.Empty); } return(padInt); }