Skip to content

Commit

Permalink
Init lock
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelmathot committed Jun 23, 2021
1 parent 3740840 commit 50b5add
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions src/DotNetStac/Extensions/StacExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace Stac.Extensions
public static class StacExtensions
{
private static Dictionary<string, Type> managedStacExtensions = new Dictionary<string, Type>();
private static object initLock;

/// <summary>
/// Dictionary of extensions managed by the library
Expand All @@ -34,20 +35,23 @@ public static Dictionary<string, Type> ManagedStacExtensions
/// </summary>
public static void InitManagedExtensions()
{
managedStacExtensions.Clear();
managedStacExtensions.Add(Eo.EoStacExtension.JsonSchemaUrl, typeof(Eo.EoStacExtension));
managedStacExtensions.Add("eo", typeof(Eo.EoStacExtension));
managedStacExtensions.Add(Processing.ProcessingStacExtension.JsonSchemaUrl, typeof(Processing.ProcessingStacExtension));
managedStacExtensions.Add("processing", typeof(Processing.ProcessingStacExtension));
managedStacExtensions.Add(Projection.ProjectionStacExtension.JsonSchemaUrl, typeof(Projection.ProjectionStacExtension));
managedStacExtensions.Add("projection", typeof(Projection.ProjectionStacExtension));
managedStacExtensions.Add(Raster.RasterStacExtension.JsonSchemaUrl, typeof(Raster.RasterStacExtension));
managedStacExtensions.Add(Sar.SarStacExtension.JsonSchemaUrl, typeof(Sar.SarStacExtension));
managedStacExtensions.Add("sar", typeof(Sar.SarStacExtension));
managedStacExtensions.Add(Sat.SatStacExtension.JsonSchemaUrl, typeof(Sat.SatStacExtension));
managedStacExtensions.Add("sat", typeof(Sat.SatStacExtension));
managedStacExtensions.Add(View.ViewStacExtension.JsonSchemaUrl, typeof(View.ViewStacExtension));
managedStacExtensions.Add("view", typeof(View.ViewStacExtension));
lock (initLock)
{
managedStacExtensions.Clear();
managedStacExtensions.Add(Eo.EoStacExtension.JsonSchemaUrl, typeof(Eo.EoStacExtension));
managedStacExtensions.Add("eo", typeof(Eo.EoStacExtension));
managedStacExtensions.Add(Processing.ProcessingStacExtension.JsonSchemaUrl, typeof(Processing.ProcessingStacExtension));
managedStacExtensions.Add("processing", typeof(Processing.ProcessingStacExtension));
managedStacExtensions.Add(Projection.ProjectionStacExtension.JsonSchemaUrl, typeof(Projection.ProjectionStacExtension));
managedStacExtensions.Add("projection", typeof(Projection.ProjectionStacExtension));
managedStacExtensions.Add(Raster.RasterStacExtension.JsonSchemaUrl, typeof(Raster.RasterStacExtension));
managedStacExtensions.Add(Sar.SarStacExtension.JsonSchemaUrl, typeof(Sar.SarStacExtension));
managedStacExtensions.Add("sar", typeof(Sar.SarStacExtension));
managedStacExtensions.Add(Sat.SatStacExtension.JsonSchemaUrl, typeof(Sat.SatStacExtension));
managedStacExtensions.Add("sat", typeof(Sat.SatStacExtension));
managedStacExtensions.Add(View.ViewStacExtension.JsonSchemaUrl, typeof(View.ViewStacExtension));
managedStacExtensions.Add("view", typeof(View.ViewStacExtension));
}
}

/// <summary>
Expand Down

0 comments on commit 50b5add

Please sign in to comment.