/// <summary> /// Function to get a remote reference to a PADInt with a given uid. /// If the object doesn't exist, then returns null, and warns the client. /// </summary> /// <param name="uid"></param> /// <returns>The remote reference to the PADInt object</returns> public static PADInt AccessPADInt(int uid) { List <PADInt> objectReferences = new List <PADInt>(); List <string> servers; if (_references.ContainsKey(uid)) { Console.WriteLine("The reference for the PADInt " + uid + " was in cache"); return(_references[uid]); } Console.WriteLine("DSTMLib-> calling master to get the servers for the PADInt!"); servers = _master.GetServers(uid); if (servers == null) { Console.WriteLine("DSTMLib-> ERROR: The PadInt with uid" + uid + " does not exist"); return(null); } foreach (String server in servers) { Console.WriteLine("DSTMLib-> connecting to the server " + server); ServerInterface chosen = (ServerInterface)Activator.GetObject(typeof(ServerInterface), server); objectReferences.Add(chosen.AccessPADInt(uid, _transactionId)); if (!_serverList.Contains(server)) { _serverList.Add(server); } } PADInt localCopy = new PADInt(objectReferences, _transactionId, objectReferences[0].UID, objectReferences[0].Value); _references.Add(localCopy.UID, localCopy); return(localCopy); }