release version 1.11.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.10.0</version>
|
||||
<version>1.11.0</version>
|
||||
</parent>
|
||||
<artifactId>object-runtime-core</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
|
@@ -0,0 +1,38 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 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 ru.entaxy.platform.base.objects.EntaxyObject;
|
||||
|
||||
public interface EntaxyObjectCustomizer {
|
||||
|
||||
boolean isAccepted(EntaxyObject entaxyObject);
|
||||
|
||||
EntaxyObject applyCustomization(EntaxyObject entaxyObject);
|
||||
|
||||
EntaxyObject unapplyCustomization(EntaxyObject entaxyObject);
|
||||
|
||||
}
|
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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,36 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 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.Map;
|
||||
|
||||
public interface EntaxyRuntimeObjectExtendedDataProvider {
|
||||
|
||||
String getProviderId();
|
||||
|
||||
Map<String, Object> getExtendedData(EntaxyRuntimeObject runtimeObject);
|
||||
|
||||
}
|
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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,6 +46,7 @@ public interface EntaxyRuntimeObjectManager {
|
||||
String getObjectFullId();
|
||||
boolean isForced();
|
||||
boolean isSoft();
|
||||
boolean isAffected();
|
||||
Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> getAffected();
|
||||
}
|
||||
|
||||
@@ -59,6 +60,8 @@ public interface EntaxyRuntimeObjectManager {
|
||||
|
||||
OperationResult start(String objectFullId);
|
||||
OperationResult startForced(String objectFullId);
|
||||
OperationResult startForced(String objectFullId, boolean isAffectedBundle);
|
||||
|
||||
OperationResult startSoft(String objectFullId);
|
||||
|
||||
OperationResult start(OperationConfig config);
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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,99 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 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.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.service.component.annotations.ReferencePolicy;
|
||||
import org.osgi.service.component.annotations.ReferencePolicyOption;
|
||||
import org.slf4j.Logger;
|
||||
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.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";
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.OPTIONAL, policy = ReferencePolicy.DYNAMIC,
|
||||
policyOption = ReferencePolicyOption.GREEDY)
|
||||
volatile protected ClusterBundleDataProvider clusterBundleDataProvider = null;
|
||||
|
||||
protected BundleContext bundleContext;
|
||||
|
||||
@Activate
|
||||
public void activate(ComponentContext componentContext) {
|
||||
this.bundleContext = componentContext.getBundleContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProviderId() {
|
||||
return CLUSTER_PROVIDER_ID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getExtendedData(EntaxyRuntimeObject runtimeObject) {
|
||||
if (clusterBundleDataProvider == null)
|
||||
return null;
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
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");
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
protected List<String> getClusterGroups(EntaxyRuntimeObject runtimeObject) {
|
||||
try {
|
||||
BundleInfo bi = runtimeObject.getBundleInfo();
|
||||
Bundle bundle = bundleContext.getBundle(bi.getBundleId());
|
||||
return clusterBundleDataProvider.getGroups(bundle);
|
||||
} catch (Exception e) {
|
||||
LOG.error(String.format("Error getting cluster groups for [%s]", runtimeObject.getObjectFullId()), e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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,171 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 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.impl;
|
||||
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.osgi.framework.Filter;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.service.component.annotations.ReferencePolicy;
|
||||
import org.osgi.service.component.annotations.ReferencePolicyOption;
|
||||
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectContainer;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectService;
|
||||
import ru.entaxy.platform.search.AbstractSearchProvider;
|
||||
import ru.entaxy.platform.search.SearchProvider;
|
||||
import ru.entaxy.platform.search.SearchProviderInfo;
|
||||
import ru.entaxy.platform.search.SearchService;
|
||||
|
||||
@Component(service = SearchProvider.class, immediate = true)
|
||||
@SearchProviderInfo(id = "runtime",
|
||||
targetTypes = {RuntimeObjectSearchProvider.TYPE_OBJECT, RuntimeObjectSearchProvider.TYPE_CONTAINER})
|
||||
public class RuntimeObjectSearchProvider extends AbstractSearchProvider {
|
||||
|
||||
public static final String TYPE_OBJECT = "object";
|
||||
public static final String TYPE_CONTAINER = "container";
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC,
|
||||
policyOption = ReferencePolicyOption.GREEDY)
|
||||
volatile SearchService searchService;
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC,
|
||||
policyOption = ReferencePolicyOption.GREEDY)
|
||||
volatile EntaxyRuntimeObjectService objectService;
|
||||
|
||||
@Override
|
||||
public Map<String, String> getStandardAttributes(String targetType) throws IllegalArgumentException {
|
||||
|
||||
if (TYPE_CONTAINER.equalsIgnoreCase(targetType))
|
||||
return EntaxyRuntimeObjectContainer.SEARCH.STANDARD_ATTRIBUTES;
|
||||
|
||||
if (TYPE_OBJECT.equalsIgnoreCase(targetType)) {
|
||||
Map<String, String> result = new LinkedHashMap<>();
|
||||
result.putAll(EntaxyRuntimeObject.SEARCH.STANDARD_ATTRIBUTES);
|
||||
|
||||
result.putAll(CommonUtils.prefixMap(EntaxyRuntimeObjectContainer.SEARCH.STANDARD_ATTRIBUTES, "container."));
|
||||
|
||||
// factory fields we'll get via search service
|
||||
// for 'runtime-only' nodes the information can be unavailable
|
||||
|
||||
try {
|
||||
result.putAll(CommonUtils.prefixMap(searchService.getStandardAttributes("factory"), "factory."));
|
||||
} catch (Exception ignore) {
|
||||
// NOOP
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(
|
||||
String.format("Provider [%s]: type [%s] nor supported", getProviderId(), targetType));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> search(String targetType, Filter filter) throws IllegalArgumentException {
|
||||
if (TYPE_CONTAINER.equalsIgnoreCase(targetType))
|
||||
return searchContainers(filter);
|
||||
|
||||
if (TYPE_OBJECT.equalsIgnoreCase(targetType))
|
||||
return searchObjects(filter);
|
||||
|
||||
throw new IllegalArgumentException(
|
||||
String.format("Provider [%s]: type [%s] nor supported", getProviderId(), targetType));
|
||||
}
|
||||
|
||||
protected List<Map<String, Object>> searchObjects(Filter filter) {
|
||||
return objectService.getObjects().stream()
|
||||
.map(obj -> getObjectEssence(obj))
|
||||
.filter(ess -> filter.matches(ess))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
protected Map<String, Object> getObjectEssence(EntaxyRuntimeObject object) {
|
||||
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
|
||||
// object attributes
|
||||
result.put(EntaxyRuntimeObject.SEARCH.ATTR_ID, object.getId());
|
||||
result.put(EntaxyRuntimeObject.SEARCH.ATTR_TYPE, object.getType());
|
||||
result.put(EntaxyRuntimeObject.SEARCH.ATTR_LABEL, object.getAllAttributes().getOrDefault("label", ""));
|
||||
result.put(EntaxyRuntimeObject.SEARCH.ATTR_DISPLAY_NAME, object.getDisplayName());
|
||||
result.put(EntaxyRuntimeObject.SEARCH.ATTR_FACTORY, object.getFactoryId());
|
||||
result.put(EntaxyRuntimeObject.SEARCH.ATTR_SCOPE, object.getScope());
|
||||
result.put(EntaxyRuntimeObject.SEARCH.ATTR_RESOURCES, object.getResources().stream()
|
||||
.map(res -> String.format("%s;%s", res.getResourceUrl(), res.getScope().name()))
|
||||
.collect(Collectors.toList()));
|
||||
result.put(EntaxyRuntimeObject.SEARCH.ATTR_RELATIONS_IN,
|
||||
object.getIncomingRelations().stream().map(rel -> String.format("%s;%S;%s:%s",
|
||||
rel.getSource().getObjectFullId(), rel.getType().name(), rel.getName(), rel.getGroup()))
|
||||
.collect(Collectors.toList()));
|
||||
result.put(EntaxyRuntimeObject.SEARCH.ATTR_RELATIONS_OUT,
|
||||
object.getRelations().stream().map(rel -> String.format("%s;%S;%s:%s",
|
||||
rel.getTarget().getObjectFullId(), rel.getType().name(), rel.getName(), rel.getGroup()))
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
// container attributes
|
||||
result.putAll(CommonUtils.prefixMap(getContainerEssence(object.getContainer()), "container."));
|
||||
|
||||
// factory attributes we'll get via search service
|
||||
// for 'runtime-only' nodes the information can be unavailable
|
||||
|
||||
try {
|
||||
List<Map<String, Object>> factories = searchService.search("factory",
|
||||
String.format("(&(id=%s)(type=%s))", object.getFactoryId(), object.getType()));
|
||||
if (factories != null && !factories.isEmpty())
|
||||
result.putAll(CommonUtils.prefixMap(factories.get(0), "factory."));
|
||||
} catch (Exception ignore) {
|
||||
// NOOP
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
protected List<Map<String, Object>> searchContainers(Filter filter) {
|
||||
return objectService.getContainers().stream()
|
||||
.map(obj -> getContainerEssence(obj))
|
||||
.filter(ess -> filter.matches(ess))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
protected Map<String, Object> getContainerEssence(EntaxyRuntimeObjectContainer container) {
|
||||
Map<String, Object> result = new LinkedHashMap<>();
|
||||
|
||||
result.put(EntaxyRuntimeObjectContainer.SEARCH.ATTR_ID, container.getId());
|
||||
result.put(EntaxyRuntimeObjectContainer.SEARCH.ATTR_TYPE, container.getType());
|
||||
result.put(EntaxyRuntimeObjectContainer.SEARCH.ATTR_NAME, container.getName());
|
||||
result.put(EntaxyRuntimeObjectContainer.SEARCH.ATTR_STATE, container.getState());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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
|
||||
@@ -53,8 +53,13 @@ public class EntaxyRuntimeObjectManagerImpl implements EntaxyRuntimeObjectManage
|
||||
|
||||
@Override
|
||||
public OperationResult startForced(String objectFullId) {
|
||||
return start((new OperationConfigImpl(objectFullId)).forced(true));
|
||||
return startForced(objectFullId, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OperationResult startForced(String objectFullId, boolean isAffectedBundle) {
|
||||
return start((new OperationConfigImpl(objectFullId)).forced(true).affectedOperation(isAffectedBundle));
|
||||
}
|
||||
|
||||
@Override
|
||||
public OperationResult startSoft(String objectFullId) {
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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
|
||||
@@ -37,6 +37,7 @@ public class OperationConfigImpl implements OperationConfig {
|
||||
|
||||
boolean isForced = false;
|
||||
boolean isSoft = false;
|
||||
boolean isAffected = false;
|
||||
|
||||
final Map<String, ENTAXY_RUNTIME_OBJECT_OPERATION> affected = new HashMap<>();
|
||||
|
||||
@@ -79,6 +80,11 @@ public class OperationConfigImpl implements OperationConfig {
|
||||
return this;
|
||||
};
|
||||
|
||||
public OperationConfigImpl affectedOperation(boolean affectedValue) {
|
||||
this.setIsAffected(affectedValue);
|
||||
return this;
|
||||
};
|
||||
|
||||
public OperationConfigImpl objectFullId(String objectFullIdValue) {
|
||||
this.setObjectFullId(objectFullIdValue);
|
||||
return this;
|
||||
@@ -95,5 +101,14 @@ public class OperationConfigImpl implements OperationConfig {
|
||||
public void setSoft(boolean isSoft) {
|
||||
this.isSoft = isSoft;
|
||||
}
|
||||
|
||||
public void setIsAffected(boolean isAffected) {
|
||||
this.isAffected = isAffected;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAffected() {
|
||||
return isAffected;
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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,9 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
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;
|
||||
@@ -39,6 +42,8 @@ import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectManager.OperationCo
|
||||
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;
|
||||
|
||||
@@ -53,6 +58,7 @@ public abstract class OperationExecutor<T extends OperationExecutor<T>> {
|
||||
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()) {
|
||||
@@ -93,6 +99,23 @@ public abstract class OperationExecutor<T extends OperationExecutor<T>> {
|
||||
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) {
|
||||
try {
|
||||
this.wait(1000);
|
||||
} catch (InterruptedException e) {
|
||||
log.trace(e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return EntaxyRuntimeObjectServiceImpl.getInstance().getObjectState(object);
|
||||
}
|
||||
|
||||
protected EntaxyRuntimeObject getObjectFromConfig(OperationConfig operationConfig) {
|
||||
try {
|
||||
return EntaxyRuntimeObjectServiceImpl.getInstance().getRuntimeObject(operationConfig.getObjectFullId());
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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
|
||||
@@ -52,7 +52,8 @@ public class OperationExecutorStart extends OperationExecutor<OperationExecutorS
|
||||
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)))
|
||||
.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);
|
||||
@@ -82,8 +83,8 @@ public class OperationExecutorStart extends OperationExecutor<OperationExecutorS
|
||||
try {
|
||||
getBundleController(runtimeObject).startBundle(runtimeObject.getContainer().getName());
|
||||
} catch (Exception e) {
|
||||
log.error("ERROR stoping [" + runtimeObject.getObjectFullId() + "]", e);
|
||||
return OperationResultImpl.createFailed().message("ERROR stoping [" + runtimeObject.getObjectFullId()
|
||||
log.error("ERROR starting [" + runtimeObject.getObjectFullId() + "]", e);
|
||||
return OperationResultImpl.createFailed().message("ERROR starting [" + runtimeObject.getObjectFullId()
|
||||
+ "]; ORIGINAL MESSAGE: " + e.getMessage());
|
||||
}
|
||||
|
||||
@@ -94,7 +95,7 @@ public class OperationExecutorStart extends OperationExecutor<OperationExecutorS
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (EntaxyRuntimeObject part: parts) {
|
||||
OperationResult result = objectManager.startForced(part.getObjectFullId());
|
||||
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());
|
||||
@@ -102,7 +103,7 @@ public class OperationExecutorStart extends OperationExecutor<OperationExecutorS
|
||||
|
||||
// start all affected objects
|
||||
for (String affectedId: operationConfig.getAffected().keySet()) {
|
||||
OperationResult result = objectManager.startForced(affectedId);
|
||||
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());
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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
|
||||
@@ -37,12 +37,12 @@ import org.slf4j.LoggerFactory;
|
||||
import ru.entaxy.platform.base.objects.EntaxyObject;
|
||||
import ru.entaxy.platform.base.objects.EntaxyObject.OBJECT_RELATION;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeRelation;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject.ENTAXY_RUNTIME_OBJECT_STATE;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectManager.ENTAXY_RUNTIME_OBJECT_OPERATION;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectManager.ENTAXY_RUNTIME_OBJECT_OPERATION_RESULT;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectManager.OperationConfig;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectManager.OperationResult;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeRelation;
|
||||
|
||||
public class OperationExecutorUninstall extends OperationExecutor<OperationExecutorUninstall> {
|
||||
|
||||
@@ -83,7 +83,6 @@ public class OperationExecutorUninstall extends OperationExecutor<OperationExecu
|
||||
|
||||
@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())
|
||||
@@ -112,8 +111,14 @@ public class OperationExecutorUninstall extends OperationExecutor<OperationExecu
|
||||
"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);
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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,48 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-core
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 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.internal;
|
||||
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
|
||||
import ru.entaxy.esb.resources.impl.AbstractResourceProviderProxy;
|
||||
|
||||
// @Component(service = EntaxyResourceProviderProxy.class, immediate = true)
|
||||
/**
|
||||
* @Deprecated already defined in core-support-runtime
|
||||
*/
|
||||
@Deprecated(forRemoval = true)
|
||||
public class ObjectResourcesProvider extends AbstractResourceProviderProxy {
|
||||
|
||||
@Activate
|
||||
public void activate() {
|
||||
|
||||
setProtocol("object-resources");
|
||||
setTargetProtocol("entaxy-file-internal");
|
||||
setTargetPath(".object-resources");
|
||||
|
||||
}
|
||||
|
||||
}
|
@@ -3,7 +3,7 @@
|
||||
<parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.core</groupId>
|
||||
<artifactId>object-runtime</artifactId>
|
||||
<version>1.10.0</version>
|
||||
<version>1.11.0</version>
|
||||
</parent>
|
||||
<artifactId>object-runtime-shell</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
|
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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,63 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 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 org.apache.karaf.shell.api.action.Action;
|
||||
import org.apache.karaf.shell.api.action.Argument;
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
import org.osgi.framework.Filter;
|
||||
import org.osgi.framework.FrameworkUtil;
|
||||
|
||||
import ru.entaxy.platform.base.support.karaf.shell.ShellTableExt;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
|
||||
@Service
|
||||
@Command(name = "find-objects", scope = EntaxyRuntimeObjectServiceSupport.OBJECTS_SCOPE)
|
||||
public class ObjectFind extends EntaxyRuntimeObjectServiceSupport implements Action {
|
||||
|
||||
@Argument(index = 0)
|
||||
String filter;
|
||||
|
||||
@Override
|
||||
public Object execute() throws Exception {
|
||||
|
||||
Filter odgiFilter = FrameworkUtil.createFilter(filter);
|
||||
|
||||
ShellTableExt shellTable = new ShellTableExt();
|
||||
shellTable.column("Id");
|
||||
shellTable.column("Type");
|
||||
|
||||
for (EntaxyRuntimeObject obj : objectService.findObjects(odgiFilter))
|
||||
shellTable.addRow().addContent(
|
||||
obj.getId(), obj.getType());
|
||||
|
||||
shellTable.print(System.out);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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,76 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2025 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.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
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.core.artifact.Artifact;
|
||||
import ru.entaxy.platform.core.artifact.Artifacts;
|
||||
import ru.entaxy.platform.core.artifact.repository.ArtifactRepository;
|
||||
import ru.entaxy.platform.core.artifact.service.ArtifactService;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
|
||||
@Service
|
||||
@Command(name = "object-versions", scope = EntaxyRuntimeObjectServiceSupport.OBJECTS_SCOPE,
|
||||
description = "List available object versions")
|
||||
public class ObjectVersions extends RuntimeObjectAwareCommand {
|
||||
|
||||
@Reference
|
||||
ArtifactService artifactService;
|
||||
|
||||
@Override
|
||||
public Object doExecute(EntaxyRuntimeObject entaxyObject) throws Exception {
|
||||
Set<String> availaleVersions = new HashSet<>();
|
||||
|
||||
Artifact artifact = Artifacts.create(Artifact.ARTIFACT_CATEGORY_BUNDLE);
|
||||
artifact.getCoordinates().groupId(entaxyObject.getType()).artifactId(entaxyObject.getId());
|
||||
|
||||
String[] repos = new String[] {ArtifactRepository.REPO_NAME_LOCAL, ArtifactRepository.REPO_NAME_SHARED};
|
||||
for (String repoName : repos) {
|
||||
List<String> versions = artifactService.getRepository(repoName).getAvailableVersions(artifact);
|
||||
if (versions != null)
|
||||
availaleVersions.addAll(versions);
|
||||
}
|
||||
|
||||
List<String> list = new ArrayList<>(availaleVersions);
|
||||
Collections.sort(list);
|
||||
|
||||
System.out.println("Available versions:\n");
|
||||
System.out.println(list.stream().collect(Collectors.joining("\n")));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* test-producers
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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 - 2024 EmDev LLC
|
||||
* Copyright (C) 2020 - 2025 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.10.0</version>
|
||||
<version>1.11.0</version>
|
||||
</parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.core</groupId>
|
||||
<artifactId>object-runtime</artifactId>
|
||||
|
Reference in New Issue
Block a user