release version 1.10.0
This commit is contained in:
175
platform/integration/applications/application-shell/LICENSE.txt
Normal file
175
platform/integration/applications/application-shell/LICENSE.txt
Normal file
@ -0,0 +1,175 @@
|
||||
ЛИЦЕНЗИЯ ОГРАНИЧЕННОГО ПРИМЕНЕНИЯ
|
||||
|
||||
Настоящий документ устанавливает для Пользователя условия применения Базовой (некоммерческой)
|
||||
версии лицензии для пробного использования программного обеспечения ENTAXY, принадлежащего
|
||||
Правообладателю – Обществу с ограниченной ответственностью "ЕМДЕВ" (ОГРН 1057810026658, ИНН
|
||||
7813313860, юридический адрес: 197022, Россия, г. Санкт-Петербург, ул. Профессора Попова,
|
||||
д. 23, литера В, помещение 3Н), расположенной в сети Интернет по адресу
|
||||
https://www.emdev.ru/about (далее - Компания).
|
||||
|
||||
Используя или получая доступ к Программному обеспечению, или нажав «Я согласен с Условиями»
|
||||
(или аналогичную кнопку или флажок) после загрузки или установки Программного обеспечения,
|
||||
Пользователь выражает свое согласие на обязательность условий и ограничений, изложенных в
|
||||
настоящем документе, в противном случае, он должен не использовать или не получать доступ
|
||||
к Программному обеспечению.
|
||||
|
||||
1. ТЕРМИНЫ И ОПРЕДЕЛЕНИЯ
|
||||
|
||||
a) ПО – Программное обеспечение, интеграционная шина «ЭНТАКСИ» (ENTAXY) в любой ее версии
|
||||
или редакции, исключительные права на которую принадлежат Правообладателю.
|
||||
b) Правообладатель (Компания) – ООО «ЕМДЕВ», ОГРН 1057810026658, ИНН 7813313860, исключительные
|
||||
права которого подтверждаются Свидетельством о государственной регистрации в Реестре программ
|
||||
для ЭВМ № 2021610848 от 19.01.2021 года.
|
||||
c) Пользователь – юридическое или физическое лицо, получившее через скачивание с сайта
|
||||
https://entaxy.ru или иным образом, дистрибутив ПО, пользующееся ПО.
|
||||
d) ИС – интеллектуальная собственность – закреплённое законом исключительное право, а также
|
||||
личные неимущественные права авторов произведений на результат интеллектуальной деятельности.
|
||||
e) Подписка – это коммерческое предложение Правообладателя, состоящее из Лицензии на использование
|
||||
ПО и доступа к технической поддержке программного обеспечения на срок Подписки. Подписка
|
||||
включает предоставление Пользователю неисключительного права использования ПО, в том числе
|
||||
получение обновлений функционала ПО и безопасности ПО, исправление ошибок ПО и получение
|
||||
патчей с обновлениями и исправлениями программного обеспечения. Подписка приобретается
|
||||
Пользователем на период времени, указанный в Сертификате. Количество подписок устанавливается
|
||||
для каждого Пользователя индивидуально в Сертификате.
|
||||
f) Сертификат – документ, выдаваемый Дистрибъютором или Авторизованным партнёром (Партнёром),
|
||||
подтверждающий факт приобретения физическим или юридическим лицом Подписки на программное
|
||||
обеспечение в ограниченном объёме и на определённый период времени.
|
||||
g) Лицензия (простая (неисключительная) – совокупность ограниченных прав использования ПО,
|
||||
предоставленных Пользователю согласно условиям Подписки.
|
||||
h) Библиотека – совокупность подпрограмм и объектов, используемых для разработки программного
|
||||
обеспечения.
|
||||
i) Исходный код – текст компьютерной программы на каком-либо языке программирования, состоящий
|
||||
из одного или нескольких файлов, который может быть прочтён человеком.
|
||||
j) Объектный код – файл (часть машинного кода) с промежуточным представлением отдельного модуля
|
||||
программы, полученный в результате обработки исходного кода, еще не связанный в полную программу.
|
||||
Это машинный код для одной конкретной библиотеки или модуля, который будет составлять готовый
|
||||
продукт.
|
||||
k) Некоммерческое использование – индивидуальное личное использование Пользователем программного
|
||||
обеспечения с целью обучения работе с Программным обеспечением, для оценки или демонстрации
|
||||
возможностей Программного обеспечения, при котором, Пользователем не извлекается коммерческая
|
||||
выгода и/или не идёт в доход денежное вознаграждение при использовании Программного обеспечения.
|
||||
|
||||
2. ДОПУСТИМЫЕ СПОСОБЫ ИСПОЛЬЗОВАНИЯ ПРОГРАММНОГО ОБЕСПЕЧЕНИЯ
|
||||
|
||||
2.1. Правообладатель предоставляет Пользователю ограниченное право использования Программного
|
||||
обеспечения на условиях простой (неисключительной) лицензии в объёме, ограниченном правом
|
||||
воспроизведения полной рабочей версии программного обеспечения, новых версий программного обеспечения
|
||||
в памяти оборудования и его запуска на оборудовании в соответствии со ст. 1280 ГК РФ.
|
||||
2.2. Право на использование Программного обеспечения, предоставляемое Пользователю, носит
|
||||
неисключительный характер.
|
||||
2.3. Пользователю предоставляется всемирная, неисключительная, не подлежащая сублицензированию,
|
||||
лицензия на ограниченное использование Программного обеспечения.
|
||||
2.4. Пользователь, имеющий Базовую (некоммерческую) версию лицензии для пробного использования
|
||||
имеет право приобрести Подписку на программное обеспечение. В этом случае Пользователь обязан
|
||||
обратиться в службу поддержки Правообладателя по адресу: https://entaxy.ru/ для изменения
|
||||
вида лицензии с Базовой бесплатной версии на Подписки.
|
||||
2.5. Срок использования скачанной Пользователем базовой (некоммерческой) версии лицензии для
|
||||
пробного использования программного обеспечения – не ограничен.
|
||||
2.6. Использование Пользователем настоящего программного обеспечения в целях разработки,
|
||||
модификации, обновления другого ПО, принадлежащего третьим лицам, а не Правообладателю,
|
||||
без разрешения Правообладателя не допускается.
|
||||
|
||||
3. АВТОРСКОЕ ПРАВО.
|
||||
|
||||
3.1. Все авторские права, все права интеллектуальной собственности на Программное обеспечение
|
||||
и любые его копии принадлежат Правообладателю.
|
||||
3.2. Все авторские права, все права интеллектуальной собственности в отношении любого контента,
|
||||
к которому можно получить доступ с помощью Программного обеспечения, является собственностью
|
||||
соответствующего владельца контента и защищается применимым законодательством об авторском
|
||||
праве или другими законами и договорами об интеллектуальной собственности.
|
||||
3.3. Условия использования Программного обеспечения.
|
||||
Лицензия, предоставленная Пользователю, действительна только в том случае, если Пользователь
|
||||
придерживается следующих условий:
|
||||
3.3.1. Принятие уведомлений об авторских правах. Пользователю запрещается удалять или изменять
|
||||
какие-либо уведомления об авторских правах или лицензиях, которые появляются при использовании
|
||||
Программного обеспечения или на нем.
|
||||
3.3.2. Модификация. Пользователю запрещается модифицировать, изменять, декомпилировать,
|
||||
расшифровывать, дизассемблировать, переводить или реверсировать, перепроектировать
|
||||
Программное обеспечение.
|
||||
3.3.3. Распространение. Пользователю запрещается сублицензировать, передавать право использования
|
||||
ПО или иным образом распространять или предоставлять Программное обеспечение любой третьей стороне.
|
||||
3.3.4. SaaS. За исключением случаев, когда это разрешено Правообладателем, Пользователю запрещено
|
||||
использовать Программное обеспечение в коммерческих целях для оказания услуг третьим лицам.
|
||||
|
||||
4. ОТВЕТСТВЕННОСТЬ ПРАВООБЛАДАТЕЛЯ ПРИ НАРУШЕНИИ ПОЛЬЗОВАТЕЛЕМ ПРАВ «ИС»
|
||||
|
||||
4.1. Правообладатель не несет никаких обязательств в отношении каких-либо претензий к Пользователю
|
||||
на предмет нарушения последним прав Интеллектуальной собственности, возникших в связи с
|
||||
использованием Пользователем:
|
||||
4.1.1. Любых компонентов программного обеспечения с открытым исходным кодом, включенных в
|
||||
Программное обеспечение;
|
||||
4.1.2. Любого нарушения правил использования Программного обеспечения, установленного условиями
|
||||
настоящего соглашения;
|
||||
4.1.3. Любого использования Программного обеспечения в сочетании с другими ПО, оборудованием,
|
||||
или данными, не предоставленными Пользователю Правообладателем;
|
||||
4.1.4. Любого изменения Программного обеспечения любым третьим лицом, а не Правообладателем.
|
||||
|
||||
|
||||
5. НАСТОЯЩИМ ПРАВООБЛАДАТЕЛЬ ЗАЯВЛЯЕТ, ЧТО ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ ПРЕДОСТАВЛЯЕТСЯ ПОЛЬЗОВАТЕЛЮ
|
||||
ПО ПРИНЦИПУ «AS IS» - «КАК ЕСТЬ». НИ ПРИ КАКИХ ОБСТОЯТЕЛЬСТВАХ ПРАВООБЛАДАТЕЛЬ НЕ ГАРАНТИРУЕТ
|
||||
И НЕ ОБЕЩАЕТ, ЧТО ПРЕДОСТАВЛЕННОЕ ИМ ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ БУДЕТ ПОДХОДИТЬ ИЛИ НЕ ПОДХОДИТЬ
|
||||
ДЛЯ КОНКРЕТНЫХ ЦЕЛЕЙ ПОЛЬЗОВАТЕЛЯ, ЧТО ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ БУДЕТ ОТВЕЧАТЬ ВСЕМ КОММЕРЧЕСКИМ
|
||||
И ЛИЧНЫМ СУБЪЕКТИВНЫМ ОЖИДАНИЯМ ПОЛЬЗОВАТЕЛЯ, ЧТО ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ БУДЕТ РАБОТАТЬ
|
||||
ИСПРАВНО, БЕЗ ТЕХНИЧЕСКИХ ОШИБОК, БЫСТРО И БЕСПЕРЕБОЙНО.
|
||||
|
||||
6. ОГРАНИЧЕНИЕ ОТВЕТСТВЕННОСТИ.
|
||||
НИ ПРИ КАКИХ ОБСТОЯТЕЛЬСТВАХ ПРАВООБЛАДАТЕЛЬ ИЛИ ЕГО АФФИЛЛИРОВАННЫЕ ЛИЦА НЕ НЕСУТ ПЕРЕД ПОЛЬЗОВАТЕЛЕМ
|
||||
ОТВЕТСТВЕННОСТИ ЗА ЛЮБЫЕ ПРЯМЫЕ ИЛИ КОСВЕННЫЕ УБЫТКИ ПОЛЬЗОВАТЕЛЯ, ЕГО РАСХОДЫ ИЛИ РЕАЛЬНЫЙ УЩЕРБ,
|
||||
ВКЛЮЧАЯ, ПОМИМО ПРОЧЕГО, ПРОСТОИ; УТРАТУ БИЗНЕСА; УПУЩЕННУЮ ВЫГОДУ; НЕДОПОЛУЧЕННУЮ ПРИБЫЛЬ;
|
||||
ПОТЕРЮ ИЛИ ПОВРЕЖДЕНИЕ ДАННЫХ, ИМУЩЕСТВА И ИНОЕ.
|
||||
ОГРАНИЧЕНИЯ ПРИМЕНЯЮТСЯ НЕЗАВИСИМО ОТ ОСНОВАНИЯ НАСТУПЛЕНИЯ ОТВЕТСТВЕННОСТИ; В ТОМ ЧИСЛЕ ВСЛЕДСТВИЕ
|
||||
ДЕЙСТВИЯ ИЛИ БЕЗДЕЙСТВИЯ, НЕБРЕЖНОСТИ, УМЫСЛА, ПРЯМОГО ИЛИ КОСВЕННОГО; НЕОСТОРОЖНОСТИ; ЗАБЛУЖДЕНИЯ;
|
||||
КЛЕВЕТЫ; НАРУШЕНИЯ КОНФИДЕНЦИАЛЬНОСТИ ИЛИ ПРАВА ИНТЕЛЛЕКТУАЛЬНОЙ СОБСТВЕННОСТИ; ИЛИ ЛЮБОЕ ДРУГОЕ
|
||||
ОСНОВАНИЕ НАСТУПЛЕНИЯ ОТВЕТСТВЕННОСТИ.
|
||||
|
||||
7. ОБЯЗАННОСТЬ ПОЛЬЗОВАТЕЛЯ:
|
||||
Не осуществлять самостоятельно и (или) с привлечением третьих лиц нижеследующие действия
|
||||
(включая, но не ограничиваясь) по:
|
||||
-дизассемблированию и (или) декомпилированию (преобразованию объектного кода в исходный код)
|
||||
Программного обеспечения;
|
||||
-модификации Программного обеспечения, в том числе вносить изменения в объектный код, исходный
|
||||
код Программного обеспечения, за исключением тех изменений, которые вносятся средствами,
|
||||
включёнными в Программное обеспечение и описанными непосредственно в документации к нему;
|
||||
-созданию условий для использования Программного обеспечения лицами, не имеющими прав на
|
||||
использование данного Программного обеспечения, включая (но не ограничиваясь) вмешательство
|
||||
третьих лиц в функционирование Программного обеспечения, предоставление третьим лицам доступа
|
||||
к исследованию и (или) замене настроек Программного обеспечения, включая его первичную установку;
|
||||
-распространению Программного обеспечения в целом или в части (включая приложенную к нему документацию).
|
||||
|
||||
8. БИБЛИОТЕКА ПО. ИСПОЛЬЗУЕМЫЕ ПРОГРАММНЫЕ СРЕДСТВА.
|
||||
|
||||
8.1. Настоящим, Правообладатель заверяет, что Библиотека программного обеспечения состоит из
|
||||
лицензионных продуктов, используемых на законных основаниях, а
|
||||
именно https://entaxy.ru/libs/licenses/root-aggregated.deps.
|
||||
8.2. Любые программные средства, применяемые Пользователем при работе с ПО, должны быть
|
||||
совместимы с библиотекой ПО, указанной в п.8.1. настоящего соглашения.
|
||||
8.3. Перечень внешних модулей ПО, указанный в п.8.1 настоящего соглашения, может изменяться
|
||||
Правообладателем в одностороннем порядке, в зависимости от выпуска релизов программного обеспечения,
|
||||
содержащих все изменения и дополнения программного обеспечения.
|
||||
|
||||
9. ВНЕСЕНИЕ ИЗМЕНЕНИЙ В ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ.
|
||||
|
||||
9.1. Программное обеспечение, интеграционная шина «ЭНТАКСИ» (ENTAXY) является свободно распространяемым
|
||||
программным обеспечением.
|
||||
9.2. Пользователь имеет право вносить изменения в исходный код программного обеспечения исключительно
|
||||
с согласия Правообладателя в порядке предложения изменений/правок/дополнений через механизм
|
||||
«Pull Requests» в открытом репозитории Правообладателя по адресу: https://git.entaxy.ru/entaxy/entaxy-public.
|
||||
9.3. Любые изменения программного обеспечения, осуществляемые Пользователем без соблюдения условий
|
||||
пункта 9.2. настоящего документа, являются нарушением авторских и смежных прав Правообладателя,
|
||||
прав интеллектуальной собственности Правообладателя и влекут применение к Пользователю мер
|
||||
ответственности в соответствии с условиями настоящей Лицензии, а также применимого законодательства
|
||||
Российской Федерации.
|
||||
|
||||
10. ЗАКЛЮЧИТЕЛЬНЫЕ ПОЛОЖЕНИЯ.
|
||||
|
||||
10.1. В случае нарушения Пользователем любого из условий настоящей Лицензии, Правообладатель имеет
|
||||
право взыскать с Пользователя любые причинённые таким нарушением убытки, реальный ущерб,
|
||||
недополученную прибыль, упущенную выгоду, а также в случае нарушения Пользователем условий
|
||||
пункта 9.2 настоящего соглашения, в том числе, взыскать с Пользователя штраф в размере
|
||||
2 000 000 (Два миллиона) рублей за каждый установленный случай несанкционированного изменения
|
||||
исходного или объектного кода Программного обеспечения «Энтакси» (Entaxy).
|
||||
10.2. В рамках исполнения Пользователем обязательств по настоящей Лицензии, применимое
|
||||
законодательство – Российской Федерации.
|
||||
10.3. Если какое-либо положение настоящей Лицензии будет признано судом недействительным,
|
||||
остальные положения будут продолжать своё действие, а Пользователь будет обязан продолжать
|
||||
исполнять свои обязанности в соответствии с этими положениями.
|
64
platform/integration/applications/application-shell/pom.xml
Normal file
64
platform/integration/applications/application-shell/pom.xml
Normal file
@ -0,0 +1,64 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>ru.entaxy.platform.integration</groupId>
|
||||
<artifactId>applications</artifactId>
|
||||
<version>1.10.0</version>
|
||||
</parent>
|
||||
<groupId>ru.entaxy.platform.integration.applications</groupId>
|
||||
<artifactId>application-shell</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
<name>ENTAXY :: PLATFORM :: INTEGRATION :: APPLICATIONS :: SHELL</name>
|
||||
<description>ENTAXY :: PLATFORM :: INTEGRATION :: APPLICATIONS :: SHELL</description>
|
||||
|
||||
<properties>
|
||||
<bundle.osgi.remove.headers>none</bundle.osgi.remove.headers>
|
||||
<bundle.osgi.private.pkg>
|
||||
ru.entaxy.platform.integration.applications.shell*
|
||||
</bundle.osgi.private.pkg>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.apache.karaf.shell</groupId>
|
||||
<artifactId>org.apache.karaf.shell.core</artifactId>
|
||||
<version>${karaf.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.base</groupId>
|
||||
<artifactId>base-support</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.platform.integration.applications</groupId>
|
||||
<artifactId>application-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.core</groupId>
|
||||
<artifactId>object-runtime-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.karaf.config</groupId>
|
||||
<artifactId>org.apache.karaf.config.core</artifactId>
|
||||
<version>${karaf.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>org.apache.felix.configadmin</artifactId>
|
||||
<version>${felix.configadmin.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.core.objects-implementations.config-implementation</groupId>
|
||||
<artifactId>config-runtime</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>${commons-io.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,41 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Action;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Reference;
|
||||
import org.apache.karaf.shell.api.console.Session;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.ApplicationManager;
|
||||
|
||||
public abstract class ApplicationManagerCommandSupport implements Action {
|
||||
|
||||
@Reference
|
||||
public ApplicationManager applicationManager;
|
||||
|
||||
@Reference
|
||||
public Session session;
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.karaf.shell.support.ansi.SimpleAnsi;
|
||||
|
||||
import ru.entaxy.platform.base.support.karaf.shell.ShellTableExt;
|
||||
|
||||
public class ApplicationShell {
|
||||
|
||||
public static final String COMMAND_SCOPE = "entaxy";
|
||||
|
||||
public static final String COMMAND_APP_NAME_PREFIX = "app-";
|
||||
|
||||
public static final String COMMAND_PROJECT_NAME_PREFIX = "project-";
|
||||
|
||||
public static String projectCommandName(String name) {
|
||||
return COMMAND_PROJECT_NAME_PREFIX.concat("-").concat(name);
|
||||
}
|
||||
|
||||
public static final String PROJECT_KEY = "ApplicationShell.project";
|
||||
|
||||
public static final String PROJECT_VERSION_KEY = "ApplicationShell.projectVersion";
|
||||
|
||||
public static final String APPLICATION_KEY = "ApplicationShell.application";
|
||||
|
||||
public static final String APPLICATION_VERSION_KEY = "ApplicationShell.applicationVersion";
|
||||
|
||||
public static final String APPLICATION_REVISION_KEY = "ApplicationShell.applicationRevision";
|
||||
|
||||
public static final String APPLICATION_CONFIG_KEY = "ApplicationShell.applicationConfig";
|
||||
|
||||
// Welocme color
|
||||
public static String WLC = "\u001B[36m";
|
||||
// OK color: High Intensity Foreground Color: Green
|
||||
public static String OKC = SimpleAnsi.COLOR_GREEN;
|
||||
// WARN color: High Intensity Foreground Color: Yellow
|
||||
public static String WARNC = SimpleAnsi.COLOR_YELLOW;
|
||||
// CRITICAL color: High Intensity Foreground Color: Red
|
||||
public static String CRT = SimpleAnsi.COLOR_RED + SimpleAnsi.INTENSITY_BOLD;
|
||||
// reset colors
|
||||
public static String NOR = "\33[0m";
|
||||
|
||||
public static String COLOR_REQUIRED = CRT;
|
||||
public static String COLOR_INCLUDED = OKC + SimpleAnsi.INTENSITY_BOLD;
|
||||
public static String COLOR_IGNORED = SimpleAnsi.COLOR_BLUE + SimpleAnsi.INTENSITY_BOLD;
|
||||
public static String COLOR_GHOST = WARNC + SimpleAnsi.INTENSITY_BOLD;
|
||||
|
||||
public static String COLOR_GRAY = "\33[38;2;100;100;100m" + SimpleAnsi.INTENSITY_BOLD;
|
||||
|
||||
public static String COLOR_RESET = NOR + SimpleAnsi.INTENSITY_NORMAL;
|
||||
|
||||
public static String colRequired(String data) {
|
||||
return COLOR_REQUIRED + data + COLOR_RESET;
|
||||
}
|
||||
|
||||
public static String colIncluded(String data) {
|
||||
return COLOR_INCLUDED + data + COLOR_RESET;
|
||||
}
|
||||
|
||||
public static String colIgnored(String data) {
|
||||
return COLOR_IGNORED + data + COLOR_RESET;
|
||||
}
|
||||
|
||||
public static String colGhost(String data) {
|
||||
return COLOR_GHOST + data + COLOR_RESET;
|
||||
}
|
||||
|
||||
public static Function<String, String> normalColorProvider =
|
||||
(str -> SimpleAnsi.RESET + SimpleAnsi.INTENSITY_NORMAL);
|
||||
|
||||
public static Function<ShellTableExt.CellData, String> normalColorProviderExt =
|
||||
(cellData -> SimpleAnsi.RESET + SimpleAnsi.INTENSITY_NORMAL);
|
||||
|
||||
public static Function<String, String> itemStatusColorProvider = (str -> {
|
||||
if ("+".equals(str))
|
||||
return COLOR_INCLUDED;
|
||||
else if ("-".equals(str))
|
||||
return COLOR_IGNORED;
|
||||
else if ("!".equals(str))
|
||||
return COLOR_REQUIRED;
|
||||
else if ("?".equals(str))
|
||||
return COLOR_GHOST;
|
||||
else
|
||||
return "";
|
||||
});
|
||||
|
||||
public static Function<String, String> requirementStatusColorProvider = (str -> {
|
||||
if ("V".equals(str))
|
||||
return COLOR_INCLUDED;
|
||||
else if ("X".equals(str))
|
||||
return COLOR_REQUIRED;
|
||||
else
|
||||
return "";
|
||||
});
|
||||
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.karaf.features.Capability;
|
||||
import org.apache.karaf.features.Feature;
|
||||
|
||||
import ru.entaxy.platform.base.support.osgi.bundle.CapabilityDescriptorImpl;
|
||||
import ru.entaxy.platform.base.support.osgi.bundle.CapabilityHelper;
|
||||
|
||||
/**
|
||||
* @deprecated use {@link ru.entaxy.platform.base.support.osgi.feature.FeatureCapabilityHelper}
|
||||
* instead
|
||||
*/
|
||||
@Deprecated
|
||||
public class FeatureCapabilityHelper extends CapabilityHelper {
|
||||
|
||||
protected Feature feature;
|
||||
|
||||
public FeatureCapabilityHelper(Feature feature) {
|
||||
super();
|
||||
setMultipleNamespacesSupported(true);
|
||||
this.feature = feature;
|
||||
load();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void load() {
|
||||
super.load();
|
||||
List<? extends Capability> featureCapabilities = feature.getCapabilities();
|
||||
for (Capability c : featureCapabilities) {
|
||||
String[] caps = c.getValue().split(",");
|
||||
for (String cap : caps)
|
||||
try {
|
||||
CapabilityDescriptorImpl descriptor = parseCapability(cap);
|
||||
if (descriptor != null)
|
||||
addProvidedCapability(descriptor);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Argument;
|
||||
import org.apache.karaf.shell.api.action.Completion;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.ApplicationStorage;
|
||||
import ru.entaxy.platform.integration.applications.shell.completers.StorageCompleter;
|
||||
|
||||
public abstract class StorageAwareCommand extends ApplicationManagerCommandSupport {
|
||||
|
||||
@Argument(name = "storage", required = true)
|
||||
@Completion(caseSensitive = false, value = StorageCompleter.class)
|
||||
public String storage;
|
||||
|
||||
public ApplicationStorage applicationStorage;
|
||||
|
||||
@Override
|
||||
public Object execute() throws Exception {
|
||||
applicationStorage = applicationManager.getStorage(storage);
|
||||
if (applicationStorage == null)
|
||||
throw new IllegalArgumentException("Storage not found: " + storage);
|
||||
doExecute();
|
||||
return null;
|
||||
}
|
||||
|
||||
protected abstract void doExecute();
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-storage-disable", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class StorageDisableCommand extends StorageAwareCommand {
|
||||
|
||||
@Override
|
||||
protected void doExecute() {
|
||||
applicationStorage.disable();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-storage-enable", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class StorageEnableCommand extends StorageAwareCommand {
|
||||
|
||||
@Override
|
||||
protected void doExecute() {
|
||||
applicationStorage.enable();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,80 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.Option;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.base.support.karaf.shell.ShellTableFixed;
|
||||
import ru.entaxy.platform.integration.applications.ApplicationStorage;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-storage-list", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class StorageListCommand extends ApplicationManagerCommandSupport {
|
||||
|
||||
@Option(name = "-d", aliases = {"--show-disabled"}, required = false, description = "Show disabled storage also")
|
||||
boolean showDisabled = false;
|
||||
|
||||
@Override
|
||||
public Object execute() throws Exception {
|
||||
|
||||
List<ApplicationStorage> storages =
|
||||
showDisabled ? applicationManager.getAllStorages() : applicationManager.getActiveStorages();
|
||||
|
||||
Collections.sort(storages, new Comparator<ApplicationStorage>() {
|
||||
@Override
|
||||
public int compare(ApplicationStorage o1, ApplicationStorage o2) {
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
}
|
||||
});
|
||||
|
||||
ShellTableFixed table = new ShellTableFixed();
|
||||
table.column("Name");
|
||||
table.column("Type");
|
||||
table.column("Enabled");
|
||||
table.column("Info");
|
||||
|
||||
for (ApplicationStorage storage : storages) {
|
||||
String storageInfo = storage.getInfo().entrySet().stream()
|
||||
.map(entry -> entry.getKey().concat(": ")
|
||||
.concat(entry.getValue() == null ? "" : entry.getValue().toString()))
|
||||
.collect(Collectors.joining("\n"));
|
||||
table.addRow().addContent(storage.getName(), storage.getType(), storage.isEnabled() ? "*" : "",
|
||||
storageInfo);
|
||||
}
|
||||
|
||||
table.print(System.out);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.karaf.bundle.core.BundleService;
|
||||
import org.apache.karaf.features.Feature;
|
||||
import org.apache.karaf.shell.api.action.Argument;
|
||||
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 org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
import ru.entaxy.platform.base.support.karaf.shell.ShellTableExt;
|
||||
import ru.entaxy.platform.base.support.osgi.bundle.CapabilityDescriptor;
|
||||
import ru.entaxy.platform.base.support.osgi.feature.FeatureCapabilityHelper;
|
||||
import ru.entaxy.platform.base.support.osgi.feature.FeaturesUtils.FeaturesHelper;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationManagerCommandSupport;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-bundle-check", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ApplicationCheckBundleCommand extends ApplicationManagerCommandSupport {
|
||||
|
||||
protected final static String APP_NAMESPACE = "entaxy.application";
|
||||
|
||||
@Reference
|
||||
BundleContext bundleContext;
|
||||
|
||||
@Argument(required = true)
|
||||
long bundleId;
|
||||
|
||||
@Reference
|
||||
BundleService bundleService;
|
||||
|
||||
@Override
|
||||
public Object execute() throws Exception {
|
||||
|
||||
Bundle b = bundleContext.getBundle(bundleId);
|
||||
List<Feature> features = FeaturesHelper.create(bundleContext).withCapabilityNamespace(APP_NAMESPACE)
|
||||
.containingBundle(b).installedOnly().find();
|
||||
|
||||
ShellTableExt shellTable = new ShellTableExt();
|
||||
shellTable.column("Application");
|
||||
shellTable.column("Version");
|
||||
shellTable.column("Revision");
|
||||
|
||||
for (Feature feature : features) {
|
||||
FeatureCapabilityHelper capabilityHelper = new FeatureCapabilityHelper(feature);
|
||||
List<CapabilityDescriptor> descriptors = capabilityHelper.getProvidedCapabilities(APP_NAMESPACE);
|
||||
for (CapabilityDescriptor descriptor : descriptors) {
|
||||
String name = descriptor.getAttributes().getOrDefault("name", "").toString();
|
||||
if (!CommonUtils.isValid(name))
|
||||
continue;
|
||||
String version = descriptor.getAttributes().getOrDefault("version", "").toString();
|
||||
String revision = descriptor.getAttributes().getOrDefault("revision", "").toString();
|
||||
|
||||
shellTable.addRow().addContent(name, version, revision);
|
||||
}
|
||||
}
|
||||
|
||||
// print output
|
||||
shellTable.print(System.out);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
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 ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
import ru.entaxy.platform.integration.applications.shell.StorageAwareCommand;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-import-file", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ApplicationImportFromFile extends StorageAwareCommand {
|
||||
|
||||
@Argument(required = true, index = 1)
|
||||
String filePath;
|
||||
|
||||
@Override
|
||||
protected void doExecute() {
|
||||
try {
|
||||
applicationManager.importApplicationFromFile(storage, filePath);
|
||||
} catch (Exception e) {
|
||||
// print error
|
||||
System.err.println("ERROR: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
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 ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
import ru.entaxy.platform.integration.applications.shell.StorageAwareCommand;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-import-repository", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ApplicationImportFromRepository extends StorageAwareCommand {
|
||||
|
||||
@Argument(required = true, index = 1)
|
||||
String mavenUrl;
|
||||
|
||||
@Override
|
||||
protected void doExecute() {
|
||||
try {
|
||||
applicationManager.importApplicationFromRepository(storage, mavenUrl);
|
||||
} catch (Exception e) {
|
||||
// print error
|
||||
System.err.println("ERROR: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,137 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.karaf.features.FeaturesService;
|
||||
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.CommonUtils;
|
||||
import ru.entaxy.platform.base.support.karaf.shell.ShellTableFixed;
|
||||
import ru.entaxy.platform.base.support.osgi.bundle.CapabilityDescriptor;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationManagerCommandSupport;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
import ru.entaxy.platform.integration.applications.shell.FeatureCapabilityHelper;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-list", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ApplicationListCommand extends ApplicationManagerCommandSupport {
|
||||
|
||||
protected final static String APP_NAMESPACE = "entaxy.application";
|
||||
|
||||
@Reference
|
||||
FeaturesService featuresService;
|
||||
|
||||
@Override
|
||||
public Object execute() throws Exception {
|
||||
ShellTableFixed table = new ShellTableFixed();
|
||||
table.column("Name");
|
||||
table.column("Storage");
|
||||
table.column("Versions");
|
||||
table.column("Last revision").alignCenter();
|
||||
table.column("Installed revision").alignCenter();
|
||||
|
||||
List<EntaxyApplication> apps = applicationManager.getApplications();
|
||||
Collections.sort(apps, new Comparator<EntaxyApplication>() {
|
||||
|
||||
@Override
|
||||
public int compare(EntaxyApplication o1, EntaxyApplication o2) {
|
||||
String storage1 = o1.getStorage().getName();
|
||||
String storage2 = o2.getStorage().getName();
|
||||
if (!storage1.equals(storage2))
|
||||
return storage1.compareTo(storage2);
|
||||
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
for (EntaxyApplication app : apps) {
|
||||
List<EntaxyApplicationVersion> versions = app.getVersions();
|
||||
Collections.sort(versions, new Comparator<EntaxyApplicationVersion>() {
|
||||
|
||||
@Override
|
||||
public int compare(EntaxyApplicationVersion o1, EntaxyApplicationVersion o2) {
|
||||
return o1.compareTo(o2);
|
||||
}
|
||||
|
||||
});
|
||||
String versionsValue = versions.stream().map(v -> v.getVersionNumber()).collect(Collectors.joining("\n"));
|
||||
String lastRevisionsValue = versions.stream().map(v -> v.getLastRevision().getRevisionNumber() + "")
|
||||
.collect(Collectors.joining("\n"));
|
||||
String installedRevisionsValue = versions.stream().map(v -> getInstalledRevisionValue(v))
|
||||
.collect(Collectors.joining("\n"));;
|
||||
|
||||
table.addRow().addContent(app.getName(), app.getStorage() == null ? "" : app.getStorage().getName(),
|
||||
versionsValue, lastRevisionsValue, installedRevisionsValue);
|
||||
}
|
||||
|
||||
// print output
|
||||
table.print(System.out);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
protected String getInstalledRevisionValue(EntaxyApplicationVersion version) {
|
||||
try {
|
||||
List<FeatureCapabilityHelper> helpers = Arrays.asList(featuresService.listInstalledFeatures()).stream()
|
||||
.map(f -> new FeatureCapabilityHelper(f))
|
||||
.filter(h -> h.isCapabilityProvided(APP_NAMESPACE))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (FeatureCapabilityHelper helper : helpers) {
|
||||
List<CapabilityDescriptor> descriptors = helper.getProvidedCapabilities(APP_NAMESPACE);
|
||||
for (CapabilityDescriptor descriptor : descriptors) {
|
||||
String nameValue = descriptor.getAttributes().getOrDefault("name", "").toString();
|
||||
String versionValue = descriptor.getAttributes().getOrDefault("version", "").toString();
|
||||
if (version.getApplication().getName().equals(nameValue)
|
||||
&& version.getVersionNumber().equals(versionValue)) {
|
||||
String revision = descriptor.getAttributes().getOrDefault("revision", "").toString();
|
||||
if (CommonUtils.isValid(revision))
|
||||
return revision;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
} catch (Exception ignore) {
|
||||
// NOOP
|
||||
ignore.printStackTrace();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,114 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Argument;
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.Completion;
|
||||
import org.apache.karaf.shell.api.action.Option;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.ApplicationStorage;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationManagerCommandSupport;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
import ru.entaxy.platform.integration.applications.shell.completers.ApplicationCompleter;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-manage", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ApplicationManageCommand extends ApplicationManagerCommandSupport {
|
||||
|
||||
@Argument
|
||||
@Completion(value = ApplicationCompleter.class)
|
||||
String application;
|
||||
|
||||
@Option(name = "-f", aliases = {"--force-cancel"})
|
||||
boolean forceCancel = false;
|
||||
|
||||
@Override
|
||||
public Object execute() throws Exception {
|
||||
if (session.get(ApplicationShell.APPLICATION_KEY) != null) {
|
||||
if (forceCancel) {
|
||||
try {
|
||||
EntaxyApplicationVersion version =
|
||||
(EntaxyApplicationVersion) session.get(ApplicationShell.APPLICATION_VERSION_KEY);
|
||||
} catch (Exception ignore) {
|
||||
|
||||
}
|
||||
try {
|
||||
EntaxyApplication application =
|
||||
(EntaxyApplication) session.get(ApplicationShell.APPLICATION_KEY);
|
||||
} catch (Exception ignore) {
|
||||
|
||||
}
|
||||
session.put(ApplicationShell.APPLICATION_KEY, null);
|
||||
session.put(ApplicationShell.APPLICATION_VERSION_KEY, null);
|
||||
} else {
|
||||
// print error
|
||||
System.err.println("Other application is being managed, please commit or cancel");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
String[] data = application.split("@");
|
||||
|
||||
if (data.length < 2) {
|
||||
// print error
|
||||
System.err.println("Incorrect application specified");
|
||||
return null;
|
||||
}
|
||||
|
||||
String storageName = data[1];
|
||||
ApplicationStorage storage = applicationManager.getStorage(storageName);
|
||||
if (storage == null) {
|
||||
// print error
|
||||
System.err.println("Incorrect storage specified: [" + storageName + "]");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!storage.isEnabled()) {
|
||||
// print error
|
||||
System.err.println("Storage is disabled: [" + storageName + "]");
|
||||
return null;
|
||||
}
|
||||
|
||||
String appName = data[0];
|
||||
EntaxyApplication app = storage.getApplication(appName);
|
||||
if (app == null) {
|
||||
// print error
|
||||
System.err.println(String.format("Application [%s] not found in storage [%s]", appName, storageName));
|
||||
return null;
|
||||
}
|
||||
|
||||
session.put(ApplicationShell.APPLICATION_KEY, app);
|
||||
session.put(ApplicationShell.APPLICATION_VERSION_KEY, null);
|
||||
session.put(ApplicationShell.APPLICATION_REVISION_KEY, null);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
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 ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.exceptions.ProjectNotFoundException;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
import ru.entaxy.platform.integration.applications.shell.StorageAwareCommand;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-remove", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ApplicationRemoveCommand extends StorageAwareCommand {
|
||||
|
||||
@Argument(name = "applicationName", required = true, index = 1)
|
||||
String applicationName;
|
||||
|
||||
@Override
|
||||
protected void doExecute() {
|
||||
try {
|
||||
EntaxyApplication app = applicationStorage.getApplication(applicationName);
|
||||
if (app != null) {
|
||||
applicationStorage.removeApplication(app);
|
||||
System.out.println("Removed successfully");
|
||||
} else {
|
||||
throw new ProjectNotFoundException(applicationName);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// output error
|
||||
System.err.println("ERROR: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-version-manage", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ApplicationVersionManageCommand extends ApplicationVersionSupport {
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplication application) {
|
||||
if (session.get(ApplicationShell.APPLICATION_VERSION_KEY) != null) {
|
||||
// print error
|
||||
System.err.println("Another version is being managed, please cancel or commit");
|
||||
return;
|
||||
}
|
||||
|
||||
EntaxyApplicationVersion version = application.getVersion(versionNumber);
|
||||
if (version == null) {
|
||||
System.err.println("Version not found");
|
||||
return;
|
||||
}
|
||||
|
||||
session.put(ApplicationShell.APPLICATION_VERSION_KEY, version);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-version-remove", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ApplicationVersionRemoveCommand extends ApplicationVersionSupport {
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplication application) {
|
||||
application.removeVersion(versionNumber);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Argument;
|
||||
import org.apache.karaf.shell.api.action.Completion;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.shell.completers.ApplicationVersionCompleter;
|
||||
|
||||
public abstract class ApplicationVersionSupport extends ManagedApplicationCommand {
|
||||
|
||||
@Argument(required = true)
|
||||
@Completion(value = ApplicationVersionCompleter.class)
|
||||
String versionNumber;
|
||||
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationRevision;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
import ru.entaxy.platform.config.runtime.ObjectConfigEditor;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-revision-config-cancel", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ConfigCancelCommand extends ManagedApplicationConfigCommand {
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplication application, EntaxyApplicationVersion version,
|
||||
EntaxyApplicationRevision revision, ObjectConfigEditor editor) {
|
||||
|
||||
editor.clear();
|
||||
session.put(ApplicationShell.APPLICATION_CONFIG_KEY, null);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.ApplicationItem;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication.ITEM_TYPE;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationRevision;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
import ru.entaxy.platform.config.runtime.ObjectConfigEditor;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-revision-config-commit", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ConfigCommitCommand extends ManagedApplicationConfigCommand {
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplication application, EntaxyApplicationVersion version,
|
||||
EntaxyApplicationRevision revision, ObjectConfigEditor editor) {
|
||||
|
||||
Optional<ApplicationItem> configItemOpt = revision.getItems().stream()
|
||||
.filter(item -> item.getType().equals(ITEM_TYPE.CONFIG) && editor.getPid().equals(item.getId()))
|
||||
.findFirst();
|
||||
if (configItemOpt.isEmpty()) {
|
||||
// output error
|
||||
System.err.println("ERROR: config [" + editor.getPid() + "] not found");
|
||||
return;
|
||||
}
|
||||
|
||||
ApplicationItem configItem = configItemOpt.get();
|
||||
|
||||
try {
|
||||
editor.save();
|
||||
} catch (Exception e) {
|
||||
// output error
|
||||
System.err.println("ERROR: failed saving config [" + editor.getPid() + "], see exception below");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
try (InputStream is = new FileInputStream(editor.getConfigFile())) {
|
||||
configItem.update(is);
|
||||
} catch (Exception e) {
|
||||
// output error
|
||||
System.err.println("ERROR: failed saving config [" + editor.getPid() + "], see exception below");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
editor.clear();
|
||||
session.put(ApplicationShell.APPLICATION_CONFIG_KEY, null);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Argument;
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.Completion;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.ApplicationItem;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication.ITEM_TYPE;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationRevision;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
import ru.entaxy.platform.config.runtime.ObjectConfigEditor;
|
||||
import ru.entaxy.platform.integration.applications.shell.completers.ConfigCompleter;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-revision-config-edit", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ConfigEditCommand extends ManagedApplicationRevisionCommand {
|
||||
|
||||
@Argument(required = true)
|
||||
@Completion(value = ConfigCompleter.class)
|
||||
String configId;
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplication application, EntaxyApplicationVersion version,
|
||||
EntaxyApplicationRevision revision) {
|
||||
|
||||
ObjectConfigEditor editor = (ObjectConfigEditor) session.get(ApplicationShell.APPLICATION_CONFIG_KEY);
|
||||
|
||||
if (editor != null) {
|
||||
// print error
|
||||
System.err.println("ERROR: another config is being edited, please commit or cancel it first");
|
||||
return;
|
||||
}
|
||||
|
||||
Optional<ApplicationItem> configItemOpt = revision.getItems().stream()
|
||||
.filter(item -> item.getType().equals(ITEM_TYPE.CONFIG) && configId.equals(item.getId())).findFirst();
|
||||
if (configItemOpt.isEmpty()) {
|
||||
// output error
|
||||
System.err.println("ERROR: config [" + configId + "] not found");
|
||||
return;
|
||||
}
|
||||
|
||||
ApplicationItem configItem = configItemOpt.get();
|
||||
|
||||
File tempFile = null;
|
||||
|
||||
try {
|
||||
Path temp = Files.createTempFile(configId, null);
|
||||
tempFile = temp.toFile().getAbsoluteFile();
|
||||
tempFile.getParentFile().mkdirs();
|
||||
} catch (IOException e) {
|
||||
// output error
|
||||
System.err.println("ERROR: can't create temp file, see exception below:\n");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
try (InputStream is = configItem.getInputStream()) {
|
||||
Files.copy(is, tempFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
} catch (IOException e) {
|
||||
// output error
|
||||
System.err.println("ERROR: can't write to temp file, see exception below:\n");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
editor = ObjectConfigEditor.create(tempFile);
|
||||
} catch (IOException e) {
|
||||
System.err.println("ERROR: can't create config editor, see exception below:\n");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
editor.loadCurrent(configItem.getId());
|
||||
} catch (Exception e) {
|
||||
System.err.println("WARN: can't create config editor, see exception below:\n");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
editor.setPid(configId);
|
||||
|
||||
session.put(ApplicationShell.APPLICATION_CONFIG_KEY, editor);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.base.support.karaf.shell.ShellTableFixed;
|
||||
import ru.entaxy.platform.integration.applications.ApplicationItem;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication.ITEM_TYPE;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationRevision;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-revision-config-list", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ConfigListCommand extends RevisionSupport {
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplication application, EntaxyApplicationVersion version,
|
||||
EntaxyApplicationRevision revision) {
|
||||
|
||||
ShellTableFixed table = new ShellTableFixed();
|
||||
table.column("Id");
|
||||
table.column("Location");
|
||||
|
||||
for (ApplicationItem item : revision.getItems().stream().filter(it -> it.getType().equals(ITEM_TYPE.CONFIG))
|
||||
.collect(Collectors.toList())) {
|
||||
table.addRow().addContent(item.getId(), item.getLocation());
|
||||
}
|
||||
|
||||
table.print(System.out);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,139 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.StandardCopyOption;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Argument;
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.Option;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.base.support.karaf.shell.ShellTableFixed;
|
||||
import ru.entaxy.platform.integration.applications.ApplicationItem;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication.ITEM_TYPE;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationRevision;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
import ru.entaxy.platform.config.runtime.ObjectConfigEditor;
|
||||
import ru.entaxy.platform.config.runtime.ObjectConfigEditor.ConfigProperty;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-revision-config-print", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ConfigPrintCommand extends RevisionSupport {
|
||||
|
||||
@Argument(required = true)
|
||||
String configId;
|
||||
|
||||
@Option(name = "-s", aliases = {"--show-system-properties"})
|
||||
boolean showSystemProperties = false;
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplication application, EntaxyApplicationVersion version,
|
||||
EntaxyApplicationRevision revision) {
|
||||
|
||||
Optional<ApplicationItem> configItemOpt = revision.getItems().stream()
|
||||
.filter(item -> item.getType().equals(ITEM_TYPE.CONFIG) && configId.equals(item.getId())).findFirst();
|
||||
if (configItemOpt.isEmpty()) {
|
||||
// output error
|
||||
System.err.println("ERROR: config [" + configId + "] not found");
|
||||
return;
|
||||
}
|
||||
|
||||
ApplicationItem configItem = configItemOpt.get();
|
||||
|
||||
File tempFile = null;
|
||||
|
||||
try {
|
||||
Path temp = Files.createTempFile(configId, null);
|
||||
tempFile = temp.toFile().getAbsoluteFile();
|
||||
tempFile.getParentFile().mkdirs();
|
||||
} catch (IOException e) {
|
||||
// output error
|
||||
System.err.println("ERROR: can't create temp file, see exception below:\n");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
try (InputStream is = configItem.getInputStream()) {
|
||||
Files.copy(is, tempFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
|
||||
} catch (IOException e) {
|
||||
// output error
|
||||
System.err.println("ERROR: can't write to temp file, see exception below:\n");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
ObjectConfigEditor editor = null;
|
||||
|
||||
try {
|
||||
editor = ObjectConfigEditor.create(tempFile);
|
||||
} catch (IOException e) {
|
||||
System.err.println("ERROR: can't create config editor, see exception below:\n");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
editor.loadCurrent(configItem.getId());
|
||||
} catch (Exception e) {
|
||||
System.err.println("WARN: can't create config editor, see exception below:\n");
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
ShellTableFixed table = new ShellTableFixed();
|
||||
table.column("Name");
|
||||
table.column("Display Name");
|
||||
table.column("Is system");
|
||||
table.column("Type");
|
||||
table.column("Value");
|
||||
table.column("Current Value");
|
||||
|
||||
for (String name : editor.getPropertiesNames()) {
|
||||
ConfigProperty property = editor.getAsConfigProperty(name);
|
||||
if (property.hint.isInternal() && !showSystemProperties)
|
||||
continue;
|
||||
table.addRow().addContent(
|
||||
name,
|
||||
property.hint.getDisplayName(),
|
||||
property.hint.isInternal(),
|
||||
property.hint.getType(),
|
||||
property.configValue == null ? "" : property.configValue.toString(),
|
||||
property.currentValue == null ? "" : property.currentValue.toString());
|
||||
|
||||
}
|
||||
|
||||
table.print(System.out);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
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 ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationRevision;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
import ru.entaxy.platform.config.runtime.ObjectConfigEditor;
|
||||
import ru.entaxy.platform.config.runtime.ObjectConfigEditor.ConfigProperty;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-revision-config-set", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ConfigSetPropertyCommand extends ManagedApplicationConfigCommand {
|
||||
|
||||
@Argument(required = true, index = 0)
|
||||
String propertyName;
|
||||
|
||||
@Argument(required = true, index = 1)
|
||||
String propertyValue;
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplication application, EntaxyApplicationVersion version,
|
||||
EntaxyApplicationRevision revision, ObjectConfigEditor editor) {
|
||||
|
||||
ConfigProperty property = editor.getAsConfigProperty(propertyName);
|
||||
if (property == null) {
|
||||
// output error
|
||||
System.err.println("ERROR: property [" + propertyName + "] not found");
|
||||
return;
|
||||
}
|
||||
|
||||
if (property.hint.isInternal()) {
|
||||
// output error
|
||||
System.err.println("ERROR: property [" + propertyName + "] is system, it can't be updated");
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
editor.setValue(propertyName, propertyValue);
|
||||
} catch (Exception e) {
|
||||
// output error
|
||||
System.err.println("ERROR: setting property [" + propertyName + "], see exception below");
|
||||
e.printStackTrace();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,151 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.Option;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.base.support.karaf.shell.ShellTableExt;
|
||||
import ru.entaxy.platform.config.runtime.ObjectConfig.ConfigFieldHint;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationRevision;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
import ru.entaxy.platform.config.runtime.ObjectConfigEditor;
|
||||
import ru.entaxy.platform.config.runtime.ObjectConfigEditor.ConfigProperty;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-revision-config-status", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ConfigStatusCommand extends ManagedApplicationConfigCommand {
|
||||
|
||||
@Option(name = "-s", aliases = {"--show-system-properties"})
|
||||
boolean showSystemProperties = false;
|
||||
|
||||
ConfigFieldHint currentHint = null;
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplication application, EntaxyApplicationVersion version,
|
||||
EntaxyApplicationRevision revision, ObjectConfigEditor editor) {
|
||||
|
||||
Function<String, String> isSystemColorProvider = (str -> {
|
||||
if (currentHint == null)
|
||||
return ApplicationShell.COLOR_RESET;
|
||||
if (currentHint.isInternal())
|
||||
return ApplicationShell.COLOR_GRAY;
|
||||
return ApplicationShell.COLOR_RESET;
|
||||
});
|
||||
|
||||
Function<ShellTableExt.CellData, String> isSystemColorProviderExt = (cellData -> {
|
||||
|
||||
if (cellData.dataObject == null)
|
||||
return ApplicationShell.COLOR_RESET;
|
||||
|
||||
if (!(cellData.dataObject instanceof ConfigProperty))
|
||||
return ApplicationShell.COLOR_RESET;
|
||||
|
||||
ConfigProperty configProperty = (ConfigProperty) cellData.dataObject;
|
||||
|
||||
if (configProperty.hint == null)
|
||||
return ApplicationShell.COLOR_RESET;
|
||||
if (configProperty.hint.isInternal())
|
||||
return ApplicationShell.COLOR_GRAY;
|
||||
return ApplicationShell.COLOR_RESET;
|
||||
});
|
||||
|
||||
Function<ShellTableExt.CellData, String> isNewValueProviderExt = (cellData -> {
|
||||
|
||||
if (cellData.dataObject == null)
|
||||
return ApplicationShell.COLOR_RESET;
|
||||
|
||||
if (!(cellData.dataObject instanceof ConfigProperty))
|
||||
return ApplicationShell.COLOR_RESET;
|
||||
|
||||
ConfigProperty configProperty = (ConfigProperty) cellData.dataObject;
|
||||
|
||||
if (configProperty.currentValue == null)
|
||||
return ApplicationShell.COLOR_INCLUDED;
|
||||
return ApplicationShell.COLOR_RESET;
|
||||
});
|
||||
|
||||
Function<ShellTableExt.CellData, String> isAbsentValueProviderExt = (cellData -> {
|
||||
|
||||
if (cellData.dataObject == null)
|
||||
return ApplicationShell.COLOR_RESET;
|
||||
|
||||
if (!(cellData.dataObject instanceof ConfigProperty))
|
||||
return ApplicationShell.COLOR_RESET;
|
||||
|
||||
ConfigProperty configProperty = (ConfigProperty) cellData.dataObject;
|
||||
|
||||
if (configProperty.configValue == null)
|
||||
return ApplicationShell.COLOR_REQUIRED;
|
||||
return ApplicationShell.COLOR_RESET;
|
||||
});
|
||||
|
||||
Function<ShellTableExt.CellData, String> isModifiedColorProvider = (cellData -> {
|
||||
if (cellData.dataObject == null)
|
||||
return ApplicationShell.COLOR_RESET;
|
||||
return ApplicationShell.COLOR_IGNORED;
|
||||
});
|
||||
|
||||
ShellTableExt table = new ShellTableExt();
|
||||
table.column("Name").colorProviderExt(isSystemColorProviderExt);
|
||||
table.column("Display Name").colorProvider(ApplicationShell.normalColorProvider);
|
||||
table.column("Is system");
|
||||
table.column("Type");
|
||||
table.column("Imported Value").colorProviderExt(isNewValueProviderExt);
|
||||
table.column("Modified Value").colorProviderExt(isModifiedColorProvider);
|
||||
table.column("Local Value").colorProviderExt(isAbsentValueProviderExt);
|
||||
|
||||
for (String name : editor.getPropertiesNames()) {
|
||||
ConfigProperty property = editor.getAsConfigProperty(name);
|
||||
currentHint = property.hint;
|
||||
if (property.hint.isInternal() && !showSystemProperties)
|
||||
continue;
|
||||
table.addRow(property).addContent(
|
||||
name,
|
||||
property.hint.getDisplayName(),
|
||||
property.hint.isInternal(),
|
||||
property.hint.getType(),
|
||||
property.configValue == null ? "" : property.configValue.toString(),
|
||||
property.modifiedValue == null ? "" : property.modifiedValue.toString(),
|
||||
property.currentValue == null ? "" : property.currentValue.toString());
|
||||
|
||||
}
|
||||
|
||||
// output data
|
||||
System.out.println("PID:\t" + editor.getPid());
|
||||
System.out.println("Modified:\t" + editor.isDirty());
|
||||
System.out.println("Temp file:\t" + editor.getConfigFile().getAbsolutePath());
|
||||
System.out.println("\n\tPROPERTIES:");
|
||||
table.print(System.out);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationManagerCommandSupport;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
public abstract class ManagedApplicationCommand extends ApplicationManagerCommandSupport {
|
||||
|
||||
@Override
|
||||
public Object execute() throws Exception {
|
||||
if (session.get(ApplicationShell.APPLICATION_KEY) == null) {
|
||||
// print error
|
||||
System.err.println("No application is being managed");
|
||||
return null;
|
||||
}
|
||||
EntaxyApplication app = (EntaxyApplication) session.get(ApplicationShell.APPLICATION_KEY);
|
||||
doExecute(app);
|
||||
return null;
|
||||
}
|
||||
|
||||
protected abstract void doExecute(EntaxyApplication application);
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationRevision;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
import ru.entaxy.platform.config.runtime.ObjectConfigEditor;
|
||||
|
||||
public abstract class ManagedApplicationConfigCommand extends ManagedApplicationRevisionCommand {
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplication application, EntaxyApplicationVersion version,
|
||||
EntaxyApplicationRevision revision) {
|
||||
ObjectConfigEditor editor =
|
||||
(ObjectConfigEditor) session.get(ApplicationShell.APPLICATION_CONFIG_KEY);
|
||||
if (editor == null) {
|
||||
// print error
|
||||
System.err.println("No config is being edited");
|
||||
return;
|
||||
}
|
||||
doExecute(application, version, revision, editor);
|
||||
}
|
||||
|
||||
protected abstract void doExecute(EntaxyApplication application, EntaxyApplicationVersion version,
|
||||
EntaxyApplicationRevision revision, ObjectConfigEditor editor);
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationRevision;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
public abstract class ManagedApplicationRevisionCommand extends ManagedApplicationVersionCommand {
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplication application, EntaxyApplicationVersion version) {
|
||||
EntaxyApplicationRevision revision =
|
||||
(EntaxyApplicationRevision) session.get(ApplicationShell.APPLICATION_REVISION_KEY);
|
||||
if (revision == null) {
|
||||
// print error
|
||||
System.err.println("No revision is being managed");
|
||||
return;
|
||||
}
|
||||
doExecute(application, version, revision);
|
||||
}
|
||||
|
||||
protected abstract void doExecute(EntaxyApplication application, EntaxyApplicationVersion version,
|
||||
EntaxyApplicationRevision revision);
|
||||
}
|
@ -0,0 +1,47 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
public abstract class ManagedApplicationVersionCommand extends ManagedApplicationCommand {
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplication application) {
|
||||
EntaxyApplicationVersion version =
|
||||
(EntaxyApplicationVersion) session.get(ApplicationShell.APPLICATION_VERSION_KEY);
|
||||
if (version == null) {
|
||||
// print error
|
||||
System.err.println("No version is being managed");
|
||||
return;
|
||||
}
|
||||
doExecute(application, version);
|
||||
}
|
||||
|
||||
protected abstract void doExecute(EntaxyApplication application, EntaxyApplicationVersion version);
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationRevision;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationVersion;
|
||||
import ru.entaxy.platform.integration.applications.exceptions.RevisionException;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-revision-configure", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class RevisionConfigureCommand extends RevisionSupport {
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplication application, EntaxyApplicationVersion version,
|
||||
EntaxyApplicationRevision revision) {
|
||||
try {
|
||||
revision.configure();
|
||||
session.put(ApplicationShell.APPLICATION_REVISION_KEY, revision);
|
||||
printRevision(revision);
|
||||
} catch (RevisionException e) {
|
||||
// output error
|
||||
System.err.println("ERROR: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.Option;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationRevision;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationVersion;
|
||||
import ru.entaxy.platform.integration.applications.exceptions.ApplicationVersionException;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-revision-create", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class RevisionCreateCommand extends ManagedApplicationVersionCommand {
|
||||
|
||||
@Option(name = "-r", aliases = {"--from-revision"}, required = false)
|
||||
String fromRevision;
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplication application, EntaxyApplicationVersion version) {
|
||||
|
||||
int sourceRevision = -1;
|
||||
|
||||
if (CommonUtils.isValid(fromRevision))
|
||||
try {
|
||||
sourceRevision = Integer.parseInt(fromRevision);
|
||||
} catch (Exception e) {
|
||||
// print error
|
||||
System.err.println("Invalid source revision number: " + fromRevision);
|
||||
return;
|
||||
}
|
||||
|
||||
EntaxyApplicationRevision revision = null;
|
||||
|
||||
try {
|
||||
if (sourceRevision < 0)
|
||||
revision = version.createRevision();
|
||||
else
|
||||
revision = version.createRevision(sourceRevision);
|
||||
} catch (ApplicationVersionException e) {
|
||||
// print error
|
||||
System.err.println("Error creating revision: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (revision == null) {
|
||||
// print error
|
||||
System.err.println("Error creating revision: revision is null");
|
||||
return;
|
||||
}
|
||||
|
||||
// print result
|
||||
System.out.println(String.format("Created revision %d with status %s", revision.getRevisionNumber(),
|
||||
revision.getStatus()));
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationRevision;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationVersion;
|
||||
import ru.entaxy.platform.integration.applications.exceptions.RevisionException;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-revision-deploy", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class RevisionDeployCommand extends RevisionSupport {
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplication application, EntaxyApplicationVersion version,
|
||||
EntaxyApplicationRevision revision) {
|
||||
try {
|
||||
revision.deploy();
|
||||
printRevision(revision);
|
||||
} catch (RevisionException e) {
|
||||
// output error
|
||||
System.err.println("ERROR: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,49 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationRevision;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-revision-done", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class RevisionDoneCommand extends ManagedApplicationRevisionCommand {
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplication application, EntaxyApplicationVersion version,
|
||||
EntaxyApplicationRevision revision) {
|
||||
|
||||
|
||||
session.put(ApplicationShell.APPLICATION_REVISION_KEY, null);
|
||||
session.put(ApplicationShell.APPLICATION_CONFIG_KEY, null);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,138 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import java.util.Comparator;
|
||||
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.esb.resources.EntaxyResource;
|
||||
import ru.entaxy.esb.resources.EntaxyResourceService;
|
||||
import ru.entaxy.platform.base.support.karaf.shell.ShellTableFixed;
|
||||
import ru.entaxy.platform.integration.applications.ApplicationItem;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationRevision;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationVersion;
|
||||
import ru.entaxy.platform.integration.applications.descriptor.ApplicationDescriptor;
|
||||
import ru.entaxy.platform.integration.applications.descriptor.ApplicationRequirement;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectService;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-revision-info", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class RevisionInfoCommand extends RevisionSupport {
|
||||
|
||||
@Reference
|
||||
EntaxyRuntimeObjectService entaxyRuntimeObjectService;
|
||||
|
||||
@Reference
|
||||
EntaxyResourceService entaxyResourceService;
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplication application, EntaxyApplicationVersion version,
|
||||
EntaxyApplicationRevision revision) {
|
||||
|
||||
System.out.println("");
|
||||
// output main revision info
|
||||
String data = "Application : ".concat(application.getName()).concat("\n")
|
||||
.concat("Group : ").concat(version.getDescriptor().group).concat("\n")
|
||||
.concat("Version : ").concat(version.getVersionNumber()).concat("\n")
|
||||
.concat("Revision : ").concat(revision.getRevisionNumber() + "").concat("\n")
|
||||
.concat("Status : ").concat(revision.getStatus().name()).concat("\n")
|
||||
.concat("Revisionable : ")
|
||||
.concat(revision.getItems().stream().filter(item -> item.isRevisionable()).count() > 0 ? "true"
|
||||
: "false")
|
||||
.concat("\n")
|
||||
.concat("Editable : ")
|
||||
.concat(revision.getItems().stream().filter(item -> item.isEditable()).count() > 0 ? "true" : "false");
|
||||
System.out.println(data);
|
||||
|
||||
// output items
|
||||
System.out.println("\n\tITEMS");
|
||||
ShellTableFixed itemsTable = new ShellTableFixed();
|
||||
itemsTable.column("Id");
|
||||
itemsTable.column("Type");
|
||||
itemsTable.column("Revisionable").alignCenter();
|
||||
itemsTable.column("Editable").alignCenter();
|
||||
|
||||
for (ApplicationItem item : revision.getItems().stream().sorted(new Comparator<ApplicationItem>() {
|
||||
|
||||
@Override
|
||||
public int compare(ApplicationItem o1, ApplicationItem o2) {
|
||||
return o1.getType().name().compareTo(o2.getType().name());
|
||||
}
|
||||
}).collect(Collectors.toList())) {
|
||||
|
||||
itemsTable.addRow().addContent(item.getId(), item.getType().name(), item.isRevisionable() ? "*" : "",
|
||||
item.isEditable() ? "*" : "");
|
||||
|
||||
}
|
||||
|
||||
itemsTable.print(System.out);
|
||||
|
||||
// output requirements
|
||||
ApplicationDescriptor applicationDescriptor = revision.getDescriptor();
|
||||
System.out.println("\n\tREQUIREMENTS");
|
||||
ShellTableFixed requirementsTable = new ShellTableFixed();
|
||||
requirementsTable.column("Id").colorProvider(ApplicationShell.normalColorProvider);
|
||||
requirementsTable.column("Type").colorProvider(ApplicationShell.normalColorProvider);
|
||||
requirementsTable.column("Scope").colorProvider(ApplicationShell.normalColorProvider);
|
||||
requirementsTable.column("Status").colorProvider(ApplicationShell.requirementStatusColorProvider).alignCenter();
|
||||
|
||||
for (ApplicationRequirement req : applicationDescriptor.requirements) {
|
||||
requirementsTable.addRow().addContent(
|
||||
req.id,
|
||||
req.type.name(),
|
||||
req.scope.name(),
|
||||
checkRequirement(req) ? "V" : "X");
|
||||
}
|
||||
|
||||
requirementsTable.print(System.out);
|
||||
|
||||
System.out.println("");
|
||||
}
|
||||
|
||||
protected boolean checkRequirement(ApplicationRequirement requirement) {
|
||||
switch (requirement.type) {
|
||||
case OBJECT:
|
||||
EntaxyRuntimeObject runtimeObject = entaxyRuntimeObjectService.getRuntimeObject(requirement.id);
|
||||
return runtimeObject != null && !runtimeObject.isGhost();
|
||||
case RESOURCE:
|
||||
EntaxyResource entaxyResource = entaxyResourceService.getResource(requirement.id);
|
||||
return entaxyResource.exists();
|
||||
case BUNDLE:
|
||||
case CONFIG:
|
||||
// TODO implement
|
||||
return true;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationRevision;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationVersion;
|
||||
import ru.entaxy.platform.integration.applications.exceptions.RevisionException;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-revision-install", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class RevisionInstallCommand extends RevisionSupport {
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplication application, EntaxyApplicationVersion version,
|
||||
EntaxyApplicationRevision revision) {
|
||||
try {
|
||||
revision.install();
|
||||
printRevision(revision);
|
||||
} catch (RevisionException e) {
|
||||
// output error
|
||||
System.err.println("ERROR: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.base.support.karaf.shell.ShellTableFixed;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationRevision;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-revision-list", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class RevisionListCommand extends ManagedApplicationVersionCommand {
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplication application, EntaxyApplicationVersion version) {
|
||||
|
||||
ShellTableFixed table = new ShellTableFixed();
|
||||
table.column("Number").alignCenter();
|
||||
table.column("Status");
|
||||
|
||||
List<EntaxyApplicationRevision> revisions =
|
||||
version.getRevisions().stream().sorted(new Comparator<EntaxyApplicationRevision>() {
|
||||
|
||||
@Override
|
||||
public int compare(EntaxyApplicationRevision o1, EntaxyApplicationRevision o2) {
|
||||
if (o1.getRevisionNumber() > o2.getRevisionNumber())
|
||||
return 1;
|
||||
return -1;
|
||||
}
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
|
||||
for (EntaxyApplicationRevision revision : revisions) {
|
||||
table.addRow().addContent(revision.getRevisionNumber(), revision.getStatus());
|
||||
}
|
||||
|
||||
// output
|
||||
table.print(System.out);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Option;
|
||||
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationRevision;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationVersion;
|
||||
|
||||
public abstract class RevisionSupport extends ManagedApplicationVersionCommand {
|
||||
|
||||
@Option(name = "-r", aliases = {"--revision"})
|
||||
public String revisionNumber;
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplication application, EntaxyApplicationVersion version) {
|
||||
int revisionNum = version.getLastRevision().getRevisionNumber();
|
||||
if (CommonUtils.isValid(revisionNumber))
|
||||
try {
|
||||
revisionNum = Integer.parseInt(revisionNumber);
|
||||
} catch (Exception e) {
|
||||
|
||||
// print error
|
||||
System.err.println("Invalid revision number: " + revisionNumber);
|
||||
return;
|
||||
}
|
||||
|
||||
EntaxyApplicationRevision revision = version.getRevision(revisionNum);
|
||||
doExecute(application, version, revision);
|
||||
}
|
||||
|
||||
protected void printRevision(EntaxyApplicationRevision revision) {
|
||||
// output
|
||||
System.out.println(
|
||||
String.format("Revision: %d; status: %s", revision.getRevisionNumber(), revision.getStatus().name()));
|
||||
}
|
||||
|
||||
protected abstract void doExecute(EntaxyApplication application, EntaxyApplicationVersion version,
|
||||
EntaxyApplicationRevision revision);
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.application;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationRevision;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationVersion;
|
||||
import ru.entaxy.platform.integration.applications.exceptions.RevisionException;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
@Command(name = "app-revision-uninstall", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class RevisionUninstallCommand extends RevisionSupport {
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplication application, EntaxyApplicationVersion version,
|
||||
EntaxyApplicationRevision revision) {
|
||||
try {
|
||||
revision.uninstall();
|
||||
printRevision(revision);
|
||||
} catch (RevisionException e) {
|
||||
// output error
|
||||
System.err.println("ERROR: " + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.completers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Reference;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
import org.apache.karaf.shell.api.console.CommandLine;
|
||||
import org.apache.karaf.shell.api.console.Completer;
|
||||
import org.apache.karaf.shell.api.console.Session;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.ApplicationManager;
|
||||
|
||||
@Service
|
||||
public class ApplicationCompleter implements Completer {
|
||||
|
||||
@Reference
|
||||
ApplicationManager applicationManager;
|
||||
|
||||
@Override
|
||||
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
|
||||
candidates.addAll(
|
||||
applicationManager.getApplications().stream()
|
||||
.filter(app -> app.getStorage() != null)
|
||||
.map(app -> app.getName().concat("@")
|
||||
.concat(app.getStorage().getName()))
|
||||
.collect(Collectors.toList()));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.completers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
import org.apache.karaf.shell.api.console.CommandLine;
|
||||
import org.apache.karaf.shell.api.console.Completer;
|
||||
import org.apache.karaf.shell.api.console.Session;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
public class ApplicationVersionCompleter implements Completer {
|
||||
|
||||
@Override
|
||||
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
|
||||
EntaxyApplication app = (EntaxyApplication) session.get(ApplicationShell.APPLICATION_KEY);
|
||||
if (app == null)
|
||||
return 0;
|
||||
candidates.addAll(app.getVersions().stream().map(v -> v.getVersionNumber()).collect(Collectors.toList()));
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.completers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
import org.apache.karaf.shell.api.console.CommandLine;
|
||||
import org.apache.karaf.shell.api.console.Completer;
|
||||
import org.apache.karaf.shell.api.console.Session;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplication.ITEM_TYPE;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationRevision;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
public class ConfigCompleter implements Completer {
|
||||
|
||||
@Override
|
||||
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
|
||||
EntaxyApplicationRevision revision =
|
||||
(EntaxyApplicationRevision) session.get(ApplicationShell.APPLICATION_REVISION_KEY);
|
||||
if (revision == null)
|
||||
return 0;
|
||||
|
||||
candidates.addAll(
|
||||
revision.getItems().stream().filter(item -> item.getType().equals(ITEM_TYPE.CONFIG))
|
||||
.map(item -> item.getId()).collect(Collectors.toList()));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.completers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Reference;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
import org.apache.karaf.shell.api.console.CommandLine;
|
||||
import org.apache.karaf.shell.api.console.Completer;
|
||||
import org.apache.karaf.shell.api.console.Session;
|
||||
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectService;
|
||||
|
||||
@Service
|
||||
public class EntaxyRuntimeObjectCompleter implements Completer {
|
||||
|
||||
@Reference
|
||||
EntaxyRuntimeObjectService entaxyRuntimeObjectService;
|
||||
|
||||
@Override
|
||||
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
|
||||
candidates.addAll(entaxyRuntimeObjectService.getObjects().stream()
|
||||
.filter(obj -> !obj.isGhost())
|
||||
.map(obj -> obj.getObjectFullId())
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.completers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Reference;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
import org.apache.karaf.shell.api.console.CommandLine;
|
||||
import org.apache.karaf.shell.api.console.Completer;
|
||||
import org.apache.karaf.shell.api.console.Session;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.ApplicationManager;
|
||||
|
||||
@Service
|
||||
public class ProjectCompleter implements Completer {
|
||||
|
||||
@Reference
|
||||
ApplicationManager applicationManager;
|
||||
|
||||
@Override
|
||||
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
|
||||
candidates.addAll(
|
||||
applicationManager.getProjects().stream()
|
||||
.filter(app -> app.getStorage() != null)
|
||||
.map(app -> app.getName().concat("@")
|
||||
.concat(app.getStorage().getName()))
|
||||
.collect(Collectors.toList()));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,53 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.completers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
import org.apache.karaf.shell.api.console.CommandLine;
|
||||
import org.apache.karaf.shell.api.console.Completer;
|
||||
import org.apache.karaf.shell.api.console.Session;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProjectVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
public class ProjectItemCompleter implements Completer {
|
||||
|
||||
@Override
|
||||
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
|
||||
EntaxyApplicationProjectVersion version = (EntaxyApplicationProjectVersion) session.get(ApplicationShell.PROJECT_VERSION_KEY);
|
||||
if (version == null)
|
||||
return 0;
|
||||
|
||||
candidates.addAll(version.getItems().stream().map(item -> item.getId()).collect(Collectors.toList()));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.completers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
import org.apache.karaf.shell.api.console.CommandLine;
|
||||
import org.apache.karaf.shell.api.console.Completer;
|
||||
import org.apache.karaf.shell.api.console.Session;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
public class ProjectVersionCompleter implements Completer {
|
||||
|
||||
@Override
|
||||
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
|
||||
EntaxyApplicationProject app = (EntaxyApplicationProject) session.get(ApplicationShell.PROJECT_KEY);
|
||||
if (app == null)
|
||||
return 0;
|
||||
candidates.addAll(app.getVersions().stream().map(v -> v.getVersionNumber()).collect(Collectors.toList()));
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.completers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Reference;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
import org.apache.karaf.shell.api.console.CommandLine;
|
||||
import org.apache.karaf.shell.api.console.Completer;
|
||||
import org.apache.karaf.shell.api.console.Session;
|
||||
|
||||
import ru.entaxy.platform.core.artifact.service.ArtifactService;
|
||||
|
||||
@Service
|
||||
public class RepositoryNameCompleter implements Completer {
|
||||
|
||||
@Reference
|
||||
ArtifactService artifactService;
|
||||
|
||||
@Override
|
||||
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
|
||||
candidates.addAll(
|
||||
artifactService.getRepositories().stream().map(repo -> repo.getName()).collect(Collectors.toList()));
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,55 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.completers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
import org.apache.karaf.shell.api.console.CommandLine;
|
||||
import org.apache.karaf.shell.api.console.Completer;
|
||||
import org.apache.karaf.shell.api.console.Session;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
public class RevisionCompleter implements Completer {
|
||||
|
||||
@Override
|
||||
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
|
||||
EntaxyApplicationVersion version =
|
||||
(EntaxyApplicationVersion) session.get(ApplicationShell.APPLICATION_VERSION_KEY);
|
||||
if (version == null)
|
||||
return 0;
|
||||
|
||||
candidates.addAll(
|
||||
version.getRevisions().stream().map(rev -> rev.getRevisionNumber() + "").collect(Collectors.toList()));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,52 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.completers;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Reference;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
import org.apache.karaf.shell.api.console.CommandLine;
|
||||
import org.apache.karaf.shell.api.console.Completer;
|
||||
import org.apache.karaf.shell.api.console.Session;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.ApplicationManager;
|
||||
|
||||
@Service
|
||||
public class StorageCompleter implements Completer {
|
||||
|
||||
@Reference
|
||||
ApplicationManager applicationManager;
|
||||
|
||||
@Override
|
||||
public int complete(Session session, CommandLine commandLine, List<String> candidates) {
|
||||
candidates.addAll(
|
||||
applicationManager.getAllStorages().stream().map(s -> s.getName()).collect(Collectors.toList()));
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.project;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.ApplicationProjectItem;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProjectVersion;
|
||||
import ru.entaxy.platform.integration.applications.exceptions.ProjectException;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
@Command(name = "project-item-add", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ItemAddCommand extends ItemAwareCommand {
|
||||
|
||||
@Override
|
||||
protected void processItem(EntaxyApplicationProject application, EntaxyApplicationProjectVersion version,
|
||||
ApplicationProjectItem item)
|
||||
throws ProjectException {
|
||||
version.addItem(item);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,67 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.project;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Argument;
|
||||
import org.apache.karaf.shell.api.action.Completion;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.ApplicationProjectItem;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProjectVersion;
|
||||
import ru.entaxy.platform.integration.applications.exceptions.ProjectException;
|
||||
import ru.entaxy.platform.integration.applications.shell.completers.ProjectItemCompleter;
|
||||
|
||||
public abstract class ItemAwareCommand extends ManagedVersionCommand {
|
||||
|
||||
@Argument(index = 0, required = true)
|
||||
@Completion(value = ProjectItemCompleter.class)
|
||||
String itemId;
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplicationProject application, EntaxyApplicationProjectVersion version) {
|
||||
|
||||
Optional<ApplicationProjectItem> optItem =
|
||||
version.getItems().stream().filter(item -> item.getId().equals(itemId)).findFirst();
|
||||
if (!optItem.isPresent()) {
|
||||
// print error
|
||||
System.err.println(String.format("Item [%s] not found in managed version", itemId));
|
||||
return;
|
||||
}
|
||||
try {
|
||||
processItem(application, version, optItem.get());
|
||||
} catch (ProjectException e) {
|
||||
// output exception
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected abstract void processItem(EntaxyApplicationProject application, EntaxyApplicationProjectVersion version,
|
||||
ApplicationProjectItem item) throws ProjectException;
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.project;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.ApplicationProjectItem;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProjectVersion;
|
||||
import ru.entaxy.platform.integration.applications.exceptions.ProjectException;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
@Command(name = "project-item-ignore", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ItemIgnoreCommand extends ItemAwareCommand {
|
||||
|
||||
@Override
|
||||
protected void processItem(EntaxyApplicationProject application, EntaxyApplicationProjectVersion version,
|
||||
ApplicationProjectItem item)
|
||||
throws ProjectException {
|
||||
version.ignoreItem(item);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.project;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.ApplicationProjectItem;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProjectVersion;
|
||||
import ru.entaxy.platform.integration.applications.exceptions.ProjectException;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
@Command(name = "project-item-remove", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ItemRemoveCommand extends ItemAwareCommand {
|
||||
|
||||
@Override
|
||||
protected void processItem(EntaxyApplicationProject application, EntaxyApplicationProjectVersion version,
|
||||
ApplicationProjectItem item)
|
||||
throws ProjectException {
|
||||
version.removeItem(item);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.project;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationManagerCommandSupport;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
public abstract class ManagedProjectCommand extends ApplicationManagerCommandSupport {
|
||||
|
||||
@Override
|
||||
public Object execute() throws Exception {
|
||||
if (session.get(ApplicationShell.PROJECT_KEY) == null) {
|
||||
// print error
|
||||
System.err.println("No application is being managed");
|
||||
return null;
|
||||
}
|
||||
EntaxyApplicationProject app = (EntaxyApplicationProject) session.get(ApplicationShell.PROJECT_KEY);
|
||||
doExecute(app);
|
||||
return null;
|
||||
}
|
||||
|
||||
protected abstract void doExecute(EntaxyApplicationProject application);
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.project;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProjectVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
public abstract class ManagedVersionCommand extends ManagedProjectCommand {
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplicationProject application) {
|
||||
EntaxyApplicationProjectVersion version = (EntaxyApplicationProjectVersion) session.get(ApplicationShell.PROJECT_VERSION_KEY);
|
||||
if (version == null) {
|
||||
// print error
|
||||
System.err.println("No version is being managed");
|
||||
return;
|
||||
}
|
||||
doExecute(application, version);
|
||||
}
|
||||
|
||||
protected abstract void doExecute(EntaxyApplicationProject application, EntaxyApplicationProjectVersion version);
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.project;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.Option;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
@Command(name = "project-cancel", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ProjectCancelCommand extends ManagedProjectCommand {
|
||||
|
||||
@Option(name = "-f", aliases = {"--force-version-cancel"})
|
||||
boolean forceVersionCancel = true;
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplicationProject application) {
|
||||
session.put(ApplicationShell.PROJECT_KEY, null);
|
||||
session.put(ApplicationShell.PROJECT_VERSION_KEY, null);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.project;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.Option;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProjectVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
@Command(name = "project-commit", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ProjectCommitCommand extends ManagedProjectCommand {
|
||||
|
||||
@Option(name = "-f", aliases = {"--force-version-commit"})
|
||||
boolean forceVersionCommit = true;
|
||||
|
||||
@Option(name = "-s", aliases = {"--stop-managing"})
|
||||
boolean stopManaging = true;
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplicationProject application) {
|
||||
application.save();
|
||||
EntaxyApplicationProjectVersion version =
|
||||
(EntaxyApplicationProjectVersion) session.get(ApplicationShell.PROJECT_VERSION_KEY);
|
||||
if (version != null) {
|
||||
if (forceVersionCommit)
|
||||
version.save();
|
||||
else
|
||||
version.disgard();
|
||||
}
|
||||
if (stopManaging) {
|
||||
session.put(ApplicationShell.PROJECT_KEY, null);
|
||||
session.put(ApplicationShell.PROJECT_VERSION_KEY, null);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.project;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Argument;
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.Option;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
import ru.entaxy.platform.integration.applications.shell.StorageAwareCommand;
|
||||
|
||||
@Service
|
||||
@Command(name = "project-create", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ProjectCreateCommand extends StorageAwareCommand {
|
||||
|
||||
@Option(name = "-v", aliases = {"--version"}, description = "Initial version for new application")
|
||||
String initialVersion = "1.0.0";
|
||||
|
||||
@Argument(name = "applicationName", required = true, index = 1)
|
||||
String applicationName;
|
||||
|
||||
@Override
|
||||
protected void doExecute() {
|
||||
try {
|
||||
EntaxyApplicationProject app = applicationManager.createProject(storage, applicationName, initialVersion);
|
||||
if (app != null) {
|
||||
// output
|
||||
System.out.println("Created successfully");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// output to console
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,73 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.project;
|
||||
|
||||
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 org.apache.karaf.shell.api.console.Session;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProjectVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
@Command(name = "project-current", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ProjectCurrentCommand implements Action {
|
||||
|
||||
@Reference
|
||||
Session session;
|
||||
|
||||
@Override
|
||||
public Object execute() throws Exception {
|
||||
if (session.get(ApplicationShell.PROJECT_KEY) == null) {
|
||||
// output
|
||||
System.out.println("No application is being managed");
|
||||
return null;
|
||||
}
|
||||
|
||||
String application = "";
|
||||
String storage = "unknown";
|
||||
String version = "none";
|
||||
|
||||
EntaxyApplicationProject app = (EntaxyApplicationProject) session.get(ApplicationShell.PROJECT_KEY);
|
||||
application = app.getName();
|
||||
storage = app.getStorage().getName();
|
||||
|
||||
EntaxyApplicationProjectVersion vers = (EntaxyApplicationProjectVersion) session.get(ApplicationShell.PROJECT_VERSION_KEY);
|
||||
if (vers != null)
|
||||
version = vers.getVersionNumber();
|
||||
|
||||
// output
|
||||
|
||||
System.out.println(
|
||||
String.format("Application: [%s]\nStorage: [%s]\nVersion: [%s]", application, storage, version));
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,90 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.project;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.base.support.karaf.shell.ShellTableFixed;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProjectVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationManagerCommandSupport;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
@Command(name = "project-list", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ProjectListCommand extends ApplicationManagerCommandSupport {
|
||||
|
||||
@Override
|
||||
public Object execute() throws Exception {
|
||||
ShellTableFixed table = new ShellTableFixed();
|
||||
table.column("Name");
|
||||
table.column("Storage");
|
||||
table.column("Versions");
|
||||
|
||||
List<EntaxyApplicationProject> apps = applicationManager.getProjects();
|
||||
Collections.sort(apps, new Comparator<EntaxyApplicationProject>() {
|
||||
|
||||
@Override
|
||||
public int compare(EntaxyApplicationProject o1, EntaxyApplicationProject o2) {
|
||||
String storage1 = o1.getStorage().getName();
|
||||
String storage2 = o2.getStorage().getName();
|
||||
if (!storage1.equals(storage2))
|
||||
return storage1.compareTo(storage2);
|
||||
|
||||
return o1.getName().compareTo(o2.getName());
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
for (EntaxyApplicationProject app : apps) {
|
||||
List<EntaxyApplicationProjectVersion> versions = app.getVersions();
|
||||
Collections.sort(versions, new Comparator<EntaxyApplicationProjectVersion>() {
|
||||
|
||||
@Override
|
||||
public int compare(EntaxyApplicationProjectVersion o1, EntaxyApplicationProjectVersion o2) {
|
||||
return o1.compareTo(o2);
|
||||
}
|
||||
|
||||
});
|
||||
String versionsValue = versions.stream().map(v -> v.getVersionNumber()).collect(Collectors.joining("\n"));
|
||||
|
||||
table.addRow().addContent(app.getName(), app.getStorage() == null ? "" : app.getStorage().getName(),
|
||||
versionsValue);
|
||||
}
|
||||
|
||||
// print output
|
||||
table.print(System.out);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.project;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Argument;
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.Completion;
|
||||
import org.apache.karaf.shell.api.action.Option;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.ApplicationStorage;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProjectVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationManagerCommandSupport;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
import ru.entaxy.platform.integration.applications.shell.completers.ProjectCompleter;
|
||||
|
||||
@Service
|
||||
@Command(name = "project-manage", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ProjectManageCommand extends ApplicationManagerCommandSupport {
|
||||
|
||||
@Argument
|
||||
@Completion(value = ProjectCompleter.class)
|
||||
String application;
|
||||
|
||||
@Option(name = "-f", aliases = {"--force-cancel"})
|
||||
boolean forceCancel = false;
|
||||
|
||||
@Override
|
||||
public Object execute() throws Exception {
|
||||
if (session.get(ApplicationShell.PROJECT_KEY) != null) {
|
||||
if (forceCancel) {
|
||||
try {
|
||||
EntaxyApplicationProjectVersion version =
|
||||
(EntaxyApplicationProjectVersion) session.get(ApplicationShell.PROJECT_VERSION_KEY);
|
||||
if (version != null)
|
||||
version.disgard();
|
||||
} catch (Exception ignore) {
|
||||
|
||||
}
|
||||
try {
|
||||
EntaxyApplicationProject application =
|
||||
(EntaxyApplicationProject) session.get(ApplicationShell.PROJECT_KEY);
|
||||
if (application != null)
|
||||
application.disgard();
|
||||
} catch (Exception ignore) {
|
||||
|
||||
}
|
||||
session.put(ApplicationShell.PROJECT_KEY, null);
|
||||
session.put(ApplicationShell.PROJECT_VERSION_KEY, null);
|
||||
} else {
|
||||
// print error
|
||||
System.err.println("Other application is being managed, please commit or cancel");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
String[] data = application.split("@");
|
||||
|
||||
if (data.length < 2) {
|
||||
// print error
|
||||
System.err.println("Incorrect application specified");
|
||||
return null;
|
||||
}
|
||||
|
||||
String storageName = data[1];
|
||||
ApplicationStorage storage = applicationManager.getStorage(storageName);
|
||||
if (storage == null) {
|
||||
// print error
|
||||
System.err.println("Incorrect storage specified: [" + storageName + "]");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!storage.isEnabled()) {
|
||||
// print error
|
||||
System.err.println("Storage is disabled: [" + storageName + "]");
|
||||
return null;
|
||||
}
|
||||
|
||||
String appName = data[0];
|
||||
EntaxyApplicationProject app = storage.getProject(appName);
|
||||
if (app == null) {
|
||||
// print error
|
||||
System.err.println(String.format("Application [%s] not found in storage [%s]", appName, storageName));
|
||||
return null;
|
||||
}
|
||||
|
||||
session.put(ApplicationShell.PROJECT_KEY, app);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.project;
|
||||
|
||||
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 ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.exceptions.ProjectNotFoundException;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
import ru.entaxy.platform.integration.applications.shell.StorageAwareCommand;
|
||||
|
||||
@Service
|
||||
@Command(name = "project-remove", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class ProjectRemoveCommand extends StorageAwareCommand {
|
||||
|
||||
@Argument(name = "projectName", required = true, index = 1)
|
||||
String projectName;
|
||||
|
||||
@Override
|
||||
protected void doExecute() {
|
||||
try {
|
||||
EntaxyApplicationProject project = applicationStorage.getProject(projectName);
|
||||
if (project != null) {
|
||||
applicationStorage.removeProject(project);
|
||||
System.out.println("Removed successfully");
|
||||
} else {
|
||||
throw new ProjectNotFoundException(projectName);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// output error
|
||||
System.err.println("ERROR: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.project;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Argument;
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.Completion;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Reference;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.ApplicationProjectItem;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProjectVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
import ru.entaxy.platform.integration.applications.shell.completers.EntaxyRuntimeObjectCompleter;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectService;
|
||||
|
||||
@Service
|
||||
@Command(name = "project-version-add-object", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class VersionAddObject extends ManagedVersionCommand {
|
||||
|
||||
@Argument(required = true)
|
||||
@Completion(value = EntaxyRuntimeObjectCompleter.class)
|
||||
String objectId;
|
||||
|
||||
@Reference
|
||||
EntaxyRuntimeObjectService entaxyRuntimeObjectService;
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplicationProject application, EntaxyApplicationProjectVersion version) {
|
||||
|
||||
ApplicationProjectItem item = version.addObject(entaxyRuntimeObjectService.getRuntimeObject(objectId));
|
||||
if (item != null)
|
||||
// print output
|
||||
System.out.println("Item is added");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.project;
|
||||
|
||||
import java.net.URL;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProjectVersion;
|
||||
import ru.entaxy.platform.integration.applications.exceptions.ProjectVersionException;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
@Command(name = "project-version-build", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class VersionBuildCommand extends ManagedVersionCommand {
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplicationProject application, EntaxyApplicationProjectVersion version) {
|
||||
try {
|
||||
URL result = version.build();
|
||||
// print output
|
||||
System.out.println("Result URL: ".concat(result == null ? "" : result.toString()));
|
||||
} catch (ProjectVersionException e) {
|
||||
// print error
|
||||
System.err.println("ERROR: " + e.getMessage());
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,171 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.project;
|
||||
|
||||
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 org.apache.karaf.shell.support.ansi.SimpleAnsi;
|
||||
|
||||
import ru.entaxy.esb.resources.EntaxyResource;
|
||||
import ru.entaxy.esb.resources.EntaxyResourceService;
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
import ru.entaxy.platform.base.support.karaf.shell.ShellTableFixed;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProjectVersion;
|
||||
import ru.entaxy.platform.integration.applications.descriptor.ApplicationComponent;
|
||||
import ru.entaxy.platform.integration.applications.descriptor.ApplicationContentItem;
|
||||
import ru.entaxy.platform.integration.applications.descriptor.ApplicationDescriptor;
|
||||
import ru.entaxy.platform.integration.applications.descriptor.ApplicationRequirement;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectService;
|
||||
|
||||
@Service
|
||||
@Command(name = "project-version-build-info", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class VersionBuildInfoCommand extends ManagedVersionCommand {
|
||||
|
||||
@Reference
|
||||
EntaxyRuntimeObjectService entaxyRuntimeObjectService;
|
||||
|
||||
@Reference
|
||||
EntaxyResourceService entaxyResourceService;
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplicationProject application, EntaxyApplicationProjectVersion version) {
|
||||
|
||||
if (!version.isBuildAvailable()) {
|
||||
// print output
|
||||
System.out.println("Build is not available");
|
||||
return;
|
||||
}
|
||||
|
||||
ApplicationDescriptor applicationDescriptor = version.getBuildInfo();
|
||||
|
||||
// output main data
|
||||
String mainData = "\n"
|
||||
.concat("Application : ").concat(applicationDescriptor.name).concat("\n")
|
||||
.concat("Group : ").concat(applicationDescriptor.group).concat("\n")
|
||||
.concat("Version : ").concat(applicationDescriptor.version).concat("\n")
|
||||
.concat("Build by : ").concat(CommonUtils.getValid(applicationDescriptor.buildBy, "")).concat("\n")
|
||||
.concat("Built on : ").concat(applicationDescriptor.buildOn).concat("\n")
|
||||
.concat("Maven : ").concat(applicationDescriptor.mavenUrl).concat("\n")
|
||||
.concat("Asset : ").concat(applicationDescriptor.mavenAsset).concat("\n");
|
||||
System.out.println(mainData);
|
||||
|
||||
// output features location info
|
||||
System.out.println(SimpleAnsi.RESET + SimpleAnsi.INTENSITY_NORMAL + "\n\t--- FEATURE REPO:");
|
||||
if (applicationDescriptor.features == null) {
|
||||
System.out.println(":: NOT FOUND");
|
||||
} else {
|
||||
String featuresData =
|
||||
(" INTERNAL : ").concat(applicationDescriptor.features.internalLocation).concat("\n")
|
||||
.concat(" ").concat("MAVEN : ").concat(applicationDescriptor.features.mavenLocation)
|
||||
.concat("\n")
|
||||
.concat(" ").concat("TARGET : ")
|
||||
.concat(applicationDescriptor.features.getFullTargetLocation());
|
||||
System.out.println(featuresData);
|
||||
|
||||
}
|
||||
|
||||
// output items
|
||||
System.out.println("\n\t--- ITEMS:");
|
||||
ShellTableFixed itemsTable = new ShellTableFixed();
|
||||
itemsTable.column("Id");
|
||||
itemsTable.column("Type");
|
||||
itemsTable.column("Component");
|
||||
|
||||
for (ApplicationContentItem item : applicationDescriptor.items) {
|
||||
itemsTable.addRow().addContent(item.id, item.type.name(), item.componentId);
|
||||
}
|
||||
|
||||
itemsTable.print(System.out);
|
||||
|
||||
// output requirements
|
||||
System.out.println("\n\t--- REQUIREMENTS:");
|
||||
ShellTableFixed requirementsTable = new ShellTableFixed();
|
||||
requirementsTable.column("Id").colorProvider(ApplicationShell.normalColorProvider);
|
||||
requirementsTable.column("Type").colorProvider(ApplicationShell.normalColorProvider);
|
||||
requirementsTable.column("Scope").colorProvider(ApplicationShell.normalColorProvider);
|
||||
requirementsTable.column("Status").colorProvider(ApplicationShell.requirementStatusColorProvider).alignCenter();
|
||||
|
||||
for (ApplicationRequirement req : applicationDescriptor.requirements) {
|
||||
requirementsTable.addRow().addContent(
|
||||
req.id,
|
||||
req.type.name(),
|
||||
req.scope.name(),
|
||||
checkRequirement(req) ? "V" : "X");
|
||||
}
|
||||
|
||||
requirementsTable.print(System.out);
|
||||
|
||||
// output components
|
||||
System.out.println(SimpleAnsi.RESET + SimpleAnsi.INTENSITY_NORMAL + "\n\t--- COMPONENTS:");
|
||||
/* ShellTableFixed componentsTable = new ShellTableFixed();
|
||||
componentsTable.column("Id");
|
||||
componentsTable.column("Type");
|
||||
componentsTable.column("Priority");
|
||||
componentsTable.column("Internal location");
|
||||
componentsTable.column("Maven location");
|
||||
*/
|
||||
for (ApplicationComponent component : applicationDescriptor.components) {
|
||||
/* componentsTable.addRow().addContent(
|
||||
component.id,
|
||||
component.type.name(),
|
||||
component.priority,
|
||||
component.internalLocation,
|
||||
component.mavenLocation);
|
||||
*/
|
||||
String componentData = component.id.concat("\n")
|
||||
.concat("\t").concat("TYPE : ").concat(component.type.name()).concat("\n")
|
||||
.concat("\t").concat("PRIORITY : ").concat(component.priority + "").concat("\n")
|
||||
.concat("\t").concat("INTERNAL : ").concat(component.internalLocation).concat("\n")
|
||||
.concat("\t").concat("MAVEN : ").concat(component.mavenLocation).concat("\n")
|
||||
.concat("\t").concat("TARGET : ").concat(component.getFullTargetLocation());
|
||||
System.out.println(componentData);
|
||||
}
|
||||
// componentsTable.print(System.out);
|
||||
|
||||
}
|
||||
|
||||
protected boolean checkRequirement(ApplicationRequirement requirement) {
|
||||
switch (requirement.type) {
|
||||
case OBJECT:
|
||||
EntaxyRuntimeObject runtimeObject = entaxyRuntimeObjectService.getRuntimeObject(requirement.id);
|
||||
return runtimeObject != null && !runtimeObject.isGhost();
|
||||
case RESOURCE:
|
||||
EntaxyResource entaxyResource = entaxyResourceService.getResource(requirement.id);
|
||||
return entaxyResource.exists();
|
||||
case BUNDLE:
|
||||
case CONFIG:
|
||||
// TODO implement
|
||||
return true;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.project;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProjectVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
@Command(name = "project-version-cancel", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class VersionCancelCommand extends ManagedVersionCommand {
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplicationProject application, EntaxyApplicationProjectVersion version) {
|
||||
session.put(ApplicationShell.PROJECT_VERSION_KEY, null);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.project;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProjectVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
@Command(name = "project-version-commit", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class VersionCommitCommand extends ManagedVersionCommand {
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplicationProject application, EntaxyApplicationProjectVersion version) {
|
||||
version.save();
|
||||
session.put(ApplicationShell.PROJECT_VERSION_KEY, null);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.project;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Argument;
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.Completion;
|
||||
import org.apache.karaf.shell.api.action.Option;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.exceptions.ProjectVersionException;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
import ru.entaxy.platform.integration.applications.shell.completers.ProjectVersionCompleter;
|
||||
|
||||
@Service
|
||||
@Command(name = "project-version-create", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class VersionCreateCommand extends ManagedProjectCommand {
|
||||
|
||||
@Option(name = "-f", aliases = {"--from-version"})
|
||||
@Completion(value = ProjectVersionCompleter.class)
|
||||
String fromVersion;
|
||||
|
||||
@Argument(required = true)
|
||||
String versionNumber;
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplicationProject application) {
|
||||
try {
|
||||
if (CommonUtils.isValid(fromVersion))
|
||||
application.createVersion(versionNumber, fromVersion);
|
||||
else
|
||||
application.createVersion(versionNumber);
|
||||
} catch (ProjectVersionException e) {
|
||||
// print error
|
||||
System.err.println("ERROR: " + e.getMessage());
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,58 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.project;
|
||||
|
||||
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 ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProjectVersion;
|
||||
import ru.entaxy.platform.integration.applications.exceptions.ProjectVersionException;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
@Command(name = "project-version-export-file", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class VersionExportToFileCommand extends ManagedVersionCommand {
|
||||
|
||||
@Argument(required = true)
|
||||
String filePath;
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplicationProject application, EntaxyApplicationProjectVersion version) {
|
||||
try {
|
||||
applicationManager.exportToFile(version, filePath);
|
||||
// print output
|
||||
System.out.println("Successfully exported");
|
||||
} catch (ProjectVersionException e) {
|
||||
// print error
|
||||
System.err.println("Error: " + e.getMessage());
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.project;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Argument;
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.Completion;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProjectVersion;
|
||||
import ru.entaxy.platform.integration.applications.exceptions.ProjectVersionException;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
import ru.entaxy.platform.integration.applications.shell.completers.RepositoryNameCompleter;
|
||||
|
||||
@Service
|
||||
@Command(name = "project-version-export-repository", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class VersionExportToRepositoryCommand extends ManagedVersionCommand {
|
||||
|
||||
@Argument(required = true)
|
||||
@Completion(value = RepositoryNameCompleter.class)
|
||||
String repositoryName;
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplicationProject application, EntaxyApplicationProjectVersion version) {
|
||||
try {
|
||||
applicationManager.exportToRepository(version, repositoryName);
|
||||
// print output
|
||||
System.out.println("Successfully exported");
|
||||
} catch (ProjectVersionException e) {
|
||||
// print error
|
||||
System.err.println("Error: " + e.getMessage());
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,86 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.project;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.base.support.karaf.shell.ShellTableFixed;
|
||||
import ru.entaxy.platform.integration.applications.ApplicationProjectItem;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProjectVersion;
|
||||
import ru.entaxy.platform.integration.applications.item.project.EntaxyBundleItem;
|
||||
import ru.entaxy.platform.integration.applications.item.project.EntaxyConfigItem;
|
||||
import ru.entaxy.platform.integration.applications.item.project.EntaxyObjectItem;
|
||||
import ru.entaxy.platform.integration.applications.item.project.EntaxyResourceItem;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
|
||||
@Service
|
||||
@Command(name = "project-version-items", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class VersionItemListCommand extends ManagedVersionCommand {
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplicationProject application, EntaxyApplicationProjectVersion version) {
|
||||
List<ApplicationProjectItem> items = version.getItems();
|
||||
|
||||
ShellTableFixed table = new ShellTableFixed();
|
||||
table.column("Status").colorProvider(ApplicationShell.itemStatusColorProvider).alignCenter();
|
||||
table.column("Id").colorProvider(ApplicationShell.normalColorProvider);
|
||||
table.column("Type").colorProvider(ApplicationShell.normalColorProvider);
|
||||
table.column("Scope").colorProvider(ApplicationShell.normalColorProvider);
|
||||
table.column("Required").colorProvider(ApplicationShell.normalColorProvider);
|
||||
table.column("Ignored").colorProvider(ApplicationShell.normalColorProvider);
|
||||
|
||||
for (ApplicationProjectItem item : items) {
|
||||
String status = "+";
|
||||
if (item.isGhost())
|
||||
status = "?";
|
||||
if (item.isRequired())
|
||||
if (item.isIgnored())
|
||||
status = "-";
|
||||
else
|
||||
status = "!";
|
||||
|
||||
String type = EntaxyConfigItem.class.isInstance(item) ? "config"
|
||||
: EntaxyObjectItem.class.isInstance(item) ? "object"
|
||||
: EntaxyBundleItem.class.isInstance(item) ? "bundle"
|
||||
: EntaxyResourceItem.class.isInstance(item) ? "resource" : "unknown";
|
||||
|
||||
table.addRow().addContent(status, item.getId(), type,
|
||||
item.getScope().name(),
|
||||
item.isRequired() ? "*" : "",
|
||||
item.isIgnored() ? "*" : "");
|
||||
|
||||
|
||||
}
|
||||
|
||||
table.print(System.out);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* application-shell
|
||||
* ==========
|
||||
* 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
|
||||
* 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.integration.applications.shell.project;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Argument;
|
||||
import org.apache.karaf.shell.api.action.Command;
|
||||
import org.apache.karaf.shell.api.action.Completion;
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Service;
|
||||
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProject;
|
||||
import ru.entaxy.platform.integration.applications.EntaxyApplicationProjectVersion;
|
||||
import ru.entaxy.platform.integration.applications.shell.ApplicationShell;
|
||||
import ru.entaxy.platform.integration.applications.shell.completers.ProjectVersionCompleter;
|
||||
|
||||
@Service
|
||||
@Command(name = "project-version-manage", scope = ApplicationShell.COMMAND_SCOPE)
|
||||
public class VersionManageCommand extends ManagedProjectCommand {
|
||||
|
||||
@Argument(required = true)
|
||||
@Completion(value = ProjectVersionCompleter.class)
|
||||
String versionNumber;
|
||||
|
||||
@Override
|
||||
protected void doExecute(EntaxyApplicationProject application) {
|
||||
if (session.get(ApplicationShell.PROJECT_VERSION_KEY) != null) {
|
||||
// print error
|
||||
System.err.println("Another version is being managed, please cancel or commit");
|
||||
return;
|
||||
}
|
||||
|
||||
EntaxyApplicationProjectVersion version = application.getVersion(versionNumber);
|
||||
if (version == null) {
|
||||
System.err.println("Version not found");
|
||||
return;
|
||||
}
|
||||
|
||||
session.put(ApplicationShell.PROJECT_VERSION_KEY, version);
|
||||
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user