示例#1
0
        public RemotingServer(FMSImplementation p, string dataDir)
        {
            plugin = p;

            settingsServer = new SettingStore(dataDir);

            AppDomain.CurrentDomain.AssemblyResolve += ResolveEventHandler;
            AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += ResolveEventHandler;

            //Configure .NET Remoting
            if (System.IO.File.Exists(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile))
            {
                RemotingConfiguration.Configure(AppDomain.CurrentDomain.SetupInformation.ConfigurationFile, false);
            }
            if (System.Runtime.Remoting.Channels.ChannelServices.RegisteredChannels.Count() == 0)
            {
                var clientFormatter = new System.Runtime.Remoting.Channels.BinaryClientFormatterSinkProvider();
                var serverFormatter = new System.Runtime.Remoting.Channels.BinaryServerFormatterSinkProvider();
                serverFormatter.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;
                var props = new System.Collections.Hashtable();
                props["port"] = 8086;
                System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(new System.Runtime.Remoting.Channels.Tcp.TcpChannel(props, clientFormatter, serverFormatter), false);

                System.Runtime.Remoting.Lifetime.LifetimeServices.LeaseTime            = TimeSpan.FromMinutes(3);
                System.Runtime.Remoting.Lifetime.LifetimeServices.SponsorshipTimeout   = TimeSpan.FromMinutes(2);
                System.Runtime.Remoting.Lifetime.LifetimeServices.RenewOnCallTime      = TimeSpan.FromMinutes(1);
                System.Runtime.Remoting.Lifetime.LifetimeServices.LeaseManagerPollTime = TimeSpan.FromSeconds(10);
                System.Runtime.Remoting.RemotingConfiguration.CustomErrorsMode         = System.Runtime.Remoting.CustomErrorsModes.Off;
            }

            var jobDb      = plugin.Backend.JobDatabase();
            var logDb      = plugin.Backend.LogDatabase();
            var inspServer = plugin.Backend.InspectionControl();
            var jobControl = plugin.Backend.JobControl();
            var oldJob     = plugin.Backend.OldJobDecrement();

            singletons = new RemoteSingletons();

            singletons.RemoteSingleton(typeof(IJobDatabase),
                                       "JobDB",
                                       jobDb);
            singletons.RemoteSingleton(typeof(ILogDatabase),
                                       "LogDB",
                                       logDb);
            singletons.RemoteSingleton(typeof(IInspectionControl),
                                       "InspectionControl",
                                       inspServer);
            singletons.RemoteSingleton(typeof(IJobControl),
                                       "JobControl",
                                       jobControl);
            singletons.RemoteSingleton(typeof(IOldJobDecrement),
                                       "OldJobDecrement",
                                       oldJob);
            singletons.RemoteSingleton(typeof(IStoreSettings),
                                       "Settings",
                                       settingsServer);
        }
示例#2
0
 public fmsController(FMSSettings fmsSt, ServerSettings serverSt, FMSImplementation impl)
 {
     _cfg      = fmsSt;
     _serverSt = serverSt;
     _impl     = impl;
 }
示例#3
0
 public serverController(FMSSettings fmsSt, ServerSettings serverSt, FMSImplementation impl)
     : base(fmsSt, serverSt, impl)
 {
 }