Example #1
0
 public ExternalRepositoryController(ExternalRepositoryManager externalRepositoryManager,
                                     AuthenticationManager authenticationManager, MainImportManager mainImportManager)
 {
     m_externalRepositoryManager = externalRepositoryManager;
     m_authenticationManager     = authenticationManager;
     m_mainImportManager         = mainImportManager;
 }
Example #2
0
        public static void RegisterDependencies()
        {
            var builder = new ContainerBuilder();

            var storageCredentials = GetPrimaryStorageCredentials();
            var batchCredentials   = GetBatchCredentials();

            builder.Register(c => new Microsoft.Azure.Batch.Blast.Configuration.BlastConfigurationManager(
                                 storageCredentials, batchCredentials).GetConfiguration())
            .As <BlastConfiguration>();

            builder.Register(c => new SystemDatabaseProvider(
                                 c.Resolve <BlastConfiguration>(),
                                 SystemDatabaseProvider.DefaultContainerName))
            .As <IDatabaseProvider>();

            builder.Register(c =>
            {
                var databaseRepoManager = new ExternalRepositoryManager(
                    c.Resolve <BlastConfiguration>());
                databaseRepoManager.AddRepository(ExternalRepositoryManager.GetNCBIRepository());
                return(databaseRepoManager);
            }).As <IExternalRepositoryManager>().SingleInstance();

            builder.Register(c =>
            {
                var importManager = new DatabaseImportManager(
                    c.Resolve <BlastConfiguration>());
                return(importManager);
            })
            .As <IDatabaseImportManager>().SingleInstance();

            builder.Register(c => new AzureSearchProvider(
                                 c.Resolve <BlastConfiguration>(),
                                 c.Resolve <IDatabaseProvider>()))
            .As <ISearchProvider>();

            // autowire
            builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly())
            .As <IDatabaseRepository>()
            .AsImplementedInterfaces()
            .InstancePerDependency();

            builder.RegisterAssemblyTypes(Assembly.GetExecutingAssembly())
            .As <ISearchProvider>()
            .AsImplementedInterfaces()
            .InstancePerRequest();

            // make controllers use constructor injection
            builder.RegisterControllers(Assembly.GetExecutingAssembly());
            builder.RegisterApiControllers(Assembly.GetExecutingAssembly()).InstancePerRequest();

            var container = builder.Build();

            DependencyResolver.SetResolver(new AutofacDependencyResolver(container));
            GlobalConfiguration.Configuration.DependencyResolver = new AutofacWebApiDependencyResolver(container);
        }
Example #3
0
 public MockDataManager(ExternalRepositoryManager externalRepositoryManager,
                        FilteringExpressionSetManager filteringExpressionSetManager, UserRepository userRepository,
                        ImportHistoryManager importHistoryManager)
 {
     m_externalRepositoryManager     = externalRepositoryManager;
     m_filteringExpressionSetManager = filteringExpressionSetManager;
     m_userRepository       = userRepository;
     m_importHistoryManager = importHistoryManager;
 }
Example #4
0
        public ImportPipelineManager(IEnumerable <IProjectImportManager> importManagers, ImportManager importManager,
                                     ILogger <ImportPipelineManager> logger, ImportPipelineBuilder importPipelineBuilder,
                                     ImportPipelineDirector importPipelineDirector, ExternalRepositoryManager externalRepositoryManager,
                                     ImportHistoryManager importHistoryManager)
        {
            m_projectImportManagers = new Dictionary <string, IProjectImportManager>();
            m_importManager         = importManager;
            m_logger = logger;
            m_importPipelineBuilder     = importPipelineBuilder;
            m_importPipelineDirector    = importPipelineDirector;
            m_externalRepositoryManager = externalRepositoryManager;
            m_importHistoryManager      = importHistoryManager;

            foreach (var manager in importManagers)
            {
                m_projectImportManagers.Add(manager.ExternalRepositoryTypeName, manager);
            }
        }