release version 1.12.0
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.core</groupId>
|
||||
<artifactId>object-runtime</artifactId>
|
||||
<version>1.11.0</version>
|
||||
<version>1.12.0</version>
|
||||
</parent>
|
||||
<artifactId>object-runtime-core</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
@@ -54,6 +54,11 @@
|
||||
<artifactId>search-service</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.cave.repository</groupId>
|
||||
<artifactId>org.apache.karaf.cave.repository.api</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -0,0 +1,88 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.platform.objects.runtime;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public interface EntaxyRuntimeObjectClusterInfo {
|
||||
|
||||
public static final String PARAM_GROUPS = "groups";
|
||||
|
||||
public static final String PARAM_OBJECT_CLUSTER_STATE = "objectClusterState";
|
||||
|
||||
public enum CLUSTER_STATE {
|
||||
UNDEFINED("undefined"),
|
||||
LOCAL("local"),
|
||||
CLUSTERED("clustered"),
|
||||
NON_CLUSTERED("non-clustered");
|
||||
|
||||
private String value;
|
||||
|
||||
CLUSTER_STATE(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public static CLUSTER_STATE findByValue(String value) {
|
||||
for (CLUSTER_STATE state : CLUSTER_STATE.values())
|
||||
if (state.getValue().equalsIgnoreCase(value))
|
||||
return state;
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public interface ObjectClusterGroupInfo {
|
||||
|
||||
String getName();
|
||||
|
||||
boolean isValid();
|
||||
|
||||
default String getGroupString() {
|
||||
return (isValid() ? "" : "?") + getName();
|
||||
}
|
||||
}
|
||||
|
||||
List<ObjectClusterGroupInfo> getGroups();
|
||||
|
||||
CLUSTER_STATE getClusterState();
|
||||
|
||||
default boolean isLocal() {
|
||||
return CLUSTER_STATE.LOCAL.equals(getClusterState());
|
||||
}
|
||||
|
||||
default List<String> getValidGroups() {
|
||||
if (getGroups() == null)
|
||||
return Collections.emptyList();
|
||||
return getGroups().stream().filter(g -> g.isValid()).map(g -> g.getName()).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
@@ -31,6 +31,7 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.collections4.MapUtils;
|
||||
import org.osgi.framework.Version;
|
||||
|
||||
public interface EntaxyRuntimeObjectContainer {
|
||||
|
||||
@@ -70,6 +71,12 @@ public interface EntaxyRuntimeObjectContainer {
|
||||
|
||||
String getName();
|
||||
|
||||
String getUrl();
|
||||
|
||||
String getVersion();
|
||||
|
||||
Version getVersionStrict();
|
||||
|
||||
default String getType() {
|
||||
return "bundle";
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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,57 +25,168 @@
|
||||
*/
|
||||
package ru.entaxy.platform.objects.runtime;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface EntaxyRuntimeObjectManager {
|
||||
|
||||
public enum ENTAXY_RUNTIME_OBJECT_OPERATION {
|
||||
START,
|
||||
STOP,
|
||||
UNINSTALL
|
||||
}
|
||||
|
||||
public enum ENTAXY_RUNTIME_OBJECT_OPERATION_RESULT {
|
||||
DONE,
|
||||
FAILED,
|
||||
BLOCKED,
|
||||
REQUEST
|
||||
}
|
||||
|
||||
public interface OperationConfig {
|
||||
String getObjectFullId();
|
||||
boolean isForced();
|
||||
boolean isSoft();
|
||||
boolean isAffected();
|
||||
Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> getAffected();
|
||||
}
|
||||
|
||||
public interface OperationResult {
|
||||
ENTAXY_RUNTIME_OBJECT_OPERATION_RESULT getResult();
|
||||
Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> getAffected();
|
||||
String getMessage();
|
||||
}
|
||||
|
||||
OperationResult execute(ENTAXY_RUNTIME_OBJECT_OPERATION operation, OperationConfig config);
|
||||
|
||||
OperationResult start(String objectFullId);
|
||||
OperationResult startForced(String objectFullId);
|
||||
OperationResult startForced(String objectFullId, boolean isAffectedBundle);
|
||||
|
||||
OperationResult startSoft(String objectFullId);
|
||||
|
||||
OperationResult start(OperationConfig config);
|
||||
public enum ENTAXY_RUNTIME_OBJECT_OPERATION {
|
||||
START,
|
||||
STOP,
|
||||
UNINSTALL
|
||||
}
|
||||
|
||||
OperationResult stop(String objectFullId);
|
||||
OperationResult stopForced(String objectFullId);
|
||||
OperationResult stopSoft(String objectFullId);
|
||||
|
||||
OperationResult stop(OperationConfig config);
|
||||
public enum ENTAXY_RUNTIME_OBJECT_OPERATION_RESULT {
|
||||
DONE,
|
||||
FAILED,
|
||||
BLOCKED,
|
||||
REQUEST
|
||||
}
|
||||
|
||||
public interface OperationConfig {
|
||||
String getObjectFullId();
|
||||
|
||||
boolean isForced();
|
||||
|
||||
boolean isSoft();
|
||||
|
||||
boolean isAffected();
|
||||
|
||||
Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> getAffected();
|
||||
|
||||
List<String> getTarget();
|
||||
}
|
||||
|
||||
public interface OperationResult {
|
||||
ENTAXY_RUNTIME_OBJECT_OPERATION_RESULT getResult();
|
||||
|
||||
Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> getAffected();
|
||||
|
||||
String getMessage();
|
||||
}
|
||||
|
||||
OperationResult execute(ENTAXY_RUNTIME_OBJECT_OPERATION operation, OperationConfig config);
|
||||
|
||||
/*
|
||||
* start
|
||||
*/
|
||||
|
||||
/* wrappers */
|
||||
|
||||
default OperationResult start(String objectFullId) {
|
||||
return start(objectFullId, null);
|
||||
}
|
||||
|
||||
default OperationResult start(String objectFullId, List<String> target) {
|
||||
return start(objectFullId, false, false, false, target);
|
||||
};
|
||||
|
||||
default OperationResult startForced(String objectFullId) {
|
||||
return startForced(objectFullId, null);
|
||||
};
|
||||
|
||||
default OperationResult startForced(String objectFullId, List<String> target) {
|
||||
return startForced(objectFullId, false, target);
|
||||
}
|
||||
|
||||
default OperationResult startForced(String objectFullId, boolean isAffectedBundle) {
|
||||
return startForced(objectFullId, true, null);
|
||||
};
|
||||
|
||||
default OperationResult startForced(String objectFullId, boolean isAffectedBundle, List<String> target) {
|
||||
return start(objectFullId, true, false, isAffectedBundle, target);
|
||||
}
|
||||
|
||||
default OperationResult startSoft(String objectFullId) {
|
||||
return startSoft(objectFullId, null);
|
||||
}
|
||||
|
||||
default OperationResult startSoft(String objectFullId, List<String> target) {
|
||||
return start(objectFullId, false, true, false, target);
|
||||
};
|
||||
|
||||
default OperationResult start(String objectFullId, boolean forced, boolean soft, boolean isAffectedBundle) {
|
||||
return start(objectFullId, forced, soft, isAffectedBundle, null);
|
||||
};
|
||||
|
||||
/* methods */
|
||||
|
||||
OperationResult start(String objectFullId, boolean forced, boolean soft, boolean isAffectedBundle,
|
||||
List<String> target);
|
||||
|
||||
OperationResult start(OperationConfig config);
|
||||
|
||||
/*
|
||||
* stop
|
||||
*/
|
||||
|
||||
/* wrappers */
|
||||
|
||||
default OperationResult stop(String objectFullId) {
|
||||
return stop(objectFullId, null);
|
||||
};
|
||||
|
||||
default OperationResult stop(String objectFullId, List<String> target) {
|
||||
return stop(objectFullId, false, false, target);
|
||||
};
|
||||
|
||||
default OperationResult stopForced(String objectFullId) {
|
||||
return stopForced(objectFullId, null);
|
||||
};
|
||||
|
||||
default OperationResult stopForced(String objectFullId, List<String> target) {
|
||||
return stop(objectFullId, true, false, target);
|
||||
};
|
||||
|
||||
default OperationResult stopSoft(String objectFullId) {
|
||||
return stopSoft(objectFullId, null);
|
||||
};
|
||||
|
||||
default OperationResult stopSoft(String objectFullId, List<String> target) {
|
||||
return stop(objectFullId, false, true, target);
|
||||
};
|
||||
|
||||
/* methods */
|
||||
|
||||
OperationResult stop(String objectFullId, boolean forced, boolean soft, List<String> target);
|
||||
|
||||
OperationResult stop(OperationConfig config);
|
||||
|
||||
|
||||
/*
|
||||
* uninstall
|
||||
*/
|
||||
|
||||
/* wrappers */
|
||||
|
||||
default OperationResult uninstall(String objectFullId) {
|
||||
return uninstall(objectFullId, null);
|
||||
};
|
||||
|
||||
default OperationResult uninstall(String objectFullId, List<String> target) {
|
||||
return uninstall(objectFullId, false, false, target);
|
||||
};
|
||||
|
||||
default OperationResult uninstallForced(String objectFullId) {
|
||||
return uninstallForced(objectFullId, null);
|
||||
};
|
||||
|
||||
default OperationResult uninstallForced(String objectFullId, List<String> target) {
|
||||
return uninstall(objectFullId, true, false, target);
|
||||
};
|
||||
|
||||
default OperationResult uninstallSoft(String objectFullId) {
|
||||
return uninstallSoft(objectFullId, null);
|
||||
};
|
||||
|
||||
default OperationResult uninstallSoft(String objectFullId, List<String> target) {
|
||||
return uninstall(objectFullId, false, true, target);
|
||||
};
|
||||
|
||||
/* methods */
|
||||
|
||||
OperationResult uninstall(String objectFullId, boolean forced, boolean soft, List<String> target);
|
||||
|
||||
OperationResult uninstall(OperationConfig config);
|
||||
|
||||
OperationResult uninstall(String objectFullId);
|
||||
OperationResult uninstallForced(String objectFullId);
|
||||
OperationResult uninstallSoft(String objectFullId);
|
||||
|
||||
OperationResult uninstall(OperationConfig config);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
@@ -38,6 +38,8 @@ import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject.ENTAXY_RUNTIME_OBJ
|
||||
|
||||
public interface EntaxyRuntimeObjectService {
|
||||
|
||||
public static final String CLUSTER_DATA_SECTION = "cluster";
|
||||
|
||||
public interface Listener {
|
||||
|
||||
void objectAdded(EntaxyRuntimeObject object);
|
||||
@@ -88,6 +90,19 @@ public interface EntaxyRuntimeObjectService {
|
||||
return getExtendedObjectInfo(entaxyRuntimeObject);
|
||||
};
|
||||
|
||||
default Map<String, Object> getClusterObjectInfo(String runtimeObjectId) {
|
||||
Map<String, Map<String, Object>> extendedData = getExtendedObjectInfo(runtimeObjectId);
|
||||
return extendedData.getOrDefault(CLUSTER_DATA_SECTION, new HashMap<>());
|
||||
}
|
||||
|
||||
default EntaxyRuntimeObjectClusterInfo getClusterInfo(String runtimeObjectId) {
|
||||
try {
|
||||
return EntaxyRuntimeObjectUtils.createClusterInfo(getClusterObjectInfo(runtimeObjectId));
|
||||
} catch (Exception ignore) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Map<String, Object>> getExtendedObjectInfo(EntaxyRuntimeObject runtimeObject);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.platform.objects.runtime;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import org.apache.karaf.cave.repository.SearchRequest;
|
||||
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectClusterInfo.ObjectClusterGroupInfo;
|
||||
|
||||
public class EntaxyRuntimeObjectUtils {
|
||||
|
||||
public static final String M2_CLASSIFIER = "classifier";
|
||||
public static final String M2_EXTENSION = "extension";
|
||||
public static final String M2_VERSION = "version";
|
||||
public static final String M2_ARTIFACT_ID = "artifactId";
|
||||
public static final String M2_GROUP_ID = "groupId";
|
||||
|
||||
public static class ObjectClusterGroupInfoImpl implements ObjectClusterGroupInfo {
|
||||
|
||||
String name = "";
|
||||
boolean isValid = true;
|
||||
|
||||
public ObjectClusterGroupInfoImpl(String value) throws IllegalArgumentException {
|
||||
if (value == null || value.isBlank())
|
||||
throw new IllegalArgumentException("Group name is not provided");
|
||||
String temp = value.trim();
|
||||
if (temp.startsWith("?")) {
|
||||
isValid = false;
|
||||
temp = temp.substring(1);
|
||||
}
|
||||
name = temp;
|
||||
if (name.isBlank())
|
||||
throw new IllegalArgumentException("Group name is not provided");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid() {
|
||||
return isValid;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static class EntaxyRuntimeObjectClusterInfoImpl implements EntaxyRuntimeObjectClusterInfo {
|
||||
|
||||
List<ObjectClusterGroupInfo> groups;
|
||||
|
||||
CLUSTER_STATE clusterState;
|
||||
|
||||
public EntaxyRuntimeObjectClusterInfoImpl(Map<String, Object> clusterData) {
|
||||
groups = new ArrayList<>();
|
||||
Object value = clusterData.get(PARAM_GROUPS);
|
||||
if (value != null && value instanceof List) {
|
||||
List<String> list = (List<String>) value;
|
||||
for (String s : list) {
|
||||
try {
|
||||
ObjectClusterGroupInfoImpl group = new ObjectClusterGroupInfoImpl(s);
|
||||
groups.add(group);
|
||||
} catch (Exception ignore) {
|
||||
// noop
|
||||
}
|
||||
}
|
||||
}
|
||||
clusterState = CLUSTER_STATE.UNDEFINED;
|
||||
try {
|
||||
clusterState =
|
||||
CLUSTER_STATE.findByValue((String) clusterData.getOrDefault(PARAM_OBJECT_CLUSTER_STATE, ""));
|
||||
} catch (Exception ignore) {
|
||||
// noop
|
||||
}
|
||||
|
||||
if (CLUSTER_STATE.UNDEFINED.equals(clusterState)) {
|
||||
// try to define by groups
|
||||
if (groups.isEmpty()) {
|
||||
clusterState = CLUSTER_STATE.LOCAL;
|
||||
} else {
|
||||
if (groups.stream().filter(g -> !g.isValid()).findFirst().isPresent()) {
|
||||
clusterState = CLUSTER_STATE.NON_CLUSTERED;
|
||||
} else {
|
||||
clusterState = CLUSTER_STATE.CLUSTERED;
|
||||
}
|
||||
} ;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ObjectClusterGroupInfo> getGroups() {
|
||||
return groups;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CLUSTER_STATE getClusterState() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static EntaxyRuntimeObjectClusterInfo createClusterInfo(Map<String, Object> clusterData)
|
||||
throws IllegalArgumentException {
|
||||
if (clusterData == null || clusterData.isEmpty())
|
||||
throw new IllegalArgumentException("Cluster data MUST be provided");
|
||||
EntaxyRuntimeObjectClusterInfoImpl info = new EntaxyRuntimeObjectClusterInfoImpl(clusterData);
|
||||
return info;
|
||||
}
|
||||
|
||||
public final static Pattern mvnPattern = Pattern.compile("mvn:([^/ ]+)/([^/ ]+)/([^/ ]*)(/([^/ ]+)(/([^/ ]+))?)?");
|
||||
public final static Pattern mvnOsgiPattern =
|
||||
Pattern.compile("([^/]*)mvn:([^/ ]+)/([^/ ]+)/([^/ ]*)(/([^/ ]+)(/([^/ ]+))?)?");
|
||||
|
||||
public static String extractMavenUrl(String url) {
|
||||
if (isMavenUrl(url))
|
||||
return url;
|
||||
Matcher matcher = mvnOsgiPattern.matcher(url);
|
||||
if (!matcher.matches())
|
||||
return null;
|
||||
String prefix = matcher.group(1);
|
||||
if (prefix != null)
|
||||
return url.substring(prefix.length());
|
||||
return url;
|
||||
}
|
||||
|
||||
public static boolean isMavenUrl(String url) {
|
||||
Matcher matcher = mvnPattern.matcher(url);
|
||||
return matcher.matches();
|
||||
}
|
||||
|
||||
public static Map<String, String> parseMvnUrl(String artifactUrl) {
|
||||
Matcher matcher = mvnPattern.matcher(artifactUrl);
|
||||
if (!matcher.matches()) {
|
||||
return null;
|
||||
}
|
||||
Map<String, String> result = new HashMap<>();
|
||||
result.put(M2_GROUP_ID, matcher.group(1));
|
||||
result.put(M2_ARTIFACT_ID, matcher.group(2));
|
||||
result.put(M2_VERSION, matcher.group(3));
|
||||
if (matcher.group(5) == null) {
|
||||
result.put(M2_EXTENSION, "jar");
|
||||
} else {
|
||||
result.put(M2_EXTENSION, matcher.group(5));
|
||||
}
|
||||
result.put(M2_CLASSIFIER, matcher.group(7));
|
||||
return result;
|
||||
}
|
||||
|
||||
public static SearchRequest createRequest(Map<String, String> parsedMavnUrl) {
|
||||
SearchRequest result = new SearchRequest();
|
||||
result.artifactId(parsedMavnUrl.get(M2_ARTIFACT_ID))
|
||||
.groupId(parsedMavnUrl.get(M2_GROUP_ID))
|
||||
.extension(parsedMavnUrl.get(M2_EXTENSION))
|
||||
.version(parsedMavnUrl.get(M2_VERSION))
|
||||
.classifier(parsedMavnUrl.get(M2_CLASSIFIER));
|
||||
return result;
|
||||
}
|
||||
|
||||
public static SearchRequest createRequest(String url) {
|
||||
String mvnUrl = extractMavenUrl(url);
|
||||
if (mvnUrl == null)
|
||||
return null;
|
||||
return createRequest(parseMvnUrl(mvnUrl));
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
@@ -44,14 +44,17 @@ import org.slf4j.LoggerFactory;
|
||||
import ru.entaxy.platform.base.objects.EntaxyObject.BundleInfo;
|
||||
import ru.entaxy.platform.core.support.runtime.cluster.ClusterBundleDataProvider;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectClusterInfo;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectClusterInfo.CLUSTER_STATE;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectExtendedDataProvider;
|
||||
|
||||
@Component(service = EntaxyRuntimeObjectExtendedDataProvider.class, immediate = true)
|
||||
public class ClusterExtendedDataProvider implements EntaxyRuntimeObjectExtendedDataProvider {
|
||||
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ClusterExtendedDataProvider.class);
|
||||
|
||||
private static final String CLUSTER_PROVIDER_ID = "cluster";
|
||||
public static final String CLUSTER_PROVIDER_ID = "cluster";
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC,
|
||||
policyOption = ReferencePolicyOption.GREEDY)
|
||||
@@ -77,9 +80,13 @@ public class ClusterExtendedDataProvider implements EntaxyRuntimeObjectExtendedD
|
||||
|
||||
List<String> groups = getClusterGroups(runtimeObject);
|
||||
if (groups != null) {
|
||||
result.put("groups", groups);
|
||||
result.put("objectClusterState", !groups.isEmpty() ?
|
||||
groups.stream().allMatch(group -> group.startsWith("?")) ? "non-clustered" : "clustered" : "local");
|
||||
result.put(EntaxyRuntimeObjectClusterInfo.PARAM_GROUPS, groups);
|
||||
result.put(EntaxyRuntimeObjectClusterInfo.PARAM_OBJECT_CLUSTER_STATE,
|
||||
!groups.isEmpty()
|
||||
? groups.stream().allMatch(group -> group.startsWith("?"))
|
||||
? CLUSTER_STATE.NON_CLUSTERED.getValue()
|
||||
: CLUSTER_STATE.CLUSTERED.getValue()
|
||||
: CLUSTER_STATE.LOCAL.getValue());
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
@@ -29,22 +29,58 @@ import org.apache.karaf.bundle.core.BundleService;
|
||||
import org.apache.karaf.bundle.core.BundleState;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.FrameworkUtil;
|
||||
import org.osgi.framework.Version;
|
||||
|
||||
public class EntaxyRuntimeObjectContainerBundle extends EntaxyRuntimeObjectContainerImpl {
|
||||
|
||||
@Override
|
||||
public ENTAXY_RUNTIME_OBJECT_CONTAINER_STATE getState() {
|
||||
try {
|
||||
|
||||
long bundleId = Long.parseLong(getId());
|
||||
Bundle bundle = FrameworkUtil.getBundle(getClass()).getBundleContext().getBundle(bundleId);
|
||||
BundleService bundleService = EntaxyRuntimeObjectServiceImpl.getInstance().getBundleService();
|
||||
BundleState state = bundleService.getInfo(bundle).getState();
|
||||
return ENTAXY_RUNTIME_OBJECT_CONTAINER_STATE.valueOf(state.name());
|
||||
|
||||
} catch (Exception e) {
|
||||
return ENTAXY_RUNTIME_OBJECT_CONTAINER_STATE.Unknown;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public ENTAXY_RUNTIME_OBJECT_CONTAINER_STATE getState() {
|
||||
try {
|
||||
|
||||
long bundleId = Long.parseLong(getId());
|
||||
Bundle bundle = FrameworkUtil.getBundle(getClass()).getBundleContext().getBundle(bundleId);
|
||||
BundleService bundleService = EntaxyRuntimeObjectServiceImpl.getInstance().getBundleService();
|
||||
BundleState state = bundleService.getInfo(bundle).getState();
|
||||
return ENTAXY_RUNTIME_OBJECT_CONTAINER_STATE.valueOf(state.name());
|
||||
|
||||
} catch (Exception e) {
|
||||
return ENTAXY_RUNTIME_OBJECT_CONTAINER_STATE.Unknown;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUrl() {
|
||||
try {
|
||||
|
||||
long bundleId = Long.parseLong(getId());
|
||||
Bundle bundle = FrameworkUtil.getBundle(getClass()).getBundleContext().getBundle(bundleId);
|
||||
BundleService bundleService = EntaxyRuntimeObjectServiceImpl.getInstance().getBundleService();
|
||||
return bundleService.getInfo(bundle).getUpdateLocation();
|
||||
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
try {
|
||||
|
||||
long bundleId = Long.parseLong(getId());
|
||||
Bundle bundle = FrameworkUtil.getBundle(getClass()).getBundleContext().getBundle(bundleId);
|
||||
BundleService bundleService = EntaxyRuntimeObjectServiceImpl.getInstance().getBundleService();
|
||||
return bundleService.getInfo(bundle).getVersion();
|
||||
|
||||
} catch (Exception e) {
|
||||
return Version.emptyVersion.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Version getVersionStrict() {
|
||||
long bundleId = Long.parseLong(getId());
|
||||
Bundle bundle = FrameworkUtil.getBundle(getClass()).getBundleContext().getBundle(bundleId);
|
||||
return bundle != null ? bundle.getVersion() : Version.emptyVersion;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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,6 +25,8 @@
|
||||
*/
|
||||
package ru.entaxy.platform.objects.runtime.impl.manager;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
@@ -38,103 +40,70 @@ import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectService;
|
||||
@Component(service = EntaxyRuntimeObjectManager.class, immediate = true)
|
||||
public class EntaxyRuntimeObjectManagerImpl implements EntaxyRuntimeObjectManager {
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, policyOption = ReferencePolicyOption.GREEDY)
|
||||
EntaxyRuntimeObjectService objectService;
|
||||
|
||||
@Override
|
||||
public OperationResult execute(ENTAXY_RUNTIME_OBJECT_OPERATION operation, OperationConfig config) {
|
||||
return createExecutor(operation).execute(config);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OperationResult start(String objectFullId) {
|
||||
return start(new OperationConfigImpl(objectFullId));
|
||||
}
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, policyOption = ReferencePolicyOption.GREEDY)
|
||||
EntaxyRuntimeObjectService objectService;
|
||||
|
||||
@Override
|
||||
public OperationResult startForced(String objectFullId) {
|
||||
return startForced(objectFullId, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OperationResult startForced(String objectFullId, boolean isAffectedBundle) {
|
||||
return start((new OperationConfigImpl(objectFullId)).forced(true).affectedOperation(isAffectedBundle));
|
||||
public OperationResult execute(ENTAXY_RUNTIME_OBJECT_OPERATION operation, OperationConfig config) {
|
||||
return createExecutor(operation).execute(config);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OperationResult startSoft(String objectFullId) {
|
||||
return start((new OperationConfigImpl(objectFullId)).soft(true));
|
||||
}
|
||||
@Override
|
||||
public OperationResult start(String objectFullId, boolean forced, boolean soft, boolean isAffectedBundle,
|
||||
List<String> target) {
|
||||
return start(new OperationConfigImpl(objectFullId).forced(forced).soft(soft).affectedOperation(isAffectedBundle)
|
||||
.target(target));
|
||||
}
|
||||
|
||||
@Override
|
||||
public OperationResult start(OperationConfig config) {
|
||||
EntaxyRuntimeObject object = objectService.getRuntimeObject(config.getObjectFullId());
|
||||
if (object == null)
|
||||
return OperationResultImpl.createFailed();
|
||||
if (ENTAXY_RUNTIME_OBJECT_STATE.ACTIVE.equals(objectService.getObjectState(object)))
|
||||
return OperationResultImpl.createDone();
|
||||
return createExecutor(ENTAXY_RUNTIME_OBJECT_OPERATION.START).execute(config);
|
||||
}
|
||||
@Override
|
||||
public OperationResult start(OperationConfig config) {
|
||||
EntaxyRuntimeObject object = objectService.getRuntimeObject(config.getObjectFullId());
|
||||
if (object == null)
|
||||
return OperationResultImpl.createFailed();
|
||||
if (ENTAXY_RUNTIME_OBJECT_STATE.ACTIVE.equals(objectService.getObjectState(object)))
|
||||
return OperationResultImpl.createDone();
|
||||
return createExecutor(ENTAXY_RUNTIME_OBJECT_OPERATION.START).execute(config);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OperationResult stop(String objectFullId) {
|
||||
return stop(new OperationConfigImpl(objectFullId));
|
||||
}
|
||||
@Override
|
||||
public OperationResult stop(String objectFullId, boolean forced, boolean soft, List<String> target) {
|
||||
return stop(new OperationConfigImpl(objectFullId).forced(forced).soft(soft).target(target));
|
||||
}
|
||||
|
||||
@Override
|
||||
public OperationResult stopForced(String objectFullId) {
|
||||
return stop((new OperationConfigImpl(objectFullId)).forced(true));
|
||||
}
|
||||
@Override
|
||||
public OperationResult stop(OperationConfig config) {
|
||||
EntaxyRuntimeObject object = objectService.getRuntimeObject(config.getObjectFullId());
|
||||
if (object == null)
|
||||
return OperationResultImpl.createFailed();
|
||||
if (ENTAXY_RUNTIME_OBJECT_STATE.INACTIVE.equals(objectService.getObjectState(object)))
|
||||
return OperationResultImpl.createDone();
|
||||
return createExecutor(ENTAXY_RUNTIME_OBJECT_OPERATION.STOP).execute(config);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OperationResult stopSoft(String objectFullId) {
|
||||
return stop((new OperationConfigImpl(objectFullId)).soft(true));
|
||||
}
|
||||
@Override
|
||||
public OperationResult uninstall(String objectFullId, boolean forced, boolean soft, List<String> target) {
|
||||
return uninstall(new OperationConfigImpl(objectFullId).forced(forced).soft(soft).target(target));
|
||||
}
|
||||
|
||||
@Override
|
||||
public OperationResult stop(OperationConfig config) {
|
||||
EntaxyRuntimeObject object = objectService.getRuntimeObject(config.getObjectFullId());
|
||||
if (object == null)
|
||||
return OperationResultImpl.createFailed();
|
||||
if (ENTAXY_RUNTIME_OBJECT_STATE.INACTIVE.equals(objectService.getObjectState(object)))
|
||||
return OperationResultImpl.createDone();
|
||||
return createExecutor(ENTAXY_RUNTIME_OBJECT_OPERATION.STOP).execute(config);
|
||||
}
|
||||
@Override
|
||||
public OperationResult uninstall(OperationConfig config) {
|
||||
return createExecutor(ENTAXY_RUNTIME_OBJECT_OPERATION.UNINSTALL).execute(config);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OperationResult uninstall(String objectFullId) {
|
||||
return uninstall(new OperationConfigImpl(objectFullId));
|
||||
}
|
||||
public EntaxyRuntimeObjectService getObjectService() {
|
||||
return objectService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OperationResult uninstallForced(String objectFullId) {
|
||||
return uninstall((new OperationConfigImpl(objectFullId)).forced(true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public OperationResult uninstallSoft(String objectFullId) {
|
||||
return uninstall((new OperationConfigImpl(objectFullId)).soft(true));
|
||||
}
|
||||
|
||||
@Override
|
||||
public OperationResult uninstall(OperationConfig config) {
|
||||
return createExecutor(ENTAXY_RUNTIME_OBJECT_OPERATION.UNINSTALL).execute(config);
|
||||
}
|
||||
|
||||
public EntaxyRuntimeObjectService getObjectService() {
|
||||
return objectService;
|
||||
}
|
||||
|
||||
protected OperationExecutor<?> createExecutor(ENTAXY_RUNTIME_OBJECT_OPERATION operation) {
|
||||
switch (operation) {
|
||||
case START:
|
||||
return (new OperationExecutorStart()).objectManager(this);
|
||||
case STOP:
|
||||
return (new OperationExecutorStop()).objectManager(this);
|
||||
case UNINSTALL:
|
||||
return (new OperationExecutorUninstall()).objectManager(this);
|
||||
default:
|
||||
return (new OperationExecutorStart()).objectManager(this);
|
||||
}
|
||||
}
|
||||
protected OperationExecutor<?> createExecutor(ENTAXY_RUNTIME_OBJECT_OPERATION operation) {
|
||||
switch (operation) {
|
||||
case START:
|
||||
return (new OperationExecutorStart()).objectManager(this);
|
||||
case STOP:
|
||||
return (new OperationExecutorStop()).objectManager(this);
|
||||
case UNINSTALL:
|
||||
return (new OperationExecutorUninstall()).objectManager(this);
|
||||
default:
|
||||
return (new OperationExecutorStart()).objectManager(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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,7 +25,9 @@
|
||||
*/
|
||||
package ru.entaxy.platform.objects.runtime.impl.manager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectManager.ENTAXY_RUNTIME_OBJECT_OPERATION;
|
||||
@@ -33,79 +35,97 @@ import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectManager.OperationCo
|
||||
|
||||
public class OperationConfigImpl implements OperationConfig {
|
||||
|
||||
String objectFullId;
|
||||
|
||||
boolean isForced = false;
|
||||
boolean isSoft = false;
|
||||
boolean isAffected = false;
|
||||
|
||||
final Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> affected = new HashMap<>();
|
||||
|
||||
public OperationConfigImpl(String objectFullId) {
|
||||
super();
|
||||
setObjectFullId(objectFullId);
|
||||
}
|
||||
|
||||
// OperationConfig
|
||||
|
||||
@Override
|
||||
public String getObjectFullId() {
|
||||
return objectFullId;
|
||||
}
|
||||
String objectFullId;
|
||||
|
||||
@Override
|
||||
public boolean isForced() {
|
||||
return isForced;
|
||||
}
|
||||
boolean isForced = false;
|
||||
boolean isSoft = false;
|
||||
boolean isAffected = false;
|
||||
|
||||
@Override
|
||||
public boolean isSoft() {
|
||||
return isSoft;
|
||||
}
|
||||
final Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> affected = new HashMap<>();
|
||||
|
||||
@Override
|
||||
public Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> getAffected() {
|
||||
return affected;
|
||||
}
|
||||
final List<String> target = new ArrayList<>();
|
||||
|
||||
// others
|
||||
public OperationConfigImpl(String objectFullId) {
|
||||
super();
|
||||
setObjectFullId(objectFullId);
|
||||
}
|
||||
|
||||
public OperationConfigImpl forced(boolean forcedValue) {
|
||||
this.setForced(forcedValue);
|
||||
return this;
|
||||
};
|
||||
|
||||
public OperationConfigImpl soft(boolean softValue) {
|
||||
this.setSoft(softValue);
|
||||
return this;
|
||||
};
|
||||
|
||||
public OperationConfigImpl affectedOperation(boolean affectedValue) {
|
||||
// OperationConfig
|
||||
|
||||
@Override
|
||||
public String getObjectFullId() {
|
||||
return objectFullId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isForced() {
|
||||
return isForced;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSoft() {
|
||||
return isSoft;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> getAffected() {
|
||||
return affected;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getTarget() {
|
||||
return target;
|
||||
}
|
||||
|
||||
// others
|
||||
|
||||
public OperationConfigImpl forced(boolean forcedValue) {
|
||||
this.setForced(forcedValue);
|
||||
return this;
|
||||
};
|
||||
|
||||
public OperationConfigImpl soft(boolean softValue) {
|
||||
this.setSoft(softValue);
|
||||
return this;
|
||||
};
|
||||
|
||||
public OperationConfigImpl affectedOperation(boolean affectedValue) {
|
||||
this.setIsAffected(affectedValue);
|
||||
return this;
|
||||
};
|
||||
|
||||
public OperationConfigImpl objectFullId(String objectFullIdValue) {
|
||||
this.setObjectFullId(objectFullIdValue);
|
||||
return this;
|
||||
};
|
||||
|
||||
public void setObjectFullId(String objectFullId) {
|
||||
this.objectFullId = objectFullId;
|
||||
}
|
||||
|
||||
public void setForced(boolean isForced) {
|
||||
this.isForced = isForced;
|
||||
}
|
||||
public OperationConfigImpl objectFullId(String objectFullIdValue) {
|
||||
this.setObjectFullId(objectFullIdValue);
|
||||
return this;
|
||||
};
|
||||
|
||||
public void setSoft(boolean isSoft) {
|
||||
this.isSoft = isSoft;
|
||||
}
|
||||
|
||||
public void setIsAffected(boolean isAffected) {
|
||||
public OperationConfigImpl target(List<String> targetValue) {
|
||||
setTarget(targetValue);
|
||||
return this;
|
||||
}
|
||||
|
||||
public void setObjectFullId(String objectFullId) {
|
||||
this.objectFullId = objectFullId;
|
||||
}
|
||||
|
||||
public void setForced(boolean isForced) {
|
||||
this.isForced = isForced;
|
||||
}
|
||||
|
||||
public void setSoft(boolean isSoft) {
|
||||
this.isSoft = isSoft;
|
||||
}
|
||||
|
||||
public void setIsAffected(boolean isAffected) {
|
||||
this.isAffected = isAffected;
|
||||
}
|
||||
|
||||
public void setTarget(List<String> targets) {
|
||||
target.clear();
|
||||
if (targets != null)
|
||||
target.addAll(targets);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAffected() {
|
||||
return isAffected;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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,6 +25,7 @@
|
||||
*/
|
||||
package ru.entaxy.platform.objects.runtime.impl.manager;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -37,74 +38,78 @@ import org.slf4j.LoggerFactory;
|
||||
import ru.entaxy.platform.core.artifact.legacy.BundleController;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject.ENTAXY_RUNTIME_OBJECT_STATE;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectClusterInfo;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectManager.ENTAXY_RUNTIME_OBJECT_OPERATION;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectManager.OperationConfig;
|
||||
import ru.entaxy.platform.objects.runtime.impl.EntaxyRuntimeObjectServiceImpl;
|
||||
|
||||
public abstract class OperationExecutor<T extends OperationExecutor<T>> {
|
||||
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(OperationExecutor.class);
|
||||
|
||||
EntaxyRuntimeObjectManagerImpl objectManager;
|
||||
|
||||
public T objectManager(EntaxyRuntimeObjectManagerImpl objectManager) {
|
||||
this.objectManager = objectManager;
|
||||
return (T)this;
|
||||
}
|
||||
|
||||
public OperationResultImpl execute(OperationConfig operationConfig) {
|
||||
EntaxyRuntimeObject runtimeObject = getObjectFromConfig(operationConfig);
|
||||
if (runtimeObject == null)
|
||||
return OperationResultImpl.createFailed().message("Object not found: " + operationConfig.getObjectFullId());
|
||||
Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> prerequisites = getPrerequisites(operationConfig, runtimeObject);
|
||||
if (!prerequisites.isEmpty()) {
|
||||
log.warn("Operation aborted due to failure to meet " + operationConfig.getObjectFullId() + " prerequisites");
|
||||
return OperationResultImpl.createBlocked().affected(prerequisites);
|
||||
}
|
||||
if (operationConfig.isForced()) {
|
||||
// execute all operations on affected objects
|
||||
operationConfig.getAffected().clear();
|
||||
operationConfig.getAffected().putAll(getAffected(operationConfig));
|
||||
return doExecute(operationConfig, runtimeObject);
|
||||
}
|
||||
if (operationConfig.isSoft()) {
|
||||
// NOT execute operations on affected objects
|
||||
operationConfig.getAffected().clear();
|
||||
return doExecute(operationConfig, runtimeObject);
|
||||
}
|
||||
if (checkAffected(operationConfig)) {
|
||||
return doExecute(operationConfig, runtimeObject);
|
||||
}
|
||||
return OperationResultImpl.createRequest(getAffected(operationConfig));
|
||||
}
|
||||
EntaxyRuntimeObjectManagerImpl objectManager;
|
||||
|
||||
protected Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> createMapForObjects(List<EntaxyRuntimeObject> objects, ENTAXY_RUNTIME_OBJECT_OPERATION operation) {
|
||||
Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> map = new HashMap<>();
|
||||
for (EntaxyRuntimeObject obj: objects)
|
||||
map.put(obj.getObjectFullId(), operation);
|
||||
return map;
|
||||
}
|
||||
|
||||
protected boolean colocated(EntaxyRuntimeObject...objects) {
|
||||
if (objects.length == 0)
|
||||
return true;
|
||||
String containerId = objects[0].getContainer().getId();
|
||||
for (int i=0; i<objects.length; i++)
|
||||
if (!objects[i].getContainer().getId().equals(containerId))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
protected ENTAXY_RUNTIME_OBJECT_STATE getObjectState(EntaxyRuntimeObject object) {
|
||||
return EntaxyRuntimeObjectServiceImpl.getInstance().getObjectState(object);
|
||||
}
|
||||
|
||||
protected ENTAXY_RUNTIME_OBJECT_STATE getObjectState(EntaxyRuntimeObject object, ENTAXY_RUNTIME_OBJECT_STATE expectedState) {
|
||||
public T objectManager(EntaxyRuntimeObjectManagerImpl objectManager) {
|
||||
this.objectManager = objectManager;
|
||||
return (T) this;
|
||||
}
|
||||
|
||||
public OperationResultImpl execute(OperationConfig operationConfig) {
|
||||
EntaxyRuntimeObject runtimeObject = getObjectFromConfig(operationConfig);
|
||||
if (runtimeObject == null)
|
||||
return OperationResultImpl.createFailed().message("Object not found: " + operationConfig.getObjectFullId());
|
||||
Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> prerequisites = getPrerequisites(operationConfig, runtimeObject);
|
||||
if (!prerequisites.isEmpty()) {
|
||||
log.warn(
|
||||
"Operation aborted due to failure to meet " + operationConfig.getObjectFullId() + " prerequisites");
|
||||
return OperationResultImpl.createBlocked().affected(prerequisites);
|
||||
}
|
||||
if (operationConfig.isForced()) {
|
||||
// execute all operations on affected objects
|
||||
operationConfig.getAffected().clear();
|
||||
operationConfig.getAffected().putAll(getAffected(operationConfig));
|
||||
return doExecute(operationConfig, runtimeObject);
|
||||
}
|
||||
if (operationConfig.isSoft()) {
|
||||
// NOT execute operations on affected objects
|
||||
operationConfig.getAffected().clear();
|
||||
return doExecute(operationConfig, runtimeObject);
|
||||
}
|
||||
if (checkAffected(operationConfig)) {
|
||||
return doExecute(operationConfig, runtimeObject);
|
||||
}
|
||||
return OperationResultImpl.createRequest(getAffected(operationConfig));
|
||||
}
|
||||
|
||||
protected Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> createMapForObjects(List<EntaxyRuntimeObject> objects,
|
||||
ENTAXY_RUNTIME_OBJECT_OPERATION operation) {
|
||||
Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> map = new HashMap<>();
|
||||
for (EntaxyRuntimeObject obj : objects)
|
||||
map.put(obj.getObjectFullId(), operation);
|
||||
return map;
|
||||
}
|
||||
|
||||
protected boolean colocated(EntaxyRuntimeObject... objects) {
|
||||
if (objects.length == 0)
|
||||
return true;
|
||||
String containerId = objects[0].getContainer().getId();
|
||||
for (int i = 0; i < objects.length; i++)
|
||||
if (!objects[i].getContainer().getId().equals(containerId))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
protected ENTAXY_RUNTIME_OBJECT_STATE getObjectState(EntaxyRuntimeObject object) {
|
||||
return EntaxyRuntimeObjectServiceImpl.getInstance().getObjectState(object);
|
||||
}
|
||||
|
||||
protected ENTAXY_RUNTIME_OBJECT_STATE getObjectState(EntaxyRuntimeObject object,
|
||||
ENTAXY_RUNTIME_OBJECT_STATE expectedState) {
|
||||
if (expectedState != null) {
|
||||
synchronized (this) {
|
||||
int limit = 0;
|
||||
EntaxyRuntimeObjectServiceImpl objService = EntaxyRuntimeObjectServiceImpl.getInstance();
|
||||
while (!(expectedState.equals(objService.getObjectState(object))) && limit++ < 30) {
|
||||
while (!(expectedState.equals(objService.getObjectState(object))) && limit++ < 30) {
|
||||
try {
|
||||
this.wait(1000);
|
||||
} catch (InterruptedException e) {
|
||||
@@ -115,51 +120,60 @@ public abstract class OperationExecutor<T extends OperationExecutor<T>> {
|
||||
}
|
||||
return EntaxyRuntimeObjectServiceImpl.getInstance().getObjectState(object);
|
||||
}
|
||||
|
||||
protected EntaxyRuntimeObject getObjectFromConfig(OperationConfig operationConfig) {
|
||||
try {
|
||||
return EntaxyRuntimeObjectServiceImpl.getInstance().getRuntimeObject(operationConfig.getObjectFullId());
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> getAffected(OperationConfig operationConfig){
|
||||
EntaxyRuntimeObject object = getObjectFromConfig(operationConfig);
|
||||
if (object == null)
|
||||
return new HashMap<>();
|
||||
return doGetAffected(operationConfig, object);
|
||||
};
|
||||
|
||||
protected abstract Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> doGetAffected(
|
||||
OperationConfig operationConfig
|
||||
, EntaxyRuntimeObject runtimeObject);
|
||||
|
||||
protected Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> getPrerequisites(
|
||||
OperationConfig operationConfig
|
||||
, EntaxyRuntimeObject runtimeObject){
|
||||
return Collections.emptyMap();
|
||||
};
|
||||
|
||||
protected boolean checkAffected(OperationConfig operationConfig) {
|
||||
Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> affected = getAffected(operationConfig);
|
||||
for (Entry<String, ENTAXY_RUNTIME_OBJECT_OPERATION> entry: operationConfig.getAffected().entrySet()) {
|
||||
if (!affected.containsKey(entry.getKey()))
|
||||
// found not affected object
|
||||
return false;
|
||||
if (!affected.get(entry.getKey()).equals(entry.getValue()))
|
||||
// operation not equal
|
||||
return false;
|
||||
}
|
||||
return affected.size() == operationConfig.getAffected().size();
|
||||
}
|
||||
|
||||
protected abstract OperationResultImpl doExecute(OperationConfig operationConfig, EntaxyRuntimeObject runtimeObject);
|
||||
|
||||
// TOOD return local or cluster controller depending on object location
|
||||
protected BundleController getBundleController(EntaxyRuntimeObject runtimeObject) {
|
||||
return EntaxyRuntimeObjectServiceImpl.getInstance().getArtifactService()
|
||||
.installers().cluster().bundleController();
|
||||
}
|
||||
|
||||
protected EntaxyRuntimeObject getObjectFromConfig(OperationConfig operationConfig) {
|
||||
try {
|
||||
return EntaxyRuntimeObjectServiceImpl.getInstance().getRuntimeObject(operationConfig.getObjectFullId());
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
protected Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> getAffected(OperationConfig operationConfig) {
|
||||
EntaxyRuntimeObject object = getObjectFromConfig(operationConfig);
|
||||
if (object == null)
|
||||
return new HashMap<>();
|
||||
return doGetAffected(operationConfig, object);
|
||||
};
|
||||
|
||||
protected abstract Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> doGetAffected(
|
||||
OperationConfig operationConfig, EntaxyRuntimeObject runtimeObject);
|
||||
|
||||
protected Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> getPrerequisites(
|
||||
OperationConfig operationConfig, EntaxyRuntimeObject runtimeObject) {
|
||||
return Collections.emptyMap();
|
||||
};
|
||||
|
||||
protected boolean checkAffected(OperationConfig operationConfig) {
|
||||
Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> affected = getAffected(operationConfig);
|
||||
for (Entry<String, ENTAXY_RUNTIME_OBJECT_OPERATION> entry : operationConfig.getAffected().entrySet()) {
|
||||
if (!affected.containsKey(entry.getKey()))
|
||||
// found not affected object
|
||||
return false;
|
||||
if (!affected.get(entry.getKey()).equals(entry.getValue()))
|
||||
// operation not equal
|
||||
return false;
|
||||
}
|
||||
return affected.size() == operationConfig.getAffected().size();
|
||||
}
|
||||
|
||||
protected abstract OperationResultImpl doExecute(OperationConfig operationConfig,
|
||||
EntaxyRuntimeObject runtimeObject);
|
||||
|
||||
// TOOD return local or cluster controller depending on object location
|
||||
protected BundleController getBundleController(EntaxyRuntimeObject runtimeObject, List<String> target) {
|
||||
EntaxyRuntimeObjectClusterInfo clusterInfo =
|
||||
objectManager.getObjectService().getClusterInfo(runtimeObject.getObjectFullId());
|
||||
if (clusterInfo == null || clusterInfo.isLocal())
|
||||
return EntaxyRuntimeObjectServiceImpl.getInstance().getArtifactService()
|
||||
.installers().local().bundleController();
|
||||
List<String> groups = new ArrayList<>();
|
||||
if (target != null && !target.isEmpty())
|
||||
groups.addAll(target);
|
||||
else
|
||||
groups.addAll(clusterInfo.getValidGroups());
|
||||
return EntaxyRuntimeObjectServiceImpl.getInstance().getArtifactService()
|
||||
.installers().cluster().groups(groups.toArray(new String[] {})).bundleController();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
@@ -43,73 +43,76 @@ import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectManager.OperationRe
|
||||
|
||||
public class OperationExecutorStart extends OperationExecutor<OperationExecutorStart> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(OperationExecutorStart.class);
|
||||
|
||||
@Override
|
||||
protected Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> getPrerequisites(OperationConfig operationConfig,
|
||||
EntaxyRuntimeObject runtimeObject) {
|
||||
|
||||
List<EntaxyRuntimeObject> objects = runtimeObject.getDependsOn().stream()
|
||||
.map(rel -> rel.getMain())
|
||||
.filter(obj -> !runtimeObject.isColocatedWith(obj))
|
||||
.filter(obj -> !ENTAXY_RUNTIME_OBJECT_STATE.ACTIVE.equals(
|
||||
getObjectState(obj, (operationConfig.isAffected() ? ENTAXY_RUNTIME_OBJECT_STATE.ACTIVE : null))))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return createMapForObjects(objects, ENTAXY_RUNTIME_OBJECT_OPERATION.START);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> doGetAffected(OperationConfig operationConfig,
|
||||
EntaxyRuntimeObject runtimeObject) {
|
||||
final Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> result = new HashMap<>();
|
||||
|
||||
List<EntaxyRuntimeObject> dependents = runtimeObject.getDependents().stream()
|
||||
.filter(rel -> !OBJECT_RELATION.COMPOSITION.equals(rel.getType()))
|
||||
.map(rel -> rel.getDependent())
|
||||
.filter(obj -> !runtimeObject.isColocatedWith(obj))
|
||||
.filter(obj -> !ENTAXY_RUNTIME_OBJECT_STATE.ACTIVE.equals(getObjectState(obj)))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (EntaxyRuntimeObject obj: dependents)
|
||||
result.put(obj.getObjectFullId(), ENTAXY_RUNTIME_OBJECT_OPERATION.START);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected OperationResultImpl doExecute(OperationConfig operationConfig, EntaxyRuntimeObject runtimeObject) {
|
||||
private static final Logger log = LoggerFactory.getLogger(OperationExecutorStart.class);
|
||||
|
||||
try {
|
||||
getBundleController(runtimeObject).startBundle(runtimeObject.getContainer().getName());
|
||||
} catch (Exception e) {
|
||||
log.error("ERROR starting [" + runtimeObject.getObjectFullId() + "]", e);
|
||||
return OperationResultImpl.createFailed().message("ERROR starting [" + runtimeObject.getObjectFullId()
|
||||
+ "]; ORIGINAL MESSAGE: " + e.getMessage());
|
||||
}
|
||||
|
||||
// start all compostion-dependent objects, not colocated with the current
|
||||
List<EntaxyRuntimeObject> parts = runtimeObject.getRelations(OBJECT_RELATION.COMPOSITION).stream()
|
||||
.map(rel -> rel.getDependent())
|
||||
.filter(obj -> !runtimeObject.isColocatedWith(obj))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (EntaxyRuntimeObject part: parts) {
|
||||
OperationResult result = objectManager.startForced(part.getObjectFullId(), true);
|
||||
if (ENTAXY_RUNTIME_OBJECT_OPERATION_RESULT.FAILED.equals(result.getResult()))
|
||||
return OperationResultImpl.createFailed().message(
|
||||
"FAILED starting [" + part.getObjectFullId() + "]; ORIGINAL MESSAGE: " + result.getMessage());
|
||||
}
|
||||
|
||||
// start all affected objects
|
||||
for (String affectedId: operationConfig.getAffected().keySet()) {
|
||||
OperationResult result = objectManager.startForced(affectedId, true);
|
||||
if (ENTAXY_RUNTIME_OBJECT_OPERATION_RESULT.FAILED.equals(result.getResult()))
|
||||
return OperationResultImpl.createFailed().message(
|
||||
"FAILED starting [" + affectedId + "]; ORIGINAL MESSAGE: " + result.getMessage());
|
||||
}
|
||||
|
||||
return OperationResultImpl.createDone();
|
||||
}
|
||||
@Override
|
||||
protected Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> getPrerequisites(OperationConfig operationConfig,
|
||||
EntaxyRuntimeObject runtimeObject) {
|
||||
|
||||
List<EntaxyRuntimeObject> objects = runtimeObject.getDependsOn().stream()
|
||||
.map(rel -> rel.getMain())
|
||||
.filter(obj -> !runtimeObject.isColocatedWith(obj))
|
||||
.filter(obj -> !ENTAXY_RUNTIME_OBJECT_STATE.ACTIVE.equals(
|
||||
getObjectState(obj,
|
||||
(operationConfig.isAffected() ? ENTAXY_RUNTIME_OBJECT_STATE.ACTIVE : null))))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return createMapForObjects(objects, ENTAXY_RUNTIME_OBJECT_OPERATION.START);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> doGetAffected(OperationConfig operationConfig,
|
||||
EntaxyRuntimeObject runtimeObject) {
|
||||
final Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> result = new HashMap<>();
|
||||
|
||||
List<EntaxyRuntimeObject> dependents = runtimeObject.getDependents().stream()
|
||||
.filter(rel -> !OBJECT_RELATION.COMPOSITION.equals(rel.getType()))
|
||||
.map(rel -> rel.getDependent())
|
||||
.filter(obj -> !runtimeObject.isColocatedWith(obj))
|
||||
.filter(obj -> !ENTAXY_RUNTIME_OBJECT_STATE.ACTIVE.equals(getObjectState(obj)))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (EntaxyRuntimeObject obj : dependents)
|
||||
result.put(obj.getObjectFullId(), ENTAXY_RUNTIME_OBJECT_OPERATION.START);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected OperationResultImpl doExecute(OperationConfig operationConfig, EntaxyRuntimeObject runtimeObject) {
|
||||
|
||||
try {
|
||||
getBundleController(runtimeObject, operationConfig.getTarget())
|
||||
.startBundle(runtimeObject.getContainer().getName());
|
||||
} catch (Exception e) {
|
||||
log.error("ERROR starting [" + runtimeObject.getObjectFullId() + "]", e);
|
||||
return OperationResultImpl.createFailed().message("ERROR starting [" + runtimeObject.getObjectFullId()
|
||||
+ "]; ORIGINAL MESSAGE: " + e.getMessage());
|
||||
}
|
||||
|
||||
// start all compostion-dependent objects, not colocated with the current
|
||||
List<EntaxyRuntimeObject> parts = runtimeObject.getRelations(OBJECT_RELATION.COMPOSITION).stream()
|
||||
.map(rel -> rel.getDependent())
|
||||
.filter(obj -> !runtimeObject.isColocatedWith(obj))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (EntaxyRuntimeObject part : parts) {
|
||||
OperationResult result =
|
||||
objectManager.startForced(part.getObjectFullId(), true, operationConfig.getTarget());
|
||||
if (ENTAXY_RUNTIME_OBJECT_OPERATION_RESULT.FAILED.equals(result.getResult()))
|
||||
return OperationResultImpl.createFailed().message(
|
||||
"FAILED starting [" + part.getObjectFullId() + "]; ORIGINAL MESSAGE: " + result.getMessage());
|
||||
}
|
||||
|
||||
// start all affected objects
|
||||
for (String affectedId : operationConfig.getAffected().keySet()) {
|
||||
OperationResult result = objectManager.startForced(affectedId, true, operationConfig.getTarget());
|
||||
if (ENTAXY_RUNTIME_OBJECT_OPERATION_RESULT.FAILED.equals(result.getResult()))
|
||||
return OperationResultImpl.createFailed().message(
|
||||
"FAILED starting [" + affectedId + "]; ORIGINAL MESSAGE: " + result.getMessage());
|
||||
}
|
||||
|
||||
return OperationResultImpl.createDone();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
@@ -35,7 +35,6 @@ import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.platform.base.objects.EntaxyObject;
|
||||
import ru.entaxy.platform.base.objects.EntaxyObject.OBJECT_RELATION;
|
||||
import ru.entaxy.platform.core.artifact.legacy.BundleController;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject.ENTAXY_RUNTIME_OBJECT_STATE;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectManager.ENTAXY_RUNTIME_OBJECT_OPERATION;
|
||||
@@ -43,69 +42,69 @@ import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectManager.ENTAXY_RUNT
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectManager.OperationConfig;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectManager.OperationResult;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeRelation;
|
||||
import ru.entaxy.platform.objects.runtime.impl.EntaxyRuntimeObjectServiceImpl;
|
||||
|
||||
public class OperationExecutorStop extends OperationExecutor<OperationExecutorStop> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(OperationExecutorStop.class);
|
||||
|
||||
@Override
|
||||
protected Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> doGetAffected(OperationConfig operationConfig,
|
||||
EntaxyRuntimeObject runtimeObject) {
|
||||
final Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> result = new HashMap<>();
|
||||
private static final Logger log = LoggerFactory.getLogger(OperationExecutorStop.class);
|
||||
|
||||
List<EntaxyRuntimeRelation> relations = runtimeObject.getRelations(OBJECT_RELATION.AGGREGATION);
|
||||
relations.addAll(runtimeObject.getIncomiingRelations(OBJECT_RELATION.DEPENDENCY));
|
||||
relations.addAll(runtimeObject.getIncomiingRelations(OBJECT_RELATION.USE));
|
||||
|
||||
List<EntaxyRuntimeObject> objects = relations.stream()
|
||||
.map(rel -> rel.getDependent())
|
||||
.filter(obj ->
|
||||
!runtimeObject.isColocatedWith(obj) ||
|
||||
!EntaxyObject.OBJECT_SCOPE.PRIVATE.equals(obj.getScope()))
|
||||
.filter(obj -> ENTAXY_RUNTIME_OBJECT_STATE.ACTIVE.equals(getObjectState(obj)))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (EntaxyRuntimeObject obj: objects)
|
||||
result.put(obj.getObjectFullId(), ENTAXY_RUNTIME_OBJECT_OPERATION.STOP);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected OperationResultImpl doExecute(OperationConfig operationConfig, EntaxyRuntimeObject runtimeObject) {
|
||||
// stop all compostion-dependent objects, not colocated with the current
|
||||
List<EntaxyRuntimeObject> parts = runtimeObject.getRelations(OBJECT_RELATION.COMPOSITION).stream()
|
||||
.map(rel -> rel.getDependent())
|
||||
.filter(obj -> !runtimeObject.getContainer().getId().equals(obj.getContainer().getId()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (EntaxyRuntimeObject part: parts) {
|
||||
OperationResult result = objectManager.stopForced(part.getObjectFullId());
|
||||
if (ENTAXY_RUNTIME_OBJECT_OPERATION_RESULT.FAILED.equals(result.getResult()))
|
||||
return OperationResultImpl.createFailed().message(
|
||||
"FAILED stopping [" + part.getObjectFullId() + "]; ORIGINAL MESSAGE: " + result.getMessage());
|
||||
}
|
||||
|
||||
// stop all affected objects
|
||||
for (String affectedId: operationConfig.getAffected().keySet()) {
|
||||
// EntaxyRuntimeObject affected = objectManager.getObjectService().getRuntimeObject(affectedId);
|
||||
OperationResult result = objectManager.stopForced(affectedId);
|
||||
if (ENTAXY_RUNTIME_OBJECT_OPERATION_RESULT.FAILED.equals(result.getResult()))
|
||||
return OperationResultImpl.createFailed().message(
|
||||
"FAILED stopping [" + affectedId + "]; ORIGINAL MESSAGE: " + result.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
getBundleController(runtimeObject).stopBundle(runtimeObject.getContainer().getName());
|
||||
return OperationResultImpl.createDone();
|
||||
} catch (Exception e) {
|
||||
log.error("ERROR stoping [" + runtimeObject.getObjectFullId() + "]", e);
|
||||
return OperationResultImpl.createFailed().message("ERROR stoping [" + runtimeObject.getObjectFullId()
|
||||
+ "]; ORIGINAL MESSAGE: " + e.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> doGetAffected(OperationConfig operationConfig,
|
||||
EntaxyRuntimeObject runtimeObject) {
|
||||
final Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> result = new HashMap<>();
|
||||
|
||||
}
|
||||
List<EntaxyRuntimeRelation> relations = runtimeObject.getRelations(OBJECT_RELATION.AGGREGATION);
|
||||
relations.addAll(runtimeObject.getIncomiingRelations(OBJECT_RELATION.DEPENDENCY));
|
||||
relations.addAll(runtimeObject.getIncomiingRelations(OBJECT_RELATION.USE));
|
||||
|
||||
List<EntaxyRuntimeObject> objects = relations.stream()
|
||||
.map(rel -> rel.getDependent())
|
||||
.filter(obj -> !runtimeObject.isColocatedWith(obj) ||
|
||||
!EntaxyObject.OBJECT_SCOPE.PRIVATE.equals(obj.getScope()))
|
||||
.filter(obj -> ENTAXY_RUNTIME_OBJECT_STATE.ACTIVE.equals(getObjectState(obj)))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (EntaxyRuntimeObject obj : objects)
|
||||
result.put(obj.getObjectFullId(), ENTAXY_RUNTIME_OBJECT_OPERATION.STOP);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected OperationResultImpl doExecute(OperationConfig operationConfig, EntaxyRuntimeObject runtimeObject) {
|
||||
// stop all compostion-dependent objects, not colocated with the current
|
||||
List<EntaxyRuntimeObject> parts = runtimeObject.getRelations(OBJECT_RELATION.COMPOSITION).stream()
|
||||
.map(rel -> rel.getDependent())
|
||||
.filter(obj -> !runtimeObject.getContainer().getId().equals(obj.getContainer().getId()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (EntaxyRuntimeObject part : parts) {
|
||||
OperationResult result = objectManager.stopForced(part.getObjectFullId(), operationConfig.getTarget());
|
||||
if (ENTAXY_RUNTIME_OBJECT_OPERATION_RESULT.FAILED.equals(result.getResult()))
|
||||
return OperationResultImpl.createFailed().message(
|
||||
"FAILED stopping [" + part.getObjectFullId() + "]; ORIGINAL MESSAGE: " + result.getMessage());
|
||||
}
|
||||
|
||||
// stop all affected objects
|
||||
for (String affectedId : operationConfig.getAffected().keySet()) {
|
||||
// EntaxyRuntimeObject affected =
|
||||
// objectManager.getObjectService().getRuntimeObject(affectedId);
|
||||
OperationResult result = objectManager.stopForced(affectedId, operationConfig.getTarget());
|
||||
if (ENTAXY_RUNTIME_OBJECT_OPERATION_RESULT.FAILED.equals(result.getResult()))
|
||||
return OperationResultImpl.createFailed().message(
|
||||
"FAILED stopping [" + affectedId + "]; ORIGINAL MESSAGE: " + result.getMessage());
|
||||
}
|
||||
|
||||
try {
|
||||
getBundleController(runtimeObject, operationConfig.getTarget())
|
||||
.stopBundle(runtimeObject.getContainer().getName());
|
||||
return OperationResultImpl.createDone();
|
||||
} catch (Exception e) {
|
||||
log.error("ERROR stoping [" + runtimeObject.getObjectFullId() + "]", e);
|
||||
return OperationResultImpl.createFailed().message("ERROR stoping [" + runtimeObject.getObjectFullId()
|
||||
+ "]; ORIGINAL MESSAGE: " + e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
@@ -46,86 +46,87 @@ import ru.entaxy.platform.objects.runtime.EntaxyRuntimeRelation;
|
||||
|
||||
public class OperationExecutorUninstall extends OperationExecutor<OperationExecutorUninstall> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(OperationExecutorUninstall.class);
|
||||
|
||||
@Override
|
||||
protected Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> doGetAffected(OperationConfig operationConfig,
|
||||
EntaxyRuntimeObject runtimeObject) {
|
||||
final Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> result = new HashMap<>();
|
||||
private static final Logger log = LoggerFactory.getLogger(OperationExecutorUninstall.class);
|
||||
|
||||
List<EntaxyRuntimeRelation> relations = runtimeObject.getRelations(OBJECT_RELATION.AGGREGATION);
|
||||
@Override
|
||||
protected Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> doGetAffected(OperationConfig operationConfig,
|
||||
EntaxyRuntimeObject runtimeObject) {
|
||||
final Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> result = new HashMap<>();
|
||||
|
||||
List<EntaxyRuntimeObject> objects = relations.stream()
|
||||
.map(rel -> rel.getDependent())
|
||||
.filter(obj ->
|
||||
!runtimeObject.isColocatedWith(obj) ||
|
||||
!EntaxyObject.OBJECT_SCOPE.PRIVATE.equals(obj.getScope()))
|
||||
.filter(obj -> ENTAXY_RUNTIME_OBJECT_STATE.ACTIVE.equals(getObjectState(obj)))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (EntaxyRuntimeObject obj: objects)
|
||||
result.put(obj.getObjectFullId(), ENTAXY_RUNTIME_OBJECT_OPERATION.UNINSTALL);
|
||||
|
||||
|
||||
relations = runtimeObject.getIncomiingRelations(OBJECT_RELATION.DEPENDENCY);
|
||||
relations.addAll(runtimeObject.getIncomiingRelations(OBJECT_RELATION.USE));
|
||||
List<EntaxyRuntimeRelation> relations = runtimeObject.getRelations(OBJECT_RELATION.AGGREGATION);
|
||||
|
||||
objects = relations.stream()
|
||||
.map(rel -> rel.getDependent())
|
||||
.filter(obj -> ENTAXY_RUNTIME_OBJECT_STATE.ACTIVE.equals(getObjectState(obj)))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (EntaxyRuntimeObject obj: objects)
|
||||
result.put(obj.getObjectFullId(), ENTAXY_RUNTIME_OBJECT_OPERATION.STOP);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected OperationResultImpl doExecute(OperationConfig operationConfig, EntaxyRuntimeObject runtimeObject) {
|
||||
// uninstall all compostion-dependent objects, not colocated with the current
|
||||
List<EntaxyRuntimeObject> parts = runtimeObject.getRelations(OBJECT_RELATION.COMPOSITION).stream()
|
||||
.map(rel -> rel.getDependent())
|
||||
.filter(obj -> !runtimeObject.getContainer().getId().equals(obj.getContainer().getId()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (EntaxyRuntimeObject part: parts) {
|
||||
OperationResult result = objectManager.uninstallForced(part.getObjectFullId());
|
||||
if (ENTAXY_RUNTIME_OBJECT_OPERATION_RESULT.FAILED.equals(result.getResult()))
|
||||
return OperationResultImpl.createFailed().message(
|
||||
"FAILED stopping [" + part.getObjectFullId() + "]; ORIGINAL MESSAGE: " + result.getMessage());
|
||||
}
|
||||
|
||||
// process (uninstall or stop) all affected objects
|
||||
for (Entry<String, ENTAXY_RUNTIME_OBJECT_OPERATION> entry: operationConfig.getAffected().entrySet()) {
|
||||
|
||||
String affectedId = entry.getKey();
|
||||
ENTAXY_RUNTIME_OBJECT_OPERATION operation = entry.getValue();
|
||||
|
||||
OperationConfigImpl config = new OperationConfigImpl(affectedId);
|
||||
config.forced(true);
|
||||
|
||||
OperationResult result = objectManager.execute(operation, config);
|
||||
if (ENTAXY_RUNTIME_OBJECT_OPERATION_RESULT.FAILED.equals(result.getResult()))
|
||||
return OperationResultImpl.createFailed().message(
|
||||
"FAILED operation [" + operation.name() + "] on [" + affectedId + "]; ORIGINAL MESSAGE: " + result.getMessage());
|
||||
}
|
||||
|
||||
// List<EntaxyRuntimeObjectResource> resources = runtimeObject.getResources();
|
||||
|
||||
try {
|
||||
getBundleController(runtimeObject).uninstallBundle(runtimeObject.getContainer().getName());
|
||||
// TODO: awaiting solution of task ENTAXY-1092
|
||||
// if (resources != null)
|
||||
// for (EntaxyRuntimeObjectResource resource : resources)
|
||||
// resource.getResource().delete();
|
||||
return OperationResultImpl.createDone();
|
||||
} catch (Exception e) {
|
||||
log.error("ERROR stoping [" + runtimeObject.getObjectFullId() + "]", e);
|
||||
return OperationResultImpl.createFailed().message("ERROR uninstalling [" + runtimeObject.getObjectFullId()
|
||||
+ "]; ORIGINAL MESSAGE: " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
List<EntaxyRuntimeObject> objects = relations.stream()
|
||||
.map(rel -> rel.getDependent())
|
||||
.filter(obj -> !runtimeObject.isColocatedWith(obj) ||
|
||||
!EntaxyObject.OBJECT_SCOPE.PRIVATE.equals(obj.getScope()))
|
||||
.filter(obj -> ENTAXY_RUNTIME_OBJECT_STATE.ACTIVE.equals(getObjectState(obj)))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (EntaxyRuntimeObject obj : objects)
|
||||
result.put(obj.getObjectFullId(), ENTAXY_RUNTIME_OBJECT_OPERATION.UNINSTALL);
|
||||
|
||||
|
||||
relations = runtimeObject.getIncomiingRelations(OBJECT_RELATION.DEPENDENCY);
|
||||
relations.addAll(runtimeObject.getIncomiingRelations(OBJECT_RELATION.USE));
|
||||
|
||||
objects = relations.stream()
|
||||
.map(rel -> rel.getDependent())
|
||||
.filter(obj -> ENTAXY_RUNTIME_OBJECT_STATE.ACTIVE.equals(getObjectState(obj)))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (EntaxyRuntimeObject obj : objects)
|
||||
result.put(obj.getObjectFullId(), ENTAXY_RUNTIME_OBJECT_OPERATION.STOP);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected OperationResultImpl doExecute(OperationConfig operationConfig, EntaxyRuntimeObject runtimeObject) {
|
||||
// uninstall all compostion-dependent objects, not colocated with the current
|
||||
List<EntaxyRuntimeObject> parts = runtimeObject.getRelations(OBJECT_RELATION.COMPOSITION).stream()
|
||||
.map(rel -> rel.getDependent())
|
||||
.filter(obj -> !runtimeObject.getContainer().getId().equals(obj.getContainer().getId()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (EntaxyRuntimeObject part : parts) {
|
||||
OperationResult result = objectManager.uninstallForced(part.getObjectFullId(), operationConfig.getTarget());
|
||||
if (ENTAXY_RUNTIME_OBJECT_OPERATION_RESULT.FAILED.equals(result.getResult()))
|
||||
return OperationResultImpl.createFailed().message(
|
||||
"FAILED stopping [" + part.getObjectFullId() + "]; ORIGINAL MESSAGE: " + result.getMessage());
|
||||
}
|
||||
|
||||
// process (uninstall or stop) all affected objects
|
||||
for (Entry<String, ENTAXY_RUNTIME_OBJECT_OPERATION> entry : operationConfig.getAffected().entrySet()) {
|
||||
|
||||
String affectedId = entry.getKey();
|
||||
ENTAXY_RUNTIME_OBJECT_OPERATION operation = entry.getValue();
|
||||
|
||||
OperationConfigImpl config = new OperationConfigImpl(affectedId);
|
||||
config.forced(true).target(operationConfig.getTarget());
|
||||
|
||||
OperationResult result = objectManager.execute(operation, config);
|
||||
if (ENTAXY_RUNTIME_OBJECT_OPERATION_RESULT.FAILED.equals(result.getResult()))
|
||||
return OperationResultImpl.createFailed().message(
|
||||
"FAILED operation [" + operation.name() + "] on [" + affectedId + "]; ORIGINAL MESSAGE: "
|
||||
+ result.getMessage());
|
||||
}
|
||||
|
||||
// List<EntaxyRuntimeObjectResource> resources = runtimeObject.getResources();
|
||||
|
||||
try {
|
||||
getBundleController(runtimeObject, operationConfig.getTarget())
|
||||
.uninstallBundle(runtimeObject.getContainer().getName());
|
||||
// TODO: awaiting solution of task ENTAXY-1092
|
||||
// if (resources != null)
|
||||
// for (EntaxyRuntimeObjectResource resource : resources)
|
||||
// resource.getResource().delete();
|
||||
return OperationResultImpl.createDone();
|
||||
} catch (Exception e) {
|
||||
log.error("ERROR stoping [" + runtimeObject.getObjectFullId() + "]", e);
|
||||
return OperationResultImpl.createFailed().message("ERROR uninstalling [" + runtimeObject.getObjectFullId()
|
||||
+ "]; ORIGINAL MESSAGE: " + e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.core</groupId>
|
||||
<artifactId>object-runtime</artifactId>
|
||||
<version>1.11.0</version>
|
||||
<version>1.12.0</version>
|
||||
</parent>
|
||||
<artifactId>object-runtime-shell</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
@@ -34,6 +34,10 @@
|
||||
<artifactId>object-runtime-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.cave.repository</groupId>
|
||||
<artifactId>org.apache.karaf.cave.repository.api</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -0,0 +1,87 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.platform.objects.runtime.shell;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.karaf.cave.repository.RepositorySearchService;
|
||||
import org.apache.karaf.cave.repository.SearchRequest;
|
||||
import org.apache.karaf.cave.repository.SearchResult;
|
||||
import org.apache.karaf.shell.api.action.Action;
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Reference;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.base.support.karaf.shell.ShellTableExt;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectContainer;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectUtils;
|
||||
|
||||
@Service
|
||||
@Command(name = "container-available-versions", scope = EntaxyRuntimeObjectServiceSupport.OBJECTS_SCOPE,
|
||||
description = "Get container info")
|
||||
public class ContainerIAvailableVersions extends ContainerAwareCommand implements Action {
|
||||
|
||||
@Reference
|
||||
RepositorySearchService repositorySearchService;
|
||||
|
||||
@Override
|
||||
protected Object doExecute(EntaxyRuntimeObjectContainer container) {
|
||||
|
||||
String url = container.getUrl();
|
||||
url = EntaxyRuntimeObjectUtils.extractMavenUrl(url);
|
||||
if (url == null || url.isBlank()) {
|
||||
System.out.println("Container url is not maven: " + url);
|
||||
return null;
|
||||
}
|
||||
|
||||
SearchRequest request = EntaxyRuntimeObjectUtils.createRequest(url);
|
||||
|
||||
ShellTableExt table = new ShellTableExt();
|
||||
table.column("Installed");
|
||||
table.column("Version");
|
||||
table.column("Last modified");
|
||||
table.column("Repository");
|
||||
|
||||
String currentVersion = request.getVersion();
|
||||
request.version(null);
|
||||
|
||||
List<SearchResult> result = repositorySearchService.search(request);
|
||||
if (result != null) {
|
||||
for (SearchResult sr : result) {
|
||||
table.addRow().addContent(
|
||||
currentVersion.equals(sr.getVersion()) ? "*" : "",
|
||||
sr.getVersion(),
|
||||
sr.lastModified,
|
||||
sr.getRepositoryName());
|
||||
}
|
||||
}
|
||||
|
||||
table.print(System.out);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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,7 +25,6 @@
|
||||
*/
|
||||
package ru.entaxy.platform.objects.runtime.shell;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Action;
|
||||
@@ -35,46 +34,49 @@ import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectContainer;
|
||||
|
||||
@Service
|
||||
@Command(name = "container-info", scope = EntaxyRuntimeObjectServiceSupport.OBJECTS_SCOPE, description = "Get container info")
|
||||
@Command(name = "container-info", scope = EntaxyRuntimeObjectServiceSupport.OBJECTS_SCOPE,
|
||||
description = "Get container info")
|
||||
public class ContainerInfo extends ContainerAwareCommand implements Action {
|
||||
|
||||
|
||||
@Override
|
||||
protected Object doExecute(EntaxyRuntimeObjectContainer container) {
|
||||
String message = "Container Info for ".concat(containerName)
|
||||
.concat("\n----------------------------------------")
|
||||
.concat("\nID: ".concat(container.getId()))
|
||||
.concat("\nTYPE: ".concat(container.getType()))
|
||||
.concat("\nNAME: ".concat(container.getName()))
|
||||
.concat("\nOBJECTS: ")
|
||||
.concat(
|
||||
container.getObjects().stream()
|
||||
.map(obj -> ("\n\t"+obj.getObjectFullId()))
|
||||
.collect(Collectors.joining())
|
||||
.concat("\nPARENT CONTAINERS: ")
|
||||
.concat(
|
||||
RuntimeObjectShellUtils.getContainerListPrintString(container.getParentContainers(), "\n\t")
|
||||
)
|
||||
.concat("\nDEPENDENCIES: ")
|
||||
.concat(
|
||||
RuntimeObjectShellUtils.getContainerListPrintString(container.getDependencies(), "\n\t")
|
||||
)
|
||||
.concat("\nCHILD CONTAINERS: ")
|
||||
.concat(
|
||||
RuntimeObjectShellUtils.getContainerListPrintString(container.getChildContainers(), "\n\t")
|
||||
)
|
||||
.concat("\nDEPENDENTS: ")
|
||||
.concat(
|
||||
RuntimeObjectShellUtils.getContainerListPrintString(container.getDependent(), "\n\t")
|
||||
)
|
||||
|
||||
);
|
||||
|
||||
|
||||
// output to console
|
||||
System.out.println(message);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Object doExecute(EntaxyRuntimeObjectContainer container) {
|
||||
String message = "Container Info for ".concat(containerName)
|
||||
.concat("\n----------------------------------------")
|
||||
.concat("\nID: ".concat(container.getId()))
|
||||
.concat("\nTYPE: ".concat(container.getType()))
|
||||
.concat("\nNAME: ".concat(container.getName()))
|
||||
.concat("\nURL: ".concat(container.getUrl()))
|
||||
.concat("\nVERSION: ".concat(container.getVersion().toString()))
|
||||
.concat("\nOBJECTS: ")
|
||||
.concat(
|
||||
container.getObjects().stream()
|
||||
.map(obj -> ("\n\t" + obj.getObjectFullId()))
|
||||
.collect(Collectors.joining())
|
||||
.concat("\nPARENT CONTAINERS: ")
|
||||
.concat(
|
||||
RuntimeObjectShellUtils
|
||||
.getContainerListPrintString(container.getParentContainers(), "\n\t"))
|
||||
.concat("\nDEPENDENCIES: ")
|
||||
.concat(
|
||||
RuntimeObjectShellUtils.getContainerListPrintString(container.getDependencies(),
|
||||
"\n\t"))
|
||||
.concat("\nCHILD CONTAINERS: ")
|
||||
.concat(
|
||||
RuntimeObjectShellUtils
|
||||
.getContainerListPrintString(container.getChildContainers(), "\n\t"))
|
||||
.concat("\nDEPENDENTS: ")
|
||||
.concat(
|
||||
RuntimeObjectShellUtils.getContainerListPrintString(container.getDependent(),
|
||||
"\n\t"))
|
||||
|
||||
);
|
||||
|
||||
|
||||
// output to console
|
||||
System.out.println(message);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
@@ -38,6 +38,7 @@ import org.apache.karaf.shell.support.table.ShellTable;
|
||||
import ru.entaxy.platform.base.support.JSONUtils;
|
||||
import ru.entaxy.platform.base.support.karaf.shell.ShellTableExt;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectClusterInfo;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectContainer;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectResource;
|
||||
|
||||
@@ -50,6 +51,8 @@ public class ObjectInfo extends RuntimeObjectAwareCommand {
|
||||
|
||||
EntaxyRuntimeObjectContainer container = entaxyObject.getContainer();
|
||||
|
||||
EntaxyRuntimeObjectClusterInfo clusterInfo = objectService.getClusterInfo(entaxyObject.getObjectFullId());
|
||||
|
||||
String message = "Object Info for ".concat(entaxyObject.getObjectFullId())
|
||||
.concat("\n----------------------------------------")
|
||||
.concat("\nID: ".concat(entaxyObject.getId()))
|
||||
@@ -80,7 +83,13 @@ public class ObjectInfo extends RuntimeObjectAwareCommand {
|
||||
.concat("\nDEPENDENTS: ")
|
||||
.concat(
|
||||
RuntimeObjectShellUtils.getRelationListDependentPrintString(
|
||||
RuntimeObjectShellUtils.getObjectIncomingDependenciesAndUses(entaxyObject), "\n\t"));
|
||||
RuntimeObjectShellUtils.getObjectIncomingDependenciesAndUses(entaxyObject), "\n\t"))
|
||||
.concat("\nDEPLOYMENT: ")
|
||||
.concat(clusterInfo == null || clusterInfo.isLocal() ? "local" : "cluster")
|
||||
.concat("\nCLUSTER GROUPS: ")
|
||||
.concat(clusterInfo == null || clusterInfo.isLocal() ? ""
|
||||
: clusterInfo.getGroups().stream().map(g -> g.getGroupString())
|
||||
.collect(Collectors.joining(", ")));
|
||||
|
||||
// object resources
|
||||
ShellTable table = new ShellTable();
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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,6 +25,9 @@
|
||||
*/
|
||||
package ru.entaxy.platform.objects.runtime.shell;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Option;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Reference;
|
||||
import org.apache.karaf.shell.support.table.ShellTable;
|
||||
@@ -36,102 +39,109 @@ import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectManager.OperationRe
|
||||
|
||||
public abstract class ObjectOperationCommand extends RuntimeObjectAwareCommand {
|
||||
|
||||
@Option(name = "-f", required = false, description = "Force action on affected objects")
|
||||
boolean force;
|
||||
|
||||
@Option(name = "-s", required = false, description = "Skip action on affected objects")
|
||||
boolean soft;
|
||||
|
||||
@Reference
|
||||
EntaxyRuntimeObjectManager objectManager;
|
||||
@Option(name = "-f", required = false, description = "Force action on affected objects")
|
||||
boolean force;
|
||||
|
||||
@Override
|
||||
public Object doExecute(EntaxyRuntimeObject entaxyObject) throws Exception {
|
||||
OperationResult result = doTargetExecute(entaxyObject);
|
||||
|
||||
// output result
|
||||
System.out.println("\t -> " + result.getResult().name());
|
||||
@Option(name = "-s", required = false, description = "Skip action on affected objects")
|
||||
boolean soft;
|
||||
|
||||
switch (result.getResult()) {
|
||||
case DONE:
|
||||
|
||||
break;
|
||||
case REQUEST:
|
||||
outputForRequest(result, entaxyObject);
|
||||
break;
|
||||
case BLOCKED:
|
||||
outputForBlocked(result, entaxyObject);
|
||||
break;
|
||||
case FAILED:
|
||||
outputForFailed(result, entaxyObject);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected abstract OperationResult doTargetExecute(EntaxyRuntimeObject entaxyObject) throws Exception;
|
||||
|
||||
protected void outputForRequest(OperationResult result, EntaxyRuntimeObject entaxyObject) {
|
||||
ShellTable table = new ShellTable();
|
||||
table.column("Object");
|
||||
table.column("Action");
|
||||
for (String key: result.getAffected().keySet())
|
||||
table.addRow().addContent(key, result.getAffected().get(key).name());
|
||||
|
||||
// output
|
||||
System.out.println("\nOperation should be applied to the following affected objects:");
|
||||
table.print(System.out);
|
||||
|
||||
String message = "\n"
|
||||
.concat("Use\n")
|
||||
.concat("\t-f option to apply all operations on affected objects\n")
|
||||
.concat("or\n")
|
||||
.concat("\t-s option to skip all operations on affected objects\n");
|
||||
|
||||
// output
|
||||
System.out.println(message);
|
||||
}
|
||||
@Option(name = "-g", required = false, description = "Cluster groups to apply action")
|
||||
String[] clusterGroups;
|
||||
|
||||
protected void outputForBlocked(OperationResult result, EntaxyRuntimeObject entaxyObject) {
|
||||
ShellTable table = new ShellTable();
|
||||
table.column("Object");
|
||||
table.column("Action");
|
||||
for (String key: result.getAffected().keySet())
|
||||
table.addRow().addContent(key, result.getAffected().get(key).name());
|
||||
|
||||
// output
|
||||
System.out.println("\nThe following operations must be applied before invoking the current one:");
|
||||
table.print(System.out);
|
||||
|
||||
}
|
||||
@Reference
|
||||
EntaxyRuntimeObjectManager objectManager;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public Object doExecute(EntaxyRuntimeObject entaxyObject) throws Exception {
|
||||
|
||||
List<String> operationTarget = clusterGroups == null ? null : Arrays.asList(clusterGroups);
|
||||
|
||||
OperationResult result = doTargetExecute(entaxyObject, operationTarget);
|
||||
|
||||
// output result
|
||||
System.out.println("\t -> " + result.getResult().name());
|
||||
|
||||
switch (result.getResult()) {
|
||||
case DONE:
|
||||
|
||||
break;
|
||||
case REQUEST:
|
||||
outputForRequest(result, entaxyObject);
|
||||
break;
|
||||
case BLOCKED:
|
||||
outputForBlocked(result, entaxyObject);
|
||||
break;
|
||||
case FAILED:
|
||||
outputForFailed(result, entaxyObject);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected abstract OperationResult doTargetExecute(EntaxyRuntimeObject entaxyObject, List<String> target)
|
||||
throws Exception;
|
||||
|
||||
protected void outputForRequest(OperationResult result, EntaxyRuntimeObject entaxyObject) {
|
||||
ShellTable table = new ShellTable();
|
||||
table.column("Object");
|
||||
table.column("Action");
|
||||
for (String key : result.getAffected().keySet())
|
||||
table.addRow().addContent(key, result.getAffected().get(key).name());
|
||||
|
||||
// output
|
||||
System.out.println("\nOperation should be applied to the following affected objects:");
|
||||
table.print(System.out);
|
||||
|
||||
String message = "\n"
|
||||
.concat("Use\n")
|
||||
.concat("\t-f option to apply all operations on affected objects\n")
|
||||
.concat("or\n")
|
||||
.concat("\t-s option to skip all operations on affected objects\n");
|
||||
|
||||
// output
|
||||
System.out.println(message);
|
||||
}
|
||||
|
||||
protected void outputForBlocked(OperationResult result, EntaxyRuntimeObject entaxyObject) {
|
||||
ShellTable table = new ShellTable();
|
||||
table.column("Object");
|
||||
table.column("Action");
|
||||
for (String key : result.getAffected().keySet())
|
||||
table.addRow().addContent(key, result.getAffected().get(key).name());
|
||||
|
||||
// output
|
||||
System.out.println("\nThe following operations must be applied before invoking the current one:");
|
||||
table.print(System.out);
|
||||
|
||||
}
|
||||
|
||||
protected void outputForFailed(OperationResult result, EntaxyRuntimeObject entaxyObject) {
|
||||
|
||||
// Output info
|
||||
System.out.println(
|
||||
"Operation failed with "
|
||||
.concat(CommonUtils.isValid(result.getMessage()) ? "the following " : "no ")
|
||||
.concat("message")
|
||||
.concat(
|
||||
CommonUtils.isValid(result.getMessage())
|
||||
? (": ".concat(result.getMessage()))
|
||||
: "."));
|
||||
|
||||
if (!result.getAffected().isEmpty()) {
|
||||
ShellTable table = new ShellTable();
|
||||
table.column("Object");
|
||||
table.column("Action");
|
||||
for (String key : result.getAffected().keySet())
|
||||
table.addRow().addContent(key, result.getAffected().get(key).name());
|
||||
|
||||
// output
|
||||
System.out.println("\nThe following suboperations failed:");
|
||||
table.print(System.out);
|
||||
}
|
||||
}
|
||||
|
||||
protected void outputForFailed(OperationResult result, EntaxyRuntimeObject entaxyObject) {
|
||||
|
||||
// Output info
|
||||
System.out.println(
|
||||
"Operation failed with "
|
||||
.concat(CommonUtils.isValid(result.getMessage())?"the following ":"no ")
|
||||
.concat("message")
|
||||
.concat(
|
||||
CommonUtils.isValid(result.getMessage())
|
||||
?(": ".concat(result.getMessage()))
|
||||
:"."
|
||||
)
|
||||
);
|
||||
|
||||
if (!result.getAffected().isEmpty()) {
|
||||
ShellTable table = new ShellTable();
|
||||
table.column("Object");
|
||||
table.column("Action");
|
||||
for (String key: result.getAffected().keySet())
|
||||
table.addRow().addContent(key, result.getAffected().get(key).name());
|
||||
|
||||
// output
|
||||
System.out.println("\nThe following suboperations failed:");
|
||||
table.print(System.out);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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,6 +25,8 @@
|
||||
*/
|
||||
package ru.entaxy.platform.objects.runtime.shell;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
@@ -35,19 +37,19 @@ import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectManager.OperationRe
|
||||
@Command(name = "object-start", scope = EntaxyRuntimeObjectServiceSupport.OBJECTS_SCOPE, description = "Start object")
|
||||
public class ObjectStart extends ObjectOperationCommand {
|
||||
|
||||
@Override
|
||||
protected OperationResult doTargetExecute(EntaxyRuntimeObject entaxyObject) throws Exception {
|
||||
|
||||
OperationResult result;
|
||||
|
||||
if (force)
|
||||
result = objectManager.startForced(entaxyObject.getObjectFullId());
|
||||
else if (soft)
|
||||
result = objectManager.startSoft(entaxyObject.getObjectFullId());
|
||||
else
|
||||
result = objectManager.start(entaxyObject.getObjectFullId());
|
||||
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
protected OperationResult doTargetExecute(EntaxyRuntimeObject entaxyObject, List<String> target) throws Exception {
|
||||
|
||||
OperationResult result;
|
||||
|
||||
if (force)
|
||||
result = objectManager.startForced(entaxyObject.getObjectFullId(), target);
|
||||
else if (soft)
|
||||
result = objectManager.startSoft(entaxyObject.getObjectFullId(), target);
|
||||
else
|
||||
result = objectManager.start(entaxyObject.getObjectFullId(), target);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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,6 +25,8 @@
|
||||
*/
|
||||
package ru.entaxy.platform.objects.runtime.shell;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
@@ -35,19 +37,19 @@ import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectManager.OperationRe
|
||||
@Command(name = "object-stop", scope = EntaxyRuntimeObjectServiceSupport.OBJECTS_SCOPE, description = "Stop object")
|
||||
public class ObjectStop extends ObjectOperationCommand {
|
||||
|
||||
@Override
|
||||
protected OperationResult doTargetExecute(EntaxyRuntimeObject entaxyObject) throws Exception {
|
||||
|
||||
OperationResult result;
|
||||
|
||||
if (force)
|
||||
result = objectManager.stopForced(entaxyObject.getObjectFullId());
|
||||
else if (soft)
|
||||
result = objectManager.stopSoft(entaxyObject.getObjectFullId());
|
||||
else
|
||||
result = objectManager.stop(entaxyObject.getObjectFullId());
|
||||
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
protected OperationResult doTargetExecute(EntaxyRuntimeObject entaxyObject, List<String> target) throws Exception {
|
||||
|
||||
OperationResult result;
|
||||
|
||||
if (force)
|
||||
result = objectManager.stopForced(entaxyObject.getObjectFullId(), target);
|
||||
else if (soft)
|
||||
result = objectManager.stopSoft(entaxyObject.getObjectFullId(), target);
|
||||
else
|
||||
result = objectManager.stop(entaxyObject.getObjectFullId(), target);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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,6 +25,8 @@
|
||||
*/
|
||||
package ru.entaxy.platform.objects.runtime.shell;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
@@ -32,22 +34,23 @@ import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectManager.OperationResult;
|
||||
|
||||
@Service
|
||||
@Command(name = "object-uninstall", scope = EntaxyRuntimeObjectServiceSupport.OBJECTS_SCOPE, description = "Uninstall object")
|
||||
@Command(name = "object-uninstall", scope = EntaxyRuntimeObjectServiceSupport.OBJECTS_SCOPE,
|
||||
description = "Uninstall object")
|
||||
public class ObjectUninstall extends ObjectOperationCommand {
|
||||
|
||||
@Override
|
||||
protected OperationResult doTargetExecute(EntaxyRuntimeObject entaxyObject) throws Exception {
|
||||
|
||||
OperationResult result;
|
||||
|
||||
if (force)
|
||||
result = objectManager.uninstallForced(entaxyObject.getObjectFullId());
|
||||
else if (soft)
|
||||
result = objectManager.uninstallSoft(entaxyObject.getObjectFullId());
|
||||
else
|
||||
result = objectManager.uninstall(entaxyObject.getObjectFullId());
|
||||
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
protected OperationResult doTargetExecute(EntaxyRuntimeObject entaxyObject, List<String> target) throws Exception {
|
||||
|
||||
OperationResult result;
|
||||
|
||||
if (force)
|
||||
result = objectManager.uninstallForced(entaxyObject.getObjectFullId(), target);
|
||||
else if (soft)
|
||||
result = objectManager.uninstallSoft(entaxyObject.getObjectFullId(), target);
|
||||
else
|
||||
result = objectManager.uninstall(entaxyObject.getObjectFullId(), target);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* test-producers
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 EmDev LLC
|
||||
* Copyright (C) 2020 - 2026 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
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime</groupId>
|
||||
<artifactId>core</artifactId>
|
||||
<version>1.11.0</version>
|
||||
<version>1.12.0</version>
|
||||
</parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.core</groupId>
|
||||
<artifactId>object-runtime</artifactId>
|
||||
|
||||
Reference in New Issue
Block a user