Beispiel #1
0
        private static IObjectServer OpenServer(IServerConfiguration configuration)
        {
            IObjectServer server = Db4oClientServer.OpenServer(configuration, DatabaseFileName, PortNumber);

            server.GrantAccess(UserAndPassword, UserAndPassword);
            return(server);
        }
			internal void Verify(IServerConfiguration config, IObjectServer server)
			{
				Assert.AreSame(config, this._config);
				Assert.AreSame(server, this._server);
				Assert.AreEqual(1, this._prepareCount);
				Assert.AreEqual(1, this._applyCount);
			}
Beispiel #3
0
        public HttpServer(IServerConfiguration configuration)
        {
            this.Address = configuration.GetAddress();
            this.Port    = configuration.GetPort();

            this.InitBase();
        }
        public virtual void TestClientServerApi()
        {
            IServerConfiguration config = Db4oClientServer.NewServerConfiguration();
            IObjectServer        server = Db4oClientServer.OpenServer(config, TempFile(), unchecked (
                                                                          (int)(0xdb40)));

            try
            {
                server.GrantAccess("user", "password");
                IClientConfiguration clientConfig = Db4oClientServer.NewClientConfiguration();
                IObjectContainer     client1      = Db4oClientServer.OpenClient(clientConfig, "localhost",
                                                                                unchecked ((int)(0xdb40)), "user", "password");
                try
                {
                }
                finally
                {
                    Assert.IsTrue(client1.Close());
                }
            }
            finally
            {
                Assert.IsTrue(server.Close());
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="ServerContext"/> class.
 /// </summary>
 /// <param name="server">The server.</param>
 /// <param name="configuration">The configuration.</param>
 /// <param name="serverSocket">The server socket.</param>
 internal ServerContext(StandardServer server, IServerConfiguration configuration, Socket serverSocket)
 {
     this.ListeningSocket = serverSocket;
     this.Server = server;
     this.windowsServer = server;
     this.Configuration = configuration;
 }
 public static void Setup(IServerConfiguration serverConfiguration)
 {
     worldService   = Api.Server.World;
     protoSpawnZone = Api.GetProtoEntity <ZoneSpecialPlayerSpawn>();
     serverConfiguration.SetupPlayerCharacterSpawnCallbackMethod(
         character => SpawnPlayer(character, isRespawn: false));
 }
Beispiel #7
0
        public UserCache(
            IServerConfiguration serverConfiguration)
        {
            _ServerConfiguration = serverConfiguration;

            _UserAccountCache = new List <CacheItem <UserAccount> >();
        }
Beispiel #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ServerContext"/> class.
 /// </summary>
 /// <param name="server">The server.</param>
 /// <param name="configuration">The configuration.</param>
 /// <param name="serverSocket">The server socket.</param>
 internal ServerContext(StandardServer server, IServerConfiguration configuration, Socket serverSocket)
 {
     this.ListeningSocket = serverSocket;
     this.Server          = server;
     this.windowsServer   = server;
     this.Configuration   = configuration;
 }
        /// <summary>
        /// Creates a new session and adds it to the beacon sender. The top level action count is reset to zero and the
        /// last interaction time is set to the current timestamp.
        /// <para>
        /// In case the given <code>initialServerConfig</code> is not null, the new session will be initialized with
        /// this server configuration. The created session however will not be in state
        /// <see cref="ISessionState.IsConfigured">configured</see>, meaning new session requests will be performed for
        /// this session.
        /// </para>
        /// <para>
        /// In case the given <code>updatedServerConfig</code> is not null, the new session will be updated with this
        /// server configuration. The created session will be in state
        /// <see cref="ISessionState.IsConfigured">configured</see>, meaning new session requests will be omitted.
        /// </para>
        /// </summary>
        /// <param name="initialServerConfig">
        /// the server configuration with which the session will be initialized. Can be <code>null</code>
        /// </param>
        /// <param name="updatedServerConfig">
        /// the server configuration with which the session will be updated. Can be <code>null</code>.
        /// </param>
        /// <returns>the newly created session.</returns>
        private ISessionInternals CreateSession(IServerConfiguration initialServerConfig,
                                                IServerConfiguration updatedServerConfig)
        {
            var session = sessionCreator.CreateSession(this);
            var beacon  = session.Beacon;

            beacon.OnServerConfigurationUpdate += OnServerConfigurationUpdate;

            ThisComposite.StoreChildInList(session);

            lastInteractionTime = beacon.SessionStartTime;
            topLevelActionCount = 0;

            if (initialServerConfig != null)
            {
                session.InitializeServerConfiguration(initialServerConfig);
            }

            if (updatedServerConfig != null)
            {
                session.UpdateServerConfiguration(updatedServerConfig);
            }

            beaconSender.AddSession(session);

            return(session);
        }
            public override void ServerInitialize(IServerConfiguration serverConfiguration)
            {
                if (Api.IsEditor)
                {
                    return;
                }

                var autosaveIntervalMinutes = Api.Server.Core.AutosaveIntervalMinutes;

                if (autosaveIntervalMinutes < AutosavegameIntervalMinutesMin ||
                    autosaveIntervalMinutes > AutosavegameIntervalMinutesMax)
                {
                    throw new Exception(
                              string.Format("Autosave interval should be in range from {0} to {1} (both inclusive)",
                                            AutosavegameIntervalMinutesMin,
                                            AutosavegameIntervalMinutesMax));
                }

                Server.Core.AutosaveOnQuit = true;
                Api.Logger.Important($"Server auto-save enabled. Interval: {autosaveIntervalMinutes} minutes");

                framesBetweenAutoSaves = 60
                                         * autosaveIntervalMinutes
                                         * ServerGame.FrameRate;

                SetNextAutoSaveFrameNumber();
                TriggerEveryFrame.ServerRegister(Update, "Autosave manager");
            }
Beispiel #11
0
        /// <summary>
        /// opens the IObjectServer, and waits forever until Close() is called
        /// or a StopServer message is being received.
        /// </summary>
        public void RunServer()
        {
            lock (this)
            {
                IServerConfiguration config = Db4oClientServer.NewServerConfiguration();
                // Using the messaging functionality to redirect all
                // messages to this.processMessage
                config.Networking.MessageRecipient = this;
                IObjectServer db4oServer = Db4oClientServer.OpenServer(config, FILE, PORT);
                db4oServer.GrantAccess(USER, PASS);

                try
                {
                    if (!stop)
                    {
                        // wait forever until Close will change stop variable
                        Monitor.Wait(this);
                    }
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.ToString());
                }
                db4oServer.Close();
            }
        }
Beispiel #12
0
        private void BuildClientsHandlerConfig(IServerConfiguration clients)
        {
            //set up where to bind the listening socket
            //config for this should already be valid here, of course we can't check yet if the interface actually exists
            string interfaceAddress = String.Empty; //empty string means bind to *
            int    port             = 19333;        //default port

            for (int i = 0; i < m_globalconfiglines.Count; i++)
            {
                string line = m_globalconfiglines[i].line;
                string word;
                Util.GetWord(ref line, out word);

                if (word == "interface")
                {
                    Util.GetWord(ref line, out interfaceAddress);
                }
                else if (word == "port")
                {
                    Util.GetWord(ref line, out word);
                    port = int.Parse(word);
                }
            }
            clients.SetInterface(interfaceAddress, port);
        }
 internal void Verify(IServerConfiguration config, IObjectServer server)
 {
     Assert.AreSame(config, _config);
     Assert.AreSame(server, _server);
     Assert.AreEqual(1, _prepareCount);
     Assert.AreEqual(1, _applyCount);
 }
Beispiel #14
0
            public override void ServerInitialize(IServerConfiguration serverConfiguration)
            {
                var database = Server.Database;
                if (!database.TryGet(nameof(ChatSystem),
                                     "GlobalChatRoomHolder",
                                     out sharedGlobalChatRoomHolder))
                {
                    sharedGlobalChatRoomHolder = ServerCreateChatRoom(new ChatRoomGlobal());
                    database.Set(nameof(ChatSystem), "GlobalChatRoomHolder", sharedGlobalChatRoomHolder);
                }

                if (!database.TryGet(nameof(ChatSystem),
                                     "LocalChatRoomHolder",
                                     out sharedLocalChatRoomHolder))
                {
                    sharedLocalChatRoomHolder = ServerCreateChatRoom(new ChatRoomLocal());
                    database.Set(nameof(ChatSystem), "LocalChatRoomHolder", sharedLocalChatRoomHolder);
                }

                if (!database.TryGet(nameof(ChatSystem),
                                     nameof(serverPrivateChatRooms),
                                     out serverPrivateChatRooms))
                {
                    serverPrivateChatRooms = new Dictionary<string, Dictionary<string, ILogicObject>>();
                    database.Set(nameof(ChatSystem),
                                 nameof(serverPrivateChatRooms),
                                 serverPrivateChatRooms);
                }
            }
        public RouletteContext(IServerConfiguration ServerConfiguration)
        {
            var config = ServerConfiguration.GetMongoDBConfig();
            var client = new MongoClient(config.ConnectionString);

            _db = client.GetDatabase(config.Database);
        }
Beispiel #16
0
        /// <summary>
        /// Constructs a new <see cref="ConsensusServer"/>.
        /// </summary>
        /// <param name="configuration">The <see cref="IServerConfiguration"/> of this <see cref="ConsensusServer"/>.</param>
        /// <param name="log">The <see cref="ILog"/> used by this <see cref="ConsensusServer"/> to store entries in.</param>
        /// <param name="protocol">The <see cref="IProtocol"/> using by this <see cref="ConsensusServer"/> to communicate with other <see cref="ConsensusServer"/>s in the same cluster.</param>
        /// <param name="scheduler">The <see cref="IResourceTrackingScheduler"/> on which to execute callbacks.</param>
        /// <exception cref="ArgumentNullException">Thrown if one of the parameters is null.</exception>
        public ConsensusServer(IServerConfiguration configuration, ILog log, IProtocol protocol, IResourceTrackingScheduler scheduler)
        {
            // validate arguments
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }
            if (scheduler == null)
            {
                throw new ArgumentNullException("scheduler");
            }
            if (log == null)
            {
                throw new ArgumentNullException("log");
            }
            if (protocol == null)
            {
                throw new ArgumentNullException("protocol");
            }

            // store the arguments
            this.configuration = configuration;
            this.scheduler     = scheduler;
            this.log           = log;
            this.protocol      = protocol;

            // create a new state
            state = new ConsensusServerState(this);
        }
        public virtual void TestMissingClassesInClient()
        {
            IList serverMissedClasses         = new ArrayList();
            IList clientMissedClasses         = new ArrayList();
            IServerConfiguration serverConfig = Db4oClientServer.NewServerConfiguration();

            PrepareHost(serverConfig.File, serverConfig.Common, serverMissedClasses);
            IObjectServer server = Db4oClientServer.OpenServer(serverConfig, DbUri, Port);

            server.GrantAccess(User, Password);
            try
            {
                IClientConfiguration clientConfig = Db4oClientServer.NewClientConfiguration();
                PrepareCommon(clientConfig.Common, clientMissedClasses);
                ExcludeClasses(clientConfig.Common, new Type[] { typeof(MissingClassDiagnosticsTestCase.Pilot
                                                                        ), typeof(MissingClassDiagnosticsTestCase.Car) });
                IObjectContainer client = Db4oClientServer.OpenClient(clientConfig, "localhost",
                                                                      Port, User, Password);
                IObjectSet result = client.Query(new MissingClassDiagnosticsTestCase.AcceptAllPredicate
                                                     ());
                IterateOver(result);
                client.Close();
            }
            finally
            {
                server.Close();
            }
            Assert.AreEqual(0, serverMissedClasses.Count);
            AssertPilotAndCarMissing(clientMissedClasses);
        }
