Esempio n. 1
0
        private AzureTableBasedGossipChannel gossipTable; // This type is internal

        public AzureGossipTableTests()
        {
            logger = LogManager.GetLogger("AzureGossipTableTests", LoggerType.Application);
        
            globalServiceId = Guid.NewGuid();
            deploymentId = "test-" + globalServiceId;

            IPAddress ip;
            if (!IPAddress.TryParse("127.0.0.1", out ip))
            {
                logger.Error(-1, "Could not parse ip address");
                return;
            }
            IPEndPoint ep1 = new IPEndPoint(ip, 21111);
            siloAddress1 = SiloAddress.New(ep1, 0);
            IPEndPoint ep2 = new IPEndPoint(ip, 21112);
            siloAddress2 = SiloAddress.New(ep2, 0);

            logger.Info("DeploymentId={0}", deploymentId);

            GlobalConfiguration config = new GlobalConfiguration
            {
                ServiceId = globalServiceId,
                ClusterId = "0",
                DeploymentId = deploymentId,
                DataConnectionString = TestDefaultConfiguration.DataConnectionString
            };

            gossipTable = new AzureTableBasedGossipChannel();
            var done = gossipTable.Initialize(config.ServiceId, config.DataConnectionString);
            if (!done.Wait(timeout))
            {
                throw new TimeoutException("Could not create/read table.");
            }
        }
        public async Task Reminders_AzureTable_InsertNewRowAndReadBack()
        {
            log.Info(TestContext.TestName);

            string deploymentId = NewDeploymentId();
            IReminderTable table = new AzureBasedReminderTable();
            var config = new GlobalConfiguration()
            {
                ServiceId = ServiceId,
                DeploymentId = deploymentId,
                DataConnectionString = StorageTestConstants.DataConnectionString
            };
            await table.Init(config, log);

            ReminderEntry[] rows = (await GetAllRows(table)).ToArray();
            Assert.AreEqual(0, rows.Count(), "The reminder table (sid={0}, did={1}) was not empty.", ServiceId, deploymentId);

            ReminderEntry expected = NewReminderEntry();
            await table.UpsertRow(expected);
            rows = (await GetAllRows(table)).ToArray();

            Assert.AreEqual(1, rows.Count(), "The reminder table (sid={0}, did={1}) did not contain the correct number of rows (1).", ServiceId, deploymentId);
            ReminderEntry actual = rows[0];
            Assert.AreEqual(expected.GrainRef, actual.GrainRef, "The newly inserted reminder table (sid={0}, did={1}) row did not contain the expected grain reference.", ServiceId, deploymentId);
            Assert.AreEqual(expected.ReminderName, actual.ReminderName, "The newly inserted reminder table (sid={0}, did={1}) row did not have the expected reminder name.", ServiceId, deploymentId);
            Assert.AreEqual(expected.Period, actual.Period, "The newly inserted reminder table (sid={0}, did={1}) row did not have the expected period.", ServiceId, deploymentId);
            // the following assertion fails but i don't know why yet-- the timestamps appear identical in the error message. it's not really a priority to hunt down the reason, however, because i have high confidence it is working well enough for the moment.
            /*Assert.AreEqual(expected.StartAt, actual.StartAt, "The newly inserted reminder table (sid={0}, did={1}) row did not contain the correct start time.", ServiceId, deploymentId);*/
            Assert.IsFalse(string.IsNullOrWhiteSpace(actual.ETag), "The newly inserted reminder table (sid={0}, did={1}) row contains an invalid etag.", ServiceId, deploymentId);
        }
Esempio n. 3
0
        public async Task InitializeMembershipTable(GlobalConfiguration config, bool tryInitTableVersion, TraceLogger traceLogger)
        {
            logger = traceLogger;
            deploymentId = config.DeploymentId;

            if (logger.IsVerbose3) logger.Verbose3("SqlMembershipTable.InitializeMembershipTable called.");

            database = RelationalStorageUtilities.CreateGenericStorageInstance(config.AdoInvariant, config.DataConnectionString);

            //This initializes all of Orleans operational queries from the database using a well known view
            //and assumes the database with appropriate defintions exists already.
            queryConstants = await database.InitializeOrleansQueriesAsync();

            // even if I am not the one who created the table, 
            // try to insert an initial table version if it is not already there,
            // so we always have a first table version row, before this silo starts working.
            if(tryInitTableVersion)
            {
                var wasCreated = await InitTableAsync();
                if(wasCreated)
                {
                    logger.Info("Created new table version row.");
                }
            }
        }
