-
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
1 parent
2153d04
commit a49cd56
Showing
14 changed files
with
178 additions
and
75 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
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,11 +1,13 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using Stac.Collection; | ||
|
||
namespace Stac.Extensions | ||
{ | ||
public interface IStacExtension | ||
{ | ||
string Identifier { get; } | ||
|
||
IDictionary<string, Func<IEnumerable<object>, IStacSummaryItem>> GetSummaryFunctions(); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
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,43 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using Newtonsoft.Json.Schema; | ||
|
||
namespace Stac.Extensions | ||
{ | ||
public static class StacExtensions | ||
{ | ||
public static Dictionary<string, Type> ManagedStacExtensions = new Dictionary<string, Type>(); | ||
|
||
public static void InitManagedExtensions() | ||
{ | ||
ManagedStacExtensions.Clear(); | ||
ManagedStacExtensions.Add(Eo.EoStacExtension.JsonSchemaUrl, typeof(Eo.EoStacExtension)); | ||
ManagedStacExtensions.Add(Processing.ProcessingStacExtension.JsonSchemaUrl, typeof(Processing.ProcessingStacExtension)); | ||
ManagedStacExtensions.Add(Projection.ProjectionStacExtension.JsonSchemaUrl, typeof(Projection.ProjectionStacExtension)); | ||
ManagedStacExtensions.Add(Sar.SarStacExtension.JsonSchemaUrl, typeof(Sar.SarStacExtension)); | ||
ManagedStacExtensions.Add(Sat.SatStacExtension.JsonSchemaUrl, typeof(Sat.SatStacExtension)); | ||
ManagedStacExtensions.Add(View.ViewStacExtension.JsonSchemaUrl, typeof(View.ViewStacExtension)); | ||
} | ||
|
||
public static IEnumerable<IStacExtension> GetDeclaredExtensions(this IStacPropertiesContainer stacPropertiesContainer) | ||
{ | ||
return stacPropertiesContainer.StacObjectContainer.StacExtensions | ||
.Select(stacExtension => LoadStacExtension(stacExtension, stacPropertiesContainer.StacObjectContainer)); | ||
} | ||
|
||
private static IStacExtension LoadStacExtension(string stacExtension, IStacObject stacObject) | ||
{ | ||
if (ManagedStacExtensions.ContainsKey(stacExtension)) | ||
{ | ||
try | ||
{ | ||
return Activator.CreateInstance(ManagedStacExtensions[stacExtension], new object[1] { stacObject }) as IStacExtension; | ||
} | ||
catch { } | ||
} | ||
|
||
return new SchemaBasedStacExtension(new StacSchemaResolver(new JSchemaUrlResolver()).LoadSchema(stacExtension), stacObject); | ||
} | ||
} | ||
} |
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
Oops, something went wrong.