public static void Process(string SearchName)
        {
            /* determin which dataacquirer and which dataindexer to be instantiated with "Arg" argument */
            SearchElement search = Config.Searches[SearchName];

            Type AcquirerType = Type.GetType(search.DataAcquirer);
            Type IndexerType = Type.GetType(search.DataIndexer);

            dataAcquirer = (IDataAcquirer)Activator.CreateInstance(AcquirerType, new object[] { search });
            dataIndexer = (IDataIndexer)Activator.CreateInstance(IndexerType, new object[] { search });
            /* end */

            List<ISearchEntity> data = dataAcquirer.GetData();

            List<ISearchEntity> CreateEntities = new List<ISearchEntity>();
            List<ISearchEntity> DeleteEntities = new List<ISearchEntity>();

            foreach (ISearchEntity entity in data)
            {
                if (entity.ProcessType == EntityProcessType.insert)
                    AddCreateIndex(CreateEntities, entity);
                else if (entity.ProcessType == EntityProcessType.update)
                    AddCreateIndex(CreateEntities, entity);
                else if (entity.ProcessType == EntityProcessType.delete)
                    DeleteEntities.Add(entity);
                else
                    continue;
            }

            dataIndexer.CreateIndex(CreateEntities);
            dataIndexer.DeleteIndex(DeleteEntities);

            Console.Read();
        }
Exemplo n.º 2
0
 public JobManager(
     IDataAcquirerJobStorage dataAcquirerJobStorage,
     IDataAcquirer acquirer,
     ITranslationService translationService,
     IMessageBrokerProducer producer,
     IEventTracker <JobManager> logger)
 {
     _dataAcquirerJobStorage = dataAcquirerJobStorage;
     //   _jobMetadataStorage = jobMetadataStorage;
     _acquirer           = acquirer;
     _translationService = translationService;
     _producer           = producer;
     _logger             = logger;
 }
        public static void Process(string SearchName)
        {
            /* determin which dataacquirer and which dataindexer to be instantiated with "Arg" argument */
            SearchElement search = Config.Searches[SearchName];

            Type AcquirerType = Type.GetType(search.DataAcquirer);
            Type IndexerType  = Type.GetType(search.DataIndexer);


            dataAcquirer = (IDataAcquirer)Activator.CreateInstance(AcquirerType, new object[] { search });
            dataIndexer  = (IDataIndexer)Activator.CreateInstance(IndexerType, new object[] { search });
            /* end */

            List <ISearchEntity> data = dataAcquirer.GetData();

            List <ISearchEntity> CreateEntities = new List <ISearchEntity>();
            List <ISearchEntity> DeleteEntities = new List <ISearchEntity>();

            foreach (ISearchEntity entity in data)
            {
                if (entity.ProcessType == EntityProcessType.insert)
                {
                    AddCreateIndex(CreateEntities, entity);
                }
                else if (entity.ProcessType == EntityProcessType.update)
                {
                    AddCreateIndex(CreateEntities, entity);
                }
                else if (entity.ProcessType == EntityProcessType.delete)
                {
                    DeleteEntities.Add(entity);
                }
                else
                {
                    continue;
                }
            }

            dataIndexer.CreateIndex(CreateEntities);
            dataIndexer.DeleteIndex(DeleteEntities);

            Console.Read();
        }
Exemplo n.º 4
0
 public CustomStaticDataApp(
     IDataAcquirer dataAcquirer)
 {
     _dataAcquirer = dataAcquirer;
 }