Commit 535c2a79 authored by Komal Makkar's avatar Komal Makkar
Browse files

checkstyle fix

parent bf5158f3
......@@ -310,7 +310,7 @@
<artifactId>maven-surefire-plugin</artifactId>
<version>${maven.surefire.version}</version>
</plugin>
<!--<plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${checkstyle.version}</version>
......@@ -331,7 +331,8 @@
</goals>
</execution>
</executions>
</plugin>-->
</plugin>
</plugins>
</build>
</project>
......@@ -21,10 +21,8 @@ import org.opengroup.osdu.azure.cosmosdb.CosmosStoreBulkOperations;
import org.opengroup.osdu.azure.partition.PartitionServiceEventGridClient;
import org.opengroup.osdu.azure.partition.adapters.EventGridPartitionConfigAdapter;
import org.opengroup.osdu.azure.partition.adapters.IAzureResourcePartitionConfigAdapter;
import org.opengroup.osdu.azure.partition.models.EventGridPartitionConfig;
import org.opengroup.osdu.azure.partition.models.EventGridTopicPartitionInfoAzure;
import org.opengroup.osdu.azure.partition.providers.PartitionInfoProvider;
import org.opengroup.osdu.core.common.logging.ILogger;
import org.opengroup.osdu.core.common.model.http.AppException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -69,12 +67,23 @@ public class EventGridTopicStore {
private IEventGridTopicClientFactory eventGridTopicClientFactory;
private PartitionServiceEventGridClient eventGridPartitionClient;
/**
* Autowired Constructor.
*
* @param partitionInfoProviders partitionInfoProvider
* @param eventGridTopicClientFactories eventGridTopicClientFactory
* @param eventGridPartitionClients eventGridPartitionClient
* @param eventGridPartitionConfigAdapters eventGridPartitionConfigAdapter
*/
@Autowired
public EventGridTopicStore(PartitionInfoProvider partitionInfoProvider, IEventGridTopicClientFactory eventGridTopicClientFactory, PartitionServiceEventGridClient eventGridPartitionClient) {
this.adapter = new EventGridPartitionConfigAdapter();
this.partitionInfoProvider = partitionInfoProvider;
this.eventGridTopicClientFactory = eventGridTopicClientFactory;
this.eventGridPartitionClient = eventGridPartitionClient;
public EventGridTopicStore(final PartitionInfoProvider partitionInfoProviders,
final IEventGridTopicClientFactory eventGridTopicClientFactories,
final PartitionServiceEventGridClient eventGridPartitionClients,
final EventGridPartitionConfigAdapter eventGridPartitionConfigAdapters) {
this.adapter = eventGridPartitionConfigAdapters;
this.partitionInfoProvider = partitionInfoProviders;
this.eventGridTopicClientFactory = eventGridTopicClientFactories;
this.eventGridPartitionClient = eventGridPartitionClients;
}
/**
......
......@@ -24,8 +24,9 @@ import java.util.List;
*/
@Service
@Lazy
public class PartitionServiceClient{
public class PartitionServiceClient {
private final Gson gson = new Gson();
@Autowired
private IPartitionFactory partitionFactory;
@Autowired
......@@ -35,8 +36,6 @@ public class PartitionServiceClient{
@Autowired
private DpsHeaders headers;
private final Gson gson = new Gson();
/**
* Get partition info.
*
......@@ -83,7 +82,8 @@ public class PartitionServiceClient{
/**
* Get Service client for Partition Service.
*getPartitionInfo
* getPartitionInfo
*
* @return PartitionServiceClient
*/
private IPartitionProvider getServiceClient() {
......
......@@ -14,23 +14,25 @@
package org.opengroup.osdu.azure.partition.adapters;
import com.azure.security.keyvault.secrets.SecretClient;
import org.opengroup.osdu.azure.partition.models.EventGridPartitionConfig;
import org.opengroup.osdu.azure.partition.models.EventGridTopicPartitionInfoAzure;
import org.opengroup.osdu.core.common.partition.PartitionInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.HashMap;
/**
* Event Grid Adapter
*/
@Component
public class EventGridPartitionConfigAdapter implements IAzureResourcePartitionConfigAdapter {
@Autowired
private SecretClient secretClient;
/**
* @param partitionInfo partitionInfo
* @param partitionId partitionId
* @return EventGridPartitionConfig
*/
@Override
public EventGridPartitionConfig getConfig(PartitionInfo partitionInfo, String partitionId) {
return new EventGridPartitionConfig(new HashMap<String, EventGridTopicPartitionInfoAzure>());
public EventGridPartitionConfig getConfig(final PartitionInfo partitionInfo, final String partitionId) {
return new EventGridPartitionConfig(new HashMap<>());
}
}
......@@ -16,8 +16,16 @@ package org.opengroup.osdu.azure.partition.adapters;
import org.opengroup.osdu.core.common.partition.PartitionInfo;
public interface IAzureResourcePartitionConfigAdapter<T> {
public <T> T getConfig(PartitionInfo partitionInfo, String partitionId);
/**
* Contracting Adapters for PartitionInfo to Azure Resource Config (data model).
*/
public interface IAzureResourcePartitionConfigAdapter {
/**
* @param partitionInfo partitionInfo
* @param partitionId partitionId
* @param <T> config generics
* @return config
*/
<T> T getConfig(PartitionInfo partitionInfo, String partitionId);
}
......@@ -19,8 +19,11 @@ import lombok.Getter;
import java.util.Map;
/**
* Azure data partition variables for Event Grid.
*/
@AllArgsConstructor
@Getter
public class EventGridPartitionConfig {
Map<String, EventGridTopicPartitionInfoAzure> topicsRegistered;
private Map<String, EventGridTopicPartitionInfoAzure> topicsRegistered;
}
......@@ -23,6 +23,9 @@ import org.opengroup.osdu.core.common.partition.PartitionInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
/**
* PartitionInfo dispenser.
*/
@Component
public class PartitionInfoProvider {
@Autowired
......@@ -32,8 +35,6 @@ public class PartitionInfoProvider {
@Autowired
private IPartitionFactory partitionFactory;
// TODO: @komakkar check if this can be cached. The only downside will be failing calls everytime a new config is added and we try to access it.
/**
* Get partition info.
*
......
Markdown is supported
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