release version 1.10.0
This commit is contained in:
175
platform/runtime/core/management/config-management/LICENSE.txt
Normal file
175
platform/runtime/core/management/config-management/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. Если какое-либо положение настоящей Лицензии будет признано судом недействительным,
|
||||
остальные положения будут продолжать своё действие, а Пользователь будет обязан продолжать
|
||||
исполнять свои обязанности в соответствии с этими положениями.
|
38
platform/runtime/core/management/config-management/pom.xml
Normal file
38
platform/runtime/core/management/config-management/pom.xml
Normal file
@ -0,0 +1,38 @@
|
||||
<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.esb.platform.runtime.core</groupId>
|
||||
<artifactId>management</artifactId>
|
||||
<version>1.10.0</version>
|
||||
</parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.core.management</groupId>
|
||||
<artifactId>config-management</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
|
||||
<name>ENTAXY :: PLATFORM :: RUNTIME :: CORE :: MANAGEMENT :: CONFIG MANAGEMENT</name>
|
||||
<description>ENTAXY :: PLATFORM :: RUNTIME :: CORE :: MANAGEMENT :: CONFIG MANAGEMENT</description>
|
||||
|
||||
<properties>
|
||||
<bundle.osgi.export.pkg>ru.entaxy.platform.config.management</bundle.osgi.export.pkg>
|
||||
<bundle.osgi.private.pkg>ru.entaxy.platform.config.management.impl</bundle.osgi.private.pkg>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.base</groupId>
|
||||
<artifactId>management-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.core.management</groupId>
|
||||
<artifactId>object-management</artifactId>
|
||||
<version>${project.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>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,43 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* config-management
|
||||
* ==========
|
||||
* 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.config.management;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Attribute;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBean;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
|
||||
public interface ConfigMBean extends EntaxyRuntimeObjectMBean {
|
||||
|
||||
String SUBQUALIFIER_KEY = "config";
|
||||
|
||||
@Attribute(desc = "Configuration PID")
|
||||
default String getPid() {
|
||||
return getObjectId();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* config-management
|
||||
* ==========
|
||||
* 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.config.management;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.ManagementCore;
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
import ru.entaxy.platform.config.runtime.ObjectConfig;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectContainerMBean;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
|
||||
public interface ConfigsMBean extends EntaxyRuntimeObjectContainerMBean {
|
||||
|
||||
String CONFIG_RUNTIME_TYPE = ObjectConfig.CONFIG_OBJECT_TYPE;
|
||||
|
||||
Qualifier QUALIFIER = ManagementCore.Q_RUNTIME.qualifier("category", "configs");
|
||||
|
||||
String SUBQUALIFIER = QUALIFIER.getValue().substring(ManagementCore.Q_RUNTIME.getValue().length() + 1);
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* config-management
|
||||
* ==========
|
||||
* 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.config.management;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Attribute;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
|
||||
public interface ObjectConfigMBean extends ConfigMBean {
|
||||
|
||||
@Attribute(desc = "Target object being configured by this config")
|
||||
default String getTarget() {
|
||||
return getRuntimeObject().getAttributeOrDefault("target", "").toString();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* config-management
|
||||
* ==========
|
||||
* 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.config.management.impl;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.platform.config.management.ConfigsMBean;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeItemMBean;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBean;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBeanFactory;
|
||||
import ru.entaxy.platform.core.management.object.MBeanFactory;
|
||||
import ru.entaxy.platform.core.management.object.factory.AbstractMBeanFactory;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
|
||||
@MBeanFactory(id = "vaults-factory", supportedTypes = {ConfigsMBean.CONFIG_RUNTIME_TYPE})
|
||||
@Component(service = EntaxyRuntimeObjectMBeanFactory.class, immediate = true)
|
||||
public class ConfigMBeanFactory extends AbstractMBeanFactory {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ConfigMBeanFactory.class);
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY)
|
||||
ConfigsMBeanImpl configsMBean;
|
||||
|
||||
@Override
|
||||
public <T extends EntaxyRuntimeObjectMBean> T createMBean(EntaxyRuntimeObject entaxyRuntimeObject) {
|
||||
try {
|
||||
if (entaxyRuntimeObject.getIncomiingSubordRelations().isEmpty())
|
||||
return (T) new ConfigMBeanImpl(entaxyRuntimeObject);
|
||||
else
|
||||
return (T) new ObjectConfigMBeanImpl(entaxyRuntimeObject);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Error creating MBean for [" + entaxyRuntimeObject.getObjectFullId() + "]", e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends EntaxyRuntimeItemMBean> createMBeans() {
|
||||
return Collections.singletonList(configsMBean);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* config-management
|
||||
* ==========
|
||||
* 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.config.management.impl;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.EntaxyRuntimeTyped;
|
||||
import ru.entaxy.platform.config.management.ConfigMBean;
|
||||
import ru.entaxy.platform.config.management.ConfigsMBean;
|
||||
import ru.entaxy.platform.core.management.object.ObjectMBean;
|
||||
import ru.entaxy.platform.core.management.object.factory.AbstractObjectMBean;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
|
||||
@EntaxyRuntimeTyped(name = ConfigsMBean.CONFIG_RUNTIME_TYPE)
|
||||
@ObjectMBean(subQualifierName = ConfigMBean.SUBQUALIFIER_KEY)
|
||||
public class ConfigMBeanImpl<T extends ConfigMBean> extends AbstractObjectMBean<T>
|
||||
implements ConfigMBean {
|
||||
|
||||
public ConfigMBeanImpl(EntaxyRuntimeObject entaxyRuntimeObject)
|
||||
throws NotCompliantMBeanException {
|
||||
super((Class<T>) ConfigMBean.class, entaxyRuntimeObject);
|
||||
}
|
||||
|
||||
protected ConfigMBeanImpl(Class<T> mbeanInterface, EntaxyRuntimeObject entaxyRuntimeObject)
|
||||
throws NotCompliantMBeanException {
|
||||
super(mbeanInterface, entaxyRuntimeObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Qualifier getJMXQualifier() {
|
||||
return ConfigsMBean.QUALIFIER.qualifier(ConfigMBean.SUBQUALIFIER_KEY, getObjectId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJMXSubQualifier() {
|
||||
return ConfigMBean.SUBQUALIFIER_KEY.concat("=")
|
||||
.concat(getObjectId());
|
||||
}
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* config-management
|
||||
* ==========
|
||||
* 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.config.management.impl;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
import ru.entaxy.platform.config.management.ConfigsMBean;
|
||||
import ru.entaxy.platform.core.management.object.ContainerMBean;
|
||||
import ru.entaxy.platform.core.management.object.factory.AbstractObjectContainerMBean;
|
||||
|
||||
@Component(service = ConfigsMBeanImpl.class, immediate = true)
|
||||
@ContainerMBean(id = "configs", subQualifierValue = "configs")
|
||||
public class ConfigsMBeanImpl extends AbstractObjectContainerMBean<ConfigsMBean>
|
||||
implements ConfigsMBean {
|
||||
|
||||
public ConfigsMBeanImpl() throws NotCompliantMBeanException {
|
||||
super(ConfigsMBean.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Qualifier getJMXQualifier() {
|
||||
return ConfigsMBean.QUALIFIER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJMXSubQualifier() {
|
||||
return ConfigsMBean.SUBQUALIFIER;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* config-management
|
||||
* ==========
|
||||
* 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.config.management.impl;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import ru.entaxy.platform.config.management.ObjectConfigMBean;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
|
||||
public class ObjectConfigMBeanImpl extends ConfigMBeanImpl<ObjectConfigMBean> implements ObjectConfigMBean {
|
||||
|
||||
public ObjectConfigMBeanImpl(EntaxyRuntimeObject entaxyRuntimeObject) throws NotCompliantMBeanException {
|
||||
super(ObjectConfigMBean.class, entaxyRuntimeObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParentSubPath() {
|
||||
return "";
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* connection-management
|
||||
* ==========
|
||||
* 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.esb.platform.core.management.connection.to_remove;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.RuntimeTypedMBean;
|
||||
|
||||
public interface ConnectionMBean extends RuntimeTypedMBean {
|
||||
|
||||
public static final String CONNECTION_KEY = "connection";
|
||||
|
||||
/*
|
||||
* connection name
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
/*
|
||||
* if connection is platform one or user defined
|
||||
*/
|
||||
public boolean isPlatform();
|
||||
|
||||
/*
|
||||
* status of the bundle if connection is deplyed
|
||||
*/
|
||||
public String getStatus();
|
||||
|
||||
/*
|
||||
* if the connection local or shared (cluster)
|
||||
*/
|
||||
public boolean isLocal();
|
||||
|
||||
/*
|
||||
* if the connection is shared (single malt)
|
||||
* or prototype-like (blended)
|
||||
*/
|
||||
public boolean isShared();
|
||||
|
||||
/*
|
||||
* if the connection is deployed or only defined
|
||||
*/
|
||||
public boolean isDeployed();
|
||||
|
||||
/*
|
||||
* bundle id for single malt connection
|
||||
* null for blended
|
||||
*/
|
||||
public String getBundleId();
|
||||
|
||||
/*
|
||||
* connection label
|
||||
*/
|
||||
public String getLabel();
|
||||
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* connection-management
|
||||
* ==========
|
||||
* 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.esb.platform.core.management.connection.to_remove;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Operation;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Parameter;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATION_ENRICH)
|
||||
public interface ConnectionsMBean {
|
||||
|
||||
public static final String CAPABILITY_NAMESPACE = "entaxy.runtime.connection";
|
||||
|
||||
public static final String CONNECTIONS_KEY = "category";
|
||||
|
||||
public static final String CONNECTIONS_KEY_VALUE = "connections";
|
||||
|
||||
@Operation(desc = "Gets connection's configuration")
|
||||
public String getConnectionConfig(
|
||||
@Parameter(name = "connectionName", desc = "Connection name") String connectionName) throws Exception;
|
||||
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* connection-management
|
||||
* ==========
|
||||
* 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.esb.platform.core.management.connection.to_remove.impl;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
import javax.management.StandardMBean;
|
||||
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.EntaxyRuntimeTyped;
|
||||
import ru.entaxy.esb.platform.core.management.connection.to_remove.ConnectionMBean;
|
||||
|
||||
//@TODO move string to constant
|
||||
@EntaxyRuntimeTyped(name = "entaxy.runtime.connection")
|
||||
public class ConnectionMBeanImpl extends StandardMBean implements ConnectionMBean {
|
||||
|
||||
protected ManagedConnection connection;
|
||||
|
||||
protected BundleContext bundleContext;
|
||||
|
||||
public ConnectionMBeanImpl(BundleContext bundleContext, ManagedConnection connection) throws NotCompliantMBeanException {
|
||||
super(ConnectionMBean.class);
|
||||
this.bundleContext = bundleContext;
|
||||
this.connection = connection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return connection.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlatform() {
|
||||
return connection.isPlatform();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatus() {
|
||||
int state = this.bundleContext.getBundle(connection.getBundleId()).getState();
|
||||
switch (state) {
|
||||
case Bundle.ACTIVE:
|
||||
return "Active";
|
||||
case Bundle.INSTALLED:
|
||||
return "Installed";
|
||||
case Bundle.RESOLVED:
|
||||
return "Resolved";
|
||||
case Bundle.STARTING:
|
||||
return "Starting";
|
||||
case Bundle.STOPPING:
|
||||
return "Stopping";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLocal() {
|
||||
return connection.isLocal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShared() {
|
||||
return connection.isShared();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDeployed() {
|
||||
return connection.isDeployed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBundleId() {
|
||||
return connection.getBundleId() + "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
return connection.getLabel();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,145 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* connection-management
|
||||
* ==========
|
||||
* 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.esb.platform.core.management.connection.to_remove.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.ServiceRegistration;
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.Deactivate;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.ManagementCore;
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.AnnotatedMBean;
|
||||
import ru.entaxy.esb.platform.core.management.connection.to_remove.ConnectionMBean;
|
||||
import ru.entaxy.esb.platform.core.management.connection.to_remove.ConnectionsMBean;
|
||||
import ru.entaxy.esb.platform.core.management.connection.to_remove.tracker.DeployedConnectionTracker;
|
||||
import ru.entaxy.platform.base.objects.EntaxyObjectService;
|
||||
|
||||
/*
|
||||
|
||||
@Component(
|
||||
service = {ConnectionsMBean.class, DynamicMBean.class, MBeanRegistration.class},
|
||||
property = {ManagementCore.JMX_OBJECTNAME
|
||||
+ "=" + ManagementCore.Q_RUNTIME_S
|
||||
+ "," + ConnectionsMBean.CONNECTIONS_KEY
|
||||
+ "=" + ConnectionsMBean.CONNECTIONS_KEY_VALUE},
|
||||
scope = ServiceScope.SINGLETON,
|
||||
immediate = true
|
||||
)
|
||||
*/
|
||||
|
||||
|
||||
public class ConnectionsMBeanImpl extends AnnotatedMBean<ConnectionsMBean>
|
||||
implements ConnectionsMBean, ManagedConnectionsListener {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ConnectionsMBeanImpl.class);
|
||||
|
||||
public static final Qualifier Q_CONNECTIONS = ManagementCore.Q_RUNTIME
|
||||
.qualifier(ConnectionsMBean.CONNECTIONS_KEY, ConnectionsMBean.CONNECTIONS_KEY_VALUE);
|
||||
|
||||
protected BundleContext bundleContext;
|
||||
|
||||
protected DeployedConnectionTracker tracker;
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY)
|
||||
EntaxyObjectService entaxyObjectService;
|
||||
|
||||
protected static class ManagedConnectionDescriptor {
|
||||
|
||||
ManagedConnection connection;
|
||||
ServiceRegistration<ConnectionMBean> registration;
|
||||
|
||||
}
|
||||
|
||||
protected Map<String, ManagedConnectionDescriptor> managed = new HashMap<>();
|
||||
|
||||
public ConnectionsMBeanImpl() throws NotCompliantMBeanException {
|
||||
super(ConnectionsMBean.class);
|
||||
}
|
||||
|
||||
@Activate
|
||||
public void activate(ComponentContext componentContext) {
|
||||
this.bundleContext = componentContext.getBundleContext();
|
||||
tracker = new DeployedConnectionTracker(bundleContext, this);
|
||||
tracker.open();
|
||||
}
|
||||
|
||||
@Deactivate
|
||||
public void deactivate() {
|
||||
tracker.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void added(ManagedConnections connections) {
|
||||
Hashtable props = new Hashtable<>();
|
||||
// String jmxObjectName = "jmx.objectname";
|
||||
// String objectName = "ru.entaxy.esb:group=platform,category=connections,connection=";
|
||||
for (ManagedConnection connection: connections.managedConnections) {
|
||||
if (managed.containsKey(connection.getName()))
|
||||
this.managed.get(connection.getName()).registration.unregister();
|
||||
try {
|
||||
ConnectionMBeanImpl service = new ConnectionMBeanImpl(bundleContext, connection);
|
||||
ManagedConnectionDescriptor descriptor = new ManagedConnectionDescriptor();
|
||||
descriptor.connection = connection;
|
||||
props.put(ManagementCore.JMX_OBJECTNAME
|
||||
, Q_CONNECTIONS.qualifier(ConnectionMBean.CONNECTION_KEY
|
||||
, connection.getName()).getValue());
|
||||
descriptor.registration = bundleContext.registerService(ConnectionMBean.class
|
||||
, service
|
||||
, props);
|
||||
managed.put(connection.getName(), descriptor);
|
||||
} catch (Exception e) {
|
||||
log.error("Error adding connection [" + connection.getName() + "]", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removed(ManagedConnections connections) {
|
||||
for (ManagedConnection connection: connections.managedConnections) {
|
||||
if (managed.containsKey(connection.getName())) {
|
||||
this.managed.get(connection.getName()).registration.unregister();
|
||||
this.managed.remove(connection.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConnectionConfig(String connectionName) throws Exception {
|
||||
return entaxyObjectService.findObject(connectionName, "entaxy.runtime.connection").getConfiguration();
|
||||
}
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* connection-management
|
||||
* ==========
|
||||
* 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.esb.platform.core.management.connection.to_remove.impl;
|
||||
|
||||
public class ManagedConnection {
|
||||
|
||||
protected String name;
|
||||
protected boolean isPlatform;
|
||||
protected boolean isLocal;
|
||||
protected boolean isShared;
|
||||
protected long bundleId;
|
||||
protected boolean isDeployed;
|
||||
protected String label;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public boolean isPlatform() {
|
||||
return isPlatform;
|
||||
}
|
||||
public boolean isLocal() {
|
||||
return isLocal;
|
||||
}
|
||||
public boolean isShared() {
|
||||
return isShared;
|
||||
}
|
||||
public long getBundleId() {
|
||||
return bundleId;
|
||||
}
|
||||
public boolean isDeployed() {
|
||||
return isDeployed;
|
||||
}
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public void setPlatform(boolean isPlatform) {
|
||||
this.isPlatform = isPlatform;
|
||||
}
|
||||
public void setLocal(boolean isLocal) {
|
||||
this.isLocal = isLocal;
|
||||
}
|
||||
public void setShared(boolean isShared) {
|
||||
this.isShared = isShared;
|
||||
}
|
||||
public void setBundleId(long bundleId) {
|
||||
this.bundleId = bundleId;
|
||||
}
|
||||
public void setDeployed(boolean isDeployed) {
|
||||
this.isDeployed = isDeployed;
|
||||
}
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public ManagedConnection name(String name) {
|
||||
setName(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ManagedConnection platform(boolean isPlatform) {
|
||||
setPlatform(isPlatform);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ManagedConnection local(boolean isLocal) {
|
||||
setLocal(isLocal);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ManagedConnection shared(boolean isShared) {
|
||||
setShared(isShared);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ManagedConnection bundleId(long bundleId) {
|
||||
setBundleId(bundleId);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ManagedConnection deployed(boolean deployed) {
|
||||
setDeployed(deployed);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ManagedConnection label(String label) {
|
||||
setLabel(label);
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* connection-management
|
||||
* ==========
|
||||
* 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.esb.platform.core.management.connection.to_remove.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ManagedConnections {
|
||||
|
||||
public List<ManagedConnection> managedConnections = new ArrayList<>();
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* connection-management
|
||||
* ==========
|
||||
* 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.esb.platform.core.management.connection.to_remove.impl;
|
||||
|
||||
public interface ManagedConnectionsListener {
|
||||
|
||||
public void added(ManagedConnections connections);
|
||||
public void removed(ManagedConnections connections);
|
||||
|
||||
}
|
@ -0,0 +1,102 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* connection-management
|
||||
* ==========
|
||||
* 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.esb.platform.core.management.connection.to_remove.tracker;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleEvent;
|
||||
import org.osgi.framework.wiring.BundleCapability;
|
||||
import org.osgi.framework.wiring.BundleRevision;
|
||||
import org.osgi.util.tracker.BundleTrackerCustomizer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.esb.platform.core.management.connection.to_remove.ConnectionsMBean;
|
||||
import ru.entaxy.esb.platform.core.management.connection.to_remove.impl.ManagedConnection;
|
||||
import ru.entaxy.esb.platform.core.management.connection.to_remove.impl.ManagedConnections;
|
||||
import ru.entaxy.esb.platform.core.management.connection.to_remove.impl.ManagedConnectionsListener;
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
|
||||
public class DeployedConnectionCustomizer implements BundleTrackerCustomizer<ManagedConnections> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(DeployedConnectionCustomizer.class);
|
||||
|
||||
protected ManagedConnectionsListener listener;
|
||||
|
||||
public DeployedConnectionCustomizer(ManagedConnectionsListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManagedConnections addingBundle(Bundle bundle, BundleEvent event) {
|
||||
log.debug("INSPECTING: " + bundle.getBundleId());
|
||||
BundleRevision revision = bundle.adapt(BundleRevision.class);
|
||||
if (revision == null)
|
||||
return null;
|
||||
log.debug("REVISION FOUND: " + bundle.getBundleId());
|
||||
List<BundleCapability> capabilities = revision.getDeclaredCapabilities(ConnectionsMBean.CAPABILITY_NAMESPACE);
|
||||
if ((capabilities==null) || (capabilities.size()==0))
|
||||
return null;
|
||||
log.debug("CAPABILITIES FOUND: " + bundle.getBundleId());
|
||||
ManagedConnections result = new ManagedConnections();
|
||||
for (BundleCapability capability: capabilities) {
|
||||
Object val = capability.getAttributes().get("name");
|
||||
String name = val==null?"":val.toString();
|
||||
log.debug("CAPABILITIES/NAME [" + name + "] : " + bundle.getBundleId());
|
||||
if (!CommonUtils.isValid(name))
|
||||
continue;
|
||||
val = capability.getAttributes().get("platform");
|
||||
boolean isPlatform = val==null?false:"true".equals(val.toString());
|
||||
val = capability.getAttributes().get("label");
|
||||
String label = val == null ? "" : val.toString();
|
||||
ManagedConnection mc = (new ManagedConnection())
|
||||
.name(name)
|
||||
.platform(isPlatform)
|
||||
.deployed(true)
|
||||
.local(isPlatform)
|
||||
.shared(true)
|
||||
.bundleId(bundle.getBundleId())
|
||||
.label(label);
|
||||
result.managedConnections.add(mc);
|
||||
}
|
||||
listener.added(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modifiedBundle(Bundle bundle, BundleEvent event, ManagedConnections object) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removedBundle(Bundle bundle, BundleEvent event, ManagedConnections object) {
|
||||
log.debug("BUNDLE [{}] REMOVING", bundle.getBundleId());
|
||||
listener.removed(object);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* connection-management
|
||||
* ==========
|
||||
* 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.esb.platform.core.management.connection.to_remove.tracker;
|
||||
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.util.tracker.BundleTracker;
|
||||
|
||||
import ru.entaxy.esb.platform.core.management.connection.to_remove.impl.ManagedConnections;
|
||||
import ru.entaxy.esb.platform.core.management.connection.to_remove.impl.ManagedConnectionsListener;
|
||||
|
||||
public class DeployedConnectionTracker extends BundleTracker<ManagedConnections> {
|
||||
|
||||
public DeployedConnectionTracker(BundleContext bundleContext, ManagedConnectionsListener listener) {
|
||||
super(bundleContext
|
||||
, Bundle.ACTIVE | Bundle.INSTALLED | Bundle.RESOLVED | Bundle.STARTING | Bundle.STOPPING
|
||||
, new DeployedConnectionCustomizer(listener));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* connection-management
|
||||
* ==========
|
||||
* 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.core.management.connection;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Attribute;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBean;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
|
||||
public interface ConnectionMBean extends EntaxyRuntimeObjectMBean {
|
||||
|
||||
public static final String CONNECTION_KEY = "connection";
|
||||
|
||||
/*
|
||||
* connection name
|
||||
*/
|
||||
@Attribute
|
||||
default String getName() {
|
||||
return getObjectId();
|
||||
};
|
||||
|
||||
/*
|
||||
* if connection is platform one or user defined
|
||||
*/
|
||||
@Attribute
|
||||
public boolean isPlatform();
|
||||
|
||||
/*
|
||||
* status of the bundle if connection is deplyed
|
||||
*/
|
||||
@Attribute
|
||||
public String getStatus();
|
||||
|
||||
/*
|
||||
* if the connection local or shared (cluster)
|
||||
*/
|
||||
@Attribute
|
||||
public boolean isLocal();
|
||||
|
||||
/*
|
||||
* if the connection is shared (single malt) or prototype-like (blended)
|
||||
*/
|
||||
@Attribute
|
||||
public boolean isShared();
|
||||
|
||||
/*
|
||||
* if the connection is deployed or only defined
|
||||
*/
|
||||
@Attribute
|
||||
public boolean isDeployed();
|
||||
|
||||
/*
|
||||
* connection label
|
||||
*/
|
||||
@Deprecated(since = "1.10", forRemoval = true)
|
||||
@Attribute
|
||||
default String getLabel() {
|
||||
return getObjectLabel();
|
||||
};
|
||||
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* connection-management
|
||||
* ==========
|
||||
* 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.core.management.connection;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Operation;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Parameter;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectContainerMBean;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
|
||||
public interface ConnectionsMBean extends EntaxyRuntimeObjectContainerMBean {
|
||||
|
||||
public static final String CONNECTION_TYPE = "entaxy.runtime.connection";
|
||||
|
||||
public static final String CONNECTIONS_KEY = "category";
|
||||
|
||||
public static final String CONNECTIONS_KEY_VALUE = "connections";
|
||||
|
||||
@Operation(desc = "Gets connection's configuration")
|
||||
public String getConnectionConfig(
|
||||
@Parameter(name = "connectionName", desc = "Connection name") String connectionName) throws Exception;
|
||||
|
||||
@Operation(desc = "Start connection")
|
||||
void startConnection(
|
||||
@Parameter(name = "idOrName", desc = "Id or name of the connection") String idOrName) throws Exception;
|
||||
|
||||
@Operation(desc = "Stop connection")
|
||||
void stopConnection(
|
||||
@Parameter(name = "idOrName", desc = "Id or name of the connection") String idOrName) throws Exception;
|
||||
|
||||
@Operation(desc = "Uninstall connection")
|
||||
void uninstallConnection(
|
||||
@Parameter(name = "idOrName", desc = "Id or name of the connection") String idOrName) throws Exception;
|
||||
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* connection-management
|
||||
* ==========
|
||||
* 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.core.management.connection.impl;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.service.component.annotations.ReferencePolicyOption;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeItemMBean;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBean;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBeanFactory;
|
||||
import ru.entaxy.platform.core.management.object.MBeanFactory;
|
||||
import ru.entaxy.platform.core.management.object.factory.AbstractMBeanFactory;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
|
||||
|
||||
@MBeanFactory(id = "connection-factory", supportedTypes = {"entaxy.runtime.connection", "entaxy.runtime.connection.*"})
|
||||
@Component(service = EntaxyRuntimeObjectMBeanFactory.class, immediate = true)
|
||||
public class ConnectionMBeanFactory extends AbstractMBeanFactory {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ConnectionMBeanFactory.class);
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, policyOption = ReferencePolicyOption.GREEDY)
|
||||
ConnectionsMBeanImpl connectionsMBean;
|
||||
|
||||
@Override
|
||||
public <T extends EntaxyRuntimeObjectMBean> T createMBean(EntaxyRuntimeObject entaxyRuntimeObject) {
|
||||
ConnectionMBeanImpl beanImpl;
|
||||
try {
|
||||
beanImpl = new ConnectionMBeanImpl(entaxyRuntimeObject);
|
||||
beanImpl.setParentMBean(connectionsMBean);
|
||||
} catch (NotCompliantMBeanException e) {
|
||||
log.error("Error creating ProfileMBeanImpl for [" + entaxyRuntimeObject.getObjectFullId() + "]", e);
|
||||
return null;
|
||||
}
|
||||
return (T) beanImpl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends EntaxyRuntimeItemMBean> createMBeans() {
|
||||
return Collections.singletonList(connectionsMBean);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* connection-management
|
||||
* ==========
|
||||
* 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.core.management.connection.impl;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.EntaxyRuntimeTyped;
|
||||
import ru.entaxy.platform.core.management.connection.ConnectionMBean;
|
||||
import ru.entaxy.platform.core.management.object.ObjectMBean;
|
||||
import ru.entaxy.platform.core.management.object.factory.AbstractObjectMBean;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
|
||||
// @TODO move string to constant
|
||||
@EntaxyRuntimeTyped(name = "entaxy.runtime.connection")
|
||||
@ObjectMBean(subQualifierName = "connection")
|
||||
public class ConnectionMBeanImpl extends AbstractObjectMBean<ConnectionMBean> implements ConnectionMBean {
|
||||
|
||||
public ConnectionMBeanImpl(EntaxyRuntimeObject entaxyRuntimeObject)
|
||||
throws NotCompliantMBeanException {
|
||||
super(ConnectionMBean.class, entaxyRuntimeObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJMXSubQualifierValue() {
|
||||
return getObjectId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlatform() {
|
||||
return entaxyRuntimeObject.getAttributeOrDefault("platform", "false").toString().equals("true");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatus() {
|
||||
return getBundleState();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLocal() {
|
||||
return isPlatform();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShared() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDeployed() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* connection-management
|
||||
* ==========
|
||||
* 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.core.management.connection.impl;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Deactivate;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.service.component.annotations.ServiceScope;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.ManagementCore;
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
import ru.entaxy.platform.base.objects.EntaxyObjectService;
|
||||
import ru.entaxy.platform.core.management.connection.ConnectionsMBean;
|
||||
import ru.entaxy.platform.core.management.object.ContainerMBean;
|
||||
import ru.entaxy.platform.core.management.object.factory.AbstractObjectContainerMBean;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectManager;
|
||||
|
||||
@Component(
|
||||
service = {ConnectionsMBeanImpl.class},
|
||||
scope = ServiceScope.SINGLETON,
|
||||
immediate = true)
|
||||
@ContainerMBean(id = "connections", subQualifierName = "category", subQualifierValue = "connections")
|
||||
public class ConnectionsMBeanImpl extends AbstractObjectContainerMBean<ConnectionsMBean>
|
||||
implements ConnectionsMBean {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ConnectionsMBeanImpl.class);
|
||||
|
||||
public static final Qualifier Q_CONNECTIONS = ManagementCore.Q_RUNTIME
|
||||
.qualifier(ConnectionsMBean.CONNECTIONS_KEY, ConnectionsMBean.CONNECTIONS_KEY_VALUE);
|
||||
|
||||
protected BundleContext bundleContext;
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY)
|
||||
EntaxyObjectService entaxyObjectService;
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY)
|
||||
EntaxyRuntimeObjectManager entaxyRuntimeObjectManager;
|
||||
|
||||
|
||||
public ConnectionsMBeanImpl() throws NotCompliantMBeanException {
|
||||
super(ConnectionsMBean.class);
|
||||
}
|
||||
|
||||
@Activate
|
||||
public void activate(ComponentContext componentContext) {
|
||||
this.bundleContext = componentContext.getBundleContext();
|
||||
}
|
||||
|
||||
@Deactivate
|
||||
public void deactivate() {}
|
||||
|
||||
|
||||
@Override
|
||||
public String getConnectionConfig(String connectionName) throws Exception {
|
||||
return entaxyObjectService.findObject(connectionName, ConnectionsMBean.CONNECTION_TYPE).getConfiguration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startConnection(String idOrName) throws Exception {
|
||||
entaxyRuntimeObjectManager
|
||||
.start(entaxyObjectService.findObject(idOrName, ConnectionsMBean.CONNECTION_TYPE).getObjectFullId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopConnection(String idOrName) throws Exception {
|
||||
entaxyRuntimeObjectManager
|
||||
.stopForced(entaxyObjectService.findObject(idOrName, ConnectionsMBean.CONNECTION_TYPE)
|
||||
.getObjectFullId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstallConnection(String idOrName) throws Exception {
|
||||
entaxyRuntimeObjectManager
|
||||
.uninstallForced(entaxyObjectService.findObject(idOrName, ConnectionsMBean.CONNECTION_TYPE)
|
||||
.getObjectFullId());
|
||||
}
|
||||
}
|
@ -0,0 +1,105 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* connection-management
|
||||
* ==========
|
||||
* 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.core.management.connection.support.legacy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleEvent;
|
||||
import org.osgi.framework.wiring.BundleCapability;
|
||||
import org.osgi.framework.wiring.BundleRevision;
|
||||
import org.osgi.util.tracker.BundleTrackerCustomizer;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
|
||||
public class DeployedLegacyConnectionCustomizer implements BundleTrackerCustomizer<ManagedLegacyConnections> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(DeployedLegacyConnectionCustomizer.class);
|
||||
|
||||
public static final String CAPABILITY_NAMESPACE = "entaxy.runtime.connection";
|
||||
|
||||
protected ManagedLegacyConnectionsListener listener;
|
||||
|
||||
public DeployedLegacyConnectionCustomizer(ManagedLegacyConnectionsListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ManagedLegacyConnections addingBundle(Bundle bundle, BundleEvent event) {
|
||||
log.debug("INSPECTING: " + bundle.getBundleId());
|
||||
BundleRevision revision = bundle.adapt(BundleRevision.class);
|
||||
if (revision == null)
|
||||
return null;
|
||||
log.debug("REVISION FOUND: " + bundle.getBundleId());
|
||||
List<BundleCapability> capabilities = revision.getDeclaredCapabilities(CAPABILITY_NAMESPACE);
|
||||
if ((capabilities == null) || (capabilities.size() == 0))
|
||||
return null;
|
||||
log.debug("CAPABILITIES FOUND: " + bundle.getBundleId());
|
||||
ManagedLegacyConnections result = new ManagedLegacyConnections();
|
||||
for (BundleCapability capability : capabilities) {
|
||||
|
||||
// process only legacy connections
|
||||
if (capability.getAttributes().containsKey("objectId") && capability.getAttributes().containsKey("factory"))
|
||||
continue;
|
||||
|
||||
Object val = capability.getAttributes().get("name");
|
||||
String name = val == null ? "" : val.toString();
|
||||
log.debug("CAPABILITIES/NAME [" + name + "] : " + bundle.getBundleId());
|
||||
if (!CommonUtils.isValid(name))
|
||||
continue;
|
||||
val = capability.getAttributes().get("platform");
|
||||
boolean isPlatform = val == null ? false : "true".equals(val.toString());
|
||||
val = capability.getAttributes().get("label");
|
||||
String label = val == null ? "" : val.toString();
|
||||
ManagedLegacyConnection mc = (new ManagedLegacyConnection())
|
||||
.name(name)
|
||||
.platform(isPlatform)
|
||||
.deployed(true)
|
||||
.local(isPlatform)
|
||||
.shared(true)
|
||||
.bundleId(bundle.getBundleId())
|
||||
.label(label);
|
||||
result.managedConnections.add(mc);
|
||||
}
|
||||
listener.added(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modifiedBundle(Bundle bundle, BundleEvent event, ManagedLegacyConnections object) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removedBundle(Bundle bundle, BundleEvent event, ManagedLegacyConnections object) {
|
||||
log.debug("BUNDLE [{}] REMOVING", bundle.getBundleId());
|
||||
listener.removed(object);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* connection-management
|
||||
* ==========
|
||||
* 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.core.management.connection.support.legacy;
|
||||
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.util.tracker.BundleTracker;
|
||||
|
||||
public class DeployedLegacyConnectionTracker extends BundleTracker<ManagedLegacyConnections> {
|
||||
|
||||
public DeployedLegacyConnectionTracker(BundleContext bundleContext, ManagedLegacyConnectionsListener listener) {
|
||||
super(bundleContext, Bundle.ACTIVE | Bundle.INSTALLED | Bundle.RESOLVED | Bundle.STARTING | Bundle.STOPPING,
|
||||
new DeployedLegacyConnectionCustomizer(listener));
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* connection-management
|
||||
* ==========
|
||||
* 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.core.management.connection.support.legacy;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.RuntimeTypedMBean;
|
||||
|
||||
public interface LegacyConnectionMBean extends RuntimeTypedMBean {
|
||||
|
||||
public static final String CONNECTION_KEY = "connection";
|
||||
|
||||
/*
|
||||
* connection name
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
/*
|
||||
* if connection is platform one or user defined
|
||||
*/
|
||||
public boolean isPlatform();
|
||||
|
||||
/*
|
||||
* status of the bundle if connection is deplyed
|
||||
*/
|
||||
public String getStatus();
|
||||
|
||||
/*
|
||||
* if the connection local or shared (cluster)
|
||||
*/
|
||||
public boolean isLocal();
|
||||
|
||||
/*
|
||||
* if the connection is shared (single malt)
|
||||
* or prototype-like (blended)
|
||||
*/
|
||||
public boolean isShared();
|
||||
|
||||
/*
|
||||
* if the connection is deployed or only defined
|
||||
*/
|
||||
public boolean isDeployed();
|
||||
|
||||
/*
|
||||
* bundle id for single malt connection
|
||||
* null for blended
|
||||
*/
|
||||
public String getBundleId();
|
||||
|
||||
/*
|
||||
* connection label
|
||||
*/
|
||||
public String getLabel();
|
||||
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* connection-management
|
||||
* ==========
|
||||
* 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.core.management.connection.support.legacy;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
import javax.management.StandardMBean;
|
||||
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.EntaxyRuntimeTyped;
|
||||
|
||||
|
||||
// @TODO move string to constant
|
||||
@EntaxyRuntimeTyped(name = "entaxy.runtime.connection")
|
||||
public class LegacyConnectionMBeanImpl extends StandardMBean implements LegacyConnectionMBean {
|
||||
|
||||
protected ManagedLegacyConnection connection;
|
||||
|
||||
protected BundleContext bundleContext;
|
||||
|
||||
public LegacyConnectionMBeanImpl(BundleContext bundleContext, ManagedLegacyConnection connection)
|
||||
throws NotCompliantMBeanException {
|
||||
super(LegacyConnectionMBean.class);
|
||||
this.bundleContext = bundleContext;
|
||||
this.connection = connection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return connection.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isPlatform() {
|
||||
return connection.isPlatform();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatus() {
|
||||
int state = this.bundleContext.getBundle(connection.getBundleId()).getState();
|
||||
switch (state) {
|
||||
case Bundle.ACTIVE:
|
||||
return "Active";
|
||||
case Bundle.INSTALLED:
|
||||
return "Installed";
|
||||
case Bundle.RESOLVED:
|
||||
return "Resolved";
|
||||
case Bundle.STARTING:
|
||||
return "Starting";
|
||||
case Bundle.STOPPING:
|
||||
return "Stopping";
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLocal() {
|
||||
return connection.isLocal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShared() {
|
||||
return connection.isShared();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDeployed() {
|
||||
return connection.isDeployed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBundleId() {
|
||||
return connection.getBundleId() + "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
return connection.getLabel();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,125 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* connection-management
|
||||
* ==========
|
||||
* 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.core.management.connection.support.legacy;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Map;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.ServiceRegistration;
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Deactivate;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.service.component.annotations.ServiceScope;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.ManagementCore;
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
import ru.entaxy.esb.platform.core.management.connection.to_remove.ConnectionMBean;
|
||||
import ru.entaxy.esb.platform.core.management.connection.to_remove.ConnectionsMBean;
|
||||
import ru.entaxy.platform.base.objects.EntaxyObjectService;
|
||||
|
||||
@Component(
|
||||
service = {LegacyConnectionsManager.class},
|
||||
scope = ServiceScope.SINGLETON,
|
||||
immediate = true)
|
||||
public class LegacyConnectionsManager implements ManagedLegacyConnectionsListener {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(LegacyConnectionsManager.class);
|
||||
|
||||
public static final Qualifier Q_CONNECTIONS = ManagementCore.Q_RUNTIME
|
||||
.qualifier(ConnectionsMBean.CONNECTIONS_KEY, ConnectionsMBean.CONNECTIONS_KEY_VALUE);
|
||||
|
||||
protected BundleContext bundleContext;
|
||||
|
||||
protected DeployedLegacyConnectionTracker tracker;
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY)
|
||||
EntaxyObjectService entaxyObjectService;
|
||||
|
||||
protected static class ManagedConnectionDescriptor {
|
||||
|
||||
ManagedLegacyConnection connection;
|
||||
ServiceRegistration<LegacyConnectionMBean> registration;
|
||||
|
||||
}
|
||||
|
||||
protected Map<String, ManagedConnectionDescriptor> managed = new HashMap<>();
|
||||
|
||||
public LegacyConnectionsManager() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Activate
|
||||
public void activate(ComponentContext componentContext) {
|
||||
this.bundleContext = componentContext.getBundleContext();
|
||||
tracker = new DeployedLegacyConnectionTracker(bundleContext, this);
|
||||
tracker.open();
|
||||
}
|
||||
|
||||
@Deactivate
|
||||
public void deactivate() {
|
||||
tracker.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void added(ManagedLegacyConnections connections) {
|
||||
Hashtable props = new Hashtable<>();
|
||||
// String jmxObjectName = "jmx.objectname";
|
||||
// String objectName = "ru.entaxy.esb:group=platform,category=connections,connection=";
|
||||
for (ManagedLegacyConnection connection : connections.managedConnections) {
|
||||
if (managed.containsKey(connection.getName()))
|
||||
this.managed.get(connection.getName()).registration.unregister();
|
||||
try {
|
||||
LegacyConnectionMBeanImpl service = new LegacyConnectionMBeanImpl(bundleContext, connection);
|
||||
ManagedConnectionDescriptor descriptor = new ManagedConnectionDescriptor();
|
||||
descriptor.connection = connection;
|
||||
props.put(ManagementCore.JMX_OBJECTNAME,
|
||||
Q_CONNECTIONS.qualifier(ConnectionMBean.CONNECTION_KEY, connection.getName()).getValue());
|
||||
descriptor.registration = bundleContext.registerService(LegacyConnectionMBean.class, service, props);
|
||||
managed.put(connection.getName(), descriptor);
|
||||
} catch (Exception e) {
|
||||
log.error("Error adding connection [" + connection.getName() + "]", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removed(ManagedLegacyConnections connections) {
|
||||
for (ManagedLegacyConnection connection : connections.managedConnections) {
|
||||
if (managed.containsKey(connection.getName())) {
|
||||
this.managed.get(connection.getName()).registration.unregister();
|
||||
this.managed.remove(connection.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* connection-management
|
||||
* ==========
|
||||
* 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.core.management.connection.support.legacy;
|
||||
|
||||
public class ManagedLegacyConnection {
|
||||
|
||||
protected String name;
|
||||
protected boolean isPlatform;
|
||||
protected boolean isLocal;
|
||||
protected boolean isShared;
|
||||
protected long bundleId;
|
||||
protected boolean isDeployed;
|
||||
protected String label;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
public boolean isPlatform() {
|
||||
return isPlatform;
|
||||
}
|
||||
public boolean isLocal() {
|
||||
return isLocal;
|
||||
}
|
||||
public boolean isShared() {
|
||||
return isShared;
|
||||
}
|
||||
public long getBundleId() {
|
||||
return bundleId;
|
||||
}
|
||||
public boolean isDeployed() {
|
||||
return isDeployed;
|
||||
}
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
public void setPlatform(boolean isPlatform) {
|
||||
this.isPlatform = isPlatform;
|
||||
}
|
||||
public void setLocal(boolean isLocal) {
|
||||
this.isLocal = isLocal;
|
||||
}
|
||||
public void setShared(boolean isShared) {
|
||||
this.isShared = isShared;
|
||||
}
|
||||
public void setBundleId(long bundleId) {
|
||||
this.bundleId = bundleId;
|
||||
}
|
||||
public void setDeployed(boolean isDeployed) {
|
||||
this.isDeployed = isDeployed;
|
||||
}
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public ManagedLegacyConnection name(String name) {
|
||||
setName(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ManagedLegacyConnection platform(boolean isPlatform) {
|
||||
setPlatform(isPlatform);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ManagedLegacyConnection local(boolean isLocal) {
|
||||
setLocal(isLocal);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ManagedLegacyConnection shared(boolean isShared) {
|
||||
setShared(isShared);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ManagedLegacyConnection bundleId(long bundleId) {
|
||||
setBundleId(bundleId);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ManagedLegacyConnection deployed(boolean deployed) {
|
||||
setDeployed(deployed);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ManagedLegacyConnection label(String label) {
|
||||
setLabel(label);
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* connection-management
|
||||
* ==========
|
||||
* 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.core.management.connection.support.legacy;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ManagedLegacyConnections {
|
||||
|
||||
public List<ManagedLegacyConnection> managedConnections = new ArrayList<>();
|
||||
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* connection-management
|
||||
* ==========
|
||||
* 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.core.management.connection.support.legacy;
|
||||
|
||||
public interface ManagedLegacyConnectionsListener {
|
||||
|
||||
public void added(ManagedLegacyConnections connections);
|
||||
|
||||
public void removed(ManagedLegacyConnections connections);
|
||||
|
||||
}
|
175
platform/runtime/core/management/object-management/LICENSE.txt
Normal file
175
platform/runtime/core/management/object-management/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. Если какое-либо положение настоящей Лицензии будет признано судом недействительным,
|
||||
остальные положения будут продолжать своё действие, а Пользователь будет обязан продолжать
|
||||
исполнять свои обязанности в соответствии с этими положениями.
|
39
platform/runtime/core/management/object-management/pom.xml
Normal file
39
platform/runtime/core/management/object-management/pom.xml
Normal file
@ -0,0 +1,39 @@
|
||||
<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.esb.platform.runtime.core</groupId>
|
||||
<artifactId>management</artifactId>
|
||||
<version>1.10.0</version>
|
||||
</parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.core.management</groupId>
|
||||
<artifactId>object-management</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
<name>ENTAXY :: CORE :: MANAGEMENT :: OBJECT</name>
|
||||
<description>ENTAXY :: CORE :: MANAGEMENT :: OBJECT</description>
|
||||
|
||||
<properties>
|
||||
<bundle.osgi.export.pkg>
|
||||
ru.entaxy.platform.core.management.object,
|
||||
ru.entaxy.platform.core.management.object.factory
|
||||
</bundle.osgi.export.pkg>
|
||||
<bundle.osgi.private.pkg>
|
||||
ru.entaxy.platform.core.management.object.impl,
|
||||
ru.entaxy.platform.core.management.object.factory.impl,
|
||||
ru.entaxy.platform.core.management.object.shell
|
||||
</bundle.osgi.private.pkg>
|
||||
<bundle.osgi.remove.headers>none</bundle.osgi.remove.headers>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.core</groupId>
|
||||
<artifactId>object-runtime-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.karaf.bundle</groupId>
|
||||
<artifactId>org.apache.karaf.bundle.core</artifactId>
|
||||
<version>${karaf.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -0,0 +1,46 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object;
|
||||
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Inherited
|
||||
@Retention(RUNTIME)
|
||||
@Target(TYPE)
|
||||
public @interface ContainerMBean {
|
||||
|
||||
String id() default "";
|
||||
|
||||
String subQualifierName() default EntaxyRuntimeObjectContainerMBean.JMX_QUALIFIER_NAME;
|
||||
|
||||
String subQualifierValue();
|
||||
|
||||
}
|
@ -0,0 +1,162 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.ManagementCore;
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
|
||||
public interface EntaxyRuntimeItemMBean {
|
||||
|
||||
String JMX_SUBPATH_QUALIFIER = "subgroup";
|
||||
|
||||
String JMX_SUBQUALIFIER_AUTO = "@AUTO@";
|
||||
|
||||
EntaxyRuntimeItemMBean DEFAULT_PARENT_MBEAN = new EntaxyRuntimeItemMBean() {
|
||||
|
||||
@Override
|
||||
public Class<? extends EntaxyRuntimeItemMBean> getMBeanClass() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public String getJMXSubQualifier() {
|
||||
return ManagementCore.Q_RUNTIME_S;
|
||||
};
|
||||
|
||||
@Override
|
||||
public String getJMXSubQualifierValue() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJMXSubQualifierName() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Qualifier getJMXQualifier() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public EntaxyRuntimeItemMBean getParentMBean() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParentMBean(EntaxyRuntimeItemMBean mBean) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParentSubPath(String subPath) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJMXSubQualifierName(String name) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJMXSubQualifierValue(String value) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, EntaxyRuntimeItemMBean> getChildMBeans() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChildMBean(EntaxyRuntimeItemMBean mBean) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeChildMBean(EntaxyRuntimeItemMBean mBean) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
Qualifier getJMXQualifier();
|
||||
|
||||
default String getJMXSubQualifier() {
|
||||
return getJMXSubQualifierName().concat("=").concat(getJMXSubQualifierValue());
|
||||
};
|
||||
|
||||
default EntaxyRuntimeItemMBean getParentMBean() {
|
||||
return DEFAULT_PARENT_MBEAN;
|
||||
};
|
||||
|
||||
void setParentMBean(EntaxyRuntimeItemMBean mBean);
|
||||
|
||||
default String getParentSubPath() {
|
||||
return "";
|
||||
};
|
||||
|
||||
void setParentSubPath(String subPath);
|
||||
|
||||
Map<String, EntaxyRuntimeItemMBean> getChildMBeans();
|
||||
|
||||
void addChildMBean(EntaxyRuntimeItemMBean mBean);
|
||||
|
||||
void removeChildMBean(EntaxyRuntimeItemMBean mBean);
|
||||
|
||||
String getJMXSubQualifierName();
|
||||
|
||||
void setJMXSubQualifierName(String name);
|
||||
|
||||
String getJMXSubQualifierValue();
|
||||
|
||||
void setJMXSubQualifierValue(String value);
|
||||
|
||||
String getId();
|
||||
|
||||
Class<? extends EntaxyRuntimeItemMBean> getMBeanClass();
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
|
||||
public interface EntaxyRuntimeObjectContainerMBean extends EntaxyRuntimeItemMBean {
|
||||
|
||||
String JMX_QUALIFIER_NAME = "category";
|
||||
|
||||
String JMX_DEFAULT_CATEGORY = "objects";
|
||||
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.management.MBeanOperationInfo;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Attribute;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Operation;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.RuntimeTypedMBean;
|
||||
import ru.entaxy.esb.platform.base.management.core.utils.BundleAwareMBean;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
|
||||
public interface EntaxyRuntimeObjectMBean extends EntaxyRuntimeItemMBean, BundleAwareMBean, RuntimeTypedMBean {
|
||||
|
||||
public static final String DEFAULT_OBJECT_SUBQUALIFIER = "object";
|
||||
|
||||
EntaxyRuntimeObject getRuntimeObject();
|
||||
|
||||
@Override
|
||||
default String getJMXSubQualifierName() {
|
||||
if (this.getClass().isAnnotationPresent(ObjectMBean.class))
|
||||
return this.getClass().getAnnotation(ObjectMBean.class).subQualifierName();
|
||||
return DEFAULT_OBJECT_SUBQUALIFIER;
|
||||
}
|
||||
|
||||
@Attribute(desc = "Managed bean Id")
|
||||
String getId();
|
||||
|
||||
@Deprecated(since = "1.10.0", forRemoval = true)
|
||||
@Attribute(desc = "Object Name")
|
||||
String getName();
|
||||
|
||||
@Attribute(desc = "Object Id")
|
||||
String getObjectId();
|
||||
|
||||
@Attribute(desc = "Object Type")
|
||||
String getObjectType();
|
||||
|
||||
@Attribute(desc = "Object full Id")
|
||||
String getObjectFullId();
|
||||
|
||||
@Attribute(desc = "Object label")
|
||||
public String getObjectLabel();
|
||||
|
||||
@Attribute(desc = "Display name")
|
||||
public String getDisplayName();
|
||||
|
||||
@Attribute(desc = "Object factory Id")
|
||||
String getFactoryId();
|
||||
|
||||
@Attribute(desc = "Object scope")
|
||||
String getScope();
|
||||
|
||||
@Attribute(desc = "Object owner for private objects")
|
||||
String getOwner();
|
||||
|
||||
@Attribute(desc = "Object container Id")
|
||||
String getContainerId();
|
||||
|
||||
@Attribute(desc = "Object is provided via capability descriptor")
|
||||
boolean isProvided();
|
||||
|
||||
@Attribute(desc = "Object is ghost: assumed by relations but not present")
|
||||
boolean isGhost();
|
||||
|
||||
@Operation(desc = "Gets JSON configuration of the object", impact = MBeanOperationInfo.INFO)
|
||||
String readConfiguration();
|
||||
|
||||
@Operation(desc = "Reads extended data of the object", impact = MBeanOperationInfo.INFO)
|
||||
Map<String, Map<String, Object>> readExtendedData();
|
||||
}
|
@ -0,0 +1,45 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface EntaxyRuntimeObjectMBeanCustomizer {
|
||||
|
||||
public interface Customized {
|
||||
|
||||
EntaxyRuntimeObjectMBean getCustomizedMBean();
|
||||
|
||||
List<EntaxyRuntimeObjectMBean> getAdditionalMBeans();
|
||||
}
|
||||
|
||||
String getId();
|
||||
|
||||
boolean isAccepted(EntaxyRuntimeObjectMBean bean);
|
||||
|
||||
Customized customize(EntaxyRuntimeObjectMBean bean);
|
||||
|
||||
}
|
@ -0,0 +1,56 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
|
||||
public interface EntaxyRuntimeObjectMBeanFactory {
|
||||
|
||||
String JMX_QUALIFIER_NAME = "category";
|
||||
|
||||
String JMX_DEFAULT_CATEGORY = "objects";
|
||||
|
||||
String getId();
|
||||
|
||||
default String getCategory() {
|
||||
return JMX_DEFAULT_CATEGORY;
|
||||
};
|
||||
|
||||
default String getJMXSubQualifier() {
|
||||
return JMX_QUALIFIER_NAME.concat("=").concat(getCategory());
|
||||
}
|
||||
|
||||
List<String> getSupportedTypes();
|
||||
|
||||
<T extends EntaxyRuntimeObjectMBean> T createMBean(EntaxyRuntimeObject entaxyRuntimeObject);
|
||||
|
||||
// <T extends EntaxyRuntimeObjectContainerMBean> T createMBeanContainerForType(String
|
||||
// entaxyObjectType);
|
||||
|
||||
List<? extends EntaxyRuntimeItemMBean> createMBeans();
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object;
|
||||
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Inherited
|
||||
@Retention(RUNTIME)
|
||||
@Target(TYPE)
|
||||
public @interface MBeanFactory {
|
||||
|
||||
String[] supportedTypes();
|
||||
|
||||
String id();
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object;
|
||||
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
import static java.lang.annotation.RetentionPolicy.RUNTIME;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RUNTIME)
|
||||
@Target(TYPE)
|
||||
public @interface ObjectMBean {
|
||||
|
||||
String subQualifierName();
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object.factory;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBeanFactory;
|
||||
import ru.entaxy.platform.core.management.object.MBeanFactory;
|
||||
|
||||
public abstract class AbstractMBeanFactory implements EntaxyRuntimeObjectMBeanFactory {
|
||||
|
||||
protected String id;
|
||||
|
||||
protected List<String> supportedTypes = new ArrayList<>();
|
||||
|
||||
protected AbstractMBeanFactory() {
|
||||
super();
|
||||
this.id = this.getClass().getSimpleName();
|
||||
if (this.getClass().isAnnotationPresent(MBeanFactory.class)) {
|
||||
MBeanFactory anno = this.getClass().getAnnotation(MBeanFactory.class);
|
||||
this.id = anno.id();
|
||||
supportedTypes.addAll(Arrays.asList(anno.supportedTypes()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return this.id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getSupportedTypes() {
|
||||
return this.supportedTypes;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,54 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object.factory;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
import ru.entaxy.platform.core.management.object.ContainerMBean;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectContainerMBean;
|
||||
|
||||
public abstract class AbstractObjectContainerMBean<T extends EntaxyRuntimeObjectContainerMBean>
|
||||
extends AbstractObjectItemMBean<T>
|
||||
implements EntaxyRuntimeObjectContainerMBean {
|
||||
|
||||
protected AbstractObjectContainerMBean(Class<T> mbeanInterface) throws NotCompliantMBeanException {
|
||||
super(mbeanInterface);
|
||||
if (this.getClass().isAnnotationPresent(ContainerMBean.class)) {
|
||||
ContainerMBean anno = this.getClass().getAnnotation(ContainerMBean.class);
|
||||
jmxSubQualifierName = anno.subQualifierName();
|
||||
jmxSubQualifierValue = anno.subQualifierValue();
|
||||
id = anno.id();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Qualifier getJMXQualifier() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,134 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object.factory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.AnnotatedMBean;
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeItemMBean;
|
||||
|
||||
public abstract class AbstractObjectItemMBean<T extends EntaxyRuntimeItemMBean> extends AnnotatedMBean<T>
|
||||
implements EntaxyRuntimeItemMBean {
|
||||
|
||||
protected String jmxSubQualifierName;
|
||||
protected String jmxSubQualifierValue;
|
||||
|
||||
protected String id;
|
||||
|
||||
protected EntaxyRuntimeItemMBean parentMBean;
|
||||
protected String parentSubPath;
|
||||
|
||||
protected Map<String, EntaxyRuntimeItemMBean> children = new HashMap<>();
|
||||
|
||||
protected AbstractObjectItemMBean(Class<T> mbeanInterface) throws NotCompliantMBeanException {
|
||||
super(mbeanInterface);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Qualifier getJMXQualifier() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJMXSubQualifierName() {
|
||||
return jmxSubQualifierName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJMXSubQualifierName(String name) {
|
||||
jmxSubQualifierName = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJMXSubQualifierValue() {
|
||||
return jmxSubQualifierValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setJMXSubQualifierValue(String value) {
|
||||
jmxSubQualifierValue = value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<? extends EntaxyRuntimeItemMBean> getMBeanClass() {
|
||||
return this.interfaceClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntaxyRuntimeItemMBean getParentMBean() {
|
||||
if (this.parentMBean != null)
|
||||
return this.parentMBean;
|
||||
return EntaxyRuntimeItemMBean.super.getParentMBean();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParentMBean(EntaxyRuntimeItemMBean mBean) {
|
||||
if (this.parentMBean != null)
|
||||
this.parentMBean.removeChildMBean(this);
|
||||
this.parentMBean = mBean;
|
||||
if (parentMBean != null)
|
||||
this.parentMBean.addChildMBean(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getParentSubPath() {
|
||||
if (CommonUtils.isValid(this.parentSubPath))
|
||||
return this.parentSubPath;
|
||||
return EntaxyRuntimeItemMBean.super.getParentSubPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParentSubPath(String parentSubPath) {
|
||||
this.parentSubPath = parentSubPath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, EntaxyRuntimeItemMBean> getChildMBeans() {
|
||||
return this.children;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addChildMBean(EntaxyRuntimeItemMBean mBean) {
|
||||
children.put(mBean.getId(), mBean);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeChildMBean(EntaxyRuntimeItemMBean mBean) {
|
||||
children.remove(mBean.getId());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,214 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object.factory;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import org.apache.karaf.bundle.core.BundleInfo;
|
||||
import org.apache.karaf.bundle.core.BundleState;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.FrameworkUtil;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBean;
|
||||
import ru.entaxy.platform.core.management.object.factory.impl.ServiceHelper;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectService;
|
||||
|
||||
public abstract class AbstractObjectMBean<T extends EntaxyRuntimeObjectMBean>
|
||||
extends AbstractObjectItemMBean<T>
|
||||
implements EntaxyRuntimeObjectMBean {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AbstractObjectMBean.class);
|
||||
|
||||
protected EntaxyRuntimeObject entaxyRuntimeObject;
|
||||
|
||||
protected AbstractObjectMBean(Class<T> mbeanInterface, EntaxyRuntimeObject entaxyRuntimeObject)
|
||||
throws NotCompliantMBeanException {
|
||||
super(mbeanInterface);
|
||||
this.entaxyRuntimeObject = entaxyRuntimeObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJMXSubQualifierName() {
|
||||
if (CommonUtils.isValid(this.jmxSubQualifierName))
|
||||
return this.jmxSubQualifierName;
|
||||
return EntaxyRuntimeObjectMBean.super.getJMXSubQualifierName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJMXSubQualifierValue() {
|
||||
return entaxyRuntimeObject.getObjectFullId().replace(':', '_');
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getBundleId() {
|
||||
if (entaxyRuntimeObject.getBundleInfo() != null)
|
||||
return entaxyRuntimeObject.getBundleInfo().getBundleId();
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBundleState() {
|
||||
if (getBundleId() < 0)
|
||||
return BundleState.Unknown.name();
|
||||
BundleInfo bi = ServiceHelper.getInstance().getBundleInfo(getBundleId());
|
||||
if (bi == null)
|
||||
return BundleState.Unknown.name();
|
||||
return bi.getState().name();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBundleSymbolicName() {
|
||||
if (entaxyRuntimeObject.isGhost())
|
||||
return "";
|
||||
if (entaxyRuntimeObject.getContainer() == null)
|
||||
return "";
|
||||
return entaxyRuntimeObject.getContainer().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
if (entaxyRuntimeObject != null)
|
||||
return entaxyRuntimeObject.getObjectFullId();
|
||||
return super.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refreshBundleInfo() {
|
||||
// TODO Auto-generated method stub
|
||||
}
|
||||
|
||||
@Override
|
||||
public EntaxyRuntimeObject getRuntimeObject() {
|
||||
return this.entaxyRuntimeObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return entaxyRuntimeObject.getAttributeOrDefault("name", getObjectId()).toString();
|
||||
};
|
||||
|
||||
@Override
|
||||
public String getObjectId() {
|
||||
return this.entaxyRuntimeObject.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectType() {
|
||||
return this.entaxyRuntimeObject.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectFullId() {
|
||||
return this.entaxyRuntimeObject.getObjectFullId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return this.entaxyRuntimeObject.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getObjectLabel() {
|
||||
return entaxyRuntimeObject.getAttributeOrDefault("label", "").toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFactoryId() {
|
||||
return this.entaxyRuntimeObject.getFactoryId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getContainerId() {
|
||||
return "" + getBundleId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getScope() {
|
||||
return this.entaxyRuntimeObject.getScope();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOwner() {
|
||||
return this.entaxyRuntimeObject.getOwner();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRuntimeType() {
|
||||
if (entaxyRuntimeObject != null)
|
||||
return entaxyRuntimeObject.getType();
|
||||
return EntaxyRuntimeObjectMBean.super.getRuntimeType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isProvided() {
|
||||
if (entaxyRuntimeObject != null)
|
||||
return entaxyRuntimeObject.isProvided();
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGhost() {
|
||||
if (entaxyRuntimeObject != null)
|
||||
return entaxyRuntimeObject.isGhost();
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String readConfiguration() {
|
||||
if (entaxyRuntimeObject != null)
|
||||
return entaxyRuntimeObject.getConfiguration();
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Map<String, Object>> readExtendedData() {
|
||||
try {
|
||||
BundleContext bundleContext = FrameworkUtil.getBundle(EntaxyRuntimeObjectService.class).getBundleContext();
|
||||
ServiceReference<EntaxyRuntimeObjectService> ref =
|
||||
bundleContext.getServiceReference(EntaxyRuntimeObjectService.class);
|
||||
EntaxyRuntimeObjectService objectService = bundleContext.getService(ref);
|
||||
|
||||
Map<String, Map<String, Object>> result = objectService.getExtendedObjectInfo(entaxyRuntimeObject);
|
||||
|
||||
bundleContext.ungetService(ref);
|
||||
|
||||
if (result != null)
|
||||
return result;
|
||||
|
||||
} catch (Exception e) {
|
||||
LOG.error(String.format("Error reading extended data for [%s]", entaxyRuntimeObject.getObjectFullId()), e);
|
||||
}
|
||||
return new HashMap<>();
|
||||
}
|
||||
}
|
@ -0,0 +1,65 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object.factory;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Operation;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Parameter;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectContainerMBean;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
|
||||
public interface ObjectsContainerMBean extends EntaxyRuntimeObjectContainerMBean {
|
||||
|
||||
@Operation(desc = "Refreshes full object tree")
|
||||
void refresh();
|
||||
|
||||
@Operation(desc = "Start bundle")
|
||||
String startBundle(
|
||||
@Parameter(name = "idOrName", desc = "Id or name of the object") String idOrName,
|
||||
@Parameter(name = "runtimeType", desc = "Runtime type of the object") String runtimeType,
|
||||
@Parameter(name = "forced", desc = "Operation flag for forced processing") boolean forced,
|
||||
@Parameter(name = "soft", desc = "Operation flag for soft processing") boolean soft) throws Exception;
|
||||
|
||||
@Operation(desc = "Stop bundle")
|
||||
String stopBundle(
|
||||
@Parameter(name = "idOrName", desc = "Id or name of the object") String idOrName,
|
||||
@Parameter(name = "runtimeType", desc = "Runtime type of the object") String runtimeType,
|
||||
@Parameter(name = "forced", desc = "Operation flag for forced processing") boolean forced,
|
||||
@Parameter(name = "soft", desc = "Operation flag for soft processing") boolean soft) throws Exception;
|
||||
|
||||
@Operation(desc = "Uninstall bundle")
|
||||
String uninstallBundle(
|
||||
@Parameter(name = "idOrName", desc = "Id or name of the object") String idOrName,
|
||||
@Parameter(name = "runtimeType", desc = "Runtime type of the object") String runtimeType,
|
||||
@Parameter(name = "forced", desc = "Operation flag for forced processing") boolean forced,
|
||||
@Parameter(name = "soft", desc = "Operation flag for soft processing") boolean soft) throws Exception;
|
||||
|
||||
@Operation(desc = "Find objects by osgi filter")
|
||||
String findObjects(
|
||||
@Parameter(name = "osgiFilter", desc = "OSGI filter") String osgiFilter) throws Exception;
|
||||
|
||||
}
|
@ -0,0 +1,88 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object.factory.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeItemMBean;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBean;
|
||||
import ru.entaxy.platform.core.management.object.MBeanFactory;
|
||||
import ru.entaxy.platform.core.management.object.factory.AbstractMBeanFactory;
|
||||
import ru.entaxy.platform.core.management.object.impl.EntaxyRuntimeObjectMBeanManager;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
|
||||
@MBeanFactory(id = "root-object-factory", supportedTypes = {"*"})
|
||||
// @Component(service = EntaxyRuntimeObjectMBeanFactory.class, immediate = true)
|
||||
public class EntaxyObjectMBeanFactory extends AbstractMBeanFactory {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(EntaxyObjectMBeanFactory.class);
|
||||
|
||||
protected ObjectsContainerMBeanImpl objectsContainerMBeanImpl;
|
||||
|
||||
protected EntaxyRuntimeObjectMBeanManager objectMBeanManager;
|
||||
|
||||
public EntaxyObjectMBeanFactory(EntaxyRuntimeObjectMBeanManager objectMBeanManager) {
|
||||
super();
|
||||
this.objectMBeanManager = objectMBeanManager;
|
||||
try {
|
||||
objectsContainerMBeanImpl = new ObjectsContainerMBeanImpl();
|
||||
} catch (NotCompliantMBeanException e) {
|
||||
log.error("Error creating MBean for ObjectsContainerMBean", e);
|
||||
}
|
||||
}
|
||||
|
||||
public void activate() {}
|
||||
|
||||
@Override
|
||||
public <T extends EntaxyRuntimeObjectMBean> T createMBean(EntaxyRuntimeObject entaxyRuntimeObject) {
|
||||
try {
|
||||
EntaxyRuntimeObjectMBeanImpl result = new EntaxyRuntimeObjectMBeanImpl(entaxyRuntimeObject);
|
||||
if (objectsContainerMBeanImpl != null)
|
||||
result.setParentMBean(objectsContainerMBeanImpl);
|
||||
return (T) result;
|
||||
} catch (NotCompliantMBeanException e) {
|
||||
log.error("Error creating MBean for [" + entaxyRuntimeObject.getObjectFullId() + "]", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends EntaxyRuntimeItemMBean> createMBeans() {
|
||||
List<EntaxyRuntimeItemMBean> result = new ArrayList<>();
|
||||
if (objectsContainerMBeanImpl != null) {
|
||||
objectsContainerMBeanImpl.manager = objectMBeanManager;
|
||||
result.add(objectsContainerMBeanImpl);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object.factory.impl;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBean;
|
||||
import ru.entaxy.platform.core.management.object.factory.AbstractObjectMBean;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
|
||||
public class EntaxyRuntimeObjectMBeanImpl extends AbstractObjectMBean<EntaxyRuntimeObjectMBean>
|
||||
implements EntaxyRuntimeObjectMBean {
|
||||
|
||||
public EntaxyRuntimeObjectMBeanImpl(EntaxyRuntimeObject entaxyRuntimeObject) throws NotCompliantMBeanException {
|
||||
super(EntaxyRuntimeObjectMBean.class, entaxyRuntimeObject);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object.factory.impl;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
import ru.entaxy.platform.base.support.JSONUtils;
|
||||
import ru.entaxy.platform.core.management.object.ContainerMBean;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBeanFactory;
|
||||
import ru.entaxy.platform.core.management.object.factory.AbstractObjectContainerMBean;
|
||||
import ru.entaxy.platform.core.management.object.factory.ObjectsContainerMBean;
|
||||
import ru.entaxy.platform.core.management.object.impl.EntaxyRuntimeObjectMBeanManager;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectManager.OperationResult;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@ContainerMBean(id = "objects", subQualifierValue = EntaxyRuntimeObjectMBeanFactory.JMX_DEFAULT_CATEGORY)
|
||||
public class ObjectsContainerMBeanImpl extends AbstractObjectContainerMBean<ObjectsContainerMBean>
|
||||
implements ObjectsContainerMBean {
|
||||
|
||||
protected EntaxyRuntimeObjectMBeanManager manager;
|
||||
|
||||
protected ObjectsContainerMBeanImpl() throws NotCompliantMBeanException {
|
||||
super(ObjectsContainerMBean.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh() {
|
||||
manager.refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String startBundle(String idOrName, String runtimeType, boolean forced, boolean soft) throws Exception {
|
||||
if (ServiceHelper.getInstance() == null) {
|
||||
throw new IllegalStateException("Service helper is not initialized");
|
||||
}
|
||||
|
||||
String objectFullId = ServiceHelper.getInstance()
|
||||
.entaxyObjectService.findObject(idOrName, runtimeType).getObjectFullId();
|
||||
|
||||
OperationResult result;
|
||||
|
||||
if (forced) {
|
||||
result = ServiceHelper.getInstance().entaxyRuntimeObjectManager.startForced(objectFullId);
|
||||
} else if (soft) {
|
||||
result = ServiceHelper.getInstance().entaxyRuntimeObjectManager.startSoft(objectFullId);
|
||||
} else {
|
||||
result = ServiceHelper.getInstance().entaxyRuntimeObjectManager.start(objectFullId);
|
||||
}
|
||||
|
||||
return getOutput(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String stopBundle(String idOrName, String runtimeType, boolean forced, boolean soft) throws Exception {
|
||||
if (ServiceHelper.getInstance() == null) {
|
||||
throw new IllegalStateException("Service helper is not initialized");
|
||||
}
|
||||
|
||||
String objectFullId = ServiceHelper.getInstance()
|
||||
.entaxyObjectService.findObject(idOrName, runtimeType).getObjectFullId();
|
||||
|
||||
OperationResult result;
|
||||
|
||||
if (forced) {
|
||||
result = ServiceHelper.getInstance().entaxyRuntimeObjectManager.stopForced(objectFullId);
|
||||
} else if (soft) {
|
||||
result = ServiceHelper.getInstance().entaxyRuntimeObjectManager.stopSoft(objectFullId);
|
||||
} else {
|
||||
result = ServiceHelper.getInstance().entaxyRuntimeObjectManager.stop(objectFullId);
|
||||
}
|
||||
|
||||
return getOutput(result);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uninstallBundle(String idOrName, String runtimeType, boolean forced, boolean soft) throws Exception {
|
||||
if (ServiceHelper.getInstance() == null) {
|
||||
throw new IllegalStateException("Service helper is not initialized");
|
||||
}
|
||||
|
||||
String objectFullId = ServiceHelper.getInstance()
|
||||
.entaxyObjectService.findObject(idOrName, runtimeType).getObjectFullId();
|
||||
|
||||
OperationResult result;
|
||||
|
||||
if (forced) {
|
||||
result = ServiceHelper.getInstance().entaxyRuntimeObjectManager.uninstallForced(objectFullId);
|
||||
} else if (soft) {
|
||||
result = ServiceHelper.getInstance().entaxyRuntimeObjectManager.uninstallSoft(objectFullId);
|
||||
} else {
|
||||
result = ServiceHelper.getInstance().entaxyRuntimeObjectManager.uninstall(objectFullId);
|
||||
}
|
||||
|
||||
return getOutput(result);
|
||||
}
|
||||
|
||||
private String getOutput(OperationResult result) {
|
||||
JsonObject jsonObject = new JsonObject();
|
||||
|
||||
jsonObject.addProperty("result", result.getResult().name());
|
||||
if (!result.getAffected().isEmpty()) {
|
||||
JsonArray affectedArray = new JsonArray();
|
||||
for (String key : result.getAffected().keySet()) {
|
||||
JsonObject affected = new JsonObject();
|
||||
affected.addProperty("objectId", key);
|
||||
affected.addProperty("action", result.getAffected().get(key).name());
|
||||
affectedArray.add(affected);
|
||||
}
|
||||
jsonObject.addProperty("affected", affectedArray.toString());
|
||||
}
|
||||
if (CommonUtils.isValid(result.getMessage())) {
|
||||
jsonObject.addProperty("message", result.getMessage());
|
||||
}
|
||||
|
||||
return jsonObject.toString();
|
||||
}
|
||||
|
||||
public String findObjects(String osgiFilter) throws Exception {
|
||||
return JSONUtils.GSON.toJson(manager.findObjects(osgiFilter).stream().map(object -> {
|
||||
return object.getObjectFullId();
|
||||
}).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object.factory.impl;
|
||||
|
||||
import org.apache.karaf.bundle.core.BundleInfo;
|
||||
import org.apache.karaf.bundle.core.BundleService;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.FrameworkUtil;
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.osgi.service.component.annotations.*;
|
||||
import ru.entaxy.platform.base.objects.EntaxyObjectService;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectManager;
|
||||
|
||||
@Component(service = ServiceHelper.class, immediate = true)
|
||||
public class ServiceHelper {
|
||||
|
||||
private static ServiceHelper INSTANCE;
|
||||
|
||||
public static ServiceHelper getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC,
|
||||
policyOption = ReferencePolicyOption.GREEDY)
|
||||
volatile public EntaxyObjectService entaxyObjectService;
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC,
|
||||
policyOption = ReferencePolicyOption.GREEDY)
|
||||
volatile public EntaxyRuntimeObjectManager entaxyRuntimeObjectManager;
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY)
|
||||
BundleService bundleService;
|
||||
|
||||
BundleContext bundleContext;
|
||||
|
||||
@Activate
|
||||
public void activate(ComponentContext componentContext) {
|
||||
INSTANCE = this;
|
||||
this.bundleContext = componentContext.getBundleContext();
|
||||
}
|
||||
|
||||
@Deactivate
|
||||
public void deactivate() {
|
||||
INSTANCE = null;
|
||||
}
|
||||
|
||||
public BundleService getBundleService() {
|
||||
return bundleService;
|
||||
}
|
||||
|
||||
public BundleInfo getBundleInfo(long id) {
|
||||
Bundle b = FrameworkUtil.getBundle(getClass()).getBundleContext().getBundle(id);
|
||||
if (b == null)
|
||||
return null;
|
||||
return bundleService.getInfo(b);
|
||||
}
|
||||
}
|
@ -0,0 +1,133 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeItemMBean;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBeanFactory;
|
||||
|
||||
public class EntaxyRuntimeItemMBeanInfo<T extends EntaxyRuntimeItemMBean> {
|
||||
|
||||
public enum ItemStatus {
|
||||
NEW,
|
||||
ACTIVE,
|
||||
REREGISTER,
|
||||
RECREATE,
|
||||
REMOVE,
|
||||
UNKNOWN
|
||||
}
|
||||
|
||||
public MBeanHolder<T> mbeanHolder = null;
|
||||
boolean isVirtual = false;
|
||||
|
||||
protected BundleContext bundleContext;
|
||||
|
||||
public ItemStatus itemStatus = ItemStatus.UNKNOWN;
|
||||
|
||||
public ItemStatus status() {
|
||||
return itemStatus;
|
||||
}
|
||||
|
||||
public ItemStatus status(ItemStatus newStatus) {
|
||||
if (newStatus == null)
|
||||
return status(ItemStatus.UNKNOWN);
|
||||
this.itemStatus = newStatus;
|
||||
return status();
|
||||
}
|
||||
|
||||
public boolean isInStatus(ItemStatus checkStatus) {
|
||||
return this.itemStatus.equals(checkStatus);
|
||||
}
|
||||
|
||||
EntaxyRuntimeItemMBeanInfo<?> parentMBeanInfo;
|
||||
|
||||
List<EntaxyRuntimeItemMBeanInfo<?>> children = new ArrayList<>();
|
||||
|
||||
protected EntaxyRuntimeObjectMBeanFactory factory;
|
||||
|
||||
public String getId() {
|
||||
return mbeanHolder == null ? "" : mbeanHolder.mbean.getId();
|
||||
}
|
||||
|
||||
public boolean createHolder(T mbean) {
|
||||
mbeanHolder = MBeanHolder.create(mbean);
|
||||
return isCreated();
|
||||
}
|
||||
|
||||
public boolean isCreated() {
|
||||
if (mbeanHolder == null)
|
||||
return false;
|
||||
return mbeanHolder.mbean != null;
|
||||
}
|
||||
|
||||
public boolean isRegistered() {
|
||||
return isCreated() && (mbeanHolder.registration != null);
|
||||
}
|
||||
|
||||
public void setBundleContext(BundleContext bundleContext) {
|
||||
this.bundleContext = bundleContext;
|
||||
}
|
||||
|
||||
public void register(BundleContext bundleContext) {
|
||||
setBundleContext(bundleContext);
|
||||
register();
|
||||
}
|
||||
|
||||
public void register() {
|
||||
try {
|
||||
if (this.mbeanHolder.bundleContext == null)
|
||||
this.mbeanHolder.bundleContext = this.bundleContext;
|
||||
this.mbeanHolder.register();
|
||||
} catch (Exception ignore) {
|
||||
// NOOP
|
||||
}
|
||||
}
|
||||
|
||||
public void unregister() {
|
||||
try {
|
||||
this.mbeanHolder.unregister();
|
||||
} catch (Exception ignore) {
|
||||
// NOOP
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, EntaxyRuntimeItemMBean> getAllChildMBeans() {
|
||||
if (this.mbeanHolder != null)
|
||||
return this.mbeanHolder.mbean.getChildMBeans();
|
||||
return Collections.emptyMap();
|
||||
};
|
||||
|
||||
public Map<String, EntaxyRuntimeItemMBean> getPrimaryChildMBeans() {
|
||||
return getAllChildMBeans();
|
||||
};
|
||||
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object.impl;
|
||||
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectContainerMBean;
|
||||
|
||||
public class EntaxyRuntimeObjectContainerMBeanInfo
|
||||
extends EntaxyRuntimeItemMBeanInfo<EntaxyRuntimeObjectContainerMBean> {
|
||||
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBeanCustomizer;
|
||||
|
||||
public class EntaxyRuntimeObjectMBeanCustomizerHolder {
|
||||
|
||||
public EntaxyRuntimeObjectMBeanCustomizer customizer;
|
||||
|
||||
public List<EntaxyRuntimeItemMBeanInfo<?>> mbeanInfo = new ArrayList<>();
|
||||
|
||||
public EntaxyRuntimeObjectMBeanCustomizerHolder(EntaxyRuntimeObjectMBeanCustomizer customizer) {
|
||||
this.customizer = customizer;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,119 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeItemMBean;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBean;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeRelation;
|
||||
|
||||
public class EntaxyRuntimeObjectMBeanInfo extends EntaxyRuntimeItemMBeanInfo<EntaxyRuntimeObjectMBean> {
|
||||
|
||||
public enum LOAD_STATUS {
|
||||
AUTO_LOADED,
|
||||
LOADED,
|
||||
NONE
|
||||
}
|
||||
|
||||
public EntaxyRuntimeObjectMBeanInfo(EntaxyRuntimeObject runtimeObject) {
|
||||
this.runtimeObject = runtimeObject;
|
||||
}
|
||||
|
||||
String foundPattern;
|
||||
|
||||
EntaxyRuntimeObject runtimeObject;
|
||||
|
||||
EntaxyRuntimeObject parentObject;
|
||||
|
||||
EntaxyRuntimeRelation relationFromParent;
|
||||
|
||||
LOAD_STATUS loadStatus = LOAD_STATUS.NONE;
|
||||
|
||||
Map<String, List<EntaxyRuntimeObjectMBeanInfo>> secondaryBeans = new HashMap<>();
|
||||
|
||||
public boolean isGhost() {
|
||||
return this.runtimeObject.isGhost();
|
||||
}
|
||||
|
||||
public void resetStatus() {
|
||||
this.loadStatus = LOAD_STATUS.NONE;
|
||||
}
|
||||
|
||||
public void makeAutoLoaded() {
|
||||
this.loadStatus = LOAD_STATUS.AUTO_LOADED;
|
||||
}
|
||||
|
||||
public boolean isAutoLoaded() {
|
||||
return LOAD_STATUS.AUTO_LOADED.equals(this.loadStatus);
|
||||
}
|
||||
|
||||
public void makeLoaded() {
|
||||
this.loadStatus = LOAD_STATUS.LOADED;
|
||||
}
|
||||
|
||||
public boolean isLoaded() {
|
||||
return LOAD_STATUS.LOADED.equals(this.loadStatus);
|
||||
}
|
||||
|
||||
public boolean isUpdatedByLoad() {
|
||||
return !LOAD_STATUS.NONE.equals(this.loadStatus);
|
||||
}
|
||||
|
||||
public void register() {
|
||||
super.register();
|
||||
for (String key : secondaryBeans.keySet()) {
|
||||
List<EntaxyRuntimeObjectMBeanInfo> list = secondaryBeans.get(key);
|
||||
for (EntaxyRuntimeObjectMBeanInfo sMBean : list)
|
||||
sMBean.register(this.bundleContext);
|
||||
}
|
||||
}
|
||||
|
||||
public void unregister() {
|
||||
for (String key : secondaryBeans.keySet()) {
|
||||
List<EntaxyRuntimeObjectMBeanInfo> list = secondaryBeans.get(key);
|
||||
for (EntaxyRuntimeObjectMBeanInfo sMBean : list)
|
||||
sMBean.unregister();
|
||||
}
|
||||
super.unregister();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, EntaxyRuntimeItemMBean> getPrimaryChildMBeans() {
|
||||
final List<String> secondariesIds =
|
||||
secondaryBeans.values().stream().flatMap(list -> list.stream())
|
||||
.map(bi -> bi.mbeanHolder.mbean.getId())
|
||||
.collect(Collectors.toList());
|
||||
Map<String, EntaxyRuntimeItemMBean> result =
|
||||
getAllChildMBeans().entrySet().stream().filter(e -> !secondariesIds.contains(e.getValue().getId()))
|
||||
.collect(Collectors.toMap(e -> e.getKey(), e -> e.getValue()));
|
||||
return result;
|
||||
}
|
||||
}
|
@ -0,0 +1,734 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.InvalidSyntaxException;
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.CollectionType;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Deactivate;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.service.component.annotations.ReferencePolicy;
|
||||
import org.osgi.service.component.annotations.ReferencePolicyOption;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.platform.base.objects.EntaxyObject.OBJECT_RELATION;
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeItemMBean;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBean;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBeanCustomizer;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBeanCustomizer.Customized;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBeanFactory;
|
||||
import ru.entaxy.platform.core.management.object.factory.impl.EntaxyObjectMBeanFactory;
|
||||
import ru.entaxy.platform.core.management.object.impl.EntaxyRuntimeItemMBeanInfo.ItemStatus;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectManager;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObjectService;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeRelation;
|
||||
|
||||
@Component(service = EntaxyRuntimeObjectMBeanManager.class, immediate = true)
|
||||
public class EntaxyRuntimeObjectMBeanManager implements EntaxyRuntimeObjectService.Listener {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(EntaxyRuntimeObjectMBeanManager.class);
|
||||
|
||||
private static final String TYPE_WILDCARD = "*";
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC,
|
||||
policyOption = ReferencePolicyOption.GREEDY)
|
||||
volatile EntaxyRuntimeObjectService entaxyRuntimeObjectService;
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC,
|
||||
policyOption = ReferencePolicyOption.GREEDY)
|
||||
volatile EntaxyRuntimeObjectManager entaxyRuntimeObjectManager;
|
||||
|
||||
protected static class FactorySearchResult {
|
||||
|
||||
public static FactorySearchResult create(EntaxyRuntimeObjectMBeanFactory factory, String pattern) {
|
||||
return new FactorySearchResult(factory, pattern);
|
||||
}
|
||||
|
||||
EntaxyRuntimeObjectMBeanFactory factory;
|
||||
String pattern;
|
||||
|
||||
protected FactorySearchResult(EntaxyRuntimeObjectMBeanFactory factory, String pattern) {
|
||||
this.factory = factory;
|
||||
this.pattern = pattern;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected Map<String, EntaxyRuntimeObjectMBeanFactory> factoriesMap = new HashMap<>();
|
||||
|
||||
protected Map<String, EntaxyRuntimeItemMBeanInfo<?>> infoById = new HashMap<>();
|
||||
|
||||
protected Map<String, EntaxyRuntimeObjectMBeanCustomizerHolder> customizersMap =
|
||||
new HashMap<>();
|
||||
|
||||
// protected Map<String, EntaxyRuntimeItemMBeanInfo<?>> infoByJMXObjectName = new HashMap<>();
|
||||
|
||||
protected List<EntaxyRuntimeObjectMBeanInfo> toRemove = new ArrayList<>();
|
||||
|
||||
protected BundleContext bundleContext;
|
||||
|
||||
protected boolean activated = false;
|
||||
|
||||
protected Object lock = new Object();
|
||||
|
||||
@Activate
|
||||
public EntaxyRuntimeObjectMBeanManager(BundleContext bundleContext) {
|
||||
super();
|
||||
this.bundleContext = bundleContext;
|
||||
|
||||
// add root factory
|
||||
addFactory(new EntaxyObjectMBeanFactory(this));
|
||||
}
|
||||
|
||||
|
||||
@Activate
|
||||
public void activate(ComponentContext componentContext) {
|
||||
// this.bundleContext = componentContext.getBundleContext();
|
||||
activated = true;
|
||||
synchronized (lock) {
|
||||
entaxyRuntimeObjectService.addListener(this);
|
||||
loadCurrentObjects();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Deactivate
|
||||
public void deactivate() {
|
||||
entaxyRuntimeObjectService.removeListener(this);
|
||||
}
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC,
|
||||
policyOption = ReferencePolicyOption.GREEDY,
|
||||
collectionType = CollectionType.SERVICE, unbind = "removeFactory")
|
||||
public void addFactory(EntaxyRuntimeObjectMBeanFactory factory) {
|
||||
synchronized (lock) {
|
||||
for (String pattern : factory.getSupportedTypes()) {
|
||||
factoriesMap.put(pattern, factory);
|
||||
}
|
||||
List<? extends EntaxyRuntimeItemMBean> mbeans = factory.createMBeans();
|
||||
if (mbeans != null)
|
||||
for (EntaxyRuntimeItemMBean mbean : mbeans) {
|
||||
EntaxyRuntimeItemMBeanInfo<?> mbeanInfo = MBeanUtils.createMBeanInfo(mbean);
|
||||
if (!mbeanInfo.isCreated()) {
|
||||
log.error("Error creating MBeanInfo for mbean [{}]", mbean.getId());
|
||||
continue;
|
||||
}
|
||||
if (infoById.containsKey(mbeanInfo.getId())) {
|
||||
try {
|
||||
infoById.get(mbeanInfo.getId()).unregister();
|
||||
} catch (Exception ignore) {
|
||||
// ignore
|
||||
}
|
||||
}
|
||||
infoById.put(mbeanInfo.getId(), mbeanInfo);
|
||||
mbeanInfo.register(bundleContext);
|
||||
}
|
||||
|
||||
|
||||
// review all created mbeans if they suit newly added factory
|
||||
|
||||
List<EntaxyRuntimeObjectMBeanInfo> infoToRecreate = new ArrayList<>();
|
||||
List<EntaxyRuntimeItemMBeanInfo<?>> infoToReregister = new ArrayList<>();
|
||||
|
||||
for (EntaxyRuntimeItemMBeanInfo<?> itemInfo : infoById.values()) {
|
||||
if (!(itemInfo instanceof EntaxyRuntimeObjectMBeanInfo))
|
||||
continue;
|
||||
EntaxyRuntimeObjectMBeanInfo mBeanInfo = (EntaxyRuntimeObjectMBeanInfo) itemInfo;
|
||||
FactorySearchResult result = findFactory(mBeanInfo.runtimeObject);
|
||||
if (result.factory.getId().equals(factory.getId()))
|
||||
if (!infoToRecreate.contains(mBeanInfo))
|
||||
infoToRecreate.add(mBeanInfo);
|
||||
}
|
||||
|
||||
List<EntaxyRuntimeItemMBean> itemsToReregister = new ArrayList<>();
|
||||
|
||||
for (EntaxyRuntimeObjectMBeanInfo mBeanInfo : infoToRecreate)
|
||||
collectCascadeChildren(itemsToReregister, mBeanInfo.mbeanHolder.mbean);
|
||||
|
||||
infoToReregister.addAll(itemsToReregister.stream()
|
||||
.map(item -> infoById.get(item.getId()))
|
||||
.filter(item -> item != null)
|
||||
.collect(Collectors.toList()));
|
||||
infoToReregister.removeAll(infoToRecreate);
|
||||
|
||||
List<EntaxyRuntimeObject> runtimeObjects = infoToRecreate.stream()
|
||||
.map(inf -> inf.runtimeObject)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
ObjectHelper helper = new ObjectHelper(runtimeObjects);
|
||||
|
||||
List<EntaxyRuntimeObjectMBeanInfo> recreatedInfos = helper.load();
|
||||
|
||||
List<EntaxyRuntimeObjectMBeanInfo> toRegister = new ArrayList<>();
|
||||
|
||||
for (EntaxyRuntimeObjectMBeanInfo newInfo : recreatedInfos) {
|
||||
|
||||
EntaxyRuntimeObjectMBeanInfo oldInfo = (EntaxyRuntimeObjectMBeanInfo) infoById.get(newInfo.getId());
|
||||
|
||||
if (oldInfo == null) {
|
||||
|
||||
// just add
|
||||
|
||||
infoById.put(newInfo.getId(), newInfo);
|
||||
newInfo.setBundleContext(bundleContext);
|
||||
newInfo.status(ItemStatus.REREGISTER);
|
||||
toRegister.add(newInfo);
|
||||
} else {
|
||||
|
||||
// mbean info already exists
|
||||
|
||||
if (newInfo.isAutoLoaded()) {
|
||||
|
||||
// object loaded only as someone's parent
|
||||
// so we just switch the children links
|
||||
switchChildren(newInfo.mbeanHolder.mbean, oldInfo.mbeanHolder.mbean);
|
||||
|
||||
if (oldInfo.isInStatus(ItemStatus.REMOVE))
|
||||
oldInfo.status(ItemStatus.REREGISTER);
|
||||
|
||||
} else if (newInfo.isLoaded()) {
|
||||
|
||||
// unregister existing mbean
|
||||
oldInfo.unregister();
|
||||
|
||||
updateObjectMBeanInfo(newInfo, oldInfo, toRegister);
|
||||
|
||||
switchChildren(oldInfo.mbeanHolder.mbean, newInfo.mbeanHolder.mbean);
|
||||
|
||||
// detach old secondaries from parent
|
||||
for (String key : oldInfo.secondaryBeans.keySet()) {
|
||||
List<EntaxyRuntimeObjectMBeanInfo> list = oldInfo.secondaryBeans.get(key);
|
||||
for (EntaxyRuntimeObjectMBeanInfo bi : list)
|
||||
bi.mbeanHolder.mbean.setParentMBean(null);
|
||||
}
|
||||
|
||||
// remove all secondaries
|
||||
oldInfo.secondaryBeans.clear();
|
||||
|
||||
// add new secondaries
|
||||
oldInfo.secondaryBeans.putAll(newInfo.secondaryBeans);
|
||||
|
||||
// set new mbean
|
||||
oldInfo.mbeanHolder.mbean = newInfo.mbeanHolder.mbean;
|
||||
|
||||
oldInfo.status(ItemStatus.REREGISTER);
|
||||
|
||||
// schedule existing to re-register
|
||||
toRegister.add(oldInfo);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
* for (EntaxyRuntimeObjectMBeanInfo mBeanInfo : infoToRecreate) { FactorySearchResult
|
||||
* searchResult = findFactory(mBeanInfo.runtimeObject); EntaxyRuntimeObjectMBean
|
||||
* newMBean = searchResult.factory.createMBean(mBeanInfo.runtimeObject);
|
||||
* EntaxyRuntimeObjectMBeanInfo newInfo = (EntaxyRuntimeObjectMBeanInfo)
|
||||
* MBeanUtils.createMBeanInfo(newMBean);
|
||||
*
|
||||
* mBeanInfo.mbeanHolder.unregister();
|
||||
*
|
||||
* if (newInfo.mbeanHolder.mbean.getParentMBean() == null) {
|
||||
* newInfo.mbeanHolder.mbean.setParentMBean(mBeanInfo.mbeanHolder.mbean.getParentMBean()
|
||||
* ); }
|
||||
*
|
||||
* // unlink from parent and switch children
|
||||
* mBeanInfo.mbeanHolder.mbean.setParentMBean(null);
|
||||
* switchChildren(mBeanInfo.mbeanHolder.mbean, newInfo.mbeanHolder.mbean);
|
||||
*
|
||||
* infoById.put(newInfo.getId(), newInfo); newInfo.mbeanHolder.bundleContext =
|
||||
* bundleContext; newInfo.mbeanHolder.register(); }
|
||||
*/
|
||||
|
||||
for (EntaxyRuntimeItemMBeanInfo<?> toReg : toRegister) {
|
||||
toReg.unregister();
|
||||
toReg.register();
|
||||
}
|
||||
|
||||
infoToReregister.removeAll(toRegister);
|
||||
|
||||
for (EntaxyRuntimeItemMBeanInfo<?> toReg : infoToReregister) {
|
||||
toReg.unregister();
|
||||
toReg.register();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public void refresh() {
|
||||
synchronized (lock) {
|
||||
toRemove.addAll(infoById.values().stream()
|
||||
.filter(v -> (v instanceof EntaxyRuntimeObjectMBeanInfo))
|
||||
.map(v -> EntaxyRuntimeObjectMBeanInfo.class.cast(v))
|
||||
.collect(Collectors.toList()));
|
||||
tryToRemove();
|
||||
loadCurrentObjects();
|
||||
}
|
||||
}
|
||||
|
||||
public void removeFactory(EntaxyRuntimeObjectMBeanFactory factory) {
|
||||
for (String pattern : factory.getSupportedTypes()) {
|
||||
factoriesMap.remove(pattern);
|
||||
}
|
||||
}
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MULTIPLE, policy = ReferencePolicy.DYNAMIC,
|
||||
policyOption = ReferencePolicyOption.GREEDY,
|
||||
collectionType = CollectionType.SERVICE, unbind = "removeCustomizer")
|
||||
public void addCustomizer(EntaxyRuntimeObjectMBeanCustomizer customizer) {
|
||||
|
||||
synchronized (lock) {
|
||||
|
||||
EntaxyRuntimeObjectMBeanCustomizerHolder holder = customizersMap.get(customizer.getId());
|
||||
|
||||
if (holder != null) {
|
||||
// just switch to new customizer
|
||||
holder.customizer = customizer;
|
||||
} else {
|
||||
holder = new EntaxyRuntimeObjectMBeanCustomizerHolder(customizer);
|
||||
|
||||
customizersMap.put(customizer.getId(), holder);
|
||||
|
||||
for (EntaxyRuntimeItemMBeanInfo<?> itemInfo : infoById.values()) {
|
||||
|
||||
if ((itemInfo.mbeanHolder == null)
|
||||
|| !(itemInfo.mbeanHolder.mbean instanceof EntaxyRuntimeObjectMBean))
|
||||
continue;
|
||||
|
||||
if (!customizer.isAccepted((EntaxyRuntimeObjectMBean) itemInfo.mbeanHolder.mbean))
|
||||
continue;
|
||||
|
||||
EntaxyRuntimeObjectMBeanInfo objectInfo = (EntaxyRuntimeObjectMBeanInfo) itemInfo;
|
||||
|
||||
Customized customized = customizer.customize(objectInfo.mbeanHolder.mbean);
|
||||
|
||||
if (customized.getAdditionalMBeans() == null || customized.getAdditionalMBeans().isEmpty())
|
||||
continue;
|
||||
|
||||
List<EntaxyRuntimeObjectMBeanInfo> secondaries = customized.getAdditionalMBeans().stream()
|
||||
.map(b -> (EntaxyRuntimeObjectMBeanInfo) MBeanUtils.createMBeanInfo(b)).map(bi -> {
|
||||
bi.status(ItemStatus.NEW);
|
||||
bi.runtimeObject = objectInfo.runtimeObject;
|
||||
return bi;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
for (EntaxyRuntimeObjectMBeanInfo bi : secondaries) {
|
||||
bi.register(bundleContext);
|
||||
}
|
||||
|
||||
objectInfo.secondaryBeans.put(customizer.getId(), secondaries);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void removeCustomizer(EntaxyRuntimeObjectMBeanCustomizer customizer) {
|
||||
synchronized (lock) {
|
||||
|
||||
for (EntaxyRuntimeItemMBeanInfo<?> itemInfo : infoById.values()) {
|
||||
|
||||
if ((itemInfo.mbeanHolder == null)
|
||||
|| !(itemInfo.mbeanHolder.mbean instanceof EntaxyRuntimeObjectMBean))
|
||||
continue;
|
||||
|
||||
EntaxyRuntimeObjectMBeanInfo objectInfo = (EntaxyRuntimeObjectMBeanInfo) itemInfo;
|
||||
|
||||
if (objectInfo.secondaryBeans.containsKey(customizer.getId())) {
|
||||
for (EntaxyRuntimeObjectMBeanInfo sBean : objectInfo.secondaryBeans.get(customizer.getId()))
|
||||
sBean.unregister();
|
||||
objectInfo.secondaryBeans.remove(customizer.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
customizersMap.remove(customizer.getId());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void loadCurrentObjects() {
|
||||
|
||||
ObjectHelper helper = new ObjectHelper(entaxyRuntimeObjectService.getObjects());
|
||||
List<EntaxyRuntimeObjectMBeanInfo> mBeanInfoList = helper.load();
|
||||
|
||||
for (EntaxyRuntimeObjectMBeanInfo mBeanInfo : mBeanInfoList) {
|
||||
infoById.put(mBeanInfo.getId(), mBeanInfo);
|
||||
mBeanInfo.register(bundleContext);
|
||||
mBeanInfo.resetStatus();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected FactorySearchResult findFactory(EntaxyRuntimeObject entaxyRuntimeObject) {
|
||||
EntaxyRuntimeObjectMBeanFactory result = null;
|
||||
String type = entaxyRuntimeObject.getType();
|
||||
while (CommonUtils.isValid(type)) {
|
||||
result = factoriesMap.get(type);
|
||||
if (result != null)
|
||||
return FactorySearchResult.create(result, type);
|
||||
int index = type.lastIndexOf('.');
|
||||
if (index < 0) {
|
||||
if (type.equals(TYPE_WILDCARD))
|
||||
type = "";
|
||||
else
|
||||
type = TYPE_WILDCARD;
|
||||
} else {
|
||||
if (type.endsWith(TYPE_WILDCARD))
|
||||
type = type.substring(0, index);
|
||||
else {
|
||||
type = type.substring(0, index).concat(".").concat(TYPE_WILDCARD);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return FactorySearchResult.create(null, "");
|
||||
}
|
||||
|
||||
protected void findFactory(EntaxyRuntimeObjectMBeanInfo mBeanInfo) {
|
||||
FactorySearchResult searchResult = findFactory(mBeanInfo.runtimeObject);
|
||||
if (searchResult != null) {
|
||||
mBeanInfo.factory = searchResult.factory;
|
||||
mBeanInfo.foundPattern = searchResult.pattern;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// EntaxyRuntimeObjectService.Listener
|
||||
|
||||
@Override
|
||||
public void objectAdded(EntaxyRuntimeObject object) {
|
||||
if (object == null)
|
||||
return;
|
||||
synchronized (lock) {
|
||||
ObjectHelper helper = new ObjectHelper(Collections.singletonList(object));
|
||||
List<EntaxyRuntimeObjectMBeanInfo> mBeanInfoList = helper.load();
|
||||
|
||||
List<EntaxyRuntimeObjectMBeanInfo> toRegister = new ArrayList<>();
|
||||
|
||||
for (EntaxyRuntimeObjectMBeanInfo mBeanInfo : mBeanInfoList) {
|
||||
|
||||
if (!infoById.containsKey(mBeanInfo.getId())) {
|
||||
|
||||
// just add
|
||||
|
||||
infoById.put(mBeanInfo.getId(), mBeanInfo);
|
||||
mBeanInfo.setBundleContext(bundleContext);;
|
||||
mBeanInfo.status(ItemStatus.REREGISTER);
|
||||
toRegister.add(mBeanInfo);
|
||||
} else {
|
||||
|
||||
// mbean info already exists
|
||||
|
||||
EntaxyRuntimeObjectMBeanInfo existing =
|
||||
(EntaxyRuntimeObjectMBeanInfo) infoById.get(mBeanInfo.getId());
|
||||
|
||||
if (mBeanInfo.isAutoLoaded()) {
|
||||
|
||||
// object loaded only as someone's parent
|
||||
// so we just switch the children links
|
||||
// switchChildren(mBeanInfo.mbeanHolder.mbean, existing.mbeanHolder.mbean);
|
||||
|
||||
switchChildren(mBeanInfo.mbeanHolder.mbean, existing.mbeanHolder.mbean,
|
||||
existing.secondaryBeans.values().stream().flatMap(list -> list.stream())
|
||||
.map(bi -> bi.mbeanHolder.mbean).collect(Collectors.toList()));
|
||||
|
||||
if (existing.isInStatus(ItemStatus.REMOVE))
|
||||
existing.status(ItemStatus.REREGISTER);
|
||||
|
||||
} else if (mBeanInfo.isLoaded()) {
|
||||
|
||||
// unregister existing mbean
|
||||
existing.unregister();
|
||||
|
||||
updateObjectMBeanInfo(mBeanInfo, existing, toRegister);
|
||||
|
||||
// switchChildren(existing.mbeanHolder.mbean, mBeanInfo.mbeanHolder.mbean);
|
||||
|
||||
switchChildren(existing.mbeanHolder.mbean, mBeanInfo.mbeanHolder.mbean,
|
||||
existing.secondaryBeans.values().stream().flatMap(list -> list.stream())
|
||||
.map(bi -> bi.mbeanHolder.mbean).collect(Collectors.toList()));
|
||||
|
||||
// detach old secondaries from parent
|
||||
for (String key : existing.secondaryBeans.keySet()) {
|
||||
List<EntaxyRuntimeObjectMBeanInfo> list = existing.secondaryBeans.get(key);
|
||||
for (EntaxyRuntimeObjectMBeanInfo bi : list)
|
||||
bi.mbeanHolder.mbean.setParentMBean(null);
|
||||
}
|
||||
|
||||
// remove all secondaries
|
||||
existing.secondaryBeans.clear();
|
||||
|
||||
// add new secondaries
|
||||
existing.secondaryBeans.putAll(mBeanInfo.secondaryBeans);
|
||||
|
||||
// set new mbean
|
||||
existing.mbeanHolder.mbean = mBeanInfo.mbeanHolder.mbean;
|
||||
|
||||
existing.status(ItemStatus.REREGISTER);
|
||||
|
||||
// schedule existing to re-register
|
||||
toRegister.add(existing);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (EntaxyRuntimeObjectMBeanInfo mbean : toRegister) {
|
||||
if (mbean.isRegistered())
|
||||
mbean.unregister();
|
||||
mbean.register();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected void switchChildren(EntaxyRuntimeItemMBean fromMBean, EntaxyRuntimeItemMBean toMBean,
|
||||
List<EntaxyRuntimeItemMBean> ignore) {
|
||||
|
||||
// avoid cuncurrent modifications
|
||||
List<EntaxyRuntimeItemMBean> children = new ArrayList<>(fromMBean.getChildMBeans().values());
|
||||
|
||||
for (EntaxyRuntimeItemMBean child : children)
|
||||
if (!ignore.contains(child))
|
||||
child.setParentMBean(toMBean);
|
||||
|
||||
}
|
||||
|
||||
protected void switchChildren(EntaxyRuntimeItemMBean fromMBean, EntaxyRuntimeItemMBean toMBean) {
|
||||
|
||||
// avoid cuncurrent modifications
|
||||
List<EntaxyRuntimeItemMBean> children = new ArrayList<>(fromMBean.getChildMBeans().values());
|
||||
|
||||
for (EntaxyRuntimeItemMBean child : children)
|
||||
child.setParentMBean(toMBean);
|
||||
}
|
||||
|
||||
protected void updateObjectMBeanInfo(EntaxyRuntimeObjectMBeanInfo fromMBeanInfo,
|
||||
EntaxyRuntimeObjectMBeanInfo toMBeanInfo, List<EntaxyRuntimeObjectMBeanInfo> affectedItems) {
|
||||
|
||||
// switch existing children to new mbean
|
||||
// and schedule them to re-register
|
||||
/*
|
||||
* List<EntaxyRuntimeItemMBean> children = new
|
||||
* ArrayList<>(fromMBeanInfo.mbeanHolder.mbean.getChildMBeans().values()); for
|
||||
* (EntaxyRuntimeItemMBean child : children) {
|
||||
* child.setParentMBean(toMBeanInfo.mbeanHolder.mbean); if
|
||||
* (!affectedItems.contains(infoById.get(child.getId())))
|
||||
* affectedItems.add((EntaxyRuntimeObjectMBeanInfo) infoById.get(child.getId()));
|
||||
*
|
||||
* List<EntaxyRuntimeItemMBean> cascadeChildren = new ArrayList<>();
|
||||
* collectCascadeChildren(cascadeChildren, child); affectedItems.addAll(
|
||||
* cascadeChildren.stream() .map(c -> (EntaxyRuntimeObjectMBeanInfo)
|
||||
* infoById.get(c.getId())) .collect(Collectors.toList())); }
|
||||
*/
|
||||
// set parent to new mbean
|
||||
// existing.mbeanHolder.mbean.setParentMBean(mBeanInfo.mbeanHolder.mbean.getParentMBean());
|
||||
// toMBeanInfo.mbeanHolder.mbean.setParentMBean(null);
|
||||
|
||||
// update existing
|
||||
toMBeanInfo.factory = fromMBeanInfo.factory;
|
||||
toMBeanInfo.foundPattern = fromMBeanInfo.foundPattern;
|
||||
toMBeanInfo.relationFromParent = fromMBeanInfo.relationFromParent;
|
||||
toMBeanInfo.runtimeObject = fromMBeanInfo.runtimeObject;
|
||||
|
||||
}
|
||||
|
||||
protected void collectCascadeChildren(List<EntaxyRuntimeItemMBean> result, EntaxyRuntimeItemMBean startMBean) {
|
||||
for (EntaxyRuntimeItemMBean child : startMBean.getChildMBeans().values()) {
|
||||
result.add(child);
|
||||
collectCascadeChildren(result, child);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void objectModified(EntaxyRuntimeObject object) {
|
||||
// we'll do the same as when an object is added
|
||||
objectAdded(object);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void objectRemoved(EntaxyRuntimeObject object) {
|
||||
synchronized (lock) {
|
||||
if (!infoById.containsKey(object.getObjectFullId()))
|
||||
return;
|
||||
toRemove.add((EntaxyRuntimeObjectMBeanInfo) infoById.get(object.getObjectFullId()));
|
||||
tryToRemove();
|
||||
}
|
||||
}
|
||||
|
||||
protected void tryToRemove() {
|
||||
int currentSize = -1;
|
||||
while (currentSize != toRemove.size()) {
|
||||
currentSize = toRemove.size();
|
||||
List<EntaxyRuntimeObjectMBeanInfo> removed = new ArrayList<>();
|
||||
for (EntaxyRuntimeObjectMBeanInfo item : toRemove) {
|
||||
if (item.isRegistered())
|
||||
item.unregister();
|
||||
// if (item.mbeanHolder.mbean.getChildMBeans().isEmpty()) {
|
||||
if (item.getPrimaryChildMBeans().isEmpty()) {
|
||||
// remove from parent
|
||||
item.mbeanHolder.mbean.setParentMBean(null);
|
||||
// remove
|
||||
infoById.remove(item.getId());
|
||||
|
||||
removed.add(item);
|
||||
}
|
||||
}
|
||||
toRemove.removeAll(removed);
|
||||
}
|
||||
}
|
||||
|
||||
// Util classes
|
||||
|
||||
protected class ObjectHelper {
|
||||
|
||||
List<EntaxyRuntimeObject> objects;
|
||||
|
||||
Map<String, EntaxyRuntimeObjectMBeanInfo> createdInfo = new HashMap<>();
|
||||
|
||||
public ObjectHelper(List<EntaxyRuntimeObject> objects) {
|
||||
this.objects = objects;
|
||||
}
|
||||
|
||||
public List<EntaxyRuntimeObjectMBeanInfo> load() {
|
||||
|
||||
// create Mbean info objects
|
||||
for (EntaxyRuntimeObject object : this.objects) {
|
||||
String objectId = object.getObjectFullId();
|
||||
|
||||
EntaxyRuntimeObjectMBeanInfo mBeanInfo = getOrCreateMBeanInfo(object);
|
||||
if (mBeanInfo == null)
|
||||
continue;
|
||||
|
||||
mBeanInfo.makeLoaded();
|
||||
|
||||
EntaxyRuntimeObjectMBean mBean = mBeanInfo.mbeanHolder.mbean;
|
||||
|
||||
List<EntaxyRuntimeRelation> relations = object.getIncomiingRelations(OBJECT_RELATION.COMPOSITION);
|
||||
if (relations.isEmpty())
|
||||
relations = object.getIncomiingRelations(OBJECT_RELATION.AGGREGATION);
|
||||
if (relations.isEmpty())
|
||||
continue;
|
||||
|
||||
EntaxyRuntimeRelation parentLink = relations.get(0);
|
||||
EntaxyRuntimeObject parentObject = parentLink.getMain();
|
||||
String parentObjectId = parentObject.getObjectFullId();
|
||||
EntaxyRuntimeObjectMBeanInfo mBeanInfoParent = getOrCreateMBeanInfo(parentObject);
|
||||
|
||||
if (!mBeanInfoParent.isLoaded())
|
||||
mBeanInfoParent.makeAutoLoaded();
|
||||
|
||||
mBean.setParentMBean(mBeanInfoParent.mbeanHolder.mbean);
|
||||
if (CommonUtils.isValid(parentLink.getName()))
|
||||
mBean.setJMXSubQualifierName(parentLink.getName());
|
||||
mBean.setParentSubPath(parentLink.getGroup());
|
||||
}
|
||||
|
||||
return new ArrayList<>(createdInfo.values());
|
||||
|
||||
}
|
||||
|
||||
protected EntaxyRuntimeObjectMBeanInfo getOrCreateMBeanInfo(EntaxyRuntimeObject object) {
|
||||
String objectId = object.getObjectFullId();
|
||||
if (!createdInfo.containsKey(objectId)) {
|
||||
FactorySearchResult searchResult = findFactory(object);
|
||||
if (searchResult.factory == null) {
|
||||
log.warn("No MBean factory found for object [{}]", objectId);
|
||||
return null;
|
||||
}
|
||||
EntaxyRuntimeObjectMBean mBean = searchResult.factory.createMBean(object);
|
||||
EntaxyRuntimeObjectMBeanInfo mBeanInfo =
|
||||
(EntaxyRuntimeObjectMBeanInfo) MBeanUtils.createMBeanInfo(mBean);
|
||||
|
||||
for (EntaxyRuntimeObjectMBeanCustomizerHolder holder : customizersMap.values()) {
|
||||
EntaxyRuntimeObjectMBeanCustomizer customizer = holder.customizer;
|
||||
if (customizer.isAccepted(mBean)) {
|
||||
Customized customized = customizer.customize(mBean);
|
||||
if (customized.getAdditionalMBeans() != null && !customized.getAdditionalMBeans().isEmpty())
|
||||
mBeanInfo.secondaryBeans.put(customizer.getId(),
|
||||
customized.getAdditionalMBeans().stream()
|
||||
.map(b -> (EntaxyRuntimeObjectMBeanInfo) MBeanUtils.createMBeanInfo(b))
|
||||
.map(bi -> {
|
||||
bi.status(ItemStatus.NEW);
|
||||
bi.runtimeObject = object;
|
||||
return bi;
|
||||
})
|
||||
.collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
mBeanInfo.status(ItemStatus.NEW);
|
||||
mBeanInfo.runtimeObject = object;
|
||||
createdInfo.put(objectId, mBeanInfo);
|
||||
return mBeanInfo;
|
||||
} else {
|
||||
return createdInfo.get(objectId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Map<String, EntaxyRuntimeObjectMBeanFactory> getFactoriesMap() {
|
||||
return Collections.unmodifiableMap(factoriesMap);
|
||||
}
|
||||
|
||||
|
||||
public Map<String, EntaxyRuntimeItemMBeanInfo<?>> getInfoById() {
|
||||
return Collections.unmodifiableMap(infoById);
|
||||
}
|
||||
|
||||
public List<EntaxyRuntimeObject> findObjects(String osgiFilter) throws InvalidSyntaxException {
|
||||
return entaxyRuntimeObjectService.findObjects(osgiFilter);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,150 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object.impl;
|
||||
|
||||
import java.util.Dictionary;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Iterator;
|
||||
|
||||
import javax.management.DynamicMBean;
|
||||
import javax.management.MBeanRegistration;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.ServiceRegistration;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.ManagementCore;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeItemMBean;
|
||||
|
||||
public class MBeanHolder<T extends EntaxyRuntimeItemMBean> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(MBeanHolder.class);
|
||||
|
||||
public static <S extends EntaxyRuntimeItemMBean> MBeanHolder<S> create(S mbean) {
|
||||
MBeanHolder<S> result = new MBeanHolder<S>();
|
||||
result.mbean = mbean;
|
||||
result.objectId = mbean.getId();
|
||||
return result;
|
||||
}
|
||||
|
||||
public static <S extends EntaxyRuntimeItemMBean> MBeanHolder<S> register(Class<? extends S> mbeanClass,
|
||||
S mbean,
|
||||
Dictionary<String, Object> properties,
|
||||
BundleContext bundleContext) {
|
||||
|
||||
MBeanHolder<S> result = create(mbean);
|
||||
|
||||
if (properties != null) {
|
||||
result.clearProperties();
|
||||
Enumeration<String> keys = properties.keys();
|
||||
while (keys.hasMoreElements()) {
|
||||
String key = keys.nextElement();
|
||||
result.registrationProperties.put(key, properties.get(key));
|
||||
}
|
||||
}
|
||||
|
||||
if (mbeanClass != null)
|
||||
result.register(mbeanClass);
|
||||
else
|
||||
result.register();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
ServiceRegistration<?> registration;
|
||||
|
||||
public String objectId;
|
||||
|
||||
public T mbean;
|
||||
|
||||
Dictionary<String, Object> registrationPropertiesDefaults = new Hashtable<>();
|
||||
|
||||
Dictionary<String, Object> registrationProperties = new Hashtable<>();
|
||||
|
||||
BundleContext bundleContext;
|
||||
|
||||
public void clearProperties() {
|
||||
this.registrationProperties = new Hashtable<>();
|
||||
}
|
||||
|
||||
protected void loadDefaultProperties() {
|
||||
Iterator<String> iter = registrationPropertiesDefaults.keys().asIterator();
|
||||
while (iter.hasNext()) {
|
||||
String key = iter.next();
|
||||
registrationProperties.put(key, registrationPropertiesDefaults.get(key));
|
||||
}
|
||||
}
|
||||
|
||||
public void register() {
|
||||
if (this.mbean == null)
|
||||
return;
|
||||
register(this.mbean.getMBeanClass());
|
||||
}
|
||||
|
||||
public void register(Class<? extends EntaxyRuntimeItemMBean> mbeanClass) {
|
||||
if (this.mbean == null)
|
||||
return;
|
||||
|
||||
unregister();
|
||||
|
||||
String[] classes = new String[] {
|
||||
mbeanClass.getName(),
|
||||
DynamicMBean.class.getName(),
|
||||
MBeanRegistration.class.getName()
|
||||
};
|
||||
|
||||
loadDefaultProperties();
|
||||
|
||||
if (registrationProperties.get(ManagementCore.JMX_OBJECTNAME) == null) {
|
||||
registrationProperties.put(ManagementCore.JMX_OBJECTNAME,
|
||||
MBeanUtils.addNamespace(MBeanUtils.calculateJmxObjectName(mbean)));
|
||||
}
|
||||
|
||||
try {
|
||||
registration = bundleContext.registerService(classes, mbean, registrationProperties);
|
||||
} catch (Exception e) {
|
||||
log.error("Error registering MBean [" + mbean.getId() + "]", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void unregister() {
|
||||
if (registration != null) {
|
||||
try {
|
||||
registration.unregister();
|
||||
} catch (Exception ignore) {
|
||||
// NOOP
|
||||
}
|
||||
|
||||
registration = null;
|
||||
|
||||
}
|
||||
clearProperties();
|
||||
}
|
||||
}
|
@ -0,0 +1,101 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object.impl;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.ManagementCore;
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeItemMBean;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectContainerMBean;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBean;
|
||||
|
||||
public class MBeanUtils {
|
||||
|
||||
|
||||
public static EntaxyRuntimeItemMBeanInfo<?> createMBeanInfo(EntaxyRuntimeItemMBean mBean) {
|
||||
if (EntaxyRuntimeObjectMBean.class.isAssignableFrom(mBean.getMBeanClass())) {
|
||||
EntaxyRuntimeObjectMBeanInfo mBeanInfo = new EntaxyRuntimeObjectMBeanInfo(
|
||||
((EntaxyRuntimeObjectMBean) mBean).getRuntimeObject());
|
||||
mBeanInfo.createHolder((EntaxyRuntimeObjectMBean) mBean);
|
||||
return mBeanInfo;
|
||||
} else {
|
||||
EntaxyRuntimeObjectContainerMBeanInfo mBeanInfo = new EntaxyRuntimeObjectContainerMBeanInfo();
|
||||
mBeanInfo.createHolder((EntaxyRuntimeObjectContainerMBean) mBean);
|
||||
return mBeanInfo;
|
||||
}
|
||||
}
|
||||
|
||||
public static String calculateJmxObjectName(EntaxyRuntimeItemMBean mbean) {
|
||||
return calculateJmxObjectName(mbean, EntaxyRuntimeItemMBean.JMX_SUBPATH_QUALIFIER);
|
||||
}
|
||||
|
||||
public static String calculateJmxObjectName(EntaxyRuntimeItemMBean mbean, String subPathQualifier) {
|
||||
String finalName = mbean.getJMXSubQualifier();
|
||||
EntaxyRuntimeItemMBean currentMbean = mbean.getParentMBean();
|
||||
String parentSubPath = mbean.getParentSubPath();
|
||||
|
||||
String levelPlaceholderConstant = "@LEVEL@";
|
||||
|
||||
finalName = finalName.replace(EntaxyRuntimeItemMBean.JMX_SUBQUALIFIER_AUTO,
|
||||
subPathQualifier.concat("_").concat(levelPlaceholderConstant));
|
||||
|
||||
while (currentMbean != null) {
|
||||
String newName = currentMbean.getJMXSubQualifier();
|
||||
if (CommonUtils.isValid(parentSubPath)) {
|
||||
// we must create unique, but idempotent set of keys
|
||||
// as a key we'll use subPathQualifier with level index
|
||||
String subpath = Arrays.asList(parentSubPath.split("/"))
|
||||
.stream()
|
||||
.map(s -> subPathQualifier.concat("_").concat(levelPlaceholderConstant).concat("=").concat(s))
|
||||
.collect(Collectors.joining(","));
|
||||
if (CommonUtils.isValid(subpath))
|
||||
newName = newName.concat(",").concat(subpath);
|
||||
}
|
||||
|
||||
finalName = newName.concat(",").concat(finalName);
|
||||
parentSubPath = currentMbean.getParentSubPath();
|
||||
currentMbean = currentMbean.getParentMBean();
|
||||
}
|
||||
|
||||
// replace placeholder with overall level value
|
||||
String[] splitted = finalName.split(",");
|
||||
for (int i = 0; i < splitted.length; i++) {
|
||||
splitted[i] = splitted[i].replace(levelPlaceholderConstant, "" + i);
|
||||
}
|
||||
finalName = Arrays.asList(splitted).stream().collect(Collectors.joining(","));
|
||||
|
||||
return finalName;
|
||||
}
|
||||
|
||||
public static String addNamespace(String qualifier) {
|
||||
if (qualifier.contains(":"))
|
||||
return qualifier;
|
||||
return ManagementCore.ENTAXY_JMX_DOMAIN.concat(":").concat(qualifier);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object.shell;
|
||||
|
||||
import org.apache.karaf.shell.api.action.lifecycle.Reference;
|
||||
|
||||
import ru.entaxy.platform.core.management.object.impl.EntaxyRuntimeObjectMBeanManager;
|
||||
|
||||
public class EntaxyRuntimeObjectMBeanManagerSupport {
|
||||
|
||||
public static final String COMMAND_SCOPE = "entaxy";
|
||||
|
||||
@Reference
|
||||
public EntaxyRuntimeObjectMBeanManager mBeanManager;
|
||||
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object.shell;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Action;
|
||||
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.core.management.object.EntaxyRuntimeObjectMBeanFactory;
|
||||
|
||||
@Service
|
||||
@Command(scope = EntaxyRuntimeObjectMBeanManagerSupport.COMMAND_SCOPE, name = "object-mbean-factory-list")
|
||||
public class ListMBeanFactories extends EntaxyRuntimeObjectMBeanManagerSupport implements Action {
|
||||
|
||||
@Override
|
||||
public Object execute() throws Exception {
|
||||
ShellTableFixed shellTable = new ShellTableFixed();
|
||||
shellTable.column("Id");
|
||||
shellTable.column("Supported types");
|
||||
|
||||
for (EntaxyRuntimeObjectMBeanFactory factory : new HashSet<>(mBeanManager.getFactoriesMap().values())) {
|
||||
shellTable.addRow().addContent(
|
||||
factory.getId(),
|
||||
factory.getSupportedTypes().stream().collect(Collectors.joining("\n")));
|
||||
}
|
||||
|
||||
shellTable.print(System.out);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* object-management
|
||||
* ==========
|
||||
* 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.core.management.object.shell;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import org.apache.karaf.shell.api.action.Action;
|
||||
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.core.management.object.impl.EntaxyRuntimeItemMBeanInfo;
|
||||
import ru.entaxy.platform.core.management.object.impl.EntaxyRuntimeObjectMBeanInfo;
|
||||
|
||||
@Service
|
||||
@Command(scope = EntaxyRuntimeObjectMBeanManagerSupport.COMMAND_SCOPE, name = "object-mbean-list")
|
||||
public class ListMBeans extends EntaxyRuntimeObjectMBeanManagerSupport implements Action {
|
||||
|
||||
@Override
|
||||
public Object execute() throws Exception {
|
||||
ShellTableFixed shellTable = new ShellTableFixed();
|
||||
shellTable.column("Object Id");
|
||||
shellTable.column("Type");
|
||||
shellTable.column("Class name");
|
||||
shellTable.column("Registered");
|
||||
shellTable.column("Parent Id");
|
||||
shellTable.column("Ghost");
|
||||
|
||||
Map<String, EntaxyRuntimeItemMBeanInfo<?>> map = mBeanManager.getInfoById();
|
||||
for (Entry<String, EntaxyRuntimeItemMBeanInfo<?>> entry : map.entrySet()) {
|
||||
|
||||
EntaxyRuntimeItemMBeanInfo<?> info = entry.getValue();
|
||||
|
||||
shellTable.addRow().addContent(
|
||||
entry.getKey(),
|
||||
info instanceof EntaxyRuntimeObjectMBeanInfo ? "OBJECT" : "CONTAINER",
|
||||
info.mbeanHolder.mbean == null ? "" : info.mbeanHolder.mbean.getClass().getName(),
|
||||
info.isRegistered() ? "*" : "",
|
||||
info.mbeanHolder.mbean == null ? ""
|
||||
: info.mbeanHolder.mbean.getParentMBean() == null ? ""
|
||||
: info.mbeanHolder.mbean.getParentMBean().getId(),
|
||||
info instanceof EntaxyRuntimeObjectMBeanInfo
|
||||
? ((EntaxyRuntimeObjectMBeanInfo) info).isGhost() ? "*" : ""
|
||||
: "");
|
||||
|
||||
}
|
||||
|
||||
shellTable.print(System.out);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.esb.platform.core.management.profile.helper;
|
||||
|
||||
import ru.entaxy.platform.core.management.profile.support.legacy.AccountManager;
|
||||
|
||||
public interface AccountHelper extends AccountManager {
|
||||
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.esb.platform.core.management.profile.helper;
|
||||
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.CollectionType;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.service.component.annotations.ReferencePolicy;
|
||||
import org.osgi.service.component.annotations.ReferencePolicyOption;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.platform.core.management.profile.NotBackwardCompatibleException;
|
||||
import ru.entaxy.platform.core.management.profile.support.legacy.AccountManager;
|
||||
|
||||
@Component(service = AccountHelper.class, immediate = true)
|
||||
public class AccountHelperImpl implements AccountHelper {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AccountHelperImpl.class);
|
||||
|
||||
protected AccountManager accountManager = null;
|
||||
|
||||
protected AccountManager nullAccountManager = null;
|
||||
|
||||
@Activate
|
||||
public void activate() {
|
||||
this.nullAccountManager = new AccountManager() {
|
||||
|
||||
@Override
|
||||
public String getAccountForSystem(String systemUuid) throws Exception {
|
||||
throw new NotBackwardCompatibleException(Helpers.BACKWARD_COMPATIBILITY_DISABLED);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createAccountForSystem(String login, String password, String systemUUID, String createdBy,
|
||||
String editedBy) throws Exception {
|
||||
throw new NotBackwardCompatibleException(Helpers.BACKWARD_COMPATIBILITY_DISABLED);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
@Reference(collectionType = CollectionType.SERVICE, cardinality = ReferenceCardinality.OPTIONAL,
|
||||
policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY,
|
||||
service = AccountManager.class, unbind = "unsetAccountManager")
|
||||
public void setAccountManager(AccountManager accountManager) {
|
||||
this.accountManager = accountManager;
|
||||
}
|
||||
|
||||
public void unsetAccountManager(AccountManager accountManager) {
|
||||
this.accountManager = null;
|
||||
}
|
||||
|
||||
protected AccountManager getEffectiveAccountManager() {
|
||||
return accountManager != null ? accountManager : nullAccountManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAccountForSystem(String systemUuid) throws Exception {
|
||||
return getEffectiveAccountManager().getAccountForSystem(systemUuid);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createAccountForSystem(String login, String password, String systemUUID, String createdBy,
|
||||
String editedBy) throws Exception {
|
||||
getEffectiveAccountManager().createAccountForSystem(login, password, systemUUID, createdBy, editedBy);
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.esb.platform.core.management.profile.helper;
|
||||
|
||||
import ru.entaxy.platform.core.management.profile.support.legacy.ConnectorManager;
|
||||
|
||||
public interface ConnectorHelper extends ConnectorManager {
|
||||
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.esb.platform.core.management.profile.helper;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.CollectionType;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.service.component.annotations.ReferencePolicy;
|
||||
import org.osgi.service.component.annotations.ReferencePolicyOption;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.platform.core.management.profile.NotBackwardCompatibleException;
|
||||
import ru.entaxy.platform.core.management.profile.support.legacy.ConnectorManager;
|
||||
|
||||
@Component(service = ConnectorHelper.class, immediate = true)
|
||||
public class ConnectorHelperImpl implements ConnectorHelper {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ProfileHelperImpl.class);
|
||||
|
||||
protected static final String EXPLANATION = Helpers.BACKWARD_COMPATIBILITY_DISABLED;
|
||||
|
||||
protected ConnectorManager connectorManager = null;
|
||||
|
||||
protected ConnectorManager nullConnectorManager = null;
|
||||
|
||||
@Activate
|
||||
public void activate(ComponentContext componentContext) {
|
||||
this.nullConnectorManager = new ConnectorManager() {
|
||||
|
||||
@Override
|
||||
public void stopConnector(String idOrName, String connectorName) throws Exception {
|
||||
throw new NotBackwardCompatibleException(EXPLANATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startConnector(String idOrName, String connectorName) throws Exception {
|
||||
throw new NotBackwardCompatibleException(EXPLANATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeConnector(String idOrName, String connectorName) throws Exception {
|
||||
throw new NotBackwardCompatibleException(EXPLANATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConnector(String idOrName, String connectorFactoryId, Map<String, String> parameters)
|
||||
throws Exception {
|
||||
throw new NotBackwardCompatibleException(EXPLANATION);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public ConnectorManager getEffectiveConnectorManager() {
|
||||
return connectorManager != null ? connectorManager : nullConnectorManager;
|
||||
}
|
||||
|
||||
@Reference(collectionType = CollectionType.SERVICE, cardinality = ReferenceCardinality.OPTIONAL,
|
||||
policyOption = ReferencePolicyOption.GREEDY, policy = ReferencePolicy.DYNAMIC,
|
||||
service = ConnectorManager.class,
|
||||
unbind = "unsetConnectorManager")
|
||||
public void setConnectorManager(ConnectorManager connectorManager) {
|
||||
this.connectorManager = connectorManager;
|
||||
log.debug(">> ConnectorManager is bound");
|
||||
}
|
||||
|
||||
public void unsetConnectorManager(ConnectorManager connectorManager) {
|
||||
this.connectorManager = null;
|
||||
log.debug(">> ConnectorManager is unbound");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addConnector(String idOrName, String connectorFactoryId, Map<String, String> parameters)
|
||||
throws Exception {
|
||||
getEffectiveConnectorManager().addConnector(idOrName, connectorFactoryId, parameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeConnector(String idOrName, String connectorName) throws Exception {
|
||||
getEffectiveConnectorManager().removeConnector(idOrName, connectorName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startConnector(String idOrName, String connectorName) throws Exception {
|
||||
getEffectiveConnectorManager().startConnector(idOrName, connectorName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopConnector(String idOrName, String connectorName) throws Exception {
|
||||
getEffectiveConnectorManager().stopConnector(idOrName, connectorName);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,68 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.esb.platform.core.management.profile.helper;
|
||||
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.service.component.annotations.ReferencePolicy;
|
||||
import org.osgi.service.component.annotations.ReferencePolicyOption;
|
||||
|
||||
import ru.entaxy.platform.base.objects.EntaxyObjectService;
|
||||
|
||||
@Component(service = Helpers.class, immediate = true)
|
||||
public class Helpers {
|
||||
|
||||
public static final String BACKWARD_COMPATIBILITY_DISABLED =
|
||||
"You're calling deprecated API, to use it backward compatibility modules must be installed";
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC,
|
||||
policyOption = ReferencePolicyOption.GREEDY)
|
||||
volatile public ProfileHelper profileHelper;
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC,
|
||||
policyOption = ReferencePolicyOption.GREEDY)
|
||||
volatile public ConnectorHelper connectorHelper;
|
||||
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC,
|
||||
policyOption = ReferencePolicyOption.GREEDY)
|
||||
volatile public PermissionHelper permissionHelper;
|
||||
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC,
|
||||
policyOption = ReferencePolicyOption.GREEDY)
|
||||
volatile public EntaxyObjectService entaxyObjectService;
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC,
|
||||
policyOption = ReferencePolicyOption.GREEDY)
|
||||
volatile public SystemHelper systemHelper;
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC,
|
||||
policyOption = ReferencePolicyOption.GREEDY)
|
||||
volatile public AccountHelper accountHelper;
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.esb.platform.core.management.profile.helper;
|
||||
|
||||
import ru.entaxy.platform.core.management.profile.support.legacy.PermissionManager;
|
||||
|
||||
public interface PermissionHelper extends PermissionManager {
|
||||
|
||||
}
|
@ -0,0 +1,108 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.esb.platform.core.management.profile.helper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.CollectionType;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.service.component.annotations.ReferencePolicyOption;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.platform.core.management.profile.NotBackwardCompatibleException;
|
||||
import ru.entaxy.platform.core.management.profile.support.legacy.PermissionManager;
|
||||
|
||||
@Component(service = PermissionHelper.class, immediate = true)
|
||||
public class PermissionHelperImpl implements PermissionHelper {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(PermissionHelperImpl.class);
|
||||
|
||||
protected static final String EXPLANATION = Helpers.BACKWARD_COMPATIBILITY_DISABLED;
|
||||
|
||||
protected PermissionManager permissionManager = null;
|
||||
|
||||
protected PermissionManager nullPermissionManager = null;
|
||||
|
||||
@Activate
|
||||
public void activate(ComponentContext componentContext) {
|
||||
this.nullPermissionManager = new PermissionManager() {
|
||||
|
||||
@Override
|
||||
public List<String> getSubjectPermissions(String subjectId) throws Exception {
|
||||
throw new NotBackwardCompatibleException(EXPLANATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getObjectPermissions(String objectId) throws Exception {
|
||||
throw new NotBackwardCompatibleException(EXPLANATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createPermission(String objectId, String subjectId) throws Exception {
|
||||
throw new NotBackwardCompatibleException(EXPLANATION);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public PermissionManager getEffectivePermissionManager() {
|
||||
return this.permissionManager != null ? this.permissionManager : this.nullPermissionManager;
|
||||
}
|
||||
|
||||
@Reference(collectionType = CollectionType.SERVICE, cardinality = ReferenceCardinality.OPTIONAL,
|
||||
policyOption = ReferencePolicyOption.GREEDY, service = PermissionManager.class,
|
||||
unbind = "unsetPermissionManager")
|
||||
public void setPermissionManager(PermissionManager permissionManager) {
|
||||
this.permissionManager = permissionManager;
|
||||
log.debug(">> PermissionManager is bound");
|
||||
}
|
||||
|
||||
public void unsetPermissionManager(PermissionManager permissionManager) {
|
||||
this.permissionManager = null;
|
||||
log.debug(">> PermissionManager is unbound");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> getObjectPermissions(String objectId) throws Exception {
|
||||
return getEffectivePermissionManager().getObjectPermissions(objectId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getSubjectPermissions(String subjectId) throws Exception {
|
||||
return getEffectivePermissionManager().getSubjectPermissions(subjectId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createPermission(String objectId, String subjectId) throws Exception {
|
||||
getEffectivePermissionManager().createPermission(objectId, subjectId);
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.esb.platform.core.management.profile.helper;
|
||||
|
||||
import ru.entaxy.platform.core.management.profile.support.legacy.ProfileManager;
|
||||
|
||||
public interface ProfileHelper extends ProfileManager {
|
||||
|
||||
}
|
@ -0,0 +1,133 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.esb.platform.core.management.profile.helper;
|
||||
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.CollectionType;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.service.component.annotations.ReferencePolicy;
|
||||
import org.osgi.service.component.annotations.ReferencePolicyOption;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.platform.core.management.profile.NotBackwardCompatibleException;
|
||||
import ru.entaxy.platform.core.management.profile.support.legacy.ProfileManager;
|
||||
|
||||
@Component(service = {ProfileHelper.class},
|
||||
immediate = true)
|
||||
public class ProfileHelperImpl implements ProfileHelper {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ProfileHelperImpl.class);
|
||||
|
||||
protected static final String EXPLANATION = Helpers.BACKWARD_COMPATIBILITY_DISABLED;
|
||||
|
||||
protected ProfileManager profileManager = null;
|
||||
|
||||
protected ProfileManager nullProfileManager = null;
|
||||
|
||||
@Activate
|
||||
public void activate(ComponentContext componentContext) {
|
||||
|
||||
this.nullProfileManager = new ProfileManager() {
|
||||
|
||||
@Override
|
||||
public void uninstallProfile(String idOrName) throws Exception {
|
||||
throw new NotBackwardCompatibleException(EXPLANATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopProfile(String idOrName) throws Exception {
|
||||
throw new NotBackwardCompatibleException(EXPLANATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startProfile(String idOrName) throws Exception {
|
||||
throw new NotBackwardCompatibleException(EXPLANATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createProfile(String id, String name, String description) throws Exception {
|
||||
throw new NotBackwardCompatibleException(EXPLANATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProfileConfig(String idOrName) throws Exception {
|
||||
throw new NotBackwardCompatibleException(EXPLANATION);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ProfileManager getEffectiveProfileManager() {
|
||||
return profileManager != null ? profileManager : nullProfileManager;
|
||||
}
|
||||
|
||||
@Reference(collectionType = CollectionType.SERVICE, cardinality = ReferenceCardinality.OPTIONAL,
|
||||
policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY,
|
||||
service = ProfileManager.class, unbind = "unsetProfileManager")
|
||||
public void setProfileManager(ProfileManager profileManager) {
|
||||
this.profileManager = profileManager;
|
||||
log.debug(">> ProfileManager is bound");
|
||||
}
|
||||
|
||||
public void unsetProfileManager(ProfileManager profileManager) {
|
||||
this.profileManager = null;
|
||||
log.debug(">> ProfileManager is unbound");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void createProfile(String id, String name, String description) throws Exception {
|
||||
getEffectiveProfileManager().createProfile(id, name, description);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProfileConfig(String idOrName) throws Exception {
|
||||
return getEffectiveProfileManager().getProfileConfig(idOrName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startProfile(String idOrName) throws Exception {
|
||||
getEffectiveProfileManager().startProfile(idOrName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopProfile(String idOrName) throws Exception {
|
||||
getEffectiveProfileManager().stopProfile(idOrName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstallProfile(String idOrName) throws Exception {
|
||||
getEffectiveProfileManager().uninstallProfile(idOrName);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.esb.platform.core.management.profile.helper;
|
||||
|
||||
import ru.entaxy.platform.core.management.profile.support.legacy.SystemManager;
|
||||
|
||||
public interface SystemHelper extends SystemManager {
|
||||
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.esb.platform.core.management.profile.helper;
|
||||
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.CollectionType;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.service.component.annotations.ReferencePolicy;
|
||||
import org.osgi.service.component.annotations.ReferencePolicyOption;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.platform.core.management.profile.NotBackwardCompatibleException;
|
||||
import ru.entaxy.platform.core.management.profile.support.legacy.SystemManager;
|
||||
|
||||
@Component(service = SystemHelper.class, immediate = true)
|
||||
public class SystemHelperImpl implements SystemHelper {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(SystemHelperImpl.class);
|
||||
|
||||
protected SystemManager systemManager = null;
|
||||
|
||||
protected SystemManager nullSystemManager = null;
|
||||
|
||||
@Activate
|
||||
public void activate() {
|
||||
this.nullSystemManager = new SystemManager() {
|
||||
|
||||
@Override
|
||||
public String getUUIDbyName(String name) throws Exception {
|
||||
throw new NotBackwardCompatibleException(Helpers.BACKWARD_COMPATIBILITY_DISABLED);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Reference(collectionType = CollectionType.SERVICE, cardinality = ReferenceCardinality.OPTIONAL,
|
||||
policy = ReferencePolicy.DYNAMIC, policyOption = ReferencePolicyOption.GREEDY,
|
||||
service = SystemManager.class, unbind = "unsetSystemManager")
|
||||
public void setSystemManager(SystemManager systemManager) {
|
||||
this.systemManager = systemManager;
|
||||
}
|
||||
|
||||
public void unsetSystemManager(SystemManager systemManager) {
|
||||
this.systemManager = null;
|
||||
}
|
||||
|
||||
protected SystemManager getEffectiveSystemManager() {
|
||||
return systemManager != null ? systemManager : nullSystemManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUUIDbyName(String name) throws Exception {
|
||||
return getEffectiveSystemManager().getUUIDbyName(name);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Attribute;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Operation;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBean;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
|
||||
public interface ConnectorMBean extends EntaxyRuntimeObjectMBean {
|
||||
|
||||
public static final String CAPABILITY_NAMESPACE = "entaxy.runtime.connector";
|
||||
|
||||
public static final String CONNECTOR_KEY = "connector";
|
||||
|
||||
public static final String CONNECTOR_KEY_VALUE_DEFAULT = "default";
|
||||
|
||||
// TODO implement if needed
|
||||
// public boolean isDefault();
|
||||
|
||||
@Attribute(desc = "Connector name")
|
||||
default String getName() {
|
||||
return getObjectId();
|
||||
};
|
||||
|
||||
@Attribute(desc = "Connector registered name used in registry")
|
||||
public String getRegisteredName();
|
||||
|
||||
@Attribute(desc = "Connector system")
|
||||
public String getSystem();
|
||||
|
||||
@Attribute(desc = "Connector classifier")
|
||||
public String getClassifier();
|
||||
|
||||
@Attribute(desc = "Connector display name")
|
||||
public String getDisplayName();
|
||||
|
||||
@Attribute(desc = "Connector direction")
|
||||
public String getDirection();
|
||||
|
||||
@Attribute(desc = "Connector protocol")
|
||||
public String getProtocol();
|
||||
|
||||
@Operation(desc = "Starts the connector")
|
||||
public void start() throws Exception;
|
||||
|
||||
@Operation(desc = "Stops the connector")
|
||||
public void stop() throws Exception;
|
||||
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Operation;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBean;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
|
||||
public interface DefaultRouteMBean extends EntaxyRuntimeObjectMBean {
|
||||
|
||||
public static interface Helper {
|
||||
|
||||
public static Qualifier getQualifier(String profileName) {
|
||||
return RoutesMBean.Helper.getQualifier(profileName).qualifier(ROUTE_KEY, ROUTE_KEY_VALUE_DEFAULT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static final String CAPABILITY_NAMESPACE = "entaxy.runtime.default-route";
|
||||
|
||||
public static final String ROUTE_KEY = "route";
|
||||
|
||||
public static final String ROUTE_KEY_VALUE_DEFAULT = "default";
|
||||
|
||||
default boolean isDefault() {
|
||||
return true;
|
||||
};
|
||||
|
||||
@Deprecated(since = "1.10", forRemoval = true)
|
||||
@Operation(desc = "Gets route's configuration")
|
||||
default public String doGetRouteConfig() throws Exception {
|
||||
return readConfiguration();
|
||||
};
|
||||
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile;
|
||||
|
||||
import javax.naming.OperationNotSupportedException;
|
||||
|
||||
public class NotBackwardCompatibleException extends OperationNotSupportedException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public NotBackwardCompatibleException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public NotBackwardCompatibleException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
@ -0,0 +1,135 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.management.MBeanOperationInfo;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Attribute;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Operation;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Parameter;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBean;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
|
||||
public interface ProfileMBean extends EntaxyRuntimeObjectMBean {
|
||||
|
||||
public static interface Helper {
|
||||
|
||||
public static Qualifier getQualifier(String name) {
|
||||
return ProfilesMBean.Q_PROFILES.qualifier(PROFILE_KEY, name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final String CAPABILITY_NAMESPACE = "entaxy.runtime.profile";
|
||||
|
||||
public static final String PROFILE_KEY = "profile";
|
||||
|
||||
@Attribute
|
||||
default public String getName() {
|
||||
return getObjectId();
|
||||
};
|
||||
|
||||
@Attribute
|
||||
public String getDescription();
|
||||
|
||||
@Deprecated(since = "1.10", forRemoval = true)
|
||||
@Attribute
|
||||
default public String getBasicAuthAccount() {
|
||||
return "";
|
||||
};
|
||||
|
||||
@Deprecated(since = "1.10", forRemoval = true)
|
||||
@Attribute
|
||||
default public String getUuid() {
|
||||
return getObjectId();
|
||||
};
|
||||
|
||||
@Deprecated(since = "1.10", forRemoval = true)
|
||||
@Attribute(desc = "Systems the current can send messages to")
|
||||
default public List<String> getAllowedTargets() {
|
||||
return Collections.emptyList();
|
||||
};
|
||||
|
||||
@Deprecated(since = "1.10", forRemoval = true)
|
||||
@Attribute(desc = "Systems the current can receive messages from")
|
||||
default public List<String> getAllowedSources() {
|
||||
return Collections.emptyList();
|
||||
};
|
||||
|
||||
@Deprecated(since = "1.10", forRemoval = true)
|
||||
@Operation(desc = "Adds connector to profile")
|
||||
public void addConnector(
|
||||
@Parameter(name = "factoryId", desc = "Connector factory ID") String connectorFactoryId,
|
||||
@Parameter(name = "parameters", desc = "Connector parameters") Map<String, String> parameters)
|
||||
throws Exception;
|
||||
|
||||
@Deprecated(since = "1.10", forRemoval = true)
|
||||
@Operation(desc = "Removes connector from profile")
|
||||
public void removeConnector(
|
||||
@Parameter(name = "connectorName", desc = "Connector name") String connectorName) throws Exception;
|
||||
|
||||
@Deprecated(since = "1.10", forRemoval = true)
|
||||
@Operation(desc = "Starts connector in profile")
|
||||
public void startConnector(
|
||||
@Parameter(name = "connectorName", desc = "Connector name") String connectorName) throws Exception;
|
||||
|
||||
@Deprecated(since = "1.10", forRemoval = true)
|
||||
@Operation(desc = "Stops connector in profile")
|
||||
public void stopConnector(
|
||||
@Parameter(name = "connectorName", desc = "Connector name") String connectorName) throws Exception;
|
||||
|
||||
@Deprecated(since = "1.10", forRemoval = true)
|
||||
@Operation(desc = "Gets connector's configuration")
|
||||
public String getConnectorConfig(
|
||||
@Parameter(name = "connectorName", desc = "Connector name") String connectorName) throws Exception;
|
||||
|
||||
@Deprecated(since = "1.10", forRemoval = true)
|
||||
@Operation(desc = "Creates account for this system", impact = MBeanOperationInfo.ACTION)
|
||||
default public void createAccount(
|
||||
@Parameter(name = "login", desc = "Login") String login,
|
||||
@Parameter(name = "password", desc = "Password") String password) throws Exception {};
|
||||
|
||||
@Deprecated(since = "1.10", forRemoval = true)
|
||||
@Operation(desc = "Allow this system to send messages to other system")
|
||||
default public void allowTarget(
|
||||
@Parameter(name = "targetIdOrName", desc = "Target system Id or Name") String idOrName) throws Exception {
|
||||
|
||||
};
|
||||
|
||||
@Deprecated(since = "1.10", forRemoval = true)
|
||||
@Operation(desc = "Allow this system to receive messages from other system")
|
||||
default public void allowSource(
|
||||
@Parameter(name = "sourceIdOrName", desc = "Source system Id or Name") String idOrName) throws Exception {
|
||||
|
||||
};
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.ManagementCore;
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectContainerMBean;
|
||||
import ru.entaxy.platform.core.management.profile.support.legacy.ProfileManager;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
|
||||
public interface ProfilesMBean extends EntaxyRuntimeObjectContainerMBean, ProfileManager {
|
||||
|
||||
public static final String CAPABILITY_NAMESPACE_DEFAULT_ROUTE = "entaxy.runtime.default-route";
|
||||
|
||||
public static final String PROFILES_KEY = "category";
|
||||
|
||||
public static final String PROFILES_KEY_VALUE = "profiles";
|
||||
|
||||
public static final Qualifier Q_PROFILES = ManagementCore.Q_RUNTIME
|
||||
.qualifier(ProfilesMBean.PROFILES_KEY, ProfilesMBean.PROFILES_KEY_VALUE);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
|
||||
public interface RoutesMBean {
|
||||
|
||||
public static interface Helper {
|
||||
public static Qualifier getQualifier(String profileName) {
|
||||
return ProfileMBean.Helper
|
||||
.getQualifier(profileName)
|
||||
.qualifier(ROUTES_KEY, ROUTES_KEY_VALUE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final String ROUTES_KEY = "section";
|
||||
public static final String ROUTES_KEY_VALUE = "routes";
|
||||
|
||||
}
|
@ -0,0 +1,79 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile.impl;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.service.component.annotations.ReferencePolicyOption;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.esb.platform.core.management.profile.helper.Helpers;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeItemMBean;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBean;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBeanFactory;
|
||||
import ru.entaxy.platform.core.management.object.MBeanFactory;
|
||||
import ru.entaxy.platform.core.management.object.factory.AbstractMBeanFactory;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
|
||||
|
||||
@MBeanFactory(id = "connector-factory", supportedTypes = {"entaxy.runtime.connector"})
|
||||
@Component(service = EntaxyRuntimeObjectMBeanFactory.class, immediate = true)
|
||||
public class ConnectorMBeanFactory extends AbstractMBeanFactory {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ConnectorMBeanFactory.class);
|
||||
|
||||
// @Reference(cardinality = ReferenceCardinality.MANDATORY, policyOption = ReferencePolicyOption.GREEDY)
|
||||
// ProfilesMBean profilesMBean;
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, policyOption = ReferencePolicyOption.GREEDY)
|
||||
Helpers helpers;
|
||||
|
||||
@Override
|
||||
public <T extends EntaxyRuntimeObjectMBean> T createMBean(EntaxyRuntimeObject entaxyRuntimeObject) {
|
||||
ConnectorMBeanImpl beanImpl;
|
||||
try {
|
||||
beanImpl = new ConnectorMBeanImpl(entaxyRuntimeObject, helpers);
|
||||
// beanImpl.setParentMBean(profilesMBean);
|
||||
} catch (NotCompliantMBeanException e) {
|
||||
log.error("Error creating ProfileMBeanImpl for [" + entaxyRuntimeObject.getObjectFullId() + "]", e);
|
||||
return null;
|
||||
}
|
||||
return (T) beanImpl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends EntaxyRuntimeItemMBean> createMBeans() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile.impl;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.EntaxyRuntimeTyped;
|
||||
import ru.entaxy.esb.platform.core.management.profile.helper.Helpers;
|
||||
import ru.entaxy.platform.core.management.object.ObjectMBean;
|
||||
import ru.entaxy.platform.core.management.object.factory.AbstractObjectMBean;
|
||||
import ru.entaxy.platform.core.management.profile.ConnectorMBean;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
|
||||
// @TODO move string to constant
|
||||
@EntaxyRuntimeTyped(name = "entaxy.runtime.connector")
|
||||
@ObjectMBean(subQualifierName = "connector")
|
||||
public class ConnectorMBeanImpl extends AbstractObjectMBean<ConnectorMBean> implements ConnectorMBean {
|
||||
|
||||
protected Helpers helpers;
|
||||
|
||||
public ConnectorMBeanImpl(EntaxyRuntimeObject entaxyRuntimeObject, Helpers helpers)
|
||||
throws NotCompliantMBeanException {
|
||||
super(ConnectorMBean.class, entaxyRuntimeObject);
|
||||
this.helpers = helpers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJMXSubQualifierValue() {
|
||||
return getObjectId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFactoryId() {
|
||||
return this.entaxyRuntimeObject.getAttributeOrDefault("templateId", super.getFactoryId()).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRegisteredName() {
|
||||
return this.entaxyRuntimeObject.getAttributeOrDefault("bundleName", "").toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSystem() {
|
||||
return this.entaxyRuntimeObject.getAttributeOrDefault("system", "").toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getClassifier() {
|
||||
return this.entaxyRuntimeObject.getAttributeOrDefault("classifier", "").toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return this.entaxyRuntimeObject.getAttributeOrDefault("displayName", getObjectId()).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDirection() {
|
||||
return this.entaxyRuntimeObject.getAttributeOrDefault("direction", getObjectId()).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProtocol() {
|
||||
return this.entaxyRuntimeObject.getAttributeOrDefault("protocol", getObjectId()).toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() throws Exception {
|
||||
this.helpers.connectorHelper.startConnector(getSystem(), this.getRegisteredName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() throws Exception {
|
||||
this.helpers.connectorHelper.stopConnector(getSystem(), this.getRegisteredName());
|
||||
}
|
||||
}
|
@ -0,0 +1,76 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile.impl;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.service.component.annotations.ReferencePolicyOption;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.esb.platform.core.management.profile.helper.Helpers;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeItemMBean;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBean;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBeanFactory;
|
||||
import ru.entaxy.platform.core.management.object.MBeanFactory;
|
||||
import ru.entaxy.platform.core.management.object.factory.AbstractMBeanFactory;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
|
||||
|
||||
@MBeanFactory(id = "default-route-factory", supportedTypes = {"entaxy.runtime.default-route"})
|
||||
@Component(service = EntaxyRuntimeObjectMBeanFactory.class, immediate = true)
|
||||
public class DefaultRouteMBeanFactory extends AbstractMBeanFactory {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(DefaultRouteMBeanFactory.class);
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, policyOption = ReferencePolicyOption.GREEDY)
|
||||
Helpers helpers;
|
||||
|
||||
@Override
|
||||
public <T extends EntaxyRuntimeObjectMBean> T createMBean(EntaxyRuntimeObject entaxyRuntimeObject) {
|
||||
DefaultRouteMBeanImpl beanImpl;
|
||||
try {
|
||||
beanImpl = new DefaultRouteMBeanImpl(entaxyRuntimeObject, helpers);
|
||||
// beanImpl.setParentMBean(profilesMBean);
|
||||
} catch (NotCompliantMBeanException e) {
|
||||
log.error("Error creating ProfileMBeanImpl for [" + entaxyRuntimeObject.getObjectFullId() + "]", e);
|
||||
return null;
|
||||
}
|
||||
return (T) beanImpl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends EntaxyRuntimeItemMBean> createMBeans() {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile.impl;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.EntaxyRuntimeTyped;
|
||||
import ru.entaxy.esb.platform.core.management.profile.helper.Helpers;
|
||||
import ru.entaxy.platform.core.management.object.ObjectMBean;
|
||||
import ru.entaxy.platform.core.management.object.factory.AbstractObjectMBean;
|
||||
import ru.entaxy.platform.core.management.profile.DefaultRouteMBean;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
|
||||
// @TODO move string to constant
|
||||
@EntaxyRuntimeTyped(name = "entaxy.runtime.default-route")
|
||||
@ObjectMBean(subQualifierName = "route")
|
||||
public class DefaultRouteMBeanImpl extends AbstractObjectMBean<DefaultRouteMBean> implements DefaultRouteMBean {
|
||||
|
||||
Helpers helpers;
|
||||
|
||||
public DefaultRouteMBeanImpl(EntaxyRuntimeObject entaxyRuntimeObject, Helpers helpers)
|
||||
throws NotCompliantMBeanException {
|
||||
super(DefaultRouteMBean.class, entaxyRuntimeObject);
|
||||
this.helpers = helpers;
|
||||
}
|
||||
|
||||
/**
|
||||
* methood is overridden for compatibility with current UI
|
||||
*
|
||||
* TODO: remove after the above is not actual
|
||||
*/
|
||||
@Override
|
||||
public String getJMXSubQualifierName() {
|
||||
return "route";
|
||||
}
|
||||
|
||||
/**
|
||||
* methood is overridden for compatibility with current UI
|
||||
*
|
||||
* TODO: remove after the above is not actual
|
||||
*/
|
||||
@Override
|
||||
public String getJMXSubQualifierValue() {
|
||||
return "default";
|
||||
}
|
||||
|
||||
/**
|
||||
* methood is overridden for compatibility with current UI
|
||||
*
|
||||
* TODO: remove after the above is not actual
|
||||
*/
|
||||
/*
|
||||
@Override
|
||||
public String getParentSubPath() {
|
||||
// TODO remove after the above is not actual
|
||||
return "";
|
||||
}
|
||||
*/
|
||||
|
||||
/**
|
||||
* methood is overridden for compatibility with current UI
|
||||
*
|
||||
* TODO: remove after the above is not actual
|
||||
*/
|
||||
/*
|
||||
@Override
|
||||
public String getJMXSubQualifier() {
|
||||
return "section=routes," + super.getJMXSubQualifier();
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
@ -0,0 +1,81 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile.impl;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.service.component.annotations.ReferencePolicy;
|
||||
import org.osgi.service.component.annotations.ReferencePolicyOption;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.esb.platform.core.management.profile.helper.Helpers;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeItemMBean;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBean;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBeanFactory;
|
||||
import ru.entaxy.platform.core.management.object.MBeanFactory;
|
||||
import ru.entaxy.platform.core.management.object.factory.AbstractMBeanFactory;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
|
||||
|
||||
@MBeanFactory(id = "profile-factory", supportedTypes = {"entaxy.runtime.profile"})
|
||||
@Component(service = EntaxyRuntimeObjectMBeanFactory.class, immediate = true)
|
||||
public class ProfileMBeanFactory extends AbstractMBeanFactory {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ProfileMBeanFactory.class);
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY)
|
||||
ProfilesMBeanImpl profilesMBean;
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, policy = ReferencePolicy.DYNAMIC,
|
||||
policyOption = ReferencePolicyOption.GREEDY)
|
||||
volatile Helpers helpers;
|
||||
|
||||
@Override
|
||||
public <T extends EntaxyRuntimeObjectMBean> T createMBean(EntaxyRuntimeObject entaxyRuntimeObject) {
|
||||
ProfileMBeanImpl beanImpl;
|
||||
try {
|
||||
beanImpl = new ProfileMBeanImpl(entaxyRuntimeObject, helpers);
|
||||
beanImpl.setParentMBean(profilesMBean);
|
||||
} catch (NotCompliantMBeanException e) {
|
||||
log.error("Error creating ProfileMBeanImpl for [" + entaxyRuntimeObject.getObjectFullId() + "]", e);
|
||||
return null;
|
||||
}
|
||||
return (T) beanImpl;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<? extends EntaxyRuntimeItemMBean> createMBeans() {
|
||||
return Collections.singletonList(profilesMBean);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,188 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.EntaxyRuntimeTyped;
|
||||
import ru.entaxy.esb.platform.core.management.profile.helper.Helpers;
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
import ru.entaxy.platform.core.management.object.ObjectMBean;
|
||||
import ru.entaxy.platform.core.management.object.factory.AbstractObjectMBean;
|
||||
import ru.entaxy.platform.core.management.profile.NotBackwardCompatibleException;
|
||||
import ru.entaxy.platform.core.management.profile.ProfileMBean;
|
||||
import ru.entaxy.platform.objects.runtime.EntaxyRuntimeObject;
|
||||
|
||||
// @TODO move string to constant
|
||||
@EntaxyRuntimeTyped(name = "entaxy.runtime.profile")
|
||||
@ObjectMBean(subQualifierName = "profile")
|
||||
public class ProfileMBeanImpl extends AbstractObjectMBean<ProfileMBean> implements ProfileMBean {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ProfileMBeanImpl.class);
|
||||
|
||||
Helpers helpers;
|
||||
|
||||
// BundleContext bundleContext;
|
||||
|
||||
public ProfileMBeanImpl(EntaxyRuntimeObject entaxyRuntimeObject, /*
|
||||
* BundleContext bundleContext,
|
||||
*/
|
||||
Helpers helpers)
|
||||
throws NotCompliantMBeanException {
|
||||
super(ProfileMBean.class, entaxyRuntimeObject);
|
||||
// this.bundleContext = bundleContext;
|
||||
this.helpers = helpers;
|
||||
setJMXSubQualifierValue(entaxyRuntimeObject.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJMXSubQualifierName() {
|
||||
// TODO Auto-generated method stub
|
||||
return super.getJMXSubQualifierName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getJMXSubQualifierValue() {
|
||||
return getObjectId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return entaxyRuntimeObject.getAttributeOrDefault("name", "").toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return entaxyRuntimeObject.getAttributeOrDefault("name", "").toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Deprecated
|
||||
public String getUuid() {
|
||||
try {
|
||||
return internalGetUuid();
|
||||
} catch (Exception ignore) {
|
||||
} ;
|
||||
return getObjectId();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
protected String internalGetUuid() throws Exception {
|
||||
return helpers.systemHelper.getUUIDbyName(getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBasicAuthAccount() {
|
||||
try {
|
||||
return internalGetBasicAuthAccount();
|
||||
} catch (Exception ignore) {
|
||||
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
protected String internalGetBasicAuthAccount() throws Exception {
|
||||
return helpers.accountHelper.getAccountForSystem(internalGetUuid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createAccount(String login, String password) throws Exception {
|
||||
if (CommonUtils.isValid(getBasicAuthAccount()))
|
||||
throw new IllegalArgumentException("Account already exists");
|
||||
|
||||
// FIXME remove hardcoded
|
||||
this.helpers.accountHelper.createAccountForSystem(login, password, getUuid(), "admin", "admin");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConnector(String connectorFactoryId, Map<String, String> parameters) throws Exception {
|
||||
this.helpers.connectorHelper.addConnector(getName(), connectorFactoryId, parameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeConnector(String connectorName) throws Exception {
|
||||
this.helpers.connectorHelper.removeConnector(getName(), connectorName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startConnector(String connectorName) throws Exception {
|
||||
this.helpers.connectorHelper.startConnector(getName(), connectorName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopConnector(String connectorName) throws Exception {
|
||||
this.helpers.connectorHelper.stopConnector(getName(), connectorName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConnectorConfig(String connectorName) throws Exception {
|
||||
return helpers.entaxyObjectService.findObject(connectorName, "entaxy.runtime.connector").getConfiguration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAllowedTargets() {
|
||||
try {
|
||||
return helpers.permissionHelper.getObjectPermissions(internalGetUuid());
|
||||
} catch (NotBackwardCompatibleException ignore) {
|
||||
//
|
||||
} catch (Exception e) {
|
||||
log.warn("getAllowedTargets not succeded", e);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAllowedSources() {
|
||||
try {
|
||||
return helpers.permissionHelper.getSubjectPermissions(internalGetUuid());
|
||||
} catch (NotBackwardCompatibleException ignore) {
|
||||
//
|
||||
} catch (Exception e) {
|
||||
log.warn("getAllowedSources not succeded", e);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allowSource(String idOrName) throws Exception {
|
||||
helpers.permissionHelper.createPermission(idOrName, internalGetUuid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allowTarget(String idOrName) throws Exception {
|
||||
helpers.permissionHelper.createPermission(internalGetUuid(), idOrName);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile.impl;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.CollectionType;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Deactivate;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.service.component.annotations.ReferencePolicy;
|
||||
import org.osgi.service.component.annotations.ReferencePolicyOption;
|
||||
import org.osgi.service.component.annotations.ServiceScope;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.esb.platform.core.management.profile.helper.Helpers;
|
||||
import ru.entaxy.platform.core.management.object.ContainerMBean;
|
||||
import ru.entaxy.platform.core.management.object.factory.AbstractObjectContainerMBean;
|
||||
import ru.entaxy.platform.core.management.profile.ProfilesMBean;
|
||||
|
||||
@Component(service = {ProfilesMBeanImpl.class}, scope = ServiceScope.SINGLETON,
|
||||
immediate = true)
|
||||
@ContainerMBean(id = "profiles", subQualifierValue = "profiles")
|
||||
public class ProfilesMBeanImpl extends AbstractObjectContainerMBean<ProfilesMBean>
|
||||
implements ProfilesMBean {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ProfilesMBeanImpl.class);
|
||||
|
||||
protected BundleContext bundleContext;
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, service = Helpers.class,
|
||||
collectionType = CollectionType.SERVICE, policy = ReferencePolicy.DYNAMIC,
|
||||
policyOption = ReferencePolicyOption.GREEDY)
|
||||
volatile Helpers helpers;
|
||||
|
||||
public ProfilesMBeanImpl() throws NotCompliantMBeanException {
|
||||
super(ProfilesMBean.class);
|
||||
}
|
||||
|
||||
@Activate
|
||||
public void activate(ComponentContext componentContext) {
|
||||
this.bundleContext = componentContext.getBundleContext();
|
||||
|
||||
}
|
||||
|
||||
@Deactivate
|
||||
public void deactivate() {}
|
||||
|
||||
/*
|
||||
* ProfileManager implementation
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void createProfile(String id, String name, String description) throws Exception {
|
||||
this.helpers.profileHelper.createProfile(id, name, description);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProfileConfig(String idOrName) throws Exception {
|
||||
return this.helpers.entaxyObjectService.findObject(idOrName, "entaxy.runtime.profile").getConfiguration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startProfile(String idOrName) throws Exception {
|
||||
this.helpers.profileHelper.startProfile(idOrName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopProfile(String idOrName) throws Exception {
|
||||
this.helpers.profileHelper.stopProfile(idOrName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstallProfile(String idOrName) throws Exception {
|
||||
this.helpers.profileHelper.uninstallProfile(idOrName);
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile.support.legacy;
|
||||
|
||||
public interface AccountManager {
|
||||
|
||||
public String getAccountForSystem(String systemUuid) throws Exception;
|
||||
|
||||
public void createAccountForSystem(String login, String password, String systemUUID, String createdBy,
|
||||
String editedBy) throws Exception;
|
||||
|
||||
}
|
@ -0,0 +1,83 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile.support.legacy;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Attribute;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Operation;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.RuntimeTypedMBean;
|
||||
import ru.entaxy.esb.platform.base.management.core.utils.BundleAwareMBean;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATION_ENRICH)
|
||||
public interface ConnectorMBean extends BundleAwareMBean, RuntimeTypedMBean {
|
||||
|
||||
public static interface Helper {
|
||||
|
||||
public static Qualifier getQualifier(String profileName, String connectorName) {
|
||||
return ConnectorsMBean.Helper.getQualifier(profileName).qualifier(CONNECTOR_KEY, connectorName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final String CAPABILITY_NAMESPACE = "entaxy.runtime.connector";
|
||||
|
||||
public static final String CONNECTOR_KEY = "connector";
|
||||
|
||||
public static final String CONNECTOR_KEY_VALUE_DEFAULT = "default";
|
||||
|
||||
// TODO implement if needed
|
||||
// public boolean isDefault();
|
||||
|
||||
@Attribute(desc = "Factory ID used to create the connector")
|
||||
public String getFactoryId();
|
||||
|
||||
@Attribute(desc = "Connector name")
|
||||
public String getName();
|
||||
|
||||
@Attribute(desc = "Connector registered name used in registry")
|
||||
public String getRegisteredName();
|
||||
|
||||
@Attribute(desc = "Connector system")
|
||||
public String getSystem();
|
||||
|
||||
@Attribute(desc = "Connector classifier")
|
||||
public String getClassifier();
|
||||
|
||||
@Attribute(desc = "Connector display name")
|
||||
public String getDisplayName();
|
||||
|
||||
@Attribute(desc = "Connector direction")
|
||||
public String getDirection();
|
||||
|
||||
@Operation(desc = "Starts the connector")
|
||||
public void start() throws Exception;
|
||||
|
||||
@Operation(desc = "Stops the connector")
|
||||
public void stop() throws Exception;
|
||||
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile.support.legacy;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface ConnectorManager {
|
||||
|
||||
public void addConnector(String idOrName, String connectorFactoryId, Map<String, String> parameters) throws Exception;
|
||||
|
||||
public void removeConnector(String idOrName, String connectorName) throws Exception;
|
||||
|
||||
public void startConnector(String idOrName, String connectorName) throws Exception;
|
||||
|
||||
public void stopConnector(String idOrName, String connectorName) throws Exception;
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile.support.legacy;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
import ru.entaxy.platform.core.management.profile.ProfileMBean;
|
||||
|
||||
public interface ConnectorsMBean {
|
||||
public static interface Helper {
|
||||
public static Qualifier getQualifier(String profileName) {
|
||||
return ProfileMBean.Helper
|
||||
.getQualifier(profileName)
|
||||
.qualifier(CONNECTORS_KEY, CONNECTORS_KEY_VALUE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final String CONNECTORS_KEY = "section";
|
||||
public static final String CONNECTORS_KEY_VALUE = "connectors";
|
||||
|
||||
}
|
@ -0,0 +1,113 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile.support.legacy;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleEvent;
|
||||
import org.osgi.framework.wiring.BundleCapability;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.utils.ExtendedBundleTrackerCustomizer;
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
import ru.entaxy.platform.base.support.osgi.tracker.filter.BundleCapabilityFilter;
|
||||
|
||||
public class DeployedLegacyConnectorCustomizer extends ExtendedBundleTrackerCustomizer<List<ManagedLegacyConnector>> {
|
||||
|
||||
@Override
|
||||
protected List<ManagedLegacyConnector> createManagedObject(Bundle bundle, BundleEvent event,
|
||||
Map<String, List<?>> filterResults) {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<BundleCapability> capabilities =
|
||||
(List<BundleCapability>) filterResults.get(BundleCapabilityFilter.DEFAULT_FILTER_ID);
|
||||
if (capabilities == null)
|
||||
capabilities = new ArrayList<>();
|
||||
List<ManagedLegacyConnector> result = new ArrayList<>();
|
||||
|
||||
|
||||
for (BundleCapability capability : capabilities) {
|
||||
|
||||
// process only legacy connectors
|
||||
if (capability.getAttributes().containsKey("objectId")
|
||||
&& capability.getAttributes().containsKey("factory")) {
|
||||
// it's factory-based connector
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
Object val = capability.getAttributes().get("name");
|
||||
String name = val == null ? "" : val.toString();
|
||||
if (!CommonUtils.isValid(name))
|
||||
continue;
|
||||
val = capability.getAttributes().get("system");
|
||||
String system = val == null ? "" : val.toString();
|
||||
if (!CommonUtils.isValid(system))
|
||||
continue;
|
||||
|
||||
val = capability.getAttributes().get("templateId");
|
||||
String factoryId = val == null ? "" : val.toString();
|
||||
|
||||
val = capability.getAttributes().get("factory");
|
||||
factoryId = val == null ? factoryId : val.toString();
|
||||
|
||||
val = capability.getAttributes().get("bundleName");
|
||||
String registeredName = val == null ? "" : val.toString();
|
||||
|
||||
val = capability.getAttributes().get("classifier");
|
||||
String classifier = val == null ? "" : val.toString();
|
||||
|
||||
val = capability.getAttributes().get("displayName");
|
||||
String displayName;
|
||||
try {
|
||||
displayName =
|
||||
val == null ? "" : new String(val.toString().getBytes(StandardCharsets.ISO_8859_1), "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
displayName = val == null ? "" : val.toString();
|
||||
}
|
||||
|
||||
val = capability.getAttributes().get("direction");
|
||||
String direction = val == null ? "" : val.toString();
|
||||
|
||||
|
||||
ManagedLegacyConnector mc = (new ManagedLegacyConnector())
|
||||
.name(name)
|
||||
.system(system)
|
||||
.factoryId(factoryId)
|
||||
.registeredName(registeredName)
|
||||
.classifier(classifier)
|
||||
.displayName(displayName)
|
||||
.direction(direction);
|
||||
enrich(bundle, event, filterResults, mc);
|
||||
result.add(mc);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,94 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile.support.legacy;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.EntaxyRuntimeTyped;
|
||||
import ru.entaxy.esb.platform.base.management.core.utils.BundleAwareMBeanImpl;
|
||||
import ru.entaxy.esb.platform.core.management.profile.helper.Helpers;
|
||||
|
||||
// @TODO move string to constant
|
||||
@EntaxyRuntimeTyped(name = "entaxy.runtime.connector")
|
||||
public class LegacyConnectorMBeanImpl extends BundleAwareMBeanImpl<ManagedLegacyConnector, ConnectorMBean>
|
||||
implements ConnectorMBean {
|
||||
|
||||
protected Helpers helpers;
|
||||
|
||||
public LegacyConnectorMBeanImpl(BundleContext bundleContext, ManagedLegacyConnector managedObject, Helpers helpers)
|
||||
throws NotCompliantMBeanException {
|
||||
super(ConnectorMBean.class, managedObject);
|
||||
this.bundleContext = bundleContext;
|
||||
this.helpers = helpers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFactoryId() {
|
||||
return this.managedObject.getFactoryId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.managedObject.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRegisteredName() {
|
||||
return this.managedObject.getRegisteredName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSystem() {
|
||||
return this.managedObject.getSystem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getClassifier() {
|
||||
return this.managedObject.getClassifier();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return this.managedObject.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDirection() {
|
||||
return this.managedObject.getDirection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() throws Exception {
|
||||
this.helpers.connectorHelper.startConnector(this.managedObject.getSystem(), this.getRegisteredName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() throws Exception {
|
||||
this.helpers.connectorHelper.stopConnector(this.managedObject.getSystem(), this.getRegisteredName());
|
||||
}
|
||||
}
|
@ -0,0 +1,72 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile.support.legacy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.CollectionType;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.util.tracker.BundleTracker;
|
||||
|
||||
import ru.entaxy.esb.platform.core.management.profile.helper.Helpers;
|
||||
import ru.entaxy.platform.base.support.osgi.tracker.BundleTrackerUtils;
|
||||
import ru.entaxy.platform.base.support.osgi.tracker.filter.BundleCapabilityFilter;
|
||||
|
||||
@Component(service = LegacyConnectorManager.class, immediate = true)
|
||||
public class LegacyConnectorManager {
|
||||
|
||||
public static final String CAPABILITY_NAMESPACE = "entaxy.runtime.connector";
|
||||
|
||||
protected BundleTracker<List<ManagedLegacyConnector>> connectorTracker;
|
||||
|
||||
protected BundleContext bundleContext;
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY, service = Helpers.class,
|
||||
collectionType = CollectionType.SERVICE)
|
||||
Helpers helpers;
|
||||
|
||||
@Activate
|
||||
public void activate(ComponentContext componentContext) {
|
||||
this.bundleContext = componentContext.getBundleContext();
|
||||
connectorTracker = BundleTrackerUtils.<List<ManagedLegacyConnector>>createBuilder()
|
||||
.customizer(
|
||||
(new DeployedLegacyConnectorCustomizer())
|
||||
.listener(new ManagedLegacyConnectorsListener(bundleContext, this.helpers)))
|
||||
.addFilter(
|
||||
(new BundleCapabilityFilter()).namespace(CAPABILITY_NAMESPACE))
|
||||
.bundleContext(bundleContext)
|
||||
.bundleState(Bundle.ACTIVE | Bundle.INSTALLED | Bundle.RESOLVED | Bundle.STARTING | Bundle.STOPPING)
|
||||
.get();
|
||||
connectorTracker.open();
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile.support.legacy;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.utils.BundleAwareManagedObjectImpl;
|
||||
|
||||
public class ManagedLegacyConnector extends BundleAwareManagedObjectImpl {
|
||||
|
||||
protected String system;
|
||||
|
||||
protected String name;
|
||||
|
||||
protected String registeredName;
|
||||
|
||||
protected String factoryId;
|
||||
|
||||
protected String classifier;
|
||||
|
||||
protected String displayName;
|
||||
|
||||
protected String direction;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public ManagedLegacyConnector name(String name) {
|
||||
setName(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSystem() {
|
||||
return system;
|
||||
}
|
||||
|
||||
public void setSystem(String system) {
|
||||
this.system = system;
|
||||
}
|
||||
|
||||
public ManagedLegacyConnector system(String system) {
|
||||
setSystem(system);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFactoryId() {
|
||||
return factoryId;
|
||||
}
|
||||
|
||||
public void setFactoryId(String factoryId) {
|
||||
this.factoryId = factoryId;
|
||||
}
|
||||
|
||||
public ManagedLegacyConnector factoryId(String factoryIdValue) {
|
||||
this.setFactoryId(factoryIdValue);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRegisteredName() {
|
||||
return registeredName;
|
||||
}
|
||||
|
||||
public void setRegisteredName(String registeredName) {
|
||||
this.registeredName = registeredName;
|
||||
};
|
||||
|
||||
public ManagedLegacyConnector registeredName(String registeredNameValue) {
|
||||
this.setRegisteredName(registeredNameValue);
|
||||
return this;
|
||||
};
|
||||
|
||||
public String getClassifier() {
|
||||
return classifier;
|
||||
}
|
||||
|
||||
public void setClassifier(String classifier) {
|
||||
this.classifier = classifier;
|
||||
}
|
||||
|
||||
public ManagedLegacyConnector classifier(String classifierValue) {
|
||||
this.setClassifier(classifierValue);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public void setDisplayName(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public ManagedLegacyConnector displayName(String displayNameValue) {
|
||||
this.setDisplayName(displayNameValue);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getDirection() {
|
||||
return direction;
|
||||
}
|
||||
|
||||
public void setDirection(String direction) {
|
||||
this.direction = direction;
|
||||
}
|
||||
|
||||
public ManagedLegacyConnector direction(String directionValue) {
|
||||
this.setDirection(directionValue);
|
||||
return this;
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile.support.legacy;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.utils.ManagedObjectsListener;
|
||||
import ru.entaxy.esb.platform.core.management.profile.helper.Helpers;
|
||||
|
||||
public class ManagedLegacyConnectorsListener extends
|
||||
ManagedObjectsListener<List<ManagedLegacyConnector>, ManagedLegacyConnector, ConnectorMBean, LegacyConnectorMBeanImpl> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ManagedLegacyConnectorsListener.class);
|
||||
|
||||
protected Helpers helpers;
|
||||
|
||||
public ManagedLegacyConnectorsListener(BundleContext bundleContext, Helpers helpers) {
|
||||
super(bundleContext, ConnectorMBean.class);
|
||||
this.helpers = helpers;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterator<ManagedLegacyConnector> getIterator(List<ManagedLegacyConnector> managedObject) {
|
||||
return managedObject.iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getKeyValue(ManagedLegacyConnector object) {
|
||||
return object.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected LegacyConnectorMBeanImpl createService(ManagedLegacyConnector managedObject) {
|
||||
try {
|
||||
return new LegacyConnectorMBeanImpl(bundleContext, managedObject, helpers);
|
||||
} catch (Exception e) {
|
||||
log.error("Error creating service", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getJmxObjectName(ManagedLegacyConnector managedObject) {
|
||||
return ConnectorMBean.Helper.getQualifier(
|
||||
managedObject.getSystem(),
|
||||
managedObject.getName()).getValue();
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile.support.legacy;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PermissionManager {
|
||||
|
||||
public List<String> getObjectPermissions(String objectId) throws Exception;
|
||||
|
||||
public List<String> getSubjectPermissions(String subjectId) throws Exception;
|
||||
|
||||
public void createPermission(String objectId, String subjectId) throws Exception;
|
||||
|
||||
}
|
@ -0,0 +1,57 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile.support.legacy;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Operation;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Parameter;
|
||||
|
||||
@Deprecated(since = "1.10", forRemoval = true)
|
||||
public interface ProfileManager {
|
||||
|
||||
@Operation(desc = "Create and deploy new profile")
|
||||
public void createProfile(
|
||||
@Parameter(desc = "Profile ID", name = "id") String id,
|
||||
@Parameter(desc = "System name", name = "name") String name,
|
||||
@Parameter(desc = "Description", name = "description") String description) throws Exception;
|
||||
|
||||
@Deprecated(since = "1.10", forRemoval = true)
|
||||
@Operation(desc = "Get profile configuration")
|
||||
public String getProfileConfig(@Parameter(desc = "Profile ID or system name", name = "idOrName") String idOrName)
|
||||
throws Exception;
|
||||
|
||||
@Operation(desc = "Start profile")
|
||||
public void startProfile(@Parameter(desc = "Profile ID or system name", name = "idOrName") String idOrName)
|
||||
throws Exception;
|
||||
|
||||
@Operation(desc = "Stop profile")
|
||||
public void stopProfile(@Parameter(desc = "Profile ID or system name", name = "idOrName") String idOrName)
|
||||
throws Exception;
|
||||
|
||||
@Operation(desc = "Uninstall profile")
|
||||
public void uninstallProfile(@Parameter(desc = "Profile ID or system name", name = "idOrName") String idOrName)
|
||||
throws Exception;
|
||||
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* 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.core.management.profile.support.legacy;
|
||||
|
||||
public interface SystemManager {
|
||||
|
||||
String getUUIDbyName(String name) throws Exception;
|
||||
|
||||
}
|
@ -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. Если какое-либо положение настоящей Лицензии будет признано судом недействительным,
|
||||
остальные положения будут продолжать своё действие, а Пользователь будет обязан продолжать
|
||||
исполнять свои обязанности в соответствии с этими положениями.
|
@ -0,0 +1,46 @@
|
||||
<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.esb.platform.runtime.core</groupId>
|
||||
<artifactId>management</artifactId>
|
||||
<version>1.10.0</version>
|
||||
</parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.core.management</groupId>
|
||||
<artifactId>repository-management</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
<name>ENTAXY :: PLATFORM :: RUNTIME :: CORE :: MANAGEMENT :: REPOSITORY MANAGEMENT</name>
|
||||
<description>ENTAXY :: PLATFORM :: RUNTIME :: CORE :: MANAGEMENT :: REPOSITORY MANAGEMENT</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.core.management</groupId>
|
||||
<artifactId>object-management</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.osgi</groupId>
|
||||
<artifactId>org.osgi.service.component.annotations</artifactId>
|
||||
<version>1.4.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>org.apache.felix.scr</artifactId>
|
||||
<version>2.1.20</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>
|
||||
ru.entaxy.esb.platform.runtime.base
|
||||
</groupId>
|
||||
<artifactId>base-support</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.base</groupId>
|
||||
<artifactId>management-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,48 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* repository-management
|
||||
* ==========
|
||||
* 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.core.management.repository;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Operation;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Parameter;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectContainerMBean;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
|
||||
public interface RepositoriesMBean extends EntaxyRuntimeObjectContainerMBean {
|
||||
|
||||
@Operation(desc = "Start repository")
|
||||
void startRepository(
|
||||
@Parameter(name = "idOrName", desc = "Id or name of the repository") String idOrName) throws Exception;
|
||||
|
||||
@Operation(desc = "Stop repository")
|
||||
void stopRepository(
|
||||
@Parameter(name = "idOrName", desc = "Id or name of the repository") String idOrName) throws Exception;
|
||||
|
||||
@Operation(desc = "Uninstall repository")
|
||||
void uninstallRepository(
|
||||
@Parameter(name = "idOrName", desc = "Id or name of the repository") String idOrName) throws Exception;
|
||||
}
|
@ -0,0 +1,41 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* repository-management
|
||||
* ==========
|
||||
* 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.core.management.repository;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Attribute;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
import ru.entaxy.platform.core.management.object.EntaxyRuntimeObjectMBean;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATED_ONLY)
|
||||
public interface RepositoryMBean extends EntaxyRuntimeObjectMBean {
|
||||
|
||||
@Attribute(desc = "Repository name")
|
||||
default String getName() {
|
||||
return getObjectId();
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user