Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
Open Subsurface Data Universe Software
Platform
System
Register
Commits
0c87c5c0
Commit
0c87c5c0
authored
Jan 12, 2021
by
ethiraj krishnamanaidu
Browse files
Merge branch 'issue_18' into 'master'
Removes google dependency from core module See merge request
!57
parents
976b9e13
84b63c2a
Pipeline
#21654
failed with stages
in 48 minutes and 32 seconds
Changes
37
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
.gitlab-ci.yml
View file @
0c87c5c0
...
...
@@ -25,7 +25,7 @@ include:
file
:
"
build/maven.yml"
-
project
:
"
osdu/platform/ci-cd-pipelines"
file
:
"
scanners/fossa.yml"
file
:
"
scanners/fossa
-maven
.yml"
-
project
:
"
osdu/platform/ci-cd-pipelines"
file
:
"
cloud-providers/gcp.yml"
...
...
NOTICE
View file @
0c87c5c0
...
...
@@ -39,19 +39,13 @@ The following software have components provided under the terms of this license:
- FindBugs-jsr305 (from http://findbugs.sourceforge.net/)
- Google APIs Client Library for Java (from )
- Google App Engine extensions to the Google HTTP Client Library for Java. (from )
- Google App Engine extensions to the Google HTTP Client Library for Java. (from )
- Google Cloud Core (from https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-core)
- Google Cloud Core (from https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-core)
- Google Cloud Core HTTP (from https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-core-http)
- Google Cloud Core HTTP (from https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-core-http)
- Google Cloud Core gRPC (from https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-core-grpc)
- Google Cloud Core gRPC (from https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-core-grpc)
- Google Cloud Datastore (from https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-datastore)
- Google Cloud Datastore (from https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-datastore)
- Google Cloud Key Management Service (KMS) API v1-rev22-1.23.0 (from )
- Google Cloud Logging (from https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-logging)
- Google Cloud Pub/Sub (from https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-pubsub)
- Google Cloud Pub/Sub (from https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-pubsub)
- Google Cloud Storage (from https://github.com/GoogleCloudPlatform/google-cloud-java/tree/master/google-cloud-storage)
- Google HTTP Client Library for Java (from https://github.com/google/google-http-java-client.git)
- Google OAuth Client Library for Java (from )
...
...
@@ -106,8 +100,8 @@ The following software have components provided under the terms of this license:
- Lucene Spatial Extras (from )
- Lucene Suggest (from )
- MapStruct Core (from )
- Mockito (from http://www.mockito.org)
- Mockito (from http://mockito.org)
- Mockito (from http://www.mockito.org)
- Netty/Buffer (from http://netty.io/)
- Netty/Codec (from )
- Netty/Common (from )
...
...
@@ -150,10 +144,8 @@ The following software have components provided under the terms of this license:
- aggs-matrix-stats (from https://github.com/elastic/elasticsearch)
- cli (from https://github.com/elastic/elasticsearch)
- com.google.api.grpc:grpc-google-cloud-pubsub-v1 (from https://github.com/googleapis/googleapis)
- com.google.api.grpc:grpc-google-cloud-pubsub-v1 (from https://github.com/googleapis/googleapis)
- com.google.api.grpc:proto-google-cloud-logging-v2 (from https://github.com/googleapis/googleapis)
- com.google.api.grpc:proto-google-cloud-pubsub-v1 (from https://github.com/googleapis/googleapis)
- com.google.api.grpc:proto-google-cloud-pubsub-v1 (from https://github.com/googleapis/googleapis)
- com.google.api.grpc:proto-google-common-protos (from https://github.com/googleapis/googleapis)
- com.google.api.grpc:proto-google-iam-v1 (from https://github.com/googleapis/googleapis)
- commons-collections (from )
...
...
@@ -175,8 +167,8 @@ The following software have components provided under the terms of this license:
- jackson-databind (from http://github.com/FasterXML/jackson)
- jakarta.inject (from )
- javaparser-core (from )
- javax.inject (from )
- javax.inject (from http://code.google.com/p/atinject/)
- javax.inject (from )
- javax.ws.rs-api (from http://jax-rs-spec.java.net)
- jersey-container-servlet (from git://java.net/jersey~code/project/jersey-container-servlet)
- jersey-container-servlet-core (from git://java.net/jersey~code/project/jersey-container-servlet-core)
...
...
@@ -207,7 +199,6 @@ The following software have components provided under the terms of this license:
- powermock-reflect (from )
- powermock-reflect (from )
- proto-google-cloud-datastore-v1 (from https://github.com/googleapis/api-client-staging)
- proto-google-cloud-datastore-v1 (from https://github.com/googleapis/api-client-staging)
- rank-eval (from https://github.com/elastic/elasticsearch)
- rest (from https://github.com/elastic/elasticsearch)
- rest-high-level (from https://github.com/elastic/elasticsearch)
...
...
@@ -577,6 +568,4 @@ The following software have components provided under the terms of this license:
- jersey-ext-entity-filtering (from )
- jersey-inject-hk2 (from )
- jersey-media-jaxb (from )
- jersey-spring4 (from )
- jersey-spring4 (from )
\ No newline at end of file
provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/action/ActionDoc.java
View file @
0c87c5c0
...
...
@@ -14,14 +14,24 @@
package
org.opengroup.osdu.register.provider.aws.action
;
import
com.amazonaws.services.dynamodbv2.datamodeling.*
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
lombok.*
;
import
java.sql.Timestamp
;
import
org.opengroup.osdu.register.action.model.Action
;
import
org.opengroup.osdu.register.action.model.Filter
;
import
java.sql.Timestamp
;
import
com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBAttribute
;
import
com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBHashKey
;
import
com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTable
;
import
com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTypeConverted
;
import
com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBTypeConverter
;
import
com.fasterxml.jackson.core.type.TypeReference
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
lombok.SneakyThrows
;
@Data
...
...
@@ -107,9 +117,7 @@ public class ActionDoc {
action
.
setImg
(
actionDoc
.
getImg
());
action
.
setUrl
(
actionDoc
.
getUrl
());
action
.
setContactEmail
(
actionDoc
.
getContactEmail
());
Timestamp
sqlTimestamp
=
Timestamp
.
valueOf
(
actionDoc
.
getCreatedOnEpoch
());
com
.
google
.
cloud
.
Timestamp
t
=
com
.
google
.
cloud
.
Timestamp
.
of
(
sqlTimestamp
);
action
.
setCreatedOnEpoch
(
t
);
action
.
setCreatedOnEpoch
(
Timestamp
.
valueOf
(
actionDoc
.
getCreatedOnEpoch
()));
action
.
setFilter
(
actionDoc
.
getFilter
());
return
action
;
}
...
...
provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/ddms/DdmsDoc.java
View file @
0c87c5c0
...
...
@@ -104,9 +104,7 @@ public class DdmsDoc {
ddms
.
setName
(
ddmsDoc
.
getName
());
ddms
.
setDescription
(
ddmsDoc
.
getDescription
());
ddms
.
setContactEmail
(
ddmsDoc
.
getContactEmail
());
Timestamp
sqlTimestamp
=
Timestamp
.
valueOf
(
ddmsDoc
.
getCreatedDateTimeEpoch
());
com
.
google
.
cloud
.
Timestamp
t
=
com
.
google
.
cloud
.
Timestamp
.
of
(
sqlTimestamp
);
ddms
.
setCreatedDateTimeEpoch
(
t
);
ddms
.
setCreatedDateTimeEpoch
(
Timestamp
.
valueOf
(
ddmsDoc
.
getCreatedDateTimeEpoch
()));
ddms
.
setInterfaces
(
ddmsDoc
.
getInterfaces
());
return
ddms
;
}
...
...
provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/subscriber/AwsSubscriptionRepo.java
View file @
0c87c5c0
...
...
@@ -13,37 +13,32 @@
// limitations under the License.
package
org.opengroup.osdu.register.provider.aws.subscriber
;
import
com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBDeleteExpression
;
import
com.amazonaws.services.dynamodbv2.datamodeling.PaginatedQueryList
;
import
com.amazonaws.services.dynamodbv2.model.AttributeValue
;
import
com.amazonaws.services.dynamodbv2.model.ConditionalCheckFailedException
;
import
com.amazonaws.services.sns.AmazonSNS
;
import
com.google.cloud.Timestamp
;
import
java.nio.ByteBuffer
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
javax.annotation.PostConstruct
;
import
javax.inject.Inject
;
import
org.opengroup.osdu.core.aws.dynamodb.DynamoDBQueryHelper
;
import
org.opengroup.osdu.core.aws.sns.AmazonSNSConfig
;
import
org.opengroup.osdu.core.aws.ssm.ParameterStorePropertySource
;
import
org.opengroup.osdu.core.aws.ssm.SSMConfig
;
import
org.opengroup.osdu.core.common.logging.JaxRsDpsLog
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
import
org.opengroup.osdu.core.common.model.http.DpsHeaders
;
import
org.opengroup.osdu.register.provider.aws.action.ActionDoc
;
import
org.opengroup.osdu.register.provider.aws.config.AwsServiceConfig
;
import
org.opengroup.osdu.register.provider.aws.util.DocUtil
;
import
org.opengroup.osdu.register.provider.interfaces.subscriber.ISubscriptionRepository
;
import
org.opengroup.osdu.register.subscriber.model.
*
;
import
org.opengroup.osdu.register.
utils.Constants
;
import
org.opengroup.osdu.register.subscriber.model.
Secret
;
import
org.opengroup.osdu.register.
subscriber.model.Subscription
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
javax.annotation.PostConstruct
;
import
javax.inject.Inject
;
import
java.nio.ByteBuffer
;
import
java.text.MessageFormat
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
com.amazonaws.services.dynamodbv2.datamodeling.DynamoDBDeleteExpression
;
import
com.amazonaws.services.dynamodbv2.model.AttributeValue
;
import
com.amazonaws.services.dynamodbv2.model.ConditionalCheckFailedException
;
@Repository
public
class
AwsSubscriptionRepo
implements
ISubscriptionRepository
{
...
...
provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/subscriber/SubscriptionDoc.java
View file @
0c87c5c0
...
...
@@ -111,10 +111,7 @@ public class SubscriptionDoc {
sub
.
setTopic
(
subDoc
.
getTopic
());
sub
.
setPushEndpoint
(
subDoc
.
getPushEndpoint
());
sub
.
setCreatedBy
(
subDoc
.
getCreatedBy
());
Timestamp
sqlTimestamp
=
Timestamp
.
valueOf
(
subDoc
.
getCreatedOnEpoch
());
com
.
google
.
cloud
.
Timestamp
t
=
com
.
google
.
cloud
.
Timestamp
.
of
(
sqlTimestamp
);
sub
.
setCreatedOnEpoch
(
t
);
//sub.setCreatedOnEpoch( com.google.cloud.Timestamp.of(subDoc.getCreatedOnEpoch()));
sub
.
setCreatedOnEpoch
(
Timestamp
.
valueOf
(
subDoc
.
getCreatedOnEpoch
()));
sub
.
setNotificationId
(
subDoc
.
getNotificationId
());
sub
.
setSecret
(
secret
);
...
...
provider/register-aws/src/main/java/org/opengroup/osdu/register/provider/aws/verifier/GsaTokenVerifierImpl.java
0 → 100644
View file @
0c87c5c0
package
org.opengroup.osdu.register.provider.aws.verifier
;
import
org.apache.http.HttpStatus
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
import
org.opengroup.osdu.register.provider.interfaces.verifier.GsaTokenVerifier
;
import
org.springframework.stereotype.Component
;
@Component
public
class
GsaTokenVerifierImpl
implements
GsaTokenVerifier
{
public
boolean
verify
(
String
token
)
{
throw
new
AppException
(
HttpStatus
.
SC_NOT_IMPLEMENTED
,
"Not implemented"
,
"Not implemented"
);
}
}
provider/register-aws/src/test/java/org/opengroup/osdu/register/provider/aws/verifier/GsaTokenVerifierImplTest.java
0 → 100644
View file @
0c87c5c0
package
org.opengroup.osdu.register.provider.aws.verifier
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.mockito.InjectMocks
;
import
org.mockito.runners.MockitoJUnitRunner
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
@RunWith
(
MockitoJUnitRunner
.
class
)
public
class
GsaTokenVerifierImplTest
{
@InjectMocks
private
GsaTokenVerifierImpl
gsaTokenVerifier
;
@Test
public
void
verify_throw501_whenDoesNotImplemented
()
throws
Exception
{
try
{
gsaTokenVerifier
.
verify
(
"token"
);
}
catch
(
AppException
ex
)
{
assertEquals
(
501
,
ex
.
getError
().
getCode
());
}
}
}
\ No newline at end of file
provider/register-azure/src/main/java/org/opengroup/osdu/register/provider/azure/action/ActionRepository.java
View file @
0c87c5c0
...
...
@@ -14,24 +14,23 @@
package
org.opengroup.osdu.register.provider.azure.action
;
import
com.azure.cosmos.models.CosmosQueryRequestOptions
;
import
com.azure.cosmos.models.SqlParameter
;
import
com.azure.cosmos.models.SqlQuerySpec
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
org.opengroup.osdu.azure.cosmosdb.CosmosStore
;
import
org.opengroup.osdu.core.common.logging.JaxRsDpsLog
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
import
org.opengroup.osdu.core.common.model.http.DpsHeaders
;
import
org.opengroup.osdu.register.action.model.Action
;
import
org.opengroup.osdu.register.provider.azure.di.AzureBootstrapConfig
;
import
org.opengroup.osdu.register.provider.azure.di.CosmosContainerConfig
;
import
org.opengroup.osdu.register.provider.interfaces.action.IActionRepo
;
import
org.opengroup.osdu.azure.cosmosdb.CosmosStore
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
com.google.cloud.Timestamp
;
import
java.util.List
;
import
java.util.concurrent.locks.ReentrantLock
;
import
java.util.stream.Collectors
;
import
org.opengroup.osdu.core.common.model.http.DpsHeaders
;
import
com.azure.cosmos.models.CosmosQueryRequestOptions
;
import
com.azure.cosmos.models.SqlParameter
;
import
com.azure.cosmos.models.SqlQuerySpec
;
@Repository
public
class
ActionRepository
implements
IActionRepo
{
...
...
@@ -127,7 +126,7 @@ public class ActionRepository implements IActionRepo {
action
.
setImg
(
doc
.
getImg
());
action
.
setUrl
(
doc
.
getUrl
());
action
.
setContactEmail
(
doc
.
getContactEmail
());
action
.
setCreatedOnEpoch
(
Timestamp
.
of
(
doc
.
getCreatedOnEpoch
())
)
;
action
.
setCreatedOnEpoch
(
doc
.
getCreatedOnEpoch
());
action
.
setFilter
(
doc
.
getFilter
());
return
action
;
}
...
...
provider/register-azure/src/main/java/org/opengroup/osdu/register/provider/azure/ddms/DdmsRepository.java
View file @
0c87c5c0
...
...
@@ -14,25 +14,24 @@
package
org.opengroup.osdu.register.provider.azure.ddms
;
import
com.azure.cosmos.models.CosmosQueryRequestOptions
;
import
com.azure.cosmos.models.SqlParameter
;
import
com.azure.cosmos.models.SqlQuerySpec
;
import
com.google.cloud.Timestamp
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
org.opengroup.osdu.azure.cosmosdb.CosmosStore
;
import
org.opengroup.osdu.core.common.logging.JaxRsDpsLog
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
import
org.opengroup.osdu.core.common.model.http.DpsHeaders
;
import
org.opengroup.osdu.register.ddms.model.Ddms
;
import
org.opengroup.osdu.register.ddms.model.RegisteredInterface
;
import
org.opengroup.osdu.register.provider.azure.di.AzureBootstrapConfig
;
import
org.opengroup.osdu.register.provider.azure.di.CosmosContainerConfig
;
import
org.opengroup.osdu.register.provider.interfaces.ddms.IDdmsRepository
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.concurrent.locks.ReentrantLock
;
import
java.util.stream.Collectors
;
import
com.azure.cosmos.models.CosmosQueryRequestOptions
;
import
com.azure.cosmos.models.SqlParameter
;
import
com.azure.cosmos.models.SqlQuerySpec
;
@Repository
public
class
DdmsRepository
implements
IDdmsRepository
{
...
...
@@ -126,7 +125,7 @@ public class DdmsRepository implements IDdmsRepository {
ddms
.
setName
(
doc
.
getName
());
ddms
.
setDescription
(
doc
.
getDescription
());
ddms
.
setContactEmail
(
doc
.
getContactEmail
());
ddms
.
setCreatedDateTimeEpoch
(
Timestamp
.
of
(
doc
.
getCreatedDateTimeEpoch
())
)
;
ddms
.
setCreatedDateTimeEpoch
(
doc
.
getCreatedDateTimeEpoch
());
ddms
.
setInterfaces
(
doc
.
getInterfaces
().
stream
().
map
(
this
::
convertToRegisteredInterfaceClass
).
collect
(
Collectors
.
toSet
()));
return
ddms
;
}
...
...
provider/register-azure/src/main/java/org/opengroup/osdu/register/provider/azure/subscriber/SubscriptionRepository.java
View file @
0c87c5c0
...
...
@@ -14,10 +14,10 @@
package
org.opengroup.osdu.register.provider.azure.subscriber
;
import
com.azure.cosmos.models.CosmosQueryRequestOptions
;
import
com.azure.cosmos.models.SqlParameter
;
import
com.azure.cosmos.models.SqlQuerySpec
;
import
com.google.cloud.Timestamp
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
import
org.opengroup.osdu.azure.cosmosdb.CosmosStore
;
import
org.opengroup.osdu.core.common.logging.JaxRsDpsLog
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
...
...
@@ -35,9 +35,9 @@ import org.opengroup.osdu.register.utils.Constants;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.stream.Collectors
;
import
com.azure.cosmos.models.CosmosQueryRequestOptions
;
import
com.azure.cosmos.models.SqlParameter
;
import
com.azure.cosmos.models.SqlQuerySpec
;
@Repository
public
class
SubscriptionRepository
implements
ISubscriptionRepository
{
...
...
@@ -307,6 +307,6 @@ public class SubscriptionRepository implements ISubscriptionRepository {
secret
=
hmacSecret
;
}
return
new
Subscription
(
doc
.
getId
(),
doc
.
getName
(),
doc
.
getDescription
(),
doc
.
getTopic
(),
doc
.
getPushEndpoint
(),
doc
.
getCreatedBy
(),
Timestamp
.
of
(
doc
.
getCreatedOnEpoch
()
)
,
doc
.
getNotificationId
(),
secret
);
doc
.
getCreatedBy
(),
doc
.
getCreatedOnEpoch
(),
doc
.
getNotificationId
(),
secret
);
}
}
provider/register-azure/src/main/java/org/opengroup/osdu/register/provider/azure/verifier/GsaTokenVerifierImpl.java
0 → 100644
View file @
0c87c5c0
package
org.opengroup.osdu.register.provider.azure.verifier
;
import
org.apache.http.HttpStatus
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
import
org.opengroup.osdu.register.provider.interfaces.verifier.GsaTokenVerifier
;
import
org.springframework.stereotype.Component
;
@Component
public
class
GsaTokenVerifierImpl
implements
GsaTokenVerifier
{
public
boolean
verify
(
String
token
)
{
throw
new
AppException
(
HttpStatus
.
SC_NOT_IMPLEMENTED
,
"Not implemented"
,
"Not implemented"
);
}
}
provider/register-azure/src/test/java/org/opengroup/osdu/register/provider/azure/verifier/GsaTokenVerifierImplTest.java
0 → 100644
View file @
0c87c5c0
package
org.opengroup.osdu.register.provider.azure.verifier
;
import
static
org
.
junit
.
Assert
.
assertEquals
;
import
org.junit.Test
;
import
org.junit.jupiter.api.extension.ExtendWith
;
import
org.mockito.InjectMocks
;
import
org.mockito.junit.jupiter.MockitoExtension
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
@ExtendWith
(
MockitoExtension
.
class
)
public
class
GsaTokenVerifierImplTest
{
@InjectMocks
private
GsaTokenVerifierImpl
gsaTokenVerifier
;
@Test
public
void
verify_throw501_whenDoesNotImplemented
()
throws
Exception
{
try
{
gsaTokenVerifier
.
verify
(
"token"
);
}
catch
(
AppException
ex
)
{
assertEquals
(
501
,
ex
.
getError
().
getCode
());
}
}
}
\ No newline at end of file
provider/register-gcp/src/main/java/org/opengroup/osdu/register/provider/gcp/action/datastore/DatastoreActionRepo.java
View file @
0c87c5c0
...
...
@@ -16,22 +16,34 @@
package
org.opengroup.osdu.register.provider.gcp.action.datastore
;
import
com.google.cloud.datastore.*
;
import
com.google.gson.Gson
;
import
lombok.Getter
;
import
java.util.ArrayList
;
import
java.util.List
;
import
org.apache.http.HttpStatus
;
import
org.opengroup.osdu.register.action.model.Action
;
import
org.opengroup.osdu.register.provider.interfaces.action.IActionRepo
;
import
org.opengroup.osdu.core.common.logging.JaxRsDpsLog
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
import
org.opengroup.osdu.core.common.model.tenant.TenantInfo
;
import
org.opengroup.osdu.core.common.util.Crc32c
;
import
org.opengroup.osdu.register.action.model.Action
;
import
org.opengroup.osdu.register.provider.gcp.ddms.datastore.DatastoreMultiTenantAccess
;
import
org.opengroup.osdu.
core.common.model.http.AppException
;
import
org.opengroup.osdu.
register.provider.interfaces.action.IActionRepo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
java.util.ArrayList
;
import
java.util.List
;
import
com.google.cloud.Timestamp
;
import
com.google.cloud.datastore.Datastore
;
import
com.google.cloud.datastore.DatastoreException
;
import
com.google.cloud.datastore.Entity
;
import
com.google.cloud.datastore.FullEntity
;
import
com.google.cloud.datastore.Key
;
import
com.google.cloud.datastore.Query
;
import
com.google.cloud.datastore.QueryResults
;
import
com.google.cloud.datastore.StringValue
;
import
com.google.cloud.datastore.Transaction
;
import
com.google.cloud.datastore.Value
;
import
com.google.gson.Gson
;
import
lombok.Getter
;
@Repository
public
class
DatastoreActionRepo
implements
IActionRepo
{
...
...
@@ -203,7 +215,7 @@ public class DatastoreActionRepo implements IActionRepo {
output
.
setUrl
(
entity
.
getString
(
URL
));
output
.
setImg
(
entity
.
getString
(
IMG
));
output
.
setContactEmail
(
entity
.
getString
(
CONTACT_EMAIL
));
output
.
setCreatedOnEpoch
(
entity
.
getTimestamp
(
CREATED_ON
));
output
.
setCreatedOnEpoch
(
entity
.
getTimestamp
(
CREATED_ON
)
.
toSqlTimestamp
()
);
output
.
getFilter
().
setEntityType
(
types
);
output
.
getFilter
().
setSource
(
sources
);
output
.
getFilter
().
setVersion
(
versions
);
...
...
@@ -220,7 +232,7 @@ public class DatastoreActionRepo implements IActionRepo {
FullEntity
.
Builder
entity
=
FullEntity
.
newBuilder
(
key
)
.
set
(
NAME
,
action
.
getName
())
.
set
(
CREATED_ON
,
action
.
getCreatedOnEpoch
())
.
set
(
CREATED_ON
,
Timestamp
.
of
(
action
.
getCreatedOnEpoch
())
)
.
set
(
CONTACT_EMAIL
,
action
.
getContactEmail
())
.
set
(
IMG
,
action
.
getImg
())
.
set
(
URL
,
action
.
getUrl
())
...
...
provider/register-gcp/src/main/java/org/opengroup/osdu/register/provider/gcp/ddms/datastore/DatastoreDdmsRepository.java
View file @
0c87c5c0
...
...
@@ -16,19 +16,31 @@
package
org.opengroup.osdu.register.provider.gcp.ddms.datastore
;
import
com.google.cloud.datastore.*
;
import
com.google.gson.Gson
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
import
org.opengroup.osdu.core.common.model.tenant.TenantInfo
;
import
org.opengroup.osdu.register.ddms.model.Ddms
;
import
org.opengroup.osdu.register.ddms.model.RegisteredInterface
;
import
org.opengroup.osdu.register.provider.interfaces.ddms.IDdmsRepository
;
import
org.opengroup.osdu.core.common.model.http.AppException
;
import
org.opengroup.osdu.core.common.model.tenant.TenantInfo
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Repository
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
com.google.cloud.Timestamp
;
import
com.google.cloud.datastore.Datastore
;
import
com.google.cloud.datastore.DatastoreException
;
import
com.google.cloud.datastore.Entity
;
import
com.google.cloud.datastore.EntityValue
;
import
com.google.cloud.datastore.FullEntity
;
import
com.google.cloud.datastore.IncompleteKey
;
import
com.google.cloud.datastore.Key
;
import
com.google.cloud.datastore.Query
;
import
com.google.cloud.datastore.QueryResults
;
import
com.google.cloud.datastore.StringValue
;
import
com.google.cloud.datastore.Transaction
;
import
com.google.gson.Gson
;
@Repository
public
class
DatastoreDdmsRepository
implements
IDdmsRepository
{
...
...
@@ -153,7 +165,7 @@ public class DatastoreDdmsRepository implements IDdmsRepository {
ddms
.
setName
(
entity
.
getString
(
NAME
));
ddms
.
setDescription
(
entity
.
getString
(
DESCRIPTION
));
ddms
.
setContactEmail
(
entity
.
getString
(
CONTACT_EMAIL
));
ddms
.
setCreatedDateTimeEpoch
(
entity
.
getTimestamp
(
CREATED_ON
));
ddms
.
setCreatedDateTimeEpoch
(
entity
.
getTimestamp
(
CREATED_ON
)
.
toSqlTimestamp
()
);
List
<
EntityValue
>
dsInterfaces
=
entity
.
getList
(
INTERFACES
);
dsInterfaces
.
forEach
(
i
->
{
RegisteredInterface
ri
=
new
RegisteredInterface
();
...
...
@@ -169,7 +181,7 @@ public class DatastoreDdmsRepository implements IDdmsRepository {
FullEntity
.
Builder
entity
=
FullEntity
.
newBuilder
(
key
)
.
set
(
NAME
,
ddms
.
getName
())
.
set
(
CREATED_ON
,
ddms
.
getCreatedDateTimeEpoch
())
.
set
(
CREATED_ON
,
Timestamp
.
of
(
ddms
.
getCreatedDateTimeEpoch
())
)
.
set
(
CONTACT_EMAIL
,
ddms
.
getContactEmail
())
.
set
(
DESCRIPTION
,
StringValue
.
newBuilder
(
ddms
.
getDescription
()).
setExcludeFromIndexes
(
true
).
build
());
...
...
provider/register-gcp/src/main/java/org/opengroup/osdu/register/provider/gcp/subscriber/ModelEntityHelper.java
View file @
0c87c5c0
...
...
@@ -29,6 +29,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Component
;
import
java.io.IOException
;
import
java.time.Instant
;
@Component
class
ModelEntityHelper
{
...
...
@@ -64,7 +65,7 @@ class ModelEntityHelper {
output
.
setNotificationId
(
entity
.
getString
(
SUBSCRIPTION
));
output
.
setPushEndpoint
(
entity
.
getString
(
PUSH_ENDPOINT
));
output
.
setCreatedBy
(
entity
.
getString
(
CREATED_BY
));
output
.
setCreatedOnEpoch
(
entity
.
getTimestamp
(
CREATED_ON
));
output
.
setCreatedOnEpoch
(
entity
.
getTimestamp
(
CREATED_ON
)
.
toSqlTimestamp
()
);
String
decryptedValue
=
kmsClient
.
decryptString
(
entity
.
getString
(
SECRET_VALUE
));
if
(
entity
.
getString
(
SECRET_TYPE
).
equals
(
Constants
.
GSASecret
))
{
...
...
@@ -81,8 +82,7 @@ class ModelEntityHelper {
}
FullEntity
convertSubscriptionToEntity
(
Subscription
subscription
,
Key
key
)
throws
IOException
{
Timestamp
timeNow
=
Timestamp
.
now
();
subscription
.
setCreatedOnEpoch
(
timeNow
);
subscription
.
setCreatedOnEpoch
(
java
.
sql
.
Timestamp
.
from
(
Instant
.
now
()));
String
encryptedString
=
kmsClient
.
encryptString
(
subscription
.
getSecret
().
toString
());
FullEntity
.
Builder
entity
=
FullEntity
.
newBuilder
(
key
)
.
set
(
NAME
,
subscription
.
getName
())
...
...
provider/register-gcp/src/main/java/org/opengroup/osdu/register/provider/gcp/verifier/GsaTokenVerifierImpl.java
0 → 100644
View file @
0c87c5c0
package
org.opengroup.osdu.register.provider.gcp.verifier
;
import
java.util.Collections
;
import
org.opengroup.osdu.register.provider.interfaces.verifier.GsaTokenVerifier
;
import
org.opengroup.osdu.register.utils.AppServiceConfig
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
com.google.api.client.googleapis.auth.oauth2.GoogleIdToken
;