Beispiel #18
0
        public static void Main(string[] args)
        {
            File.Delete(YapFileName);
            AccessLocalServer();
            File.Delete(YapFileName);
            using (IObjectContainer db = Db4oEmbedded.OpenFile(YapFileName))
            {
                SetFirstCar(db);
                SetSecondCar(db);
            }

            IServerConfiguration config = Db4oClientServer.NewServerConfiguration();

            config.Common.ObjectClass(typeof(Car)).UpdateDepth(3);
            using (IObjectServer server = Db4oClientServer.OpenServer(config,
                                                                      YapFileName, 0))
            {
                QueryLocalServer(server);
                DemonstrateLocalReadCommitted(server);
                DemonstrateLocalRollback(server);
            }

            AccessRemoteServer();
            using (IObjectServer server = Db4oClientServer.OpenServer(Db4oClientServer.NewServerConfiguration(),
                                                                      YapFileName, ServerPort))
            {
                server.GrantAccess(ServerUser, ServerPassword);
                QueryRemoteServer(ServerPort, ServerUser, ServerPassword);
                DemonstrateRemoteReadCommitted(ServerPort, ServerUser, ServerPassword);
                DemonstrateRemoteRollback(ServerPort, ServerUser, ServerPassword);
            }
        }
        /// <summary>
        /// Creates a new session and adds it to the beacon sender. The top level action count is reset to zero and the
        /// last interaction time is set to the current timestamp.
        /// <para>
        /// In case the given <code>initialServerConfig</code> is not null, the new session will be initialized with
        /// this server configuration. The created session however will not be in state
        /// <see cref="ISessionState.IsConfigured">configured</see>, meaning new session requests will be performed for
        /// this session.
        /// </para>
        /// <para>
        /// In case the given <code>updatedServerConfig</code> is not null, the new session will be updated with this
        /// server configuration. The created session will be in state
        /// <see cref="ISessionState.IsConfigured">configured</see>, meaning new session requests will be omitted.
        /// </para>
        /// </summary>
        /// <param name="initialServerConfig">
        /// the server configuration with which the session will be initialized. Can be <code>null</code>
        /// </param>
        /// <param name="updatedServerConfig">
        /// the server configuration with which the session will be updated. Can be <code>null</code>.
        /// </param>
        private void CreateAndAssignCurrentSession(IServerConfiguration initialServerConfig,
                                                   IServerConfiguration updatedServerConfig)
        {
            var session = sessionCreator.CreateSession(this);
            var beacon  = session.Beacon;

            beacon.OnServerConfigurationUpdate += OnServerConfigurationUpdate;

            ThisComposite.StoreChildInList(session);

            lastInteractionTime = beacon.SessionStartTime;
            topLevelActionCount = 0;

            if (initialServerConfig != null)
            {
                session.InitializeServerConfiguration(initialServerConfig);
            }

            if (updatedServerConfig != null)
            {
                session.UpdateServerConfiguration(updatedServerConfig);
            }

            lock (lockObject)
            {
                // synchronize access
                currentSession = session;
            }

            beaconSender.AddSession(currentSession);
        }
