-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
833 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LINES/@EntryValue">False</s:Boolean> | ||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpUseContinuousIndentInsideBracesMigration/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ESettingsUpgrade_002EMigrateBlankLinesAroundFieldToBlankLinesAroundProperty/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Features | ||
- ReQueuing on all errors | ||
- Added Data Activator Export Target | ||
- Added Real Time Intelligence Export Target |
21 changes: 21 additions & 0 deletions
21
src/Connector.DataActivator/Connector.DataActivator.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net6.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Remove="Resources\data_activator.svg" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<EmbeddedResource Include="Resources\data_activator.svg" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\Connector.SqlServer\Connector.AzureEventHub.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
54 changes: 54 additions & 0 deletions
54
src/Connector.DataActivator/DataActivatorConnectorComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
using System.Reflection; | ||
using Castle.MicroKernel.Registration; | ||
using CluedIn.Connector.AzureEventHub; | ||
using CluedIn.Core; | ||
using CluedIn.Core.Providers; | ||
using CluedIn.Core.Server; | ||
using ComponentHost; | ||
using Microsoft.Extensions.Logging; | ||
|
||
namespace CluedIn.Connector.DataActivator; | ||
|
||
[Component(DataActivatorConstants.ProviderName, "Providers", ComponentType.Service, ServerComponents.ProviderWebApi, Components.Server, Components.DataStores, Isolation = ComponentIsolation.NotIsolated)] | ||
public sealed class DataActivatorConnectorComponent : ServiceApplicationComponent<IServer> | ||
{ | ||
/********************************************************************************************************** | ||
* CONSTRUCTOR | ||
**********************************************************************************************************/ | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="AzureEventHubConnectorComponent" /> class. | ||
/// </summary> | ||
/// <param name="componentInfo">The component information.</param> | ||
public DataActivatorConnectorComponent(ComponentInfo componentInfo) : base(componentInfo) | ||
{ | ||
// Dev. Note: Potential for compiler warning here ... CA2214: Do not call overridable methods in constructors | ||
// this class has been sealed to prevent the CA2214 waring being raised by the compiler | ||
Container.Register(Component.For<DataActivatorConnectorComponent>().Instance(this)); | ||
} | ||
|
||
/********************************************************************************************************** | ||
* METHODS | ||
**********************************************************************************************************/ | ||
|
||
/// <summary>Starts this instance.</summary> | ||
public override void Start() | ||
{ | ||
var asm = Assembly.GetExecutingAssembly(); | ||
Container.Register(Types.FromAssembly(asm).BasedOn<IProvider>().WithServiceFromInterface().If(t => !t.IsAbstract).LifestyleSingleton()); | ||
|
||
Log.LogInformation("[DataActivator] Data Activator Registered"); | ||
State = ServiceState.Started; | ||
} | ||
|
||
/// <summary>Stops this instance.</summary> | ||
public override void Stop() | ||
{ | ||
if (State == ServiceState.Stopped) | ||
{ | ||
return; | ||
} | ||
|
||
State = ServiceState.Stopped; | ||
} | ||
} |
193 changes: 193 additions & 0 deletions
193
src/Connector.DataActivator/DataActivatorConnectorProvider.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,193 @@ | ||
using CluedIn.Connector.AzureEventHub; | ||
using CluedIn.Core; | ||
using CluedIn.Core.Crawling; | ||
using CluedIn.Core.Data.Relational; | ||
using CluedIn.Core.Providers; | ||
using CluedIn.Core.Webhooks; | ||
using CluedIn.Providers.Models; | ||
using Newtonsoft.Json; | ||
using ExecutionContext = CluedIn.Core.ExecutionContext; | ||
|
||
namespace CluedIn.Connector.DataActivator; | ||
|
||
public class DataActivatorConnectorProvider : ProviderBase, IExtendedProviderMetadata | ||
{ | ||
/********************************************************************************************************** | ||
* CONSTRUCTORS | ||
**********************************************************************************************************/ | ||
|
||
public DataActivatorConnectorProvider([NotNull] ApplicationContext appContext) | ||
: base(appContext, DataActivatorConstants.CreateProviderMetadata()) | ||
{ | ||
} | ||
|
||
public string ServiceType { get; } = JsonConvert.SerializeObject(DataActivatorConstants.ServiceType); | ||
public string Aliases { get; } = JsonConvert.SerializeObject(DataActivatorConstants.Aliases); | ||
|
||
public string Details { get; set; } = DataActivatorConstants.Details; | ||
public string Category { get; set; } = DataActivatorConstants.Category; | ||
|
||
public string Icon => DataActivatorConstants.IconResourceName; | ||
public string Domain { get; } = DataActivatorConstants.Uri; | ||
public string About { get; } = DataActivatorConstants.ConnectorDescription; | ||
public AuthMethods AuthMethods => DataActivatorConstants.AuthMethods; | ||
public IEnumerable<Control> Properties { get; } = DataActivatorConstants.Properties; | ||
|
||
public Guide Guide { get; set; } = new() { Instructions = DataActivatorConstants.Instructions, Value = new List<string> { DataActivatorConstants.ConnectorDescription }, Details = DataActivatorConstants.Details }; | ||
|
||
public new IntegrationType Type { get; set; } = DataActivatorConstants.Type; | ||
|
||
/********************************************************************************************************** | ||
* METHODS | ||
**********************************************************************************************************/ | ||
|
||
public override async Task<CrawlJobData> GetCrawlJobData( | ||
ProviderUpdateContext context, | ||
IDictionary<string, object> configuration, | ||
Guid organizationId, | ||
Guid userId, | ||
Guid providerDefinitionId) | ||
{ | ||
if (configuration == null) | ||
{ | ||
throw new ArgumentNullException(nameof(configuration)); | ||
} | ||
|
||
var result = new AzureEventHubConnectorJobData(configuration); | ||
|
||
return await Task.FromResult(result); | ||
} | ||
|
||
public override Task<bool> TestAuthentication( | ||
ProviderUpdateContext context, | ||
IDictionary<string, object> configuration, | ||
Guid organizationId, | ||
Guid userId, | ||
Guid providerDefinitionId) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override Task<ExpectedStatistics> FetchUnSyncedEntityStatistics(ExecutionContext context, IDictionary<string, object> configuration, Guid organizationId, Guid userId, Guid providerDefinitionId) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override Task<IDictionary<string, object>> GetHelperConfiguration( | ||
ProviderUpdateContext context, | ||
[NotNull] CrawlJobData jobData, | ||
Guid organizationId, | ||
Guid userId, | ||
Guid providerDefinitionId) | ||
{ | ||
if (jobData == null) | ||
{ | ||
throw new ArgumentNullException(nameof(jobData)); | ||
} | ||
|
||
if (jobData is AzureEventHubConnectorJobData result) | ||
{ | ||
return Task.FromResult(result.ToDictionary()); | ||
} | ||
|
||
throw new InvalidOperationException($"Unexpected data type for AzureEventConnectorJobData, {jobData.GetType()}"); | ||
} | ||
|
||
public override Task<IDictionary<string, object>> GetHelperConfiguration( | ||
ProviderUpdateContext context, | ||
CrawlJobData jobData, | ||
Guid organizationId, | ||
Guid userId, | ||
Guid providerDefinitionId, | ||
string folderId) | ||
{ | ||
return GetHelperConfiguration(context, jobData, organizationId, userId, providerDefinitionId); | ||
} | ||
|
||
public override Task<AccountInformation> GetAccountInformation(ExecutionContext context, [NotNull] CrawlJobData jobData, Guid organizationId, Guid userId, Guid providerDefinitionId) | ||
{ | ||
if (jobData == null) | ||
{ | ||
throw new ArgumentNullException(nameof(jobData)); | ||
} | ||
|
||
if (!(jobData is AzureEventHubConnectorJobData result)) | ||
{ | ||
throw new ArgumentException( | ||
"Wrong CrawlJobData type", nameof(jobData)); | ||
} | ||
|
||
var accountId = $"{result.Name}.{result.ConnectionString}"; | ||
|
||
return Task.FromResult(new AccountInformation(accountId, $"{accountId}")); | ||
} | ||
|
||
public override string Schedule(DateTimeOffset relativeDateTime, bool webHooksEnabled) | ||
{ | ||
return $"{relativeDateTime.Minute} 0/23 * * *"; | ||
} | ||
|
||
public override Task<IEnumerable<WebHookSignature>> CreateWebHook(ExecutionContext context, [NotNull] CrawlJobData jobData, [NotNull] IWebhookDefinition webhookDefinition, [NotNull] IDictionary<string, object> config) | ||
{ | ||
if (jobData == null) | ||
{ | ||
throw new ArgumentNullException(nameof(jobData)); | ||
} | ||
|
||
if (webhookDefinition == null) | ||
{ | ||
throw new ArgumentNullException(nameof(webhookDefinition)); | ||
} | ||
|
||
if (config == null) | ||
{ | ||
throw new ArgumentNullException(nameof(config)); | ||
} | ||
|
||
throw new NotImplementedException(); | ||
} | ||
|
||
public override Task<IEnumerable<WebhookDefinition>> GetWebHooks(ExecutionContext context) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override Task DeleteWebHook(ExecutionContext context, [NotNull] CrawlJobData jobData, [NotNull] IWebhookDefinition webhookDefinition) | ||
{ | ||
if (jobData == null) | ||
{ | ||
throw new ArgumentNullException(nameof(jobData)); | ||
} | ||
|
||
if (webhookDefinition == null) | ||
{ | ||
throw new ArgumentNullException(nameof(webhookDefinition)); | ||
} | ||
|
||
throw new NotImplementedException(); | ||
} | ||
|
||
public override IEnumerable<string> WebhookManagementEndpoints([NotNull] IEnumerable<string> ids) | ||
{ | ||
if (ids == null) | ||
{ | ||
throw new ArgumentNullException(nameof(ids)); | ||
} | ||
|
||
// TODO should ids also be checked for being empty ? | ||
|
||
throw new NotImplementedException(); | ||
} | ||
|
||
public override Task<CrawlLimit> GetRemainingApiAllowance(ExecutionContext context, [NotNull] CrawlJobData jobData, Guid organizationId, Guid userId, Guid providerDefinitionId) | ||
{ | ||
if (jobData == null) | ||
{ | ||
throw new ArgumentNullException(nameof(jobData)); | ||
} | ||
|
||
//TODO what the hell is this? | ||
//There is no limit set, so you can pull as often and as much as you want. | ||
return Task.FromResult(new CrawlLimit(-1, TimeSpan.Zero)); | ||
} | ||
} |
Oops, something went wrong.