From b123014b577019676703f2b3e9c67be81ba89777 Mon Sep 17 00:00:00 2001 From: etreschenkov Date: Tue, 4 Oct 2022 12:50:42 +0300 Subject: [PATCH] delete method for mapstore revision --- .../spcex/clearing/imdg/IMDGApplication.java | 61 +------------------ 1 file changed, 1 insertion(+), 60 deletions(-) diff --git a/clearing-parent/imdg/src/main/java/ru/spcex/clearing/imdg/IMDGApplication.java b/clearing-parent/imdg/src/main/java/ru/spcex/clearing/imdg/IMDGApplication.java index 18f22bce6..26544a2ba 100644 --- a/clearing-parent/imdg/src/main/java/ru/spcex/clearing/imdg/IMDGApplication.java +++ b/clearing-parent/imdg/src/main/java/ru/spcex/clearing/imdg/IMDGApplication.java @@ -1,73 +1,14 @@ package ru.spcex.clearing.imdg; -import com.hazelcast.config.MapStoreConfig; -import com.hazelcast.core.HazelcastInstance; -import org.slf4j.LoggerFactory; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.context.ConfigurableApplicationContext; -import ru.spcex.clearing.imdg.base.BusinessObjectMapStore; -import ru.spcex.clearing.imdg.base.DictionaryMapStore; -import ru.spcex.clearing.imdg.base.TemplateEventMapStore; -import ru.spcex.clearing.imdg.base.TemplateMapStore; - -import java.sql.Connection; -import java.sql.DatabaseMetaData; -import java.sql.DriverManager; -import java.sql.ResultSet; -import java.util.ArrayList; -import java.util.List; @SpringBootApplication public class IMDGApplication { public static void main(String[] args) { SpringApplicationBuilder builder = new SpringApplicationBuilder(IMDGApplication.class); - ConfigurableApplicationContext configurableApplicationContext = builder.run(args); - tmpLogUncompletedMapStores(configurableApplicationContext); - } - - public static void tmpLogUncompletedMapStores(ConfigurableApplicationContext configurableApplicationContext) { - try { - //Поиск таблиц которым нужно добавить mapStore и вывод результата в консоль - List nameTables = new ArrayList<>(); - Connection jdbcConnection = DriverManager.getConnection("jdbc:postgresql://10.200.200.133:5432/postgres", "clearing", "Aa111111"); - DatabaseMetaData md = jdbcConnection.getMetaData(); - ResultSet rs = md.getTables(null, "clearing", "%", new String[]{"TABLE"}); - while (rs.next()) { - nameTables.add(rs.getString(3)); - } - - HazelcastInstance hazelcastInstance = configurableApplicationContext.getBean(HazelcastInstance.class); - hazelcastInstance.getMap(""); - for (String mapName : hazelcastInstance.getConfig().getMapConfigs().keySet()) { - MapStoreConfig mapStoreConfig = hazelcastInstance.getConfig().getMapConfig(mapName).getMapStoreConfig(); - Object mapStore = mapStoreConfig.getImplementation(); - String tableName; - if (mapStore instanceof TemplateMapStore) { - tableName = ((TemplateMapStore) mapStore).getTableName(); - } else if (mapStore instanceof DictionaryMapStore) { - tableName = ((DictionaryMapStore) mapStore).getTableName(); - } else if (mapStore instanceof TemplateEventMapStore) { - tableName = ((TemplateEventMapStore) mapStore).getTableName(); - } else if (mapStore instanceof BusinessObjectMapStore) { - tableName = ((BusinessObjectMapStore) mapStore).getTableName(); - } else if (mapName.equals("default")) { - continue; - } else { - System.out.println(mapStore == null ? "Не получилось сопоставить mapStore: is null" : "Не получилось сопоставить: " + mapStore.getClass() + " с таблицей"); - continue; - } - nameTables.remove(tableName.toLowerCase()); - } - System.out.println("** Результата поиска таблиц которым нужно добавить mapStore **"); - nameTables.forEach(System.out::println); - System.out.println("**************************************************************"); - } catch ( - Throwable e) { - LoggerFactory.getLogger(IMDGApplication.class).error("STORAGE start failed: {} -> {}", e.getClass().getSimpleName(), e.getMessage()); - System.exit(-1); - } + builder.run(args); } }