Commit 60379044 authored by devesh bajpai's avatar devesh bajpai Committed by ethiraj krishnamanaidu
Browse files

Enhance package structure for WKS

parent 5b049899
package org.opengroup.osdu.wks.provider.azure;
import org.opengroup.osdu.wks.config.ThreadScopeBeanFactoryPostProcessor;
import org.opengroup.osdu.wks.config.scope.thread.ThreadScopeBeanFactoryPostProcessor;
import org.opengroup.osdu.wks.provider.interfaces.SubscriptionManager;
import org.opengroup.osdu.wks.service.SchemaService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
......
......@@ -5,14 +5,14 @@ import com.google.gson.JsonElement;
import com.google.gson.JsonParser;
import com.microsoft.azure.servicebus.IMessage;
import org.opengroup.osdu.core.common.model.http.DpsHeaders;
import org.opengroup.osdu.wks.config.ThreadScopeContextHolder;
import org.opengroup.osdu.wks.config.scope.thread.ThreadScopeContextHolder;
import org.opengroup.osdu.wks.exceptions.ApplicationException;
import org.opengroup.osdu.wks.exceptions.BadRequestException;
import org.opengroup.osdu.wks.model.RawRecordDetails;
import org.opengroup.osdu.wks.provider.azure.config.ThreadDpsHeaders;
import org.opengroup.osdu.wks.provider.azure.utils.AppInsightsMetric;
import org.opengroup.osdu.wks.provider.azure.utils.MDCContextMap;
import org.opengroup.osdu.wks.service.WKSService;
import org.opengroup.osdu.wks.service.wks.WksService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
......@@ -31,7 +31,7 @@ public class ProcessWKSTransform {
private static final String METRIC_NAME = "WKS-availability";
@Autowired
private WKSService wKSService;
private WksService wKSService;
@Autowired
private MDCContextMap mdcContextMap;
......
......@@ -3,7 +3,7 @@ package org.opengroup.osdu.wks.provider.azure.statusstore;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import org.opengroup.osdu.wks.model.RelationshipStatus;
import org.opengroup.osdu.wks.service.transformer.handler.relationship.model.RelationshipStatus;
import java.sql.Timestamp;
import java.util.List;
......
......@@ -4,7 +4,7 @@ import org.opengroup.osdu.azure.cosmosdb.CosmosStore;
import org.opengroup.osdu.core.common.model.http.AppException;
import org.opengroup.osdu.wks.config.RequestIdentity;
import org.opengroup.osdu.wks.exceptions.ApplicationException;
import org.opengroup.osdu.wks.model.RelationshipStatus;
import org.opengroup.osdu.wks.service.transformer.handler.relationship.model.RelationshipStatus;
import org.opengroup.osdu.wks.provider.azure.di.CosmosContainerConfig;
import org.opengroup.osdu.wks.provider.interfaces.StatusStoreService;
import org.slf4j.Logger;
......
......@@ -7,8 +7,8 @@ import org.opengroup.osdu.azure.blobstorage.BlobStore;
import org.opengroup.osdu.azure.cosmosdb.CosmosStore;
import org.opengroup.osdu.wks.config.RequestIdentity;
import org.opengroup.osdu.wks.constants.Constants;
import org.opengroup.osdu.wks.model.mapping.MappingDefinition;
import org.opengroup.osdu.wks.model.mapping.MappingInfo;
import org.opengroup.osdu.wks.service.transformer.model.mapping.MappingDefinition;
import org.opengroup.osdu.wks.service.transformer.model.mapping.MappingInfo;
import org.opengroup.osdu.wks.provider.azure.di.AzureBootstrapConfig;
import org.opengroup.osdu.wks.provider.azure.di.CosmosContainerConfig;
import org.opengroup.osdu.wks.provider.interfaces.MappingStore;
......
......@@ -28,7 +28,7 @@ import org.opengroup.osdu.wks.exceptions.BadRequestException;
import org.opengroup.osdu.wks.model.RawRecordDetails;
import org.opengroup.osdu.wks.provider.azure.config.ThreadDpsHeaders;
import org.opengroup.osdu.wks.provider.azure.utils.MDCContextMap;
import org.opengroup.osdu.wks.service.WKSService;
import org.opengroup.osdu.wks.service.wks.WksService;
import java.util.Collections;
......@@ -55,7 +55,7 @@ public class ProcessWKSTransformTest {
private ProcessWKSTransform processWKSTransform;
@Mock
private WKSService wksService;
private WksService wksService;
@Mock
private Message message;
......
......@@ -9,7 +9,7 @@ import org.mockito.junit.jupiter.MockitoExtension;
import org.opengroup.osdu.azure.cosmosdb.CosmosStore;
import org.opengroup.osdu.wks.config.RequestIdentity;
import org.opengroup.osdu.wks.exceptions.ApplicationException;
import org.opengroup.osdu.wks.model.RelationshipStatus;
import org.opengroup.osdu.wks.service.transformer.handler.relationship.model.RelationshipStatus;
import org.opengroup.osdu.wks.provider.azure.di.CosmosContainerConfig;
import static org.mockito.ArgumentMatchers.any;
......
......@@ -16,10 +16,10 @@ import org.opengroup.osdu.azure.blobstorage.BlobStore;
import org.opengroup.osdu.azure.cosmosdb.CosmosStore;
import org.opengroup.osdu.core.common.model.http.DpsHeaders;
import org.opengroup.osdu.wks.config.RequestIdentity;
import org.opengroup.osdu.wks.model.mapping.Mapping;
import org.opengroup.osdu.wks.model.mapping.MappingDefinition;
import org.opengroup.osdu.wks.model.mapping.MappingInfo;
import org.opengroup.osdu.wks.model.mapping.operation.Operation;
import org.opengroup.osdu.wks.service.transformer.model.mapping.Mapping;
import org.opengroup.osdu.wks.service.transformer.model.mapping.MappingDefinition;
import org.opengroup.osdu.wks.service.transformer.model.mapping.MappingInfo;
import org.opengroup.osdu.wks.service.transformer.model.mapping.operation.Operation;
import org.opengroup.osdu.wks.provider.azure.di.AzureBootstrapConfig;
import org.opengroup.osdu.wks.provider.azure.di.CosmosContainerConfig;
import com.azure.cosmos.models.SqlParameter;
......
......@@ -8,7 +8,7 @@ import org.opengroup.osdu.wks.constants.Constants;
import org.opengroup.osdu.wks.exceptions.ApplicationException;
import org.opengroup.osdu.wks.exceptions.BadRequestException;
import org.opengroup.osdu.wks.model.RawRecordDetails;
import org.opengroup.osdu.wks.service.WKSService;
import org.opengroup.osdu.wks.service.wks.WksService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -24,7 +24,7 @@ import lombok.extern.java.Log;
public class PubSubMessageReceiver implements MessageReceiver {
@Autowired
private WKSService wKSService;
private WksService wKSService;
@Override
public void receiveMessage(PubsubMessage pubsubMessage, AckReplyConsumer ackReplyConsumer) {
......
......@@ -5,9 +5,9 @@ import java.util.List;
import org.opengroup.osdu.wks.config.RequestIdentity;
import org.opengroup.osdu.wks.constants.Constants;
import org.opengroup.osdu.wks.constants.RelationshipInfo;
import org.opengroup.osdu.wks.service.transformer.handler.relationship.model.RelationshipInfo;
import org.opengroup.osdu.wks.exceptions.ApplicationException;
import org.opengroup.osdu.wks.model.RelationshipStatus;
import org.opengroup.osdu.wks.service.transformer.handler.relationship.model.RelationshipStatus;
import org.opengroup.osdu.wks.provider.interfaces.StatusStoreService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......
package org.opengroup.osdu.wks.storage;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.api.gax.paging.Page;
import com.google.cloud.storage.Blob;
import com.google.cloud.storage.Storage;
import com.google.cloud.storage.Storage.BlobListOption;
import lombok.extern.java.Log;
import org.opengroup.osdu.wks.constants.Constants;
import org.opengroup.osdu.wks.model.mapping.MappingDefinition;
import org.opengroup.osdu.wks.model.mapping.MappingInfo;
import org.opengroup.osdu.wks.service.transformer.model.mapping.MappingDefinition;
import org.opengroup.osdu.wks.service.transformer.model.mapping.MappingInfo;
import org.opengroup.osdu.wks.provider.interfaces.MappingStore;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
......
......@@ -16,13 +16,11 @@ import org.junit.rules.ExpectedException;
import org.junit.runner.RunWith;
import org.mockito.InjectMocks;
import org.mockito.Mock;
import org.mockito.Mockito;
import org.mockito.MockitoAnnotations;
import org.opengroup.osdu.wks.constants.Constants;
import org.opengroup.osdu.wks.exceptions.ApplicationException;
import org.opengroup.osdu.wks.exceptions.BadRequestException;
import org.opengroup.osdu.wks.model.RawRecordDetails;
import org.opengroup.osdu.wks.service.WKSService;
import org.opengroup.osdu.wks.service.wks.WksService;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.google.cloud.pubsub.v1.AckReplyConsumer;
......@@ -35,7 +33,7 @@ public class PubSubMessageReceiverTest {
@Mock
private WKSService wksService;
private WksService wksService;
@Rule
public ExpectedException expectedException = ExpectedException.none();
......
package org.opengroup.osdu.wks;
import org.opengroup.osdu.wks.config.ThreadScopeBeanFactoryPostProcessor;
import org.opengroup.osdu.wks.config.scope.thread.ThreadScopeBeanFactoryPostProcessor;
import org.opengroup.osdu.wks.provider.interfaces.SubscriptionManager;
import org.opengroup.osdu.wks.service.SchemaService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
......@@ -19,7 +18,7 @@ import org.springframework.web.client.RestTemplate;
})
public class WksServiceApplication {
private final static Logger LOGGER = LoggerFactory.getLogger(WksServiceApplication.class);
private static final Logger LOGGER = LoggerFactory.getLogger(WksServiceApplication.class);
public static void main(String[] args) {
ApplicationContext context = SpringApplication.run(WksServiceApplication.class, args);
try {
......@@ -31,14 +30,4 @@ public class WksServiceApplication {
LOGGER.error(e.getMessage(), e);
}
}
@Bean("restTemplate")
public RestTemplate restTemplate() {
return new RestTemplate();
}
@Bean
public static BeanFactoryPostProcessor beanFactoryPostProcessor() {
return new ThreadScopeBeanFactoryPostProcessor();
}
}
package org.opengroup.osdu.wks.config;
import org.opengroup.osdu.wks.config.scope.thread.ThreadScopeBeanFactoryPostProcessor;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
@Configuration
public class AppConfiguration {
@Bean("restTemplate")
public RestTemplate restTemplate() {
return new RestTemplate();
}
@Bean
public static BeanFactoryPostProcessor beanFactoryPostProcessor() {
return new ThreadScopeBeanFactoryPostProcessor();
}
}
package org.opengroup.osdu.wks.service;
package org.opengroup.osdu.wks.config;
import lombok.Getter;
import lombok.Setter;
......@@ -10,7 +10,7 @@ import org.springframework.context.annotation.Configuration;
@ConfigurationProperties("osdu.restclient")
@Getter
@Setter
public class RestClientConfig {
public class RestClientConfiguration {
@Value("#{new Integer('${searchRetryIntervalInSeconds:60}')}")
private Integer searchRetryIntervalInSeconds;
......
package org.opengroup.osdu.wks.service;
package org.opengroup.osdu.wks.config;
import lombok.Getter;
import lombok.Setter;
......@@ -9,7 +9,7 @@ import org.springframework.context.annotation.Configuration;
@ConfigurationProperties("osdu.host")
@Getter
@Setter
class ServiceHostConfiguration {
public class ServiceHostConfiguration {
private String searchServiceUrl;
private String storageServiceUrl;
private String schemaServiceUrl;
......
package org.opengroup.osdu.wks.config;
package org.opengroup.osdu.wks.config.scope.thread;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.ObjectFactory;
......
package org.opengroup.osdu.wks.config;
package org.opengroup.osdu.wks.config.scope.thread;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
......
package org.opengroup.osdu.wks.config;
package org.opengroup.osdu.wks.config.scope.thread;
import java.util.HashMap;
import java.util.Map;
......
package org.opengroup.osdu.wks.config;
package org.opengroup.osdu.wks.config.scope.thread;
public final class ThreadScopeContextHolder {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment