diff --git a/platform/pom.xml b/platform/pom.xml
index 2460162e..893a4059 100644
--- a/platform/pom.xml
+++ b/platform/pom.xml
@@ -3,7 +3,7 @@
root
ru.entaxy.esb
- 1.9.0
+ 1.10.0
4.0.0
@@ -14,6 +14,7 @@
runtime
+ integration
diff --git a/platform/runtime/base/base-support/pom.xml b/platform/runtime/base/base-support/pom.xml
index c090631f..d1016596 100644
--- a/platform/runtime/base/base-support/pom.xml
+++ b/platform/runtime/base/base-support/pom.xml
@@ -3,7 +3,7 @@
ru.entaxy.esb.platform.runtime
base
- 1.9.0
+ 1.10.0
ru.entaxy.esb.platform.runtime.base
base-support
@@ -17,11 +17,16 @@
ru.entaxy.platform.base.support.xml,
ru.entaxy.platform.base.support.osgi,
ru.entaxy.platform.base.support.osgi.bundle,
+ ru.entaxy.platform.base.support.osgi.feature,
ru.entaxy.platform.base.support.osgi.service,
ru.entaxy.platform.base.support.osgi.tracker,
ru.entaxy.platform.base.support.osgi.tracker.filter,
- ru.entaxy.platform.base.support.osgi.filter
+ ru.entaxy.platform.base.support.osgi.filter,
+ ru.entaxy.platform.base.support.karaf.shell
+
+ org.apache.felix.gogo.runtime.threadio
+
@@ -48,8 +53,29 @@
commons-codec
- com.google.code.gson
- gson
+ ru.entaxy.bundles-repacked
+ ru.entaxy.bundles-repacked.com.google.code.gson-2.8.5.entaxy
+ ${gson.version}-ENTAXY
+
+ org.apache.karaf.shell
+ org.apache.karaf.shell.core
+ ${karaf.version}
+
+
+ org.apache.karaf.features
+ org.apache.karaf.features.core
+ ${karaf.version}
+
+
+ org.apache.karaf.bundle
+ org.apache.karaf.bundle.core
+ ${karaf.version}
+
+
+ org.fusesource.jansi
+ jansi
+ 1.18
+
diff --git a/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/CommonUtils.java b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/CommonUtils.java
index 7dabf39f..10c815a6 100644
--- a/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/CommonUtils.java
+++ b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/CommonUtils.java
@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* base-support
* ==========
- * Copyright (C) 2020 - 2023 EmDev LLC
+ * Copyright (C) 2020 - 2024 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
@@ -33,6 +33,7 @@ import java.util.Dictionary;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
@@ -49,243 +50,256 @@ import org.apache.commons.lang3.StringUtils;
*
*/
public class CommonUtils {
-
- public static final String GUID_0 = "00000000-0000-0000-0000-000000000000";
- public static final String GUID_f = "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF";
- public static final String NULL_GUID_ = GUID_0;
-
- public static final String PACKET_TYPE_PARAM_NAME = "packetType";
- public static class Path {
-
- public static final String DEFAULT_SEPARATOR = "/";
-
- protected String separator = DEFAULT_SEPARATOR;
- protected List data = new ArrayList<>();
-
- public static Path create() {
- return new Path();
- }
-
- public static boolean isAbsolute(String path) {
- return isAbsolute(path, DEFAULT_SEPARATOR);
- }
-
- public static boolean isAbsolute(String path, String separator) {
- if (!isValid(path))
- return false;
- return path.trim().startsWith(separator);
- }
-
- public Path() {
- super();
- }
-
- public Path separator(String newSeparator) {
- if (newSeparator!=null)
- this.separator = newSeparator;
- return this;
- }
-
- public Path construct(String...fragments) {
- data.clear();
- return append(fragments);
- }
-
- public Path append(String...fragments) {
- if (fragments==null)
- return this;
- for (int i = 0; i < fragments.length; i++) {
- String string = fragments[i];
- if (isValid(string)) {
- String[] splitted = StringUtils.split(string, separator);
- for (int j = 0; j < splitted.length; j++) {
- String string2 = splitted[j];
- if (isValid(string2) && isValid(string2.trim()))
- data.add(string2.trim());
- }
- }
- }
- return this;
- };
-
- public String relational() {
- return StringUtils.join(data, separator);
- }
-
- public String absolute() {
- return separator + relational();
- }
-
- public Iterator fragmentsIterator() {
- return data.iterator();
- }
-
- public ListIterator fragmentsListIterator() {
- return data.listIterator();
- }
-
- public List pathHierarchy(){
- return pathHierarchy(true);
- }
-
- public List pathHierarchy(boolean absolute){
- List result = new ArrayList<>();
- if (data.isEmpty())
- return result;
- result.add((absolute?separator:"") + data.get(0));
- for (int i=1; i iterator() {
- return pathHierarchy().iterator();
- }
-
- public ListIterator listIterator() {
- return pathHierarchy().listIterator();
- }
-
- }
-
- /**
- * Generates UUID
- *
- * @return
- */
- public static String getUUID(){
- return UUID.randomUUID().toString().toLowerCase().replace("-", "");
- }
- /**
- * Generates UUID consisting of specified char
- * @param c
- * @return
- */
- public static String getUUID(char c) {
- return StringUtils.leftPad("", 32, c);
- }
-
- /**
- * Generates GUID
- *
- * @return
- */
- public static String getGUID(){
- return UUID.randomUUID().toString().toUpperCase();
- }
+ public static final String GUID_0 = "00000000-0000-0000-0000-000000000000";
+ public static final String GUID_f = "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF";
+ public static final String NULL_GUID_ = GUID_0;
- /**
- * Generates GUID consisting of specified char
- * @param c
- * @return
- */
- public static String getGUID(char c) {
- return uid2guid(StringUtils.leftPad("", 32, c));
- }
-
- /**
- * Converts UUID to GUID
- * @param uid
- * @return
- */
- public static String uid2guid(String uid){
- return uid.replaceFirst("(.{8})(.{4})(.{4})(.{4})(.{8})", "$1-$2-$3-$4-$5").toUpperCase();
- }
-
- /**
- * Converts GUID to UUID
- * @param uid
- * @return
- */
- public static String guid2uid(String guid){
- return guid.toLowerCase().replace("-", "");
- }
-
- /**
- * Checks if the string is not null and has something inside after trim
- *
- * @param s
- * @return
- */
- public static boolean isValid(String s){
- if (s==null)
- return false;
- return s.trim().length()>0;
- }
-
- /**
- *
- * @param s string to examine
- * @param def default value
- * @return s if isValid(s), otherwise def
- */
- public static String getValid(String s, String def){
- return isValid(s)?s:def;
- }
-
- public static String padLeft(String data, int length){
- return padLeft(data, length, ' ');
- }
- public static String padRight(String data, int length){
- return padRight(data, length, ' ');
- }
+ public static final String PACKET_TYPE_PARAM_NAME = "packetType";
- public static String padBoth(String data, int length){
- return padBoth(data, length, ' ');
- }
+ public static class Path {
- public static String padLeft(String data, int length, Character c){
- String val = data;
- if (data==null)
- val = "";
- while (val.length() data = new ArrayList<>();
- public static void stream2file(InputStream input, String file) throws Exception {
- File f = new File(file);
- FileOutputStream output = new FileOutputStream(f);
- IOUtils.copy(input, output);
- output.close();
- }
-
- public static Map addDictionaryToMap(Dictionary source, Map sink) {
- for (Enumeration keys = source.keys(); keys.hasMoreElements();) {
- K key = keys.nextElement();
- sink.put(key, source.get(key));
- }
- return sink;
- }
-
- public static Map getDictionaryAsMap(Dictionary source) {
- Map result = new HashMap<>();
- CommonUtils.addDictionaryToMap(source, result);
- return result;
- }
-
+ public static Path create() {
+ return new Path();
+ }
+
+ public static boolean isAbsolute(String path) {
+ return isAbsolute(path, DEFAULT_SEPARATOR);
+ }
+
+ public static boolean isAbsolute(String path, String separator) {
+ if (!isValid(path))
+ return false;
+ return path.trim().startsWith(separator);
+ }
+
+ public Path() {
+ super();
+ }
+
+ public Path separator(String newSeparator) {
+ if (newSeparator != null)
+ this.separator = newSeparator;
+ return this;
+ }
+
+ public Path construct(String... fragments) {
+ data.clear();
+ return append(fragments);
+ }
+
+ public Path append(String... fragments) {
+ if (fragments == null)
+ return this;
+ for (int i = 0; i < fragments.length; i++) {
+ String string = fragments[i];
+ if (isValid(string)) {
+ String[] splitted = StringUtils.split(string, separator);
+ for (int j = 0; j < splitted.length; j++) {
+ String string2 = splitted[j];
+ if (isValid(string2) && isValid(string2.trim()))
+ data.add(string2.trim());
+ }
+ }
+ }
+ return this;
+ };
+
+ public String relational() {
+ return StringUtils.join(data, separator);
+ }
+
+ public String absolute() {
+ return separator + relational();
+ }
+
+ public Iterator fragmentsIterator() {
+ return data.iterator();
+ }
+
+ public ListIterator fragmentsListIterator() {
+ return data.listIterator();
+ }
+
+ public List pathHierarchy() {
+ return pathHierarchy(true);
+ }
+
+ public List pathHierarchy(boolean absolute) {
+ List result = new ArrayList<>();
+ if (data.isEmpty())
+ return result;
+ result.add((absolute ? separator : "") + data.get(0));
+ for (int i = 1; i < data.size(); i++)
+ result.add(result.get(i - 1) + separator + data.get(i));
+ return result;
+ }
+
+ public Iterator iterator() {
+ return pathHierarchy().iterator();
+ }
+
+ public ListIterator listIterator() {
+ return pathHierarchy().listIterator();
+ }
+
+ }
+
+ /**
+ * Generates UUID
+ *
+ * @return
+ */
+ public static String getUUID() {
+ return UUID.randomUUID().toString().toLowerCase().replace("-", "");
+ }
+
+ /**
+ * Generates UUID consisting of specified char
+ *
+ * @param c
+ * @return
+ */
+ public static String getUUID(char c) {
+ return StringUtils.leftPad("", 32, c);
+ }
+
+ /**
+ * Generates GUID
+ *
+ * @return
+ */
+ public static String getGUID() {
+ return UUID.randomUUID().toString().toUpperCase();
+ }
+
+ /**
+ * Generates GUID consisting of specified char
+ *
+ * @param c
+ * @return
+ */
+ public static String getGUID(char c) {
+ return uid2guid(StringUtils.leftPad("", 32, c));
+ }
+
+ /**
+ * Converts UUID to GUID
+ *
+ * @param uid
+ * @return
+ */
+ public static String uid2guid(String uid) {
+ return uid.replaceFirst("(.{8})(.{4})(.{4})(.{4})(.{8})", "$1-$2-$3-$4-$5").toUpperCase();
+ }
+
+ /**
+ * Converts GUID to UUID
+ *
+ * @param uid
+ * @return
+ */
+ public static String guid2uid(String guid) {
+ return guid.toLowerCase().replace("-", "");
+ }
+
+ /**
+ * Checks if the string is not null and has something inside after trim
+ *
+ * @param s
+ * @return
+ */
+ public static boolean isValid(String s) {
+ if (s == null)
+ return false;
+ return s.trim().length() > 0;
+ }
+
+ /**
+ *
+ * @param s string to examine
+ * @param def default value
+ * @return s if isValid(s), otherwise def
+ */
+ public static String getValid(String s, String def) {
+ return isValid(s) ? s : def;
+ }
+
+ public static String padLeft(String data, int length) {
+ return padLeft(data, length, ' ');
+ }
+
+ public static String padRight(String data, int length) {
+ return padRight(data, length, ' ');
+ }
+
+ public static String padBoth(String data, int length) {
+ return padBoth(data, length, ' ');
+ }
+
+ public static String padLeft(String data, int length, Character c) {
+ String val = data;
+ if (data == null)
+ val = "";
+ while (val.length() < length)
+ val = c + val;
+ return val;
+ }
+
+ public static String padRight(String data, int length, Character c) {
+ String val = data;
+ if (data == null)
+ val = "";
+ while (val.length() < length)
+ val = val + c;
+ return val;
+ }
+
+ public static String padBoth(String data, int length, Character c) {
+ String val = data;
+ boolean left = true;
+ if (data == null)
+ val = "";
+ while (val.length() < length) {
+ if (left)
+ val = c + val;
+ else
+ val = val + c;
+ left = !left;
+ }
+ return val;
+ }
+
+ public static void stream2file(InputStream input, String file) throws Exception {
+ File f = new File(file);
+ try (FileOutputStream output = new FileOutputStream(f)) {
+ IOUtils.copy(input, output);
+ }
+ }
+
+ public static Map addDictionaryToMap(Dictionary source, Map sink) {
+ for (Enumeration keys = source.keys(); keys.hasMoreElements();) {
+ K key = keys.nextElement();
+ sink.put(key, source.get(key));
+ }
+ return sink;
+ }
+
+ public static Map getDictionaryAsMap(Dictionary source) {
+ Map result = new HashMap<>();
+ CommonUtils.addDictionaryToMap(source, result);
+ return result;
+ }
+
+ public static Map prefixMap(Map map, String prefix) {
+ Map result = new LinkedHashMap<>();
+ for (Map.Entry entry : map.entrySet())
+ result.put(String.format("%s%s", prefix, entry.getKey()), entry.getValue());
+ return result;
+ }
}
diff --git a/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/DependencySorter.java b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/DependencySorter.java
index 6a2984e2..cfecf87c 100644
--- a/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/DependencySorter.java
+++ b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/DependencySorter.java
@@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* test-producers
* ==========
- * Copyright (C) 2020 - 2023 EmDev LLC
+ * Copyright (C) 2020 - 2024 EmDev LLC
* ==========
* You may not use this file except in accordance with the License Terms of the Copyright
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
@@ -25,54 +25,53 @@
*/
package ru.entaxy.platform.base.support;
+import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.stream.Collectors;
public class DependencySorter {
- public static interface DependencyProvider {
- List getDependencies(T inspectedObject);
- }
-
- public static List getSortedList(List origin, DependencyProvider provider) throws Exception {
- List result = new LinkedList<>();
-
- // add independent objects
- result.addAll(
- origin.stream().filter(obj -> provider.getDependencies(obj).isEmpty())
- .collect(Collectors.toList())
- );
-
- while (result.size() < origin.size()) {
- List nextObjects = origin.stream().filter(obj->!result.contains(obj))
- .filter(obj->result.containsAll(provider.getDependencies(obj)))
- .collect(Collectors.toList());
- if (nextObjects.isEmpty())
- // TODO create more informative exception
- throw new UnsatisfiedDependenciesException(
- origin.stream().filter(obj->!result.contains(obj))
- .collect(Collectors.toList())
- );
- result.addAll(nextObjects);
- }
-
- return result;
- }
+ public static interface DependencyProvider {
+ List getDependencies(T inspectedObject);
+ }
+
+ public static List getSortedList(List origin, DependencyProvider provider) throws Exception {
+ List result = new LinkedList<>();
+
+ // add independent objects
+ result.addAll(
+ origin.stream().filter(obj -> provider.getDependencies(obj).isEmpty())
+ .collect(Collectors.toList()));
+
+ while (result.size() < origin.size()) {
+ List nextObjects = origin.stream().filter(obj -> !result.contains(obj))
+ .filter(obj -> result.containsAll(provider.getDependencies(obj)))
+ .collect(Collectors.toList());
+ if (nextObjects.isEmpty())
+ // TODO create more informative exception
+ throw new UnsatisfiedDependenciesException(
+ origin.stream().filter(obj -> !result.contains(obj))
+ .collect(Collectors.toList()));
+ result.addAll(nextObjects);
+ }
+
+ return result;
+ }
+
+ @SuppressWarnings("serial")
+ public static class UnsatisfiedDependenciesException extends Exception {
+
+ protected List