/// <summary> /// Build and return a pipeline that can perform device detection. /// </summary> /// <returns></returns> public override IPipeline Build() { IAspectEngine deviceDetectionEngine = null; // Create the device detection engine based on the configuration. switch (_algorithm) { case DeviceDetectionAlgorithm.Hash: var hashBuilder = new DeviceDetectionHashEngineBuilder(LoggerFactory, _dataUpdateService); deviceDetectionEngine = ConfigureAndBuild(hashBuilder); break; default: throw new PipelineConfigurationException( $"Unrecognized algorithm '{_algorithm}'."); } if (deviceDetectionEngine != null) { // Add the share usage element to the list if enabled if (_shareUsageEnabled) { FlowElements.Add(new ShareUsageBuilder(LoggerFactory, _httpClient).Build()); } // Add the device detection engine to the list FlowElements.Add(deviceDetectionEngine); } else { throw new PipelineException(Messages.ExceptionErrorOnStartup); } // Create and return the pipeline return(base.Build()); }
/// <summary> /// Construct a new instance of the wrapper. /// </summary> /// <param name="logger"> /// The logger instance to use. /// </param> /// <param name="pipeline"> /// The Pipeline that created this data instance. /// </param> /// <param name="engine"> /// The engine that create this data instance. /// </param> /// <param name="missingPropertyService"> /// The <see cref="IMissingPropertyService"/> to use if a requested /// property does not exist. /// </param> public DeviceDataCloud(ILogger <AspectDataBase> logger, IPipeline pipeline, IAspectEngine engine, IMissingPropertyService missingPropertyService) : base(logger, pipeline, engine, missingPropertyService) { }
/// <summary> /// Constructor /// </summary> /// <param name="logger"> /// Used for logging /// </param> /// <param name="pipeline"> /// The <see cref="IPipeline"/> instance this element data will /// be associated with. /// </param> /// <param name="engine"> /// The <see cref="IAspectEngine"/> that created this instance /// </param> public AspectDataBase( ILogger <AspectDataBase> logger, IPipeline pipeline, IAspectEngine engine) : this(logger, pipeline, engine, null) { }
/// <summary> /// Constructor /// </summary> /// <param name="logger"> /// Used for logging. /// </param> /// <param name="pipeline"> /// The <see cref="IPipeline"/> this instance will be attached to. /// </param> /// <param name="engine"> /// The <see cref="IAspectEngine"/> that created this instance. /// </param> public PrimeCheckerData( ILogger <AspectDataBase> logger, IPipeline pipeline, IAspectEngine engine) : base(logger, pipeline, engine) { }
/// <summary> /// Constructor /// </summary> /// <param name="element"></param> /// <param name="name"></param> /// <param name="type"></param> /// <param name="category"></param> /// <param name="dataTiersWherePresent"></param> /// <param name="available"></param> /// <param name="component"></param> /// <param name="defaultValue"></param> /// <param name="values"></param> /// <param name="description"></param> public FiftyOneAspectPropertyMetaDataHash( IAspectEngine element, string name, Type type, string category, IList <string> dataTiersWherePresent, bool available, ComponentMetaDataDefault component, ValueMetaDataDefault defaultValue, IEnumerable <ValueMetaDataDefault> values, string description) : this(element, name, type, category, dataTiersWherePresent, available, component, defaultValue, values, description, 255, false, false, false, true, true, string.Empty) { }
internal void AddEngine(IAspectEngine engine) { lock (Engines) { _engines.Add(engine); } }
/// <summary> /// Constructor /// </summary> /// <param name="logger"> /// Used for logging. /// </param> /// <param name="pipeline"> /// The <see cref="IPipeline"/> this instance will be attached to. /// </param> /// <param name="engine"> /// The <see cref="IAspectEngine"/> that created this instance. /// </param> /// <param name="missingPropertyService"> /// The <see cref="IMissingPropertyService"/> to use when a requested /// key cannot be found. /// </param> public PrimeCheckerData( ILogger <AspectDataBase> logger, IPipeline pipeline, IAspectEngine engine, IMissingPropertyService missingPropertyService) : base(logger, pipeline, engine, missingPropertyService) { }
/// <summary> /// Constructor /// </summary> /// <param name="logger"> /// The logger instance to use. /// </param> /// <param name="pipeline"> /// The Pipeline that created this data instance. /// </param> /// <param name="engine"> /// The engine that create this data instance. /// </param> public MultiDeviceDataCloud( ILogger <AspectDataBase> logger, IPipeline pipeline, IAspectEngine engine) : base(logger, pipeline, engine) { Initialize(); }
public EmptyEngineData( ILogger <EmptyEngineData> logger, IPipeline pipeline, IAspectEngine engine, IMissingPropertyService missingPropertyService) : base(logger, pipeline, engine, missingPropertyService) { }
/// <summary> /// Constructor /// </summary> /// <param name="logger"> /// The logger for this instance to use. /// </param> /// <param name="pipeline"> /// The Pipeline this data instance has been created by. /// </param> /// <param name="engine"> /// The engine this data instance has been created by. /// </param> /// <param name="missingPropertyService"> /// The missing property service to use when a requested property /// does not exist. /// </param> protected DeviceDataBaseOnPremise( ILogger <AspectDataBase> logger, IPipeline pipeline, IAspectEngine engine, IMissingPropertyService missingPropertyService) : base(logger, pipeline, engine, missingPropertyService) { }
/// <summary> /// Constructor /// </summary> /// <param name="logger"> /// Used for logging. /// </param> /// <param name="pipeline"> /// The <see cref="IPipeline"/> this instance will be attached to. /// </param> /// <param name="engine"> /// The <see cref="IAspectEngine"/> that created this instance. /// </param> /// <param name="missingPropertyService"> /// The <see cref="IMissingPropertyService"/> to use when a requested /// key cannot be found. /// </param> /// <param name="dictionary"> /// The dictionary instance to use internally when storing data values. /// </param> public PrimeCheckerData( ILogger <AspectDataBase> logger, IPipeline pipeline, IAspectEngine engine, IMissingPropertyService missingPropertyService, IDictionary <string, object> dictionary) : base(logger, pipeline, engine, missingPropertyService, dictionary) { }
public ColorColumn(NlmTreeListView listView) { Text = "Color"; Width = 40; TextAlign = HorizontalAlignment.Center; AspectEngine = new ColorAspectEngine(listView, this); Renderer = new ColorRenderer(); }
internal TestResults( ILogger <AspectDataBase> logger, IPipeline pipeline, IAspectEngine engine, IMissingPropertyService missingPropertyService, object value) : base(logger, pipeline, engine, missingPropertyService) { _value = value; // The ResultManager needs to have something added to it // in order to allow access to the values. // For this test, we can just give it a null reference. Results.AddResult(null); }
/// <summary> /// Constructor /// </summary> /// <param name="logger"> /// Used for logging /// </param> /// <param name="pipeline"> /// The <see cref="IPipeline"/> instance this element data will /// be associated with. /// </param> /// <param name="engine"> /// The <see cref="IAspectEngine"/> that created this instance /// </param> /// <param name="missingPropertyService"> /// The <see cref="IMissingPropertyService"/> to use when a requested /// key cannot be found. /// </param> public AspectDataBase( ILogger <AspectDataBase> logger, IPipeline pipeline, IAspectEngine engine, IMissingPropertyService missingPropertyService) : base(logger, pipeline) { Logger = logger; _engines = new List <IAspectEngine>() { engine }; MissingPropertyService = missingPropertyService; }
/// <summary> /// Constructor /// </summary> /// <param name="element"> /// The <see cref="IAspectEngine"/> that this property is associated /// with. /// </param> /// <param name="name"> /// The name of the property. Must match the string key used to /// store the property value in the <see cref="IAspectData"/> instance. /// </param> /// <param name="type"> /// The type of the property values. /// </param> /// <param name="category"> /// The category the property belongs to. /// </param> /// <param name="dataTiersWherePresent"> /// A list of the data tiers that can be used to determine values /// for this property. /// </param> /// <param name="available"> /// True if the property is available in the results for the /// associated <see cref="IAspectEngine"/>, false otherwise. /// </param> /// <param name="description"> /// Full description of the property. /// </param> /// <param name="itemProperties"> /// The meta-data for properties that are stored in sub-items. /// Only relevant if this meta-data instance relates to a /// collection of complex objects. /// </param> public AspectPropertyMetaData( IAspectEngine element, string name, Type type, string category, IList <string> dataTiersWherePresent, bool available, string description = "", IReadOnlyList <IElementPropertyMetaData> itemProperties = null) : base(element, name, type, available, category, itemProperties) { DataTiersWherePresent = dataTiersWherePresent; Description = description; }
/// <summary> /// Constructor /// </summary> /// <param name="logger"> /// Used for logging /// </param> /// <param name="pipeline"> /// The <see cref="IPipeline"/> instance this element data will /// be associated with. /// </param> /// <param name="engine"> /// The <see cref="IAspectEngine"/> that created this instance /// </param> /// <param name="missingPropertyService"> /// The <see cref="IMissingPropertyService"/> to use when a requested /// key cannot be found. /// </param> /// <param name="dictionary"> /// The dictionary instance to use internally when storing data values. /// </param> public AspectDataBase( ILogger <AspectDataBase> logger, IPipeline pipeline, IAspectEngine engine, IMissingPropertyService missingPropertyService, IDictionary <string, object> dictionary) : base(logger, pipeline, dictionary) { Logger = logger; _engines = new List <IAspectEngine>() { engine }; MissingPropertyService = missingPropertyService; }
public CurrentColumn(NlmTreeListView listView) { Text = "Current"; Width = 40; TriStateCheckBoxes = true; TextAlign = HorizontalAlignment.Center; AspectEngine = new CurrentAspectEngine(this, listView); Renderer = new MappedImageRenderer(new Object[] { true, new Bitmap(GetType().Module.Assembly.GetManifestResourceStream("NestedLayerManager.Resources.Icons.CheckState.CurrentChecked.png")), false, null, null, new Bitmap(GetType().Module.Assembly.GetManifestResourceStream("NestedLayerManager.Resources.Icons.CheckState.CurrentIndeterminate.png")), }); }
public FiftyOneAspectPropertyMetaDataDefault( IAspectEngine element, string name, Type type, string category, IList <string> dataTiersWherePresent, bool available, ComponentMetaDataDefault component, ValueMetaDataDefault defaultValue, IEnumerable <ValueMetaDataDefault> values, string description, byte displayOrder, bool list, bool mandatory, bool obsolete, bool show, bool showValues, string url) : base(element, name, type, category, dataTiersWherePresent, available, description) { if (component == null) { throw new ArgumentNullException(nameof(component)); } if (defaultValue == null) { throw new ArgumentNullException(nameof(defaultValue)); } _component = component; _defaultValue = defaultValue; DisplayOrder = displayOrder; List = list; Mandatory = mandatory; Obsolete = obsolete; Show = show; ShowValues = showValues; Url = url; // Add this property to the configured component. _component.AddProperty(this); // Set the property of the default value to this. _defaultValue.SetProperty(this); _values = values.Select(v => { v.SetProperty(this); return((IValueMetaData)v); }).ToList(); }
public VisibleColumn(NlmTreeListView listView) { Text = "Visible"; Width = 40; TriStateCheckBoxes = true; TextAlign = HorizontalAlignment.Center; AspectEngine = new VisibleAspectEngine(listView, this); Bitmap visibleCheckedBitmap = new Bitmap(GetType().Module.Assembly.GetManifestResourceStream("NestedLayerManager.Resources.Icons.CheckState.VisibleChecked.png")); Bitmap visibleUncheckedBitmap = new Bitmap(GetType().Module.Assembly.GetManifestResourceStream("NestedLayerManager.Resources.Icons.CheckState.VisibleUnchecked.png")); Bitmap visibleIndeterminateBitmap = new Bitmap(GetType().Module.Assembly.GetManifestResourceStream("NestedLayerManager.Resources.Icons.CheckState.VisibleIndeterminate.png")); Renderer = new MappedActiveImageRenderer( visibleCheckedBitmap, visibleUncheckedBitmap, visibleIndeterminateBitmap ); }
public RenderColumn(NlmTreeListView listView) { Text = "Render"; Width = 40; TriStateCheckBoxes = true; TextAlign = System.Windows.Forms.HorizontalAlignment.Center; AspectEngine = new RenderAspectEngine(listView, this); Bitmap renderCheckedBitmap = new Bitmap(GetType().Module.Assembly.GetManifestResourceStream("NestedLayerManager.Resources.Icons.CheckState.RenderChecked.png")); Bitmap renderUncheckedBitmap = new Bitmap(GetType().Module.Assembly.GetManifestResourceStream("NestedLayerManager.Resources.Icons.CheckState.Unchecked.png")); Bitmap renderIndeterminateBitmap = new Bitmap(GetType().Module.Assembly.GetManifestResourceStream("NestedLayerManager.Resources.Icons.CheckState.RenderIndeterminate.png")); Renderer = new MappedActiveImageRenderer( renderCheckedBitmap, renderUncheckedBitmap, renderIndeterminateBitmap ); }
public FiftyOneAspectPropertyMetaDataHash( IAspectEngine element, string name, Type type, string category, IList <string> dataTiersWherePresent, bool available, ComponentMetaDataDefault component, ValueMetaDataDefault defaultValue, IEnumerable <ValueMetaDataDefault> values, string description, byte displayOrder, bool list, bool mandatory, bool obsolete, bool show, bool showValues, string url) : base(element, name, type, category, dataTiersWherePresent, available, component, defaultValue, values, description, displayOrder, list, mandatory, obsolete, show, showValues, url) { }
public void Initialise() { var loggerFactory = new TestLoggerFactory(); var builder = new PipelineBuilder(loggerFactory); var httpClient = new HttpClient(); var dataUpdateService = new DataUpdateService( loggerFactory.CreateLogger <DataUpdateService>(), httpClient); _engine = new EmptyEngineBuilder(loggerFactory) .Build(); var shareUsage = new ShareUsageBuilder(loggerFactory, httpClient) .Build(); _pipeline = builder .AddFlowElement(_engine) .AddFlowElement(shareUsage) .Build(); }
public NameColumn(NlmTreeListView listView) { Text = "Name"; IsEditable = true; Searchable = true; FillsFreeSpace = true; ImageGetter = delegate(Object rowObject) { LayerTreeNode layerTreeNode = rowObject as LayerTreeNode; if (layerTreeNode != null) { if (layerTreeNode.IsInstanced) { return("LayerInstance"); } else { return("Layer"); } } ObjectTreeNode objectTreeNode = rowObject as ObjectTreeNode; if (objectTreeNode != null) { return(objectTreeNode.Class.ToString()); } if (rowObject is FolderTreeNode) { return("Folder"); } return(null); }; AspectEngine = new NameAspectEngine(listView, this); Renderer = new NlmTreeColumnRenderer(); }
/// <summary> /// Constructor /// </summary> /// <param name="logger"> /// The logger for this instance /// </param> /// <param name="pipeline"> /// The pipeline this instance was created by. /// </param> /// <param name="engine"> /// The engine that created this instance. /// </param> public CloudRequestData( ILogger <AspectDataBase> logger, IPipeline pipeline, IAspectEngine engine) : base(logger, pipeline, engine) { }
/// <summary> /// Get the reason that a property is not available from an engine. /// </summary> /// <param name="propertyName"> /// The name of the property to look for /// </param> /// <param name="engine"> /// The engine that is expected to supply the property value. /// </param> /// <returns> /// A <see cref="MissingPropertyResult"/> instance that includes an /// enum giving the reason and a developer-facing description of /// the reason. /// </returns> public MissingPropertyResult GetMissingPropertyReason(string propertyName, IAspectEngine engine) { if (engine == null) { throw new ArgumentNullException(nameof(engine)); } MissingPropertyResult result = new MissingPropertyResult(); MissingPropertyReason reason = MissingPropertyReason.Unknown; IAspectPropertyMetaData property = null; property = engine.Properties.FirstOrDefault(p => p.Name == propertyName); if (property != null) { // Check if the property is available in the data file that is // being used by the engine. if (property.DataTiersWherePresent.Any(t => t == engine.DataSourceTier) == false) { reason = MissingPropertyReason.DataFileUpgradeRequired; } // Check if the property is excluded from the results. else if (property.Available == false) { reason = MissingPropertyReason.PropertyExculdedFromEngineConfiguration; } } if (reason == MissingPropertyReason.Unknown && typeof(ICloudAspectEngine).IsAssignableFrom(engine.GetType())) { reason = MissingPropertyReason.CloudEngine; } // Build the message string to return to the caller. StringBuilder message = new StringBuilder(); message.AppendLine($"Property '{propertyName}' is not present in the results."); switch (reason) { case MissingPropertyReason.DataFileUpgradeRequired: message.Append("This is because your license and/or data file " + "does not include this property. The property is available "); message.Append("with the "); message.Append(string.Join(",", property.DataTiersWherePresent)); message.Append($" license/data for the {engine.GetType().Name}"); break; case MissingPropertyReason.PropertyExculdedFromEngineConfiguration: message.Append("This is because the property has been " + "excluded when configuring the engine."); break; case MissingPropertyReason.CloudEngine: message.Append("This may be because your resource key " + "does not include this property. " + "Check the property name is correct. Compare this " + "to the properties available using the supplied " + "resource key: "); message.Append(string.Join(",", engine.Properties.Select(p => p.Name))); break; case MissingPropertyReason.Unknown: message.Append("The reason for this is unknown. Please " + "check that the aspect and property name are correct."); break; default: break; } result.Description = message.ToString(); result.Reason = reason; return(result); }
/// <summary> /// Get the reason that a property is not available from an engine. /// </summary> /// <param name="propertyName"> /// The name of the property to look for /// </param> /// <param name="engine"> /// The engine that is expected to supply the property value. /// </param> /// <returns> /// A <see cref="MissingPropertyResult"/> instance that includes an /// enum giving the reason and a developer-facing description of /// the reason. /// </returns> public MissingPropertyResult GetMissingPropertyReason(string propertyName, IAspectEngine engine) { if (engine == null) { throw new ArgumentNullException(nameof(engine)); } MissingPropertyResult result = new MissingPropertyResult(); MissingPropertyReason reason = MissingPropertyReason.Unknown; IAspectPropertyMetaData property = null; property = engine.Properties.FirstOrDefault(p => p.Name == propertyName); if (property != null) { // Check if the property is available in the data file that is // being used by the engine. if (property.DataTiersWherePresent.Any(t => t == engine.DataSourceTier) == false) { reason = MissingPropertyReason.DataFileUpgradeRequired; } // Check if the property is excluded from the results. else if (property.Available == false) { reason = MissingPropertyReason.PropertyExcludedFromEngineConfiguration; } } if (reason == MissingPropertyReason.Unknown && typeof(ICloudAspectEngine).IsAssignableFrom(engine.GetType())) { if (engine.Properties.Count == 0) { reason = MissingPropertyReason.ProductNotAccessibleWithResourceKey; } else { reason = MissingPropertyReason.PropertyNotAccessibleWithResourceKey; } } // Build the message string to return to the caller. StringBuilder message = new StringBuilder(); message.Append( string.Format(CultureInfo.InvariantCulture, Messages.MissingPropertyMessagePrefix, propertyName, engine.ElementDataKey)); switch (reason) { case MissingPropertyReason.DataFileUpgradeRequired: message.Append( string.Format(CultureInfo.InvariantCulture, Messages.MissingPropertyMessageDataUpgradeRequired, string.Join(",", property.DataTiersWherePresent), engine.GetType().Name)); break; case MissingPropertyReason.PropertyExcludedFromEngineConfiguration: message.Append(Messages.MissingPropertyMessagePropertyExcluded); break; case MissingPropertyReason.ProductNotAccessibleWithResourceKey: message.Append( string.Format(CultureInfo.InvariantCulture, Messages.MissingPropertyMessageProductNotInCloudResource, engine.ElementDataKey)); break; case MissingPropertyReason.PropertyNotAccessibleWithResourceKey: message.Append( string.Format(CultureInfo.InvariantCulture, Messages.MissingPropertyMessagePropertyNotInCloudResource, engine.ElementDataKey, string.Join(",", engine.Properties.Select(p => p.Name)))); break; case MissingPropertyReason.Unknown: message.Append(Messages.MissingPropertyMessageUnknown); break; default: break; } result.Description = message.ToString(); result.Reason = reason; return(result); }
public ItemData(ILogger <AspectDataBase> logger, IPipeline pipeline, IAspectEngine engine) : base(logger, pipeline, engine) { }