Esempio n. 4
0
        internal IMembershipTable GetMembershipTable(GlobalConfiguration.LivenessProviderType livenessType, string membershipTableAssembly = null)
        {
            IMembershipTable membershipTable;
            if (livenessType.Equals(GlobalConfiguration.LivenessProviderType.MembershipTableGrain))
            {
                membershipTable =
                    GrainReference.FromGrainId(Constants.SystemMembershipTableId).Cast<IMembershipTableGrain>();
            }
            else if (livenessType.Equals(GlobalConfiguration.LivenessProviderType.SqlServer))
            {
                membershipTable = AssemblyLoader.LoadAndCreateInstance<IMembershipTable>(Constants.ORLEANS_SQL_UTILS_DLL, logger);
            }
            else if (livenessType.Equals(GlobalConfiguration.LivenessProviderType.AzureTable))
            {
                membershipTable = AssemblyLoader.LoadAndCreateInstance<IMembershipTable>(Constants.ORLEANS_AZURE_UTILS_DLL, logger);
            }
            else if (livenessType.Equals(GlobalConfiguration.LivenessProviderType.ZooKeeper))
            {
                membershipTable = AssemblyLoader.LoadAndCreateInstance<IMembershipTable>(Constants.ORLEANS_ZOOKEEPER_UTILS_DLL, logger);
            }
            else if (livenessType.Equals(GlobalConfiguration.LivenessProviderType.Custom))
            {
                membershipTable = AssemblyLoader.LoadAndCreateInstance<IMembershipTable>(membershipTableAssembly, logger);
            }
            else
            {
                throw new NotImplementedException("No membership table provider found for LivenessType=" + livenessType);
            }

            return membershipTable;
        }
        public AnnotationsMetadataReader(GlobalConfiguration globalCfg, PersistentClass pc)
        {
            this.globalCfg = globalCfg;
            this.pc = pc;

            _auditData = new ClassAuditingData();
        }
Esempio n. 6
0
        /// <summary>
        /// Initialize current instance with specific global configuration and logger
        /// </summary>
        /// <param name="config"> Global configuration to initialize with </param>
        /// <param name="logger"> Specific logger to use in current instance </param>
        /// <returns></returns>
        public Task Init(GlobalConfiguration config, Logger logger)
        {
            deploymentId = config.DeploymentId;
            serviceId = config.ServiceId;

            this.logger = logger;

            storage = new DynamoDBStorage(config.DataConnectionStringForReminders, logger);
            logger.Info(ErrorCode.ReminderServiceBase, "Initializing AWS DynamoDB Reminders Table");

            var secondaryIndex = new GlobalSecondaryIndex
            {
                IndexName = SERVICE_ID_INDEX,
                Projection = new Projection { ProjectionType = ProjectionType.ALL },
                KeySchema = new List<KeySchemaElement>
                {
                    new KeySchemaElement { AttributeName = SERVICE_ID_PROPERTY_NAME, KeyType = KeyType.HASH},
                    new KeySchemaElement { AttributeName = GRAIN_HASH_PROPERTY_NAME, KeyType = KeyType.RANGE }
                }
            };

            return storage.InitializeTable(TABLE_NAME_DEFAULT_VALUE,
                new List<KeySchemaElement>
                {
                    new KeySchemaElement { AttributeName = REMINDER_ID_PROPERTY_NAME, KeyType = KeyType.HASH },
                    new KeySchemaElement { AttributeName = GRAIN_HASH_PROPERTY_NAME, KeyType = KeyType.RANGE }
                },
                new List<AttributeDefinition>
                {
                    new AttributeDefinition { AttributeName = REMINDER_ID_PROPERTY_NAME, AttributeType = ScalarAttributeType.S },
                    new AttributeDefinition { AttributeName = GRAIN_HASH_PROPERTY_NAME, AttributeType = ScalarAttributeType.N },
                    new AttributeDefinition { AttributeName = SERVICE_ID_PROPERTY_NAME, AttributeType = ScalarAttributeType.S }
                },
                new List<GlobalSecondaryIndex> { secondaryIndex });
        }
 internal static void Initialize(GlobalConfiguration config = null)
 {
     InitializeStrategies();
     var strategy = config == null
         ? GlobalConfiguration.DEFAULT_MULTICLUSTER_REGISTRATION_STRATEGY
         : config.DefaultMultiClusterRegistrationStrategy;
     defaultStrategy = GetStrategy(strategy);
 }
