Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
I
Indexer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OSDU
OSDU Data Platform
System
Indexer
Commits
e370debb
Commit
e370debb
authored
4 years ago
by
Sviatoslav Nekhaienko
Browse files
Options
Downloads
Patches
Plain Diff
add more methods
parent
e5a93b9f
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!60
Indexer to read from Schema Service as well as Storage Schema
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
indexer-core/src/main/java/org/opengroup/osdu/indexer/service/impl/SchemaServiceImpl.java
+29
-9
29 additions, 9 deletions
...pengroup/osdu/indexer/service/impl/SchemaServiceImpl.java
with
29 additions
and
9 deletions
indexer-core/src/main/java/org/opengroup/osdu/indexer/service/impl/SchemaServiceImpl.java
+
29
−
9
View file @
e370debb
...
...
@@ -56,21 +56,17 @@ public class SchemaServiceImpl implements SchemaService {
@Override
public
String
getSchema
(
String
kind
)
throws
URISyntaxException
,
UnsupportedEncodingException
{
String
schemaFromStorageService
=
storageService
.
get
StorageS
chema
(
kind
);
String
schemaFromStorageService
=
getFrom
StorageS
ervice
(
kind
);
if
(
schemaFromStorageService
!=
null
)
{
return
schemaFromStorageService
;
}
log
.
warning
(
"Schema is not found on the Storage Service:"
+
kind
);
return
getFromSchemaService
(
kind
);
}
String
url
=
String
.
format
(
"%s/%s"
,
SCHEMA_HOST
,
URLEncoder
.
encode
(
kind
,
StandardCharsets
.
UTF_8
.
toString
()));
FetchServiceHttpRequest
request
=
FetchServiceHttpRequest
.
builder
()
.
httpMethod
(
HttpMethods
.
GET
)
.
headers
(
this
.
requestInfo
.
getHeadersMap
())
.
url
(
url
)
.
build
();
HttpResponse
response
=
this
.
urlFetchService
.
sendRequest
(
request
);
private
String
getFromSchemaService
(
String
kind
)
throws
UnsupportedEncodingException
,
URISyntaxException
{
HttpResponse
response
=
getSchemaServiceResponse
(
kind
);
if
(
response
.
getResponseCode
()
==
HttpStatus
.
SC_NOT_FOUND
)
{
log
.
warning
(
"Schema is not found on the Schema Service:"
+
kind
);
...
...
@@ -80,4 +76,28 @@ public class SchemaServiceImpl implements SchemaService {
return
response
.
getResponseCode
()
!=
HttpStatus
.
SC_OK
?
null
:
schemaToStorageFormat
.
convertToString
(
response
.
getBody
(),
kind
);
}
private
String
getFromStorageService
(
String
kind
)
throws
URISyntaxException
,
UnsupportedEncodingException
{
String
schemaFromStorageService
=
storageService
.
getStorageSchema
(
kind
);
if
(
schemaFromStorageService
!=
null
)
{
return
schemaFromStorageService
;
}
log
.
warning
(
"Schema is not found on the Storage Service:"
+
kind
);
return
null
;
}
private
HttpResponse
getSchemaServiceResponse
(
String
kind
)
throws
UnsupportedEncodingException
,
URISyntaxException
{
String
url
=
String
.
format
(
"%s/%s"
,
SCHEMA_HOST
,
URLEncoder
.
encode
(
kind
,
StandardCharsets
.
UTF_8
.
toString
()));
FetchServiceHttpRequest
request
=
FetchServiceHttpRequest
.
builder
()
.
httpMethod
(
HttpMethods
.
GET
)
.
headers
(
this
.
requestInfo
.
getHeadersMap
())
.
url
(
url
)
.
build
();
return
this
.
urlFetchService
.
sendRequest
(
request
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment