Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Ronak Sakhuja
OS Core Lib Azure
Commits
d8aad764
Commit
d8aad764
authored
Aug 25, 2020
by
Aman Verma
Browse files
adding a config class
parent
b6e2ae8b
Changes
3
Hide whitespace changes
Inline
Side-by-side
README.md
View file @
d8aad764
...
...
@@ -78,4 +78,5 @@ Enabled transaction logger and slf4jlogger
| name | value | description |
| --- | --- | --- |
|
`tenantInfo.container.name`
|
`TenantInfo`
| cosmos container name |
|
`azure.cosmosdb.database`
| ex
`dev-osdu-r2-db`
| cosmos databse name |
\ No newline at end of file
|
`azure.cosmosdb.database`
| ex
`dev-osdu-r2-db`
| cosmos database name |
|
`storage_account`
| ex
`testStorage`
| storage account name |
\ No newline at end of file
src/main/java/org/opengroup/osdu/azure/blobstorage/BlobServiceClientFactoryImpl.java
View file @
d8aad764
...
...
@@ -17,10 +17,10 @@ package org.opengroup.osdu.azure.blobstorage;
import
com.azure.identity.DefaultAzureCredential
;
import
com.azure.storage.blob.BlobServiceClient
;
import
com.azure.storage.blob.BlobServiceClientBuilder
;
import
org.opengroup.osdu.azure.di.BlobStoreConfiguration
;
import
org.opengroup.osdu.common.Validators
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
javax.inject.Named
;
import
org.springframework.context.annotation.Lazy
;
/**
* Implementation for IBlobServiceClientFactory.
...
...
@@ -31,8 +31,8 @@ public class BlobServiceClientFactoryImpl implements IBlobServiceClientFactory {
private
DefaultAzureCredential
defaultAzureCredential
;
@Autowired
@
Named
(
"STORAGE_ACCOUNT_NAME"
)
private
String
storageAccount
;
@
Lazy
private
BlobStoreConfiguration
blobStoreConfiguration
;
private
BlobServiceClient
blobServiceClient
;
...
...
@@ -42,9 +42,9 @@ public class BlobServiceClientFactoryImpl implements IBlobServiceClientFactory {
*/
public
BlobServiceClientFactoryImpl
()
{
Validators
.
checkNotNull
(
defaultAzureCredential
,
"Credential cannot be null"
);
Validators
.
checkNotNullAndNotEmpty
(
storageAccount
,
"KV URL
"
);
Validators
.
checkNotNullAndNotEmpty
(
blobStoreConfiguration
.
getStorageAccountName
(),
"Storage account name cannot be null
"
);
String
endpoint
=
String
.
format
(
"https://%s.blob.core.windows.net"
,
s
torageAccount
);
String
endpoint
=
String
.
format
(
"https://%s.blob.core.windows.net"
,
blobStoreConfiguration
.
getS
torageAccount
Name
()
);
blobServiceClient
=
new
BlobServiceClientBuilder
()
.
endpoint
(
endpoint
)
.
credential
(
defaultAzureCredential
)
...
...
src/main/java/org/opengroup/osdu/azure/di/BlobStoreConfiguration.java
0 → 100644
View file @
d8aad764
// Copyright © Microsoft Corporation
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package
org.opengroup.osdu.azure.di
;
import
lombok.Getter
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Lazy
;
/**
* A configuration bean class to set up blob store related variables.
*/
@Configuration
@Getter
@Lazy
public
class
BlobStoreConfiguration
{
@Value
(
"${azure.storage.account-name}"
)
private
String
storageAccountName
;
}
Write
Preview
Supports
Markdown
0%
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!
Cancel
Please
register
or
sign in
to comment