Esempio n. 8
0
 public async Task Init(GlobalConfiguration config, TraceLogger logger)
 {
     serviceId = config.ServiceId.ToString();
     deploymentId = config.DeploymentId;
     database = RelationalStorageUtilities.CreateGenericStorageInstance(config.AdoInvariantForReminders,
         config.DataConnectionStringForReminders);
     queryConstants = await database.InitializeOrleansQueriesAsync();
 }
        internal GlobalSingleInstanceActivationMaintainer(LocalGrainDirectory router, Logger logger, GlobalConfiguration config)
        {
            this.router = router;
            this.logger = logger;
            this.period = config.GlobalSingleInstanceRetryInterval;
            logger.Verbose("GSIP:M GlobalSingleInstanceActivationMaintainer Started, Period = {0}", period);

        }
 internal GrainDirectoryHandoffManager(LocalGrainDirectory localDirectory, GlobalConfiguration config)
 {
     logger = TraceLogger.GetLogger(this.GetType().FullName);
     this.localDirectory = localDirectory;
     directoryPartitionsMap = new Dictionary<SiloAddress, GrainDirectoryPartition>();
     silosHoldingMyPartition = new List<SiloAddress>();
     lastPromise = new Dictionary<SiloAddress, Task>();
 }
Esempio n. 11
0
        public FileBasedProjectConfiguration(FileSystem fileSystem, GlobalConfiguration globalConfiguration, NuConventions conventions)
            : base(fileSystem, GetFile(fileSystem, conventions))
        {
            _globalConfiguration = globalConfiguration;
            _conventions = conventions;

            OnMissing = GetGlobalConfigurationValue;
        }
Esempio n. 12
0
 public DeploymentLoadPublisher(Silo silo, GlobalConfiguration config)
     : base(Constants.DeploymentLoadPublisherSystemTargetId, silo.SiloAddress)
 {
     this.silo = silo;
     statisticsRefreshTime = config.DeploymentLoadPublisherRefreshTime;
     periodicStats = new ConcurrentDictionary<SiloAddress, SiloRuntimeStatistics>();
     siloStatisticsChangeListeners = new List<ISiloStatisticsChangeListener>();
 }
Esempio n. 13
0
 public SqlReminderTable(GlobalConfiguration config)
 {
     serviceId = config.ServiceId.ToString();
     deploymentId = config.DeploymentId;
     
     //TODO: Orleans does not yet provide the type of database used (to, e.g., to load dlls), so SQL Server is assumed.
     database = RelationalStorageUtilities.CreateGenericStorageInstance(WellKnownRelationalInvariants.SqlServer, config.DataConnectionString);
 }
        internal static void Initialize(GlobalConfiguration config)
        {
            InitializeStrategies();

            if (config.HasMultiClusterNetwork && config.UseGlobalSingleInstanceByDefault)
                defaultStrategy = GlobalSingleInstanceRegistration.Singleton;
            else
                defaultStrategy = ClusterLocalRegistration.Singleton;    
        }
Esempio n. 15
0
 private void Init()
 {
     Globals = new GlobalConfiguration();
     Defaults = new NodeConfiguration();
     Overrides = new Dictionary<string, NodeConfiguration>();
     overrideXml = new Dictionary<string, string>();
     SourceFile = "";
     IsRunningAsUnitTest = false;
 }
        public QueryGeneratorBuilder(GlobalConfiguration globalCfg, AuditEntitiesConfiguration verEntCfg,
            MiddleIdData referencingIdData, String auditMiddleEntityName)
        {
            this._globalCfg = globalCfg;
            this._verEntCfg = verEntCfg;
            this._referencingIdData = referencingIdData;
            this._auditMiddleEntityName = auditMiddleEntityName;

            _idDatas = new List<MiddleIdData>();
        }
        public void Initialize(GlobalConfiguration globalConfig)
        {            
            DeploymentLoadPublisher.Instance.SubscribeToStatisticsChangeEvents(this);

            SelectSilo = SelectSiloPowerOfK;
            if (globalConfig.ActivationCountBasedPlacementChooseOutOf <= 0)
                throw new ArgumentException("GlobalConfig.ActivationCountBasedPlacementChooseOutOf is " + globalConfig.ActivationCountBasedPlacementChooseOutOf);
            
            chooseHowMany = globalConfig.ActivationCountBasedPlacementChooseOutOf;
        }
