delete method for mapstore revision
This commit is contained in:
parent
e19661b449
commit
b123014b57
1 changed files with 1 additions and 60 deletions
|
|
@ -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<String> 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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue