示例#1
0
        private void RunSegment(
            int segmentIndex,
            int segmentCount,
            SegmentConfiguration segmentConfiguration,
            IBootstrapper bootstrapper,
            ISafeRepository safeRepository)
        {
            this.SetupConfigurationProvider(segmentConfiguration, bootstrapper);
            IContext context = this.SetupContext(
                segmentConfiguration,
                segmentIndex,
                segmentCount,
                bootstrapper,
                safeRepository);
            IBridge bridge = this.bridgeFactory.CreateBridge(
                segmentConfiguration.Type,
                context.EntityType.Type,
                bootstrapper);
            IInvocableInitializer invocableInitializer =
                bootstrapper.Get <IInvocableInitializer>();

            bridge.ContextValidator.Validate(context);
            ISegmentRunner segmentRunner = bridge.CreateSegmentRunner();

            bridge.EventDispatcher.SegmentExecuting(new SegmentExecutingArgs());
            invocableInitializer.Initialize(bridge.EventDispatcher);
            segmentRunner.Run();
            bridge.EventDispatcher.SegmentExecuted(new SegmentExecutedArgs());
        }
示例#2
0
 public ServiceProvider(
     IContext context,
     ISafeRepository dataRepository,
     [ImportMany] IEnumerable <IFeed <TEntity> > feeds,
     [ImportMany] IEnumerable <ISink <TEntity> > sinks,
     [ImportMany] IEnumerable <ICacheFeed <TEntity> > cacheFeeds,
     [ImportMany] IEnumerable <IMetadataProvider <TEntity> > metadataProviders,
     [ImportMany] IEnumerable <ISerializer <TEntity> > serializers,
     [ImportMany] IEnumerable <
         IPreprocessorOperation <TEntity> > preprocessorOperations,
     [ImportMany] IEnumerable <IHomogenizer> homogenizers,
     [ImportMany] IEnumerable <IMerger <TEntity> > mergers)
 {
     this.context                = context;
     this.safeRepository         = dataRepository;
     this.feeds                  = feeds;
     this.sinks                  = sinks;
     this.cacheFeeds             = cacheFeeds;
     this.metadataProviders      = metadataProviders;
     this.serializers            = serializers;
     this.preprocessorOperations = preprocessorOperations;
     this.homogenizers           = homogenizers;
     this.mergers                = mergers;
     this.feedTypeFullName       = new Lazy <string>(this.GetFeedTypeFullName);
     this.feed       = new Lazy <IFeed <TEntity> >(this.GetFeed);
     this.entityType = new Lazy <Persistence.IEntityType>(this.GetEntityType);
     this.sink       = new Lazy <ISink <TEntity> >(this.GetSink);
     this.cacheFeed  = new Lazy <ICacheFeed <TEntity> >(this.GetCacheFeed);
 }
示例#3
0
 private void ProcessParameters(
     ParameterScope scope,
     IDictionary <string, string> parameters,
     IDictionary <string, IParameter> existingParameters,
     ISafeRepository safeRepository)
 {
     foreach (string name in parameters.Keys)
     {
         if (existingParameters.ContainsKey(name))
         {
             if (existingParameters[name].Value != parameters[name])
             {
                 safeRepository.SetParameterValue(
                     existingParameters[name].Id, parameters[name]);
             }
             existingParameters.Remove(name);
         }
         else
         {
             safeRepository.CreateParameter(
                 new Parameter(
                     Guid.NewGuid(),
                     scope.DestinationSystemId,
                     scope.EntityTypeId,
                     scope.SourceSystemId,
                     name,
                     parameters[name]));
         }
     }
 }
示例#4
0
 private void DeleteOrphanParameters(
     IEnumerable <IParameter> parameters, ISafeRepository safeRepository)
 {
     foreach (IParameter parameter in parameters)
     {
         safeRepository.DeleteParameter(parameter.Id);
     }
 }
示例#5
0
 public SafeServices(ISafeRepository safeRepository)
 {
     if (safeRepository == null)
     {
         throw new ArgumentNullException("SafeRepository");
     }
     _SafeRepository = safeRepository;
 }
示例#6
0
 private void CreateOrUpdateFeeds(
     IEnumerable <Feed> feeds,
     ISafeRepository safeRepository)
 {
     foreach (Feed feed in feeds)
     {
         safeRepository.CreateOrUpdateFeed(feed);
     }
 }
示例#7
0
 private void CreateOrUpdateExternalSystems(
     IEnumerable <ExternalSystem> externalSystems,
     ISafeRepository safeRepository)
 {
     foreach (ExternalSystem externalSystem in externalSystems)
     {
         safeRepository.CreateOrUpdateExternalSystem(externalSystem);
     }
 }
 public MappingDataRepository(
     IContext context,
     IOperationExecutive operationExecutive,
     ISafeRepository safeRepository)
 {
     this.context            = context;
     this.operationExecutive = operationExecutive;
     this.safeRepository     = safeRepository;
 }
