Simple StreamInsight Application

This shows a simple StreamInsight application that can leverage the different hosting models and features for StreamInsight. It is built using input and output adapters from the StreamInsight Samples and a custom host application.

C# (113.5 KB)
 
 
 
 
 
4 Star
(1)
1,490 times
Add to favorites
3/9/2012
E-mail Twitter del.icio.us Digg Facebook
//*********************************************************
//
//  Copyright (c) J Sawyer. All rights reserved.
//  This code is licensed under the Apache 2.0 License.
//  THIS CODE IS PROVIDED *AS IS* WITHOUT WARRANTY OR
//  CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED,
//  INCLUDING, WITHOUT LIMITATION, ANY IMPLIED WARRANTIES
//  OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR
//  PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.
//
//*********************************************************

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DevBiker.SimpleSIApp
{
    /// <summary>
    /// Class for the sample application settings. 
    /// </summary>
    public class AppSettings
    {
        private static AppSettings _current; 
        /// <summary>
        /// Returns a single instance of the AppSettings. 
        /// </summary>
        public static AppSettings Current
        {
            get
            {
                if(_current == null)
                {
                    _current = new AppSettings(); 
                }
                return _current; 
            }
        }
        /// <summary>
        /// Name of the StreamInsight instance. 
        /// </summary>
        public string StreamInsightInstanceName { get; private set; }
        public string StreamInsightAppName { get; private set; }
        public bool RunInProcess { get; private set; }
        public string ManagementServiceUrl { get; private set; }
        public string OutputFolder { get; private set; }
        public bool UseMetadata { get; set; }
        private  AppSettings()
        {
            var appSettings = System.Configuration.ConfigurationManager.AppSettings;
            StreamInsightAppName = appSettings["streamInsightAppName"];
            StreamInsightInstanceName = appSettings["streamInsightInstanceName"];
            RunInProcess = bool.Parse(appSettings["runInProcess"]);
            OutputFolder = appSettings["outputFolder"];
            UseMetadata = bool.Parse(appSettings["useMetadata"]);
            if(appSettings.AllKeys.Contains("managementServiceUrl"))
            {
                ManagementServiceUrl = appSettings["managementServiceUrl"]; 
            }
        }
    }
}