コード例 #1
0
        public new void Start()
        {
            ConnectorEvent startEvent = null;

            try
            {
                _config = new Configuration(Id);
                ConnectorEventHelper.CleanupOngoingEvents(_config);
                startEvent = ConnectorEventHelper.InitiateEvent(_config, ConnectorEventType.Start, "Connector is starting", 0);

                Entity channel = RemoteManager.DataService.GetEntity(_config.ChannelId, LoadLevel.Shallow);
                if (channel == null || channel.EntityType.Id != "Channel")
                {
                    _started = false;
                    ConnectorEventHelper.UpdateEvent(startEvent, "Channel id is not valid: Entity with given ID is not a channel, or doesn't exist. Unable to start", -1, true);
                    return;
                }

                _pimFieldAdapter      = new PimFieldAdapter(_config);
                _epiMappingHelper     = new EpiMappingHelper(_config, _pimFieldAdapter);
                _entityService        = new EntityService(_config, _epiMappingHelper);
                _catalogCodeGenerator = new CatalogCodeGenerator(_config, _entityService);
                _epiApi = new EpiApi(_config, _catalogCodeGenerator, _pimFieldAdapter);
                _catalogElementFactory  = new CatalogElementFactory(_config, _epiMappingHelper, _catalogCodeGenerator, _pimFieldAdapter);
                _channelHelper          = new ChannelHelper(_config, _entityService);
                _catalogDocumentFactory = new CatalogDocumentFactory(_config, _epiApi, _catalogElementFactory, _epiMappingHelper, _channelHelper, _catalogCodeGenerator, _entityService);
                _resourceElementFactory = new ResourceElementFactory(_catalogElementFactory, _epiMappingHelper, _catalogCodeGenerator, _config, _entityService);

                _documentFileHelper = new DocumentFileHelper(_config, _channelHelper);
                _cvlUpdater         = new CvlUpdater(_config, _catalogDocumentFactory, _epiApi, _documentFileHelper);

                _publisher = new ChannelPublisher(_config,
                                                  _catalogDocumentFactory,
                                                  _catalogElementFactory,
                                                  _resourceElementFactory,
                                                  _epiApi,
                                                  _epiMappingHelper,
                                                  _documentFileHelper,
                                                  _pimFieldAdapter,
                                                  _entityService,
                                                  _catalogCodeGenerator);

                AppDomain.CurrentDomain.AssemblyResolve += CurrentDomainAssemblyResolve;

                InitConnector();

                base.Start();
                _started = true;
                ConnectorEventHelper.UpdateEvent(startEvent, "Connector has started", 100);
            }
            catch (Exception ex)
            {
                IntegrationLogger.Write(LogLevel.Error, "Error while starting connector", ex);
                ConnectorEventHelper.UpdateEvent(startEvent, "Issue while starting connector, see log.", 100, true);
                throw;
            }
        }
コード例 #2
0
        public new void Stop()
        {
            base.Stop();
            var connectorEvent = ConnectorEventHelper.InitiateEvent(_config, ConnectorEventType.Stop, "Connector is stopping", 0);

            _started = false;
            _epiApi  = null;
            _catalogElementFactory  = null;
            _catalogDocumentFactory = null;
            _channelHelper          = null;
            _resourceElementFactory = null;
            _epiMappingHelper       = null;
            _catalogCodeGenerator   = null;
            _publisher          = null;
            _config             = null;
            _documentFileHelper = null;
            _entityService      = null;
            _cvlUpdater         = null;

            ConnectorEventHelper.UpdateEvent(connectorEvent, "Connector has stopped.", 100);
        }
コード例 #3
0
 public ChannelPublisher(IConfiguration config,
                         CatalogDocumentFactory catalogDocumentFactory,
                         CatalogElementFactory catalogElementFactory,
                         ResourceElementFactory resourceElementFactory,
                         EpiApi epiApi,
                         EpiMappingHelper mappingHelper,
                         DocumentFileHelper documentFileHelper,
                         PimFieldAdapter pimFieldAdapter,
                         IEntityService entityService,
                         CatalogCodeGenerator catalogCodeGenerator)
 {
     _config = config;
     _catalogDocumentFactory = catalogDocumentFactory;
     _catalogElementFactory  = catalogElementFactory;
     _resourceElementFactory = resourceElementFactory;
     _epiApi               = epiApi;
     _mappingHelper        = mappingHelper;
     _documentFileHelper   = documentFileHelper;
     _pimFieldAdapter      = pimFieldAdapter;
     _entityService        = entityService;
     _catalogCodeGenerator = catalogCodeGenerator;
 }