Skip to content
Snippets Groups Projects
Commit d3f90974 authored by Alan Braz's avatar Alan Braz Committed by Renan Souza
Browse files

update os-core-lib-ibm version and refactor

parent a206426a
No related branches found
No related tags found
1 merge request!6Trusted ibm
......@@ -46,13 +46,11 @@
<artifactId>indexer-core</artifactId>
<version>1.0.3</version>
</dependency>
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>os-core-lib-ibm</artifactId>
<version>0.1.1</version>
</dependency>
<dependency>
<groupId>org.opengroup.osdu</groupId>
<artifactId>os-core-lib-ibm</artifactId>
<version>0.1.2</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
......@@ -139,12 +137,12 @@
<version>3.0.0</version>
<scope>test</scope>
</dependency>
<dependency>
<!-- <dependency>
<groupId>org.codehaus.mojo</groupId>
<artifactId>cobertura-maven-plugin</artifactId>
<version>2.7</version>
<scope>test</scope>
</dependency>
</dependency> -->
</dependencies>
......
......@@ -15,14 +15,15 @@
package org.opengroup.osdu.indexer.ibm.persistence;
import javax.annotation.PostConstruct;
import javax.inject.Inject;
import org.opengroup.osdu.core.ibm.cloudant.ICloudantFactory;
import org.opengroup.osdu.core.ibm.cloudant.IBMCloudantClientFactory;
import org.opengroup.osdu.indexer.ibm.model.ElasticSettingSchema;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Repository;
import com.cloudant.client.api.CloudantClient;
import com.cloudant.client.api.Database;
......@@ -31,16 +32,27 @@ public class ElasticSettingSchemaRepositoryImpl implements ISchemaRepository {
private static final Logger logger = LoggerFactory.getLogger(ElasticSettingSchemaRepositoryImpl.class);
@Inject
private ICloudantFactory cloudantFactory;
@Value("${ibm.cloudant.url}")
private String url;
@Value("${ibm.cloudant.apikey}")
private String apiKey;
@Value("${ibm.cloudant.dbname.prefix:os-indexer}")
private String dbNamePrefix;
private Database db;
@PostConstruct
public void init(){
try {
db = cloudantFactory.getDatabase(ElasticSettingsDoc.DB_NAME);
IBMCloudantClientFactory iccFactory = new IBMCloudantClientFactory(url, apiKey);
CloudantClient cloudant = iccFactory.getClient();
System.out.println("dbNamePrefix: " + dbNamePrefix);
if (dbNamePrefix.charAt(dbNamePrefix.length() - 1) == '-') {
dbNamePrefix = dbNamePrefix.substring(0, dbNamePrefix.length()-1);
}
String dbFullName = dbNamePrefix.toLowerCase() + "-" + ElasticSettingsDoc.DB_NAME.toLowerCase();
System.out.println("dbFullName: " + dbFullName);
db = cloudant.database(dbFullName, true);
} catch (Exception e) {
e.printStackTrace();
}
......
......@@ -29,7 +29,7 @@ import org.opengroup.osdu.core.common.model.indexer.JobStatus;
import org.opengroup.osdu.core.common.model.indexer.RecordStatus;
import org.opengroup.osdu.core.common.service.coreis.JaxRsDpsLog;
import org.opengroup.osdu.core.common.spi.indexer.IPublisher;
import org.opengroup.osdu.core.ibm.messagebus.IRabbitMQFactory;
import org.opengroup.osdu.core.ibm.messagebus.IMessageFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.context.annotation.RequestScope;
......@@ -42,9 +42,8 @@ import com.google.gson.JsonElement;
@RequestScope
public class PublisherImpl implements IPublisher {
@Inject
IRabbitMQFactory rabbitMQ;
IMessageFactory rabbitMQ;
@Inject
private JaxRsDpsLog logger;
......
......@@ -47,11 +47,6 @@ STORAGE_RECORDS_BATCH_SIZE=20
#spring.security.oauth2.client.registration.azure.client-name=Azure
#
#
spring.security.user.name=opendes@byoc.local
spring.security.user.password=123
spring.security.user.roles=service.indexer.admin
#
#
## Azure AD configuration
#azure.activedirectory.client-id=ffb32b1a-c6fe-4ed0-819b-6ca483de3640
#azure.activedirectory.tenant-id=1668106e-2ae0-456a-bb7d-64b52104db99
......@@ -86,9 +81,6 @@ GAE_SERVICE=indexer
DEPLOYMENT_ENVIRONMENT=CLOUD
server.servlet.contextPath=/api/storage/v2/
logging.level.org.springframework.web=DEBUG
server.port=8080
......@@ -108,9 +100,3 @@ ibm.cloudant.apikey=_nvl7qBbJ292BpnZLpvlk00dFgFg48V7pHMHgdCbFdIF
ibm.cloudant.url=https://5be9693e-3324-400a-aadc-59908c132be2-bluemix.cloudant.com
ibm.rabbitmq.uri=amqps://ibm_cloud_45338a90_9047_4927_a6a4_67cd2f7ad9f7:32769652ee6c161f72fd4bcee2929a1866178092b90d22e7f0d7650b8d3b6fa1@e6530902-b278-496b-92bb-230dd55edf86.bn2a2vgd01r3l0hfmvc0.databases.appdomain.cloud:30270
ibm.cos.bucket.crn=crn:v1:bluemix:public:cloud-object-storage:global:a/59506c69395f4b3f979f594bd9dc385a:69aee223-b6b5-4a26-a95b-5a65badfa85d:bucket:osdu-storage-ibm-dev-test
ibm.cos.bucketName=osdu-storage-ibm-dev-test
ibm.cos.endpoint_url=s3.us-south.cloud-object-storage.appdomain.cloud
ibm.cos.api_key=_em_p3rmHlPAdx2EbJcg4JxHsPnVh2rQ1Aisw-c01HOj
ibm.cos.service_instance_id=crn:v1:bluemix:public:cloud-object-storage:global:a/59506c69395f4b3f979f594bd9dc385a:69aee223-b6b5-4a26-a95b-5a65badfa85d::
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment