Skip to content

Commit

Permalink
Merge pull request #514 from Esri/2.7.1
Browse files Browse the repository at this point in the history
2.7.1 merge into master
  • Loading branch information
mhogeweg authored Dec 8, 2023
2 parents 125659f + 70f6a60 commit 0864840
Show file tree
Hide file tree
Showing 68 changed files with 10,492 additions and 344 deletions.
Binary file not shown.
2 changes: 1 addition & 1 deletion geoportal-search/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>com.esri.geoportal</groupId>
<artifactId>geoportal-search</artifactId>
<packaging>war</packaging>
<version>2.7.0</version>
<version>2.7.1</version>
<name>geoportal-search</name>
<url>http://maven.apache.org</url>
<dependencies>
Expand Down
2 changes: 2 additions & 0 deletions geoportal-search/src/main/resources/gs/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
if (!gs.provider) gs.provider = {};
if (!gs.provider.csw) gs.provider.csw = {};
if (!gs.provider.ogcrecords) gs.provider.ogcrecords = {};
if (!gs.provider.stac) gs.provider.stac = {};
if (!gs.provider.opensearch) gs.provider.opensearch = {};
if (!gs.target) gs.target = {};
if (!gs.target.csw) gs.target.csw = {};
Expand Down Expand Up @@ -59,6 +60,7 @@
"provider/csw/OwsException",
"provider/opensearch/OpensearchProvider",
"provider/ogcrecords/OGCRecordsProvider",
"provider/stac/STACProvider",
"target/Target",
"target/TargetSchema",
"target/csw/CswTarget",
Expand Down
17 changes: 16 additions & 1 deletion geoportal-search/src/main/resources/gs/base/Request.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@
headerMap: {writable: true, value: null},
parameterMap: {writable: true, value: null},
url: {writable: true, value: null}, // TODO requestUrl
pathParameters: {writable: true, value: null},

/* .......................................................................................... */

Expand Down Expand Up @@ -251,6 +252,10 @@
return null;
}},

getPathParameterValue: {writable:true,value:function(key) {
return this._getPathParameterValue(this.pathParameters,key);
}},

hasQueryParameters: {writable:true,value:function() {
var k, map = this.parameterMap;
if (map) {
Expand Down Expand Up @@ -345,7 +350,17 @@
}
}
return null;
}}
}},

_getPathParameterValue: {writable:true,value:function(map,key) {
if (map) {
var a = map[key];
if (a !== "undefined" && a !== null) {
return a;
}
}
return null;
}},

});

Expand Down
5 changes: 5 additions & 0 deletions geoportal-search/src/main/resources/gs/base/Val.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@
return (v.indexOf(sfx,(v.length - sfx.length)) !== -1);
}},

startsWith: {writable:true,value:function(v,sfx) {
if (typeof v !== "string") return null;
return (v.indexOf(sfx) === 0);
}},

escXml: {writable:true,value:function(s) {
if (s === null) return null;
if (s.length === 0) return s;
Expand Down
11 changes: 10 additions & 1 deletion geoportal-search/src/main/resources/gs/config/Config.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@

gs.config.Config = gs.Object.create(gs.Proto,{

defaultTarget: {writable: true, value: "arcgis"},
defaultTarget: {writable: true, value: "customElastic"},

// allow POSTing of Elasticsearch DSL (Domain Specific Language) queries and aggregations
allowDslSearches: {writable: true, value: true},
Expand Down Expand Up @@ -48,6 +48,8 @@

ogcrecordsAPIFile: {writable: true, value: "gs/config/ogcrecords-api.json"},

ogcrecordsSchemaFile: {writable: true, value: "gs/config/ogcrecords-schema.json"},

proxyUrl: {writable: true, value: null},

_targets: {writable: true, value: null},
Expand All @@ -61,6 +63,13 @@

var targets = {

"customElastic": gs.Object.create(gs.target.elastic.CustomElasticTarget).mixin({
"searchUrl": "https://gpt.geocloud.com/geoportal2/elastic/metadata/item/_search",
"itemBaseUrl": null,
"schemaMixin": {
"useTotalHits": false,
}
}),
"arcgis": gs.Object.create(gs.target.portal.PortalTarget).mixin({
"portalBaseUrl": "https://www.arcgis.com"
})
Expand Down
69 changes: 9 additions & 60 deletions geoportal-search/src/main/resources/gs/config/ogcrecords-api.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,26 +62,26 @@
},
"example": [
{
"href": "{opensearch.url}",
"href": "{url}",
"rel": "self",
"type": "application/json",
"title": "this OGC API - Records landing page as JSON"
"title": "This OGC API - Records landing page as JSON"
},
{
"href": "{opensearch.url}/api",
"href": "{url}/api",
"rel": "service-desc",
"type": "application/vnd.oai.openapi+json;version=3.0",
"title": "the API definition (OpenAPI document)"
"title": "The API definition (OpenAPI document)"
},
{
"href": "{opensearch.url}/conformance",
"href": "{url}/conformance",
"rel": "conformance",
"title": "the OGC API conformance classes supported"
"title": "The OGC API conformance classes supported"
},
{
"href": "{opensearch.url}/collections",
"href": "{url}/collections",
"rel": "data",
"title": "the set of available collections"
"title": "The set of available collections"
}
]
}
Expand Down Expand Up @@ -292,58 +292,7 @@
"url": "https://virtserver.swaggerhub.com/constantinius/ogc-api-coverages/1.0.0"
}],
"openapi": "3.0.1",
"paths": {
"/collections/{collectionId}/sortables": {
"get": {
"summary": "description of the sorting capabilities offerec on the collection in the catalog",
"description": "List of sortable fields in this collection.",
"operationId": "getCoverageOffering",
"responses": {
"200": {
"description": "Information about the coverage collection.",
"content": {
"text/html": {
"schema": {
"type": "string"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/sortablesInfo"
}
}
}
},
"default": {
"description": "An error occured.",
"content": {
"text/html": {
"schema": {
"type": "string"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/exception"
}
}
}
}
},
"parameters": [{
"schema": {
"type": "string"
},
"in": "path",
"explode": false,
"name": "collectionId",
"description": "Identifier (name) of a specific collection",
"style": "simple",
"required": true
}],
"tags": ["Collection"]
}
},
"paths": {
"/collections/{collectionId}/items/{recordId}": {
"get": {
"responses": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,26 @@
},
"links": [
{
"href": "{opensearch.url}",
"href": "{url}",
"rel": "self",
"type": "application/json",
"title": "this OGC API - Records landing page as JSON"
"title": "This OGC API - Records landing page as JSON"
},
{
"href": "{opensearch.url}/api",
"href": "{url}/api",
"rel": "service-desc",
"type": "application/vnd.oai.openapi+json;version=3.0",
"title": "the API definition (OpenAPI document)"
"title": "The API definition (OpenAPI document)"
},
{
"href": "{opensearch.url}/conformance",
"href": "{url}/conformance",
"rel": "conformance",
"title": "the OGC API conformance classes supported"
"title": "The OGC API conformance classes supported"
},
{
"href": "{opensearch.url}/collections",
"href": "{url}/collections",
"rel": "data",
"title": "the set of available collections"
"title": "The set of available collections"
}
]
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"type": "FeatureCollection",
"features": [],
"numberMatched": "{numberMatched}",
"numberReturned": "{numberReturned}",
"next": "{next}",
"features": "{features}",
"links": [
{
"rel": "self",
Expand All @@ -16,7 +19,5 @@
"href": "{url}/collections/metadata",
"hreflang": "en-US"
}
],
"numberMatched": 0,
"numberReturned": 0
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"id": {
"title": "id",
"type": "string"
},
"type": {
"title": "type",
"type": "string"
},
"geometry": {},
"time": {
"title": "time",
"type": "string"
},
"properties": {
"title": "properties",
"type": "object"
}
}
16 changes: 5 additions & 11 deletions geoportal-search/src/main/resources/gs/context/_Processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,18 +99,10 @@
});
}
if (!isOsDsc) provider = gs.Object.create(gs.provider.csw.CswProvider);
} else if (task.val.endsWith(v,"/ogcrecords")
|| task.val.endsWith(v,"/ogcrecords/")
|| task.val.endsWith(v,"/ogcrecords/api")
|| task.val.endsWith(v,"/ogcrecords/api/")
|| task.val.endsWith(v,"/ogcrecords/conformance")
|| task.val.endsWith(v,"/ogcrecords/collections")
|| task.val.endsWith(v,"/ogcrecords/collections/queryables")
|| task.val.endsWith(v,"/ogcrecords/collections/metadata")
|| task.val.endsWith(v,"/ogcrecords/collections/metadata/items")
|| task.val.endsWith(v,"/ogcrecords/collections/metadata/queryables")
) {
} else if (task.val.startsWith(v, "/ogcrecords")) {
provider = gs.Object.create(gs.provider.ogcrecords.OGCRecordsProvider);
} else if (task.val.startsWith(v, "/stac")) {
provider = gs.Object.create(gs.provider.stac.STACProvider);
}
return provider;
}},
Expand All @@ -121,6 +113,7 @@
body: requestInfo.requestBody,
headerMap: requestInfo.headerMap,
parameterMap: requestInfo.parameterMap,
pathParameters: requestInfo.pathParameters
});
return request;
}},
Expand Down Expand Up @@ -160,6 +153,7 @@
body: requestInfo.requestBody,
headerMap: requestInfo.headerMap,
parameterMap: requestInfo.parameterMap,
pathParameters: requestInfo.pathParameters
});
task = self.newTask(context,config,request,{
baseUrl: requestInfo.baseUrl
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,10 +226,25 @@
var con = null, buffer, nRead;
try {
var u = new java.net.URL(url);
//print(u);
java.net.HttpURLConnection.setFollowRedirects(true);
// print(u);
if(options && options.useHttps)
{
var ssl_ctx = javax.net.ssl.SSLContext.getInstance("TLS");
//Using a mock trust manager and not validating certificate

var trust_mgr = new com.esri.geoportal.lib.elastic.http.MockTrustManager();

ssl_ctx.init(null, // key manager
trust_mgr.getTrustManager(), // trust manager
new java.security.SecureRandom()); // random number generator
javax.net.ssl.HttpsURLConnection.setDefaultSSLSocketFactory(ssl_ctx.getSocketFactory());
javax.net.ssl.HttpsURLConnection.setInstanceFollowRedirects(true);
}
else{
java.net.HttpURLConnection.setFollowRedirects(true);
}

con = u.openConnection();
con.setInstanceFollowRedirects(true);

if (options && options.basicCredentials &&
typeof options.basicCredentials.username === "string" &&
Expand All @@ -244,6 +259,8 @@
if (typeof data === "string" && data.length > 0) {
con.setDoOutput(true);
con.setRequestMethod("POST");

// print("data "+data);
var postData = data.getBytes("UTF-8");
if (typeof dataContentType === "string" && dataContentType.length > 0) {
con.setRequestProperty( "Content-Type",dataContentType);
Expand Down Expand Up @@ -276,7 +293,7 @@
sw.write(buffer,0,nRead); // TODO comment out this line and Invalid JSON: <json>:1:0 Expected json literal but found eof
}
result = sw.toString();
//console.log("result",result);
// console.log("result",result);
} catch(e) {
var msg;
try {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
gs.context.node.NodeContext = gs.Object.create(gs.context.Context,{

readResourceFile: {writable:true,value:function(path,charset) {
path = "../"+path; // TODO this is relative to where node was launched
// comment for testing standalone node setup for ogcrecords
// path = "../"+path; // TODO this is relative to where node was launched
if (charset === null || charset.length == 0) charset = "UTF-8";
return fs.readFileSync(path,{encoding:charset});
}},
Expand All @@ -36,9 +37,11 @@
body: data
};
}

// TODO gs._request path for require
gs._request(options, function (error, response, body) {
var msg = "Network error";
// console.log(body);
if (!error && response && response.statusCode === 200) {
promise.resolve(body);
} else {
Expand Down
Loading

0 comments on commit 0864840

Please sign in to comment.