Esempio n. 18
0
        public QueryGeneratorBuilder(GlobalConfiguration globalCfg, AuditEntitiesConfiguration verEntCfg, IAuditStrategy auditStrategy,
							  MiddleIdData referencingIdData, string auditMiddleEntityName)
        {
            _globalCfg = globalCfg;
            _verEntCfg = verEntCfg;
            _auditStrategy = auditStrategy;
            _referencingIdData = referencingIdData;
            _auditMiddleEntityName = auditMiddleEntityName;

            _idDatas = new List<MiddleIdData>();
        }
Esempio n. 19
0
 internal SiloStatisticsManager(GlobalConfiguration globalConfig, NodeConfiguration nodeConfig)
 {
     MessagingStatisticsGroup.Init(true);
     MessagingProcessingStatisticsGroup.Init();
     NetworkingStatisticsGroup.Init(true);
     ApplicationRequestsStatisticsGroup.Init(globalConfig.ResponseTimeout);
     SchedulerStatisticsGroup.Init();
     StorageStatisticsGroup.Init();
     runtimeStats = new RuntimeStatisticsGroup();
     logStatistics = new LogStatistics(nodeConfig.StatisticsLogWriteInterval, true);
     MetricsTable = new SiloPerformanceMetrics(runtimeStats, nodeConfig);
     perfCountersPublisher = new PerfCountersStatistics(nodeConfig.StatisticsPerfCountersWriteInterval);
 }
Esempio n. 20
0
        public async Task InitializeMembershipTable(GlobalConfiguration config, bool tryInitTableVersion, TraceLogger traceLogger)
        {
            deploymentId = config.DeploymentId;
            connectionString = config.DataConnectionString;

            // even if I am not the one who created the table, 
            // try to insert an initial table version if it is not already there,
            // so we always have a first table version row, before this silo starts working.
            if (tryInitTableVersion)
            {
                await InitTable();
            }
        }
	    public AuditedPropertiesReader(ModificationStore defaultStore,
								       IPersistentPropertiesSource persistentPropertiesSource,
								       IAuditedPropertiesHolder auditedPropertiesHolder,
								       GlobalConfiguration globalCfg,
								       String propertyNamePrefix) {
		    this._defaultStore = defaultStore;
		    this._persistentPropertiesSource = persistentPropertiesSource;
		    this._auditedPropertiesHolder = auditedPropertiesHolder;
		    this._globalCfg = globalCfg;
		    this._propertyNamePrefix = propertyNamePrefix;

		    _propertyAccessedPersistentProperties = Toolz.NewHashSet<String>();
		    _fieldAccessedPersistentProperties = Toolz.NewHashSet<String>();
	    }
        public async Task Reminders_AzureTable_InsertRate()
        {
            IReminderTable table = new AzureBasedReminderTable();
            var config = new GlobalConfiguration()
            {
                ServiceId = ServiceId,
                DeploymentId = "TMSLocalTesting",
                DataConnectionString = StorageTestConstants.DataConnectionString
            };
            await table.Init(config, log);

            await TestTableInsertRate(table, 10);
            await TestTableInsertRate(table, 500);
        }
        private async Task Initialize()
        {
            deploymentId = "test-" + Guid.NewGuid();
            logger.Info("DeploymentId={0}", deploymentId);

            var config = new GlobalConfiguration
            {
                DeploymentId = deploymentId,
                DataConnectionString = StorageTestConstants.DataConnectionString
            };

            var mbr = new AzureBasedMembershipTable();
            await mbr.InitializeMembershipTable(config, true, logger).WithTimeout(timeout);
            membership = mbr;
        }
        private async Task Initialize()
        {
            deploymentId = "test-" + Guid.NewGuid();
            int generation = SiloAddress.AllocateNewGeneration();
            siloAddress = SiloAddress.NewLocalAddress(generation);

            logger.Info("DeploymentId={0} Generation={1}", deploymentId, generation);

            GlobalConfiguration config = new GlobalConfiguration
            {
                DeploymentId = deploymentId,                
                DataConnectionString = relationalStorage.ConnectionString                
            };

            var mbr = new SqlMembershipTable();
            await mbr.InitializeMembershipTable(config, true, logger).WithTimeout(timeout);
            membership = mbr;
        }