示例#9
0
 private void CreateOrUpdateEntityTypes(
     IEnumerable <EntityType> entityTypes,
     ISafeRepository safeRepository)
 {
     foreach (EntityType entityType in entityTypes)
     {
         safeRepository.CreateOrUpdateEntityType(entityType);
     }
 }
示例#10
0
 public EmployeeRepository(string connectionString,
                           ILogger <IRepository <EmployeeDTO> > logger,
                           ISafeRepository <PositionDTO> positionRepository,
                           IReaderConverter <EmployeeDTO> employeeConverter) : base(logger)
 {
     this.logger             = logger;
     this.positionRepository = positionRepository;
     ConnectionString        = connectionString;
     convert = employeeConverter.converterToDTO;
 }
        public GenericRestEntityRemoteService(
            ISafeRepository <TEntity> repository,
            ILogger <GenericRestEntityRemoteService <TEntity> > logger,
            IEntityManager entityManager)
        {
            this.Repository    = repository;
            this.Logger        = logger;
            this.EntityManager = entityManager;

            this.Entity = entityManager.GetEntityByClrType(typeof(TEntity));
        }
示例#12
0
 private ContextFactory GetContextFactory(ISafeRepository safeRepository)
 {
     if (this.contextFactory == null)
     {
         this.contextFactory = new ContextFactory(
             this,
             safeRepository.GetExternalSystems(),
             safeRepository.GetEntityTypes(),
             safeRepository.GetSharedIdentifierSourceSystems());
     }
     return(this.contextFactory);
 }
示例#13
0
 private void CreateSharedSourceSystemIdentifierGroup(
     SharedSourceSystemIdentifierGroup group,
     int groupNumber,
     ISafeRepository safeRepository)
 {
     foreach (Guid sourceSystemId in group.SourceSystemIds)
     {
         safeRepository.CreateSharedSourceSystemIdentifier(
             new SharedSourceSystemIdentifier(
                 group.EntityTypeId, sourceSystemId, groupNumber));
     }
 }
 public ProjectRepository(string connectionString,
                          ILogger <IRepository <ProjectDTO> > logger,
                          IRepository <EmployeeDTO> employeeRepository,
                          ISafeRepository <StatusDTO> statusRepository,
                          IReaderConverter <ProjectDTO> projectConverter,
                          IReaderConverter <TaskDTO> taskConverter) : base(logger)
 {
     this.logger             = logger;
     ConnectionString        = connectionString;
     this.employeeRepository = employeeRepository;
     this.statusRepository   = statusRepository;
     convert     = projectConverter.converterToDTO;
     convertTask = taskConverter.converterToDTO;
 }
示例#15
0
 GetExistingParametersByScope(ISafeRepository safeRepository)
 {
     return
         (safeRepository
          .GetParameters()
          .GroupBy(parameter => new ParameterScope(
                       parameter.DestinationSystemId,
                       parameter.EntityTypeId,
                       parameter.SourceSystemId))
          .ToDictionary(
              parameters => parameters.Key,
              parameters => parameters.ToDictionary(
                  parameter => parameter.Name)));
 }
示例#16
0
 private void CreateSharedSourceSystemIdentifierGroups(
     IEnumerable <SharedSourceSystemIdentifierGroup> groups,
     ISafeRepository safeRepository)
 {
     foreach (IGrouping <Guid, SharedSourceSystemIdentifierGroup>
              entityTypeGroups in groups.GroupBy(group => group.EntityTypeId))
     {
         safeRepository.ClearSharedSourceSystemIdentifiers(entityTypeGroups.Key);
         int groupNumber = 1;
         foreach (SharedSourceSystemIdentifierGroup group in entityTypeGroups)
         {
             this.CreateSharedSourceSystemIdentifierGroup(
                 group, groupNumber++, safeRepository);
         }
     }
 }
示例#17
0
 public MappingRepository(
     IContext context,
     IOperationExecutive operationExecutive,
     IMappingDataRepository mappingDataRepository,
     ISafeRepository safeRepository,
     IHashingSerializer <TEntity> hashingSerializer,
     IEventDispatcher <TEntity> eventDispatcher,
     IInitializer initializer)
 {
     this.context               = context;
     this.operationExecutive    = operationExecutive;
     this.mappingDataRepository = mappingDataRepository;
     this.safeRepository        = safeRepository;
     this.hashingSerializer     = hashingSerializer;
     initializer.Register(
         this.mappingDataRepository.CreateInitializer(eventDispatcher),
         suppressEvents: true);
 }
示例#18
0
 public DatabaseLogger(
     IContext context,
     IOperationExecutive operationExecutive,
     IServiceProvider <TEntity> serviceProvider,
     IMappingDataRepository mappingDataRepository,
     IHashingSerializer <TEntity> hashingSerializer,
     IHashFunction hashFunction,
     ILoggingConfigurationProvider loggingConfigurationProvider,
     ISafeRepository safeRepository)
 {
     this.context                      = context;
     this.operationExecutive           = operationExecutive;
     this.serviceProvider              = serviceProvider;
     this.mappingDataRepository        = mappingDataRepository;
     this.hashingSerializer            = hashingSerializer;
     this.hashFunction                 = hashFunction;
     this.loggingConfigurationProvider = loggingConfigurationProvider;
     this.safeRepository               = safeRepository;
 }
