Example #1
0
        // methods for creating and accessing PADInts

        public static PADInt CreatePADInt(int uid)
        {
            Console.WriteLine("DSTMLib-> calling master to create PADInt!");

            List <PADInt> objectReferences = new List <PADInt>();
            List <string> servers          = new List <string>();
            List <string> locations        = _master.GenerateServers(uid);

            if (locations == null)
            {
                Console.WriteLine("DSTMLib-> ERROR: There is already a PADInt with the uid: " + uid);
                return(null);
            }
            else
            {
                foreach (string server in locations)
                {
                    servers.Add(server);
                }
            }

            foreach (String server in servers)
            {
                ServerInterface tServer = (ServerInterface)Activator.GetObject(typeof(ServerInterface), server);
                objectReferences.Add(tServer.CreatePADInt(uid, servers, _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);
        }