Esempio n. 25
0
        public void TestInitialize()
        {
            logger = TraceLogger.GetLogger(GetType().Name, TraceLogger.LoggerType.Application);
            deploymentId = "test-" + Guid.NewGuid();

            logger.Info("DeploymentId={0}", deploymentId);

            var globalConfiguration = new GlobalConfiguration
            {
                DeploymentId = deploymentId,
                AdoInvariant = GetAdoInvariant(),
                DataConnectionString = GetConnectionString()
            };

            var mbr = CreateMembershipTable(logger);
            mbr.InitializeMembershipTable(globalConfiguration, true, logger).WithTimeout(TimeSpan.FromMinutes(1)).Wait();
            membershipTable = mbr;
        }
Esempio n. 26
0
 public Task InitializeMembershipTable(GlobalConfiguration config, bool tryInitTableVersion, Logger log)
 {
     logger = log;
     deploymentId = config.DeploymentId;
     storage = new DynamoDBStorage(config.DataConnectionString, log);
     logger.Info(ErrorCode.MembershipBase, "Initializing AWS DynamoDB Membership Table");
     return storage.InitializeTable(TABLE_NAME_DEFAULT_VALUE,
         new List<KeySchemaElement>
         {
             new KeySchemaElement { AttributeName = SiloInstanceRecord.DEPLOYMENT_ID_PROPERTY_NAME, KeyType = KeyType.HASH },
             new KeySchemaElement { AttributeName = SiloInstanceRecord.SILO_IDENTITY_PROPERTY_NAME, KeyType = KeyType.RANGE }
         },
         new List<AttributeDefinition>
         {
             new AttributeDefinition { AttributeName = SiloInstanceRecord.DEPLOYMENT_ID_PROPERTY_NAME, AttributeType = ScalarAttributeType.S },
             new AttributeDefinition { AttributeName = SiloInstanceRecord.SILO_IDENTITY_PROPERTY_NAME, AttributeType = ScalarAttributeType.S }
         });
 }
Esempio n. 27
0
        private async Task Initialize()
        {
            deploymentId = "test-" + Guid.NewGuid();
            int generation = SiloAddress.AllocateNewGeneration();

            logger.Info("DeploymentId={0} Generation={1}", deploymentId, generation);

            GlobalConfiguration config = new GlobalConfiguration
                                         {
                                             DeploymentId = deploymentId,
                                             DataConnectionStringForReminders = connectionString,
                                             AdoInvariantForReminders = AdoNetInvariants.InvariantNameMySql
                                         };

            var rmndr = new SqlReminderTable();
            await rmndr.Init(config, logger).WithTimeout(timeout);
            reminder = rmndr;
        }
        private async Task Initialize()
        {
            deploymentId = "test-" + Guid.NewGuid();
            int generation = SiloAddress.AllocateNewGeneration();
            siloAddress = SiloAddress.NewLocalAddress(generation);

            logger.Info("DeploymentId={0} Generation={1}", deploymentId, generation);

            GlobalConfiguration config = new GlobalConfiguration
            {
                DeploymentId = deploymentId,
                DataConnectionString = StorageTestConstants.GetZooKeeperConnectionString()
            };

            var mbr = AssemblyLoader.LoadAndCreateInstance<IMembershipTable>(Constants.ORLEANS_ZOOKEEPER_UTILS_DLL, logger);
            await mbr.InitializeMembershipTable(config, true, logger).WithTimeout(timeout);
            membership = mbr;
        }
Esempio n. 29
0
 public GrainRuntime(
     GlobalConfiguration globalConfig,
     ILocalSiloDetails localSiloDetails,
     IGrainFactory grainFactory,
     ITimerRegistry timerRegistry,
     IReminderRegistry reminderRegistry,
     IStreamProviderManager streamProviderManager,
     IServiceProvider serviceProvider,
     IRuntimeClient runtimeClient)
 {
     this.runtimeClient = runtimeClient;
     ServiceId = globalConfig.ServiceId;
     SiloIdentity = localSiloDetails.SiloAddress.ToLongString();
     GrainFactory = grainFactory;
     TimerRegistry = timerRegistry;
     ReminderRegistry = reminderRegistry;
     StreamProviderManager = streamProviderManager;
     ServiceProvider = serviceProvider;
 }
        public async Task InitializeMembershipTable(GlobalConfiguration config, bool tryInitTableVersion, TraceLogger traceLogger)
        {
            logger = traceLogger;
            AzureTableDefaultPolicies.MaxBusyRetries = config.MaxStorageBusyRetries;
            TraceLogger.SetExceptionDecoder(typeof(StorageException), AzureStorageUtils.PrintStorageException);

            tableManager = await OrleansSiloInstanceManager.GetManager(
                config.DeploymentId, config.DataConnectionString);

            // even if I am not the one who created the table, 
            // try to insert an initial table version if it is not already there,
            // so we always have a first table version row, before this silo starts working.
            if (tryInitTableVersion)
            {
                // ignore return value, since we don't care if I inserted it or not, as long as it is in there. 
                bool created = await tableManager.TryCreateTableVersionEntryAsync().WithTimeout(AzureTableDefaultPolicies.TableOperationTimeout);
                if(created) logger.Info("Created new table version row.");
            }
        }