示例#19
0
 private void CreateOrUpdateAssets(
     IBootstrapper bootstrapper, DeploymentContext context)
 {
     using (ISafeRepository safeRepository = bootstrapper.Get <ISafeRepository>())
     {
         using (var scope = new TransactionScope())
         {
             this.CreateOrUpdateExternalSystems(
                 context.ExternalSystems, safeRepository);
             this.CreateOrUpdateEntityTypes(
                 context.EntityTypes, safeRepository);
             this.CreateSharedSourceSystemIdentifierGroups(
                 context.SharedSourceSystemIdentifierGroups, safeRepository);
             this.CreateOrUpdateFeeds(
                 context.Feeds, safeRepository);
             this.CreateOrUpdateParameters(context, safeRepository);
             scope.Complete();
         }
     }
 }
示例#20
0
 public GarbageCollectionSegmentRunner(
     IContext context,
     IParameterProvider parameterProvider,
     IOperationExecutive operationExecutive,
     IGateway <TEntity> gateway,
     ISafeRepository safeRepository,
     IEventDispatcher <TEntity> eventDispatcher,
     IInitializer initializer)
 {
     this.context               = context;
     this.parameterProvider     = parameterProvider;
     this.operationExecutive    = operationExecutive;
     this.gateway               = gateway;
     this.safeRepository        = safeRepository;
     this.eventDispatcher       = eventDispatcher;
     this.idsOfEntitiesToDelete = null;
     initializer.Register(
         new Initializer(this),
         suppressEvents: true);
 }
示例#21
0
 private void RunSegment(
     int segmentIndex,
     int segmentCount,
     SegmentConfiguration segmentConfiguration)
 {
     using (IBootstrapper bootstrapper =
                this.bootstrapperFactory.CreateBootstrapper())
     {
         using (ISafeRepository safeRepository =
                    bootstrapper.Get <ISafeRepository>())
         {
             this.RunSegment(
                 segmentIndex,
                 segmentCount,
                 segmentConfiguration,
                 bootstrapper,
                 safeRepository);
         }
     }
 }
示例#22
0
        private IContext SetupContext(
            SegmentConfiguration segmentConfiguration,
            int segmentIndex,
            int segmentCount,
            IBootstrapper bootstrapper,
            ISafeRepository safeRepository)
        {
            IContext context =
                this
                .GetContextFactory(safeRepository)
                .CreateContext(
                    bootstrapper,
                    segmentConfiguration,
                    segmentIndex,
                    segmentCount,
                    this.runData);
            IWritableContext writableContext = bootstrapper.Get <IWritableContext>();

            writableContext.SetContext(context);
            return(context);
        }
示例#23
0
        private void CreateOrUpdateParameters(
            DeploymentContext context, ISafeRepository safeRepository)
        {
            IEnumerable <ParameterScope>
            parameterScopes = this.GetParameterScopes(context);
            IDictionary <ParameterScope, Dictionary <string, IParameter> >
            existingParametersByScope =
                this.GetExistingParametersByScope(safeRepository);

            foreach (ParameterScope scope in parameterScopes)
            {
                IDictionary <string, IParameter> existingParameters =
                    this.GetExistingParameters(existingParametersByScope, scope);
                IDictionary <string, string>
                parameters = this.GetParameters(context, scope);
                this.ProcessParameters(
                    scope,
                    parameters,
                    existingParameters,
                    safeRepository);
                this.DeleteOrphanParameters(existingParameters.Values, safeRepository);
            }
        }
示例#24
0
 public MenuService(ISafeRepository <MenuItemEntity> menuItemRepo)
 {
     _menuItemRepo = menuItemRepo;
 }
示例#25
0
 protected DataManager(ISafeRepository <TEntity> safeRepository, IUnsafeRepository <TEntity> unsafeRepository, IMapper mapper)
 {
     this.SafeRepository   = safeRepository;
     this.UnsafeRepository = unsafeRepository;
     this.Mapper           = mapper;
 }
示例#26
0
 public TestService(ISafeRepository <FeatureEntity> repo)
 {
 }
示例#27
0
 public PositionService(ILogger <PositionService> logger, ISafeRepository <PositionDTO> positionRepository, IConverter <PositionDTO, PositionBLO> positionConverter)
 {
     this.logger             = logger;
     this.positionRepository = positionRepository;
     this.positionConverter  = positionConverter;
 }
示例#28
0
 public GenericRecordImporter(ISafeRepository <TEntity> repository)
 {
     _repository = repository;
 }
示例#29
0
 public OperationExecutive(IContext context, ISafeRepository safeRepository)
 {
     this.context          = context;
     this.safeRepository   = safeRepository;
     this.currentOperation = null;
 }
示例#30
0
 public ParametersAssembler(ISafeRepository safeRepository)
 {
     this.safeRepository = safeRepository;
 }