Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
Legal
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
Security and Compliance
Legal
Commits
9d62875f
Commit
9d62875f
authored
4 years ago
by
Auto GO3-NRG Ticket
Browse files
Options
Downloads
Plain Diff
Auto commit when pipeline succeeds
parents
bbdf3a02
260e8fb1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!98
(GONRG-1768) GCP: logging impl
,
!92
Cloud-agnostic module `legal-reference` for Anthos (GONRG-1423)
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
provider/legal-azure/src/main/java/org/opengroup/osdu/legal/azure/countries/StorageReaderImpl.java
+13
-5
13 additions, 5 deletions
...engroup/osdu/legal/azure/countries/StorageReaderImpl.java
with
13 additions
and
5 deletions
provider/legal-azure/src/main/java/org/opengroup/osdu/legal/azure/countries/StorageReaderImpl.java
+
13
−
5
View file @
9d62875f
...
...
@@ -16,6 +16,7 @@ package org.opengroup.osdu.legal.azure.countries;
import
com.azure.storage.blob.BlobContainerClient
;
import
com.azure.storage.blob.specialized.BlockBlobClient
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
import
org.opengroup.osdu.core.common.model.tenant.TenantInfo
;
import
org.opengroup.osdu.core.common.logging.JaxRsDpsLog
;
import
org.opengroup.osdu.legal.provider.interfaces.IStorageReader
;
...
...
@@ -43,20 +44,27 @@ public class StorageReaderImpl implements IStorageReader {
return
readFromBlobStorage
().
getBytes
(
StandardCharsets
.
UTF_8
);
//should return a json format of an array of Country class
}
/**
* This function should be fail close. It reads the pre-configuration file for the partition. As a security requirement, we should
* fail the corresponding request instead of assuming the content is empty, but it should only fail close on the request level not
* service level meaning the service could still start and running probably for the APIs which do not need the pre-configuration file
*/
public
String
readFromBlobStorage
()
{
String
content
=
""
;
BlockBlobClient
blockBlobClient
=
blobContainerClient
.
getBlobClient
(
fileName
).
getBlockBlobClient
();
if
(
blockBlobClient
.
exists
())
{
try
(
ByteArrayOutputStream
downloadStream
=
new
ByteArrayOutputStream
())
{
blockBlobClient
.
download
(
downloadStream
);
content
=
downloadStream
.
toString
(
StandardCharsets
.
UTF_8
.
name
());
String
content
=
downloadStream
.
toString
(
StandardCharsets
.
UTF_8
.
name
());
return
content
;
}
catch
(
Exception
e
)
{
logger
.
error
(
String
.
format
(
"read %s failed"
,
fileName
));
String
message
=
String
.
format
(
"read %s failed"
,
fileName
);
throw
new
AppException
(
500
,
"Server error"
,
message
);
}
}
else
{
String
message
=
String
.
format
(
"%s does not exist on partition %s"
,
fileName
,
tenantInfo
.
getDataPartitionId
());
throw
new
AppException
(
500
,
"Server error"
,
message
);
}
return
content
;
}
}
\ No newline at end of file
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