Esempio n. 31
0
 protected void Application_Start()
 {
     XmlConfigurator.Configure();
     logger.Info("Application start - before configuring");
     GlobalConfiguration.Configure(WebApiConfig.Register);
 }
Esempio n. 32
0
 protected void Application_Start(object sender, EventArgs e)
 {
     GlobalConfiguration.Configure(SetupDahAPI.DoSomeStuffToGetReady);
 }
 protected void Application_Start()
 {
     GlobalConfiguration.Configure(WebApiConfig.Register);
     AutofacDependecyBuilder.DependencyBuilder();
 }
Esempio n. 34
0
        public MpqProvider(GlobalConfiguration globalConfiguration)
        {
            // TODO: Make this less dumb. We need to an external file to configure mpq load order.

            _mpqs = Directory
                    .EnumerateFiles(globalConfiguration.BaseDataPath, "*.mpq")
                    .Where(x => !(Path.GetFileName(x)?.StartsWith("patch") ?? false))
                    .Select(file => new MPQ(file))
                    .ToList();


            if (!_mpqs.Any())
            {
                _log.Fatal("No data files were found! Are you specifying the correct data path?");
                throw new OpenDiablo2Exception("No data files were found.");
            }

            // Load the base game files
            for (var i = 0; i < _mpqs.Count; i++)
            {
                var path = Path.GetFileName(_mpqs[i].Path) ?? string.Empty;

                if (path.StartsWith("d2exp") || path.StartsWith("d2x"))
                {
                    continue;
                }

                foreach (var file in _mpqs[i].Files)
                {
                    _mpqLookup[file.ToLower()] = i;
                }
            }

            // Load the expansion game files
            for (var i = 0; i < _mpqs.Count; i++)
            {
                var path = Path.GetFileName(_mpqs[i].Path) ?? string.Empty;

                if (!path.StartsWith("d2exp") && !path.StartsWith("d2x"))
                {
                    continue;
                }

                foreach (var file in _mpqs[i].Files)
                {
                    _mpqLookup[file.ToLower()] = i;
                }
            }

            // Get the combined list file by joining all of the other mpqs
            List <string> superListFile = _mpqs.SelectMany(x => x.Files).ToList();

            var patchMPQ = Directory
                           .EnumerateFiles(globalConfiguration.BaseDataPath, "*.mpq")
                           .Where(x => Path.GetFileName(x).StartsWith("patch"))
                           .Select(file => new MPQ(file, superListFile))
                           .First();

            _mpqs.Add(patchMPQ);
            int patchMPQIndex = _mpqs.Count - 1;

            // Replace existing mpqLookups with those from the patch, which take precedence
            foreach (var file in patchMPQ.Files)
            {
                // unlike the other mpqs, we need to ensure that the files actually exist
                // inside of the patch mpq instead of assuming that they do, because
                // we can't trust the filelist
                if (!patchMPQ.HasFile(file))
                {
                    continue;
                }

                _mpqLookup[file.ToLower()] = patchMPQIndex;
            }
        }
 protected void Application_Start()
 {
     sql = App_Start.Sql_db.get_DBInstance.getDBConn();
     GlobalConfiguration.Configure(WebApiConfig.Register);
 }
