ENTAXY-248 release 1.8.1

This commit is contained in:
2022-02-28 15:20:38 +03:00
parent 4d274c4fcc
commit c826adf1db
1958 changed files with 195926 additions and 10280 deletions

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ru.entaxy.esb.platform.runtime.core</groupId>
<artifactId>initializer</artifactId>
<version>1.8.0</version>
<version>1.8.1</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@ -16,6 +16,12 @@
<name>ENTAXY :: PLATFORM :: RUNTIME :: CORE :: INITIALIZER :: CONNECTION INITIALIZER</name>
<description>ENTAXY :: PLATFORM :: RUNTIME :: CORE :: INITIALIZER :: CONNECTION INITIALIZER</description>
<properties>
<!-- bundle.osgi.private.pkg>
ru.entaxy.esb.platform.runtime.core.initializer.connection
</bundle.osgi.private.pkg -->
</properties>
<build>
<plugins>
<plugin>
@ -66,7 +72,6 @@
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
<dependency>
<groupId>ru.entaxy.esb.platform.runtime.core.initializer</groupId>
@ -74,5 +79,10 @@
<version>${project.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>ru.entaxy.esb.platform.runtime.base</groupId>
<artifactId>base-support</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</project>

View File

@ -26,6 +26,7 @@ import org.slf4j.LoggerFactory;
import ru.entaxy.esb.platform.runtime.core.initializer.api.AbstractInitializer;
import ru.entaxy.esb.platform.runtime.core.initializer.api.InitializerException;
import ru.entaxy.esb.platform.runtime.core.management.connection.util.ConnectionManagerUtil;
import ru.entaxy.platform.base.support.FileUtils;
import java.io.File;
import java.io.IOException;
@ -55,6 +56,7 @@ public class ConnectionInitializer extends AbstractInitializer {
try {
initPlatformConnections(bundleContext);
} catch (Exception e) {
e.printStackTrace();
throw new InitializerException(this, "Can't create platform connections", "", e);
}
}
@ -65,10 +67,43 @@ public class ConnectionInitializer extends AbstractInitializer {
}
private void initPlatformConnections(BundleContext bundleContext) throws Exception {
chackAndPrepareFile(bundleContext);
String json = getJsonAsString(bundleContext);
ConnectionManagerUtil.getService().createAndInstallConnections(json);
FileUtils.FileHelper helper = new FileUtils.FileHelper(JSON_FILE_PATH);
if (!helper.isReadable()) {
// TODO throw exception
log.error("Platform connectons file {} is not readable", JSON_FILE_PATH);
return;
}
if (helper.isChanged()) {
log.info("File is new or changed, install/update connections");
// we need to create/update connections with new timestamp
String oldTimestamp = helper.getTimestamp();
String newTimestamp = helper.updateTimestamp();
// ConnectionManagerUtil.getService().createAndInstallConnections(json);
ConnectionManagerUtil.getService().installUpdateConnections(json, newTimestamp);
helper.updateMd5();
} else {
log.info("File is not changed, install/check connections");
// we need to create if absent connectoins with old timestamp
// ConnectionManagerUtil.getService().createAndInstallConnections(json);
ConnectionManagerUtil.getService().checkInstallConnections(json, helper.getTimestamp());
}
}
private void chackAndPrepareFile(BundleContext context) throws IOException {
File f = new File(JSON_FILE_PATH);
if (!f.exists()) {
FileUtils.string2file(getJsonAsString(context), JSON_FILE_PATH);
}
}
private String getJsonAsString(BundleContext context) throws IOException {
URL jsonUrl;
File f = new File(JSON_FILE_PATH);

View File

@ -18,15 +18,13 @@
"nodeType": "connection",
"uuid": "connection-uuid-2",
"name": "entaxy-broker",
"adapterName": "artemisAdapter",
"adapterName": "artemisAmqpAdapter",
"platform": true,
"pathParameter": "queue:entaxy.default",
"properties": {
"url": "(tcp://localhost:61616)",
"url": "amqp://localhost:5672",
"username": "entaxy",
"password": "entaxy",
"maxConnections": "20",
"maxSessionsPerConnection": "100"
"password": "entaxy"
},
"options": {}
},
@ -34,7 +32,8 @@
"nodeType": "connection",
"uuid": "connection-uuid-3",
"name": "entaxy-db-storage",
"adapterName": "postgresqlAdapter",
"adapterName.pg": "postgresqlAdapter",
"adapterName": "h2Adapter",
"platform": true,
"pathParameter": "entaxy.esb.storage",
"properties": {},
@ -44,7 +43,8 @@
"nodeType": "connection",
"uuid": "connection-uuid-4",
"name": "entaxy-db-cache",
"adapterName": "postgresqlAdapter",
"adapterName.pg": "postgresqlAdapter",
"adapterName": "h2Adapter",
"platform": true,
"pathParameter": "entaxy.esb.cache",
"properties": {},