-
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
25 changed files
with
439 additions
and
101 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
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 |
---|---|---|
@@ -1,10 +1,6 @@ | ||
mode: ContinuousDeployment | ||
next-version: 3.2 | ||
branches: | ||
master: | ||
mode: ContinuousDelivery | ||
pull-request: | ||
tag: pr | ||
increment: None | ||
develop: | ||
tag: alpha1 | ||
# GitVersion.yml | ||
mode: ContinuousDelivery | ||
next-version: 3.3 | ||
branches: {} | ||
ignore: | ||
sha: [] |
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
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,2 @@ | ||
### Features | ||
- Implemented Provider Model |
This file was deleted.
Oops, something went wrong.
13 changes: 13 additions & 0 deletions
13
...ernalSearch.Providers.VatLayer.Provider/Provider.ExternalSearch.Providers.VatLayer.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,13 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
|
||
<ItemGroup> | ||
<PackageReference Include="CluedIn.Core" /> | ||
<PackageReference Include="ComponentHost" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\ExternalSearch.Providers.VatLayer\ExternalSearch.Providers.VatLayer.csproj" /> | ||
</ItemGroup> | ||
|
||
</Project> |
51 changes: 51 additions & 0 deletions
51
src/ExternalSearch.Providers.VatLayer.Provider/VatLayerProviderProviderComponent.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,51 @@ | ||
using System.Reflection; | ||
using Castle.MicroKernel.Registration; | ||
using CluedIn.Core; | ||
using CluedIn.Core.Providers; | ||
using CluedIn.Core.Server; | ||
using ComponentHost; | ||
using Constants = CluedIn.ExternalSearch.Providers.VatLayer.Constants; | ||
|
||
namespace CluedIn.Provider.VatLayer | ||
{ | ||
[Component(Constants.ComponentName, "Providers", ComponentType.Service, ServerComponents.ProviderWebApi, Components.Server, Components.DataStores, Isolation = ComponentIsolation.NotIsolated)] | ||
public sealed class VatLayerProviderProviderComponent : ServiceApplicationComponent<IServer> | ||
{ | ||
/********************************************************************************************************** | ||
* CONSTRUCTOR | ||
**********************************************************************************************************/ | ||
|
||
/// <summary> | ||
/// Initializes a new instance of the <see cref="VatLayerProviderProviderComponent" /> class. | ||
/// </summary> | ||
/// <param name="componentInfo">The component information.</param> | ||
public VatLayerProviderProviderComponent(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<VatLayerProviderProviderComponent>().Instance(this)); | ||
} | ||
|
||
/********************************************************************************************************** | ||
* METHODS | ||
**********************************************************************************************************/ | ||
|
||
/// <summary>Starts this instance.</summary> | ||
public override void Start() | ||
{ | ||
var asm = Assembly.GetAssembly(typeof(VatLayerProviderProviderComponent)); | ||
Container.Register(Types.FromAssembly(asm).BasedOn<IProvider>().WithServiceFromInterface().If(t => !t.IsAbstract).LifestyleSingleton()); | ||
|
||
State = ServiceState.Started; | ||
} | ||
|
||
/// <summary>Stops this instance.</summary> | ||
public override void Stop() | ||
{ | ||
if (State == ServiceState.Stopped) | ||
return; | ||
|
||
State = ServiceState.Stopped; | ||
} | ||
} | ||
} |
122 changes: 122 additions & 0 deletions
122
src/ExternalSearch.Providers.VatLayer.Provider/VatLayerSearchProviderProvider.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,122 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Threading.Tasks; | ||
using CluedIn.Core; | ||
using CluedIn.Core.Crawling; | ||
using CluedIn.Core.Data.Relational; | ||
using CluedIn.Core.ExternalSearch; | ||
using CluedIn.Core.Providers; | ||
using CluedIn.Core.Webhooks; | ||
using CluedIn.ExternalSearch; | ||
using CluedIn.ExternalSearch.Providers.VatLayer; | ||
using CluedIn.Providers.Models; | ||
using Constants = CluedIn.ExternalSearch.Providers.VatLayer.Constants; | ||
|
||
namespace CluedIn.Provider.VatLayer | ||
{ | ||
public class VatLayerSearchProviderProvider : ProviderBase, IExtendedProviderMetadata, IExternalSearchProviderProvider | ||
{ | ||
public IExternalSearchProvider ExternalSearchProvider { get; } | ||
|
||
public VatLayerSearchProviderProvider([System.Diagnostics.CodeAnalysis.NotNull] ApplicationContext appContext) : base(appContext, GetMetaData()) | ||
{ | ||
ExternalSearchProvider = appContext.Container.ResolveAll<IExternalSearchProvider>().Single(n => n.Id == Constants.ProviderId); | ||
} | ||
|
||
private static IProviderMetadata GetMetaData() | ||
{ | ||
return new ProviderMetadata | ||
{ | ||
Id = Constants.ProviderId, | ||
Name = Constants.ProviderName, | ||
ComponentName = Constants.ComponentName, | ||
AuthTypes = new List<string>(), | ||
SupportsConfiguration = true, | ||
SupportsAutomaticWebhookCreation = false, | ||
SupportsWebHooks = false, | ||
Type = "Enricher" | ||
}; | ||
} | ||
|
||
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 VatLayerExternalSearchJobData(configuration); | ||
|
||
return await Task.FromResult(result); | ||
} | ||
|
||
public override Task<bool> TestAuthentication(ProviderUpdateContext context, IDictionary<string, object> configuration, Guid organizationId, Guid userId, Guid providerDefinitionId) | ||
{ | ||
return Task.FromResult(true); | ||
} | ||
|
||
public override Task<ExpectedStatistics> FetchUnSyncedEntityStatistics(Core.ExecutionContext context, IDictionary<string, object> configuration, Guid organizationId, Guid userId, Guid providerDefinitionId) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
|
||
public override async Task<IDictionary<string, object>> GetHelperConfiguration(ProviderUpdateContext context, CrawlJobData jobData, Guid organizationId, Guid userId, Guid providerDefinitionId) | ||
{ | ||
if (jobData is VatLayerExternalSearchJobData result) | ||
{ | ||
return await Task.FromResult(result.ToDictionary()); | ||
} | ||
|
||
throw new InvalidOperationException($"Unexpected data type for {nameof(VatLayerExternalSearchJobData)}, {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(Core.ExecutionContext context, CrawlJobData jobData, Guid organizationId, Guid userId, Guid providerDefinitionId) | ||
{ | ||
return Task.FromResult(new AccountInformation(providerDefinitionId.ToString(), providerDefinitionId.ToString())); | ||
} | ||
|
||
public override string Schedule(DateTimeOffset relativeDateTime, bool webHooksEnabled) | ||
{ | ||
return $"{relativeDateTime.Minute} 0/23 * * *"; | ||
} | ||
|
||
public override Task<IEnumerable<WebHookSignature>> CreateWebHook(Core.ExecutionContext context, CrawlJobData jobData, IWebhookDefinition webhookDefinition, IDictionary<string, object> config) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override Task<IEnumerable<WebhookDefinition>> GetWebHooks(Core.ExecutionContext context) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override Task DeleteWebHook(Core.ExecutionContext context, CrawlJobData jobData, IWebhookDefinition webhookDefinition) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public override Task<CrawlLimit> GetRemainingApiAllowance(Core.ExecutionContext context, CrawlJobData jobData, Guid organizationId, Guid userId, Guid providerDefinitionId) | ||
{ | ||
if (jobData == null) throw new ArgumentNullException(nameof(jobData)); | ||
return Task.FromResult(new CrawlLimit(-1, TimeSpan.Zero)); | ||
} | ||
|
||
public override IEnumerable<string> WebhookManagementEndpoints(IEnumerable<string> ids) | ||
{ | ||
throw new NotImplementedException(); | ||
} | ||
|
||
public string Icon { get; } = Constants.Icon; | ||
public string Domain { get; } = Constants.Domain; | ||
public string About { get; } = Constants.About; | ||
public AuthMethods AuthMethods { get; } = Constants.AuthMethods; | ||
public IEnumerable<Control> Properties { get; } = Constants.Properties; | ||
public Guide Guide { get; } = Constants.Guide; | ||
public new IntegrationType Type { get; } = Constants.IntegrationType; | ||
} | ||
} |
Oops, something went wrong.