Esempio n. 36
0
        /// <summary>
        ///     Opens and initializes devices and services listening and running on the local machine.
        /// </summary>
        /// <returns>True on success, false otherwise.</returns>
        public override bool Open()
        {
            var opened = false;

            Log.Debug("Initializing root hub");

            _limitInstance = new LimitInstance(@"Global\ScpDsxRootHub");

            try
            {
                if (!_limitInstance.IsOnlyInstance) // existing root hub running as desktop app
                {
                    throw new RootHubAlreadyStartedException(
                              "The root hub is already running, please close the ScpServer first!");
                }
            }
            catch (UnauthorizedAccessException) // existing root hub running as service
            {
                throw new RootHubAlreadyStartedException(
                          "The root hub is already running, please stop the ScpService first!");
            }

            Log.DebugFormat("++ {0} {1}", Assembly.GetExecutingAssembly().Location,
                            Assembly.GetExecutingAssembly().GetName().Version);
            Log.DebugFormat("++ {0}", OsInfoHelper.OsInfo);

            #region Native feed server

            _rxFeedServer = new ReactiveListener(Settings.Default.RootHubNativeFeedPort);

            _rxFeedServer.Connections.Subscribe(socket =>
            {
                Log.DebugFormat("Client connected on native feed channel: {0}", socket.GetHashCode());
                var protocol = new ScpNativeFeedChannel(socket);

                _nativeFeedSubscribers.Add(socket.GetHashCode(), protocol);

                protocol.Receiver.Subscribe(packet => { Log.Warn("Uuuhh how did we end up here?!"); });

                socket.Disconnected += (sender, e) =>
                {
                    Log.DebugFormat(
                        "Client disconnected from native feed channel {0}",
                        sender.GetHashCode());

                    _nativeFeedSubscribers.Remove(socket.GetHashCode());
                };

                socket.Disposed += (sender, e) =>
                {
                    Log.DebugFormat("Client disposed from native feed channel {0}",
                                    sender.GetHashCode());

                    _nativeFeedSubscribers.Remove(socket.GetHashCode());
                };
            });

            #endregion

            opened |= _scpBus.Open(GlobalConfiguration.Instance.Bus);
            opened |= _usbHub.Open();
            opened |= _bthHub.Open();

            GlobalConfiguration.Load();
            return(opened);
        }
Esempio n. 37
0
 /// <summary>
 ///     Submits an altered copy of the global configuration to the root hub and saves it.
 /// </summary>
 /// <param name="configuration">The global configuration object.</param>
 public void SubmitConfiguration(GlobalConfiguration configuration)
 {
     GlobalConfiguration.Submit(configuration);
     GlobalConfiguration.Save();
 }
Esempio n. 38
0
 /// <summary>
 ///     Requests the currently active configuration set from the root hub.
 /// </summary>
 /// <returns>Returns the global configuration object.</returns>
 public GlobalConfiguration RequestConfiguration()
 {
     return(GlobalConfiguration.Request());
 }
Esempio n. 39
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     GlobalConfiguration.Configure(WebApiConfig.Register);
 }
Esempio n. 40
0
        public override bool Open()
        {
            var opened = false;

            Log.Info("Initializing root hub");

            Log.DebugFormat("++ {0} {1}", Assembly.GetExecutingAssembly().Location,
                            Assembly.GetExecutingAssembly().GetName().Version);
            Log.DebugFormat("++ {0}", OsInfoHelper.OsInfo);

            #region Native feed server

            _rxFeedServer.Connections.Subscribe(socket =>
            {
                Log.InfoFormat("Client connected on native feed channel: {0}", socket.GetHashCode());
                var protocol = new ScpNativeFeedChannel(socket);

                lock (this)
                {
                    _nativeFeedSubscribers.Add(socket.GetHashCode(), protocol);
                }

                protocol.Receiver.Subscribe(packet =>
                {
                    Log.Debug("Uuuhh how did we end up here?!");
                });

                socket.Disconnected += (sender, e) =>
                {
                    Log.InfoFormat(
                        "Client disconnected from native feed channel {0}",
                        sender.GetHashCode());

                    lock (this)
                    {
                        _nativeFeedSubscribers.Remove(socket.GetHashCode());
                    }
                };

                socket.Disposed += (sender, e) =>
                {
                    Log.InfoFormat("Client disposed from native feed channel {0}",
                                   sender.GetHashCode());

                    lock (this)
                    {
                        _nativeFeedSubscribers.Remove(socket.GetHashCode());
                    }
                };
            });

            #endregion

            scpMap.Open();

            opened |= _scpBus.Open(GlobalConfiguration.Instance.Bus);
            opened |= _usbHub.Open();
            opened |= _bthHub.Open();

            GlobalConfiguration.Load();
            return(opened);
        }
