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; } }
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); }