ENTAXY-248 release 1.8.1 #9
							
								
								
									
										0
									
								
								aggregate.marker
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -22,7 +22,7 @@ _src/main/resource/template/example-in-connector.ftl_ | ||||
|            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||||
|            xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd"> | ||||
|  | ||||
|     <bean id="inConnector" class="ru.entaxy.esb.system.profile.commons.connectors.in.QueueInConnectorImpl"> | ||||
|     <bean id="inConnector" class="ru.entaxy.esb.system.profile.commons.connectors.in.DirectVMInConnectorImpl"> | ||||
|         <property name="endpointName" value="example"/> | ||||
|         <property name="systemName" value="[=systemName]"/> | ||||
|     </bean> | ||||
| @@ -49,7 +49,7 @@ _src/main/resource/template/example-in-connector.ftl_ | ||||
| Создание и публикация бина: для связи коннектора с профилем, возможности получить весь список коннекторов определенного типа. | ||||
| [source, xml] | ||||
| ---- | ||||
| <bean id="inConnector" class="ru.entaxy.esb.system.profile.commons.connectors.in.QueueInConnectorImpl"> | ||||
| <bean id="inConnector" class="ru.entaxy.esb.system.profile.commons.connectors.in.DirectVMInConnectorImpl"> | ||||
|     <property name="endpointName" value="example"/> | ||||
|     <property name="systemName" value="[=systemName]"/> | ||||
| </bean> | ||||
| @@ -113,7 +113,7 @@ _src/main/resource/template/example-out-connector.ftl_ | ||||
|         <property name="connectionFactory" ref="pooledConnectionFactory"/> | ||||
|     </bean> | ||||
|  | ||||
|     <bean id="exampleConnector" class="ru.entaxy.esb.system.profile.commons.connectors.out.QueueOutConnectorImpl"> | ||||
|     <bean id="exampleConnector" class="ru.entaxy.esb.system.profile.commons.connectors.out.DirectVMOutConnectorImpl"> | ||||
|         <property name="endpointName" value="example"/> | ||||
|         <property name="systemName" value="[=systemName]"/> | ||||
|     </bean> | ||||
| @@ -144,7 +144,7 @@ _src/main/resource/template/example-out-connector.ftl_ | ||||
| Создание и публикация бина: для связи коннектора с профилем, возможности получить весь список коннекторов определенного типа. | ||||
| [source, xml] | ||||
| ---- | ||||
| <bean id="exampleOutConnector" class="ru.entaxy.esb.system.profile.commons.connectors.out.QueueOutConnectorImpl"> | ||||
| <bean id="exampleOutConnector" class="ru.entaxy.esb.system.profile.commons.connectors.out.DirectVMOutConnectorImpl"> | ||||
|     <property name="endpointName" value="example"/> | ||||
|     <property name="systemName" value="[=systemName]"/> | ||||
| </bean> | ||||
|   | ||||
| @@ -1,4 +1,4 @@ | ||||
| = Shema | ||||
| = Sсhema | ||||
|  | ||||
| Есть три типа ресурсов, которые можно загружать в шину и использовать в маршрутах: | ||||
|  | ||||
|   | ||||
| @@ -344,6 +344,13 @@ sudo chown -R karaf:karaf /opt/karaf | ||||
| sudo sed -i 's/# export JAVA_HOME/export JAVA_HOME=\/opt\/openjdk\/jdk-11.0.11/g' /opt/karaf/bin/setenv | ||||
| ---- | ||||
| + | ||||
| . Отредактировать переменную окружения `EXTRA_JAVA_OPTS` для Karaf, чтобы устранить возможность эксплуатацию критической уязвимости Log4j CVE-2021-44228: | ||||
| + | ||||
| [source,bash] | ||||
| ---- | ||||
| sudo sed -i 's/# export EXTRA_JAVA_OPTS/export EXTRA_JAVA_OPTS=-Dlog4j2.formatMsgNoLookups=true/g' /opt/karaf/bin/setenv | ||||
| ---- | ||||
| + | ||||
| . Создать файл сервиса `/etc/systemd/system/karaf.service` со следующим содержимым: | ||||
| + | ||||
| .karaf.service | ||||
| @@ -495,7 +502,7 @@ karaf@root()> | ||||
|  | ||||
| [source,bash] | ||||
| ---- | ||||
| feature:repo-add mvn:ru.entaxy.esb/karaf-features/1.8.0/xml/features | ||||
| feature:repo-add mvn:ru.entaxy.esb/karaf-features/1.8.1/xml/features | ||||
| ---- | ||||
|  | ||||
| Затем запускается команда установки всех компонентов Entaxy | ||||
|   | ||||
| @@ -8,3 +8,4 @@ Entaxy have different installation ways OOTB: | ||||
| * xref:../../distribution/entaxy-docker/ReadMe.md[Development docker installation] | ||||
| * xref:../../features/README.md[Development standalone installation] | ||||
| * xref:install.adoc[Enterprise environment installation] | ||||
| * xref:local-installation/local-installation.adoc[Local installation] | ||||
|   | ||||
| @@ -5,6 +5,7 @@ __Alternative languages:__ | ||||
| = Установка | ||||
| Entaxy из коробки имеет разные варианты установки: | ||||
|  | ||||
| * xref:local-installation/ReadMe.md[Установка для разработки в докер] | ||||
| * xref:../../distribution/entaxy-docker/ReadMe.md[Установка для разработки в докер] | ||||
| * xref:../../features/README.ru.md[Установка для разработки отдельных серверных приложений] | ||||
| * xref:install.adoc[Установка на промышленное окружение] | ||||
| * xref:local-installation/local-installation.ru.adoc[Локальная установка] | ||||
|   | ||||
| @@ -1,141 +0,0 @@ | ||||
| ## Docker compose для сборки и запуска Entaxy. | ||||
|  | ||||
| Запуск локального окружения с несколькими docker контейнерами:  | ||||
| * Караф | ||||
| * Брокер | ||||
| * СУБД | ||||
| * Менеджер артефактов | ||||
|  | ||||
| Для начала клонируем репозиторий и переходим в корень проекта:  | ||||
| ```bash | ||||
| git clone <entaxy-framework-repository> | ||||
| cd entaxy-framework | ||||
| ``` | ||||
| Далее у нас есть разные варианты хранения необходимых для установки Entaxy артефактов. | ||||
| ### 1. Самый простой способ: локальный репозиторий артефактов включаеться в образ карафа. | ||||
| В корневом POM находится профиль для деплоя артефактов в образ карафа: | ||||
| ```xml | ||||
| <profile> | ||||
|     <id>docker.file.repo</id> | ||||
|     <distributionManagement> | ||||
|         <snapshotRepository> | ||||
|             <id>entaxy-maven-repo-file</id> | ||||
|             <url>file:./distribution/entaxy-docker/karaf/repo</url> | ||||
|         </snapshotRepository> | ||||
|     </distributionManagement> | ||||
| </profile> | ||||
| ``` | ||||
| Запускаем мевен деплой из корня проекта с этим профилем:  | ||||
| ```bash | ||||
| mvn deploy -P docker.file.repo | ||||
| ```  | ||||
| И после успешной сборки запускаем контейнеры из директории проекта, в которой находится docker-compose.yml: | ||||
| ```bash | ||||
| cd ./distribution/entaxy-docker | ||||
| docker-compose up | ||||
| ```  | ||||
| Или `docker compose up` для новых версий docker. | ||||
| После запуска комманды мы будем видеть прогресс сборки образов, запуска контейнеров и логи запущенных приложений. Для остановки контейнеров достаточно нажать сочетание клавиш Ctrl+C или через команды запущенные из другого окна/вкладки терминала. | ||||
| ```bash | ||||
| docker-compose stop | ||||
| docker-compose start | ||||
| ``` | ||||
| После запуска контейнеров открываем новый терминал и заходим в караф: | ||||
| ```bash | ||||
| docker-compose exec karaf /opt/apache-karaf/bin/client | ||||
| ``` | ||||
| или ssh клиент с дальнейшим вводом пароля (karaf) | ||||
| ```bash | ||||
| ssh -p 8101 karaf@localhost | ||||
| ```  | ||||
|  | ||||
| И в консоли карафа запускаем скрипт с установкой необходимых фич: | ||||
| ```bash  | ||||
| shell:source ./install.karaf | ||||
| ``` | ||||
| Ждём окончания деплоя в караф. | ||||
| (Не всегда полная установка проходит с первой попытки и тогда помогает повторный запуск `source install.karaf`) | ||||
|  | ||||
| ### 2. Reposilite: легковесный http репозиторий артефактов запускается в отдельном контейнере. | ||||
| Комментируем в файле install.karaf строку начинающуюся с:  | ||||
| ```bash | ||||
| config:property-set -p org.ops4j.pax.url.mvn org.ops4j.pax.url.mvn.repositories file:/opt/apache-karaf/repo | ||||
| ``` | ||||
| И убираем комментарий в строке начинающейся:  | ||||
| ```bash | ||||
| #config:property-set -p org.ops4j.pax.url.mvn org.ops4j.pax.url.mvn.repositories http://maven-repo/snapshots | ||||
| ``` | ||||
|  | ||||
| Запускаем контейнеры из директории проекта, в которой находится docker-compose.yml: | ||||
| ```bash | ||||
| cd ./distribution/entaxy-docker | ||||
| docker-compose up | ||||
| ```  | ||||
| Или `docker compose up` для новых версий docker. | ||||
| После запуска комманды мы будем видеть прогресс сборки образов, запуска контейнеров и логи запущенных приложений. Для остановки контейнеров достаточно нажать сочетание клавиш Ctrl+C или через команды запущенные из другого окна/вкладки терминала. | ||||
| ```bash | ||||
| docker-compose stop | ||||
| docker-compose start | ||||
| ``` | ||||
|  | ||||
| Для деплоя в reposilite добавляем учётные данные в конфигурацию мавена (`~/.m2/settings.xml`): | ||||
| ```xml | ||||
| <settings xmlns="http://maven.apache.org/SETTINGS/1.0.0" | ||||
|           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||||
|           xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"> | ||||
|     <servers> | ||||
|         <server> | ||||
|             <id>entaxy-maven-repo</id> | ||||
|             <username>admin</username> | ||||
|             <password>aW7frfS9NPGrOnuNBMf9gyO0eXNRaCoOGtXHTcLU5akDFJ9ACiUJhgmZxlOKnLC5</password> | ||||
|         </server> | ||||
|     </servers> | ||||
| </settings> | ||||
| ``` | ||||
| В корневом POM находится профиль для деплоя артефактов на сервер reposilite: | ||||
| ```xml | ||||
| <profile> | ||||
|     <id>docker.reposilite</id> | ||||
|     <distributionManagement> | ||||
|         <snapshotRepository> | ||||
|             <id>entaxy-maven-repo</id> | ||||
|             <url>http://127.0.0.1:8081/snapshots</url> | ||||
|         </snapshotRepository> | ||||
|     </distributionManagement> | ||||
| </profile> | ||||
| ``` | ||||
| Запускаем мевен деплой из корня проекта с этим профилем: | ||||
| ```bash | ||||
| mvn deploy -P docker.reposilite | ||||
| ```  | ||||
| После успешной сборки открываем новый терминал и заходим в караф: | ||||
| ```bash | ||||
| docker-compose exec karaf /opt/apache-karaf/bin/client | ||||
| ``` | ||||
| или ssh клиент с дальнейшим вводом пароля (karaf) | ||||
| ```bash | ||||
| ssh -p 8101 karaf@localhost | ||||
| ```  | ||||
|  | ||||
| И в консоли карафа запускаем скрипт с установкой необходимых фич: | ||||
| ```bash  | ||||
| shell:source ./install.karaf | ||||
| ``` | ||||
| Ждём окончания деплоя в караф. | ||||
| (Не всегда полная установка проходит с первой попытки и тогда помогает повторный запуск `source install.karaf`) | ||||
|  | ||||
|  | ||||
|  | ||||
| Также есть вариант с nexus | ||||
| После старта получаем пароль для admin через команду:  | ||||
| `docker-compose exec nexus cat /nexus-data/admin.password`. | ||||
| Через админку нужно разрешить анонимный деплой или настроить доступы. | ||||
| Урл для install.karaf | ||||
| `http://nexus:8081/repository/maven-snapshots/@id=local-nexus@snapshots@noreleases` | ||||
|  | ||||
|  | ||||
|  | ||||
| Остановить все контейнеры | ||||
| `docker-compose down` | ||||
| Остановить и удалить хранилища с БД и репой | ||||
| `docker-compose down -v` | ||||
| After Width: | Height: | Size: 5.6 KiB | 
| After Width: | Height: | Size: 43 KiB | 
| @@ -0,0 +1,246 @@ | ||||
| = Локальная установка Entaxy на рабочую станцию или сервер. | ||||
|  | ||||
| __Alternative languages:__ | ||||
|  | ||||
| * xref:windows-local-installation.adoc[English] | ||||
|  | ||||
|  | ||||
| == Введение. | ||||
|  | ||||
| В этой инструкции мы рассмотрим установку Entaxy. Установка на все ОС проходит аналогичным образом и отличается выбором соответствующих инсталляторов или использованием пакетных менеджеров. | ||||
|  | ||||
|  | ||||
| == Установка Java. | ||||
|  | ||||
| . Скачиваем и устанавливаем JAVA. Для работы Entaxy рекомендуется Java 11. Работа платформы протестирована на OpenJDK и LibericaJDK от BellSoft (https://libericajdk.ru/pages/downloads/) | ||||
|  | ||||
| . Создаем переменную окружения JAVA_HOME. | ||||
|  | ||||
| . Добавляем абсолютный путь к директории bin в системную переменную окружения PATH. | ||||
|  | ||||
|  | ||||
| == Дистрибутивы Entaxy | ||||
|  | ||||
| Сущетсвет несколько вариантов сборок Entaxy, которые доступны по адресу https://entaxy.ru/download  | ||||
|  | ||||
| . `entaxy-assembly-compact*` - все-в-одном, брокер, бд и графический веб-интерфейс в одной сборке. См. xref:#_установка_all_in_one [Установка all-in-one] | ||||
|  | ||||
| . `entaxy-assembly*` - сборка без предустановленного графического веб-интерфейса. См. xref:#_установка_без_ui [Установка без UI] | ||||
|  | ||||
| . `entaxy-assembly-with-ui*` - сборка без предустановленного брокера сообщений. См. xref:#_установка_с_внешним_брокером [Установка с внешним брокером]     | ||||
|  | ||||
| . Все компоненты устанавливаются отдельно. См. xref:#_покомпонентная_установка [Покомпонентная установка] | ||||
|  | ||||
|  | ||||
| == Установка all-in-one | ||||
|  | ||||
| . Распаковываем архив `entaxy-assembly-compact*` | ||||
|  | ||||
| . Распакованный архив лучше перенести в другое место, чтобы абсолютный путь до каталога приложения не был слишком длинным, также необходимо чтобы путь содержал только латинские символы и был без пробелов. | ||||
|  | ||||
| . Переходим в каталог `/bin` приложения и запускаем:  | ||||
|     - entaxy - для Linux | ||||
|     - entaxy.bat - для Windows | ||||
|  | ||||
| . Немного ждем и проверяем, что система корректно запустилась см. xref:#_проверка_готовности_системы [Проверка готовности системы] | ||||
|  | ||||
|  | ||||
| == Установка без UI | ||||
|  | ||||
| . Распаковываем архив `entaxy-assembly*` | ||||
|  | ||||
| . Распакованный архив лучше перенести в другое место, чтобы абсолютный путь до каталога приложения не был слишком длинным, также необходимо чтобы путь содержал только латинские символы и был без пробелов. | ||||
|  | ||||
| . Переходим в каталог `/bin` приложения и запускаем:  | ||||
|     - entaxy - для Linux | ||||
|     - entaxy.bat - для Windows | ||||
|  | ||||
| . Немного ждем и проверяем, что система корректно запустилась см. xref:#_проверка_готовности_системы [Проверка готовности системы] | ||||
|  | ||||
| . Веб-интерфейс можно установить, после запуска системы, командой (в консоли Карафа): `source scripts/entaxy-ui.install` | ||||
|  | ||||
|  | ||||
| == Установка с внешним брокером | ||||
|  | ||||
| . Для установки брокера смотрите инструкцию: xref:#_установка_и_настройка_брокера[Установка и настройка брокера] | ||||
|  | ||||
| . Распаковываем архив `entaxy-assembly-with-ui*` | ||||
|  | ||||
| . Распакованный архив лучше перенести в другое место, чтобы абсолютный путь до каталога приложения не был слишком длинным, также необходимо чтобы путь содержал только латинские символы и был без пробелов. | ||||
|  | ||||
| . Переходим в каталог `/bin` приложения и запускаем:  | ||||
|     - entaxy - для Linux | ||||
|     - entaxy.bat - для Windows | ||||
|  | ||||
| . Немного ждем и проверяем, что система корректно запустилась см. xref:#_проверка_готовности_системы [Проверка готовности системы]   | ||||
|  | ||||
|  | ||||
| == Покомпонентная установка | ||||
|  | ||||
| === Установка и настройка БД. | ||||
|  | ||||
| Entaxy не привязана к какой-либо конкретной СУБД, но по умолчанию используется встроенная H2, в данной инструкции будет показано как установить и настроить систему на работу с БД Postgres. | ||||
|  | ||||
| . Скачиваем инсталятор с официального сайта (https://www.enterprisedb.com/downloads/postgres-postgresql-downloads). | ||||
|  | ||||
| . Запускаем установку. image:image/postgresql-installation-1.jpg[postgresql-installation] | ||||
|  | ||||
| . Оставляем все настройки по умолчанию и устанавливаем пароль `postgres`. | ||||
|  | ||||
| . Запускаем pgAdmin 4 и устанавливаем мастер пароль для приложения `postgres`. image:image/pgadmin-start.jpg[pgadmin-start] | ||||
|  | ||||
| . Добавляем подключение к локальному серверу БД. | ||||
|  | ||||
| . Выбираем доступную базу данных из списка и переходим в Query Tool, в котором выполняем sql запрос: | ||||
|  | ||||
| [source,sql] | ||||
| ---- | ||||
| CREATE USER "entaxy" WITH PASSWORD 'entaxy'; | ||||
| ---- | ||||
| image:image/pgadmin-create-user.jpg[pgadmin-create-user] | ||||
|  | ||||
| [start=7] | ||||
| . Теперь в том же окне по очереди (по одной строчке) выполняем запросы для создания необходимых для Entaxy баз данных. | ||||
|  | ||||
| [source,sql] | ||||
| ---- | ||||
| CREATE DATABASE esb_entaxy; | ||||
| ---- | ||||
|  | ||||
| [source,sql] | ||||
| ---- | ||||
| GRANT ALL PRIVILEGES ON DATABASE esb_entaxy TO entaxy; | ||||
| ---- | ||||
|  | ||||
| [source,sql] | ||||
| ---- | ||||
| CREATE DATABASE cache; | ||||
| ---- | ||||
|  | ||||
| [source,sql] | ||||
| ---- | ||||
| GRANT ALL PRIVILEGES ON DATABASE cache TO entaxy; | ||||
| ---- | ||||
|  | ||||
| На этом настройка СУБД завершена. | ||||
|  | ||||
|  | ||||
| === Установка и настройка брокера | ||||
|  | ||||
| В этой инструкции мы рассмотрим использование брокера сообщений Artemis. | ||||
|  | ||||
| . Скачиваем архив с официального сайта (https://activemq.apache.org/components/artemis/download/). | ||||
|  | ||||
| . Распаковываем архив и переходим в директорию bin. | ||||
|  | ||||
| . Запускаем в командной строке создание брокера `artemis create --user entaxy --password entaxy --allow-anonymous $ARTEMIS_HOME/brokers/entaxy-broker`. | ||||
|  | ||||
| . После создания брокера надо открыть файл `$ARTEMIS_HOME/brokers/entaxy-broker/etc/broker.xml` и проверить, что автоматическое удаление очередей и адресов отключено: | ||||
|  | ||||
| [source,xml] | ||||
| ---- | ||||
| <!--default for catch all--> | ||||
| <address-setting match="#"> | ||||
|  | ||||
|     <auto-delete-queues>false</auto-delete-queues> | ||||
|     <auto-delete-addresses>false</auto-delete-addresses> | ||||
|  | ||||
| </address-setting> | ||||
| ---- | ||||
|  | ||||
| . Запускаем брокер сообщений `$ARTEMIS_HOME/brokers/entaxy-broker/bin/artemis run` | ||||
|  | ||||
| Установка брокера завершена. | ||||
|  | ||||
|  | ||||
| === Установка Entaxy | ||||
|  | ||||
| . xref:#_установка_с_внешним_брокером [Выполняем установку Entaxy без брокера] | ||||
|  | ||||
| . xref:#_настройка_entaxy_на_внешнюю_базы_данных [Перенастраиваем Entaxy на внешнюю БД], установленную на предыдущем шаге. | ||||
|  | ||||
|  | ||||
| == Проверка готовности системы | ||||
|  | ||||
| Чтобы проверить, что все сервисы Entaxy готовы к работае, открываем следующий адрес в браузере http://localhost:8181/system/health | ||||
|  | ||||
| При полной готовности система выдаст следующую информацию:  | ||||
| image:image/health-check.png[] | ||||
|  | ||||
| Если при первом запуске Entaxy Connections находится в статусе TEMPORARILY_UNAVAILABLE, необходимо перезапустить Entaxy. | ||||
|  | ||||
| == Настройка Entaxy на внешнюю базу данных | ||||
|  | ||||
| По умолчанию все сборки Entaxy используют встроенную БД H2.  | ||||
|  | ||||
| Для того чтобы перенестроить Entaxy на использование внешней БД, нужно выполнить следующие шаги: | ||||
|  | ||||
| В каталоге `/etc` приложения: | ||||
|  | ||||
| . Найти файлы `org.ops4j.datasource-entaxy.esb.cache.cfg` и `org.ops4j.datasource-entaxy.esb.storage.cfg` | ||||
|  | ||||
| . Удалить их или переименовать путем добавления постфикса, например, `*.defaultdb`.  | ||||
|  | ||||
| . Найти файлы `org.ops4j.datasource-entaxy.esb.cache.cfg.pg` и `org.ops4j.datasource-entaxy.esb.storage.cfg.pg` и удалить постфикс `.pg` из имени. | ||||
|  | ||||
| . Если при выполнении установки БД были указаны другие данные или была выполненна установка на другом хосте, то вводим соответствующие значения в файлах. | ||||
|  | ||||
|  | ||||
| == Тестирование. | ||||
|  | ||||
| Для проверки работоспособности платформы переходим к xref:../../connectors/uniform-exchange-service/tests/postman.adoc[инструкции по тестированию]. | ||||
|  | ||||
|  | ||||
| == Кластерный запуск Entaxy | ||||
|  | ||||
| По умолчанию Entaxy использует мультикаст для поиска компонентов кластера по сети, необходимо убедиться что настройки вашего оборудования и файервол настроены для широковещания.  | ||||
|  | ||||
| Чтобы два и более экземпляра соединились в кластер достаточно их запустить на разных хостах из одной подсети. | ||||
|  | ||||
|  | ||||
| === Настройка статичных адресов узлов кластера | ||||
|  | ||||
| Если требуется указать статичные адреса узлов кластера поиска узлов, то это можно сделать в файле `/etc/hazelcast.xml` | ||||
|  | ||||
| - Выключаем мультикаст `<multicast enabled="false">` | ||||
| - Включаем ip `<tcp-ip enabled="true">` | ||||
|  | ||||
| например: | ||||
| [source,xml] | ||||
| ---- | ||||
| <multicast enabled="false"> | ||||
|     <multicast-group>224.2.2.3</multicast-group> | ||||
|     <multicast-port>54327</multicast-port> | ||||
| </multicast> | ||||
| <tcp-ip enabled="true"> | ||||
|     <interface>127.0.0.1</interface> | ||||
| </tcp-ip> | ||||
| ---- | ||||
|  | ||||
| Также можно задавать маски адресов:  | ||||
| [source,xml] | ||||
| ---- | ||||
| <tcp-ip enabled="true"> | ||||
|     <interface>192.168.1.*</interface> | ||||
| </tcp-ip> | ||||
| ---- | ||||
|  | ||||
|  | ||||
| === Проверка кластера | ||||
|  | ||||
| Чтобы понимать, что экземпляры соединились в кластер, выполняем следующую команду в одной из консолей карафа: `cluster:node-list` | ||||
|  | ||||
| image:image/cluster-note-list.png[] | ||||
|  | ||||
|  | ||||
| === Запуск нескольких экземпляров на одном хосте | ||||
|  | ||||
| Для того чтобы запустить несколько экземпляров системы на одном хосте, необходимо в файле `etc/entaxy.properties` изменить значения свойств: | ||||
|  | ||||
|     - entaxy.rmiRegistryPort | ||||
|     - entaxy.rmiServerPort | ||||
|     - entaxy.jmxmpPort | ||||
|     - entaxy.sshPort | ||||
|     - entaxy.org.osgi.service.http.port | ||||
|     - entaxy.service.port.management | ||||
|     - entaxy.service.port.subscription | ||||
| @@ -1,116 +0,0 @@ | ||||
| = Локальная установка Entaxy на рабочую станцию или сервер. | ||||
|  | ||||
| __Alternative languages:__ | ||||
|  | ||||
| * xref:windows-local-installation.adoc[English] | ||||
|  | ||||
| == Введение. | ||||
|  | ||||
| В этой инструкции мы рассмотрим установку Entaxy, включая брокер и бд, на одной машине с операционной системой Windows. Установка на другие ОС проходит аналогичным образом и отличается выбором соответствующих инсталяторов или использованием пакетных менеджеров. | ||||
|  | ||||
| == Шаг 1: Установка Java. | ||||
|  | ||||
| Скачиваем и устанавливаем JAVA. Для работы Entaxy рекомендуется Java 11. Работа платформы протестирована на OpenJDK и LibericaJDK от BellSoft (https://libericajdk.ru/pages/downloads/). | ||||
|  | ||||
| == Шаг 2: Установка и настройка Maven. | ||||
|  | ||||
| 1. Скачиваем архив с официального сайта (https://maven.apache.org/download.cgi). | ||||
| 2. Распаковываем архив и переходи в директорию bin. | ||||
| 3. Копируем абсолютный путь к директории bin и добавляем его в системную переменную окружения PATH. | ||||
|  | ||||
| == Шаг 3: Получение исходных кодов и сборка проекта. | ||||
|  | ||||
| 1. Для получения исходных кодов платформы переходим по адресу https://git.emdev.ru/entaxy-public/entaxy-public и нажимаем иконку `скачать`. image:image/source-download.jpg[source-download] | ||||
| 2. Распаковываем архив и переходим в корневую директорию проекта `entaxy-public`. | ||||
| 3. Собираем проект командой `mvn install`. | ||||
|  | ||||
| == Шаг 4: Установка и настройка БД. | ||||
|  | ||||
| Entaxy не привязана к какой-либо конкретной СУБД, но в большинстве случаев используется PostgreSQL. | ||||
|  | ||||
| 1. Скачиваем инсталятор с официального сайта (https://www.enterprisedb.com/downloads/postgres-postgresql-downloads). | ||||
| 2. Запускаем установку. image:image/postgresql-installation-1.jpg[postgresql-installation] | ||||
| 3. Оставляем все настройки по умолчанию и устанавливаем пароль `postgres`. | ||||
| 4. Запускаем pgAdmin 4 и устанавливаем мастер пароль для приложения `postgres`. image:image/pgadmin-start.jpg[pgadmin-start] | ||||
| 5. Добавляем подключение к локальному серверу БД. | ||||
| 6. Выбираем доступную базу данных из списка и переходим в Query Tool, в котором выполняем sql запрос: | ||||
|  | ||||
| [source,sql] | ||||
| ---- | ||||
| CREATE USER "entaxy" WITH PASSWORD 'entaxy'; | ||||
| ---- | ||||
| image:image/pgadmin-create-user.jpg[pgadmin-create-user] | ||||
| [start=7] | ||||
| . Теперь в том же окне по очереди (по одной строчке) выполняем запросы для создания необходимых для Entaxy баз данных. | ||||
|  | ||||
| [source,sql] | ||||
| ---- | ||||
| CREATE DATABASE esb_entaxy; | ||||
| ---- | ||||
|  | ||||
| [source,sql] | ||||
| ---- | ||||
| GRANT ALL PRIVILEGES ON DATABASE esb_entaxy TO entaxy; | ||||
| ---- | ||||
|  | ||||
| [source,sql] | ||||
| ---- | ||||
| CREATE DATABASE cache; | ||||
| ---- | ||||
|  | ||||
| [source,sql] | ||||
| ---- | ||||
| GRANT ALL PRIVILEGES ON DATABASE cache TO entaxy; | ||||
| ---- | ||||
|  | ||||
| На этом настройка СУБД завершена. | ||||
|  | ||||
| == Шаг 5: Установка и настройка брокера. | ||||
|  | ||||
| В этой инструкции мы рассмотрим использование брокера сообщений Artemis. | ||||
|  | ||||
| 1. Скачиваем архив с официального сайта (https://activemq.apache.org/components/artemis/download/). | ||||
| 2. Распаковываем архив и переходим в директорию bin. | ||||
| 3. Запускаем в командной строке создание брокера `artemis create --user entaxy --password entaxy --allow-anonymous $ARTEMIS_HOME/brokers/entaxy-broker`. | ||||
| 4. После создания брокера надо открыть файл `$ARTEMIS_HOME/brokers/entaxy-broker/etc/broker.xml` и проверить, что автоматическое удаление очередей и адресов отключено: | ||||
|  | ||||
| [source,xml] | ||||
| ---- | ||||
| <!--default for catch all--> | ||||
| <address-setting match="#"> | ||||
|  | ||||
|     <auto-delete-queues>false</auto-delete-queues> | ||||
|     <auto-delete-addresses>false</auto-delete-addresses> | ||||
|  | ||||
| </address-setting> | ||||
| ---- | ||||
| 5. Запускаем брокер сообщений `$ARTEMIS_HOME/brokers/entaxy-broker/bin/artemis run` | ||||
|  | ||||
| Установка брокера завершена. | ||||
|  | ||||
| == Шаг 6: Установка и запуск карафа. | ||||
|  | ||||
| 1. Скачать Karaf Runtime 4.2.9 (Binary Distribution : ZIP) с официального сайта (https://archive.apache.org/dist/karaf/4.2.9/apache-karaf-4.2.9.zip). | ||||
| 2. Распаковываем архив и переходим в директорию `etc`. | ||||
| 3. Копируем в директорию `etc` карафа все файлы исходных кодов из директории `entaxy-public\features\target\cfg` и ещё один файл `entaxy-public\features\target\script\install.karaf`. | ||||
| 4. Переходим в директорию `bin` карафа и запускаем командой `karaf` | ||||
| После запуска откроется консоль карафа. | ||||
|  | ||||
| == Шаг 7: Установка Entaxy в караф. | ||||
|  | ||||
| В командной строке карафа выполнить команду | ||||
| [source,bash] | ||||
| ---- | ||||
| shell:source etc/install.karaf | ||||
| ---- | ||||
| Если времени на установку не хватило, то нужно повторить последнюю команду или выполнить команды установки построчно. Для отображения списка команд достаточно в консоли карафа выполнить команду | ||||
| [source,bash] | ||||
| ---- | ||||
| cat etc/install.karaf | ||||
| ---- | ||||
|  | ||||
| После успешной установки, выполняем команду `list`, чтобы убедиться, что все модули находятся в состоянии `Active`. | ||||
|  | ||||
| == Шаг 8: Тестирование. | ||||
|  | ||||
| Для проверки работоспособности платформы переходим к xref:../../connectors/uniform-exchange-service/tests/postman.adoc[инструкции по тестированию]. | ||||
							
								
								
									
										29
									
								
								documentation/monitoring/hawtio.adoc
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,29 @@ | ||||
| = Использование hawtio для мониторинга entaxy | ||||
|  | ||||
| hawtio доступно по адресу http://{nginx_address}/hawtio/ | ||||
|  | ||||
| * Открываем в браузере hawtio и аутентифицируемся как karaf / karaf | ||||
|  | ||||
| http://10.24.2.33:8181/hawtio/ | ||||
|  | ||||
| image::screenshots/image_2021-09-30_12-43-58.png[] | ||||
|  | ||||
| * При успешной аутентификации видим вкладку camel со всеми маршрутами и возможностью посмотреть статистику по маршрутам | ||||
|  | ||||
| image::screenshots/image_2021-09-30_12-45-07.png[] | ||||
|  | ||||
| * Возможность просмотреть логи | ||||
|  | ||||
| image::screenshots/image_2021-09-30_12-45-35.png[] | ||||
|  | ||||
| * Возможность просмотреть метрику | ||||
|  | ||||
| image::screenshots/image_2021-09-30_12-45-55.png[] | ||||
|  | ||||
| * Общую статистику можно увидеть на вкладке JMX, выбрав Camel Contexts (отображение данных бывает с небольшой паузой) | ||||
|  | ||||
| image::screenshots/image_2021-09-30_12-46-36.png[] | ||||
|  | ||||
| * Также можно увидеть визуальное отображение маршрута | ||||
|  | ||||
| image::screenshots/image_2021-09-30_12-47-18.png[] | ||||
| After Width: | Height: | Size: 625 KiB | 
| After Width: | Height: | Size: 237 KiB | 
| After Width: | Height: | Size: 271 KiB | 
| After Width: | Height: | Size: 55 KiB | 
| After Width: | Height: | Size: 339 KiB | 
| After Width: | Height: | Size: 171 KiB | 
| @@ -1,187 +0,0 @@ | ||||
| # Entaxy features install | ||||
|  | ||||
| ### Alternative languages | ||||
|  | ||||
| [Russian](README.ru.md) | ||||
|  | ||||
| ### Introduction | ||||
|  | ||||
| You need several steps for Entaxy features installation. | ||||
| Use Java 11+. | ||||
|  | ||||
| ### Build | ||||
| You will need to compile this example first: | ||||
|  | ||||
| 	mvn install | ||||
|  | ||||
| ### Run | ||||
|  | ||||
| To run the example on Apache Karaf 4.x or newer | ||||
|  | ||||
| #### Step 1: Karaf | ||||
|  | ||||
| Launch the server | ||||
|  | ||||
| 	karaf / karaf.bat | ||||
|  | ||||
|  | ||||
| #### Step 2: DB, artemis and artefact manager Setup | ||||
|  | ||||
| If use docker run Artemis | ||||
|  | ||||
| 	sudo docker run --rm -p 8161:8161 -p 61616:61616 -e ARTEMIS_USERNAME=entaxy -e ARTEMIS_PASSWORD=entaxy --name=artemis1 -d vromero/activemq-artemis | ||||
|  | ||||
| And run postgres | ||||
|  | ||||
| 	sudo docker run --name entaxy_db -p 5432:5432 -v /etc/timezone:/etc/timezone:ro -e POSTGRES_PASSWORD=entaxy -e POSTGRES_USER=entaxy -e POSTGRES_DB=cache -d postgres | ||||
|  | ||||
| or mssql | ||||
|  | ||||
| 	sudo docker run --name mssql -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=entaxy' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2017-CU8-ubuntu | ||||
|  | ||||
| `By default project use two db: cache и esb_entaxy,` | ||||
| `Name of db wrote in org.ops4j.datasource-entaxy.esb.*.cfg` | ||||
|  | ||||
| and run nexus, if do you want to use it(necessary for system-management to work) | ||||
|  | ||||
| 	sudo docker run -d -p 8081:8081 --name nexus sonatype/nexus3 | ||||
|  | ||||
| Now we look at the admin password through the command: | ||||
|  | ||||
|     docker exec nexus cat /nexus-data/admin.password | ||||
| And then we go to the admin panel through the browser on http://localhost:8081/. | ||||
| By default, it needs to create a user entaxy / entaxy and a maven repository called entaxy to work. | ||||
|  | ||||
| On Docker Toolbox, errors may occur due to insufficient memory, solved by changing the memory allocation at startup` | ||||
|  | ||||
|     docker run -d -p 8081:8081 --name nexus -e INSTALL4J_ADD_VM_PARAMS="-Xms2g -Xmx2g -XX:MaxDirectMemorySize=3g" sonatype/nexus3 | ||||
|  | ||||
| #### Step 3: Preparing and launching karaf | ||||
|  | ||||
| Copy the following files from the entaxy-framework\features\src\main\cfg\ repository to etc karaf | ||||
|  | ||||
| 	jre.properties  | ||||
| 	org.apache.karaf.cellar.groups.cfg | ||||
|  | ||||
|  | ||||
| Also, the local nexus repository must be added to the standard repositories in the file org.ops4j.pax.url.mvn.cfg property org.ops4j.pax.url.mvn.repositories.` | ||||
|  | ||||
| `The user and the name of the repository are specified in the ru.entaxy.esb.deployer.nexus.cfg configuration file.` | ||||
|  | ||||
|  | ||||
| Running Apache Karaf 4.x or newer | ||||
|  | ||||
| 	karaf | ||||
|  | ||||
| Or starting karaf with cleaning to its original state | ||||
|  | ||||
| 	karaf clean | ||||
|  | ||||
| ## Step 4: Installing all features in one go using the karaf command line | ||||
|  | ||||
| 	shell:source <project-directory>/entaxy-framework/features/src/main/script/install.karaf | ||||
|  | ||||
| - After that you need to check the configurations of connections to the database in the files org.ops4j.datasource-entaxy.esb. *. Cfg | ||||
| - Check the address of the broker in the file ru.entaxy.esb.cfg property ru.entaxy.esb.jms.url | ||||
| - Check broker address in init/entaxy-platform-connections.json file "name": "entaxy-broker" connection in which property url | ||||
| - Replace org.apache.karaf.cellar.groups.cfg file | ||||
|  | ||||
| #### Step 4a: Add features | ||||
|  | ||||
| Add features required | ||||
|  | ||||
| 	feature:repo-add mvn:ru.entaxy.esb/karaf-features/$ESB_ENTAXY_VERSION/xml/features | ||||
|  | ||||
| Install entaxy | ||||
|  | ||||
| 	feature:install entaxy-all | ||||
|  | ||||
| Add base feature required | ||||
|  | ||||
| 	feature:repo-add mvn:ru.entaxy.esb.platform.runtime/base/$ESB_ENTAXY_VERSION/xml/features | ||||
|  | ||||
| Install base | ||||
|  | ||||
| 	feature:install base | ||||
|  | ||||
| Add core feature required | ||||
|  | ||||
| 	feature:repo-add mvn:ru.entaxy.esb.platform.runtime/core/$ESB_ENTAXY_VERSION/xml/features | ||||
|  | ||||
| Install core | ||||
|  | ||||
| 	feature:install core | ||||
|  | ||||
| Add entaxy-uniform-service feature required | ||||
|  | ||||
| 	feature:repo-add mvn:ru.entaxy.esb.platform.runtime.modules/uniform-service/$ESB_ENTAXY_VERSION/xml/features | ||||
|  | ||||
| Install entaxy-uniform-service | ||||
|  | ||||
| 	feature:install entaxy-uniform-service | ||||
| 	 | ||||
| Useful comand for dev | ||||
|  | ||||
| 	bundle:watch mvn:ru.entaxy.esb/esb/1.8.0 | ||||
|  | ||||
| #### Step 5: Verify that your service is available using the following url in the browser. | ||||
|  | ||||
| We assume you're using Karaf's default PAX Web configuration which uses port `8181` for http. If you would like to use another port or https, change the configuration in `${KARAF_HOME}/etc/org.ops4j.pax.web.cfg`. The immediate extension after the hostname and port ("cxf" in the below URL) is configured via the org.apache.cxf.osgi.cfg file (Please see [http://team.ops4j.org/wiki//display/paxweb/Pax+Web](http://team.ops4j.org/wiki//display/paxweb/Pax+Web) for more information on PAX Web). | ||||
|  | ||||
| [http://localhost:8181/cxf/system-management?wsdl](http://localhost:8181/cxf/system-management?wsdl) | ||||
|  | ||||
| #### Step 6: Start SOAPUI or Postman | ||||
|  | ||||
| POST request to  | ||||
|  | ||||
|     http://localhost:8181/cxf/system-management | ||||
|  | ||||
| Send test request: | ||||
|  | ||||
|     <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sys="http://www.entaxy.ru/system-management-service/"> | ||||
| 		<soapenv:Header/> | ||||
| 		<soapenv:Body> | ||||
| 			<sys:listTemplateRequest/> | ||||
| 		</soapenv:Body> | ||||
| 	</soapenv:Envelope> | ||||
|  | ||||
| ### Forum, Help, etc | ||||
|  | ||||
| If you hit an problems please let us know on the Camel Forums | ||||
| 	<http://camel.apache.org/discussion-forums.html> | ||||
|  | ||||
| Please help us make Apache Camel better - we appreciate any feedback you may | ||||
| have.  Enjoy! | ||||
|  | ||||
|  | ||||
| The Camel riders! | ||||
|  | ||||
|  | ||||
|  | ||||
| ## Reinstall | ||||
|     bin/karaf clean | ||||
|     shell:source install.karaf | ||||
|  | ||||
|  | ||||
| ## Tests | ||||
|  | ||||
| <https://learning.getpostman.com/docs/postman/collection_runs/command_line_integration_with_newman/> | ||||
|  | ||||
| #### Install | ||||
|  | ||||
|     npm install -g newman | ||||
|  | ||||
| #### Run | ||||
|      | ||||
|     cd test | ||||
|     newman run "Entaxy Integration Tests.postman_collection.json" -e "entaxy dev proxy.postman_environment.json" | ||||
|      | ||||
| or | ||||
|      | ||||
|     newman run "Entaxy Integration Tests.postman_collection.json" --env-var base_url=http://localhost:8181/cxf | ||||
|  | ||||
| #### CXF logging messages | ||||
|  | ||||
|     config:property-set -p org.apache.cxf.features.logging enabled true | ||||
|      | ||||
| and after restart bundle with cxf service | ||||
| @@ -1,157 +0,0 @@ | ||||
| # Установка фич (features) | ||||
|  | ||||
| ### Languages | ||||
|  | ||||
| [English](README.md) | ||||
|  | ||||
| ### Введение | ||||
|  | ||||
| Для установки фич понадобятся несколько шагов. | ||||
|  | ||||
| Использовать Java 11+ | ||||
|  | ||||
| ### Шаг 1: Сборка проекта | ||||
|  | ||||
| Необходимо локально собрать корневой проект: | ||||
|  | ||||
| 	mvn install | ||||
|  | ||||
| #### Шаг 2: Настройка брокера, БД и менеджера артефактов. | ||||
|  | ||||
| При использовании докера запустите Артемис | ||||
|  | ||||
| 	sudo docker run --rm -p 8161:8161 -p 61616:61616 -e ARTEMIS_USERNAME=entaxy -e ARTEMIS_PASSWORD=entaxy --name=artemis1 -d vromero/activemq-artemis | ||||
|  | ||||
| И запустите постгрес | ||||
|  | ||||
| 	sudo docker run --name entaxy_db -p 5432:5432 -v /etc/timezone:/etc/timezone:ro -e POSTGRES_PASSWORD=entaxy -e POSTGRES_USER=entaxy -e POSTGRES_DB=cache -d postgres | ||||
| 	 | ||||
| или Майкрософт Сиквел | ||||
|  | ||||
| 	sudo docker run --name mssql -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=entaxy' -p 1433:1433 -d mcr.microsoft.com/mssql/server:2017-CU8-ubuntu | ||||
|  | ||||
| `По умолчанию в проекте используется 2 базы данных: cache и esb_entaxy,` | ||||
| `Названия баз данных прописаны в конфигурациях соединений с бд org.ops4j.datasource-entaxy.esb.*.cfg` | ||||
|  | ||||
| и осталось поднять nexus(необходимо для работы system-management) | ||||
|  | ||||
| 	sudo docker run -d -p 8081:8081 --name nexus sonatype/nexus3 | ||||
| 	 | ||||
| Теперь смотрим админский пароль через команду: | ||||
|  | ||||
|     docker exec nexus cat /nexus-data/admin.password | ||||
| И далее заходим в админку через браузер на http://localhost:8081/. | ||||
| По умолчанию для работы требуется создать пользователя entaxy/entaxy и maven репозиторий с названием entaxy.  | ||||
|  | ||||
| На Docker Toolbox могут возникнуть ошибки из-за нехватки памяти, решается изменением выделения памяти при запуске` | ||||
|  | ||||
|     docker run -d -p 8081:8081 --name nexus -e INSTALL4J_ADD_VM_PARAMS="-Xms2g -Xmx2g -XX:MaxDirectMemorySize=3g" sonatype/nexus3 | ||||
|  | ||||
| #### Шаг 3: Подготовка и запуск карафа | ||||
|  | ||||
| Скопировать в карафовский etc следующие файлы из репозитория entaxy-framework\features\src\main\cfg\ | ||||
|  | ||||
| 	jre.properties  | ||||
| 	org.apache.karaf.cellar.groups.cfg | ||||
| 	 | ||||
|  | ||||
|  | ||||
| Так же локальный нексус репозиторий необходимо добавить к стандартным репозиториям в файле org.ops4j.pax.url.mvn.cfg свойство org.ops4j.pax.url.mvn.repositories.` | ||||
| `Пользователь и название репозитория прописано в конфигурационном файле ru.entaxy.esb.deployer.nexus.cfg.` | ||||
|  | ||||
|  | ||||
| Запуск Apache Karaf 4.x или новее | ||||
|  | ||||
| 	karaf | ||||
|  | ||||
| Или запуск карафа с очисткой до первоначального состояния | ||||
|  | ||||
| 	karaf clean | ||||
|  | ||||
| ## Шаг 4: Установка всех фич за один раз, используя командную строку карафа | ||||
|  | ||||
| 	shell:source <project-directory>/entaxy-framework/features/src/main/script/install.karaf | ||||
|  | ||||
| - После требуется проверить конфигурации соединений с бд в файлах org.ops4j.datasource-entaxy.esb.*.cfg | ||||
| - Проверить адрес брокера в файле ru.entaxy.esb.cfg свойство ru.entaxy.esb.jms.url | ||||
| - Проверить адрес брокера в файле init/entaxy-platform-connections.json коннекция "name": "entaxy-broker" в которой свойство url | ||||
| - Заменить файл org.apache.karaf.cellar.groups.cfg | ||||
|  | ||||
| #### Шаг 4a: Или можно установить фичи вручную   | ||||
|  | ||||
| Добавить необходимую фичу | ||||
|  | ||||
| 	feature:repo-add mvn:ru.entaxy.esb/karaf-features/$ESB_ENTAXY_VERSION/xml/features | ||||
|  | ||||
| Установить entaxy | ||||
|  | ||||
| 	feature:install entaxy-all | ||||
|  | ||||
| Добавить необходимую фичу base | ||||
|  | ||||
| 	feature:repo-add mvn:ru.entaxy.esb.platform.runtime/base/$ESB_ENTAXY_VERSION/xml/features | ||||
|  | ||||
| Установить base | ||||
|  | ||||
| 	feature:install base | ||||
|  | ||||
| Добавить необходимую фичу core | ||||
|  | ||||
| 	feature:repo-add mvn:ru.entaxy.esb.platform.runtime/core/$ESB_ENTAXY_VERSION/xml/features | ||||
|  | ||||
| Установить core | ||||
|  | ||||
| 	feature:install core | ||||
|  | ||||
| Добавить необходимую entaxy-uniform-service | ||||
|  | ||||
| 	feature:repo-add mvn:ru.entaxy.esb.platform.runtime.modules/uniform-service/$ESB_ENTAXY_VERSION/xml/features | ||||
|  | ||||
| Install entaxy-uniform-service | ||||
|  | ||||
| 	feature:install entaxy-uniform-service | ||||
|  | ||||
| Useful comand for dev | ||||
|  | ||||
| 	bundle:watch mvn:ru.entaxy.esb/esb/1.8.0 | ||||
|  | ||||
| #### Шаг 5: Проверка доступности сервиса через браузер, используя следующий адрес. | ||||
|  | ||||
| Подразумевается использование настроек по умолчанию для карафовского PAX Web, который для http настроен на порт `8181`. Если Вы желаете использовать другой порт или https, то необходимо поменять настройки в `${KARAF_HOME}/etc/org.ops4j.pax.web.cfg`.  Непосредственное продолжение адреса после имени хоста и номера порта (в примере ниже `cxf`) можно настроить в файле `org.apache.cxf.osgi.cfg`. (Для более подробной информации по PAX Web перейдите по ссылке [http://team.ops4j.org/wiki/display/paxweb/Pax+Web](http://team.ops4j.org/wiki/display/paxweb/Pax+Web)) | ||||
|  | ||||
| [http://localhost:8181/cxf/system-management?wsdl](http://localhost:8181/cxf/system-management?wsdl) | ||||
|  | ||||
| #### Шаг 6: Запуск SOAPUI или Postman | ||||
|  | ||||
| Отправка POST запроса на адрес | ||||
|  | ||||
|     http://localhost:8181/cxf/system-management | ||||
|  | ||||
| Тестовый запрос: | ||||
|  | ||||
|     <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:sys="http://www.entaxy.ru/system-management-service/"> | ||||
| 		<soapenv:Header/> | ||||
| 		<soapenv:Body> | ||||
| 			<sys:listTemplateRequest/> | ||||
| 		</soapenv:Body> | ||||
| 	</soapenv:Envelope> | ||||
|  | ||||
| ## Автотесты | ||||
|  | ||||
| <https://learning.getpostman.com/docs/postman/collection_runs/command_line_integration_with_newman/> | ||||
|  | ||||
| #### Установка | ||||
|  | ||||
| 	npm install -g newman | ||||
|  | ||||
| #### Запуск | ||||
|  | ||||
| 	cd test | ||||
| 	newman run "Entaxy Integration Tests.postman_collection.json" -e "entaxy dev proxy.postman_environment.json" | ||||
|  | ||||
| #### Запуск нагрузочных тестов через Jmeter | ||||
|  | ||||
| В тестах прописана система s1 | ||||
|  | ||||
| * UNIFORM-SERVICE-CONNECTOR_SEND_GET_ACK.jmx - запись и чтение с подтверждением последовательно | ||||
| * UNIFORM-SERVICE_SEND_GET_AСK_ASYNC.jmx - запись и чтение с подтверждением в параллельных потоках | ||||
							
								
								
									
										181
									
								
								features/pom.xml
									
									
									
									
									
								
							
							
						
						| @@ -1,181 +0,0 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||||
|     <modelVersion>4.0.0</modelVersion> | ||||
|     <parent> | ||||
|         <groupId>ru.entaxy.esb</groupId> | ||||
|         <artifactId>root</artifactId> | ||||
|         <version>1.8.0</version> | ||||
|     </parent> | ||||
|  | ||||
|     <artifactId>karaf-features</artifactId> | ||||
|     <name>SYSTEM :: ENTAXY :: Features</name> | ||||
|     <packaging>pom</packaging> | ||||
|  | ||||
|     <profiles> | ||||
|         <profile> | ||||
|             <id>cfg.dev</id> | ||||
|             <properties> | ||||
|                 <environmentConfigurationDirectory>cfg</environmentConfigurationDirectory> | ||||
|             </properties> | ||||
|             <build> | ||||
|                 <resources> | ||||
|                     <resource> | ||||
|                         <directory>src/main/${environmentConfigurationDirectory}</directory> | ||||
|                         <filtering>true</filtering> | ||||
|                         <targetPath>${project.build.directory}/cfg</targetPath> | ||||
|                     </resource> | ||||
|                 </resources> | ||||
|             </build> | ||||
|             <activation> | ||||
|                 <property> | ||||
|                     <name>!skipDevConfig</name> | ||||
|                 </property> | ||||
|             </activation> | ||||
|         </profile> | ||||
|         <profile> | ||||
|             <id>cfg.local</id> | ||||
|             <properties> | ||||
|                 <environmentConfigurationDirectory>cfg.local</environmentConfigurationDirectory> | ||||
|             </properties> | ||||
|         </profile> | ||||
|     </profiles> | ||||
|  | ||||
|     <build> | ||||
|         <resources> | ||||
|             <resource> | ||||
|                 <directory>src/main/feature</directory> | ||||
|                 <filtering>true</filtering> | ||||
|                 <targetPath>${project.build.directory}/feature</targetPath> | ||||
|             </resource> | ||||
|             <resource> | ||||
|                 <directory>src/main/script</directory> | ||||
|                 <filtering>true</filtering> | ||||
|                 <targetPath>${project.build.directory}/script</targetPath> | ||||
|             </resource> | ||||
|         </resources> | ||||
|         <plugins> | ||||
|             <plugin> | ||||
|                 <groupId>org.apache.maven.plugins</groupId> | ||||
|                 <artifactId>maven-resources-plugin</artifactId> | ||||
|                 <version>3.1.0</version> | ||||
|                 <executions> | ||||
|                     <execution> | ||||
|                         <goals> | ||||
|                             <goal>resources</goal> | ||||
|                         </goals> | ||||
|                     </execution> | ||||
|                 </executions> | ||||
|             </plugin> | ||||
|             <plugin> | ||||
|                 <groupId>org.codehaus.mojo</groupId> | ||||
|                 <artifactId>build-helper-maven-plugin</artifactId> | ||||
|                 <version>1.12</version> | ||||
|                 <executions> | ||||
|                     <execution> | ||||
|                         <id>attach-artifacts</id> | ||||
|                         <phase>package</phase> | ||||
|                         <goals> | ||||
|                             <goal>attach-artifact</goal> | ||||
|                         </goals> | ||||
|                         <configuration> | ||||
|                             <artifacts> | ||||
|                                 <artifact> | ||||
|                                     <file>target/feature/feature.xml</file> | ||||
|                                     <type>xml</type> | ||||
|                                     <classifier>features</classifier> | ||||
|                                 </artifact> | ||||
|                                 <artifact> | ||||
|                                     <file>target/cfg/ru.entaxy.esb.cfg</file> | ||||
|                                     <type>cfg</type> | ||||
|                                     <classifier>ru.entaxy.esb</classifier> | ||||
|                                 </artifact> | ||||
|                                 <artifact> | ||||
|                                     <file>target/cfg/ru.entaxy.esb.system.basic_auth.cfg</file> | ||||
|                                     <type>cfg</type> | ||||
|                                     <classifier>ru.entaxy.esb.system.basic_auth</classifier> | ||||
|                                 </artifact> | ||||
|                                 <artifact> | ||||
|                                     <file>target/cfg/ru.entaxy.esb.system.basic_auth.htpasswd.cfg</file> | ||||
|                                     <type>cfg</type> | ||||
|                                     <classifier>ru.entaxy.esb.system.basic_auth.htpasswd</classifier> | ||||
|                                 </artifact> | ||||
|                                 <artifact> | ||||
|                                     <file>target/cfg/ru.entaxy.esb.system.event.rest.cfg</file> | ||||
|                                     <type>cfg</type> | ||||
|                                     <classifier>ru.entaxy.esb.system.event.rest</classifier> | ||||
|                                 </artifact> | ||||
|                                 <artifact> | ||||
|                                     <file>target/cfg/ru.entaxy.esb.system.event.handler.cfg</file> | ||||
|                                     <type>cfg</type> | ||||
|                                     <classifier>ru.entaxy.esb.system.event.handler</classifier> | ||||
|                                 </artifact> | ||||
|                                 <artifact> | ||||
|                                     <file>target/cfg/org.ops4j.datasource-entaxy.esb.cache.cfg</file> | ||||
|                                     <type>cfg</type> | ||||
|                                     <classifier>datasource-cache</classifier> | ||||
|                                 </artifact> | ||||
|                                 <artifact> | ||||
|                                     <file>target/cfg/org.ops4j.datasource-entaxy.esb.storage.cfg</file> | ||||
|                                     <type>cfg</type> | ||||
|                                     <classifier>datasource-storage</classifier> | ||||
|                                 </artifact> | ||||
|                                 <artifact> | ||||
|                                     <file>target/cfg/ru.entaxy.esb.deployer.nexus.cfg</file> | ||||
|                                     <type>cfg</type> | ||||
|                                     <classifier>ru.entaxy.esb.deployer.nexus</classifier> | ||||
|                                 </artifact> | ||||
|                                 <artifact> | ||||
|                                     <file>target/cfg/ru.entaxy.esb.deployer.cellar.cfg</file> | ||||
|                                     <type>cfg</type> | ||||
|                                     <classifier>ru.entaxy.esb.deployer.cellar</classifier> | ||||
|                                 </artifact> | ||||
|                                 <artifact> | ||||
|                                     <file>target/script/install.karaf</file> | ||||
|                                     <type>script</type> | ||||
|                                     <classifier>install</classifier> | ||||
|                                 </artifact> | ||||
|                                 <artifact> | ||||
|                                     <file>target/cfg/ru.entaxy.esb.error.cfg</file> | ||||
|                                     <type>cfg</type> | ||||
|                                     <classifier>ru.entaxy.esb.error</classifier> | ||||
|                                 </artifact> | ||||
|                                 <artifact> | ||||
|                                     <file>target/cfg/ru.entaxy.esb.error.code.cfg</file> | ||||
|                                     <type>cfg</type> | ||||
|                                     <classifier>ru.entaxy.esb.error.code</classifier> | ||||
|                                 </artifact> | ||||
|                                 <artifact> | ||||
|                                     <file>target/cfg/ru.entaxy.esb.error.text.cfg</file> | ||||
|                                     <type>cfg</type> | ||||
|                                     <classifier>ru.entaxy.esb.error.text</classifier> | ||||
|                                 </artifact> | ||||
|                                 <artifact> | ||||
|                                     <file>target/cfg/ru.entaxy.esb.deployer.file.system.cfg</file> | ||||
|                                     <type>cfg</type> | ||||
|                                     <classifier>ru.entaxy.esb.deployer.file.system</classifier> | ||||
|                                 </artifact> | ||||
|                                 <artifact> | ||||
|                                     <file>target/cfg/ru.entaxy.esb.system.schema.cfg</file> | ||||
|                                     <type>cfg</type> | ||||
|                                     <classifier>ru.entaxy.esb.system.schema</classifier> | ||||
|                                 </artifact> | ||||
|                                 <artifact> | ||||
|                                     <file>target/cfg/ru.entaxy.esb.system.management.cfg</file> | ||||
|                                     <type>cfg</type> | ||||
|                                     <classifier>ru.entaxy.esb.system.management</classifier> | ||||
|                                 </artifact> | ||||
|                                 <artifact> | ||||
|                                     <file>target/cfg/jre.properties</file> | ||||
|                                     <type>properties</type> | ||||
|                                     <classifier>jre</classifier> | ||||
|                                 </artifact> | ||||
|                             </artifacts> | ||||
|                         </configuration> | ||||
|                     </execution> | ||||
|                 </executions> | ||||
|             </plugin> | ||||
|         </plugins> | ||||
|     </build> | ||||
|  | ||||
| </project> | ||||
| @@ -1,502 +0,0 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <!-- | ||||
|   ~~~~~~licensing~~~~~~ | ||||
|   karaf-features | ||||
|   ========== | ||||
|   Copyright (C) 2020 - 2021 EmDev LLC | ||||
|   ========== | ||||
|   Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|   you may not use this file except in compliance with the License. | ||||
|   You may obtain a copy of the License at | ||||
|    | ||||
|        http://www.apache.org/licenses/LICENSE-2.0 | ||||
|    | ||||
|   Unless required by applicable law or agreed to in writing, software | ||||
|   distributed under the License is distributed on an "AS IS" BASIS, | ||||
|   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|   See the License for the specific language governing permissions and | ||||
|   limitations under the License. | ||||
|   ~~~~~~/licensing~~~~~~ | ||||
|   --> | ||||
|  | ||||
|  | ||||
| <features name="karaf-entaxy-${project.version}" | ||||
|           xmlns="http://karaf.apache.org/xmlns/features/v1.3.0" | ||||
|           xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||||
|           xsi:schemaLocation="http://karaf.apache.org/xmlns/features/v1.3.0 http://karaf.apache.org/xmlns/features/v1.3.0"> | ||||
|  | ||||
|     <repository>mvn:org.apache.camel.karaf/apache-camel/${camel.version}/xml/features</repository> | ||||
|     <repository>mvn:org.apache.activemq/artemis-features/${activemq.version}/xml/features</repository> | ||||
|     <repository>mvn:org.hibernate/hibernate-osgi/${hibernate.version}/xml/karaf</repository> | ||||
|     <repository>mvn:org.apache.karaf.cellar/apache-karaf-cellar/${cellar.version}/xml/features</repository> | ||||
|     <repository>mvn:org.apache.ignite/ignite-osgi-karaf/${ignite.version}/xml/features</repository> | ||||
|  | ||||
|     <feature name="karaf-camel-common" version="${project.version}"> | ||||
|         <feature prerequisite="true">aries-blueprint</feature> | ||||
|         <feature>cxf</feature> | ||||
|         <feature>camel</feature> | ||||
|         <feature>camel-blueprint</feature> | ||||
|         <feature>camel-jaxb</feature> | ||||
|         <feature>camel-cxf</feature> | ||||
|         <feature>camel-amqp</feature> | ||||
|         <feature>camel-core</feature> | ||||
|         <feature>camel-http</feature> | ||||
|         <bundle>mvn:ru.entaxy.esb.system/component-bean-fix/${project.version}</bundle> | ||||
|         <capability> | ||||
|             osgi.service;objectClass=org.apache.aries.blueprint.NamespaceHandler;osgi.service.blueprint.namespace=http://camel.apache.org/schema/blueprint;effective:=active; | ||||
|         </capability> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="system-entaxy-jms" version="${project.version}"> | ||||
|         <feature>artemis-jms-client</feature> | ||||
|         <feature>camel-jms</feature> | ||||
|         <bundle>mvn:org.messaginghub/pooled-jms/1.0.6</bundle> | ||||
|         <bundle>mvn:org.apache.commons/commons-pool2/2.6.2</bundle> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="system-entaxy-db" version="${project.version}"> | ||||
|         <feature>hibernate</feature> | ||||
|         <feature>jdbc</feature> | ||||
|         <feature>pax-jdbc-pool-dbcp2</feature> | ||||
|         <feature>jndi</feature> | ||||
|         <feature>spring-jdbc</feature> | ||||
|         <feature version="[2,3)">jpa</feature> | ||||
|         <bundle>wrap:mvn:org.postgresql/postgresql/${postgresql.version}</bundle> | ||||
|         <bundle>wrap:mvn:com.microsoft.sqlserver/mssql-jdbc/${mssql.version}</bundle> | ||||
|  | ||||
|         <configfile finalname="${karaf.etc}/org.ops4j.datasource-entaxy.esb.cache.cfg" override="false"> | ||||
|             mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/datasource-cache | ||||
|         </configfile> | ||||
|         <configfile finalname="${karaf.etc}/org.ops4j.datasource-entaxy.esb.storage.cfg" override="false"> | ||||
|             mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/datasource-storage | ||||
|         </configfile> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="error-handler" version="${project.version}"> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.core/error-handler/${project.version}</bundle> | ||||
|  | ||||
|         <configfile finalname="${karaf.etc}/ru.entaxy.esb.error.cfg" override="false"> | ||||
|             mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.error | ||||
|         </configfile> | ||||
|         <configfile finalname="${karaf.etc}/ru.entaxy.esb.error.code.cfg" override="false"> | ||||
|             mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.error.code | ||||
|         </configfile> | ||||
|         <configfile finalname="${karaf.etc}/ru.entaxy.esb.error.text.cfg" override="false"> | ||||
|             mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.error.text | ||||
|         </configfile> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="entaxy-common" version="${project.version}"> | ||||
|         <configfile finalname="${karaf.etc}/jre.properties" override="true"> | ||||
|             mvn:ru.entaxy.esb/karaf-features/${project.version}/properties/jre | ||||
|         </configfile> | ||||
|  | ||||
|         <feature version="${project.version}">karaf-camel-common</feature> | ||||
|         <feature version="${project.version}">system-entaxy-db</feature> | ||||
|         <feature version="${project.version}">system-entaxy-jms</feature> | ||||
|         <feature dependency="true">ignite-core</feature> | ||||
|  | ||||
|         <bundle>mvn:org.apache.ignite/ignite-jcl/${ignite.version}</bundle> | ||||
|         <feature>camel-ignite</feature> | ||||
|         <feature>camel-sql</feature> | ||||
|  | ||||
|         <feature version="${project.version}">entaxy-esb-api</feature> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="system-maven" version="${project.version}"> | ||||
|         <bundle>mvn:org.eclipse.aether/aether-transport-http/1.1.0</bundle> | ||||
|         <bundle>mvn:org.eclipse.aether/aether-transport-file/1.1.0</bundle> | ||||
|         <bundle>mvn:org.eclipse.aether/aether-connector-basic/1.1.0</bundle> | ||||
|         <bundle>mvn:org.eclipse.aether/aether-impl/1.1.0</bundle> | ||||
|         <bundle>wrap:mvn:org.apache.maven/maven-aether-provider/3.3.9</bundle> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="system-common" version="${project.version}"> | ||||
|         <feature dependency="true">aries-blueprint</feature> | ||||
|         <feature version="${project.version}">karaf-camel-common</feature> | ||||
|         <feature version="${project.version}">system-entaxy-db</feature> | ||||
|         <feature version="${project.version}">system-entaxy-jms</feature> | ||||
|          | ||||
|         <configfile finalname="${karaf.etc}/ru.entaxy.esb.cfg" override="false"> | ||||
|             mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb | ||||
|         </configfile> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="entaxy-esb-api" version="${project.version}"> | ||||
|         <feature version="${cellar.version}">cellar</feature> | ||||
|         <feature version="${project.version}">bundle-service</feature> | ||||
|         <feature version="${project.version}">system-common</feature> | ||||
|         <feature version="${project.version}">entaxy-common</feature> | ||||
|         <feature>camel-gson</feature> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.core/template/${project.version}</bundle> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.commons/system-commons/${project.version}</bundle> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.core.dispatcher/dispatcher/${project.version}</bundle> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.registry.profile.commons/profile-commons/${project.version}</bundle> | ||||
|  | ||||
|         <bundle>mvn:ru.entaxy.esb.system.registry.connector/connector-impl/${project.version}</bundle> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.registry.connector/connector-api/${project.version}</bundle> | ||||
|         <feature version="${project.version}">system-api</feature> | ||||
|         <feature version="${project.version}">nexus-deployer</feature> | ||||
|         <feature version="${project.version}">file-system-deployer</feature> | ||||
|         <feature version="${project.version}">cellar-deployer</feature> | ||||
|  | ||||
|         <feature version="${project.version}">blueprint-generator</feature> | ||||
| <!--        <feature version="${project.version}">file-connector</feature>--> | ||||
|  | ||||
|         <bundle>mvn:ru.entaxy.esb.system.management.bundle.manager/bundle-manager/${project.version}</bundle> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.management.connector.manager/connector-manager/${project.version}</bundle> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.management.bridge.profile.manager/bridge-profile-manager/${project.version} | ||||
|         </bundle> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.management.profile.manager/profile-manager/${project.version}</bundle> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.management.route.manager/route-manager/${project.version}</bundle> | ||||
|         <feature version="${project.version}">system-management</feature> | ||||
|  | ||||
|         <feature version="${project.version}">schema</feature> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="file-system-deployer" version="${project.version}"> | ||||
|         <feature>camel-blueprint</feature> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.deployer/deployer-api/${project.version}</bundle> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.deployer/file-system-deployer/${project.version}</bundle> | ||||
|         <configfile finalname="${karaf.etc}/ru.entaxy.esb.deployer.file.system.cfg" override="false"> | ||||
|             mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.deployer.file.system | ||||
|         </configfile> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="nexus-deployer" version="${project.version}"> | ||||
|         <bundle>mvn:org.eclipse.aether/aether-api/${aether.version}</bundle> | ||||
|         <feature>camel-http</feature> | ||||
|         <feature>camel-cxf</feature> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.deployer/deployer-api/${project.version}</bundle> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.deployer/nexus-deployer/${project.version}</bundle> | ||||
|         <configfile finalname="${karaf.etc}/ru.entaxy.esb.deployer.nexus.cfg" override="false"> | ||||
|             mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.deployer.nexus | ||||
|         </configfile> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="cellar-deployer" version="${project.version}"> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.deployer/cellar-deployer/${project.version}</bundle> | ||||
|         <configfile finalname="${karaf.etc}/ru.entaxy.esb.deployer.cellar.cfg" override="false"> | ||||
|             mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.deployer.cellar | ||||
|         </configfile> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="blueprint-generator" version="${project.version}"> | ||||
|         <bundle>mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker/2.3.29_1</bundle> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.management.blueprint.generator/blueprint-generator/${project.version}</bundle> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="bundle-service" version="${project.version}"> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.management.bundle.jpa/bundle-service/${project.version}</bundle> | ||||
|         <capability> | ||||
|             osgi.service;objectClass=org.hibernate.SessionFactory;effective:=active; | ||||
|         </capability> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="system-management" version="${project.version}"> | ||||
|     	<configfile finalname="${karaf.etc}/ru.entaxy.esb.system.management.cfg" override="false"> | ||||
|             mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.system.management | ||||
|         </configfile> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.management/system-management-api/${project.version}</bundle> | ||||
|         <capability> | ||||
|             osgi.service;objectClass=org.hibernate.SessionFactory;effective:=active; | ||||
|         </capability> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="profile-commons" version="${project.version}"> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.core.dispatcher/dispatcher/${project.version}</bundle> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.registry.profile.commons/profile-commons/${project.version}</bundle> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="liquibase-updater" version="${project.version}"> | ||||
|         <feature version="${project.version}">karaf-camel-common</feature> | ||||
|         <feature version="${project.version}">system-entaxy-db</feature> | ||||
|         <feature version="${project.version}">system-entaxy-jms</feature> | ||||
|  | ||||
|         <bundle>mvn:org.liquibase/liquibase-core/${liquibase.version}</bundle> | ||||
|  | ||||
|         <bundle>mvn:ru.entaxy.esb.platform.runtime.core.initializer.storage.initializer/liquibase-updater/${project.version}</bundle> | ||||
|         <feature version="${project.version}">storage-cache</feature> | ||||
|         <feature version="${project.version}">storage-esb_entaxy</feature> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="storage-cache" version="${project.version}"> | ||||
|         <bundle>mvn:ru.entaxy.esb.platform.runtime.core.initializer.storage.initializer/storage-cache/${project.version}</bundle> | ||||
|         <capability> | ||||
|             osgi.service;effective:=active;objectClass=javax.sql.DataSource;osgi.jndi.service.name=entaxy.esb.cache; | ||||
|         </capability> | ||||
|         <capability> | ||||
|             osgi.service;objectClass=javax.sql.DataSource;osgi.jndi.service.name=entaxy.esb.cache-connector; | ||||
|         </capability> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="storage-esb_entaxy" version="${project.version}"> | ||||
|         <bundle>mvn:ru.entaxy.esb.platform.runtime.core.initializer.storage.initializer/storage-esb_entaxy/${project.version}</bundle> | ||||
|         <capability> | ||||
|             osgi.service;effective:=active;objectClass=javax.sql.DataSource;osgi.jndi.service.name=entaxy.esb.storage; | ||||
|         </capability> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="system-profile" version="${project.version}"> | ||||
|         <feature version="${project.version}">profile-commons</feature> | ||||
|  | ||||
|         <bundle>mvn:ru.entaxy.esb.system.registry.systems.profile/system-profile-api/${project.version}</bundle> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.registry.systems.profile/system-profile-collector/${project.version}</bundle> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.registry.systems.profile/system-profile-impl-default/${project.version} | ||||
|         </bundle> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="system-api" version="${project.version}"> | ||||
|         <feature version="${project.version}">system-entaxy-db</feature> | ||||
|         <feature version="${project.version}">system-entaxy-jms</feature> | ||||
|         <feature version="${project.version}">bundle-service</feature> | ||||
|         <feature version="${project.version}">permission-api</feature> | ||||
|  | ||||
|         <bundle>mvn:ru.entaxy.esb.system.commons/system-commons/${project.version}</bundle> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.registry.connector/connector-api/${project.version}</bundle> | ||||
|  | ||||
|         <bundle>mvn:ru.entaxy.esb.system.registry.systems/system-api/${project.version}</bundle> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.registry.systems/system-impl/${project.version}</bundle> | ||||
|  | ||||
|         <capability> | ||||
|             osgi.service;objectClass=org.hibernate.SessionFactory;effective:=active; | ||||
|         </capability> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="system-registry" version="${project.version}"> | ||||
|         <feature version="${project.version}">karaf-camel-common</feature> | ||||
|         <feature version="${project.version}">system-entaxy-jms</feature> | ||||
|  | ||||
|         <feature version="${project.version}">system-common</feature> | ||||
|         <feature version="${project.version}">system-profile</feature> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.registry.systems/system-component/${project.version}</bundle> | ||||
|  | ||||
|         <capability> | ||||
|             osgi.service;objectClass=org.hibernate.SessionFactory;effective:=active; | ||||
|         </capability> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="system-group-profile" version="${project.version}"> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.registry.system-groups.profile/system-group-profile-api/${project.version} | ||||
|         </bundle> | ||||
|         <bundle> | ||||
|             mvn:ru.entaxy.esb.system.registry.system-groups.profile/system-group-profile-collector/${project.version} | ||||
|         </bundle> | ||||
|         <bundle> | ||||
|             mvn:ru.entaxy.esb.system.registry.system-groups.profile/system-group-profile-impl-default/${project.version} | ||||
|         </bundle> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="system-group-registry" version="${project.version}"> | ||||
|         <feature version="${project.version}">karaf-camel-common</feature> | ||||
|         <feature version="${project.version}">system-entaxy-jms</feature> | ||||
|  | ||||
|         <feature version="${project.version}">system-common</feature> | ||||
|         <feature version="${project.version}">system-group-profile</feature> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.registry.system-groups/system-group-component/${project.version}</bundle> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="basic-auth" version="${project.version}"> | ||||
|         <feature version="${project.version}">karaf-camel-common</feature> | ||||
|         <feature version="${project.version}">liquibase-updater</feature> | ||||
|         <bundle>mvn:commons-codec/commons-codec/${commons-codec.version}</bundle> | ||||
|  | ||||
|         <configfile finalname="${karaf.etc}/ru.entaxy.esb.system.basic_auth.cfg" override="false"> | ||||
|             mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.system.basic_auth | ||||
|         </configfile> | ||||
|         <configfile finalname="${karaf.etc}/ru.entaxy.esb.system.basic_auth.htpasswd.cfg" override="false"> | ||||
|             mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.system.basic_auth.htpasswd | ||||
|         </configfile> | ||||
|  | ||||
|         <bundle>mvn:ru.entaxy.esb.system.auth.basic.api/basic-auth-api/${project.version}</bundle> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.auth.basic.impl/basic-auth-impl/${project.version}</bundle> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.auth.basic.htpasswd/htpasswd/${project.version}</bundle> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.auth.basic/basic-auth-soap/${project.version}</bundle> | ||||
|         <capability> | ||||
|             osgi.service;objectClass=org.hibernate.SessionFactory;effective:=active; | ||||
|         </capability> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="events" version="${project.version}"> | ||||
|         <feature version="${project.version}">events-impl</feature> | ||||
|         <feature version="${project.version}">events-rest</feature> | ||||
|         <feature version="${project.version}">events-handler</feature> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="events-common" version="${project.version}"> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.core.events/events-common/${project.version}</bundle> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="events-rest" version="${project.version}"> | ||||
|         <feature version="${cellar.version}">cellar</feature> | ||||
|         <feature version="${cellar.version}">cellar-eventadmin</feature> | ||||
|         <feature>camel-eventadmin</feature> | ||||
|         <feature version="${project.version}">karaf-camel-common</feature> | ||||
|         <feature>camel-jsonpath</feature> | ||||
|         <feature>camel-gson</feature> | ||||
|         <feature version="${project.version}">system-common</feature> | ||||
|         <feature version="${project.version}">error-handler</feature> | ||||
|         <feature version="${project.version}">system-registry</feature> | ||||
|  | ||||
|         <feature version="${project.version}">system-api</feature> | ||||
|  | ||||
|         <feature version="${project.version}">events-api</feature> | ||||
|         <feature version="${project.version}">basic-auth</feature> | ||||
|         <feature version="${project.version}">events-common</feature> | ||||
|  | ||||
|         <feature version="${project.version}">permission-impl</feature> | ||||
|         <feature version="${project.version}">permission-handler</feature> | ||||
|         <feature version="${project.version}">permission-component</feature> | ||||
|  | ||||
|         <bundle>mvn:ru.entaxy.esb.system.commons/system-commons/${project.version}</bundle> | ||||
|  | ||||
|         <configfile finalname="${karaf.etc}/ru.entaxy.esb.system.event.rest.cfg" override="false"> | ||||
|             mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.system.event.rest | ||||
|         </configfile> | ||||
|  | ||||
|         <bundle>mvn:ru.entaxy.esb.system.core.events/events-rest/${project.version}</bundle> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="events-api" version="${project.version}"> | ||||
|         <feature version="${project.version}">system-entaxy-db</feature> | ||||
|  | ||||
|         <feature version="${project.version}">events-common</feature> | ||||
|  | ||||
|         <bundle>mvn:ru.entaxy.esb.system.core.events/events-api/${project.version}</bundle> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="events-impl" version="${project.version}"> | ||||
|         <feature version="${project.version}">system-common</feature> | ||||
|         <feature version="${project.version}">events-api</feature> | ||||
|  | ||||
|         <feature version="${project.version}">events-common</feature> | ||||
|  | ||||
|         <bundle>mvn:ru.entaxy.esb.system.core.events/events-impl/${project.version}</bundle> | ||||
|         <capability> | ||||
|             osgi.service;objectClass=org.hibernate.SessionFactory;effective:=active; | ||||
|         </capability> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="events-handler" version="${project.version}"> | ||||
|         <feature>camel-ognl</feature> | ||||
|         <feature>camel-gson</feature> | ||||
|         <feature>camel-quartz</feature> | ||||
|         <feature version="${project.version}">system-common</feature> | ||||
|         <feature version="${project.version}">events-api</feature> | ||||
|  | ||||
|         <feature version="${project.version}">events-common</feature> | ||||
|  | ||||
|         <configfile finalname="${karaf.etc}/ru.entaxy.esb.system.event.handler.cfg" override="false"> | ||||
|             mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.system.event.handler | ||||
|         </configfile> | ||||
|  | ||||
|         <bundle>mvn:ru.entaxy.esb.system.core.events/events-handler/${project.version}</bundle> | ||||
|  | ||||
|         <capability> | ||||
|             osgi.service;effective:=active;objectClass=javax.sql.DataSource;osgi.jndi.service.name=entaxy.esb.cache; | ||||
|         </capability> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="permission" version="${project.version}"> | ||||
|         <feature version="${project.version}">permission-impl</feature> | ||||
|         <feature version="${project.version}">permission-handler</feature> | ||||
|         <feature version="${project.version}">permission-component</feature> | ||||
|         <feature version="${project.version}">permission-soap</feature> | ||||
|         <feature version="${project.version}">permission-manager</feature> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="permission-common" version="${project.version}"> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.core.permission/permission-common/${project.version}</bundle> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="permission-api" version="${project.version}"> | ||||
|         <feature version="${project.version}">system-entaxy-db</feature> | ||||
|  | ||||
|         <bundle>mvn:ru.entaxy.esb.system.core.permission/permission-api/${project.version}</bundle> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="permission-impl" version="${project.version}"> | ||||
|         <feature version="${project.version}">liquibase-updater</feature> | ||||
|         <feature version="${project.version}">system-entaxy-db</feature> | ||||
|         <feature version="${project.version}">system-common</feature> | ||||
|         <feature version="${project.version}">permission-api</feature> | ||||
|  | ||||
|         <feature version="${project.version}">permission-common</feature> | ||||
|  | ||||
|         <bundle>mvn:ru.entaxy.esb.system.core.permission/permission-impl/${project.version}</bundle> | ||||
|         <capability> | ||||
|             osgi.service;objectClass=org.hibernate.SessionFactory;effective:=active; | ||||
|         </capability> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="permission-handler" version="${project.version}"> | ||||
|         <feature>camel-ognl</feature> | ||||
|         <feature version="${project.version}">system-entaxy-jms</feature> | ||||
|         <feature version="${project.version}">system-common</feature> | ||||
|         <feature version="${project.version}">permission-impl</feature> | ||||
|  | ||||
|         <feature version="${project.version}">permission-common</feature> | ||||
|  | ||||
|         <!--         <configfile finalname="${karaf.etc}/ru.entaxy.esb.system.event.handler.cfg" override="false">mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.system.event.handler</configfile> --> | ||||
|  | ||||
|         <bundle>mvn:ru.entaxy.esb.system.core.permission/permission-handler/${project.version}</bundle> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="permission-manager" version="${project.version}"> | ||||
|         <feature version="${project.version}">permission-component</feature> | ||||
|  | ||||
|         <bundle>mvn:ru.entaxy.esb.system.management.permission.manager/permission-manager/${project.version}</bundle> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="permission-component" version="${project.version}"> | ||||
|         <feature version="${project.version}">system-common</feature> | ||||
|         <feature>camel-gson</feature> | ||||
|         <feature version="${project.version}">permission-common</feature> | ||||
|         <feature version="${project.version}">permission-impl</feature> | ||||
|         <feature version="${project.version}">system-api</feature> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.commons/system-commons/${project.version}</bundle> | ||||
|  | ||||
|         <bundle>mvn:ru.entaxy.esb.system.core.permission/permission-component/${project.version}</bundle> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="permission-soap" version="${project.version}"> | ||||
|         <feature version="${project.version}">basic-auth</feature> | ||||
|         <feature version="${project.version}">karaf-camel-common</feature> | ||||
|  | ||||
|         <bundle>mvn:ru.entaxy.esb.system.core.permission/permission-soap/${project.version}</bundle> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="schema" version="${project.version}"> | ||||
|         <feature version="${project.version}">system-entaxy-db</feature> | ||||
| 		 | ||||
| 		<configfile finalname="${karaf.etc}/ru.entaxy.esb.system.schema.cfg" override="false"> | ||||
|             mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.system.schema | ||||
|         </configfile> | ||||
| 		 | ||||
|         <bundle>mvn:ru.entaxy.esb.system.registry.schema/schema-api/${project.version}</bundle> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.registry.schema/schema-impl/${project.version}</bundle> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.registry.schema/schema-soap/${project.version}</bundle> | ||||
|         <bundle>mvn:ru.entaxy.esb.system.registry.schema/schema-component/${project.version}</bundle> | ||||
|         <capability> | ||||
|             osgi.service;objectClass=org.hibernate.SessionFactory;effective:=active; | ||||
|         </capability> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="entaxy-service" version="${project.version}"> | ||||
|         <feature version="${project.version}">basic-auth</feature> | ||||
|         <feature version="${project.version}">permission</feature> | ||||
|         <feature version="${project.version}">entaxy-esb-api</feature> | ||||
|         <feature version="${project.version}">system-registry</feature> | ||||
|         <feature version="${project.version}">system-group-registry</feature> | ||||
|         <feature version="${project.version}">events</feature> | ||||
|     </feature> | ||||
|  | ||||
|     <feature name="entaxy-all" version="${project.version}"> | ||||
|         <configfile finalname="${karaf.etc}/branding.properties" override="true"> | ||||
|             mvn:ru.entaxy.esb.platform.runtime.base/branding/${project.version}/properties/branding | ||||
|         </configfile> | ||||
|  | ||||
|         <feature version="${project.version}">entaxy-service</feature> | ||||
|     </feature> | ||||
|  | ||||
| </features> | ||||
| @@ -1,9 +0,0 @@ | ||||
|  | ||||
|  | ||||
| ## Репозиторий с релизами | ||||
|  | ||||
| http://192.168.122.76:8081/service/rest/repository/browse/karaf_patch/ | ||||
|  | ||||
| ## Install patch | ||||
|  | ||||
|     tar -zxf karaf_update_1.0.10-SNAPSHOT.tgz install.sh; ./install.sh 1.0.10-SNAPSHOT | ||||
| @@ -1,67 +0,0 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| ### | ||||
| # ~~~~~~licensing~~~~~~ | ||||
| # karaf-features | ||||
| # ========== | ||||
| # Copyright (C) 2020 - 2021 EmDev LLC | ||||
| # ========== | ||||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| # you may not use this file except in compliance with the License. | ||||
| # You may obtain a copy of the License at | ||||
| #  | ||||
| #      http://www.apache.org/licenses/LICENSE-2.0 | ||||
| #  | ||||
| # Unless required by applicable law or agreed to in writing, software | ||||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| # See the License for the specific language governing permissions and | ||||
| # limitations under the License. | ||||
| # ~~~~~~/licensing~~~~~~ | ||||
| ### | ||||
|  | ||||
| DIRNAME="$( cd "$(dirname "$0")" ; pwd -P )" | ||||
|  | ||||
| INSTALL_DIR=$DIRNAME/karaf-full-$(date +%d%m%Y-%H%M) | ||||
|  | ||||
| mkdir -p $INSTALL_DIR/bin | ||||
| mkdir -p $INSTALL_DIR/etc | ||||
| mkdir -p $INSTALL_DIR/lib | ||||
| mkdir -p $INSTALL_DIR/system | ||||
| mkdir -p $INSTALL_DIR/data | ||||
| mkdir -p $INSTALL_DIR/systemd/system | ||||
|  | ||||
| sudo systemctl stop karaf | ||||
| echo "Stopped karaf" | ||||
|  | ||||
| cp -R /opt/karaf/bin/* $INSTALL_DIR/bin | ||||
| cp -R /opt/karaf/etc/* $INSTALL_DIR/etc | ||||
| cp -R /opt/karaf/lib/* $INSTALL_DIR/lib | ||||
| cp -R /opt/karaf/system/* $INSTALL_DIR/system | ||||
| cp -R /opt/karaf/data/* $INSTALL_DIR/data | ||||
| cp /etc/systemd/system/karaf $INSTALL_DIR/systemd/system | ||||
| cp /etc/systemd/system/karaf.service $INSTALL_DIR/systemd/system | ||||
|  | ||||
| sudo systemctl start karaf | ||||
| echo "Started karaf" | ||||
|  | ||||
| rm -rf $INSTALL_DIR/data/tmp/* | ||||
| rm -rf $INSTALL_DIR/data/log/* | ||||
| rm -rf $INSTALL_DIR/data/txlog/* | ||||
|  | ||||
| #pushd ./$INSTALL_DIR/etc | ||||
| #$DIRNAME/change_ips.sh | ||||
| #popd | ||||
|  | ||||
| if test -f "$DIRNAME/version"; then | ||||
|     ESB_ENTAXY_VERSION=`cat $DIRNAME/version` | ||||
| else | ||||
|     ESB_ENTAXY_VERSION=1.8.0 | ||||
| fi | ||||
| echo "Installing $ESB_ENTAXY_VERSION" | ||||
|  | ||||
| pushd $INSTALL_DIR | ||||
| tar czvf $DIRNAME/karaf_full_$ESB_ENTAXY_VERSION.tgz * | ||||
| popd | ||||
|  | ||||
| rm -rf $INSTALL_DIR | ||||
| @@ -1,64 +0,0 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| ### | ||||
| # ~~~~~~licensing~~~~~~ | ||||
| # karaf-features | ||||
| # ========== | ||||
| # Copyright (C) 2020 - 2021 EmDev LLC | ||||
| # ========== | ||||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| # you may not use this file except in compliance with the License. | ||||
| # You may obtain a copy of the License at | ||||
| #  | ||||
| #      http://www.apache.org/licenses/LICENSE-2.0 | ||||
| #  | ||||
| # Unless required by applicable law or agreed to in writing, software | ||||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| # See the License for the specific language governing permissions and | ||||
| # limitations under the License. | ||||
| # ~~~~~~/licensing~~~~~~ | ||||
| ### | ||||
|  | ||||
| # создает архив с обновлением | ||||
|  | ||||
| DIRNAME="$( cd "$(dirname "$0")" ; pwd -P )" | ||||
|  | ||||
| if test -f "$DIRNAME/version"; then | ||||
|     ESB_ENTAXY_VERSION=`cat $DIRNAME/version` | ||||
| else | ||||
|     ESB_ENTAXY_VERSION=1.8.0 | ||||
| fi | ||||
| echo "Create patch version $ESB_ENTAXY_VERSION" | ||||
|  | ||||
| RELEASE_DIR=$DIRNAME/karaf-$(date +%d%m%Y-%H%M) | ||||
| mkdir -p $RELEASE_DIR | ||||
|  | ||||
| mkdir -p $RELEASE_DIR/etc | ||||
| mkdir -p $RELEASE_DIR/data | ||||
|  | ||||
| sudo systemctl stop karaf | ||||
| echo "Stopped karaf" | ||||
|  | ||||
| cp -R /opt/karaf/etc/* $RELEASE_DIR/etc | ||||
| cp -R /opt/karaf/data/* $RELEASE_DIR/data | ||||
| cp $DIRNAME/change_ips.sh $RELEASE_DIR/etc | ||||
| cp $DIRNAME/install_patch.sh $RELEASE_DIR/install.sh | ||||
|  | ||||
| sudo systemctl start karaf | ||||
| echo "Started karaf" | ||||
|  | ||||
| rm -rf $RELEASE_DIR/data/tmp/* | ||||
| rm -rf $RELEASE_DIR/data/log/* | ||||
| rm -rf $RELEASE_DIR/data/txlog/* | ||||
|  | ||||
| pushd $RELEASE_DIR | ||||
| tar czvf $DIRNAME/karaf_update_$ESB_ENTAXY_VERSION.tgz * | ||||
| popd | ||||
|  | ||||
|  | ||||
| rm -rf $RELEASE_DIR | ||||
|  | ||||
| curl -v --user 'deployer:deployer' --upload-file $DIRNAME/README.md http://192.168.122.76:8081/repository/karaf_patch/README.md | ||||
| curl -v --user 'deployer:deployer' --upload-file $DIRNAME/karaf_update_$ESB_ENTAXY_VERSION.tgz http://192.168.122.76:8081/repository/karaf_patch/karaf_update_$ESB_ENTAXY_VERSION.tgz | ||||
| echo "Upload path to nexus http://192.168.122.76:8081/service/rest/repository/browse/karaf_patch/" | ||||
| @@ -1,16 +0,0 @@ | ||||
| ESB_ENTAXY_VERSION=${project.version} | ||||
| echo "Entaxy version=$ESB_ENTAXY_VERSION" | ||||
|  | ||||
|  | ||||
| feature:repo-add mvn:ru.entaxy.esb/karaf-features/$ESB_ENTAXY_VERSION/xml/features | ||||
| echo "feature:install entaxy-all" | ||||
| feature:install entaxy-all | ||||
| feature:repo-add mvn:ru.entaxy.esb.platform.runtime/base/$ESB_ENTAXY_VERSION/xml/features | ||||
| echo "feature:install base" | ||||
| feature:install entaxy-platform-base | ||||
| feature:repo-add mvn:ru.entaxy.esb.platform.runtime/core/$ESB_ENTAXY_VERSION/xml/features | ||||
| echo "feature:install core" | ||||
| feature:install entaxy-platform-core | ||||
| feature:repo-add mvn:ru.entaxy.esb.platform.runtime.modules/uniform-service/$ESB_ENTAXY_VERSION/xml/features | ||||
| echo "feature:install entaxy-uniform-service" | ||||
| feature:install entaxy-uniform-service | ||||
| @@ -1,75 +0,0 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| ### | ||||
| # ~~~~~~licensing~~~~~~ | ||||
| # karaf-features | ||||
| # ========== | ||||
| # Copyright (C) 2020 - 2021 EmDev LLC | ||||
| # ========== | ||||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| # you may not use this file except in compliance with the License. | ||||
| # You may obtain a copy of the License at | ||||
| #  | ||||
| #      http://www.apache.org/licenses/LICENSE-2.0 | ||||
| #  | ||||
| # Unless required by applicable law or agreed to in writing, software | ||||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| # See the License for the specific language governing permissions and | ||||
| # limitations under the License. | ||||
| # ~~~~~~/licensing~~~~~~ | ||||
| ### | ||||
|  | ||||
| # первый параметр номер версии | ||||
| # если задан второй параметр чистит конфиги | ||||
|  | ||||
| DIRNAME="$( cd "$(dirname "$0")" ; pwd -P )" | ||||
| ESB_ENTAXY_VERSION=$1 | ||||
| PATCH_FILE=$DIRNAME/karaf_update_$ESB_ENTAXY_VERSION.tgz | ||||
|  | ||||
| if test -f "$PATCH_FILE"; then | ||||
|   echo "Installing $ESB_ENTAXY_VERSION, use patch file: $PATCH_FILE" | ||||
| else | ||||
|   echo "Error: patch file $PATCH_FILE not found" | ||||
| fi | ||||
|  | ||||
| sudo systemctl stop karaf | ||||
| echo "Stopped karaf" | ||||
|  | ||||
| BKPDIR=$DIRNAME/backup-karaf-$(date +%d%m%Y-%H%M) | ||||
| mkdir -p $BKPDIR | ||||
| echo "Created dir $BKPDIR" | ||||
|  | ||||
| # create backup | ||||
| sudo cp -r /opt/karaf/etc $BKPDIR | ||||
| sudo cp -r /opt/karaf/data $BKPDIR | ||||
|  | ||||
| # clean backed dirs | ||||
| sudo su - -c "rm -rf /opt/karaf/data/*" karaf | ||||
|  | ||||
| if [ -n "$2" ] | ||||
| then | ||||
|   # clean configs | ||||
|   sudo su - -c "rm -rf /opt/karaf/etc/ru.entaxy.esb.*" karaf | ||||
|   sudo su - -c "rm -rf /opt/karaf/etc/org.ops4j.datasource-entaxy.esb.*" karaf | ||||
|   echo "Karaf data and configs cleaned up" | ||||
| else | ||||
|   echo "Karaf data cleaned up" | ||||
| fi | ||||
|  | ||||
| sudo tar -zxk -f $PATCH_FILE -C /opt/karaf/ | ||||
|  | ||||
| if [ -n "$2" ] | ||||
| then | ||||
|   sudo /opt/karaf/etc/change_ips.sh | ||||
|   echo "Run change_ips.sh" | ||||
| fi | ||||
|  | ||||
| # restore file owner | ||||
| sudo chown -R karaf. /opt/karaf/{etc,data} | ||||
|  | ||||
| sudo systemctl start karaf | ||||
| echo "Started karaf" | ||||
|  | ||||
| sleep 30 | ||||
| sudo su - -c "/opt/karaf/bin/client 'list --no-format | grep -v Active'" karaf | ||||
| @@ -1,83 +0,0 @@ | ||||
| #!/bin/sh | ||||
|  | ||||
| ### | ||||
| # ~~~~~~licensing~~~~~~ | ||||
| # karaf-features | ||||
| # ========== | ||||
| # Copyright (C) 2020 - 2021 EmDev LLC | ||||
| # ========== | ||||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| # you may not use this file except in compliance with the License. | ||||
| # You may obtain a copy of the License at | ||||
| #  | ||||
| #      http://www.apache.org/licenses/LICENSE-2.0 | ||||
| #  | ||||
| # Unless required by applicable law or agreed to in writing, software | ||||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| # See the License for the specific language governing permissions and | ||||
| # limitations under the License. | ||||
| # ~~~~~~/licensing~~~~~~ | ||||
| ### | ||||
|  | ||||
| # берет номер версии из файла version, если его нет то используется 1.8.0 | ||||
| # если задан первый параметр чистит конфиги | ||||
|  | ||||
| DIRNAME="$( cd "$(dirname "$0")" ; pwd -P )" | ||||
|  | ||||
| if test -f "$DIRNAME/version"; then | ||||
|     ESB_ENTAXY_VERSION=`cat $DIRNAME/version` | ||||
| else | ||||
|     ESB_ENTAXY_VERSION=1.8.0 | ||||
| fi | ||||
| echo "Installing $ESB_ENTAXY_VERSION" | ||||
|  | ||||
| sudo systemctl stop karaf | ||||
|  | ||||
| echo "Stopped karaf" | ||||
|  | ||||
| BKPDIR=$DIRNAME/backup-karaf-$(date +%d%m%Y-%H%M) | ||||
| mkdir -p $BKPDIR | ||||
|  | ||||
| echo "Created dir $BKPDIR" | ||||
|  | ||||
| # create backup | ||||
| cp -r /opt/karaf/etc $BKPDIR | ||||
| cp -r /opt/karaf/data $BKPDIR | ||||
|  | ||||
| # clean backed dirs | ||||
| sudo rm -rf /opt/karaf/data/* | ||||
|  | ||||
| if [ -n "$1" ] | ||||
| then | ||||
|   # clean configs | ||||
|   sudo rm -rf /opt/karaf/etc/ru.entaxy.esb.* | ||||
|   sudo rm -rf /opt/karaf/etc/org.ops4j.datasource-entaxy.esb.* | ||||
|   echo "Karaf data and configs cleaned up" | ||||
| else | ||||
|   echo "Karaf data cleaned up" | ||||
| fi | ||||
|  | ||||
| # restore file owner | ||||
| sudo chown -R karaf. /opt/karaf/{etc,data} | ||||
|  | ||||
| sudo systemctl start karaf | ||||
|  | ||||
| echo "Started karaf" | ||||
|  | ||||
| sleep 15 | ||||
|  | ||||
| sudo cp -r $DIRNAME/install.karaf /opt/karaf/ | ||||
|  | ||||
| sudo su - -c "/opt/karaf/bin/client 'esb_entaxy_VERSION=$ESB_ENTAXY_VERSION; shell:source /opt/karaf/install.karaf;'" karaf | ||||
|  | ||||
| echo "== Update database" | ||||
| sudo su - -c "/opt/karaf/bin/client 'feature:install liquibase-updater'" karaf | ||||
| sleep 60 | ||||
| echo "== Install all features" | ||||
| sudo su - -c "/opt/karaf/bin/client 'feature:install entaxy-all'" karaf | ||||
| sleep 60 | ||||
| echo "== Install system-group profile" | ||||
| sudo su - -c "/opt/karaf/bin/client 'bundle:install -s blueprint:mvn:ru.entaxy.esb.integration.esb.test.profiles/test-profiles/$ESB_ENTAXY_VERSION/xml/g_test'" karaf | ||||
|  | ||||
| echo "Install process finished" | ||||
| @@ -5,7 +5,7 @@ | ||||
|     <parent> | ||||
|         <artifactId>root</artifactId> | ||||
|         <groupId>ru.entaxy.esb</groupId> | ||||
|         <version>1.8.0</version> | ||||
|         <version>1.8.1</version> | ||||
|     </parent> | ||||
|     <modelVersion>4.0.0</modelVersion> | ||||
|  | ||||
|   | ||||
							
								
								
									
										52
									
								
								platform/runtime/base/base-support/pom.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,52 @@ | ||||
| <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</groupId> | ||||
|     <artifactId>base</artifactId> | ||||
|     <version>1.8.1</version> | ||||
|   </parent> | ||||
|   <groupId>ru.entaxy.esb.platform.runtime.base</groupId> | ||||
|   <artifactId>base-support</artifactId> | ||||
|   <packaging>bundle</packaging> | ||||
|   <name>ENTAXY :: PLATFORM :: BASE :: SUPPORT</name> | ||||
|   <description>ENTAXY :: PLATFORM :: BASE :: SUPPORT</description> | ||||
|    | ||||
|   <properties> | ||||
|   	<bundle.osgi.export.pkg> | ||||
|   		ru.entaxy.platform.base.support, | ||||
|   		ru.entaxy.platform.base.support.xml, | ||||
|   		ru.entaxy.platform.base.support.osgi, | ||||
|   		ru.entaxy.platform.base.support.osgi.tracker, | ||||
|   		ru.entaxy.platform.base.support.osgi.filter | ||||
|   	</bundle.osgi.export.pkg> | ||||
|   </properties> | ||||
|    | ||||
|   <dependencies> | ||||
|   	<dependency> | ||||
|   		<groupId>org.apache.commons</groupId> | ||||
|   		<artifactId>commons-lang3</artifactId> | ||||
|   		<version>${commons-lang3.version}</version> | ||||
|   	</dependency> | ||||
|   	<dependency> | ||||
|   		<groupId>commons-io</groupId> | ||||
|   		<artifactId>commons-io</artifactId> | ||||
|   		<version>${commons-io.version}</version> | ||||
|   	</dependency> | ||||
|   	<dependency> | ||||
|   		<groupId>org.osgi</groupId> | ||||
|   		<artifactId>osgi.core</artifactId> | ||||
|   	</dependency> | ||||
|     <dependency> | ||||
|         <groupId>javax.xml.bind</groupId> | ||||
|         <artifactId>jaxb-api</artifactId> | ||||
|     </dependency> | ||||
|     <dependency> | ||||
|     	<groupId>commons-codec</groupId> | ||||
|     	<artifactId>commons-codec</artifactId> | ||||
|     </dependency> | ||||
|     <dependency> | ||||
|         <groupId>com.google.code.gson</groupId> | ||||
|         <artifactId>gson</artifactId> | ||||
|     </dependency> | ||||
|   </dependencies> | ||||
| </project> | ||||
| @@ -0,0 +1,285 @@ | ||||
| /*- | ||||
|  * ~~~~~~licensing~~~~~~ | ||||
|  * base-support | ||||
|  * ========== | ||||
|  * Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  * ========== | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  *  | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  *  | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  * ~~~~~~/licensing~~~~~~ | ||||
|  */ | ||||
| package ru.entaxy.platform.base.support; | ||||
|  | ||||
| import java.io.File; | ||||
| import java.io.FileOutputStream; | ||||
| import java.io.InputStream; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Dictionary; | ||||
| import java.util.Enumeration; | ||||
| import java.util.HashMap; | ||||
| import java.util.Iterator; | ||||
| import java.util.List; | ||||
| import java.util.ListIterator; | ||||
| import java.util.Map; | ||||
| import java.util.UUID; | ||||
|  | ||||
| import org.apache.commons.io.IOUtils; | ||||
| import org.apache.commons.lang3.StringUtils; | ||||
|  | ||||
| /** | ||||
|  *  | ||||
|  * Common util for all bus components | ||||
|  *  | ||||
|  * @author fav | ||||
|  * | ||||
|  */ | ||||
| public class CommonUtils { | ||||
| 	 | ||||
| 	public static final String GUID_0	= "00000000-0000-0000-0000-000000000000"; | ||||
| 	public static final String GUID_f	= "FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF"; | ||||
| 	public static final String NULL_GUID_	= GUID_0; | ||||
| 	 | ||||
| 	public static final String PACKET_TYPE_PARAM_NAME = "packetType"; | ||||
|  | ||||
| 	public static class Path { | ||||
| 		 | ||||
| 		public static final String DEFAULT_SEPARATOR = "/"; | ||||
| 		 | ||||
| 		protected String separator = DEFAULT_SEPARATOR; | ||||
| 		protected List<String> data = new ArrayList<>(); | ||||
| 		 | ||||
| 		public static Path create() { | ||||
| 			return new Path(); | ||||
| 		} | ||||
| 		 | ||||
| 		public static boolean isAbsolute(String path) { | ||||
| 			return isAbsolute(path, DEFAULT_SEPARATOR); | ||||
| 		} | ||||
| 		 | ||||
| 		public static boolean isAbsolute(String path, String separator) { | ||||
| 			if (!isValid(path)) | ||||
| 				return false; | ||||
| 			return path.trim().startsWith(separator); | ||||
| 		} | ||||
| 		 | ||||
| 		public Path() { | ||||
| 			super(); | ||||
| 		} | ||||
| 		 | ||||
| 		public Path separator(String newSeparator) { | ||||
| 			if (newSeparator!=null) | ||||
| 				this.separator = newSeparator; | ||||
| 			return this; | ||||
| 		} | ||||
| 		 | ||||
| 		public Path construct(String...fragments) { | ||||
| 			data.clear(); | ||||
| 			return append(fragments); | ||||
| 		} | ||||
| 		 | ||||
| 		public Path append(String...fragments) { | ||||
| 			if (fragments==null) | ||||
| 				return this; | ||||
| 			for (int i = 0; i < fragments.length; i++) { | ||||
| 				String string = fragments[i]; | ||||
| 				if (isValid(string)) { | ||||
| 					String[] splitted = StringUtils.split(string, separator); | ||||
| 					for (int j = 0; j < splitted.length; j++) { | ||||
| 						String string2 = splitted[j]; | ||||
| 						if (isValid(string2) && isValid(string2.trim())) | ||||
| 							data.add(string2.trim()); | ||||
| 					} | ||||
| 				} | ||||
| 			} | ||||
| 			return this; | ||||
| 		}; | ||||
| 		 | ||||
| 		public String relational() { | ||||
| 			return StringUtils.join(data, separator); | ||||
| 		} | ||||
| 		 | ||||
| 		public String absolute() { | ||||
| 			return separator + relational(); | ||||
| 		} | ||||
| 		 | ||||
| 		public Iterator<String> fragmentsIterator() { | ||||
| 			return data.iterator(); | ||||
| 		} | ||||
| 		 | ||||
| 		public ListIterator<String> fragmentsListIterator() { | ||||
| 			return data.listIterator(); | ||||
| 		} | ||||
| 		 | ||||
| 		public List<String> pathHierarchy(){ | ||||
| 			return pathHierarchy(true); | ||||
| 		} | ||||
| 		 | ||||
| 		public List<String> pathHierarchy(boolean absolute){ | ||||
| 			List<String> result = new ArrayList<>(); | ||||
| 			if (data.isEmpty()) | ||||
| 				return result; | ||||
| 			result.add((absolute?separator:"") + data.get(0)); | ||||
| 			for (int i=1; i<data.size(); i++) | ||||
| 				result.add(result.get(i-1) + separator + data.get(i)); | ||||
| 			return result; | ||||
| 		} | ||||
| 		 | ||||
| 		public Iterator<String> iterator() { | ||||
| 			return pathHierarchy().iterator(); | ||||
| 		} | ||||
| 		 | ||||
| 		public ListIterator<String> listIterator() { | ||||
| 			return pathHierarchy().listIterator(); | ||||
| 		} | ||||
| 		 | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	 * Generates UUID | ||||
| 	 *  | ||||
| 	 * @return | ||||
| 	 */ | ||||
| 	public static String getUUID(){ | ||||
| 		return UUID.randomUUID().toString().toLowerCase().replace("-", ""); | ||||
| 	} | ||||
| 	/** | ||||
| 	 * Generates UUID consisting of specified char | ||||
| 	 * @param c | ||||
| 	 * @return | ||||
| 	 */ | ||||
| 	public static String getUUID(char c) { | ||||
| 		return StringUtils.leftPad("", 32, c); | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	 * Generates GUID | ||||
| 	 *  | ||||
| 	 * @return | ||||
| 	 */ | ||||
| 	public static String getGUID(){ | ||||
| 		return UUID.randomUUID().toString().toUpperCase(); | ||||
| 	} | ||||
|  | ||||
| 	/** | ||||
| 	 * Generates GUID consisting of specified char | ||||
| 	 * @param c | ||||
| 	 * @return | ||||
| 	 */ | ||||
| 	public static String getGUID(char c) { | ||||
| 		return uid2guid(StringUtils.leftPad("", 32, c)); | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	 * Converts UUID to GUID | ||||
| 	 * @param uid | ||||
| 	 * @return | ||||
| 	 */ | ||||
| 	public static String uid2guid(String uid){ | ||||
| 		return uid.replaceFirst("(.{8})(.{4})(.{4})(.{4})(.{8})", "$1-$2-$3-$4-$5").toUpperCase(); | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	 * Converts GUID to UUID | ||||
| 	 * @param uid | ||||
| 	 * @return | ||||
| 	 */ | ||||
| 	public static String guid2uid(String guid){ | ||||
| 		return guid.toLowerCase().replace("-", ""); | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	 * Checks if the string is not null and has something inside after trim | ||||
| 	 *  | ||||
| 	 * @param s | ||||
| 	 * @return | ||||
| 	 */ | ||||
| 	public static boolean isValid(String s){ | ||||
| 		if (s==null) | ||||
| 			return false; | ||||
| 		return s.trim().length()>0; | ||||
| 	} | ||||
| 	 | ||||
| 	/** | ||||
| 	 *  | ||||
| 	 * @param s string to examine | ||||
| 	 * @param def default value | ||||
| 	 * @return s if isValid(s), otherwise def | ||||
| 	 */ | ||||
| 	public static String getValid(String s, String def){ | ||||
| 		return isValid(s)?s:def; | ||||
| 	} | ||||
| 	 | ||||
| 	public static String padLeft(String data, int length){ | ||||
| 		return padLeft(data, length, ' '); | ||||
| 	} | ||||
| 	public static String padRight(String data, int length){ | ||||
| 		return padRight(data, length, ' '); | ||||
| 	} | ||||
|  | ||||
| 	public static String padBoth(String data, int length){ | ||||
| 		return padBoth(data, length, ' '); | ||||
| 	} | ||||
|  | ||||
| 	public static String padLeft(String data, int length, Character c){ | ||||
| 		String val = data; | ||||
| 		if (data==null) | ||||
| 			val = ""; | ||||
| 		while (val.length()<length) | ||||
| 			val = c + val; | ||||
| 		return val; | ||||
| 	} | ||||
| 	public static String padRight(String data, int length, Character c){ | ||||
| 		String val = data; | ||||
| 		if (data==null) | ||||
| 			val = ""; | ||||
| 		while (val.length()<length) | ||||
| 			val = val + c; | ||||
| 		return val; | ||||
| 	} | ||||
|  | ||||
| 	public static String padBoth(String data, int length, Character c){ | ||||
| 		String val = data; | ||||
| 		boolean left = true; | ||||
| 		if (data==null) | ||||
| 			val = ""; | ||||
| 		while (val.length()<length){ | ||||
| 			if (left) | ||||
| 				val = c + val; | ||||
| 			else | ||||
| 				val = val + c; | ||||
| 			left = !left; | ||||
| 		} | ||||
| 		return val; | ||||
| 	} | ||||
|  | ||||
| 	public static void stream2file(InputStream input, String file) throws Exception { | ||||
| 		File f = new File(file); | ||||
| 		FileOutputStream output = new FileOutputStream(f); | ||||
| 		IOUtils.copy(input, output); | ||||
| 		output.close(); | ||||
| 	} | ||||
| 	 | ||||
| 	public static <K, V> Map<K, V> addDictionaryToMap(Dictionary<K, V> source, Map<K, V> sink) { | ||||
| 	    for (Enumeration<K> keys = source.keys(); keys.hasMoreElements();) { | ||||
| 	        K key = keys.nextElement(); | ||||
| 	        sink.put(key, source.get(key)); | ||||
| 	    } | ||||
| 	    return sink; | ||||
| 	} | ||||
| 	 | ||||
| 	public static <K, V> Map<K, V> getDictionaryAsMap(Dictionary<K, V> source) { | ||||
| 		Map<K, V> result = new HashMap<>(); | ||||
| 		CommonUtils.addDictionaryToMap(source, result); | ||||
| 	    return result; | ||||
| 	} | ||||
| 	 | ||||
| } | ||||
| @@ -0,0 +1,145 @@ | ||||
| /*- | ||||
|  * ~~~~~~licensing~~~~~~ | ||||
|  * base-support | ||||
|  * ========== | ||||
|  * Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  * ========== | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  *  | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  *  | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  * ~~~~~~/licensing~~~~~~ | ||||
|  */ | ||||
| package ru.entaxy.platform.base.support; | ||||
|  | ||||
| import java.io.File; | ||||
| import java.io.IOException; | ||||
| import java.net.MalformedURLException; | ||||
| import java.nio.file.Files; | ||||
| import java.nio.file.Paths; | ||||
| import java.util.Calendar; | ||||
|  | ||||
| import org.apache.commons.codec.digest.DigestUtils; | ||||
|  | ||||
| public class FileUtils { | ||||
|  | ||||
| 	public static class FileHelper { | ||||
| 	 | ||||
| 		protected File file = null; | ||||
|  | ||||
| 		protected String fileMd5Hash = ""; | ||||
| 		 | ||||
| 		protected String md5FilePath = ""; | ||||
| 		protected String currentMd5 = null; | ||||
| 		 | ||||
| 		protected String timmestampFilePath = ""; | ||||
| 		protected String currentTimestamp = null; | ||||
| 		 | ||||
| 		public FileHelper(String filePath) { | ||||
| 			this(new File(filePath)); | ||||
| 		} | ||||
| 		 | ||||
| 		public FileHelper(File file) { | ||||
| 			this.file = file; | ||||
| 			this.md5FilePath = file.getAbsolutePath().concat(".md5"); | ||||
| 			this.timmestampFilePath = file.getAbsolutePath().concat(".timestamp"); | ||||
| 		} | ||||
| 		 | ||||
| 		public boolean isReadable() { | ||||
| 			return file.exists() && file.canRead();  | ||||
| 		} | ||||
|  | ||||
| 		protected String calcMd5() { | ||||
| 			if (!CommonUtils.isValid(this.fileMd5Hash)) | ||||
| 				try { | ||||
| 					this.fileMd5Hash = DigestUtils.md2Hex(this.file.toURI().toURL().openStream()); | ||||
| 				} catch (MalformedURLException e) { | ||||
| 					e.printStackTrace(); | ||||
| 				} catch (IOException e) { | ||||
| 					e.printStackTrace(); | ||||
| 				} | ||||
| 			return this.fileMd5Hash;  | ||||
| 		} | ||||
| 		 | ||||
| 		protected String readMd5() { | ||||
| 			if (this.currentMd5 == null) | ||||
| 			try { | ||||
| 				this.currentMd5 = Files.readString((new File(this.md5FilePath)).toPath()); | ||||
| 			} catch (IOException e) { | ||||
| 				this.currentMd5 = "";  | ||||
| 			} | ||||
| 			return this.currentMd5; | ||||
| 		} | ||||
| 		 | ||||
| 		public boolean isChanged() { | ||||
| 			return !CommonUtils.isValid(this.readMd5()) || !this.readMd5().equals(this.calcMd5()); | ||||
| 		} | ||||
|  | ||||
| 		public String getTimestamp() { | ||||
| 			if (this.currentTimestamp == null) | ||||
| 				try { | ||||
| 					this.currentTimestamp = Files.readString((new File(this.timmestampFilePath)).toPath()); | ||||
| 				} catch (IOException e) { | ||||
| 					this.currentTimestamp = "";  | ||||
| 				} | ||||
| 			return this.currentTimestamp; | ||||
| 		} | ||||
| 		 | ||||
| 		public String getMd5() { | ||||
| 			this.fileMd5Hash = ""; | ||||
| 			return calcMd5(); | ||||
| 		} | ||||
| 		 | ||||
| 		public File getFile() { | ||||
| 			return file; | ||||
| 		} | ||||
|  | ||||
| 		public String getFileMd5Hash() { | ||||
| 			return calcMd5(); | ||||
| 		} | ||||
|  | ||||
| 		public String updateMd5() { | ||||
| 			String result = getMd5(); | ||||
| 			if (CommonUtils.isValid(result)) | ||||
| 				try { | ||||
| 					FileUtils.string2file(result, md5FilePath); | ||||
| 					result = readMd5(); | ||||
| 				} catch (IOException e) { | ||||
| 					result = null; | ||||
| 				} | ||||
| 			return result; | ||||
| 		} | ||||
| 		 | ||||
| 		public String updateTimestamp() { | ||||
| 			String timestamp = Calendar.getInstance().getTimeInMillis() + ""; | ||||
| 			String result = ""; | ||||
| 			try { | ||||
| 				FileUtils.string2file(timestamp, timmestampFilePath); | ||||
| 				this.currentTimestamp = null; | ||||
| 				result = getTimestamp(); | ||||
| 			} catch (IOException e) { | ||||
| 				result = null; | ||||
| 			} | ||||
| 			return result; | ||||
| 		} | ||||
| 		 | ||||
| 	} | ||||
| 	 | ||||
| 	public static void string2file(String content, String filePath) throws IOException { | ||||
| 		string2file(content, new File(filePath)); | ||||
| 	} | ||||
| 	 | ||||
| 	public static void string2file(String content, File file) throws IOException { | ||||
| 		if (!file.exists()) | ||||
| 			file.createNewFile(); | ||||
| 		Files.writeString(file.toPath(), content); | ||||
| 	} | ||||
| 	 | ||||
| } | ||||
| @@ -0,0 +1,117 @@ | ||||
| /*- | ||||
|  * ~~~~~~licensing~~~~~~ | ||||
|  * base-support | ||||
|  * ========== | ||||
|  * Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  * ========== | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  *  | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  *  | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  * ~~~~~~/licensing~~~~~~ | ||||
|  */ | ||||
| package ru.entaxy.platform.base.support; | ||||
|  | ||||
| import java.io.BufferedReader; | ||||
| import java.io.IOException; | ||||
| import java.io.InputStreamReader; | ||||
| import java.net.URL; | ||||
| import java.nio.charset.StandardCharsets; | ||||
| import java.util.ArrayList; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.Map.Entry; | ||||
| import java.util.stream.Collectors; | ||||
|  | ||||
| import com.google.gson.JsonArray; | ||||
| import com.google.gson.JsonElement; | ||||
| import com.google.gson.JsonObject; | ||||
| import com.google.gson.JsonParser; | ||||
| import com.google.gson.JsonPrimitive; | ||||
|  | ||||
| public class JSONUtils { | ||||
|  | ||||
| 	public static final String PROP_VALUE = "_value"; | ||||
| 	 | ||||
| 	public static Map<String, Object> element2map(JsonElement element){ | ||||
| 		Map<String, Object> result = new HashMap<>(); | ||||
| 		if (element.isJsonObject()) { | ||||
| 			JsonObject jsonObject = element.getAsJsonObject(); | ||||
| 			for (Entry<String, JsonElement> entry: jsonObject.entrySet()) { | ||||
| 				result.put(entry.getKey(), element2object(entry.getValue())); | ||||
| 			} | ||||
| 		} else  | ||||
| 		if (element.isJsonArray()) { | ||||
| 			JsonArray array = element.getAsJsonArray(); | ||||
| 			result.put(PROP_VALUE, element2list(element)); | ||||
| 		} else | ||||
| 		if (element.isJsonNull()) { | ||||
| 			result.put(PROP_VALUE, null); | ||||
| 		} else | ||||
| 		if (element.isJsonPrimitive()) { | ||||
| 			result.put(PROP_VALUE, element2value(element)); | ||||
| 		} | ||||
|  | ||||
| 		return result; | ||||
| 	} | ||||
| 	 | ||||
| 	public static Object element2object(JsonElement element) { | ||||
| 		if (element.isJsonNull() || element.isJsonPrimitive()) | ||||
| 			return element2value(element); | ||||
| 		if (element.isJsonArray()) | ||||
| 			return element2list(element); | ||||
| 		if (element.isJsonObject()) | ||||
| 			return element2map(element); | ||||
| 		return null; | ||||
| 	} | ||||
| 	 | ||||
| 	public static Object element2value(JsonElement element) { | ||||
| 		Object result = null; | ||||
| 		if (element.isJsonNull() || !element.isJsonPrimitive()) | ||||
| 			return result; | ||||
| 		try { | ||||
| 			JsonPrimitive primitive = element.getAsJsonPrimitive(); | ||||
| 			if (primitive.isNumber()) | ||||
| 				result = primitive.getAsNumber(); | ||||
| 			else if (primitive.isBoolean()) | ||||
| 				result = primitive.getAsBoolean(); | ||||
| 			else result = primitive.getAsString(); | ||||
| 		} catch (Exception e1) { | ||||
| 			try { | ||||
| 				result = element.getAsBoolean(); | ||||
| 			} catch (Exception e2) { | ||||
| 				result = element.getAsString(); | ||||
| 			} | ||||
| 		} | ||||
| 		return result; | ||||
| 	} | ||||
|  | ||||
| 	public static List<Object> element2list(JsonElement element) { | ||||
| 		List<Object> result = new ArrayList<>(); | ||||
| 		JsonArray array = element.getAsJsonArray(); | ||||
| 		for (int i=0; i<array.size(); i++) | ||||
| 			result.add(element2object(array.get(i))); | ||||
| 		return result; | ||||
| 	} | ||||
| 	 | ||||
| 	public static JsonObject getJsonRootObject(URL url) throws IOException { | ||||
| 		String metadata = new BufferedReader ( | ||||
| 				  new InputStreamReader( | ||||
| 						  url.openStream(), StandardCharsets.UTF_8)) | ||||
| 					.lines() | ||||
| 					.collect(Collectors.joining("\n")); | ||||
| 		 | ||||
| 		JsonElement je = (new JsonParser()).parse(metadata); | ||||
| 		JsonObject root = je.getAsJsonObject();		 | ||||
| 		return root; | ||||
| 	} | ||||
| 	 | ||||
| } | ||||
| @@ -0,0 +1,80 @@ | ||||
| /*- | ||||
|  * ~~~~~~licensing~~~~~~ | ||||
|  * base-support | ||||
|  * ========== | ||||
|  * Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  * ========== | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  *  | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  *  | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  * ~~~~~~/licensing~~~~~~ | ||||
|  */ | ||||
| package ru.entaxy.platform.base.support.osgi; | ||||
|  | ||||
| import java.io.ByteArrayInputStream; | ||||
| import java.io.ByteArrayOutputStream; | ||||
| import java.io.File; | ||||
| import java.io.FileOutputStream; | ||||
| import java.io.IOException; | ||||
| import java.io.InputStream; | ||||
| import java.nio.file.Files; | ||||
| import java.util.jar.JarFile; | ||||
| import java.util.jar.Manifest; | ||||
| import java.util.zip.CRC32; | ||||
| import java.util.zip.ZipEntry; | ||||
| import java.util.zip.ZipInputStream; | ||||
| import java.util.zip.ZipOutputStream; | ||||
|  | ||||
| import org.osgi.framework.Constants; | ||||
|  | ||||
| public class BundleUtils { | ||||
|  | ||||
|     public static File fixBundleWithUpdateLocation(InputStream is, String uri) throws IOException { | ||||
|         File file = Files.createTempFile("update-", ".jar").toFile(); | ||||
|         try (ZipInputStream zis = new ZipInputStream(is); | ||||
|              ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(file))) { | ||||
|  | ||||
|             byte[] buf = new byte[8192]; | ||||
|             zos.setLevel(0); | ||||
|             while (true) { | ||||
|                 ZipEntry entry = zis.getNextEntry(); | ||||
|                 if (entry == null) { | ||||
|                     break; | ||||
|                 } | ||||
|                 ByteArrayOutputStream baos = new ByteArrayOutputStream(); | ||||
|                 int n; | ||||
|                 while (-1 != (n = zis.read(buf))) { | ||||
|                     baos.write(buf, 0, n); | ||||
|                 } | ||||
|                 if (entry.getName().equals(JarFile.MANIFEST_NAME)) { | ||||
|                     Manifest man = new Manifest(new ByteArrayInputStream(baos.toByteArray())); | ||||
|                     if (man.getMainAttributes().getValue(Constants.BUNDLE_UPDATELOCATION) == null) { | ||||
|                         man.getMainAttributes().putValue(Constants.BUNDLE_UPDATELOCATION, uri); | ||||
|                     } | ||||
|                     baos.reset(); | ||||
|                     man.write(baos); | ||||
|                 } | ||||
|                 byte[] data = baos.toByteArray(); | ||||
|                 CRC32 crc = new CRC32(); | ||||
|                 crc.update(data); | ||||
|                 entry = new ZipEntry(entry.getName()); | ||||
|                 entry.setSize(data.length); | ||||
|                 entry.setCrc(crc.getValue()); | ||||
|                 zos.putNextEntry(entry); | ||||
|                 zos.write(data); | ||||
|                 zis.closeEntry(); | ||||
|                 zos.closeEntry(); | ||||
|             } | ||||
|         } | ||||
|         return file; | ||||
|     } | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,183 @@ | ||||
| /*- | ||||
|  * ~~~~~~licensing~~~~~~ | ||||
|  * base-support | ||||
|  * ========== | ||||
|  * Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  * ========== | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  *  | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  *  | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  * ~~~~~~/licensing~~~~~~ | ||||
|  */ | ||||
| package ru.entaxy.platform.base.support.osgi; | ||||
|  | ||||
| import org.osgi.framework.BundleContext; | ||||
| import org.osgi.framework.Constants; | ||||
| import org.osgi.framework.FrameworkUtil; | ||||
| import org.osgi.framework.ServiceReference; | ||||
| import org.osgi.util.tracker.ServiceTracker; | ||||
|  | ||||
| import ru.entaxy.platform.base.support.CommonUtils; | ||||
|  | ||||
| public class OSGIUtils { | ||||
|  | ||||
| 	protected static abstract class ServicesEntryPoint<T extends ServicesEntryPoint<T>> { | ||||
| 		 | ||||
| 		protected Class<?> serviceClass = null; | ||||
| 		protected String serviceClassName = null; | ||||
| 		 | ||||
| 		protected String filter = null; | ||||
| 		 | ||||
| 		protected int wait = -1; | ||||
| 		 | ||||
| 		protected BundleContext bundleContext = FrameworkUtil.getBundle(OSGIUtils.class).getBundleContext(); | ||||
| 		 | ||||
| 		public T ofClass(Class<?> clazz) { | ||||
| 			this.serviceClass = clazz; | ||||
| 			return this.getBuilder(); | ||||
| 		} | ||||
| 		 | ||||
| 		public T ofClass(String className) /* throws Exception */ { | ||||
| 			this.serviceClassName = className; | ||||
| //			BundleWiring wiring = this.bundleContext.getBundle().adapt(BundleWiring.class); | ||||
| //			ClassLoader cl = wiring.getClassLoader(); | ||||
| //			this.serviceClass = cl.loadClass(this.serviceClassName); | ||||
| 			return this.getBuilder(); | ||||
| 		} | ||||
| 		 | ||||
| 		public T bundleContext(BundleContext context) { | ||||
| 			if (context == null) | ||||
| 				this.bundleContext = FrameworkUtil.getBundle(OSGIUtils.class).getBundleContext(); | ||||
| 			else | ||||
| 				this.bundleContext = context; | ||||
| 			return getBuilder(); | ||||
| 		} | ||||
| 		 | ||||
| 		protected abstract T getBuilder(); | ||||
| 	}  | ||||
| 	 | ||||
| 	public static class ServicesFindHelper extends ServicesEntryPoint<ServicesFindHelper> { | ||||
| 	 | ||||
| 		@Override | ||||
| 		protected ServicesFindHelper getBuilder() { | ||||
| 			return this; | ||||
| 		} | ||||
| 	 | ||||
| 		protected String getClassFilter() { | ||||
| 			String className = (this.serviceClass != null) | ||||
| 					?this.serviceClass.getName() | ||||
| 					:this.serviceClassName; | ||||
| 			return "(" +  | ||||
| 					(CommonUtils.isValid(className) | ||||
| 					?(Constants.OBJECTCLASS + "=" + className) | ||||
| 					:"") | ||||
| 					+ ")"; | ||||
| 		} | ||||
| 		 | ||||
| 		public ServicesFindHelper filter(String filter) { | ||||
| 			this.filter = filter; | ||||
| 			return this; | ||||
| 		} | ||||
| 		 | ||||
| 		public ServicesFindHelper waitService(int millis) { | ||||
| 			this.wait = millis; | ||||
| 			return this; | ||||
| 		} | ||||
| 		 | ||||
| 		public <T> T get() throws Exception { | ||||
| 			String classFilter = getClassFilter(); | ||||
| 			String finalFilter = ""; | ||||
| 			if (CommonUtils.isValid(classFilter)) | ||||
| 				if (CommonUtils.isValid(this.filter)) | ||||
| 					finalFilter = String.format("(&%s%s)", classFilter, this.filter); | ||||
| 				else | ||||
| 					finalFilter = "(" + classFilter + ")"; | ||||
| 			else | ||||
| 				if (CommonUtils.isValid(this.filter)) | ||||
| 					finalFilter = "(" + this.filter + ")"; | ||||
| 				else | ||||
| 					finalFilter = ""; | ||||
| 			if (wait > 0) { | ||||
| 				// wait for service | ||||
| 				ServiceTracker tracker; | ||||
| 				if (CommonUtils.isValid(this.filter)) | ||||
| 					tracker = new ServiceTracker<>(this.bundleContext, this.bundleContext.createFilter(finalFilter), null); | ||||
| 				else | ||||
| 					tracker = new ServiceTracker<>(this.bundleContext, this.bundleContext.createFilter(classFilter), null); | ||||
| 				tracker.open(); | ||||
| 				tracker.waitForService(this.wait); | ||||
| 		        ServiceReference<?> connectionManagerServiceReference = | ||||
| 		        		tracker.getServiceReference(); | ||||
| 				tracker.close(); | ||||
| 		        return (T)bundleContext.getService(connectionManagerServiceReference);				 | ||||
| 			} else { | ||||
| 				ServiceReference<?>[] serviceReferences; | ||||
| 				ServiceReference<?> serviceReference; | ||||
| 				if (this.serviceClass != null) | ||||
| 					this.serviceClassName = this.serviceClass.getName(); | ||||
| 				if (!CommonUtils.isValid(this.serviceClassName)) | ||||
| 					return null; | ||||
| 				if (CommonUtils.isValid(this.filter)) { | ||||
| 					serviceReferences = this.bundleContext.getServiceReferences(serviceClassName, this.filter); | ||||
| 					serviceReference = serviceReferences.length>0 | ||||
| 							?serviceReferences[0] | ||||
| 							:null; | ||||
| 				} else { | ||||
| 					serviceReference = this.bundleContext.getServiceReference(serviceClassName); | ||||
| 				} | ||||
| 				if (serviceReference == null) | ||||
| 					return null; | ||||
| 				return (T) this.bundleContext.getService(serviceReference); | ||||
| 			} | ||||
| 		} | ||||
| 		 | ||||
| 	} | ||||
| 	 | ||||
| 	public static class ServicesHelper extends ServicesEntryPoint<ServicesFindHelper> { | ||||
| 		private ServicesFindHelper findHelper = new ServicesFindHelper(); | ||||
| 		 | ||||
| 		@Override | ||||
| 		public ServicesFindHelper ofClass(Class<?> clazz) { | ||||
| 			return findHelper.ofClass(clazz); | ||||
| 		} | ||||
| 		 | ||||
| 		@Override | ||||
| 		public ServicesFindHelper ofClass(String className) { | ||||
| 			return findHelper.ofClass(className); | ||||
| 		} | ||||
| 		 | ||||
| 		@Override | ||||
| 		protected ServicesFindHelper getBuilder() { | ||||
| 			return findHelper; | ||||
| 		} | ||||
| 		 | ||||
| 	} | ||||
| 	 | ||||
| 	static public <T> T getService(Class<T> serviceClass) { | ||||
| 		BundleContext bundleContext = FrameworkUtil.getBundle(OSGIUtils.class).getBundleContext(); | ||||
| 		return getService(bundleContext, serviceClass); | ||||
| 	} | ||||
|  | ||||
| 	 | ||||
| 	static public <T> T getService(BundleContext bundleContext, Class<T> serviceClass) { | ||||
| 		T result = null; | ||||
| 		ServiceReference<T> ref = bundleContext.getServiceReference(serviceClass); | ||||
| 		if (ref != null) { | ||||
| 			result = bundleContext.getService(ref); | ||||
| 		} | ||||
| 		return result; | ||||
| 	} | ||||
|  | ||||
| 	static public ServicesHelper services() { | ||||
| 		return new ServicesHelper(); | ||||
| 	} | ||||
| 	 | ||||
| } | ||||
| @@ -0,0 +1,29 @@ | ||||
| /*- | ||||
|  * ~~~~~~licensing~~~~~~ | ||||
|  * profile-management | ||||
|  * ========== | ||||
|  * Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  * ========== | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  *  | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  *  | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  * ~~~~~~/licensing~~~~~~ | ||||
|  */ | ||||
| package ru.entaxy.platform.base.support.osgi.tracker; | ||||
|  | ||||
| import org.osgi.framework.BundleContext; | ||||
|  | ||||
| public interface BundleContextAware { | ||||
|  | ||||
| 	public void setBundleContext(BundleContext bundleContext); | ||||
| 	public BundleContext getBundleContext(); | ||||
| 	 | ||||
| } | ||||
| @@ -1,6 +1,6 @@ | ||||
| /*- | ||||
|  * ~~~~~~licensing~~~~~~ | ||||
|  * deployer-api | ||||
|  * profile-management | ||||
|  * ========== | ||||
|  * Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  * ========== | ||||
| @@ -17,12 +17,16 @@ | ||||
|  * limitations under the License. | ||||
|  * ~~~~~~/licensing~~~~~~ | ||||
|  */ | ||||
| package ru.entaxy.esb.system.deployer.api; | ||||
| package ru.entaxy.platform.base.support.osgi.tracker; | ||||
| 
 | ||||
| public interface BundleRepository { | ||||
| import java.util.List; | ||||
| 
 | ||||
|     String deployBlueprint(String groupId, String version, String name, String extension, byte[] data) throws Exception; | ||||
| import org.osgi.framework.Bundle; | ||||
| import org.osgi.framework.BundleEvent; | ||||
| 
 | ||||
|     void delete(String groupId, String version, String name, String extension) throws Exception; | ||||
| public interface BundleFilter<R> { | ||||
| 
 | ||||
| 	public String getFilterId(); | ||||
| 	public List<R> checkBundle(Bundle bundle, BundleEvent event);  | ||||
| 	 | ||||
| } | ||||
| @@ -0,0 +1,28 @@ | ||||
| /*- | ||||
|  * ~~~~~~licensing~~~~~~ | ||||
|  * profile-management | ||||
|  * ========== | ||||
|  * Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  * ========== | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  *  | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  *  | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  * ~~~~~~/licensing~~~~~~ | ||||
|  */ | ||||
| package ru.entaxy.platform.base.support.osgi.tracker; | ||||
|  | ||||
| public interface BundleTrackerCustomizerListener<T> { | ||||
|  | ||||
| 	public void added(T managedObject); | ||||
| 	public void modified(T managedObject); | ||||
| 	public void removed(T managedObject); | ||||
| 	 | ||||
| } | ||||
| @@ -0,0 +1,80 @@ | ||||
| /*- | ||||
|  * ~~~~~~licensing~~~~~~ | ||||
|  * profile-management | ||||
|  * ========== | ||||
|  * Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  * ========== | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  *  | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  *  | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  * ~~~~~~/licensing~~~~~~ | ||||
|  */ | ||||
| package ru.entaxy.platform.base.support.osgi.tracker; | ||||
|  | ||||
| import java.util.LinkedList; | ||||
| import java.util.List; | ||||
|  | ||||
| import org.osgi.framework.Bundle; | ||||
| import org.osgi.framework.BundleContext; | ||||
| import org.osgi.framework.FrameworkUtil; | ||||
| import org.osgi.util.tracker.BundleTracker; | ||||
|  | ||||
| public class BundleTrackerUtils { | ||||
|  | ||||
| 	public static class BundleTrackerBuilder<T> { | ||||
| 	 | ||||
| 		protected UniformBundleTrackerCustomizer<T> customizer;  | ||||
| 		 | ||||
| 		protected List<BundleFilter<?>> filters = new LinkedList<>(); | ||||
| 		 | ||||
| 		protected BundleContext bundleContext = FrameworkUtil.getBundle(BundleTrackerUtils.class).getBundleContext(); | ||||
| 		 | ||||
| 		protected int bundleState = Bundle.ACTIVE; | ||||
| 		 | ||||
| 		public BundleTrackerBuilder<T> customizer(UniformBundleTrackerCustomizer<T> customizer){ | ||||
| 			this.customizer = customizer; | ||||
| 			return this; | ||||
| 		}  | ||||
| 		 | ||||
| 		public BundleTrackerBuilder<T> bundleContext(BundleContext bundleContext){ | ||||
| 			this.bundleContext = bundleContext; | ||||
| 			return this; | ||||
| 		}  | ||||
| 		 | ||||
| 		public BundleTrackerBuilder<T> addFilter(BundleFilter<?> bundleFilter){ | ||||
| 			this.filters.add(bundleFilter); | ||||
| 			return this; | ||||
| 		} | ||||
| 		 | ||||
| 		public BundleTrackerBuilder<T> bundleState(int state){ | ||||
| 			this.bundleState = state; | ||||
| 			return this; | ||||
| 		}  | ||||
| 		 | ||||
| 		public BundleTracker<T> get(){ | ||||
| 			if (customizer == null) | ||||
| 				return null; | ||||
| 			if (customizer instanceof BundleContextAware) | ||||
| 				((BundleContextAware)customizer).setBundleContext(bundleContext); | ||||
| 			for (BundleFilter<?> filter: this.filters) { | ||||
| 				if (filter instanceof BundleContextAware) | ||||
| 					((BundleContextAware)filter).setBundleContext(bundleContext); | ||||
| 				customizer.addFilter(filter); | ||||
| 			} | ||||
| 			return new BundleTracker<T>(bundleContext, bundleState, customizer); | ||||
| 		} | ||||
| 	} | ||||
| 	 | ||||
| 	public static <T> BundleTrackerBuilder<T> createBuilder(){ | ||||
| 		return new BundleTrackerBuilder<T>();  | ||||
| 	}  | ||||
| 	 | ||||
| } | ||||
| @@ -0,0 +1,98 @@ | ||||
| /*- | ||||
|  * ~~~~~~licensing~~~~~~ | ||||
|  * profile-management | ||||
|  * ========== | ||||
|  * Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  * ========== | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  *  | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  *  | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  * ~~~~~~/licensing~~~~~~ | ||||
|  */ | ||||
| package ru.entaxy.platform.base.support.osgi.tracker; | ||||
|  | ||||
| import java.util.HashMap; | ||||
| import java.util.LinkedList; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
|  | ||||
| import org.osgi.framework.Bundle; | ||||
| import org.osgi.framework.BundleEvent; | ||||
| import org.osgi.util.tracker.BundleTrackerCustomizer; | ||||
|  | ||||
| public abstract class UniformBundleTrackerCustomizer<T> implements BundleTrackerCustomizer<T> { | ||||
| 	 | ||||
| 	protected BundleTrackerCustomizerListener<T> listener; | ||||
| 	 | ||||
| 	protected List<BundleFilter<?>> filters = new LinkedList<>(); | ||||
| 	 | ||||
| 	public UniformBundleTrackerCustomizer() { | ||||
| 		super(); | ||||
| 	} | ||||
| 	 | ||||
| 	public UniformBundleTrackerCustomizer(BundleTrackerCustomizerListener<T> listener) { | ||||
| 		super(); | ||||
| 		setListener(listener); | ||||
| 	} | ||||
|  | ||||
| 	public BundleTrackerCustomizerListener<T> getListener() { | ||||
| 		return listener; | ||||
| 	} | ||||
|  | ||||
| 	public void setListener(BundleTrackerCustomizerListener<T> listener) { | ||||
| 		this.listener = listener; | ||||
| 	}  | ||||
|  | ||||
| 	public void addFilter(BundleFilter<?> filter) { | ||||
| 		this.filters.add(filter); | ||||
| 	} | ||||
| 	 | ||||
| 	public UniformBundleTrackerCustomizer<T> listener(BundleTrackerCustomizerListener<T> listener){ | ||||
| 		setListener(listener); | ||||
| 		return this; | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
| 	public T addingBundle(Bundle bundle, BundleEvent event) { | ||||
| 		Map<String, List<?>> filterResults = new HashMap<>(); | ||||
| 		for (BundleFilter<?> filter: filters) { | ||||
| 			List<?> result = filter.checkBundle(bundle, event); | ||||
| 			if (result == null) | ||||
| 				return null; | ||||
| 			filterResults.put(filter.getFilterId(), result); | ||||
| 		} | ||||
| 		T managedObject = createManagedObject(bundle, event, filterResults); | ||||
| 		enrichManagedObject(bundle, event, filterResults, managedObject); | ||||
| 		if (listener != null) | ||||
| 			listener.added(managedObject); | ||||
| 		return managedObject; | ||||
| 	} | ||||
| 	 | ||||
| 	protected abstract T createManagedObject(Bundle bundle, BundleEvent event, Map<String, List<?>> filterResults); | ||||
|  | ||||
| 	/* | ||||
| 	 * to override | ||||
| 	 */ | ||||
| 	protected void enrichManagedObject(Bundle bundle, BundleEvent event, Map<String, List<?>> filterResults, T managedObject) { | ||||
| 		 | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
| 	public void modifiedBundle(Bundle bundle, BundleEvent event, T object) { | ||||
| 		listener.modified(object); | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
| 	public void removedBundle(Bundle bundle, BundleEvent event, T object) { | ||||
| 		listener.removed(object); | ||||
| 	} | ||||
| 	 | ||||
| } | ||||
| @@ -0,0 +1,44 @@ | ||||
| /*- | ||||
|  * ~~~~~~licensing~~~~~~ | ||||
|  * base-support | ||||
|  * ========== | ||||
|  * Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  * ========== | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  *  | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  *  | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  * ~~~~~~/licensing~~~~~~ | ||||
|  */ | ||||
| package ru.entaxy.platform.base.support.osgi.tracker.filter; | ||||
|  | ||||
| import ru.entaxy.platform.base.support.osgi.tracker.BundleFilter; | ||||
|  | ||||
| public abstract class AbstractBundleFilter<T, C extends AbstractBundleFilter<T, C>> implements BundleFilter<T>  { | ||||
|  | ||||
| 	protected String filterId = getDefaultFilterId(); | ||||
|  | ||||
| 	protected abstract String getDefaultFilterId(); | ||||
| 	 | ||||
| 	@Override | ||||
| 	public String getFilterId() { | ||||
| 		return filterId; | ||||
| 	} | ||||
|  | ||||
| 	public void setFilterId(String filterId) { | ||||
| 		this.filterId = filterId; | ||||
| 	} | ||||
|  | ||||
| 	public C filterId(String filterId) { | ||||
| 		setFilterId(filterId); | ||||
| 		return (C)this; | ||||
| 	} | ||||
|  | ||||
| } | ||||
| @@ -0,0 +1,60 @@ | ||||
| /*- | ||||
|  * ~~~~~~licensing~~~~~~ | ||||
|  * profile-management | ||||
|  * ========== | ||||
|  * Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  * ========== | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  *  | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  *  | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  * ~~~~~~/licensing~~~~~~ | ||||
|  */ | ||||
| package ru.entaxy.platform.base.support.osgi.tracker.filter; | ||||
|  | ||||
| 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; | ||||
|  | ||||
| public class BundleCapabilityFilter extends AbstractBundleFilter<BundleCapability, BundleCapabilityFilter> { | ||||
|  | ||||
| 	public static final String DEFAULT_FILTER_ID = "bundle.capabilities"; | ||||
| 	 | ||||
| 	protected String namespace; | ||||
| 	 | ||||
| 	@Override | ||||
| 	protected String getDefaultFilterId() { | ||||
| 		return DEFAULT_FILTER_ID; | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
| 	public List<BundleCapability> checkBundle(Bundle bundle, BundleEvent event) { | ||||
| 		BundleRevision revision = bundle.adapt(BundleRevision.class); | ||||
| 		if (revision == null) | ||||
| 			return null; | ||||
| 		List<BundleCapability> capabilities = revision.getDeclaredCapabilities(namespace); | ||||
| 		if ((capabilities==null) || (capabilities.size()==0)) | ||||
| 			return null; | ||||
| 		return capabilities; | ||||
| 	} | ||||
|  | ||||
| 	public void setNamespace(String namespace) { | ||||
| 		this.namespace = namespace; | ||||
| 	} | ||||
|  | ||||
| 	public BundleCapabilityFilter namespace(String namespace) { | ||||
| 		setNamespace(namespace); | ||||
| 		return this; | ||||
| 	} | ||||
| 	 | ||||
| } | ||||
| @@ -0,0 +1,81 @@ | ||||
| /*- | ||||
|  * ~~~~~~licensing~~~~~~ | ||||
|  * base-support | ||||
|  * ========== | ||||
|  * Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  * ========== | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  *  | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  *  | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  * ~~~~~~/licensing~~~~~~ | ||||
|  */ | ||||
| package ru.entaxy.platform.base.support.osgi.tracker.filter; | ||||
|  | ||||
| import java.util.Arrays; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
|  | ||||
| import org.osgi.framework.Bundle; | ||||
| import org.osgi.framework.BundleEvent; | ||||
|  | ||||
| import ru.entaxy.platform.base.support.CommonUtils; | ||||
|  | ||||
| public class BundleHeaderFilter extends AbstractBundleFilter<String, BundleHeaderFilter> { | ||||
|  | ||||
| 	public static final String DEFAULT_FILTER_ID = "bundle.header"; | ||||
| 	 | ||||
| 	protected String header; | ||||
| 	 | ||||
| 	protected String value = null; | ||||
| 	 | ||||
| 	@Override | ||||
| 	protected String getDefaultFilterId() { | ||||
| 		return DEFAULT_FILTER_ID; | ||||
| 	} | ||||
|  | ||||
| 	@Override | ||||
| 	public List<String> checkBundle(Bundle bundle, BundleEvent event) { | ||||
| 		Map<String, String> headers = CommonUtils.getDictionaryAsMap(bundle.getHeaders()); | ||||
| 		if (!headers.containsKey(header)) | ||||
| 			return null; | ||||
| 		String headerValue = headers.get(header); | ||||
| 		if (value != null) | ||||
| 			if (!value.equals(headerValue)) | ||||
| 				return null; | ||||
| 		return Arrays.asList(new String[] {headerValue}); | ||||
| 	} | ||||
| 	 | ||||
| 	public String getHeader() { | ||||
| 		return header; | ||||
| 	} | ||||
|  | ||||
| 	public void setHeader(String header) { | ||||
| 		this.header = header; | ||||
| 	} | ||||
|  | ||||
| 	public BundleHeaderFilter header(String headerValue) { | ||||
| 		this.setHeader(headerValue); | ||||
| 		return this; | ||||
| 	} | ||||
|  | ||||
| 	public String getValue() { | ||||
| 		return value; | ||||
| 	} | ||||
|  | ||||
| 	public void setValue(String value) { | ||||
| 		this.value = value; | ||||
| 	}; | ||||
| 	 | ||||
| 	public BundleHeaderFilter value(String valueValue) { | ||||
| 		this.setValue(valueValue); | ||||
| 		return this; | ||||
| 	}; | ||||
| } | ||||
| @@ -0,0 +1,252 @@ | ||||
| /*- | ||||
|  * ~~~~~~licensing~~~~~~ | ||||
|  * base-support | ||||
|  * ========== | ||||
|  * Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  * ========== | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  *  | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  *  | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  * ~~~~~~/licensing~~~~~~ | ||||
|  */ | ||||
| package ru.entaxy.platform.base.support.xml; | ||||
|  | ||||
| import java.io.File; | ||||
| import java.io.InputStream; | ||||
| import java.io.StringReader; | ||||
| import java.io.StringWriter; | ||||
| import java.net.URL; | ||||
| import java.util.HashMap; | ||||
|  | ||||
| import javax.xml.bind.JAXBContext; | ||||
| import javax.xml.bind.JAXBElement; | ||||
| import javax.xml.bind.Marshaller; | ||||
| import javax.xml.bind.Unmarshaller; | ||||
| import javax.xml.parsers.DocumentBuilder; | ||||
| import javax.xml.parsers.DocumentBuilderFactory; | ||||
| import javax.xml.transform.OutputKeys; | ||||
| import javax.xml.transform.Result; | ||||
| import javax.xml.transform.Transformer; | ||||
| import javax.xml.transform.TransformerFactory; | ||||
| import javax.xml.transform.dom.DOMSource; | ||||
| import javax.xml.transform.stream.StreamResult; | ||||
|  | ||||
| /*import net.sf.saxon.TransformerFactoryImpl; | ||||
| import net.sf.saxon.lib.NamespaceConstant; | ||||
| */ | ||||
| import org.w3c.dom.Document; | ||||
| import org.w3c.dom.Node; | ||||
| import org.w3c.dom.NodeList; | ||||
| import org.xml.sax.InputSource; | ||||
|  | ||||
| import ru.entaxy.platform.base.support.CommonUtils; | ||||
|  | ||||
| public class CommonXMLUtils { | ||||
| 	 | ||||
| 	// GETTING DOCUMENT | ||||
| 	 | ||||
| 	public static Document getDocument(URL url) throws Exception{ | ||||
| 		return getDocument(url.openStream()); | ||||
| 	} | ||||
| 	 | ||||
| 	public static Document getDocument(InputStream stream) throws Exception { | ||||
| 		return getDocument(false, stream); | ||||
| 	} | ||||
| 	public static Document getDocument(boolean namespaceAware, InputStream stream) throws Exception { | ||||
| 		InputSource is = new InputSource(stream); | ||||
| 		return getDocument(namespaceAware, is); | ||||
| 	} | ||||
| 	 | ||||
| 	public static Document newDocument(boolean namespaceAware) throws Exception{ | ||||
| 		return getDocument(namespaceAware, (File)null); | ||||
| 	} | ||||
| 	public static Document getDocument(boolean namespaceAware, String path) throws Exception{ | ||||
| 		return getDocument(namespaceAware, CommonUtils.isValid(path)?(new File(path)):null); | ||||
| 	} | ||||
| 	public static Document getDocument(boolean namespaceAware, File file) throws Exception{ | ||||
| 		DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); | ||||
| 		dbf.setNamespaceAware(namespaceAware); | ||||
| 		DocumentBuilder db = dbf.newDocumentBuilder(); | ||||
| 		if (file!=null) | ||||
| 			return db.parse(file); | ||||
| 		else | ||||
| 			return db.newDocument(); | ||||
| 		 | ||||
| 	} | ||||
| 	public static Document newDocument() throws Exception { | ||||
| 		return newDocument(false); | ||||
| 	} | ||||
| 	public static Document getDocument(String path) throws Exception{ | ||||
| 		return getDocument(false, path); | ||||
| 	} | ||||
| 	public static Document parseString(boolean namespaceAware, String xmlData) throws Exception{ | ||||
|         InputSource is = new InputSource(new StringReader(xmlData)); | ||||
|         return getDocument(namespaceAware, is); | ||||
| 	}  | ||||
| 	public static Document getDocument(InputSource source) throws Exception { | ||||
| 		return getDocument(false, source); | ||||
| 	} | ||||
| 	public static Document getDocument(boolean namespaceAware, InputSource source) throws Exception { | ||||
|         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); | ||||
|         factory.setNamespaceAware(namespaceAware); | ||||
|         DocumentBuilder builder = factory.newDocumentBuilder(); | ||||
|         Document d = builder.parse( source ); | ||||
| 		return d; | ||||
| 	} | ||||
| 	public static String doc2string(Document doc) throws Exception{ | ||||
| 		//set up a transformer | ||||
| 		TransformerFactory transfac = TransformerFactory.newInstance(); | ||||
| 		Transformer trans = transfac.newTransformer(); | ||||
| 		trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); | ||||
| 		trans.setOutputProperty(OutputKeys.INDENT, "yes"); | ||||
|  | ||||
| 		//create string from xml tree | ||||
| 		StringWriter sw = new StringWriter(); | ||||
| 		StreamResult result = new StreamResult(sw); | ||||
| 		DOMSource source = new DOMSource(doc); | ||||
| 		trans.transform(source, result); | ||||
| 		String xmlString = sw.toString(); | ||||
|  | ||||
| 		return xmlString; | ||||
| 	} | ||||
| 	 | ||||
| 	public static String node2string(Node node) throws Exception { | ||||
| 	    Transformer t = TransformerFactory.newInstance().newTransformer(); | ||||
| 	    t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes"); | ||||
| 	    StringWriter sw = new StringWriter(); | ||||
| 	    t.transform(new DOMSource(node), new StreamResult(sw)); | ||||
| 	    return sw.toString(); | ||||
| 	} | ||||
| 	 | ||||
| 	// SAVING DOCUMENT | ||||
| 	public static void saveDocument(Document doc, String path) throws Exception{ | ||||
| 		File file = new File(path); | ||||
| 		saveDocument(doc, file); | ||||
| 	} | ||||
|  | ||||
| 	public static void saveDocument(Document doc, File file) throws Exception{ | ||||
| 		DOMSource source = new DOMSource(doc); | ||||
| 		Result result = new StreamResult(file); | ||||
| 		Transformer xformer = TransformerFactory.newInstance().newTransformer(); | ||||
|         xformer.transform(source, result); | ||||
| 	} | ||||
| 	 | ||||
| 	// MARSHAL | ||||
| 	public static void jaxbMarshal(JAXBContext context, JAXBElement<?> object, Node node) throws Exception{ | ||||
| 		Marshaller m = context.createMarshaller(); | ||||
| 		jaxbMarshall(m, object, node); | ||||
| 	} | ||||
| 	public static void jaxbMarshall(Marshaller m, JAXBElement<?> object, Node node) throws Exception{ | ||||
| 		if (node==null || node.getNodeType()!=Node.ELEMENT_NODE) | ||||
| 			throw new IllegalArgumentException("Node is not Element"); | ||||
| 		m.marshal(object, node); | ||||
| 	} | ||||
| 	public static String jaxbMarshall(JAXBContext context, JAXBElement<?> object) throws Exception{ | ||||
| 		String result = null; | ||||
| 		 | ||||
| 		Marshaller m = context.createMarshaller(); | ||||
| 		StringWriter sw = new StringWriter(); | ||||
| 		m.marshal(object, sw); | ||||
| 		result = sw.toString(); | ||||
| 		 | ||||
| 		return result; | ||||
| 	} | ||||
| 	// UNMARSHAL | ||||
| 	/** | ||||
| 	 *  | ||||
| 	 * @param context | ||||
| 	 * @param node | ||||
| 	 * @param classMap | ||||
| 	 * @return | ||||
| 	 * @throws Exception | ||||
| 	 */ | ||||
| 	 | ||||
| 	public static JAXBElement<?> jaxbUnmarshall(JAXBContext context, Node node, HashMap<String, Class<? extends Object>> classMap) throws Exception{ | ||||
| 		Unmarshaller um = context.createUnmarshaller(); | ||||
| 		return jaxbUnmarshall(um, node, classMap); | ||||
| 	} | ||||
| 	public static JAXBElement<?> jaxbUnmarshall(Unmarshaller um, Node node, HashMap<String, Class<? extends Object>> classMap) throws Exception{ | ||||
| 		if (node.getNodeType()!=Node.ELEMENT_NODE) | ||||
| 			throw new IllegalArgumentException("Node is not Element"); | ||||
| 		String nodeName = node.getNodeName(); | ||||
| 		String[] s = nodeName.split(":"); | ||||
| 		nodeName = s[s.length-1]; | ||||
| 		Class<?> objectClass = classMap.get(nodeName.toLowerCase()); | ||||
| 		if (objectClass==null) | ||||
| 			throw new IllegalArgumentException("Node name " +nodeName+ " not found in map " + classMap.toString()); | ||||
| 		Object obj = um.unmarshal(node, objectClass); | ||||
| 		return (JAXBElement<?>)obj; | ||||
| 	} | ||||
| 	 | ||||
| 	public static JAXBElement<?> jaxbUnmarshall(Class<?> type, Document doc) throws Exception{ | ||||
| 		JAXBContext context	= JAXBContext.newInstance( | ||||
| 				type.getPackage().getName(), type.getClassLoader()); | ||||
| 		NodeList list = doc.getChildNodes(); | ||||
| 		Node node = null; | ||||
| 		for (int i=0; i<list.getLength(); i++){ | ||||
| 			if (list.item(i).getNodeType() == Node.ELEMENT_NODE){ | ||||
| 				node = list.item(i); | ||||
| 				break; | ||||
| 			} | ||||
| 		} | ||||
| 		if (node == null) | ||||
| 			throw new Exception("Root element not found in document"); | ||||
| 		return jaxbUnmarshall(context.createUnmarshaller(), node, type); | ||||
| 	} | ||||
| 	public static JAXBElement<?> jaxbUnmarshall(Class<?> type, Node node) throws Exception{ | ||||
| 		JAXBContext context	= JAXBContext.newInstance( | ||||
| 				type.getPackage().getName(), type.getClassLoader()); | ||||
| 		return jaxbUnmarshall(context.createUnmarshaller(), node, type); | ||||
| 	} | ||||
| 	public static JAXBElement<?> jaxbUnmarshall(JAXBContext context, Node node, Class<?> type) throws Exception{ | ||||
| 		return jaxbUnmarshall(context.createUnmarshaller(), node, type); | ||||
| 	} | ||||
| 	public static JAXBElement<?> jaxbUnmarshall(Unmarshaller um, Node node, Class<?> type) throws Exception{ | ||||
| 		Object obj = um.unmarshal(node, type); | ||||
| 		return (JAXBElement<?>)obj; | ||||
| 	} | ||||
| 	 | ||||
| 	// XSLT | ||||
| /*	 | ||||
| 	public static void transform(URL input, URL xslt, Result result) throws Exception { | ||||
|         TransformerFactory factory = TransformerFactory.newInstance("net.sf.saxon.TransformerFactoryImpl",TransformerFactoryImpl.class.getClassLoader()); | ||||
|          | ||||
|         Source xsltS = new StreamSource(xslt.openStream()); | ||||
|         Transformer transformer = factory.newTransformer(xsltS); | ||||
|         transformer.setOutputProperty(OutputKeys.INDENT, "yes"); | ||||
|         transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8"); | ||||
|         transformer.setOutputProperty(OutputKeys.STANDALONE, "yes"); | ||||
|          | ||||
|         InputStream is = input.openStream(); | ||||
|  | ||||
|         Source inputS = new StreamSource(is); | ||||
|         transformer.transform(inputS, result); | ||||
| 		 | ||||
| 	} | ||||
| */	 | ||||
| 	// XPath | ||||
| 	 | ||||
| /*	public static XPath createXPath() throws Exception { | ||||
| 		XPathFactory factory = XPathFactory.newInstance(NamespaceConstant.OBJECT_MODEL_SAXON,  | ||||
| 				"net.sf.saxon.xpath.XPathFactoryImpl", net.sf.saxon.xpath.XPathFactoryImpl.class.getClassLoader()); | ||||
| 		XPath xpath = factory.newXPath(); | ||||
|         return xpath; | ||||
| 	} | ||||
| 	 | ||||
| 	public static String getStringXPathResult(org.w3c.dom.Node node, String expression) throws Exception { | ||||
| 		XPath xpath = createXPath(); | ||||
| 		XPathExpression expr = xpath.compile(expression); | ||||
| 		Object result = expr.evaluate(node, XPathConstants.STRING); | ||||
| 		if (result == null) | ||||
| 			return null; | ||||
| 		return result.toString(); | ||||
| 	}*/ | ||||
| } | ||||
| @@ -5,7 +5,7 @@ | ||||
|     <parent> | ||||
|         <groupId>ru.entaxy.esb.platform.runtime</groupId> | ||||
|         <artifactId>base</artifactId> | ||||
|         <version>1.8.0</version> | ||||
|         <version>1.8.1</version> | ||||
|     </parent> | ||||
|     <modelVersion>4.0.0</modelVersion> | ||||
|  | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
|     <parent> | ||||
|         <groupId>ru.entaxy.esb.platform.runtime.base.connecting</groupId> | ||||
|         <artifactId>adapter</artifactId> | ||||
|         <version>1.8.0</version> | ||||
|         <version>1.8.1</version> | ||||
|     </parent> | ||||
|  | ||||
|     <modelVersion>4.0.0</modelVersion> | ||||
| @@ -20,6 +20,7 @@ | ||||
|         <bundle.osgi.export.pkg> | ||||
|             ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.api, | ||||
|             ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.impl, | ||||
|             ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.management, | ||||
|             ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.metadata, | ||||
|             ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.tracker, | ||||
|             ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.util | ||||
| @@ -35,6 +36,7 @@ | ||||
|                 <configuration> | ||||
|                     <instructions> | ||||
|                         <Bundle-Activator>ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.tracker.AdapterTrackerActivator</Bundle-Activator> | ||||
|                         <_dsannotations>*</_dsannotations> | ||||
|                     </instructions> | ||||
|                 </configuration> | ||||
|             </plugin> | ||||
| @@ -45,24 +47,45 @@ | ||||
|         <dependency> | ||||
|             <groupId>org.osgi</groupId> | ||||
|             <artifactId>osgi.core</artifactId> | ||||
|             <version>${osgi.version}</version> | ||||
|             <scope>provided</scope> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>org.slf4j</groupId> | ||||
|             <artifactId>slf4j-api</artifactId> | ||||
|             <scope>provided</scope> | ||||
| 		</dependency>         | ||||
|         <dependency> | ||||
|             <groupId>com.google.code.gson</groupId> | ||||
|             <artifactId>gson</artifactId> | ||||
|             <version>${gson.version}</version> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|             <groupId>ru.entaxy.esb.system.management.blueprint.generator</groupId> | ||||
|             <artifactId>blueprint-generator</artifactId> | ||||
|             <groupId>ru.entaxy.esb.platform.runtime.base.connecting.generator</groupId> | ||||
|             <artifactId>generator-api</artifactId> | ||||
|             <version>${project.version}</version> | ||||
|         </dependency> | ||||
|  | ||||
|         <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.base.connecting.generator</groupId> | ||||
|             <artifactId>generator-factory</artifactId> | ||||
|             <version>${project.version}</version> | ||||
|         </dependency> | ||||
|         <dependency> | ||||
|         	<groupId>org.apache.felix</groupId> | ||||
|         	<artifactId>org.apache.felix.scr</artifactId> | ||||
|         	<version>2.1.20</version> | ||||
|         </dependency> | ||||
| 	  	<dependency> | ||||
| 	  		<groupId>org.osgi</groupId> | ||||
| 	  		<artifactId>org.osgi.service.component.annotations</artifactId> | ||||
| 	  		<version>1.4.0</version> | ||||
| 	  		<scope>compile</scope> | ||||
| 	  	</dependency>         | ||||
|     </dependencies> | ||||
|  | ||||
| </project> | ||||
| @@ -19,11 +19,11 @@ | ||||
|  */ | ||||
| package ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.api; | ||||
|  | ||||
| import ru.entaxy.esb.system.management.blueprint.generator.Blueprint; | ||||
|  | ||||
| import java.util.HashMap; | ||||
| import java.util.Map; | ||||
|  | ||||
| import ru.entaxy.esb.platform.runtime.base.connecting.generator.Generated; | ||||
|  | ||||
| public interface Adapter { | ||||
| 	public static final String ADAPTER_CLASS_HEADER_NAME = "Entaxy-Adapter-Class"; | ||||
| 	public static final String ADAPTER_HEADER_NAME = "Entaxy-Adapter"; | ||||
| @@ -45,7 +45,15 @@ public interface Adapter { | ||||
| 	public default Map<String, String> getProperties() { | ||||
| 		return new HashMap<>(); | ||||
| 	} | ||||
| 	public default Blueprint generate(String type, Map<String, Object> map) throws Exception { | ||||
|  | ||||
| /* | ||||
| 	@Deprecated | ||||
| 	public default Blueprint generateBlueprint(String type, Map<String, Object> map) throws Exception { | ||||
| 		return null; | ||||
| 	} | ||||
| */ | ||||
| 	public default Generated generate(String type, Map<String, Object> map) throws Exception { | ||||
| 		return Generated.create(); | ||||
| 	} | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -19,19 +19,6 @@ | ||||
|  */ | ||||
| package ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.impl; | ||||
|  | ||||
| import com.google.gson.*; | ||||
| import org.osgi.framework.BundleContext; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
| import ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.api.Adapter; | ||||
| import ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.metadata.AdapterFieldElement; | ||||
| import ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.metadata.AdapterGeneratorElement; | ||||
| import ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.metadata.AdapterMetadataElement; | ||||
| import ru.entaxy.esb.platform.runtime.base.connecting.generator.Generator; | ||||
| import ru.entaxy.esb.platform.runtime.base.connecting.generator.factory.GeneratorFactory; | ||||
| import ru.entaxy.esb.platform.runtime.base.connecting.generator.ftl.FTLGenerator; | ||||
| import ru.entaxy.esb.system.management.blueprint.generator.Blueprint; | ||||
|  | ||||
| import java.io.BufferedReader; | ||||
| import java.io.IOException; | ||||
| import java.io.InputStreamReader; | ||||
| @@ -43,6 +30,24 @@ import java.util.Map; | ||||
| import java.util.NoSuchElementException; | ||||
| import java.util.stream.Collectors; | ||||
|  | ||||
| import org.osgi.framework.BundleContext; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
|  | ||||
| import com.google.gson.Gson; | ||||
| import com.google.gson.GsonBuilder; | ||||
| import com.google.gson.JsonElement; | ||||
| import com.google.gson.JsonObject; | ||||
| import com.google.gson.JsonParser; | ||||
|  | ||||
| import ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.api.Adapter; | ||||
| import ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.metadata.AdapterFieldElement; | ||||
| import ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.metadata.AdapterGeneratorElement; | ||||
| import ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.metadata.AdapterMetadataElement; | ||||
| import ru.entaxy.esb.platform.runtime.base.connecting.generator.Generated; | ||||
| import ru.entaxy.esb.platform.runtime.base.connecting.generator.Generator; | ||||
| import ru.entaxy.esb.platform.runtime.base.connecting.generator.factory.GeneratorFactory; | ||||
|  | ||||
| public class DefaultAdapter implements Adapter { | ||||
|  | ||||
| 	protected static final Logger log = LoggerFactory.getLogger(DefaultAdapter.class); | ||||
| @@ -54,8 +59,25 @@ public class DefaultAdapter implements Adapter { | ||||
| 	protected String defaultName = "Undefined"; | ||||
| 	protected String defaultDescription = "Undefined"; | ||||
| 	protected AdapterMetadataElement adapterMetadata; | ||||
| 	protected Map<String, Generator> generatorList = new HashMap<>(); | ||||
|  | ||||
| 	@Deprecated | ||||
| 	protected Map<String, Generator> generatorList = new HashMap<>(); | ||||
| 	protected Map<String, GeneratorDescriptor> generatorDescriptorList = new HashMap<>(); | ||||
| 	 | ||||
| 	protected static class GeneratorDescriptor { | ||||
| 		BundleContext bundleContext; | ||||
| 		AdapterGeneratorElement generatorElement; | ||||
| 		Generator generator; | ||||
| 		boolean linked = false; | ||||
| 		 | ||||
| 		public void linkGenerator() { | ||||
| 			generator = GeneratorFactory.createGenerator(generatorElement.getGenerator() | ||||
| 					, generatorElement.getType(), bundleContext); | ||||
| 			linked = (generator != null); | ||||
| 		} | ||||
| 		 | ||||
| 	} | ||||
| 	 | ||||
| 	public DefaultAdapter(BundleContext bundleContext) throws IOException { | ||||
| 		this.bundleContext = bundleContext; | ||||
| 		log.debug("Constructor of adapter {}", DefaultAdapter.class.getName()); | ||||
| @@ -84,9 +106,20 @@ public class DefaultAdapter implements Adapter { | ||||
|  | ||||
| 		this.adapterMetadata = gson.fromJson(adapterElement, AdapterMetadataElement.class); | ||||
|  | ||||
| 		initGenerators(adapterMetadata.getGenerators()); | ||||
|  | ||||
| 		return this.adapterMetadata != null && !generatorList.isEmpty(); | ||||
| 		List<AdapterGeneratorElement> generators = adapterMetadata.getGenerators();  | ||||
| 		 | ||||
| 		for (AdapterGeneratorElement generator: generators) { | ||||
| 			GeneratorDescriptor descriptor = new GeneratorDescriptor(); | ||||
| 			descriptor.bundleContext = this.bundleContext; | ||||
| 			descriptor.generatorElement = generator; | ||||
| 			if (!generator.isLazy()) | ||||
| 				descriptor.linkGenerator(); | ||||
| 			this.generatorDescriptorList.put(generator.getType(), descriptor); | ||||
| 		} | ||||
| 		 | ||||
| //		initGenerators(adapterMetadata.getGenerators()); | ||||
| 		 | ||||
| 		return this.adapterMetadata != null && !generatorDescriptorList.isEmpty(); | ||||
| 	} | ||||
|  | ||||
| 	private void initGenerators(List<AdapterGeneratorElement> generators) { | ||||
| @@ -151,14 +184,17 @@ public class DefaultAdapter implements Adapter { | ||||
| 	} | ||||
|  | ||||
| 	@Override | ||||
| 	public Blueprint generate(String type, Map<String, Object> map) throws Exception { | ||||
| 		FTLGenerator generator = (FTLGenerator) generatorList.get(type); | ||||
| 		if (null == generator) { | ||||
| 			throw new NoSuchElementException(type + " generator missed in generator list."); | ||||
| 		} | ||||
| 		// TODO: 09.07.2021 Artifact wrapper needed instead of Blueprint (not only blueprint can be return from generator) | ||||
| 		Blueprint result = generator.generate(map); | ||||
|  | ||||
| 		return result; | ||||
| 	public Generated generate(String type, Map<String, Object> map) throws Exception { | ||||
| 		GeneratorDescriptor descriptor = generatorDescriptorList.get(type); | ||||
| 		if (descriptor == null) | ||||
| 			throw new NoSuchElementException("Generator of type ["  | ||||
| 						+ type + "] not defined for adapter [" + this.getId() + "]"); | ||||
| 		if (!descriptor.linked) | ||||
| 			descriptor.linkGenerator(); | ||||
| 		if (!descriptor.linked) | ||||
| 			throw new NoSuchElementException("Generator of type ["  | ||||
| 					+ type + "] not linked for adapter [" + this.getId() + "]"); | ||||
| 		Generator generator = descriptor.generator; | ||||
| 		return generator.generate(map); | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -0,0 +1,37 @@ | ||||
| /*- | ||||
|  * ~~~~~~licensing~~~~~~ | ||||
|  * adapters-core | ||||
|  * ========== | ||||
|  * Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  * ========== | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  *  | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  *  | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  * ~~~~~~/licensing~~~~~~ | ||||
|  */ | ||||
| package ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.management; | ||||
|  | ||||
| public interface AdapterMBean { | ||||
|  | ||||
| 	public boolean isInited(); | ||||
| 	 | ||||
| 	public String getId(); | ||||
| 	 | ||||
| 	public String getName(); | ||||
| 	 | ||||
| 	public String getDescription(); | ||||
| 	 | ||||
| 	// public Map<String, String> getOptions(); | ||||
| 	 | ||||
| 	// public Map<String, String> getProperties(); | ||||
| 	 | ||||
| 	 | ||||
| } | ||||
| @@ -0,0 +1,57 @@ | ||||
| /*- | ||||
|  * ~~~~~~licensing~~~~~~ | ||||
|  * adapters-core | ||||
|  * ========== | ||||
|  * Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  * ========== | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  *  | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  *  | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  * ~~~~~~/licensing~~~~~~ | ||||
|  */ | ||||
| package ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.management; | ||||
|  | ||||
| import javax.management.NotCompliantMBeanException; | ||||
| import javax.management.StandardMBean; | ||||
|  | ||||
| import ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.api.Adapter; | ||||
|  | ||||
| public class AdapterMBeanImpl extends StandardMBean implements AdapterMBean { | ||||
| 	 | ||||
| 	protected Adapter adapter; | ||||
| 	 | ||||
| 	public AdapterMBeanImpl(Adapter adapter) throws NotCompliantMBeanException { | ||||
| 		super(AdapterMBean.class); | ||||
| 		this.adapter = adapter; | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
| 	public String getId() { | ||||
| 		return adapter.getId(); | ||||
| 	} | ||||
|  | ||||
| 	@Override | ||||
| 	public boolean isInited() { | ||||
| 		return adapter.isInited(); | ||||
| 	} | ||||
|  | ||||
| 	@Override | ||||
| 	public String getName() { | ||||
| 		return adapter.getName(); | ||||
| 	} | ||||
|  | ||||
| 	@Override | ||||
| 	public String getDescription() { | ||||
| 		return adapter.getDescription(); | ||||
| 	} | ||||
| 	 | ||||
| 	 | ||||
| } | ||||
| @@ -0,0 +1,36 @@ | ||||
| /*- | ||||
|  * ~~~~~~licensing~~~~~~ | ||||
|  * adapters-core | ||||
|  * ========== | ||||
|  * Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  * ========== | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  *  | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  *  | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  * ~~~~~~/licensing~~~~~~ | ||||
|  */ | ||||
| package ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.management; | ||||
|  | ||||
| import ru.entaxy.esb.platform.base.management.core.ManagementCore; | ||||
| import ru.entaxy.esb.platform.base.management.core.Qualifier; | ||||
|  | ||||
| public interface AdaptersMBean { | ||||
| 	 | ||||
| 	public static final String ADAPTERS_KEY = "categrory"; | ||||
| 	 | ||||
| 	public static final String ADAPTERS_VALUE = "adapters"; | ||||
| 	 | ||||
| 	public static final Qualifier Q_ADAPTERS = ManagementCore.Q_PLATFORM.qualifier(ADAPTERS_KEY, ADAPTERS_VALUE); | ||||
| 	 | ||||
| 	public static final String Q_ADAPTERS_S = ManagementCore.Q_LOCAL_NODE_S + "," + ADAPTERS_KEY + "=" + ADAPTERS_VALUE; | ||||
| 	 | ||||
| 	public void execute(String value); | ||||
| } | ||||
| @@ -0,0 +1,113 @@ | ||||
| /*- | ||||
|  * ~~~~~~licensing~~~~~~ | ||||
|  * adapters-core | ||||
|  * ========== | ||||
|  * Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  * ========== | ||||
|  * Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  * you may not use this file except in compliance with the License. | ||||
|  * You may obtain a copy of the License at | ||||
|  *  | ||||
|  *      http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  *  | ||||
|  * Unless required by applicable law or agreed to in writing, software | ||||
|  * distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  * See the License for the specific language governing permissions and | ||||
|  * limitations under the License. | ||||
|  * ~~~~~~/licensing~~~~~~ | ||||
|  */ | ||||
| package ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.management; | ||||
|  | ||||
| import java.util.HashMap; | ||||
| import java.util.Hashtable; | ||||
| import java.util.Map; | ||||
|  | ||||
| import javax.management.DynamicMBean; | ||||
| import javax.management.MBeanRegistration; | ||||
| import javax.management.NotCompliantMBeanException; | ||||
| import javax.management.StandardMBean; | ||||
|  | ||||
| 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.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.ServiceScope; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
|  | ||||
| import ru.entaxy.esb.platform.base.management.core.ManagementCore; | ||||
| import ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.api.Adapter; | ||||
|  | ||||
| @Component( | ||||
| 		service = {AdaptersMBean.class, DynamicMBean.class, MBeanRegistration.class}, | ||||
| 		// property = {"jmx.objectname=ru.entaxy.esb:group=platform,category=adapters"}, | ||||
| 		property = {ManagementCore.ENTAXY_JMX_DOMAIN + "=" + AdaptersMBean.Q_ADAPTERS_S}, | ||||
| 		scope = ServiceScope.SINGLETON, | ||||
| 		immediate = true | ||||
| 		) | ||||
| public class AdaptersMBeanImpl extends StandardMBean implements AdaptersMBean { | ||||
|  | ||||
| 	private static final Logger log = LoggerFactory.getLogger(AdaptersMBeanImpl.class); | ||||
| 	 | ||||
| 	protected Map<Adapter, ServiceRegistration<AdapterMBean>> mbeans = new HashMap<>(); | ||||
| 	 | ||||
| 	// @Reference (service = BundleContext.class) | ||||
| 	protected BundleContext bundleContext; | ||||
| 	 | ||||
| 	public AdaptersMBeanImpl() throws NotCompliantMBeanException { | ||||
| 		super(AdaptersMBean.class); | ||||
| 	} | ||||
| 	 | ||||
| 	 | ||||
| 	@Activate | ||||
| 	public void activate(ComponentContext componentContext) { | ||||
| 		log.info(" >> ACTIVATE <<"); | ||||
| 		this.bundleContext = componentContext.getBundleContext(); | ||||
| 	} | ||||
| 	 | ||||
| 	 | ||||
| 	@Reference (service = Adapter.class, cardinality = ReferenceCardinality.MULTIPLE,  | ||||
| 			unbind = "unbindAdapter", collectionType = CollectionType.SERVICE,  | ||||
| 			policy = ReferencePolicy.DYNAMIC) | ||||
| 	public void bindAdapter(Adapter adapter) { | ||||
| 		 | ||||
| 		try { | ||||
| 			AdapterMBeanImpl mbean = new AdapterMBeanImpl(adapter); | ||||
| 			Hashtable props = new Hashtable<>(); | ||||
| 			// props.put("jmx.objectname", "ru.entaxy.esb:group=platform,category=adapters,id=" + adapter.getId()); | ||||
| 			props.put(ManagementCore.JMX_OBJECTNAME, Q_ADAPTERS.qualifier("id", adapter.getId()).getValue()); | ||||
| 			ServiceRegistration<AdapterMBean> reg = bundleContext.registerService( | ||||
| 					new String[] { | ||||
| 							AdapterMBean.class.getName(), | ||||
| 							DynamicMBean.class.getName(), | ||||
| 							MBeanRegistration.class.getName() | ||||
| 						} | ||||
| 					, mbean | ||||
| 					, props); | ||||
| 			this.mbeans.put(adapter, reg); | ||||
| 			 | ||||
| 		} catch (NotCompliantMBeanException e) { | ||||
| 			log.error("Error creating MBean for adapter: ", e); | ||||
| 		} | ||||
| 		 | ||||
| 	} | ||||
| 	 | ||||
| 	public void unbindAdapter(Adapter adapter) { | ||||
| 		ServiceRegistration<AdapterMBean> reg = this.mbeans.get(adapter); | ||||
| 		if (reg != null) | ||||
| 			reg.unregister(); | ||||
| 		this.mbeans.remove(adapter); | ||||
| 	} | ||||
| 	 | ||||
| 	@Override | ||||
| 	public void execute(String value) { | ||||
| 		log.info(">> EXECUTED"); | ||||
| 	} | ||||
| 	 | ||||
| } | ||||
| @@ -19,10 +19,26 @@ | ||||
|  */ | ||||
| package ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.metadata; | ||||
|  | ||||
| import java.util.HashMap; | ||||
| import java.util.Map; | ||||
|  | ||||
| import com.google.gson.JsonObject; | ||||
|  | ||||
| import ru.entaxy.platform.base.support.JSONUtils; | ||||
|  | ||||
| public class AdapterGeneratorElement { | ||||
|     protected String type; | ||||
|     protected String generator = "FTLGenerator"; | ||||
|      | ||||
|     // Default generator is defined in GeneratorFactory | ||||
|     // no need to redefine it here | ||||
|     protected String generator = ""; | ||||
|  | ||||
|     protected JsonObject config; | ||||
|     protected Map<String, Object> configMap = new HashMap<>(); | ||||
|      | ||||
|     // we can postpone generator linking until it's really needed | ||||
|     protected boolean lazy = false; | ||||
|      | ||||
|     public String getType() { | ||||
|         return type; | ||||
|     } | ||||
| @@ -39,7 +55,31 @@ public class AdapterGeneratorElement { | ||||
|         this.generator = generator; | ||||
|     } | ||||
|  | ||||
|     public String toString() { | ||||
|     public Map<String, Object> getConfigMap() { | ||||
|     	if (configMap.isEmpty() && (this.config != null)) | ||||
|     		configMap = JSONUtils.element2map(this.config); | ||||
| 		return configMap; | ||||
| 	} | ||||
|  | ||||
| 	public void setConfigMap(Map<String, Object> configMap) { | ||||
| 		this.configMap = configMap; | ||||
| 	} | ||||
|  | ||||
| 	// actually the method is not called by Gson | ||||
| 	public void setConfig(JsonObject configElement) { | ||||
| 		this.config = configElement;  | ||||
| 		this.configMap = JSONUtils.element2map(configElement); | ||||
| 	} | ||||
|  | ||||
| 	public boolean isLazy() { | ||||
| 		return lazy; | ||||
| 	} | ||||
|  | ||||
| 	public void setLazy(boolean lazy) { | ||||
| 		this.lazy = lazy; | ||||
| 	} | ||||
|  | ||||
| 	public String toString() { | ||||
|         return "AdapterGeneratorElement: " + | ||||
|                 "{'type': '" + type + "', " + | ||||
|                 "'generator': '" + generator + "'}"; | ||||
|   | ||||
| @@ -19,11 +19,21 @@ | ||||
|  */ | ||||
| package ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.tracker; | ||||
|  | ||||
| import java.util.ArrayList; | ||||
| import java.util.Hashtable; | ||||
| import java.util.List; | ||||
|  | ||||
| import javax.management.DynamicMBean; | ||||
| import javax.management.MBeanRegistration; | ||||
|  | ||||
| import org.osgi.framework.BundleActivator; | ||||
| import org.osgi.framework.BundleContext; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
|  | ||||
| import ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.management.AdaptersMBean; | ||||
| import ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.management.AdaptersMBeanImpl; | ||||
|  | ||||
| public class AdapterTrackerActivator implements BundleActivator { | ||||
|  | ||||
| 	protected static final Logger log = LoggerFactory.getLogger(AdapterTrackerActivator.class); | ||||
| @@ -34,6 +44,18 @@ public class AdapterTrackerActivator implements BundleActivator { | ||||
| 	public void start(BundleContext context) throws Exception { | ||||
| 		tracker = new AdapterTracker(context); | ||||
| 		tracker.open(); | ||||
| 		/* AdaptersMBeanImpl mbean = new AdaptersMBeanImpl(); | ||||
| 		Hashtable props = new Hashtable(); | ||||
|         props.put("jmx.objectname", "ru.entaxy.esb:type=bundle,name=adapters"); | ||||
|         List<String> list = new ArrayList<>(); | ||||
|         list.add(AdaptersMBean.class.getName()); | ||||
|         list.add(DynamicMBean.class.getName()); | ||||
|         list.add(MBeanRegistration.class.getName()); | ||||
|         String[] clazzes = list.toArray(new String[] {}); | ||||
|         context.registerService( | ||||
|         		clazzes | ||||
|         	, mbean | ||||
|         	, props);*/		 | ||||
| 	} | ||||
|  | ||||
| 	@Override | ||||
|   | ||||
| @@ -0,0 +1,39 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <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 http://maven.apache.org/maven-v4_0_0.xsd"> | ||||
|  | ||||
|     <parent> | ||||
|         <groupId>ru.entaxy.esb.platform.runtime.base.connecting</groupId> | ||||
|         <artifactId>adapter</artifactId> | ||||
|         <version>1.8.1</version> | ||||
|     </parent> | ||||
|  | ||||
|     <modelVersion>4.0.0</modelVersion> | ||||
|     <groupId>ru.entaxy.esb.platform.runtime.base.connecting.adapter</groupId> | ||||
|     <artifactId>amqp-adapter</artifactId> | ||||
|     <packaging>bundle</packaging> | ||||
|  | ||||
|     <name>ENTAXY :: PLATFORM :: RUNTIME :: BASE :: CONNECTING :: ADAPTER :: AMQP ADAPTER</name> | ||||
|     <description>ENTAXY :: PLATFORM :: RUNTIME :: BASE :: CONNECTING :: ADAPTER :: AMQP ADAPTER</description> | ||||
|  | ||||
|  | ||||
|     <properties> | ||||
|         <bundle.osgi.dynamicimport.pkg>*</bundle.osgi.dynamicimport.pkg> | ||||
|     </properties> | ||||
|  | ||||
|     <build> | ||||
|         <plugins> | ||||
|             <plugin> | ||||
|                 <groupId>org.apache.felix</groupId> | ||||
|                 <artifactId>maven-bundle-plugin</artifactId> | ||||
|                 <extensions>true</extensions> | ||||
|                 <configuration> | ||||
|                     <instructions> | ||||
|                         <Entaxy-Adapter>true</Entaxy-Adapter> | ||||
|                         <Entaxy-Adapter-Class/> | ||||
|                     </instructions> | ||||
|                 </configuration> | ||||
|             </plugin> | ||||
|         </plugins> | ||||
|     </build> | ||||
| </project> | ||||
| @@ -0,0 +1,79 @@ | ||||
| { | ||||
| 	"adapter": { | ||||
| 		"id": "amqp.adapter.1", | ||||
| 		"name":  "amqpAdapter", | ||||
| 		"description": "Messaging with AMQP protocol using Apache QPid Client.", | ||||
| 		"fields": [ | ||||
| 			{ | ||||
| 				"name": "destinationType", | ||||
| 				"type": "String", | ||||
| 				"default": "queue", | ||||
| 				"property": false, | ||||
| 				"option": false | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "destinationName", | ||||
| 				"type": "String", | ||||
| 				"property": false, | ||||
| 				"option": false | ||||
| 			}, | ||||
|  | ||||
| 			{ | ||||
| 				"name": "clientId", | ||||
| 				"property": true, | ||||
| 				"option": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "acknowledgementModeName", | ||||
| 				"default": "AUTO_ACKNOWLEDGE", | ||||
| 				"property": true, | ||||
| 				"option": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "exchangePattern", | ||||
| 				"type": "ExchangePattern", | ||||
| 				"option": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "password", | ||||
| 				"property": true, | ||||
| 				"option": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "url", | ||||
| 				"property": true, | ||||
| 				"option": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "username", | ||||
| 				"property": true, | ||||
| 				"option": true | ||||
| 			} | ||||
| 		], | ||||
| 		"generators":[ | ||||
| 			{ | ||||
| 				"type": "pathParameter", | ||||
| 				"generator": "", | ||||
| 				"config": { | ||||
| 					"expession": "${destinationType}:${destinationName}" | ||||
| 				} | ||||
| 			}, | ||||
| 			{ | ||||
| 				"type": "init", | ||||
| 				"generator": "" | ||||
| 			}, | ||||
| 			{ | ||||
| 				"type": "ref", | ||||
| 				"generator": "" | ||||
| 			}, | ||||
| 			{ | ||||
| 				"type": "from", | ||||
| 				"generator": "" | ||||
| 			}, | ||||
| 			{ | ||||
| 				"type": "to", | ||||
| 				"generator": "" | ||||
| 			} | ||||
| 		] | ||||
| 	} | ||||
| } | ||||
| @@ -0,0 +1,24 @@ | ||||
| [#ftl attributes={"generated.type":"blueprint-node"}] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     amqp-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| [#include 'queryParameters.ftl'] | ||||
| <from uri="[=connection.name]:[=connection.pathParameter][=queryParameters]"/> | ||||
| @@ -0,0 +1,68 @@ | ||||
| [#ftl attributes={"generated.type":"blueprint"}] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     amqp-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| [#assign factoryProperties = ["url", "username", "password"]] | ||||
| [#function exceptFactoryProperties(propertyName)] | ||||
|     [#return !factoryProperties?seq_contains(propertyName)] | ||||
| [/#function] | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" | ||||
|            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||||
|            xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0" | ||||
|            xsi:schemaLocation=" | ||||
|                http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd" | ||||
|            > | ||||
|  | ||||
|     <cm:property-placeholder persistent-id="[=connection.configurationPid]" | ||||
|                              update-strategy="reload"> | ||||
|         [#if connection.properties??] | ||||
|         <cm:default-properties> | ||||
|         [#list connection.properties as key, value] | ||||
|             <cm:property name="[=connection.configurationPid].[=key]" value="[=value]"/> | ||||
|         [/#list] | ||||
|         </cm:default-properties> | ||||
|         [/#if] | ||||
|     </cm:property-placeholder> | ||||
|  | ||||
|     <service interface="org.apache.camel.Component" ref="[=connection.name]"> | ||||
|         <service-properties> | ||||
|             <entry key="connection.name" value="[=connection.name]"/> | ||||
|         </service-properties> | ||||
|     </service> | ||||
|  | ||||
|     <bean id="[=connection.name]" class="org.apache.camel.component.amqp.AMQPComponent"> | ||||
|         [#-- //TODO change template for property reference usage instead of text value --] | ||||
|         <property name="connectionFactory" ref="connectionFactory"/> | ||||
|         [#if connection.properties??] | ||||
|         [#list connection.properties?keys?filter(exceptFactoryProperties) as key] | ||||
|         <property name="[=key]" value="[='$']{[=connection.configurationPid].[=key]}"/> | ||||
|         [/#list] | ||||
|         [/#if] | ||||
|     </bean> | ||||
|  | ||||
|     <bean id="connectionFactory" class="org.apache.qpid.jms.JmsConnectionFactory"> | ||||
|         <argument index="0" value="[='$']{[=connection.configurationPid].username}"/> | ||||
|         <argument index="1" value="[='$']{[=connection.configurationPid].password}"/> | ||||
|         <argument index="2" value="[='$']{[=connection.configurationPid].url}"/> | ||||
|     </bean> | ||||
|  | ||||
| </blueprint> | ||||
| @@ -0,0 +1,30 @@ | ||||
| [#ftl] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     amqp-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| [#assign queryParameters] | ||||
|     [#if connection.options??] | ||||
|         [@compress single_line=true] | ||||
|             ?[#list connection.options as key, value][=key]=[=value][#sep]&[/#list] | ||||
|         [/@compress] | ||||
|     [/#if] | ||||
| [/#assign] | ||||
|  | ||||
| @@ -0,0 +1,24 @@ | ||||
| [#ftl attributes={"generated.type":"blueprint-node"}] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     amqp-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| <reference id="[=connection.name]" interface="org.apache.camel.Component" | ||||
|            filter="(connection.name=[=connection.name])"/> | ||||
| @@ -0,0 +1,24 @@ | ||||
| [#ftl attributes={"generated.type":"blueprint-node"}] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     amqp-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| [#include 'queryParameters.ftl'] | ||||
| <to uri="[=connection.name]:[=connection.pathParameter][=queryParameters]"/> | ||||
| @@ -5,7 +5,7 @@ | ||||
|     <parent> | ||||
|         <groupId>ru.entaxy.esb.platform.runtime.base.connecting</groupId> | ||||
|         <artifactId>adapter</artifactId> | ||||
|         <version>1.8.0</version> | ||||
|         <version>1.8.1</version> | ||||
|     </parent> | ||||
|  | ||||
|     <modelVersion>4.0.0</modelVersion> | ||||
|   | ||||
| @@ -670,7 +670,12 @@ | ||||
| 			}, | ||||
| 			{ | ||||
| 				"type": "init", | ||||
| 				"generator": "" | ||||
| 				"generator": "", | ||||
| 				"config": { | ||||
| 					"param1": "value1", | ||||
| 					"param2": 10, | ||||
| 					"param3": true  | ||||
| 				} | ||||
| 			}, | ||||
| 			{ | ||||
| 				"type": "ref", | ||||
|   | ||||
| @@ -1,21 +1,24 @@ | ||||
| <#-- | ||||
|  ~~~~~~licensing~~~~~~ | ||||
|  artemis-adapter | ||||
|  ========== | ||||
|  Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  ========== | ||||
|  Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  you may not use this file except in compliance with the License. | ||||
|  You may obtain a copy of the License at | ||||
|   | ||||
|       http://www.apache.org/licenses/LICENSE-2.0 | ||||
|   | ||||
|  Unless required by applicable law or agreed to in writing, software | ||||
|  distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  See the License for the specific language governing permissions and | ||||
|  limitations under the License. | ||||
|  ~~~~~~/licensing~~~~~~ | ||||
| --> | ||||
| <#include 'queryParameters.ftl'> | ||||
| [#ftl attributes={"generated.type":"blueprint-node"}] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     artemis-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| [#include 'queryParameters.ftl'] | ||||
| <from uri="[=connection.name]:[=connection.pathParameter][=queryParameters]"/> | ||||
|   | ||||
| @@ -1,26 +1,29 @@ | ||||
| <#-- | ||||
|  ~~~~~~licensing~~~~~~ | ||||
|  artemis-adapter | ||||
|  ========== | ||||
|  Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  ========== | ||||
|  Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  you may not use this file except in compliance with the License. | ||||
|  You may obtain a copy of the License at | ||||
|   | ||||
|       http://www.apache.org/licenses/LICENSE-2.0 | ||||
|   | ||||
|  Unless required by applicable law or agreed to in writing, software | ||||
|  distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  See the License for the specific language governing permissions and | ||||
|  limitations under the License. | ||||
|  ~~~~~~/licensing~~~~~~ | ||||
| --> | ||||
| <#assign factoryProperties = ["url", "username", "password", "maxConnections", "maxSessionsPerConnection"]> | ||||
| <#function exceptFactoryProperties(propertyName)> | ||||
|   <#return !factoryProperties?seq_contains(propertyName)> | ||||
| </#function> | ||||
| [#ftl attributes={"generated.type":"blueprint"}] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     artemis-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| [#assign factoryProperties = ["url", "username", "password", "maxConnections", "maxSessionsPerConnection"]] | ||||
| [#function exceptFactoryProperties(propertyName)] | ||||
|   [#return !factoryProperties?seq_contains(propertyName)] | ||||
| [/#function] | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" | ||||
|            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||||
| @@ -31,13 +34,13 @@ | ||||
|  | ||||
|     <cm:property-placeholder persistent-id="[=connection.configurationPid]" | ||||
|                              update-strategy="reload"> | ||||
|         <#if connection.properties??> | ||||
|         [#if connection.properties??] | ||||
|         <cm:default-properties> | ||||
|         <#list connection.properties as key, value> | ||||
|         [#list connection.properties as key, value] | ||||
|             <cm:property name="[=connection.configurationPid].[=key]" value="[=value]"/> | ||||
|         </#list> | ||||
|         [/#list] | ||||
|         </cm:default-properties> | ||||
|         </#if> | ||||
|         [/#if] | ||||
|     </cm:property-placeholder> | ||||
|  | ||||
|     <service interface="org.apache.camel.Component" ref="[=connection.name]"> | ||||
| @@ -47,13 +50,13 @@ | ||||
|     </service> | ||||
|  | ||||
|     <bean id="[=connection.name]" class="org.apache.camel.component.jms.JmsComponent"> | ||||
|         <#-- //TODO change template for property reference usage instead of text value --> | ||||
|         [#-- //TODO change template for property reference usage instead of text value --] | ||||
|         <property name="connectionFactory" ref="pooledConnectionFactory"/> | ||||
|         <#if connection.properties??> | ||||
|         <#list connection.properties?keys?filter(exceptFactoryProperties) as key> | ||||
|         [#if connection.properties??] | ||||
|         [#list connection.properties?keys?filter(exceptFactoryProperties) as key] | ||||
|         <property name="[=key]" value="[='$']{[=connection.configurationPid].[=key]}"/> | ||||
|         </#list> | ||||
|         </#if> | ||||
|         [/#list] | ||||
|         [/#if] | ||||
|     </bean> | ||||
|  | ||||
|     <bean id="pooledConnectionFactory" class="org.messaginghub.pooled.jms.JmsPoolConnectionFactory" | ||||
|   | ||||
| @@ -1,26 +1,29 @@ | ||||
| <#-- | ||||
|  ~~~~~~licensing~~~~~~ | ||||
|  artemis-adapter | ||||
|  ========== | ||||
|  Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  ========== | ||||
|  Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  you may not use this file except in compliance with the License. | ||||
|  You may obtain a copy of the License at | ||||
|   | ||||
|       http://www.apache.org/licenses/LICENSE-2.0 | ||||
|   | ||||
|  Unless required by applicable law or agreed to in writing, software | ||||
|  distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  See the License for the specific language governing permissions and | ||||
|  limitations under the License. | ||||
|  ~~~~~~/licensing~~~~~~ | ||||
| --> | ||||
| <#assign queryParameters> | ||||
|     <#if connection.options??> | ||||
|         <@compress single_line=true> | ||||
|             ?<#list connection.options as key, value>[=key]=[=value]<#sep>&</#list> | ||||
|          </@compress> | ||||
|     </#if> | ||||
| </#assign> | ||||
| [#ftl] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     artemis-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| [#assign queryParameters] | ||||
|     [#if connection.options??] | ||||
|         [@compress single_line=true] | ||||
|             ?[#list connection.options as key, value][=key]=[=value][#sep]&[/#list] | ||||
|          [/@compress] | ||||
|     [/#if] | ||||
| [/#assign] | ||||
|   | ||||
| @@ -1,21 +1,24 @@ | ||||
| <#-- | ||||
|  ~~~~~~licensing~~~~~~ | ||||
|  artemis-adapter | ||||
|  ========== | ||||
|  Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  ========== | ||||
|  Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  you may not use this file except in compliance with the License. | ||||
|  You may obtain a copy of the License at | ||||
|   | ||||
|       http://www.apache.org/licenses/LICENSE-2.0 | ||||
|   | ||||
|  Unless required by applicable law or agreed to in writing, software | ||||
|  distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  See the License for the specific language governing permissions and | ||||
|  limitations under the License. | ||||
|  ~~~~~~/licensing~~~~~~ | ||||
| --> | ||||
| [#ftl attributes={"generated.type":"blueprint-node"}] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     artemis-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| <reference id="[=connection.name]" interface="org.apache.camel.Component" | ||||
|            filter="(connection.name=[=connection.name])"/> | ||||
|   | ||||
| @@ -1,21 +1,24 @@ | ||||
| <#-- | ||||
|  ~~~~~~licensing~~~~~~ | ||||
|  artemis-adapter | ||||
|  ========== | ||||
|  Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  ========== | ||||
|  Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  you may not use this file except in compliance with the License. | ||||
|  You may obtain a copy of the License at | ||||
|   | ||||
|       http://www.apache.org/licenses/LICENSE-2.0 | ||||
|   | ||||
|  Unless required by applicable law or agreed to in writing, software | ||||
|  distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  See the License for the specific language governing permissions and | ||||
|  limitations under the License. | ||||
|  ~~~~~~/licensing~~~~~~ | ||||
| --> | ||||
| <#include 'queryParameters.ftl'> | ||||
| [#ftl attributes={"generated.type":"blueprint-node"}] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     artemis-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| [#include 'queryParameters.ftl'] | ||||
| <to uri="[=connection.name]:[=connection.pathParameter][=queryParameters]"/> | ||||
|   | ||||
| @@ -0,0 +1,39 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <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 http://maven.apache.org/maven-v4_0_0.xsd"> | ||||
|  | ||||
|     <parent> | ||||
|         <groupId>ru.entaxy.esb.platform.runtime.base.connecting</groupId> | ||||
|         <artifactId>adapter</artifactId> | ||||
|         <version>1.8.1</version> | ||||
|     </parent> | ||||
|  | ||||
|     <modelVersion>4.0.0</modelVersion> | ||||
|     <groupId>ru.entaxy.esb.platform.runtime.base.connecting.adapter</groupId> | ||||
|     <artifactId>artemis-amqp-adapter</artifactId> | ||||
|     <packaging>bundle</packaging> | ||||
|  | ||||
|     <name>ENTAXY :: PLATFORM :: RUNTIME :: BASE :: CONNECTING :: ADAPTER :: ARTEMIS AMQP ADAPTER</name> | ||||
|     <description>ENTAXY :: PLATFORM :: RUNTIME :: BASE :: CONNECTING :: ADAPTER :: ARTEMIS AMQP ADAPTER</description> | ||||
|  | ||||
|  | ||||
|     <properties> | ||||
|         <bundle.osgi.dynamicimport.pkg>*</bundle.osgi.dynamicimport.pkg> | ||||
|     </properties> | ||||
|  | ||||
|     <build> | ||||
|         <plugins> | ||||
|             <plugin> | ||||
|                 <groupId>org.apache.felix</groupId> | ||||
|                 <artifactId>maven-bundle-plugin</artifactId> | ||||
|                 <extensions>true</extensions> | ||||
|                 <configuration> | ||||
|                     <instructions> | ||||
|                         <Entaxy-Adapter>true</Entaxy-Adapter> | ||||
|                         <Entaxy-Adapter-Class/> | ||||
|                     </instructions> | ||||
|                 </configuration> | ||||
|             </plugin> | ||||
|         </plugins> | ||||
|     </build> | ||||
| </project> | ||||
| @@ -0,0 +1,79 @@ | ||||
| { | ||||
| 	"adapter": { | ||||
| 		"id": "artemis.amqp.adapter.1", | ||||
| 		"name":  "artemisAmqpAdapter", | ||||
| 		"description": "Messaging with AMQP protocol using Apache QPid Client.", | ||||
| 		"fields": [ | ||||
| 			{ | ||||
| 				"name": "destinationType", | ||||
| 				"type": "String", | ||||
| 				"default": "queue", | ||||
| 				"property": false, | ||||
| 				"option": false | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "destinationName", | ||||
| 				"type": "String", | ||||
| 				"property": false, | ||||
| 				"option": false | ||||
| 			}, | ||||
|  | ||||
| 			{ | ||||
| 				"name": "clientId", | ||||
| 				"property": true, | ||||
| 				"option": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "acknowledgementModeName", | ||||
| 				"default": "AUTO_ACKNOWLEDGE", | ||||
| 				"property": true, | ||||
| 				"option": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "exchangePattern", | ||||
| 				"type": "ExchangePattern", | ||||
| 				"option": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "password", | ||||
| 				"property": true, | ||||
| 				"option": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "url", | ||||
| 				"property": true, | ||||
| 				"option": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "username", | ||||
| 				"property": true, | ||||
| 				"option": true | ||||
| 			} | ||||
| 		], | ||||
| 		"generators":[ | ||||
| 			{ | ||||
| 				"type": "pathParameter", | ||||
| 				"generator": "", | ||||
| 				"config": { | ||||
| 					"expession": "${destinationType}:${destinationName}" | ||||
| 				} | ||||
| 			}, | ||||
| 			{ | ||||
| 				"type": "init", | ||||
| 				"generator": "" | ||||
| 			}, | ||||
| 			{ | ||||
| 				"type": "ref", | ||||
| 				"generator": "" | ||||
| 			}, | ||||
| 			{ | ||||
| 				"type": "from", | ||||
| 				"generator": "" | ||||
| 			}, | ||||
| 			{ | ||||
| 				"type": "to", | ||||
| 				"generator": "" | ||||
| 			} | ||||
| 		] | ||||
| 	} | ||||
| } | ||||
| @@ -0,0 +1,24 @@ | ||||
| [#ftl attributes={"generated.type":"blueprint-node"}] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     artemis-amqp-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| [#include 'queryParameters.ftl'] | ||||
| <from uri="[=connection.name]:[=connection.pathParameter][=queryParameters]"/> | ||||
| @@ -0,0 +1,68 @@ | ||||
| [#ftl attributes={"generated.type":"blueprint"}] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     artemis-amqp-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| [#assign factoryProperties = ["url", "username", "password"]] | ||||
| [#function exceptFactoryProperties(propertyName)] | ||||
|     [#return !factoryProperties?seq_contains(propertyName)] | ||||
| [/#function] | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" | ||||
|            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||||
|            xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0" | ||||
|            xsi:schemaLocation=" | ||||
|                http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd" | ||||
|            > | ||||
|  | ||||
|     <cm:property-placeholder persistent-id="[=connection.configurationPid]" | ||||
|                              update-strategy="reload"> | ||||
|         [#if connection.properties??] | ||||
|         <cm:default-properties> | ||||
|         [#list connection.properties as key, value] | ||||
|             <cm:property name="[=connection.configurationPid].[=key]" value="[=value]"/> | ||||
|         [/#list] | ||||
|         </cm:default-properties> | ||||
|         [/#if] | ||||
|     </cm:property-placeholder> | ||||
|  | ||||
|     <service interface="org.apache.camel.Component" ref="[=connection.name]"> | ||||
|         <service-properties> | ||||
|             <entry key="connection.name" value="[=connection.name]"/> | ||||
|         </service-properties> | ||||
|     </service> | ||||
|  | ||||
|     <bean id="[=connection.name]" class="org.apache.camel.component.amqp.AMQPComponent"> | ||||
|         [#-- //TODO change template for property reference usage instead of text value --] | ||||
|         <property name="connectionFactory" ref="connectionFactory"/> | ||||
|         [#if connection.properties??] | ||||
|         [#list connection.properties?keys?filter(exceptFactoryProperties) as key] | ||||
|         <property name="[=key]" value="[='$']{[=connection.configurationPid].[=key]}"/> | ||||
|         [/#list] | ||||
|         [/#if] | ||||
|     </bean> | ||||
|  | ||||
|     <bean id="connectionFactory" class="org.apache.qpid.jms.JmsConnectionFactory"> | ||||
|         <argument index="0" value="[='$']{[=connection.configurationPid].username}"/> | ||||
|         <argument index="1" value="[='$']{[=connection.configurationPid].password}"/> | ||||
|         <argument index="2" value="[='$']{[=connection.configurationPid].url}"/> | ||||
|     </bean> | ||||
|  | ||||
| </blueprint> | ||||
| @@ -0,0 +1,30 @@ | ||||
| [#ftl] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     artemis-amqp-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| [#assign queryParameters] | ||||
|     [#if connection.options??] | ||||
|         [@compress single_line=true] | ||||
|             ?[#list connection.options as key, value][=key]=[=value][#sep]&[/#list] | ||||
|         [/@compress] | ||||
|     [/#if] | ||||
| [/#assign] | ||||
|  | ||||
| @@ -0,0 +1,24 @@ | ||||
| [#ftl attributes={"generated.type":"blueprint-node"}] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     artemis-amqp-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| <reference id="[=connection.name]" interface="org.apache.camel.Component" | ||||
|            filter="(connection.name=[=connection.name])"/> | ||||
| @@ -0,0 +1,24 @@ | ||||
| [#ftl attributes={"generated.type":"blueprint-node"}] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     artemis-amqp-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| [#include 'queryParameters.ftl'] | ||||
| <to uri="[=connection.name]:[=connection.pathParameter][=queryParameters]"/> | ||||
| @@ -5,7 +5,7 @@ | ||||
|     <parent> | ||||
|         <groupId>ru.entaxy.esb.platform.runtime.base.connecting</groupId> | ||||
|         <artifactId>adapter</artifactId> | ||||
|         <version>1.8.0</version> | ||||
|         <version>1.8.1</version> | ||||
|     </parent> | ||||
|  | ||||
|     <modelVersion>4.0.0</modelVersion> | ||||
|   | ||||
| @@ -1,21 +1,24 @@ | ||||
| <#-- | ||||
|  ~~~~~~licensing~~~~~~ | ||||
|  file-adapter | ||||
|  ========== | ||||
|  Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  ========== | ||||
|  Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  you may not use this file except in compliance with the License. | ||||
|  You may obtain a copy of the License at | ||||
|   | ||||
|       http://www.apache.org/licenses/LICENSE-2.0 | ||||
|   | ||||
|  Unless required by applicable law or agreed to in writing, software | ||||
|  distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  See the License for the specific language governing permissions and | ||||
|  limitations under the License. | ||||
|  ~~~~~~/licensing~~~~~~ | ||||
| --> | ||||
| <#include 'queryParameters.ftl'> | ||||
| [#ftl attributes={"generated.type":"blueprint-node"}] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     file-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| [#include 'queryParameters.ftl'] | ||||
| <from uri="[=connection.name]:[=connection.pathParameter][=queryParameters]"/> | ||||
|   | ||||
| @@ -1,22 +1,25 @@ | ||||
| <#-- | ||||
|  ~~~~~~licensing~~~~~~ | ||||
|  file-adapter | ||||
|  ========== | ||||
|  Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  ========== | ||||
|  Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  you may not use this file except in compliance with the License. | ||||
|  You may obtain a copy of the License at | ||||
|   | ||||
|       http://www.apache.org/licenses/LICENSE-2.0 | ||||
|   | ||||
|  Unless required by applicable law or agreed to in writing, software | ||||
|  distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  See the License for the specific language governing permissions and | ||||
|  limitations under the License. | ||||
|  ~~~~~~/licensing~~~~~~ | ||||
| --> | ||||
| [#ftl attributes={"generated.type":"blueprint"}] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     file-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" | ||||
|            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||||
| @@ -27,13 +30,13 @@ | ||||
|  | ||||
|     <cm:property-placeholder persistent-id="[=connection.configurationPid]" | ||||
|                              update-strategy="reload"> | ||||
|         <#if connection.properties??> | ||||
|         [#if connection.properties??] | ||||
|         <cm:default-properties> | ||||
|         <#list connection.properties as key, value> | ||||
|         [#list connection.properties as key, value] | ||||
|             <cm:property name="[=connection.configurationPid].[=key]" value="[=value]"/> | ||||
|         </#list> | ||||
|         [/#list] | ||||
|         </cm:default-properties> | ||||
|         </#if> | ||||
|         [/#if] | ||||
|     </cm:property-placeholder> | ||||
|  | ||||
|     <service interface="org.apache.camel.Component" ref="[=connection.name]"> | ||||
| @@ -43,11 +46,11 @@ | ||||
|     </service> | ||||
|  | ||||
|     <bean id="[=connection.name]" class="org.apache.camel.component.file.FileComponent"> | ||||
|         <#if connection.properties??> | ||||
|         <#list connection.properties as key, value> | ||||
|         [#if connection.properties??] | ||||
|         [#list connection.properties as key, value] | ||||
|         <property name="[=key]" value="[='$']{[=connection.configurationPid].[=key]}"/> | ||||
|         </#list> | ||||
|         </#if> | ||||
|         [/#list] | ||||
|         [/#if] | ||||
|     </bean> | ||||
|  | ||||
| </blueprint> | ||||
|   | ||||
| @@ -1,26 +1,29 @@ | ||||
| <#-- | ||||
|  ~~~~~~licensing~~~~~~ | ||||
|  file-adapter | ||||
|  ========== | ||||
|  Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  ========== | ||||
|  Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  you may not use this file except in compliance with the License. | ||||
|  You may obtain a copy of the License at | ||||
|   | ||||
|       http://www.apache.org/licenses/LICENSE-2.0 | ||||
|   | ||||
|  Unless required by applicable law or agreed to in writing, software | ||||
|  distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  See the License for the specific language governing permissions and | ||||
|  limitations under the License. | ||||
|  ~~~~~~/licensing~~~~~~ | ||||
| --> | ||||
| <#assign queryParameters> | ||||
|     <#if connection.options??> | ||||
|         <@compress single_line=true> | ||||
|             ?<#list connection.options as key, value>[=key]=[=value]<#sep>&</#list> | ||||
|          </@compress> | ||||
|     </#if> | ||||
| </#assign> | ||||
| [#ftl] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     file-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| [#assign queryParameters] | ||||
|     [#if connection.options??] | ||||
|         [@compress single_line=true] | ||||
|             ?[#list connection.options as key, value][=key]=[=value][#sep]&[/#list] | ||||
|          [/@compress] | ||||
|     [/#if] | ||||
| [/#assign] | ||||
|   | ||||
| @@ -1,21 +1,24 @@ | ||||
| <#-- | ||||
|  ~~~~~~licensing~~~~~~ | ||||
|  file-adapter | ||||
|  ========== | ||||
|  Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  ========== | ||||
|  Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  you may not use this file except in compliance with the License. | ||||
|  You may obtain a copy of the License at | ||||
|   | ||||
|       http://www.apache.org/licenses/LICENSE-2.0 | ||||
|   | ||||
|  Unless required by applicable law or agreed to in writing, software | ||||
|  distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  See the License for the specific language governing permissions and | ||||
|  limitations under the License. | ||||
|  ~~~~~~/licensing~~~~~~ | ||||
| --> | ||||
| [#ftl attributes={"generated.type":"blueprint-node"}] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     file-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| <reference id="[=connection.name]" interface="org.apache.camel.Component" | ||||
|            filter="(connection.name=[=connection.name])"/> | ||||
|   | ||||
| @@ -1,21 +1,24 @@ | ||||
| <#-- | ||||
|  ~~~~~~licensing~~~~~~ | ||||
|  file-adapter | ||||
|  ========== | ||||
|  Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  ========== | ||||
|  Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  you may not use this file except in compliance with the License. | ||||
|  You may obtain a copy of the License at | ||||
|   | ||||
|       http://www.apache.org/licenses/LICENSE-2.0 | ||||
|   | ||||
|  Unless required by applicable law or agreed to in writing, software | ||||
|  distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  See the License for the specific language governing permissions and | ||||
|  limitations under the License. | ||||
|  ~~~~~~/licensing~~~~~~ | ||||
| --> | ||||
| <#include 'queryParameters.ftl'> | ||||
| [#ftl attributes={"generated.type":"blueprint-node"}] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     file-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| [#include 'queryParameters.ftl'] | ||||
| <to uri="[=connection.name]:[=connection.pathParameter][=queryParameters]"/> | ||||
|   | ||||
							
								
								
									
										48
									
								
								platform/runtime/base/connecting/adapter/h2-adapter/pom.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,48 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <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 http://maven.apache.org/maven-v4_0_0.xsd"> | ||||
|  | ||||
|     <parent> | ||||
|         <groupId>ru.entaxy.esb.platform.runtime.base.connecting</groupId> | ||||
|         <artifactId>adapter</artifactId> | ||||
|         <version>1.8.1</version> | ||||
|     </parent> | ||||
|  | ||||
|     <modelVersion>4.0.0</modelVersion> | ||||
|     <groupId>ru.entaxy.esb.platform.runtime.base.connecting.adapter</groupId> | ||||
|     <artifactId>h2-adapter</artifactId> | ||||
|     <packaging>bundle</packaging> | ||||
|  | ||||
|     <name>ENTAXY :: PLATFORM :: RUNTIME :: BASE :: CONNECTING :: ADAPTER :: H2 ADAPTER</name> | ||||
|     <description>ENTAXY :: PLATFORM :: RUNTIME :: BASE :: CONNECTING :: ADAPTER :: H2 ADAPTER</description> | ||||
|  | ||||
|  | ||||
|     <properties> | ||||
|         <bundle.osgi.dynamicimport.pkg>*</bundle.osgi.dynamicimport.pkg> | ||||
|         <h2.version>1.4.199</h2.version> | ||||
|     </properties> | ||||
|  | ||||
|     <build> | ||||
|         <plugins> | ||||
|             <plugin> | ||||
|                 <groupId>org.apache.felix</groupId> | ||||
|                 <artifactId>maven-bundle-plugin</artifactId> | ||||
|                 <extensions>true</extensions> | ||||
|                 <configuration> | ||||
|                     <instructions> | ||||
|                         <Entaxy-Adapter>true</Entaxy-Adapter> | ||||
|                         <Entaxy-Adapter-Class/> | ||||
|                     </instructions> | ||||
|                 </configuration> | ||||
|             </plugin> | ||||
|         </plugins> | ||||
|     </build> | ||||
|  | ||||
|     <dependencies> | ||||
|         <dependency> | ||||
|             <groupId>org.apache.camel</groupId> | ||||
|             <artifactId>camel-jdbc</artifactId> | ||||
|             <version>${camel.version}</version> | ||||
|         </dependency> | ||||
|     </dependencies> | ||||
| </project> | ||||
| @@ -0,0 +1,28 @@ | ||||
| ### | ||||
| # ~~~~~~licensing~~~~~~ | ||||
| # h2-adapter | ||||
| # ========== | ||||
| # Copyright (C) 2020 - 2021 EmDev LLC | ||||
| # ========== | ||||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||||
| # you may not use this file except in compliance with the License. | ||||
| # You may obtain a copy of the License at | ||||
| #  | ||||
| #      http://www.apache.org/licenses/LICENSE-2.0 | ||||
| #  | ||||
| # Unless required by applicable law or agreed to in writing, software | ||||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
| # See the License for the specific language governing permissions and | ||||
| # limitations under the License. | ||||
| # ~~~~~~/licensing~~~~~~ | ||||
| ### | ||||
| dataSourceName=entaxy.esb.storage | ||||
| osgi.jdbc.driver.name=H2 JDBC Driver | ||||
|  | ||||
| databaseName=${karaf.data}/storage | ||||
| user=sa | ||||
| password= | ||||
| pool=dbcp2 | ||||
| xa=true | ||||
| jdbc.pool.maxTotal=50 | ||||
| @@ -0,0 +1,134 @@ | ||||
| { | ||||
| 	"adapter": { | ||||
| 		"id": "h2.adapter.${h2.version}", | ||||
| 		"name":  "h2Adapter", | ||||
| 		"description": "H2 adapter to interact with databases.", | ||||
| 		"fields": [ | ||||
| 			{ | ||||
| 				"name": "dataSourceName", | ||||
| 				"type": "String", | ||||
| 				"default": "dataSource", | ||||
| 				"property": false, | ||||
| 				"option": false | ||||
| 			}, | ||||
|  | ||||
| 			{ | ||||
| 				"name": "dataSource", | ||||
| 				"type": "DataSource", | ||||
| 				"property": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "lazyStartProducer", | ||||
| 				"type": "boolean", | ||||
| 				"default": "false", | ||||
| 				"property": true, | ||||
| 				"option": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "autowiredEnabled", | ||||
| 				"type": "boolean", | ||||
| 				"default": "true", | ||||
| 				"property": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "connectionStrategy", | ||||
| 				"type": "ConnectionStrategy", | ||||
| 				"property": true, | ||||
| 				"option": true | ||||
| 			}, | ||||
|  | ||||
| 			{ | ||||
| 				"name": "allowNamedParameters", | ||||
| 				"type": "boolean", | ||||
| 				"default": "true", | ||||
| 				"option": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "outputClass", | ||||
| 				"property": true, | ||||
| 				"option": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "outputType", | ||||
| 				"type": "JdbcOutputType", | ||||
| 				"default": "SelectList", | ||||
| 				"option": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "parameters", | ||||
| 				"default": "Map", | ||||
| 				"option": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "readSize", | ||||
| 				"type": "int", | ||||
| 				"option": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "resetAutoCommit", | ||||
| 				"type": "boolean", | ||||
| 				"default": "true", | ||||
| 				"option": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "transacted", | ||||
| 				"type": "boolean", | ||||
| 				"default": "false", | ||||
| 				"option": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "useGetBytesForBlob", | ||||
| 				"type": "boolean", | ||||
| 				"default": "false", | ||||
| 				"option": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "useHeadersAsParameters", | ||||
| 				"type": "boolean", | ||||
| 				"default": "false", | ||||
| 				"option": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "useJDBC4ColumnNameAndLabelSemantics", | ||||
| 				"type": "boolean", | ||||
| 				"default": "true", | ||||
| 				"option": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "beanRowMapper", | ||||
| 				"type": "BeanRowMapper", | ||||
| 				"option": true | ||||
| 			}, | ||||
| 			{ | ||||
| 				"name": "prepareStatementStrategy", | ||||
| 				"type": "JdbcPrepareStatementStrategy", | ||||
| 				"option": true | ||||
| 			} | ||||
| 		], | ||||
| 		"generators":[ | ||||
| 			{ | ||||
| 				"type": "pathParameter", | ||||
| 				"generator": "", | ||||
| 				"config": { | ||||
| 					"expession": "${dataSourceName}" | ||||
| 				} | ||||
| 			}, | ||||
| 			{ | ||||
| 				"type": "init", | ||||
| 				"generator": "" | ||||
| 			}, | ||||
| 			{ | ||||
| 				"type": "ref", | ||||
| 				"generator": "" | ||||
| 			}, | ||||
| 			{ | ||||
| 				"type": "from", | ||||
| 				"generator": "" | ||||
| 			}, | ||||
| 			{ | ||||
| 				"type": "to", | ||||
| 				"generator": "" | ||||
| 			} | ||||
| 		] | ||||
| 	} | ||||
| } | ||||
| @@ -0,0 +1,61 @@ | ||||
| [#ftl attributes={"generated.type":"blueprint"} /] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     h2-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" | ||||
|            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||||
|            xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0" | ||||
|            xsi:schemaLocation=" | ||||
|                http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd" | ||||
|            > | ||||
|  | ||||
|     <cm:property-placeholder persistent-id="[=connection.configurationPid]" | ||||
|                              update-strategy="reload"> | ||||
|         [#if connection.properties??] | ||||
|         <cm:default-properties> | ||||
|         [#list connection.properties as key, value] | ||||
|             <cm:property name="[=connection.configurationPid].[=key]" value="[=value]"/> | ||||
|         [/#list] | ||||
|         </cm:default-properties> | ||||
|         [/#if] | ||||
|     </cm:property-placeholder> | ||||
|  | ||||
|     <service interface="org.apache.camel.Component" ref="[=connection.name]"> | ||||
|         <service-properties> | ||||
|             <entry key="connection.name" value="[=connection.name]"/> | ||||
|         </service-properties> | ||||
|     </service> | ||||
|  | ||||
|     <bean id="[=connection.name]" class="org.apache.camel.component.jdbc.JdbcComponent"> | ||||
|         [#-- //TODO change template for property reference usage instead of text value --] | ||||
|         <property name="dataSource" ref="dataSource"/> | ||||
|         [#if connection.properties??] | ||||
|         [#list connection.properties as key, value] | ||||
|         <property name="[=key]" value="[='$']{[=connection.configurationPid].[=key]}"/> | ||||
|         [/#list] | ||||
|         [/#if] | ||||
|     </bean> | ||||
|  | ||||
|     <reference id="dataSource" interface="javax.sql.DataSource" filter="(osgi.jndi.service.name=[=connection.pathParameter])" | ||||
|                availability="mandatory"/> | ||||
|  | ||||
| </blueprint> | ||||
| @@ -0,0 +1,29 @@ | ||||
| [#ftl] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     h2-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| [#assign queryParameters] | ||||
|     [#if connection.options??] | ||||
|         [@compress single_line=true] | ||||
|             ?[#list connection.options as key, value][=key]=[=value][#sep]&[/#list] | ||||
|          [/@compress] | ||||
|     [/#if] | ||||
| [/#assign] | ||||
| @@ -0,0 +1,25 @@ | ||||
| [#ftl attributes={"generated.type":"blueprint-node"}] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     h2-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
|  | ||||
| <reference id="[=connection.name]" interface="org.apache.camel.Component" | ||||
|            filter="(connection.name=[=connection.name])"/> | ||||
| @@ -0,0 +1,25 @@ | ||||
| [#ftl attributes={"generated.type":"blueprint-node"}] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     h2-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
|  | ||||
| [#include 'queryParameters.ftl'] | ||||
| <to uri="[=connection.name]:entaxy[=queryParameters]"/> | ||||
| @@ -5,7 +5,7 @@ | ||||
|     <parent> | ||||
|         <groupId>ru.entaxy.esb.platform.runtime.base.connecting</groupId> | ||||
|         <artifactId>adapter</artifactId> | ||||
|         <version>1.8.0</version> | ||||
|         <version>1.8.1</version> | ||||
|     </parent> | ||||
|  | ||||
|     <modelVersion>4.0.0</modelVersion> | ||||
|   | ||||
| @@ -1,21 +1,24 @@ | ||||
| <#-- | ||||
|  ~~~~~~licensing~~~~~~ | ||||
|  jms-adapter | ||||
|  ========== | ||||
|  Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  ========== | ||||
|  Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  you may not use this file except in compliance with the License. | ||||
|  You may obtain a copy of the License at | ||||
|   | ||||
|       http://www.apache.org/licenses/LICENSE-2.0 | ||||
|   | ||||
|  Unless required by applicable law or agreed to in writing, software | ||||
|  distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  See the License for the specific language governing permissions and | ||||
|  limitations under the License. | ||||
|  ~~~~~~/licensing~~~~~~ | ||||
| --> | ||||
| <#include 'queryParameters.ftl'> | ||||
| [#ftl attributes={"generated.type":"blueprint-node"}] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     jms-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| [#include 'queryParameters.ftl'] | ||||
| <from uri="[=connection.name]:[=connection.pathParameter][=queryParameters]"/> | ||||
|   | ||||
| @@ -1,22 +1,25 @@ | ||||
| <#-- | ||||
|  ~~~~~~licensing~~~~~~ | ||||
|  jms-adapter | ||||
|  ========== | ||||
|  Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  ========== | ||||
|  Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  you may not use this file except in compliance with the License. | ||||
|  You may obtain a copy of the License at | ||||
|   | ||||
|       http://www.apache.org/licenses/LICENSE-2.0 | ||||
|   | ||||
|  Unless required by applicable law or agreed to in writing, software | ||||
|  distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  See the License for the specific language governing permissions and | ||||
|  limitations under the License. | ||||
|  ~~~~~~/licensing~~~~~~ | ||||
| --> | ||||
| [#ftl attributes={"generated.type":"blueprint"}] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     jms-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" | ||||
|            xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||||
| @@ -27,13 +30,13 @@ | ||||
|  | ||||
|     <cm:property-placeholder persistent-id="[=connection.configurationPid]" | ||||
|                              update-strategy="reload"> | ||||
|         <#if connection.properties??> | ||||
|         [#if connection.properties??] | ||||
|         <cm:default-properties> | ||||
|         <#list connection.properties as key, value> | ||||
|         [#list connection.properties as key, value] | ||||
|             <cm:property name="[=connection.configurationPid].[=key]" value="[=value]"/> | ||||
|         </#list> | ||||
|         [/#list] | ||||
|         </cm:default-properties> | ||||
|         </#if> | ||||
|         [/#if] | ||||
|     </cm:property-placeholder> | ||||
|  | ||||
|     <service interface="org.apache.camel.Component" ref="[=connection.name]"> | ||||
| @@ -43,13 +46,13 @@ | ||||
|     </service> | ||||
|  | ||||
|     <bean id="[=connection.name]" class="org.apache.camel.component.jms.JmsComponent"> | ||||
|         <#-- //TODO change template for property reference usage instead of text value --> | ||||
|         [#-- //TODO change template for property reference usage instead of text value --] | ||||
|         <property name="connectionFactory" ref="pooledConnectionFactory"/> | ||||
|         <#if connection.properties??> | ||||
|         <#list connection.properties as key, value> | ||||
|         [#if connection.properties??] | ||||
|         [#list connection.properties as key, value] | ||||
|         <property name="[=key]" value="[='$']{[=connection.configurationPid].[=key]}"/> | ||||
|         </#list> | ||||
|         </#if> | ||||
|         [/#list] | ||||
|         [/#if] | ||||
|     </bean> | ||||
|  | ||||
|     <reference id="pooledConnectionFactory" interface="javax.jms.ConnectionFactory"/> | ||||
|   | ||||
| @@ -1,26 +1,29 @@ | ||||
| <#-- | ||||
|  ~~~~~~licensing~~~~~~ | ||||
|  jms-adapter | ||||
|  ========== | ||||
|  Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  ========== | ||||
|  Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  you may not use this file except in compliance with the License. | ||||
|  You may obtain a copy of the License at | ||||
|   | ||||
|       http://www.apache.org/licenses/LICENSE-2.0 | ||||
|   | ||||
|  Unless required by applicable law or agreed to in writing, software | ||||
|  distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  See the License for the specific language governing permissions and | ||||
|  limitations under the License. | ||||
|  ~~~~~~/licensing~~~~~~ | ||||
| --> | ||||
| <#assign queryParameters> | ||||
|     <#if connection.options??> | ||||
|         <@compress single_line=true> | ||||
|             ?<#list connection.options as key, value>[=key]=[=value]<#sep>&</#list> | ||||
|          </@compress> | ||||
|     </#if> | ||||
| </#assign> | ||||
| [#ftl] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     jms-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| [#assign queryParameters] | ||||
|     [#if connection.options??] | ||||
|         [@compress single_line=true] | ||||
|             ?[#list connection.options as key, value][=key]=[=value][#sep]&[/#list] | ||||
|          [/@compress] | ||||
|     [/#if] | ||||
| [/#assign] | ||||
|   | ||||
| @@ -1,21 +1,24 @@ | ||||
| <#-- | ||||
|  ~~~~~~licensing~~~~~~ | ||||
|  jms-adapter | ||||
|  ========== | ||||
|  Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  ========== | ||||
|  Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  you may not use this file except in compliance with the License. | ||||
|  You may obtain a copy of the License at | ||||
|   | ||||
|       http://www.apache.org/licenses/LICENSE-2.0 | ||||
|   | ||||
|  Unless required by applicable law or agreed to in writing, software | ||||
|  distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  See the License for the specific language governing permissions and | ||||
|  limitations under the License. | ||||
|  ~~~~~~/licensing~~~~~~ | ||||
| --> | ||||
| [#ftl attributes={"generated.type":"blueprint-node"}] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     jms-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| <reference id="[=connection.name]" interface="org.apache.camel.Component" | ||||
|            filter="(connection.name=[=connection.name])"/> | ||||
|   | ||||
| @@ -1,21 +1,24 @@ | ||||
| <#-- | ||||
|  ~~~~~~licensing~~~~~~ | ||||
|  jms-adapter | ||||
|  ========== | ||||
|  Copyright (C) 2020 - 2021 EmDev LLC | ||||
|  ========== | ||||
|  Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|  you may not use this file except in compliance with the License. | ||||
|  You may obtain a copy of the License at | ||||
|   | ||||
|       http://www.apache.org/licenses/LICENSE-2.0 | ||||
|   | ||||
|  Unless required by applicable law or agreed to in writing, software | ||||
|  distributed under the License is distributed on an "AS IS" BASIS, | ||||
|  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|  See the License for the specific language governing permissions and | ||||
|  limitations under the License. | ||||
|  ~~~~~~/licensing~~~~~~ | ||||
| --> | ||||
| <#include 'queryParameters.ftl'> | ||||
| [#ftl attributes={"generated.type":"blueprint-node"}] | ||||
| [#-- | ||||
|  | ||||
|     ~~~~~~licensing~~~~~~ | ||||
|     jms-adapter | ||||
|     ========== | ||||
|     Copyright (C) 2020 - 2021 EmDev LLC | ||||
|     ========== | ||||
|     Licensed under the Apache License, Version 2.0 (the "License"); | ||||
|     you may not use this file except in compliance with the License. | ||||
|     You may obtain a copy of the License at | ||||
|  | ||||
|          http://www.apache.org/licenses/LICENSE-2.0 | ||||
|  | ||||
|     Unless required by applicable law or agreed to in writing, software | ||||
|     distributed under the License is distributed on an "AS IS" BASIS, | ||||
|     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||||
|     See the License for the specific language governing permissions and | ||||
|     limitations under the License. | ||||
|     ~~~~~~/licensing~~~~~~ | ||||
|  | ||||
| --] | ||||
| [#include 'queryParameters.ftl'] | ||||
| <to uri="[=connection.name]:[=connection.pathParameter][=queryParameters]"/> | ||||
|   | ||||
| @@ -5,7 +5,7 @@ | ||||
|     <parent> | ||||
|         <groupId>ru.entaxy.esb.platform.runtime.base</groupId> | ||||
|         <artifactId>connecting</artifactId> | ||||
|         <version>1.8.0</version> | ||||
|         <version>1.8.1</version> | ||||
|     </parent> | ||||
|  | ||||
|     <modelVersion>4.0.0</modelVersion> | ||||
| @@ -22,5 +22,9 @@ | ||||
|         <module>jms-adapter</module> | ||||
|         <module>artemis-adapter</module> | ||||
|         <module>postgresql-adapter</module> | ||||
|         <module>h2-adapter</module> | ||||
|         <module>amqp-adapter</module> | ||||
|         <module>artemis-amqp-adapter</module> | ||||
|         <module>rabbitmq-amqp-adapter</module> | ||||
|     </modules> | ||||
| </project> | ||||