Esempio n. 41
0
 protected void Application_Start()
 {
     GlobalConfiguration.Configure(WebApiConfig.Register);
     AreaRegistration.RegisterAllAreas();
     RouteConfig.RegisterRoutes(RouteTable.Routes);
 }
Esempio n. 42
0
 protected void Application_Start()
 {
     GlobalConfiguration.Configuration.UseStructureMap <CustomRegistry>();
     GlobalConfiguration.Configure(WebApiConfig.Register);
 }
 public void Process(PipelineArgs args)
 {
     //GlobalConfiguration.Configure(config => config.MapHttpAttributeRoutes());
     GlobalConfiguration.Configure(ReplaceControllerSelector);
 }
Esempio n. 44
0
        // Yes, calling log4net.Config.XmlConfigurator.Configure(); is lame.  It's a bug in the current log4net universal with common logging

        protected void Application_Start()
        {
            log4net.Config.XmlConfigurator.Configure();
            GlobalConfiguration.Configure(WebApiConfig.Register);
        }
Esempio n. 45
0
 public async Task Init(GlobalConfiguration config, Logger logger)
 {
     serviceId      = config.ServiceId.ToString();
     orleansQueries = await RelationalOrleansQueries.CreateInstance(config.AdoInvariantForReminders, config.DataConnectionStringForReminders);
 }
Esempio n. 46
0
 protected void Application_Start()
 {
     GlobalConfiguration.Configure(WebApiConfig.Register);
 }
Esempio n. 47
0
 protected void Application_Start()
 {
     GlobalConfiguration.Configure(WebApiConfig.Register);
     GlobalConfiguration.Configure(FormatterConfig.Register);
     GlobalConfiguration.Configure(AutofacConfig.Register);
 }
Esempio n. 48
0
 public void Configuration(IAppBuilder app)
 {
     AutoMapperClient.Initialize();
     ConfigureAuth(app);
     GlobalConfiguration.Configure(WebApiConfig.Register);
 }
Esempio n. 49
0
 public SqlReminderTable(GlobalConfiguration config)
 {
     serviceId        = config.ServiceId.ToString();
     connectionString = config.DataConnectionString;
 }
 void Application_Start(object sender, EventArgs e)
 {
     // 應用程式啟動時執行的程式碼
     GlobalConfiguration.Configure(WebApiConfig.Register);
 }
Esempio n. 51
0
 public async Task Init(GlobalConfiguration config)
 {
     remTableManager = await RemindersTableManager.GetManager(this.siloOptions.ServiceId, this.siloOptions.ClusterId, config.DataConnectionStringForReminders, this.loggerFactory);
 }
Esempio n. 52
0
 protected void Application_Start()
 {
     AutoMapperConfig.Initialize();
     GlobalConfiguration.Configure(WebApiConfig.Register);
 }
Esempio n. 53
0
 public void Configuration(IAppBuilder app)
 {
     ConfigureAuth(app);
     GlobalConfiguration.Configure(WebApiConfig.Register);
 }
Esempio n. 54
0
 protected void Application_Start(object sender, EventArgs e)
 {
     AreaRegistration.RegisterAllAreas();
     GlobalConfiguration.Configure(WebApiConfig.Register);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
 }
Esempio n. 55
0
 void Application_Start(object sender, EventArgs e)
 {
     // Code that runs on application startup
     GlobalConfiguration.Configure(WebApiConfig.Register);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
 }
Esempio n. 56
0
 protected void Application_Start()
 {
     GlobalConfiguration.Configure(WebApiConfig.Register);
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
 }
Esempio n. 57
0
 protected void Application_Start()
 {
     GlobalConfiguration.Configure(WebApiConfig.Register);
     UnityConfig.RegisterComponents();
 }
 protected void Application_Start()
 {
     GlobalConfiguration.Configure(WebApiConfig.Register);
     AutoMapperConfig.RegisterMappings();
 }
Esempio n. 59
0
 protected void Application_Start(object sender, EventArgs e)
 {
     GlobalConfiguration.Configure(WebApiConfig.Register);
 }
Esempio n. 60
0
 public static void CreateDeploymentLoadPublisher(Silo silo, GlobalConfiguration config)
 {
     Instance = new DeploymentLoadPublisher(silo, config.DeploymentLoadPublisherRefreshTime);
 }