private void InstantiateAllAttachmentManipulators(TisServicesHost servicesHost) { m_allAttachmentManipulators = new Dictionary <string, IAttachmentManipulator>(); string[] attachmentManipulatorsServiceNames = TisServicesUtil.GetServicesOfImplType( servicesHost.GetServiceRegistry(TisServicesConst.SystemApplication), typeof(IAttachmentManipulator)); IAttachmentManipulator attachmentManipulator; foreach (string attachmentManipulatorServiceName in attachmentManipulatorsServiceNames) { try { attachmentManipulator = (IAttachmentManipulator)servicesHost.GetService(TisServicesConst.SystemApplication, attachmentManipulatorServiceName); } catch { attachmentManipulator = null; } if (attachmentManipulator != null) { attachmentManipulator.SupportedAttachmentTypes.ForEach(supportedAttachmentType => m_allAttachmentManipulators.Add(supportedAttachmentType, attachmentManipulator)); Log.WriteInfo("Attachment manipulator service [{0}] is activated.", attachmentManipulatorServiceName); } else { Log.WriteWarning("Attachment manipulator service [{0}] is not installed.", attachmentManipulatorServiceName); } } }
private void ObtainAllValidationContexts() { List <ITisValidationContext> typedValidationContexts; List <Type> validationTypes; lock (m_locker) { m_allValidationContexts.Clear(); string[] validationContextServiceNames = TisServicesUtil.GetServicesOfImplType( m_serviceRegistry, typeof(ITisValidationContext)); ITisValidationContext validationContext; foreach (string validationContextServiceName in validationContextServiceNames) { try { validationContext = (ITisValidationContext)m_servicesHost.GetService(m_applicationName, validationContextServiceName); } catch { validationContext = null; } if (validationContext != null) { validationTypes = ObtainValidationTypes(validationContext); foreach (Type validationType in validationTypes) { if (validationType != null) { if (!m_allValidationContexts.ContainsKey(validationType)) { m_allValidationContexts.Add(validationType, new List <ITisValidationContext>()); } typedValidationContexts = m_allValidationContexts[validationType]; typedValidationContexts.Add(validationContext); } else { Log.WriteWarning("Installed validation context service [{0}] does not provide validation target type", validationContextServiceName); } } } else { Log.WriteWarning("Validation service [{0}] is not installed", validationContextServiceName); } } } }
private void ObtainAllValidators() { string[] validationServiceProviderNames = TisServicesUtil.GetServicesOfImplType( m_serviceRegistry, typeof(ITisSupportValidation)); foreach (string validationServiceProviderName in validationServiceProviderNames) { TisValidator validator = (TisValidator)GetService(TisServicesSchema.Validator, validationServiceProviderName); if (validator != null) { Type validationType = validator.ValidationType; if (validationType != null) { TisValidator parentValidator = null; m_allApplicationValidators.TryGetValue(validationType, out parentValidator); if (parentValidator != null) { parentValidator.AddValidator(validator); } else { m_allApplicationValidators.Add(validationType, validator); } } else { Log.WriteWarning("Installed validation service [{0}] does not provide validation target type", validationServiceProviderName); } } else { Log.WriteWarning("Validation service [{0}] is not installed", validationServiceProviderName); } } foreach (TisValidator validator in m_allApplicationValidators.Values) { try { ((TisValidator)validator).Sort(); } catch (Exception exc) { Log.WriteException(Log.Severity.INFO, exc); } } }