Beispiel #20
0
            public override void ServerInitialize(IServerConfiguration serverConfiguration)
            {
                if (Api.IsEditor)
                {
                    return;
                }

                var autosaveIntervalMinutes = Api.Server.Core.AutosaveIntervalMinutes;

                if (autosaveIntervalMinutes < AutosavegameIntervalMinutesMin ||
                    autosaveIntervalMinutes > AutosavegameIntervalMinutesMax)
                {
                    throw new Exception(
                              string.Format("Autosave interval should be in range from {0} to {1} (both inclusive)",
                                            AutosavegameIntervalMinutesMin,
                                            AutosavegameIntervalMinutesMax));
                }

                Server.Core.AutosaveOnQuit = true;
                Api.Logger.Important($"Server auto-save enabled. Interval: {autosaveIntervalMinutes} minutes");

                serverFramesBetweenAutoSaves = 60
                                               * autosaveIntervalMinutes
                                               * ServerGame.FrameRate;

                SetNextAutoSaveFrameNumber();
                // Randomize the next autosave date a bit (up to +60 seconds)
                // to ensure that if there are several game servers they will not save together
                // affecting performance of each other.
                serverNextAutoSaveFrameNumber = (uint)(serverNextAutoSaveFrameNumber
                                                       + ServerGame.FrameRate * RandomHelper.Next(0, 61));

                TriggerEveryFrame.ServerRegister(Instance.Update, "Autosave manager");
            }
