예제 #1
0
        public void EventStatusChanged(CatalogueElements elementType, string fullName)
        {
            const string method = "EventStatusChanged";

            try
            {
                switch (elementType)
                {
                case CatalogueElements.Namespace:
                    InstrumentationManager.UpdateNamespace(fullName);
                    break;

                case CatalogueElements.Source:
                    InstrumentationManager.UpdateSource(fullName);
                    break;

                default:
                    Debug.Fail("Unexpected value of elementType: " + elementType);
                    break;
                }
            }
            catch (System.Exception ex)
            {
                if (_errorCount < Constants.Errors.MaximumErrorsToLog)
                {
                    _errorCount++;
                    HandleException(method, string.Format(
                                        "Failed to process an EventStatusChanged notification for {0} '{1}':{2}{3}",
                                        elementType, fullName, System.Environment.NewLine, ex));
                }
            }
        }
예제 #2
0
        private void HandleException(string method, string message)
        {
            if (_errorCount >= Constants.Errors.MaximumErrorsToLog)
            {
                message += System.Environment.NewLine + System.Environment.NewLine
                           + "No further repository notification errors will be logged.";
            }

            InstrumentationManager.GetInternalMessageHandler().HandleEventMessage(
                new EventMessage(null, Event.Warning, GetType(), method, message));
        }
예제 #3
0
        public void SourceCreated(string fullyQualifiedReference)
        {
            const string method = "SourceCreated";

            try
            {
                InstrumentationManager.SourceCreated(fullyQualifiedReference);
            }
            catch (System.Exception ex)
            {
                if (_errorCount < Constants.Errors.MaximumErrorsToLog)
                {
                    _errorCount++;
                    HandleException(method, string.Format(
                                        "Failed to process a SourceCreated notification for source '{0}':{1}{2}",
                                        fullyQualifiedReference, System.Environment.NewLine, ex));
                }
            }
        }
예제 #4
0
        public void EventChanged(string eventName, bool isEnabled)
        {
            const string method = "EventChanged";

            try
            {
                InstrumentationManager.UpdateEvent(eventName, isEnabled);
            }
            catch (System.Exception ex)
            {
                if (_errorCount < Constants.Errors.MaximumErrorsToLog)
                {
                    _errorCount++;
                    HandleException(method, string.Format(
                                        "Failed to process an EventChanged notification for event '{0}':{1}{2}",
                                        eventName, System.Environment.NewLine, ex));
                }
            }
        }
예제 #5
0
 protected static EventInfo GetEventInfo(string name)
 {
     return(InstrumentationManager.GetEventInfo(name));
 }
예제 #6
0
 protected InstrumentationSource(System.Type type)
 {
     _state = InstrumentationManager.GetSourceState(type);
 }