/// <summary>
        /// Creates the node managers for the server.
        /// </summary>
        /// <remarks>
        /// This method allows the sub-class create any additional node managers which it uses. The SDK
        /// always creates a CoreNodeManager which handles the built-in nodes defined by the specification.
        /// Any additional NodeManagers are expected to handle application specific nodes.
        /// </remarks>
        protected override MasterNodeManager CreateMasterNodeManager(IServerInternal server, ApplicationConfiguration configuration)
        {
            Utils.Trace("Creating the Node Managers.");

            List <INodeManager> nodeManagers = new List <INodeManager>();

            // create the custom node managers.
            nodeManagers.Add(new EmptyNodeManager(server, configuration));

            // get the ShutdownDelay configuration parameter.
            ReferenceServerConfiguration referenceServerConfiguration = configuration.ParseExtension <ReferenceServerConfiguration>();

            if (referenceServerConfiguration != null)
            {
                m_shutdownDelay = referenceServerConfiguration.ShutdownDelay;
            }
            else
            {
                // default value of 5 seconds.
                m_shutdownDelay = 5;
            }

            // create master node manager.
            return(new MasterNodeManager(server, configuration, null, nodeManagers.ToArray()));
        }
Exemplo n.º 2
0
        static void Main()
        {
            // Initialize the user interface.
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ApplicationInstance.MessageDlg = new ApplicationMessageDlg();
            ApplicationInstance application = new ApplicationInstance();

            application.ApplicationType   = ApplicationType.Server;
            application.ConfigSectionName = "Quickstarts.ReferenceServer";

            try
            {
                // load the application configuration.
                ApplicationConfiguration config = application.LoadApplicationConfiguration(false).Result;

                LoggerConfiguration loggerConfiguration = new LoggerConfiguration();
#if DEBUG
                loggerConfiguration.WriteTo.Debug(restrictedToMinimumLevel: Serilog.Events.LogEventLevel.Warning);
#endif
                SerilogTraceLogger.Create(loggerConfiguration, config);

                // check the application certificate.
                bool certOk = application.CheckApplicationInstanceCertificate(false, 0).Result;
                if (!certOk)
                {
                    throw new Exception("Application instance certificate invalid!");
                }

                // Create server, add additional node managers
                var server = new ReferenceServer();
                Quickstarts.Servers.Utils.AddDefaultNodeManagers(server);

                // start the server.
                application.Start(server).Wait();

                // check whether the invalid certificates dialog should be displayed.
                bool showCertificateValidationDialog = false;
                ReferenceServerConfiguration refServerconfiguration = application.ApplicationConfiguration.ParseExtension <ReferenceServerConfiguration>();

                if (refServerconfiguration != null)
                {
                    showCertificateValidationDialog = refServerconfiguration.ShowCertificateValidationDialog;
                }

                // run the application interactively.
                Application.Run(new ServerForm(application, showCertificateValidationDialog));
            }
            catch (Exception e)
            {
                ExceptionDlg.Show(application.ApplicationName, e);
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initializes the node manager.
        /// </summary>
        public EmptyNodeManager(IServerInternal server, ApplicationConfiguration configuration)
        :
            base(server, configuration, Namespaces.ReferenceApplications)
        {
            SystemContext.NodeIdFactory = this;

            // get the configuration for the node manager.
            m_configuration = configuration.ParseExtension<ReferenceServerConfiguration>();

            // use suitable defaults if no configuration exists.
            if (m_configuration == null)
            {
                m_configuration = new ReferenceServerConfiguration();
            }

            m_dynamicNodes = new List<BaseDataVariableState>();
        }
Exemplo n.º 4
0
        static void Main()
        {
            // Initialize the user interface.
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            ApplicationInstance.MessageDlg = new ApplicationMessageDlg();
            ApplicationInstance application = new ApplicationInstance();

            application.ApplicationType   = ApplicationType.Server;
            application.ConfigSectionName = "Quickstarts.ReferenceServer";

            try
            {
                // load the application configuration.
                application.LoadApplicationConfiguration(false).Wait();

                // check the application certificate.
                bool certOk = application.CheckApplicationInstanceCertificate(false, 0).Result;
                if (!certOk)
                {
                    throw new Exception("Application instance certificate invalid!");
                }

                // start the server.
                application.Start(new ReferenceServer()).Wait();

                // check whether the invalid certificates dialog should be displayed.
                bool showCertificateValidationDialog = false;
                ReferenceServerConfiguration refServerconfiguration = application.ApplicationConfiguration.ParseExtension <ReferenceServerConfiguration>();

                if (refServerconfiguration != null)
                {
                    showCertificateValidationDialog = refServerconfiguration.ShowCertificateValidationDialog;
                }

                // run the application interactively.
                Application.Run(new ServerForm(application, showCertificateValidationDialog));
            }
            catch (Exception e)
            {
                ExceptionDlg.Show(application.ApplicationName, e);
            }
        }