Beispiel #21
0
        private static string concurrentBody(ClassDeclarationSyntax @class, IServerConfiguration config, SemanticModel model)
        {
            var result = new StringBuilder();

            ConcurrentExtension.Visit(@class,
                                      methods: (name, type, parameters) =>
            {
                result.AppendLine(Templates
                                  .jsMethod(new
                {
                    MethodName = name.ToString(),
                    Arguments  = argumentsFromParameters(parameters),
                    Data       = objectFromParameters(parameters),
                    Path       = "'/' + this.__ID + '/" + name.ToString() + "'",
                    Response   = calculateResponse(type, model),
                }));
            },
                                      fields: (name, type, value) =>
            {
                //td: shall we transmit properties?
                //result.AppendLine(Templates
                //    .jsProperty
                //    .Render(new
                //    {
                //        Name = name.ToString(),
                //        Value = valueString(value, type, model)
                //    }));
            });

            return(result.ToString());
        }
        public IContainer GetContainer(IServerConfiguration configuration)
        {
            if(configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }

            var containerBuilder = new ContainerBuilder();

            containerBuilder.Register(b => Logger.Instance).As<ILogger>();

            containerBuilder.RegisterType<ConnectionManager>().As<IConnectionManager>().SingleInstance();
            containerBuilder.RegisterType<NodeInitializer>().As<INodeInitializer>().SingleInstance();
            containerBuilder.RegisterType<NodeSynchronizer>().As<INodeSynchronizer>().InstancePerDependency();
            containerBuilder.RegisterType<MasterElections>().As<IMasterElections>().SingleInstance();

            containerBuilder.RegisterType<AggregateRepository>().As<IAggregateRepository>().SingleInstance();
            containerBuilder.RegisterType<EventAggregate>().As<IEventAggregate>().InstancePerDependency();

            containerBuilder.RegisterInstance(configuration).As<IServerConfiguration>();

            var container = containerBuilder.Build();

            return container;
        }
