public IComputeNode GetComputeNode()
        {
            IComputeNode compute_node = null;
            try
            {
                //amazon client
                using (var client = new AmazonS3Client())
                {
                    //download request
                    using (var response = client.GetObject(new GetObjectRequest()
                        .WithBucketName(AmazonBucket)
                        .WithKey(BermudaConfig)))
                    {
                        using (StreamReader reader = new StreamReader(response.ResponseStream))
                        {
                            //read the file
                            string data = reader.ReadToEnd();

                            //deserialize
                            compute_node = new ComputeNode().DeserializeComputeNode(data);
                            if(compute_node.Catalogs.Values.Cast<ICatalog>().FirstOrDefault().CatalogMetadata.Tables.FirstOrDefault().Value.DataType == null)
                                compute_node.Catalogs.Values.Cast<ICatalog>().FirstOrDefault().CatalogMetadata.Tables.FirstOrDefault().Value.DataType = typeof(UDPTestDataItems);
                            compute_node.Init(CurrentInstanceIndex, AllNodeEndpoints.Count());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.ToString());
            }
            return compute_node;
        }
Esempio n. 2
0
 private void btnNew_Click(object sender, RoutedEventArgs e)
 {
     ComputeNode compute_node = new ComputeNode();
     ComputeNodeConfig config = new ComputeNodeConfig(compute_node);
     config.Show();
     Close();
 }
        public IComputeNode GetComputeNode()
        {
            IComputeNode compute_node = null;
            try
            {
                CloudStorageAccount storageAccount = CloudStorageAccount.Parse(RoleEnvironment.GetConfigurationSettingValue("StorageAccount.ConnectionString"));
                CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
                CloudBlobContainer container = blobClient.GetContainerReference(AzureContainer);
                container.CreateIfNotExist();
                CloudBlob blob = container.GetBlobReference(BermudaConfig);
                string data = blob.DownloadText();

                //deserialize
                compute_node = new ComputeNode().DeserializeComputeNode(data);
                if (compute_node.Catalogs.Values.Cast<ICatalog>().FirstOrDefault().CatalogMetadata.Tables.FirstOrDefault().Value.DataType == null)
                    compute_node.Catalogs.Values.Cast<ICatalog>().FirstOrDefault().CatalogMetadata.Tables.FirstOrDefault().Value.DataType = typeof(UDPTestDataItems);
                compute_node.Init(CurrentInstanceIndex, AllNodeEndpoints.Count());
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.ToString());
            }
            return compute_node;
        }
        public IComputeNode GetComputeNode()
        {
            IComputeNode compute_node = null;
            try
            {
                //amazon client
                using (var client = new AmazonS3Client())
                {
                    //download request
                    using (var response = client.GetObject(new GetObjectRequest()
                        .WithBucketName(AmazonBucket)
                        .WithKey(BermudaConfig)))
                    {
                        using (StreamReader reader = new StreamReader(response.ResponseStream))
                        {
                            //read the file
                            string data = reader.ReadToEnd();

                            //deserialize
                            compute_node = new ComputeNode().DeserializeComputeNode(data);
                            compute_node.Init(CurrentInstanceIndex, AllNodeEndpoints.Count());
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex.ToString());
            }
            return compute_node;
        }
Esempio n. 5
0
        /// <summary>
        /// open from the storage interface
        /// </summary>
        /// <param name="storage"></param>
        private void OpenStorage(IStorageAccess storage)
        {
            //open file dialog
            string PathName;
            string FileName;
            if (!storage.OpenFileDialog(out PathName, out FileName))
                return;

            //read the file
            string data;
            if (!storage.ReadFile(PathName, FileName, out data))
            {
                MessageBox.Show("There was an error reading the file.");
                return;
            }
            //create the compute node and window
            IComputeNode compute_node = new ComputeNode().DeserializeComputeNode(data);
            ComputeNodeConfig dlg = new ComputeNodeConfig(compute_node);
            dlg.Show();
            Close();
        }