release version 1.10.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.9.0</version>
|
||||
<version>1.10.0</version>
|
||||
</parent>
|
||||
<artifactId>object-runtime-shell</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
@ -19,6 +19,11 @@
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.core</groupId>
|
||||
<artifactId>artifact-management</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.karaf.shell</groupId>
|
||||
<artifactId>org.apache.karaf.shell.core</artifactId>
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
@ -27,12 +27,16 @@ package ru.entaxy.platform.objects.runtime.shell;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.PrintStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
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.EntaxyRuntimeObjectContainer;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectResource;
|
||||
@ -41,74 +45,98 @@ import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectResource;
|
||||
@Command(name = "object-info", scope = EntaxyRuntimeObjectServiceSupport.OBJECTS_SCOPE, description = "Get object info")
|
||||
public class ObjectInfo extends RuntimeObjectAwareCommand {
|
||||
|
||||
@Override
|
||||
public Object doExecute(EntaxyRuntimeObject entaxyObject) throws Exception {
|
||||
|
||||
EntaxyRuntimeObjectContainer container = entaxyObject.getContainer();
|
||||
|
||||
String message = "Object Info for ".concat(entaxyObject.getObjectFullId())
|
||||
.concat("\n----------------------------------------")
|
||||
.concat("\nID: ".concat(entaxyObject.getId()))
|
||||
.concat("\nTYPE: ".concat(entaxyObject.getType()))
|
||||
.concat("\nFULL ID: ".concat(entaxyObject.getObjectFullId()))
|
||||
.concat("\nFACTORY ID: ".concat(entaxyObject.getFactoryId()))
|
||||
.concat("\nCONTAINER: ".concat(RuntimeObjectShellUtils.getContainerPrintString(container)))
|
||||
.concat("\nBUNDLE ID: ".concat(entaxyObject.getBundleInfo().getBundleId()+""))
|
||||
.concat("\nCOLOCATED WITH OBJECTS: ")
|
||||
.concat(
|
||||
container.getObjects().stream()
|
||||
.filter(obj-> !obj.getObjectFullId().equals(entaxyObject.getObjectFullId()))
|
||||
.map(obj -> ("\n\t" + obj.getObjectFullId()))
|
||||
.collect(Collectors.joining())
|
||||
.concat("\nPARENT OBJECTS: ")
|
||||
.concat(
|
||||
RuntimeObjectShellUtils.getRelationListMainPrintString(
|
||||
entaxyObject.getIncomiingSubordRelations()
|
||||
, "\n\t")
|
||||
)
|
||||
.concat("\nDEPENDENCIES: ")
|
||||
.concat(
|
||||
RuntimeObjectShellUtils.getRelationListMainPrintString(
|
||||
RuntimeObjectShellUtils.getObjectDependenciesAndUses(entaxyObject)
|
||||
, "\n\t")
|
||||
)
|
||||
)
|
||||
.concat("\nCHILD OBJECTS: ")
|
||||
.concat(
|
||||
RuntimeObjectShellUtils.getRelationListDependentPrintString(
|
||||
entaxyObject.getSubordRelations()
|
||||
, "\n\t")
|
||||
)
|
||||
.concat("\nDEPENDENTS: ")
|
||||
.concat(
|
||||
RuntimeObjectShellUtils.getRelationListDependentPrintString(
|
||||
RuntimeObjectShellUtils.getObjectIncomingDependenciesAndUses(entaxyObject)
|
||||
, "\n\t")
|
||||
);
|
||||
|
||||
// object resources
|
||||
ShellTable table = new ShellTable();
|
||||
table.column("Scope");
|
||||
table.column("Exists");
|
||||
table.column("Url");
|
||||
|
||||
for (EntaxyRuntimeObjectResource res: entaxyObject.getResources())
|
||||
table.addRow().addContent(
|
||||
res.getScope().name(),
|
||||
(res.getResource().exists()?"*":""),
|
||||
res.getResourceUrl()
|
||||
);
|
||||
|
||||
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream(); PrintStream printStream = new PrintStream(outputStream)) {
|
||||
@Override
|
||||
public Object doExecute(EntaxyRuntimeObject entaxyObject) throws Exception {
|
||||
|
||||
table.print(printStream);
|
||||
message = message.concat("\nRESOURCES: \n").concat(outputStream.toString());
|
||||
}
|
||||
|
||||
// output to console
|
||||
System.out.println(message);
|
||||
|
||||
return null;
|
||||
}
|
||||
EntaxyRuntimeObjectContainer container = entaxyObject.getContainer();
|
||||
|
||||
String message = "Object Info for ".concat(entaxyObject.getObjectFullId())
|
||||
.concat("\n----------------------------------------")
|
||||
.concat("\nID: ".concat(entaxyObject.getId()))
|
||||
.concat("\nTYPE: ".concat(entaxyObject.getType()))
|
||||
.concat("\nFULL ID: ".concat(entaxyObject.getObjectFullId()))
|
||||
.concat("\nFACTORY ID: ".concat(entaxyObject.getFactoryId()))
|
||||
.concat("\nCONTAINER: ".concat(RuntimeObjectShellUtils.getContainerPrintString(container)))
|
||||
.concat("\nBUNDLE ID: ".concat(entaxyObject.getBundleInfo().getBundleId() + ""))
|
||||
.concat("\nCOLOCATED WITH OBJECTS: ")
|
||||
.concat(
|
||||
container.getObjects().stream()
|
||||
.filter(obj -> !obj.getObjectFullId().equals(entaxyObject.getObjectFullId()))
|
||||
.map(obj -> ("\n\t" + obj.getObjectFullId()))
|
||||
.collect(Collectors.joining())
|
||||
.concat("\nPARENT OBJECTS: ")
|
||||
.concat(
|
||||
RuntimeObjectShellUtils.getRelationListMainPrintString(
|
||||
entaxyObject.getIncomiingSubordRelations(), "\n\t"))
|
||||
.concat("\nDEPENDENCIES: ")
|
||||
.concat(
|
||||
RuntimeObjectShellUtils.getRelationListMainPrintString(
|
||||
RuntimeObjectShellUtils.getObjectDependenciesAndUses(entaxyObject),
|
||||
"\n\t")))
|
||||
.concat("\nCHILD OBJECTS: ")
|
||||
.concat(
|
||||
RuntimeObjectShellUtils.getRelationListDependentPrintString(
|
||||
entaxyObject.getSubordRelations(), "\n\t"))
|
||||
.concat("\nDEPENDENTS: ")
|
||||
.concat(
|
||||
RuntimeObjectShellUtils.getRelationListDependentPrintString(
|
||||
RuntimeObjectShellUtils.getObjectIncomingDependenciesAndUses(entaxyObject), "\n\t"));
|
||||
|
||||
// object resources
|
||||
ShellTable table = new ShellTable();
|
||||
table.column("Scope");
|
||||
table.column("Exists");
|
||||
table.column("Url");
|
||||
|
||||
for (EntaxyRuntimeObjectResource res : entaxyObject.getResources())
|
||||
table.addRow().addContent(
|
||||
res.getScope().name(),
|
||||
(res.getResource() == null ? "" : (res.getResource().exists() ? "*" : "")),
|
||||
res.getResourceUrl());
|
||||
|
||||
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
PrintStream printStream = new PrintStream(outputStream)) {
|
||||
|
||||
table.print(printStream);
|
||||
message = message.concat("\nRESOURCES: \n").concat(outputStream.toString());
|
||||
}
|
||||
|
||||
ShellTableExt tableExt = new ShellTableExt();
|
||||
tableExt.column("Attribute");
|
||||
tableExt.column("Value").maxSize(70);
|
||||
|
||||
for (Map.Entry<String, Object> entry : entaxyObject.getAllAttributes().entrySet()) {
|
||||
|
||||
String toOutput = "";
|
||||
|
||||
if (entry.getValue() != null) {
|
||||
if (entry.getValue() instanceof List)
|
||||
toOutput = ((List) entry.getValue())
|
||||
.stream().map(v -> v == null ? "" : v.toString())
|
||||
.collect(Collectors.joining("\n")).toString();
|
||||
else if (entry.getValue() instanceof Map) {
|
||||
toOutput = JSONUtils.GSON.toJsonTree((Map) entry.getValue()).toString();
|
||||
} else {
|
||||
toOutput = entry.getValue().toString();
|
||||
}
|
||||
}
|
||||
|
||||
tableExt.addRow().addContent(entry.getKey(), toOutput);
|
||||
|
||||
}
|
||||
|
||||
try (ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||
PrintStream printStream = new PrintStream(outputStream)) {
|
||||
|
||||
tableExt.print(printStream);
|
||||
message = message.concat("\nATTRIBUTES: \n").concat(outputStream.toString());
|
||||
}
|
||||
|
||||
|
||||
// output to console
|
||||
System.out.println(message);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
@ -81,7 +81,7 @@ public abstract class ObjectOperationCommand extends RuntimeObjectAwareCommand {
|
||||
table.addRow().addContent(key, result.getAffected().get(key).name());
|
||||
|
||||
// output
|
||||
System.out.println("\nOperaton should be applied to the following affected objects:");
|
||||
System.out.println("\nOperation should be applied to the following affected objects:");
|
||||
table.print(System.out);
|
||||
|
||||
String message = "\n"
|
||||
@ -102,7 +102,7 @@ public abstract class ObjectOperationCommand extends RuntimeObjectAwareCommand {
|
||||
table.addRow().addContent(key, result.getAffected().get(key).name());
|
||||
|
||||
// output
|
||||
System.out.println("\nThe following operatons must be applied before invoking the current one:");
|
||||
System.out.println("\nThe following operations must be applied before invoking the current one:");
|
||||
table.print(System.out);
|
||||
|
||||
}
|
||||
@ -129,7 +129,7 @@ public abstract class ObjectOperationCommand extends RuntimeObjectAwareCommand {
|
||||
table.addRow().addContent(key, result.getAffected().get(key).name());
|
||||
|
||||
// output
|
||||
System.out.println("\nThe following suboperatons failed:");
|
||||
System.out.println("\nThe following suboperations failed:");
|
||||
table.print(System.out);
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* test-producers
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
|
@ -2,7 +2,7 @@
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-runtime-shell
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* Copyright (C) 2020 - 2024 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
|
Reference in New Issue
Block a user