Beispiel #23
0
            public override void ServerInitialize(IServerConfiguration serverConfiguration)
            {
                serverConfiguration.SetupPlayerLoginHook(PlayerLoginHook);
                serverConfiguration.PlayerRemoteCallRateExceeded += PlayerRemoteCallRateExceededHandler;

                if (!Database.TryGet(nameof(ServerPlayerAccessSystem),
                                     DatabaseKeyKickedPlayersDictionary,
                                     out kickedPlayersDictionary))
                {
                    kickedPlayersDictionary = new Dictionary <string, KickEntry>();
                    Database.Set(nameof(ServerPlayerAccessSystem),
                                 DatabaseKeyKickedPlayersDictionary,
                                 kickedPlayersDictionary);
                }

                // fill the legacy lists
                // TODO: remove once we no longer need this
                LoadLegacyList(isWhiteList: true);
                LoadLegacyList(isWhiteList: false);

                if (Database.TryGet(nameof(ServerPlayerAccessSystem),
                                    "IsWhitelistEnabled",
                                    out bool legacyIsWhiteListEnabled))
                {
                    Database.Remove(nameof(ServerPlayerAccessSystem),
                                    "IsWhitelistEnabled");
                    SetWhitelistMode(legacyIsWhiteListEnabled);
                }
Beispiel #24
0
            public virtual void Open()
            {
                IServerConfiguration config = Db4oClientServer.NewServerConfiguration();

                config.File.Storage = new MemoryStorage();
                _server             = Db4oClientServer.OpenServer(config, string.Empty, 0);
            }
Beispiel #25
0
        public bool BuildConfig(IServerConfiguration clients, IChannelDataProvider channelDataProvider, List <CDevice> devices, List <CLight> lights)
        {
            Util.Log("building config");

            BuildClientsHandlerConfig(clients);

            List <CColor> colors = new List <CColor>();

            if (!BuildColorConfig(colors))
            {
                return(false);
            }

            if (!BuildDeviceConfig(devices, channelDataProvider))
            {
                return(false);
            }

            if (!BuildLightConfig(lights, devices, colors))
            {
                return(false);
            }

            Util.Log("built config successfully");

            return(true);
        }
Beispiel #26
0
 public override void ServerInitialize(IServerConfiguration serverConfiguration)
 {
     base.ServerInitialize(serverConfiguration);
     ServerAreasGroupChanged += ServerAreasGroupChangedHandler;
     ServerBaseBroken        += ServerBaseBrokenHandler;
     FactionSystem.ServerFactionMemberAccessRightsChanged += ServerFactionMemberAccessRightsChangedHandler;
     FactionSystem.ServerCharacterJoinedOrLeftFaction     += ServerCharacterJoinedOrLeftFactionHandler;
 }
Beispiel #27
0
 /// <summary>
 /// Instantiates a new <see cref="BasicServerBase"/>.
 /// </summary>
 /// <param name="channelAddress">The client's address.</param>
 /// <param name="configuration">The client's configuration.</param>
 /// <param name="transportController">Controls the transportation layer.</param>
 /// <param name="logSourceId">The value used for the <see cref="Logging.ILogEntry.SourceId"/> when generating <see cref="Logging.ILog"/>s.</param>
 protected BasicServerBase(IChannelAddress channelAddress,
                           IServerConfiguration configuration,
                           ITransportController transportController,
                           string logSourceId)
     : this()
 {
     Initialize(channelAddress, configuration, transportController, logSourceId);
 }
 public override void ServerInitialize(IServerConfiguration serverConfiguration)
 {
     // invoke world init with some small delay because the world objects are not yet loaded
     // (that's the bootstrapper!)
     ServerTimersSystem.AddAction(
         delaySeconds: 0.1,
         () => Api.GetProtoEntity <TriggerWorldInit>().OnWorldInit());
 }
Beispiel #29
0
 public override void ServerInitialize(IServerConfiguration serverConfiguration)
 {
     Logger.Important("Farm plants growth speed multiplier: "
                      + ServerFarmPlantsGrowthSpeedMultiplier.ToString("0.###")
                      + Environment.NewLine
                      + "Farm plants spoil speed multiplier: "
                      + SharedFarmPlantsSpoilSpeedMultiplier.ToString("0.###"));
 }
Beispiel #30
0
		public PermissionProvider(
			IServerConfiguration serverConfiguration
			, IUserCache userCache) {

			_ServerConfiguration = serverConfiguration;
			_UserCache = userCache;
			_AdministratorPermission = _ServerConfiguration.AdministratorPermissionName;
		}
 public static Configure Db4oHostedDatabase(this Configure config, 
     ICurrentSessionContext currentSessionContext, IServerConfiguration serverConfig, 
     string dbFileName, int port, params HostedServerSessionFactory.Access[] access)
 {
     var sessionFactory = new HostedServerSessionFactory(currentSessionContext, serverConfig, dbFileName, port, access);
     config.Configurer.RegisterSingleton<ISessionFactory>(sessionFactory);
     return config;
 }
Beispiel #32
0
            public override void ServerInitialize(IServerConfiguration serverConfiguration)
            {
                Server.Characters.PlayerOnlineStateChanged += ServerPlayerOnlineStateChangedHandler;
                Server.Characters.PlayerNameChanged        += ServerPlayerNameChangedHandler;
                Server.World.WorldBoundsChanged            += ServerLoadSystem;

                ServerTimersSystem.AddAction(0, ServerLoadSystem);
            }
Beispiel #33
0
            public override void ServerInitialize(IServerConfiguration serverConfiguration)
            {
                Server.Characters.PlayerOnlineStateChanged += ServerPlayerOnlineStateChangedHandler;
                Server.Characters.PlayerNameChanged        += ServerPlayerNameChangedHandler;
                Server.World.WorldBoundsChanged            += this.ServerWorldBoundsChangedHandler;

                ServerLoadSystem();
            }
        /// <exception cref="System.Exception"></exception>
        public virtual void SetUp()
        {
            IServerConfiguration config = Db4oClientServer.NewServerConfiguration();

            config.File.Storage = new MemoryStorage();
            this.server         = Db4oClientServer.OpenServer(config, "InMemory:File", Port);
            this.server.GrantAccess(UsernameAndPassword, UsernameAndPassword);
        }
 public PresentationExportHelper(IServerConfiguration config, IPresentationDAL presentationDAL)
 {
     _config = config;
     _presentationDAL = presentationDAL;
     _serverSidePresentationSchemaTransfer = new ServerSideGroupFileTransfer(
         config.ScenarioFolder, new ServerSideGroupFileSourceEx(config.ScenarioFolder));
     _serverSidePresentationTransfer = new ServerSideGroupFileTransfer(
         _config.ScenarioFolder, new ServerSideGroupFileSourceEx(_config.ScenarioFolder));
 }
 public HttpResourceHandler(string method, string path, IServerConfiguration serverConfiguration)
 {
     _method = method;
     _path = path;
     _pipeline = new HttpHandler(serverConfiguration);
     _comparison = StringComparison.CurrentCulture;
     ServerConfiguration = serverConfiguration;
     AuthenticationScheme = AuthenticationSchemes.Anonymous;
 }
Beispiel #37
0
 public ProxyController(IHgServer hgServer, 
                        IServerConfiguration configuration,
                        IDeploymentManager deploymentManager,
                        IRepositoryManager repositoryManager)
 {
     _hgServer = hgServer;
     _configuration = configuration;
     _deploymentManager = deploymentManager;
     _repositoryManager = repositoryManager;
 }
Beispiel #38
0
        private async Task FinalizeConfiguration()
        {
            // Configure the server
            this.Configuration = this.CreateServerConfiguration();

            // Setup the server security, create the server and start it up.
            IEnumerable<ISecurityRole> roles = await this.Configuration.InitializeSecurityRoles();
            this.RegisterAllowedSecurityRoles(roles);
            await this.PrepareServerForRunning();
        }
        /// <summary>
        /// Allows configuration of the server and opening to the outside
        /// </summary>
        public HostedServerSessionFactory(ICurrentSessionContext currentSessionContext, IServerConfiguration config, string dbFileName, int port, params Access[] access)
            : base(currentSessionContext)
        {
            _server = Db4oClientServer.OpenServer(config, dbFileName, port);

            foreach(var account in access)
            {
                _server.GrantAccess(account.Username,account.Password);
            }
        }
Beispiel #40
0
 public LoginService(IServerConfiguration configuration)
 {
     _configuration = configuration;
     _loginStorage = new LoginStorage(_configuration);
     _store =
         NotificationManager<LoginService>.Instance.RegisterDuplexService<UserIdentity, ILoginNotifier>(
             NotifierBehaviour.OneInstance);
     _loginStorage.OnAddItem += new EventHandler<KeyCollection<UserIdentity>.KeyEventArgs>(_loginStorage_OnAddItem);
     _loginStorage.OnRemoveItem += new EventHandler<KeyCollection<UserIdentity>.KeyEventArgs>(_loginStorage_OnRemoveItem);
 }
Beispiel #41
0
 public ProxyService(IHgServer hgServer,
                     IServerConfiguration configuration,
                     IDeploymentManager deploymentManager,
                     IServerRepository severRepository)
 {
     _hgServer = hgServer;
     _configuration = configuration;
     _deploymentManager = deploymentManager;
     _severRepository = severRepository;
 }
        public ManagedSocketAdapter( Socket connection, IServerConfiguration configuration )
        {
            Id = Guid.NewGuid().ToString();
            Configuration = configuration;
            Connection = connection;
            Bytes = new byte[configuration.ReadBufferSize];
            OnDisconnect = new List<Action>();

            SocketStream = GetStream( connection );
        }
        //private readonly ISystemParametersAdapter _systemParameters;

        public AdministrationService(IServerConfiguration serviceConfiguration, ILoginService loginService, IPresentationWorker worker)
        {
            Debug.Assert(serviceConfiguration != null, "IServerConfiguration не может быть null");
            Debug.Assert(loginService != null, "ILoginService не может быть null");
            Debug.Assert(worker != null, "IPresentationWorker не может быть null");
            
            _serviceConfiguration = serviceConfiguration;
            _loginService = loginService;
            _worker = worker;
            //_systemParameters = new SystemParametersAdapter();
        }
Beispiel #44
0
 public LiveScmController(ITracer tracer,
                          IOperationLock deploymentLock,
                          IEnvironment environment,
                          IRepository repository,
                          IServerConfiguration serverConfiguration)
 {
     _tracer = tracer;
     _deploymentLock = deploymentLock;
     _environment = environment;
     _repository = repository;
     _serverConfiguration = serverConfiguration;
 }
 public ManagedSocketListener( IScheduler scheduler, IEndpointConfiguration endpoint, IServerConfiguration configuration )
 {
     try
     {
         Scheduler = scheduler;
         Configuration = configuration;
         Connection = Bind( endpoint );
     }
     catch (Exception ex)
     {
         Console.WriteLine( ex );
     }
 }
        public IServerConfiguration ConfigurarPersistenciaEntidades( IServerConfiguration configuracion )
        {
            //configuracion.Common.ObjectClass( typeof( Proyecto )).CascadeOnUpdate( true );
            configuracion.Common.ObjectClass( typeof( Bugtracker ) ).UpdateDepth( 5 );
            configuracion.Common.ObjectClass( typeof( Bugtracker ) ).CascadeOnUpdate( true );

            //((Db4objects.Db4o.Config.IConfiguration) test ).ClassActivationDepthConfigurable
            //configuracion.Common.ObjectClass( typeof( Bugtracker ) ).MinimumActivationDepth( 100);

            configuracion.Common.ObjectClass( typeof( Proyecto ) ).UpdateDepth( 10 );

            return configuracion;
        }
 public LiveScmController(ITracer tracer,
                          IOperationLock deploymentLock,
                          IEnvironment environment,
                          IRepositoryFactory repositoryFactory,
                          IServerConfiguration serverConfiguration,
                          IDeploymentStatusManager status)
 {
     _tracer = tracer;
     _deploymentLock = deploymentLock;
     _environment = environment;
     _repository = repositoryFactory.GetGitRepository();
     _serverConfiguration = serverConfiguration;
     _status = status;
 }
 public Win32SocketAdapter( IEndpointConfiguration endpoint, IServerConfiguration configuration )
 {
     try
     {
         Configuration = configuration;
         Connection = Bind( endpoint );
         Bytes = new byte[configuration.ReadBufferSize];
         OnDisconnect = new List<Action>();
     }
     catch (Exception ex)
     {
         Console.WriteLine( ex );
     }
 }
Beispiel #49
0
        public DesignerService(IServerConfiguration config, PresentationWorker worker, ILoginService loginService,
                               IAdministrationService administrationService)
        {
            Debug.Assert(config != null, "IServerConfiguration не может быть null");
            Debug.Assert(worker != null, "IPresentationWorker не может быть null");
            Debug.Assert(loginService != null, "ILoginService не может быть null");
            Debug.Assert(administrationService != null, "IAdministrationService не может быть null");

            _config = config;
            _loginService = loginService;
            _presentationWorker = worker;
            _administrationService = administrationService;
            _configFileExportHelper = new ConfigurationExportHelper(config);
        }
		/// <exception cref="Db4objects.Db4o.Ext.Db4oIOException"></exception>
		/// <exception cref="Db4objects.Db4o.Ext.IncompatibleFileFormatException"></exception>
		/// <exception cref="Db4objects.Db4o.Ext.OldFormatException"></exception>
		/// <exception cref="Db4objects.Db4o.Ext.DatabaseFileLockedException"></exception>
		/// <exception cref="Db4objects.Db4o.Ext.DatabaseReadOnlyException"></exception>
		public virtual IObjectServer OpenServer(IServerConfiguration config, string databaseFileName
			, int port)
		{
			LocalObjectContainer container = (LocalObjectContainer)Db4oFactory.OpenFile(AsLegacy
				(config), databaseFileName);
			if (container == null)
			{
				return null;
			}
			lock (container.Lock())
			{
				return new ObjectServerImpl(container, config, port);
			}
		}
Beispiel #51
0
        public void Initialize(IServerConfiguration configuration)
        {
            var netPeerConfiguration = new NetPeerConfiguration("LidgrenConfig");
            netPeerConfiguration.Port = configuration.Port;
            netPeerConfiguration.DisableMessageType(NetIncomingMessageType.UnconnectedData);
            netPeerConfiguration.DisableMessageType(NetIncomingMessageType.DiscoveryRequest);
            netPeerConfiguration.DisableMessageType(NetIncomingMessageType.DiscoveryResponse);

            server = new NetServer(netPeerConfiguration);

            Reader = new LidgrenMessageReader(server);
            Writer = new LidgrenMessageWriter(server);

            connections.Clear();
        }
Beispiel #52
0
        /// <summary>
        /// Constructs a new <see cref="ConsensusServer"/>.
        /// </summary>
        /// <param name="configuration">The <see cref="IServerConfiguration"/> of this <see cref="ConsensusServer"/>.</param>
        /// <param name="log">The <see cref="ILog"/> used by this <see cref="ConsensusServer"/> to store entries in.</param>
        /// <param name="protocol">The <see cref="IProtocol"/> using by this <see cref="ConsensusServer"/> to communicate with other <see cref="ConsensusServer"/>s in the same cluster.</param>
        /// <param name="scheduler">The <see cref="IResourceTrackingScheduler"/> on which to execute callbacks.</param>
        /// <exception cref="ArgumentNullException">Thrown if one of the parameters is null.</exception>
        public ConsensusServer(IServerConfiguration configuration, ILog log, IProtocol protocol, IResourceTrackingScheduler scheduler)
        {
            // validate arguments
            if (configuration == null)
                throw new ArgumentNullException("configuration");
            if (scheduler == null)
                throw new ArgumentNullException("scheduler");
            if (log == null)
                throw new ArgumentNullException("log");
            if (protocol == null)
                throw new ArgumentNullException("protocol");

            // store the arguments
            this.configuration = configuration;
            this.scheduler = scheduler;
            this.log = log;
            this.protocol = protocol;

            // create a new state
            state = new ConsensusServerState(this);
        }
 public BackgroundPresentationManager(IServerConfiguration config,
     IPresentationWorker worker,
     PresentationShowPreparator preparator,
     DisplayAndEquipmentMonitor monitor,
     IShowDisplayAndDeviceCommand showDisplayAndDeviceCommand,
     UserIdentity systemUser)
 {
     _config = config;
     _showPreparator = preparator;
     _monitor = monitor;
     _worker = worker;
     _showDisplayAndDeviceCommand = showDisplayAndDeviceCommand;
     _systemUser = systemUser;
     _restoreShowTimer = new Timer(RestoreShow);
     TimeSpan interval =TimeSpan.FromSeconds(BackgroundPresentationRestoreTimeout);
     _backgroundPresentationChange = new Timer(MonitorForBackgroundPresentation, null, interval, interval);
     // мониторинг оборудования
     _monitor.OnStateChange += new EventHandler<TechnicalServices.Interfaces.ConfigModule.Server.EqiupmentStateChangeEventArgs>(_monitor_OnStateChange);
     // мониторинг изменения в фоновом сценарии
     _worker.OnPresentationChanged += new EventHandler<PresentationChangedEventArgs>(_worker_OnPresentationChanged);
 }
			public void Prepare(IServerConfiguration configuration)
			{
				this._config = configuration;
				this._prepareCount++;
			}
		public ObjectServerImpl(LocalObjectContainer container, IServerConfiguration serverConfig
			, int port) : this(container, (ServerConfigurationImpl)serverConfig, (port < 0 ? 
			0 : port), port == 0)
		{
		}
		public void Prepare(IServerConfiguration configuration) 
		{
		}
Beispiel #57
0
 protected virtual void ValidateConfiguration(IServerConfiguration config)
 {
     if (ListenPort < 1)
         throw new ServiceConfigurationException("ListenPort must be > 0.");
     if (String.IsNullOrEmpty(Db4oFileName))
         throw new ServiceConfigurationException("Missing file name.");
     if (String.IsNullOrEmpty(ClientUsername))
         throw new ServiceConfigurationException("Missing ClientUsername.");
 }
Beispiel #58
0
 protected virtual void InitializeExtendedConfiguration(IServerConfiguration config)
 {
     config.Networking.MessageRecipient = this;
 }
 public SocketServer( IServerConfiguration configuration, IListenerFactory listenerFactory, IScheduler scheduler )
 {
     Configuration = configuration;
     Scheduler = scheduler;
     ListenerFactory = listenerFactory;
 }
Beispiel #60
0
		/// <summary>
		/// opens an
		/// <see cref="Db4objects.Db4o.IObjectServer">IObjectServer</see>
		/// on the specified database file and port.
		/// <br /><br />
		/// </summary>
		/// <param name="config">
		/// a custom
		/// <see cref="Db4objects.Db4o.CS.Config.IServerConfiguration">Db4objects.Db4o.CS.Config.IServerConfiguration
		/// 	</see>
		/// instance to be obtained via
		/// <see cref="NewServerConfiguration()">NewServerConfiguration()</see>
		/// </param>
		/// <param name="databaseFileName">an absolute or relative path to the database file</param>
		/// <param name="port">
		/// the port to be used or 0 if the server should not open a port, specify a value &lt; 0 if an arbitrary free port should be chosen - see
		/// <see cref="ExtObjectServer#port()">ExtObjectServer#port()</see>
		/// .
		/// </param>
		/// <returns>
		/// an
		/// <see cref="Db4objects.Db4o.IObjectServer">IObjectServer</see>
		/// listening
		/// on the specified port.
		/// </returns>
		/// <seealso cref="Configuration#readOnly">Configuration#readOnly</seealso>
		/// <seealso cref="Configuration#encrypt">Configuration#encrypt</seealso>
		/// <seealso cref="Configuration#password">Configuration#password</seealso>
		/// <exception cref="Db4oIOException">I/O operation failed or was unexpectedly interrupted.
		/// 	</exception>
		/// <exception cref="DatabaseFileLockedException">
		/// the required database file is locked by
		/// another process.
		/// </exception>
		/// <exception cref="IncompatibleFileFormatException">
		/// runtime
		/// <see cref="Db4objects.Db4o.Config.IConfiguration">configuration</see>
		/// is not compatible
		/// with the configuration of the database file.
		/// </exception>
		/// <exception cref="OldFormatException">
		/// open operation failed because the database file
		/// is in old format and
		/// <see cref="Db4objects.Db4o.Config.IConfiguration.AllowVersionUpdates(bool)">Db4objects.Db4o.Config.IConfiguration.AllowVersionUpdates(bool)
		/// 	</see>
		/// 
		/// is set to false.
		/// </exception>
		/// <exception cref="DatabaseReadOnlyException">database was configured as read-only.
		/// 	</exception>
		public static IObjectServer OpenServer(IServerConfiguration config, string databaseFileName
			, int port)
		{
			return config.Networking.ClientServerFactory.OpenServer(config, databaseFileName, 
				port);
		}