diff --git a/aggregate.marker b/aggregate.marker new file mode 100644 index 0000000..e69de29 diff --git a/documentation/connectors/create_new_connectors.adoc b/documentation/connectors/create_new_connectors.adoc index 8b76861..8385da8 100644 --- a/documentation/connectors/create_new_connectors.adoc +++ b/documentation/connectors/create_new_connectors.adoc @@ -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"> - + @@ -49,7 +49,7 @@ _src/main/resource/template/example-in-connector.ftl_ Создание и публикация бина: для связи коннектора с профилем, возможности получить весь список коннекторов определенного типа. [source, xml] ---- - + @@ -113,7 +113,7 @@ _src/main/resource/template/example-out-connector.ftl_ - + @@ -144,7 +144,7 @@ _src/main/resource/template/example-out-connector.ftl_ Создание и публикация бина: для связи коннектора с профилем, возможности получить весь список коннекторов определенного типа. [source, xml] ---- - + diff --git a/documentation/core/schema/Schema.adoc b/documentation/core/schema/Schema.adoc index dd534ae..440476b 100644 --- a/documentation/core/schema/Schema.adoc +++ b/documentation/core/schema/Schema.adoc @@ -1,4 +1,4 @@ -= Shema += Sсhema Есть три типа ресурсов, которые можно загружать в шину и использовать в маршрутах: diff --git a/documentation/installation/install.adoc b/documentation/installation/install.adoc index 3ad1969..7590afe 100644 --- a/documentation/installation/install.adoc +++ b/documentation/installation/install.adoc @@ -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 diff --git a/documentation/installation/installation-table-of-contents.adoc b/documentation/installation/installation-table-of-contents.adoc index 0f15dcf..80a255e 100644 --- a/documentation/installation/installation-table-of-contents.adoc +++ b/documentation/installation/installation-table-of-contents.adoc @@ -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] diff --git a/documentation/installation/installation-table-of-contents.ru.adoc b/documentation/installation/installation-table-of-contents.ru.adoc index b1b6cf4..48eeadb 100644 --- a/documentation/installation/installation-table-of-contents.ru.adoc +++ b/documentation/installation/installation-table-of-contents.ru.adoc @@ -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[Локальная установка] diff --git a/documentation/installation/local-installation/ReadMe.md b/documentation/installation/local-installation/ReadMe.md deleted file mode 100644 index 1c7c1c3..0000000 --- a/documentation/installation/local-installation/ReadMe.md +++ /dev/null @@ -1,141 +0,0 @@ -## Docker compose для сборки и запуска Entaxy. - -Запуск локального окружения с несколькими docker контейнерами: -* Караф -* Брокер -* СУБД -* Менеджер артефактов - -Для начала клонируем репозиторий и переходим в корень проекта: -```bash -git clone -cd entaxy-framework -``` -Далее у нас есть разные варианты хранения необходимых для установки Entaxy артефактов. -### 1. Самый простой способ: локальный репозиторий артефактов включаеться в образ карафа. -В корневом POM находится профиль для деплоя артефактов в образ карафа: -```xml - - docker.file.repo - - - entaxy-maven-repo-file - file:./distribution/entaxy-docker/karaf/repo - - - -``` -Запускаем мевен деплой из корня проекта с этим профилем: -```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 - - - - entaxy-maven-repo - admin - aW7frfS9NPGrOnuNBMf9gyO0eXNRaCoOGtXHTcLU5akDFJ9ACiUJhgmZxlOKnLC5 - - - -``` -В корневом POM находится профиль для деплоя артефактов на сервер reposilite: -```xml - - docker.reposilite - - - entaxy-maven-repo - http://127.0.0.1:8081/snapshots - - - -``` -Запускаем мевен деплой из корня проекта с этим профилем: -```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` diff --git a/documentation/installation/local-installation/image/cluster-note-list.png b/documentation/installation/local-installation/image/cluster-note-list.png new file mode 100644 index 0000000..eb33f85 Binary files /dev/null and b/documentation/installation/local-installation/image/cluster-note-list.png differ diff --git a/documentation/installation/local-installation/image/health-check.png b/documentation/installation/local-installation/image/health-check.png new file mode 100644 index 0000000..a8b56db Binary files /dev/null and b/documentation/installation/local-installation/image/health-check.png differ diff --git a/documentation/installation/local-installation/windows-local-installation.adoc b/documentation/installation/local-installation/local-installation.adoc similarity index 100% rename from documentation/installation/local-installation/windows-local-installation.adoc rename to documentation/installation/local-installation/local-installation.adoc diff --git a/documentation/installation/local-installation/local-installation.ru.adoc b/documentation/installation/local-installation/local-installation.ru.adoc new file mode 100644 index 0000000..94fda99 --- /dev/null +++ b/documentation/installation/local-installation/local-installation.ru.adoc @@ -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] +---- + + + + false + false + + +---- + +. Запускаем брокер сообщений `$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` + +- Выключаем мультикаст `` +- Включаем ip `` + +например: +[source,xml] +---- + + 224.2.2.3 + 54327 + + + 127.0.0.1 + +---- + +Также можно задавать маски адресов: +[source,xml] +---- + + 192.168.1.* + +---- + + +=== Проверка кластера + +Чтобы понимать, что экземпляры соединились в кластер, выполняем следующую команду в одной из консолей карафа: `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 \ No newline at end of file diff --git a/documentation/installation/local-installation/windows-local-installation.ru.adoc b/documentation/installation/local-installation/windows-local-installation.ru.adoc deleted file mode 100644 index adb8b77..0000000 --- a/documentation/installation/local-installation/windows-local-installation.ru.adoc +++ /dev/null @@ -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] ----- - - - - false - false - - ----- -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[инструкции по тестированию]. \ No newline at end of file diff --git a/documentation/monitoring/hawtio.adoc b/documentation/monitoring/hawtio.adoc new file mode 100644 index 0000000..4be86b2 --- /dev/null +++ b/documentation/monitoring/hawtio.adoc @@ -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[] diff --git a/documentation/monitoring/screenshots/image_2021-09-30_12-43-58.png b/documentation/monitoring/screenshots/image_2021-09-30_12-43-58.png new file mode 100644 index 0000000..401ea45 Binary files /dev/null and b/documentation/monitoring/screenshots/image_2021-09-30_12-43-58.png differ diff --git a/documentation/monitoring/screenshots/image_2021-09-30_12-45-07.png b/documentation/monitoring/screenshots/image_2021-09-30_12-45-07.png new file mode 100644 index 0000000..9706d59 Binary files /dev/null and b/documentation/monitoring/screenshots/image_2021-09-30_12-45-07.png differ diff --git a/documentation/monitoring/screenshots/image_2021-09-30_12-45-35.png b/documentation/monitoring/screenshots/image_2021-09-30_12-45-35.png new file mode 100644 index 0000000..6c3c9ce Binary files /dev/null and b/documentation/monitoring/screenshots/image_2021-09-30_12-45-35.png differ diff --git a/documentation/monitoring/screenshots/image_2021-09-30_12-45-55.png b/documentation/monitoring/screenshots/image_2021-09-30_12-45-55.png new file mode 100644 index 0000000..c4b4361 Binary files /dev/null and b/documentation/monitoring/screenshots/image_2021-09-30_12-45-55.png differ diff --git a/documentation/monitoring/screenshots/image_2021-09-30_12-46-36.png b/documentation/monitoring/screenshots/image_2021-09-30_12-46-36.png new file mode 100644 index 0000000..758bba1 Binary files /dev/null and b/documentation/monitoring/screenshots/image_2021-09-30_12-46-36.png differ diff --git a/documentation/monitoring/screenshots/image_2021-09-30_12-47-18.png b/documentation/monitoring/screenshots/image_2021-09-30_12-47-18.png new file mode 100644 index 0000000..34e39a8 Binary files /dev/null and b/documentation/monitoring/screenshots/image_2021-09-30_12-47-18.png differ diff --git a/features/README.md b/features/README.md deleted file mode 100644 index ef696ab..0000000 --- a/features/README.md +++ /dev/null @@ -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 /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: - - - - - - - - -### Forum, Help, etc - -If you hit an problems please let us know on the Camel Forums - - -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 - - - -#### 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 diff --git a/features/README.ru.md b/features/README.ru.md deleted file mode 100644 index 5dbc4f5..0000000 --- a/features/README.ru.md +++ /dev/null @@ -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 /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 - -Тестовый запрос: - - - - - - - - -## Автотесты - - - -#### Установка - - 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 - запись и чтение с подтверждением в параллельных потоках diff --git a/features/pom.xml b/features/pom.xml deleted file mode 100644 index f27e0d9..0000000 --- a/features/pom.xml +++ /dev/null @@ -1,181 +0,0 @@ - - - 4.0.0 - - ru.entaxy.esb - root - 1.8.0 - - - karaf-features - SYSTEM :: ENTAXY :: Features - pom - - - - cfg.dev - - cfg - - - - - src/main/${environmentConfigurationDirectory} - true - ${project.build.directory}/cfg - - - - - - !skipDevConfig - - - - - cfg.local - - cfg.local - - - - - - - - src/main/feature - true - ${project.build.directory}/feature - - - src/main/script - true - ${project.build.directory}/script - - - - - org.apache.maven.plugins - maven-resources-plugin - 3.1.0 - - - - resources - - - - - - org.codehaus.mojo - build-helper-maven-plugin - 1.12 - - - attach-artifacts - package - - attach-artifact - - - - - target/feature/feature.xml - xml - features - - - target/cfg/ru.entaxy.esb.cfg - cfg - ru.entaxy.esb - - - target/cfg/ru.entaxy.esb.system.basic_auth.cfg - cfg - ru.entaxy.esb.system.basic_auth - - - target/cfg/ru.entaxy.esb.system.basic_auth.htpasswd.cfg - cfg - ru.entaxy.esb.system.basic_auth.htpasswd - - - target/cfg/ru.entaxy.esb.system.event.rest.cfg - cfg - ru.entaxy.esb.system.event.rest - - - target/cfg/ru.entaxy.esb.system.event.handler.cfg - cfg - ru.entaxy.esb.system.event.handler - - - target/cfg/org.ops4j.datasource-entaxy.esb.cache.cfg - cfg - datasource-cache - - - target/cfg/org.ops4j.datasource-entaxy.esb.storage.cfg - cfg - datasource-storage - - - target/cfg/ru.entaxy.esb.deployer.nexus.cfg - cfg - ru.entaxy.esb.deployer.nexus - - - target/cfg/ru.entaxy.esb.deployer.cellar.cfg - cfg - ru.entaxy.esb.deployer.cellar - - - target/script/install.karaf - script - install - - - target/cfg/ru.entaxy.esb.error.cfg - cfg - ru.entaxy.esb.error - - - target/cfg/ru.entaxy.esb.error.code.cfg - cfg - ru.entaxy.esb.error.code - - - target/cfg/ru.entaxy.esb.error.text.cfg - cfg - ru.entaxy.esb.error.text - - - target/cfg/ru.entaxy.esb.deployer.file.system.cfg - cfg - ru.entaxy.esb.deployer.file.system - - - target/cfg/ru.entaxy.esb.system.schema.cfg - cfg - ru.entaxy.esb.system.schema - - - target/cfg/ru.entaxy.esb.system.management.cfg - cfg - ru.entaxy.esb.system.management - - - target/cfg/jre.properties - properties - jre - - - - - - - - - - diff --git a/features/src/main/feature/feature.xml b/features/src/main/feature/feature.xml deleted file mode 100644 index 26f600e..0000000 --- a/features/src/main/feature/feature.xml +++ /dev/null @@ -1,502 +0,0 @@ - - - - - - - mvn:org.apache.camel.karaf/apache-camel/${camel.version}/xml/features - mvn:org.apache.activemq/artemis-features/${activemq.version}/xml/features - mvn:org.hibernate/hibernate-osgi/${hibernate.version}/xml/karaf - mvn:org.apache.karaf.cellar/apache-karaf-cellar/${cellar.version}/xml/features - mvn:org.apache.ignite/ignite-osgi-karaf/${ignite.version}/xml/features - - - aries-blueprint - cxf - camel - camel-blueprint - camel-jaxb - camel-cxf - camel-amqp - camel-core - camel-http - mvn:ru.entaxy.esb.system/component-bean-fix/${project.version} - - osgi.service;objectClass=org.apache.aries.blueprint.NamespaceHandler;osgi.service.blueprint.namespace=http://camel.apache.org/schema/blueprint;effective:=active; - - - - - artemis-jms-client - camel-jms - mvn:org.messaginghub/pooled-jms/1.0.6 - mvn:org.apache.commons/commons-pool2/2.6.2 - - - - hibernate - jdbc - pax-jdbc-pool-dbcp2 - jndi - spring-jdbc - jpa - wrap:mvn:org.postgresql/postgresql/${postgresql.version} - wrap:mvn:com.microsoft.sqlserver/mssql-jdbc/${mssql.version} - - - mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/datasource-cache - - - mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/datasource-storage - - - - - mvn:ru.entaxy.esb.system.core/error-handler/${project.version} - - - mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.error - - - mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.error.code - - - mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.error.text - - - - - - mvn:ru.entaxy.esb/karaf-features/${project.version}/properties/jre - - - karaf-camel-common - system-entaxy-db - system-entaxy-jms - ignite-core - - mvn:org.apache.ignite/ignite-jcl/${ignite.version} - camel-ignite - camel-sql - - entaxy-esb-api - - - - mvn:org.eclipse.aether/aether-transport-http/1.1.0 - mvn:org.eclipse.aether/aether-transport-file/1.1.0 - mvn:org.eclipse.aether/aether-connector-basic/1.1.0 - mvn:org.eclipse.aether/aether-impl/1.1.0 - wrap:mvn:org.apache.maven/maven-aether-provider/3.3.9 - - - - aries-blueprint - karaf-camel-common - system-entaxy-db - system-entaxy-jms - - - mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb - - - - - cellar - bundle-service - system-common - entaxy-common - camel-gson - mvn:ru.entaxy.esb.system.core/template/${project.version} - mvn:ru.entaxy.esb.system.commons/system-commons/${project.version} - mvn:ru.entaxy.esb.system.core.dispatcher/dispatcher/${project.version} - mvn:ru.entaxy.esb.system.registry.profile.commons/profile-commons/${project.version} - - mvn:ru.entaxy.esb.system.registry.connector/connector-impl/${project.version} - mvn:ru.entaxy.esb.system.registry.connector/connector-api/${project.version} - system-api - nexus-deployer - file-system-deployer - cellar-deployer - - blueprint-generator - - - mvn:ru.entaxy.esb.system.management.bundle.manager/bundle-manager/${project.version} - mvn:ru.entaxy.esb.system.management.connector.manager/connector-manager/${project.version} - mvn:ru.entaxy.esb.system.management.bridge.profile.manager/bridge-profile-manager/${project.version} - - mvn:ru.entaxy.esb.system.management.profile.manager/profile-manager/${project.version} - mvn:ru.entaxy.esb.system.management.route.manager/route-manager/${project.version} - system-management - - schema - - - - camel-blueprint - mvn:ru.entaxy.esb.system.deployer/deployer-api/${project.version} - mvn:ru.entaxy.esb.system.deployer/file-system-deployer/${project.version} - - mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.deployer.file.system - - - - - mvn:org.eclipse.aether/aether-api/${aether.version} - camel-http - camel-cxf - mvn:ru.entaxy.esb.system.deployer/deployer-api/${project.version} - mvn:ru.entaxy.esb.system.deployer/nexus-deployer/${project.version} - - mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.deployer.nexus - - - - - mvn:ru.entaxy.esb.system.deployer/cellar-deployer/${project.version} - - mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.deployer.cellar - - - - - mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.freemarker/2.3.29_1 - mvn:ru.entaxy.esb.system.management.blueprint.generator/blueprint-generator/${project.version} - - - - mvn:ru.entaxy.esb.system.management.bundle.jpa/bundle-service/${project.version} - - osgi.service;objectClass=org.hibernate.SessionFactory;effective:=active; - - - - - - mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.system.management - - mvn:ru.entaxy.esb.system.management/system-management-api/${project.version} - - osgi.service;objectClass=org.hibernate.SessionFactory;effective:=active; - - - - - mvn:ru.entaxy.esb.system.core.dispatcher/dispatcher/${project.version} - mvn:ru.entaxy.esb.system.registry.profile.commons/profile-commons/${project.version} - - - - karaf-camel-common - system-entaxy-db - system-entaxy-jms - - mvn:org.liquibase/liquibase-core/${liquibase.version} - - mvn:ru.entaxy.esb.platform.runtime.core.initializer.storage.initializer/liquibase-updater/${project.version} - storage-cache - storage-esb_entaxy - - - - mvn:ru.entaxy.esb.platform.runtime.core.initializer.storage.initializer/storage-cache/${project.version} - - osgi.service;effective:=active;objectClass=javax.sql.DataSource;osgi.jndi.service.name=entaxy.esb.cache; - - - osgi.service;objectClass=javax.sql.DataSource;osgi.jndi.service.name=entaxy.esb.cache-connector; - - - - - mvn:ru.entaxy.esb.platform.runtime.core.initializer.storage.initializer/storage-esb_entaxy/${project.version} - - osgi.service;effective:=active;objectClass=javax.sql.DataSource;osgi.jndi.service.name=entaxy.esb.storage; - - - - - profile-commons - - mvn:ru.entaxy.esb.system.registry.systems.profile/system-profile-api/${project.version} - mvn:ru.entaxy.esb.system.registry.systems.profile/system-profile-collector/${project.version} - mvn:ru.entaxy.esb.system.registry.systems.profile/system-profile-impl-default/${project.version} - - - - - system-entaxy-db - system-entaxy-jms - bundle-service - permission-api - - mvn:ru.entaxy.esb.system.commons/system-commons/${project.version} - mvn:ru.entaxy.esb.system.registry.connector/connector-api/${project.version} - - mvn:ru.entaxy.esb.system.registry.systems/system-api/${project.version} - mvn:ru.entaxy.esb.system.registry.systems/system-impl/${project.version} - - - osgi.service;objectClass=org.hibernate.SessionFactory;effective:=active; - - - - - karaf-camel-common - system-entaxy-jms - - system-common - system-profile - mvn:ru.entaxy.esb.system.registry.systems/system-component/${project.version} - - - osgi.service;objectClass=org.hibernate.SessionFactory;effective:=active; - - - - - mvn:ru.entaxy.esb.system.registry.system-groups.profile/system-group-profile-api/${project.version} - - - mvn:ru.entaxy.esb.system.registry.system-groups.profile/system-group-profile-collector/${project.version} - - - mvn:ru.entaxy.esb.system.registry.system-groups.profile/system-group-profile-impl-default/${project.version} - - - - - karaf-camel-common - system-entaxy-jms - - system-common - system-group-profile - mvn:ru.entaxy.esb.system.registry.system-groups/system-group-component/${project.version} - - - - karaf-camel-common - liquibase-updater - mvn:commons-codec/commons-codec/${commons-codec.version} - - - mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.system.basic_auth - - - mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.system.basic_auth.htpasswd - - - mvn:ru.entaxy.esb.system.auth.basic.api/basic-auth-api/${project.version} - mvn:ru.entaxy.esb.system.auth.basic.impl/basic-auth-impl/${project.version} - mvn:ru.entaxy.esb.system.auth.basic.htpasswd/htpasswd/${project.version} - mvn:ru.entaxy.esb.system.auth.basic/basic-auth-soap/${project.version} - - osgi.service;objectClass=org.hibernate.SessionFactory;effective:=active; - - - - - events-impl - events-rest - events-handler - - - - mvn:ru.entaxy.esb.system.core.events/events-common/${project.version} - - - - cellar - cellar-eventadmin - camel-eventadmin - karaf-camel-common - camel-jsonpath - camel-gson - system-common - error-handler - system-registry - - system-api - - events-api - basic-auth - events-common - - permission-impl - permission-handler - permission-component - - mvn:ru.entaxy.esb.system.commons/system-commons/${project.version} - - - mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.system.event.rest - - - mvn:ru.entaxy.esb.system.core.events/events-rest/${project.version} - - - - system-entaxy-db - - events-common - - mvn:ru.entaxy.esb.system.core.events/events-api/${project.version} - - - - system-common - events-api - - events-common - - mvn:ru.entaxy.esb.system.core.events/events-impl/${project.version} - - osgi.service;objectClass=org.hibernate.SessionFactory;effective:=active; - - - - - camel-ognl - camel-gson - camel-quartz - system-common - events-api - - events-common - - - mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.system.event.handler - - - mvn:ru.entaxy.esb.system.core.events/events-handler/${project.version} - - - osgi.service;effective:=active;objectClass=javax.sql.DataSource;osgi.jndi.service.name=entaxy.esb.cache; - - - - - permission-impl - permission-handler - permission-component - permission-soap - permission-manager - - - - mvn:ru.entaxy.esb.system.core.permission/permission-common/${project.version} - - - - system-entaxy-db - - mvn:ru.entaxy.esb.system.core.permission/permission-api/${project.version} - - - - liquibase-updater - system-entaxy-db - system-common - permission-api - - permission-common - - mvn:ru.entaxy.esb.system.core.permission/permission-impl/${project.version} - - osgi.service;objectClass=org.hibernate.SessionFactory;effective:=active; - - - - - camel-ognl - system-entaxy-jms - system-common - permission-impl - - permission-common - - - - mvn:ru.entaxy.esb.system.core.permission/permission-handler/${project.version} - - - - permission-component - - mvn:ru.entaxy.esb.system.management.permission.manager/permission-manager/${project.version} - - - - system-common - camel-gson - permission-common - permission-impl - system-api - mvn:ru.entaxy.esb.system.commons/system-commons/${project.version} - - mvn:ru.entaxy.esb.system.core.permission/permission-component/${project.version} - - - - basic-auth - karaf-camel-common - - mvn:ru.entaxy.esb.system.core.permission/permission-soap/${project.version} - - - - system-entaxy-db - - - mvn:ru.entaxy.esb/karaf-features/${project.version}/cfg/ru.entaxy.esb.system.schema - - - mvn:ru.entaxy.esb.system.registry.schema/schema-api/${project.version} - mvn:ru.entaxy.esb.system.registry.schema/schema-impl/${project.version} - mvn:ru.entaxy.esb.system.registry.schema/schema-soap/${project.version} - mvn:ru.entaxy.esb.system.registry.schema/schema-component/${project.version} - - osgi.service;objectClass=org.hibernate.SessionFactory;effective:=active; - - - - - basic-auth - permission - entaxy-esb-api - system-registry - system-group-registry - events - - - - - mvn:ru.entaxy.esb.platform.runtime.base/branding/${project.version}/properties/branding - - - entaxy-service - - - diff --git a/features/src/main/script/README.md b/features/src/main/script/README.md deleted file mode 100644 index e394738..0000000 --- a/features/src/main/script/README.md +++ /dev/null @@ -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 diff --git a/features/src/main/script/create_full_karaf_assembly.sh b/features/src/main/script/create_full_karaf_assembly.sh deleted file mode 100644 index 9574c52..0000000 --- a/features/src/main/script/create_full_karaf_assembly.sh +++ /dev/null @@ -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 diff --git a/features/src/main/script/create_update_patch.sh b/features/src/main/script/create_update_patch.sh deleted file mode 100644 index 4dff6ae..0000000 --- a/features/src/main/script/create_update_patch.sh +++ /dev/null @@ -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/" diff --git a/features/src/main/script/install.karaf b/features/src/main/script/install.karaf deleted file mode 100644 index fbe26ce..0000000 --- a/features/src/main/script/install.karaf +++ /dev/null @@ -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 \ No newline at end of file diff --git a/features/src/main/script/install_patch.sh b/features/src/main/script/install_patch.sh deleted file mode 100644 index e0b99dd..0000000 --- a/features/src/main/script/install_patch.sh +++ /dev/null @@ -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 diff --git a/features/src/main/script/update_karaf_clean.sh b/features/src/main/script/update_karaf_clean.sh deleted file mode 100644 index c79f804..0000000 --- a/features/src/main/script/update_karaf_clean.sh +++ /dev/null @@ -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" diff --git a/platform/pom.xml b/platform/pom.xml index 892dbe3..3f84068 100644 --- a/platform/pom.xml +++ b/platform/pom.xml @@ -5,7 +5,7 @@ root ru.entaxy.esb - 1.8.0 + 1.8.1 4.0.0 diff --git a/features/LICENSE.txt b/platform/runtime/base/base-support/LICENSE.txt similarity index 100% rename from features/LICENSE.txt rename to platform/runtime/base/base-support/LICENSE.txt diff --git a/platform/runtime/base/base-support/pom.xml b/platform/runtime/base/base-support/pom.xml new file mode 100644 index 0000000..5df74f5 --- /dev/null +++ b/platform/runtime/base/base-support/pom.xml @@ -0,0 +1,52 @@ + + 4.0.0 + + ru.entaxy.esb.platform.runtime + base + 1.8.1 + + ru.entaxy.esb.platform.runtime.base + base-support + bundle + ENTAXY :: PLATFORM :: BASE :: SUPPORT + ENTAXY :: PLATFORM :: BASE :: SUPPORT + + + + 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 + + + + + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + + + commons-io + commons-io + ${commons-io.version} + + + org.osgi + osgi.core + + + javax.xml.bind + jaxb-api + + + commons-codec + commons-codec + + + com.google.code.gson + gson + + + \ No newline at end of file diff --git a/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/CommonUtils.java b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/CommonUtils.java new file mode 100644 index 0000000..f11b83d --- /dev/null +++ b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/CommonUtils.java @@ -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 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 fragmentsIterator() { + return data.iterator(); + } + + public ListIterator fragmentsListIterator() { + return data.listIterator(); + } + + public List pathHierarchy(){ + return pathHierarchy(true); + } + + public List pathHierarchy(boolean absolute){ + List result = new ArrayList<>(); + if (data.isEmpty()) + return result; + result.add((absolute?separator:"") + data.get(0)); + for (int i=1; i iterator() { + return pathHierarchy().iterator(); + } + + public ListIterator 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() Map addDictionaryToMap(Dictionary source, Map sink) { + for (Enumeration keys = source.keys(); keys.hasMoreElements();) { + K key = keys.nextElement(); + sink.put(key, source.get(key)); + } + return sink; + } + + public static Map getDictionaryAsMap(Dictionary source) { + Map result = new HashMap<>(); + CommonUtils.addDictionaryToMap(source, result); + return result; + } + +} diff --git a/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/FileUtils.java b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/FileUtils.java new file mode 100644 index 0000000..cb83b29 --- /dev/null +++ b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/FileUtils.java @@ -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); + } + +} diff --git a/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/JSONUtils.java b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/JSONUtils.java new file mode 100644 index 0000000..9eb9a67 --- /dev/null +++ b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/JSONUtils.java @@ -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 element2map(JsonElement element){ + Map result = new HashMap<>(); + if (element.isJsonObject()) { + JsonObject jsonObject = element.getAsJsonObject(); + for (Entry 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 element2list(JsonElement element) { + List result = new ArrayList<>(); + JsonArray array = element.getAsJsonArray(); + for (int i=0; i> { + + 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 { + + @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 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 { + 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 getService(Class serviceClass) { + BundleContext bundleContext = FrameworkUtil.getBundle(OSGIUtils.class).getBundleContext(); + return getService(bundleContext, serviceClass); + } + + + static public T getService(BundleContext bundleContext, Class serviceClass) { + T result = null; + ServiceReference ref = bundleContext.getServiceReference(serviceClass); + if (ref != null) { + result = bundleContext.getService(ref); + } + return result; + } + + static public ServicesHelper services() { + return new ServicesHelper(); + } + +} diff --git a/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/BundleContextAware.java b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/BundleContextAware.java new file mode 100644 index 0000000..1520a4a --- /dev/null +++ b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/BundleContextAware.java @@ -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(); + +} diff --git a/system/deployer/deployer-api/src/main/java/ru/entaxy/esb/system/deployer/api/BundleRepository.java b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/BundleFilter.java similarity index 68% rename from system/deployer/deployer-api/src/main/java/ru/entaxy/esb/system/deployer/api/BundleRepository.java rename to platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/BundleFilter.java index cd41099..db3dbbb 100644 --- a/system/deployer/deployer-api/src/main/java/ru/entaxy/esb/system/deployer/api/BundleRepository.java +++ b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/BundleFilter.java @@ -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 { + public String getFilterId(); + public List checkBundle(Bundle bundle, BundleEvent event); + } diff --git a/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/BundleTrackerCustomizerListener.java b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/BundleTrackerCustomizerListener.java new file mode 100644 index 0000000..4c4cbcd --- /dev/null +++ b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/BundleTrackerCustomizerListener.java @@ -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 { + + public void added(T managedObject); + public void modified(T managedObject); + public void removed(T managedObject); + +} diff --git a/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/BundleTrackerUtils.java b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/BundleTrackerUtils.java new file mode 100644 index 0000000..518bb46 --- /dev/null +++ b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/BundleTrackerUtils.java @@ -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 { + + protected UniformBundleTrackerCustomizer customizer; + + protected List> filters = new LinkedList<>(); + + protected BundleContext bundleContext = FrameworkUtil.getBundle(BundleTrackerUtils.class).getBundleContext(); + + protected int bundleState = Bundle.ACTIVE; + + public BundleTrackerBuilder customizer(UniformBundleTrackerCustomizer customizer){ + this.customizer = customizer; + return this; + } + + public BundleTrackerBuilder bundleContext(BundleContext bundleContext){ + this.bundleContext = bundleContext; + return this; + } + + public BundleTrackerBuilder addFilter(BundleFilter bundleFilter){ + this.filters.add(bundleFilter); + return this; + } + + public BundleTrackerBuilder bundleState(int state){ + this.bundleState = state; + return this; + } + + public BundleTracker 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(bundleContext, bundleState, customizer); + } + } + + public static BundleTrackerBuilder createBuilder(){ + return new BundleTrackerBuilder(); + } + +} diff --git a/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/UniformBundleTrackerCustomizer.java b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/UniformBundleTrackerCustomizer.java new file mode 100644 index 0000000..b1c4076 --- /dev/null +++ b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/UniformBundleTrackerCustomizer.java @@ -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 implements BundleTrackerCustomizer { + + protected BundleTrackerCustomizerListener listener; + + protected List> filters = new LinkedList<>(); + + public UniformBundleTrackerCustomizer() { + super(); + } + + public UniformBundleTrackerCustomizer(BundleTrackerCustomizerListener listener) { + super(); + setListener(listener); + } + + public BundleTrackerCustomizerListener getListener() { + return listener; + } + + public void setListener(BundleTrackerCustomizerListener listener) { + this.listener = listener; + } + + public void addFilter(BundleFilter filter) { + this.filters.add(filter); + } + + public UniformBundleTrackerCustomizer listener(BundleTrackerCustomizerListener listener){ + setListener(listener); + return this; + } + + @Override + public T addingBundle(Bundle bundle, BundleEvent event) { + Map> 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> filterResults); + + /* + * to override + */ + protected void enrichManagedObject(Bundle bundle, BundleEvent event, Map> 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); + } + +} diff --git a/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/filter/AbstractBundleFilter.java b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/filter/AbstractBundleFilter.java new file mode 100644 index 0000000..03968a0 --- /dev/null +++ b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/filter/AbstractBundleFilter.java @@ -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> implements BundleFilter { + + 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; + } + +} diff --git a/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/filter/BundleCapabilityFilter.java b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/filter/BundleCapabilityFilter.java new file mode 100644 index 0000000..db8d413 --- /dev/null +++ b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/filter/BundleCapabilityFilter.java @@ -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 { + + public static final String DEFAULT_FILTER_ID = "bundle.capabilities"; + + protected String namespace; + + @Override + protected String getDefaultFilterId() { + return DEFAULT_FILTER_ID; + } + + @Override + public List checkBundle(Bundle bundle, BundleEvent event) { + BundleRevision revision = bundle.adapt(BundleRevision.class); + if (revision == null) + return null; + List 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; + } + +} diff --git a/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/filter/BundleHeaderFilter.java b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/filter/BundleHeaderFilter.java new file mode 100644 index 0000000..3370be9 --- /dev/null +++ b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/osgi/tracker/filter/BundleHeaderFilter.java @@ -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 { + + 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 checkBundle(Bundle bundle, BundleEvent event) { + Map 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; + }; +} diff --git a/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/xml/CommonXMLUtils.java b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/xml/CommonXMLUtils.java new file mode 100644 index 0000000..8a89bf3 --- /dev/null +++ b/platform/runtime/base/base-support/src/main/java/ru/entaxy/platform/base/support/xml/CommonXMLUtils.java @@ -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> classMap) throws Exception{ + Unmarshaller um = context.createUnmarshaller(); + return jaxbUnmarshall(um, node, classMap); + } + public static JAXBElement jaxbUnmarshall(Unmarshaller um, Node node, HashMap> 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 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(); + }*/ +} diff --git a/platform/runtime/base/branding/pom.xml b/platform/runtime/base/branding/pom.xml index 07df7b0..3d2fd6e 100644 --- a/platform/runtime/base/branding/pom.xml +++ b/platform/runtime/base/branding/pom.xml @@ -5,7 +5,7 @@ ru.entaxy.esb.platform.runtime base - 1.8.0 + 1.8.1 4.0.0 diff --git a/platform/runtime/base/connecting/adapter/adapters-core/pom.xml b/platform/runtime/base/connecting/adapter/adapters-core/pom.xml index ab362bd..e1b980b 100644 --- a/platform/runtime/base/connecting/adapter/adapters-core/pom.xml +++ b/platform/runtime/base/connecting/adapter/adapters-core/pom.xml @@ -5,7 +5,7 @@ ru.entaxy.esb.platform.runtime.base.connecting adapter - 1.8.0 + 1.8.1 4.0.0 @@ -20,6 +20,7 @@ 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 @@ ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.tracker.AdapterTrackerActivator + <_dsannotations>* @@ -45,24 +47,45 @@ org.osgi osgi.core - ${osgi.version} provided + + org.slf4j + slf4j-api + provided + com.google.code.gson gson - ${gson.version} - ru.entaxy.esb.system.management.blueprint.generator - blueprint-generator + ru.entaxy.esb.platform.runtime.base.connecting.generator + generator-api ${project.version} + + + ru.entaxy.esb.platform.runtime.base + management-core + ${project.version} + + ru.entaxy.esb.platform.runtime.base.connecting.generator generator-factory ${project.version} + + org.apache.felix + org.apache.felix.scr + 2.1.20 + + + org.osgi + org.osgi.service.component.annotations + 1.4.0 + compile + \ No newline at end of file diff --git a/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/api/Adapter.java b/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/api/Adapter.java index 4f6bb2d..6391aef 100644 --- a/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/api/Adapter.java +++ b/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/api/Adapter.java @@ -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 getProperties() { return new HashMap<>(); } - public default Blueprint generate(String type, Map map) throws Exception { + +/* + @Deprecated + public default Blueprint generateBlueprint(String type, Map map) throws Exception { return null; } +*/ + public default Generated generate(String type, Map map) throws Exception { + return Generated.create(); + } + } diff --git a/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/impl/DefaultAdapter.java b/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/impl/DefaultAdapter.java index 726745d..046e449 100644 --- a/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/impl/DefaultAdapter.java +++ b/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/impl/DefaultAdapter.java @@ -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 generatorList = new HashMap<>(); + @Deprecated + protected Map generatorList = new HashMap<>(); + protected Map 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 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 generators) { @@ -151,14 +184,17 @@ public class DefaultAdapter implements Adapter { } @Override - public Blueprint generate(String type, Map 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 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); } } diff --git a/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/management/AdapterMBean.java b/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/management/AdapterMBean.java new file mode 100644 index 0000000..81c7598 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/management/AdapterMBean.java @@ -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 getOptions(); + + // public Map getProperties(); + + +} diff --git a/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/management/AdapterMBeanImpl.java b/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/management/AdapterMBeanImpl.java new file mode 100644 index 0000000..cd9f7e1 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/management/AdapterMBeanImpl.java @@ -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(); + } + + +} diff --git a/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/management/AdaptersMBean.java b/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/management/AdaptersMBean.java new file mode 100644 index 0000000..9781d76 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/management/AdaptersMBean.java @@ -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); +} diff --git a/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/management/AdaptersMBeanImpl.java b/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/management/AdaptersMBeanImpl.java new file mode 100644 index 0000000..048d1d7 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/management/AdaptersMBeanImpl.java @@ -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> 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 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 reg = this.mbeans.get(adapter); + if (reg != null) + reg.unregister(); + this.mbeans.remove(adapter); + } + + @Override + public void execute(String value) { + log.info(">> EXECUTED"); + } + +} diff --git a/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/metadata/AdapterGeneratorElement.java b/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/metadata/AdapterGeneratorElement.java index 63173b8..a72affe 100644 --- a/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/metadata/AdapterGeneratorElement.java +++ b/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/metadata/AdapterGeneratorElement.java @@ -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 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 getConfigMap() { + if (configMap.isEmpty() && (this.config != null)) + configMap = JSONUtils.element2map(this.config); + return configMap; + } + + public void setConfigMap(Map 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 + "'}"; diff --git a/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/tracker/AdapterTrackerActivator.java b/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/tracker/AdapterTrackerActivator.java index 7ff5c83..e23be38 100644 --- a/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/tracker/AdapterTrackerActivator.java +++ b/platform/runtime/base/connecting/adapter/adapters-core/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/adapter/core/tracker/AdapterTrackerActivator.java @@ -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 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 diff --git a/system/component-bean-fix/LICENSE.txt b/platform/runtime/base/connecting/adapter/amqp-adapter/LICENSE.txt similarity index 100% rename from system/component-bean-fix/LICENSE.txt rename to platform/runtime/base/connecting/adapter/amqp-adapter/LICENSE.txt diff --git a/platform/runtime/base/connecting/adapter/amqp-adapter/pom.xml b/platform/runtime/base/connecting/adapter/amqp-adapter/pom.xml new file mode 100644 index 0000000..eb36609 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/amqp-adapter/pom.xml @@ -0,0 +1,39 @@ + + + + + ru.entaxy.esb.platform.runtime.base.connecting + adapter + 1.8.1 + + + 4.0.0 + ru.entaxy.esb.platform.runtime.base.connecting.adapter + amqp-adapter + bundle + + ENTAXY :: PLATFORM :: RUNTIME :: BASE :: CONNECTING :: ADAPTER :: AMQP ADAPTER + ENTAXY :: PLATFORM :: RUNTIME :: BASE :: CONNECTING :: ADAPTER :: AMQP ADAPTER + + + + * + + + + + + org.apache.felix + maven-bundle-plugin + true + + + true + + + + + + + \ No newline at end of file diff --git a/platform/runtime/base/connecting/adapter/amqp-adapter/src/main/resources/ru/entaxy/adapter/metadata.json b/platform/runtime/base/connecting/adapter/amqp-adapter/src/main/resources/ru/entaxy/adapter/metadata.json new file mode 100644 index 0000000..95aedb5 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/amqp-adapter/src/main/resources/ru/entaxy/adapter/metadata.json @@ -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": "" + } + ] + } +} diff --git a/platform/runtime/base/connecting/adapter/amqp-adapter/src/main/resources/template/from.ftl b/platform/runtime/base/connecting/adapter/amqp-adapter/src/main/resources/template/from.ftl new file mode 100644 index 0000000..1d2e53b --- /dev/null +++ b/platform/runtime/base/connecting/adapter/amqp-adapter/src/main/resources/template/from.ftl @@ -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'] + diff --git a/platform/runtime/base/connecting/adapter/amqp-adapter/src/main/resources/template/init.ftl b/platform/runtime/base/connecting/adapter/amqp-adapter/src/main/resources/template/init.ftl new file mode 100644 index 0000000..3a83961 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/amqp-adapter/src/main/resources/template/init.ftl @@ -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] + + + + + [#if connection.properties??] + + [#list connection.properties as key, value] + + [/#list] + + [/#if] + + + + + + + + + + [#-- //TODO change template for property reference usage instead of text value --] + + [#if connection.properties??] + [#list connection.properties?keys?filter(exceptFactoryProperties) as key] + + [/#list] + [/#if] + + + + + + + + + diff --git a/platform/runtime/base/connecting/adapter/amqp-adapter/src/main/resources/template/queryParameters.ftl b/platform/runtime/base/connecting/adapter/amqp-adapter/src/main/resources/template/queryParameters.ftl new file mode 100644 index 0000000..e594c1d --- /dev/null +++ b/platform/runtime/base/connecting/adapter/amqp-adapter/src/main/resources/template/queryParameters.ftl @@ -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] + diff --git a/platform/runtime/base/connecting/adapter/amqp-adapter/src/main/resources/template/ref.ftl b/platform/runtime/base/connecting/adapter/amqp-adapter/src/main/resources/template/ref.ftl new file mode 100644 index 0000000..7e50fe5 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/amqp-adapter/src/main/resources/template/ref.ftl @@ -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~~~~~~ + +--] + diff --git a/platform/runtime/base/connecting/adapter/amqp-adapter/src/main/resources/template/to.ftl b/platform/runtime/base/connecting/adapter/amqp-adapter/src/main/resources/template/to.ftl new file mode 100644 index 0000000..944aaf4 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/amqp-adapter/src/main/resources/template/to.ftl @@ -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'] + diff --git a/platform/runtime/base/connecting/adapter/artemis-adapter/pom.xml b/platform/runtime/base/connecting/adapter/artemis-adapter/pom.xml index f87393f..54dafac 100644 --- a/platform/runtime/base/connecting/adapter/artemis-adapter/pom.xml +++ b/platform/runtime/base/connecting/adapter/artemis-adapter/pom.xml @@ -5,7 +5,7 @@ ru.entaxy.esb.platform.runtime.base.connecting adapter - 1.8.0 + 1.8.1 4.0.0 diff --git a/platform/runtime/base/connecting/adapter/artemis-adapter/src/main/resources/ru/entaxy/adapter/metadata.json b/platform/runtime/base/connecting/adapter/artemis-adapter/src/main/resources/ru/entaxy/adapter/metadata.json index b16665d..c8eb663 100644 --- a/platform/runtime/base/connecting/adapter/artemis-adapter/src/main/resources/ru/entaxy/adapter/metadata.json +++ b/platform/runtime/base/connecting/adapter/artemis-adapter/src/main/resources/ru/entaxy/adapter/metadata.json @@ -670,7 +670,12 @@ }, { "type": "init", - "generator": "" + "generator": "", + "config": { + "param1": "value1", + "param2": 10, + "param3": true + } }, { "type": "ref", diff --git a/platform/runtime/base/connecting/adapter/artemis-adapter/src/main/resources/template/from.ftl b/platform/runtime/base/connecting/adapter/artemis-adapter/src/main/resources/template/from.ftl index e222497..5a3bc37 100644 --- a/platform/runtime/base/connecting/adapter/artemis-adapter/src/main/resources/template/from.ftl +++ b/platform/runtime/base/connecting/adapter/artemis-adapter/src/main/resources/template/from.ftl @@ -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'] diff --git a/platform/runtime/base/connecting/adapter/artemis-adapter/src/main/resources/template/init.ftl b/platform/runtime/base/connecting/adapter/artemis-adapter/src/main/resources/template/init.ftl index 4aef063..e78e0c3 100644 --- a/platform/runtime/base/connecting/adapter/artemis-adapter/src/main/resources/template/init.ftl +++ b/platform/runtime/base/connecting/adapter/artemis-adapter/src/main/resources/template/init.ftl @@ -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)> - +[#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] - <#if connection.properties??> + [#if connection.properties??] - <#list connection.properties as key, value> + [#list connection.properties as key, value] - + [/#list] - + [/#if] @@ -47,13 +50,13 @@ - <#-- //TODO change template for property reference usage instead of text value --> + [#-- //TODO change template for property reference usage instead of text value --] - <#if connection.properties??> - <#list connection.properties?keys?filter(exceptFactoryProperties) as key> + [#if connection.properties??] + [#list connection.properties?keys?filter(exceptFactoryProperties) as key] - - + [/#list] + [/#if] -<#assign queryParameters> - <#if connection.options??> - <@compress single_line=true> - ?<#list connection.options as key, value>[=key]=[=value]<#sep>& - - - +[#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] diff --git a/platform/runtime/base/connecting/adapter/artemis-adapter/src/main/resources/template/ref.ftl b/platform/runtime/base/connecting/adapter/artemis-adapter/src/main/resources/template/ref.ftl index 805a4c7..0925da0 100644 --- a/platform/runtime/base/connecting/adapter/artemis-adapter/src/main/resources/template/ref.ftl +++ b/platform/runtime/base/connecting/adapter/artemis-adapter/src/main/resources/template/ref.ftl @@ -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~~~~~~ + +--] diff --git a/platform/runtime/base/connecting/adapter/artemis-adapter/src/main/resources/template/to.ftl b/platform/runtime/base/connecting/adapter/artemis-adapter/src/main/resources/template/to.ftl index 5784e5a..58ac7c2 100644 --- a/platform/runtime/base/connecting/adapter/artemis-adapter/src/main/resources/template/to.ftl +++ b/platform/runtime/base/connecting/adapter/artemis-adapter/src/main/resources/template/to.ftl @@ -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'] diff --git a/system/deployer/LICENSE.txt b/platform/runtime/base/connecting/adapter/artemis-amqp-adapter/LICENSE.txt similarity index 100% rename from system/deployer/LICENSE.txt rename to platform/runtime/base/connecting/adapter/artemis-amqp-adapter/LICENSE.txt diff --git a/platform/runtime/base/connecting/adapter/artemis-amqp-adapter/pom.xml b/platform/runtime/base/connecting/adapter/artemis-amqp-adapter/pom.xml new file mode 100644 index 0000000..2a0c189 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/artemis-amqp-adapter/pom.xml @@ -0,0 +1,39 @@ + + + + + ru.entaxy.esb.platform.runtime.base.connecting + adapter + 1.8.1 + + + 4.0.0 + ru.entaxy.esb.platform.runtime.base.connecting.adapter + artemis-amqp-adapter + bundle + + ENTAXY :: PLATFORM :: RUNTIME :: BASE :: CONNECTING :: ADAPTER :: ARTEMIS AMQP ADAPTER + ENTAXY :: PLATFORM :: RUNTIME :: BASE :: CONNECTING :: ADAPTER :: ARTEMIS AMQP ADAPTER + + + + * + + + + + + org.apache.felix + maven-bundle-plugin + true + + + true + + + + + + + \ No newline at end of file diff --git a/platform/runtime/base/connecting/adapter/artemis-amqp-adapter/src/main/resources/ru/entaxy/adapter/metadata.json b/platform/runtime/base/connecting/adapter/artemis-amqp-adapter/src/main/resources/ru/entaxy/adapter/metadata.json new file mode 100644 index 0000000..d9966f6 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/artemis-amqp-adapter/src/main/resources/ru/entaxy/adapter/metadata.json @@ -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": "" + } + ] + } +} diff --git a/platform/runtime/base/connecting/adapter/artemis-amqp-adapter/src/main/resources/template/from.ftl b/platform/runtime/base/connecting/adapter/artemis-amqp-adapter/src/main/resources/template/from.ftl new file mode 100644 index 0000000..f213d9f --- /dev/null +++ b/platform/runtime/base/connecting/adapter/artemis-amqp-adapter/src/main/resources/template/from.ftl @@ -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'] + diff --git a/platform/runtime/base/connecting/adapter/artemis-amqp-adapter/src/main/resources/template/init.ftl b/platform/runtime/base/connecting/adapter/artemis-amqp-adapter/src/main/resources/template/init.ftl new file mode 100644 index 0000000..88330f8 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/artemis-amqp-adapter/src/main/resources/template/init.ftl @@ -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] + + + + + [#if connection.properties??] + + [#list connection.properties as key, value] + + [/#list] + + [/#if] + + + + + + + + + + [#-- //TODO change template for property reference usage instead of text value --] + + [#if connection.properties??] + [#list connection.properties?keys?filter(exceptFactoryProperties) as key] + + [/#list] + [/#if] + + + + + + + + + diff --git a/platform/runtime/base/connecting/adapter/artemis-amqp-adapter/src/main/resources/template/queryParameters.ftl b/platform/runtime/base/connecting/adapter/artemis-amqp-adapter/src/main/resources/template/queryParameters.ftl new file mode 100644 index 0000000..0bd5124 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/artemis-amqp-adapter/src/main/resources/template/queryParameters.ftl @@ -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] + diff --git a/platform/runtime/base/connecting/adapter/artemis-amqp-adapter/src/main/resources/template/ref.ftl b/platform/runtime/base/connecting/adapter/artemis-amqp-adapter/src/main/resources/template/ref.ftl new file mode 100644 index 0000000..4aafb40 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/artemis-amqp-adapter/src/main/resources/template/ref.ftl @@ -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~~~~~~ + +--] + diff --git a/platform/runtime/base/connecting/adapter/artemis-amqp-adapter/src/main/resources/template/to.ftl b/platform/runtime/base/connecting/adapter/artemis-amqp-adapter/src/main/resources/template/to.ftl new file mode 100644 index 0000000..55adffb --- /dev/null +++ b/platform/runtime/base/connecting/adapter/artemis-amqp-adapter/src/main/resources/template/to.ftl @@ -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'] + diff --git a/platform/runtime/base/connecting/adapter/file-adapter/pom.xml b/platform/runtime/base/connecting/adapter/file-adapter/pom.xml index 51a9de5..0cf8cd7 100644 --- a/platform/runtime/base/connecting/adapter/file-adapter/pom.xml +++ b/platform/runtime/base/connecting/adapter/file-adapter/pom.xml @@ -5,7 +5,7 @@ ru.entaxy.esb.platform.runtime.base.connecting adapter - 1.8.0 + 1.8.1 4.0.0 diff --git a/platform/runtime/base/connecting/adapter/file-adapter/src/main/resources/template/from.ftl b/platform/runtime/base/connecting/adapter/file-adapter/src/main/resources/template/from.ftl index f477e33..02f4bd4 100644 --- a/platform/runtime/base/connecting/adapter/file-adapter/src/main/resources/template/from.ftl +++ b/platform/runtime/base/connecting/adapter/file-adapter/src/main/resources/template/from.ftl @@ -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'] diff --git a/platform/runtime/base/connecting/adapter/file-adapter/src/main/resources/template/init.ftl b/platform/runtime/base/connecting/adapter/file-adapter/src/main/resources/template/init.ftl index 89322de..aff7c93 100644 --- a/platform/runtime/base/connecting/adapter/file-adapter/src/main/resources/template/init.ftl +++ b/platform/runtime/base/connecting/adapter/file-adapter/src/main/resources/template/init.ftl @@ -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~~~~~~ + +--] - <#if connection.properties??> + [#if connection.properties??] - <#list connection.properties as key, value> + [#list connection.properties as key, value] - + [/#list] - + [/#if] @@ -43,11 +46,11 @@ - <#if connection.properties??> - <#list connection.properties as key, value> + [#if connection.properties??] + [#list connection.properties as key, value] - - + [/#list] + [/#if] diff --git a/platform/runtime/base/connecting/adapter/file-adapter/src/main/resources/template/queryParameters.ftl b/platform/runtime/base/connecting/adapter/file-adapter/src/main/resources/template/queryParameters.ftl index 6c462f2..e054566 100644 --- a/platform/runtime/base/connecting/adapter/file-adapter/src/main/resources/template/queryParameters.ftl +++ b/platform/runtime/base/connecting/adapter/file-adapter/src/main/resources/template/queryParameters.ftl @@ -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>& - - - +[#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] diff --git a/platform/runtime/base/connecting/adapter/file-adapter/src/main/resources/template/ref.ftl b/platform/runtime/base/connecting/adapter/file-adapter/src/main/resources/template/ref.ftl index 3904086..f28ca3e 100644 --- a/platform/runtime/base/connecting/adapter/file-adapter/src/main/resources/template/ref.ftl +++ b/platform/runtime/base/connecting/adapter/file-adapter/src/main/resources/template/ref.ftl @@ -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~~~~~~ + +--] diff --git a/platform/runtime/base/connecting/adapter/file-adapter/src/main/resources/template/to.ftl b/platform/runtime/base/connecting/adapter/file-adapter/src/main/resources/template/to.ftl index 0ecfe24..76a1139 100644 --- a/platform/runtime/base/connecting/adapter/file-adapter/src/main/resources/template/to.ftl +++ b/platform/runtime/base/connecting/adapter/file-adapter/src/main/resources/template/to.ftl @@ -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'] diff --git a/system/deployer/cellar-deployer/LICENSE.txt b/platform/runtime/base/connecting/adapter/h2-adapter/LICENSE.txt similarity index 100% rename from system/deployer/cellar-deployer/LICENSE.txt rename to platform/runtime/base/connecting/adapter/h2-adapter/LICENSE.txt diff --git a/platform/runtime/base/connecting/adapter/h2-adapter/pom.xml b/platform/runtime/base/connecting/adapter/h2-adapter/pom.xml new file mode 100644 index 0000000..8438ad6 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/h2-adapter/pom.xml @@ -0,0 +1,48 @@ + + + + + ru.entaxy.esb.platform.runtime.base.connecting + adapter + 1.8.1 + + + 4.0.0 + ru.entaxy.esb.platform.runtime.base.connecting.adapter + h2-adapter + bundle + + ENTAXY :: PLATFORM :: RUNTIME :: BASE :: CONNECTING :: ADAPTER :: H2 ADAPTER + ENTAXY :: PLATFORM :: RUNTIME :: BASE :: CONNECTING :: ADAPTER :: H2 ADAPTER + + + + * + 1.4.199 + + + + + + org.apache.felix + maven-bundle-plugin + true + + + true + + + + + + + + + + org.apache.camel + camel-jdbc + ${camel.version} + + + \ No newline at end of file diff --git a/platform/runtime/base/connecting/adapter/h2-adapter/src/main/resources/example/org.ops4j.datasource-entaxy.esb.storage.cfg b/platform/runtime/base/connecting/adapter/h2-adapter/src/main/resources/example/org.ops4j.datasource-entaxy.esb.storage.cfg new file mode 100644 index 0000000..18fdc12 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/h2-adapter/src/main/resources/example/org.ops4j.datasource-entaxy.esb.storage.cfg @@ -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 diff --git a/platform/runtime/base/connecting/adapter/h2-adapter/src/main/resources/ru/entaxy/adapter/metadata.json b/platform/runtime/base/connecting/adapter/h2-adapter/src/main/resources/ru/entaxy/adapter/metadata.json new file mode 100644 index 0000000..b287e1c --- /dev/null +++ b/platform/runtime/base/connecting/adapter/h2-adapter/src/main/resources/ru/entaxy/adapter/metadata.json @@ -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": "" + } + ] + } +} \ No newline at end of file diff --git a/platform/runtime/base/connecting/adapter/h2-adapter/src/main/resources/template/init.ftl b/platform/runtime/base/connecting/adapter/h2-adapter/src/main/resources/template/init.ftl new file mode 100644 index 0000000..0451ea0 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/h2-adapter/src/main/resources/template/init.ftl @@ -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~~~~~~ + +--] + + + + + [#if connection.properties??] + + [#list connection.properties as key, value] + + [/#list] + + [/#if] + + + + + + + + + + [#-- //TODO change template for property reference usage instead of text value --] + + [#if connection.properties??] + [#list connection.properties as key, value] + + [/#list] + [/#if] + + + + + diff --git a/platform/runtime/base/connecting/adapter/h2-adapter/src/main/resources/template/queryParameters.ftl b/platform/runtime/base/connecting/adapter/h2-adapter/src/main/resources/template/queryParameters.ftl new file mode 100644 index 0000000..a10de26 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/h2-adapter/src/main/resources/template/queryParameters.ftl @@ -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] diff --git a/platform/runtime/base/connecting/adapter/h2-adapter/src/main/resources/template/ref.ftl b/platform/runtime/base/connecting/adapter/h2-adapter/src/main/resources/template/ref.ftl new file mode 100644 index 0000000..3ddd934 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/h2-adapter/src/main/resources/template/ref.ftl @@ -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~~~~~~ + +--] + + diff --git a/platform/runtime/base/connecting/adapter/h2-adapter/src/main/resources/template/to.ftl b/platform/runtime/base/connecting/adapter/h2-adapter/src/main/resources/template/to.ftl new file mode 100644 index 0000000..7cd1fb7 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/h2-adapter/src/main/resources/template/to.ftl @@ -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'] + diff --git a/platform/runtime/base/connecting/adapter/jms-adapter/pom.xml b/platform/runtime/base/connecting/adapter/jms-adapter/pom.xml index ec5681f..3c2d802 100644 --- a/platform/runtime/base/connecting/adapter/jms-adapter/pom.xml +++ b/platform/runtime/base/connecting/adapter/jms-adapter/pom.xml @@ -5,7 +5,7 @@ ru.entaxy.esb.platform.runtime.base.connecting adapter - 1.8.0 + 1.8.1 4.0.0 diff --git a/platform/runtime/base/connecting/adapter/jms-adapter/src/main/resources/template/from.ftl b/platform/runtime/base/connecting/adapter/jms-adapter/src/main/resources/template/from.ftl index 50f279a..f39c308 100644 --- a/platform/runtime/base/connecting/adapter/jms-adapter/src/main/resources/template/from.ftl +++ b/platform/runtime/base/connecting/adapter/jms-adapter/src/main/resources/template/from.ftl @@ -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'] diff --git a/platform/runtime/base/connecting/adapter/jms-adapter/src/main/resources/template/init.ftl b/platform/runtime/base/connecting/adapter/jms-adapter/src/main/resources/template/init.ftl index 4d23e3a..8084bfb 100644 --- a/platform/runtime/base/connecting/adapter/jms-adapter/src/main/resources/template/init.ftl +++ b/platform/runtime/base/connecting/adapter/jms-adapter/src/main/resources/template/init.ftl @@ -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~~~~~~ + +--] - <#if connection.properties??> + [#if connection.properties??] - <#list connection.properties as key, value> + [#list connection.properties as key, value] - + [/#list] - + [/#if] @@ -43,13 +46,13 @@ - <#-- //TODO change template for property reference usage instead of text value --> + [#-- //TODO change template for property reference usage instead of text value --] - <#if connection.properties??> - <#list connection.properties as key, value> + [#if connection.properties??] + [#list connection.properties as key, value] - - + [/#list] + [/#if] diff --git a/platform/runtime/base/connecting/adapter/jms-adapter/src/main/resources/template/queryParameters.ftl b/platform/runtime/base/connecting/adapter/jms-adapter/src/main/resources/template/queryParameters.ftl index f5cef24..ea5bdac 100644 --- a/platform/runtime/base/connecting/adapter/jms-adapter/src/main/resources/template/queryParameters.ftl +++ b/platform/runtime/base/connecting/adapter/jms-adapter/src/main/resources/template/queryParameters.ftl @@ -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>& - - - +[#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] diff --git a/platform/runtime/base/connecting/adapter/jms-adapter/src/main/resources/template/ref.ftl b/platform/runtime/base/connecting/adapter/jms-adapter/src/main/resources/template/ref.ftl index 1e7f402..f595ae6 100644 --- a/platform/runtime/base/connecting/adapter/jms-adapter/src/main/resources/template/ref.ftl +++ b/platform/runtime/base/connecting/adapter/jms-adapter/src/main/resources/template/ref.ftl @@ -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~~~~~~ + +--] diff --git a/platform/runtime/base/connecting/adapter/jms-adapter/src/main/resources/template/to.ftl b/platform/runtime/base/connecting/adapter/jms-adapter/src/main/resources/template/to.ftl index af8b51c..fb65516 100644 --- a/platform/runtime/base/connecting/adapter/jms-adapter/src/main/resources/template/to.ftl +++ b/platform/runtime/base/connecting/adapter/jms-adapter/src/main/resources/template/to.ftl @@ -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'] diff --git a/platform/runtime/base/connecting/adapter/pom.xml b/platform/runtime/base/connecting/adapter/pom.xml index 16335b8..c31c77b 100644 --- a/platform/runtime/base/connecting/adapter/pom.xml +++ b/platform/runtime/base/connecting/adapter/pom.xml @@ -5,7 +5,7 @@ ru.entaxy.esb.platform.runtime.base connecting - 1.8.0 + 1.8.1 4.0.0 @@ -22,5 +22,9 @@ jms-adapter artemis-adapter postgresql-adapter + h2-adapter + amqp-adapter + artemis-amqp-adapter + rabbitmq-amqp-adapter \ No newline at end of file diff --git a/platform/runtime/base/connecting/adapter/postgresql-adapter/pom.xml b/platform/runtime/base/connecting/adapter/postgresql-adapter/pom.xml index 15a411f..5e1ce99 100644 --- a/platform/runtime/base/connecting/adapter/postgresql-adapter/pom.xml +++ b/platform/runtime/base/connecting/adapter/postgresql-adapter/pom.xml @@ -5,7 +5,7 @@ ru.entaxy.esb.platform.runtime.base.connecting adapter - 1.8.0 + 1.8.1 4.0.0 diff --git a/platform/runtime/base/connecting/adapter/postgresql-adapter/src/main/resources/template/init.ftl b/platform/runtime/base/connecting/adapter/postgresql-adapter/src/main/resources/template/init.ftl index db48403..3ed1818 100644 --- a/platform/runtime/base/connecting/adapter/postgresql-adapter/src/main/resources/template/init.ftl +++ b/platform/runtime/base/connecting/adapter/postgresql-adapter/src/main/resources/template/init.ftl @@ -1,22 +1,25 @@ -<#-- - ~~~~~~licensing~~~~~~ - postgresql-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~~~~~~ + postgresql-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~~~~~~ + +--] - <#if connection.properties??> + [#if connection.properties??] - <#list connection.properties as key, value> + [#list connection.properties as key, value] - + [/#list] - + [/#if] @@ -43,13 +46,13 @@ - <#-- //TODO change template for property reference usage instead of text value --> + [#-- //TODO change template for property reference usage instead of text value --] - <#if connection.properties??> - <#list connection.properties as key, value> + [#if connection.properties??] + [#list connection.properties as key, value] - - + [/#list] + [/#if] -<#assign queryParameters> - <#if connection.options??> - <@compress single_line=true> - ?<#list connection.options as key, value>[=key]=[=value]<#sep>& - - - +[#ftl] +[#-- + + ~~~~~~licensing~~~~~~ + postgresql-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] diff --git a/platform/runtime/base/connecting/adapter/postgresql-adapter/src/main/resources/template/ref.ftl b/platform/runtime/base/connecting/adapter/postgresql-adapter/src/main/resources/template/ref.ftl index c264362..c3129ed 100644 --- a/platform/runtime/base/connecting/adapter/postgresql-adapter/src/main/resources/template/ref.ftl +++ b/platform/runtime/base/connecting/adapter/postgresql-adapter/src/main/resources/template/ref.ftl @@ -1,21 +1,25 @@ -<#-- - ~~~~~~licensing~~~~~~ - postgresql-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~~~~~~ + postgresql-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~~~~~~ + +--] + diff --git a/platform/runtime/base/connecting/adapter/postgresql-adapter/src/main/resources/template/to.ftl b/platform/runtime/base/connecting/adapter/postgresql-adapter/src/main/resources/template/to.ftl index 7fb8186..1ba0dad 100644 --- a/platform/runtime/base/connecting/adapter/postgresql-adapter/src/main/resources/template/to.ftl +++ b/platform/runtime/base/connecting/adapter/postgresql-adapter/src/main/resources/template/to.ftl @@ -1,21 +1,25 @@ -<#-- - ~~~~~~licensing~~~~~~ - postgresql-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~~~~~~ + postgresql-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'] diff --git a/system/deployer/deployer-api/LICENSE.txt b/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/LICENSE.txt similarity index 100% rename from system/deployer/deployer-api/LICENSE.txt rename to platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/LICENSE.txt diff --git a/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/README.md b/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/README.md new file mode 100644 index 0000000..a0b72b6 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/README.md @@ -0,0 +1 @@ +Для корректной работы rabbitmq с amqp необходимо подключить плагин rabbitmq_amqp1_0 в rabbitmq \ No newline at end of file diff --git a/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/pom.xml b/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/pom.xml new file mode 100644 index 0000000..f7b3d14 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/pom.xml @@ -0,0 +1,39 @@ + + + + + ru.entaxy.esb.platform.runtime.base.connecting + adapter + 1.8.1 + + + 4.0.0 + ru.entaxy.esb.platform.runtime.base.connecting.adapter + rabbitmq-amqp-adapter + bundle + + ENTAXY :: PLATFORM :: RUNTIME :: BASE :: CONNECTING :: ADAPTER :: RABBITMQ AMQP ADAPTER + ENTAXY :: PLATFORM :: RUNTIME :: BASE :: CONNECTING :: ADAPTER :: RABBITMQ AMQP ADAPTER + + + + * + + + + + + org.apache.felix + maven-bundle-plugin + true + + + true + + + + + + + \ No newline at end of file diff --git a/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/src/main/resources/Dockerfile b/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/src/main/resources/Dockerfile new file mode 100644 index 0000000..8ae10ca --- /dev/null +++ b/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/src/main/resources/Dockerfile @@ -0,0 +1,2 @@ +FROM rabbitmq:3.9-management +RUN rabbitmq-plugins enable --offline rabbitmq_amqp1_0 diff --git a/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/src/main/resources/ru/entaxy/adapter/metadata.json b/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/src/main/resources/ru/entaxy/adapter/metadata.json new file mode 100644 index 0000000..379ef8c --- /dev/null +++ b/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/src/main/resources/ru/entaxy/adapter/metadata.json @@ -0,0 +1,79 @@ +{ + "adapter": { + "id": "rabbitmq.amqp.adapter.1", + "name": "rabbitmqAmqpAdapter", + "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": "" + } + ] + } +} diff --git a/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/src/main/resources/template/from.ftl b/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/src/main/resources/template/from.ftl new file mode 100644 index 0000000..00a20a3 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/src/main/resources/template/from.ftl @@ -0,0 +1,24 @@ +[#ftl attributes={"generated.type":"blueprint-node"}] +[#-- + + ~~~~~~licensing~~~~~~ + rabbitmq-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'] + diff --git a/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/src/main/resources/template/init.ftl b/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/src/main/resources/template/init.ftl new file mode 100644 index 0000000..5775243 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/src/main/resources/template/init.ftl @@ -0,0 +1,68 @@ +[#ftl attributes={"generated.type":"blueprint"}] +[#-- + + ~~~~~~licensing~~~~~~ + rabbitmq-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] + + + + + [#if connection.properties??] + + [#list connection.properties as key, value] + + [/#list] + + [/#if] + + + + + + + + + + [#-- //TODO change template for property reference usage instead of text value --] + + [#if connection.properties??] + [#list connection.properties?keys?filter(exceptFactoryProperties) as key] + + [/#list] + [/#if] + + + + + + + + + diff --git a/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/src/main/resources/template/queryParameters.ftl b/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/src/main/resources/template/queryParameters.ftl new file mode 100644 index 0000000..fc5f967 --- /dev/null +++ b/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/src/main/resources/template/queryParameters.ftl @@ -0,0 +1,30 @@ +[#ftl] +[#-- + + ~~~~~~licensing~~~~~~ + rabbitmq-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] + diff --git a/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/src/main/resources/template/ref.ftl b/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/src/main/resources/template/ref.ftl new file mode 100644 index 0000000..ac1b88b --- /dev/null +++ b/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/src/main/resources/template/ref.ftl @@ -0,0 +1,24 @@ +[#ftl attributes={"generated.type":"blueprint-node"}] +[#-- + + ~~~~~~licensing~~~~~~ + rabbitmq-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~~~~~~ + +--] + diff --git a/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/src/main/resources/template/to.ftl b/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/src/main/resources/template/to.ftl new file mode 100644 index 0000000..53d47ef --- /dev/null +++ b/platform/runtime/base/connecting/adapter/rabbitmq-amqp-adapter/src/main/resources/template/to.ftl @@ -0,0 +1,24 @@ +[#ftl attributes={"generated.type":"blueprint-node"}] +[#-- + + ~~~~~~licensing~~~~~~ + rabbitmq-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'] + diff --git a/platform/runtime/base/connecting/connection/pom.xml b/platform/runtime/base/connecting/connection/pom.xml index 1b29c7d..5f0a8f5 100644 --- a/platform/runtime/base/connecting/connection/pom.xml +++ b/platform/runtime/base/connecting/connection/pom.xml @@ -5,7 +5,7 @@ ru.entaxy.esb.platform.runtime.base connecting - 1.8.0 + 1.8.1 4.0.0 @@ -29,10 +29,5 @@ adapters-core ${project.version} - - ru.entaxy.esb.system.management.blueprint.generator - blueprint-generator - ${project.version} - \ No newline at end of file diff --git a/platform/runtime/base/connecting/connection/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/connection/util/ConnectionUtil.java b/platform/runtime/base/connecting/connection/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/connection/util/ConnectionUtil.java index 94d22ec..ca72cd6 100644 --- a/platform/runtime/base/connecting/connection/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/connection/util/ConnectionUtil.java +++ b/platform/runtime/base/connecting/connection/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/connection/util/ConnectionUtil.java @@ -19,38 +19,74 @@ */ package ru.entaxy.esb.platform.runtime.base.connecting.connection.util; +import java.util.HashMap; +import java.util.Map; + 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.util.AdapterUtil; import ru.entaxy.esb.platform.runtime.base.connecting.adapter.core.util.ConnectionUsageType; import ru.entaxy.esb.platform.runtime.base.connecting.connection.Connection; -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 class ConnectionUtil { private static final Logger log = LoggerFactory.getLogger(ConnectionUtil.class); // TODO: 09.07.2021 Artifact wrapper needed instead of Blueprint (not only blueprint can be return from generator) - public static Blueprint get(Connection connection, String usageType) throws Exception { + + public static Generated get(Connection connection, String usageType) throws Exception { Adapter adapter = AdapterUtil.getAdapter(connection.getAdapterName()); Map map = new HashMap<>(); map.put("connectionName", connection.getName()); map.put("connection", connection); return adapter.generate(usageType, map); } - public static Blueprint getInit(Connection connection) throws Exception { + public static Generated getInit(Connection connection) throws Exception { return get(connection, ConnectionUsageType.INIT); } - public static Blueprint getRef(Connection connection) throws Exception { + + public static Generated getRef(Connection connection) throws Exception { return get(connection, ConnectionUsageType.REF); } - public static Blueprint getFrom(Connection connection) throws Exception { + + public static Generated getFrom(Connection connection) throws Exception { return get(connection, ConnectionUsageType.FROM); } - public static Blueprint getTo(Connection connection) throws Exception { + + public static Generated getTo(Connection connection) throws Exception { return get(connection, ConnectionUsageType.TO); } + +/* + @Deprecated + public static Blueprint getBlueprint(Connection connection, String usageType) throws Exception { + Adapter adapter = AdapterUtil.getAdapter(connection.getAdapterName()); + Map map = new HashMap<>(); + map.put("connectionName", connection.getName()); + map.put("connection", connection); + return adapter.generateBlueprint(usageType, map); + } + @Deprecated + public static Blueprint getBlueprintInit(Connection connection) throws Exception { + return getBlueprint(connection, ConnectionUsageType.INIT); + } + + @Deprecated + public static Blueprint getBlueprintRef(Connection connection) throws Exception { + return getBlueprint(connection, ConnectionUsageType.REF); + } + + @Deprecated + public static Blueprint getBlueprintFrom(Connection connection) throws Exception { + return getBlueprint(connection, ConnectionUsageType.FROM); + } + + @Deprecated + public static Blueprint getBlueprintTo(Connection connection) throws Exception { + return getBlueprint(connection, ConnectionUsageType.TO); + } + +*/ } diff --git a/system/deployer/file-system-deployer/LICENSE.txt b/platform/runtime/base/connecting/generator/common-templates-collection/LICENSE.txt similarity index 100% rename from system/deployer/file-system-deployer/LICENSE.txt rename to platform/runtime/base/connecting/generator/common-templates-collection/LICENSE.txt diff --git a/platform/runtime/base/connecting/generator/common-templates-collection/pom.xml b/platform/runtime/base/connecting/generator/common-templates-collection/pom.xml new file mode 100644 index 0000000..fb88e28 --- /dev/null +++ b/platform/runtime/base/connecting/generator/common-templates-collection/pom.xml @@ -0,0 +1,31 @@ + + 4.0.0 + + ru.entaxy.esb.platform.runtime.base.connecting + generator + 1.8.1 + + ru.entaxy.esb.platform.runtime.base.connecting.generator + common-templates-collection + bundle + ENTAXY :: GENERATOR :: COMMON TEMPLATES + Common templates for using + + + + + org.apache.felix + maven-bundle-plugin + ${maven-bundle-plugin.version} + true + + + true + + + + + + + + \ No newline at end of file diff --git a/platform/runtime/base/connecting/generator/common-templates-collection/src/main/resources/ru/entaxy/templates/bundle.manifest.ftl b/platform/runtime/base/connecting/generator/common-templates-collection/src/main/resources/ru/entaxy/templates/bundle.manifest.ftl new file mode 100644 index 0000000..4a1d5a7 --- /dev/null +++ b/platform/runtime/base/connecting/generator/common-templates-collection/src/main/resources/ru/entaxy/templates/bundle.manifest.ftl @@ -0,0 +1,23 @@ +[#ftl attributes={"generated.type":"text"}] +[#-- + + ~~~~~~licensing~~~~~~ + common-templates-collection + ========== + 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~~~~~~ + +--] +Simple text in sample template \ No newline at end of file diff --git a/platform/runtime/base/connecting/generator/common-templates-collection/src/main/resources/ru/entaxy/templates/common.config.ftl b/platform/runtime/base/connecting/generator/common-templates-collection/src/main/resources/ru/entaxy/templates/common.config.ftl new file mode 100644 index 0000000..3e16159 --- /dev/null +++ b/platform/runtime/base/connecting/generator/common-templates-collection/src/main/resources/ru/entaxy/templates/common.config.ftl @@ -0,0 +1,33 @@ +[#ftl attributes={"generated.type":"config"}] +[#-- + + ~~~~~~licensing~~~~~~ + common-templates-collection + ========== + 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~~~~~~ + +--] +a=10 +[#if configData??] + [#list configData as key, value] + [#if comments??] + [#if comments[key]??] +#[=comments[key]] + [/#if] + [/#if] +[=key]=[#if value?is_string][=value][#else][=value?c][/#if] + [/#list] +[/#if] \ No newline at end of file diff --git a/platform/runtime/base/connecting/generator/common-templates-collection/src/main/resources/ru/entaxy/templates/metadata.json b/platform/runtime/base/connecting/generator/common-templates-collection/src/main/resources/ru/entaxy/templates/metadata.json new file mode 100644 index 0000000..33b3655 --- /dev/null +++ b/platform/runtime/base/connecting/generator/common-templates-collection/src/main/resources/ru/entaxy/templates/metadata.json @@ -0,0 +1,24 @@ +{ + "templates":[ + { + "id":"common.config", + /* by default: + "name":"{id}", + "type":"ftl", + "path":"DEFAULT_PATH" + "filename":"{id}" + "fullname":"{id}.{type}", + */ + "description":"Ftl template for *.cfg file generation on properties Map" + }, + { + "id":"bundle.manifest", + "name":"tpl_bundle.manifest", + "type":"ftl", + "path":"", + "filename":"bundle.manifest", + "fullname":"bundle.manifest.ftl", + "description":"Simple text template" + } + ] +} \ No newline at end of file diff --git a/platform/runtime/base/connecting/generator/ftl-generator/pom.xml b/platform/runtime/base/connecting/generator/ftl-generator/pom.xml index 47432f9..346a1f2 100644 --- a/platform/runtime/base/connecting/generator/ftl-generator/pom.xml +++ b/platform/runtime/base/connecting/generator/ftl-generator/pom.xml @@ -5,7 +5,7 @@ ru.entaxy.esb.platform.runtime.base.connecting generator - 1.8.0 + 1.8.1 4.0.0 @@ -20,9 +20,16 @@ ru.entaxy.esb.platform.runtime.base.connecting.generator.ftl + 2.3.29 + + org.osgi + org.osgi.service.component.annotations + 1.4.0 + compile + ru.entaxy.esb.platform.runtime.base.connecting.generator generator-api @@ -34,9 +41,38 @@ ${project.version} + org.freemarker + freemarker + ${freemarker.version} + + + + + ru.entaxy.esb.platform.runtime.base.connecting.generator + + generator-factory + ${project.version} + + + + + org.apache.felix + maven-bundle-plugin + ${maven-bundle-plugin.version} + true + + + <_dsannotations>* + + + + + + \ No newline at end of file diff --git a/platform/runtime/base/connecting/generator/ftl-generator/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/generator/ftl/FTLGenerator.java b/platform/runtime/base/connecting/generator/ftl-generator/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/generator/ftl/FTLGenerator.java index d43b8ed..cd469a5 100644 --- a/platform/runtime/base/connecting/generator/ftl-generator/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/generator/ftl/FTLGenerator.java +++ b/platform/runtime/base/connecting/generator/ftl-generator/src/main/java/ru/entaxy/esb/platform/runtime/base/connecting/generator/ftl/FTLGenerator.java @@ -19,48 +19,251 @@ */ package ru.entaxy.esb.platform.runtime.base.connecting.generator.ftl; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; -import org.osgi.framework.ServiceReference; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import ru.entaxy.esb.platform.runtime.base.connecting.generator.Generator; -import ru.entaxy.esb.system.core.template.Template; -import ru.entaxy.esb.system.management.blueprint.generator.Blueprint; -import ru.entaxy.esb.system.management.blueprint.generator.BlueprintGenerator; +import static freemarker.template.Configuration.SQUARE_BRACKET_INTERPOLATION_SYNTAX; +import static freemarker.template.Configuration.SQUARE_BRACKET_TAG_SYNTAX; +import java.io.IOException; +import java.io.StringWriter; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; import java.util.Map; -public class FTLGenerator implements Generator { +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; +import org.osgi.service.component.annotations.Activate; +import org.osgi.service.component.annotations.Component; +import org.osgi.service.component.annotations.Deactivate; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import freemarker.cache.URLTemplateLoader; +import freemarker.template.Configuration; +import freemarker.template.DefaultObjectWrapper; +import freemarker.template.Template; +import freemarker.template.TemplateException; +import ru.entaxy.base.generator.template.TemplateAwareGenerator; +import ru.entaxy.base.generator.template.TemplateImpl; +import ru.entaxy.esb.platform.runtime.base.connecting.generator.AbstractSelfPublishGenerator; +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.GeneratorService; +import ru.entaxy.esb.platform.runtime.base.connecting.generator.factory.GeneratorFactory; +import ru.entaxy.esb.system.common.exception.TemplateNotFound; + +@Component( + service = {GeneratorService.class}, + property = {GeneratorService.PROP_GENERATOR_TYPE + "=" + FTLGenerator.GENERATOR_NAME}, + immediate = true +) +public class FTLGenerator extends AbstractSelfPublishGenerator + implements Generator, TemplateAwareGenerator { + + public final static String GENERATOR_NAME = "ftl"; + private static final Logger log = LoggerFactory.getLogger(FTLGenerator.class); - private BlueprintGenerator blueprintGenerator; - private Template template; + public static final String PROP_TEMPLATE_NAME = "template.name"; + public static final String PROP_TEMPLATE_PATH = "template.path"; + + private static final String ATTR_GENERATED_TYPE = "generated.type"; + + private static final String FTL_EXTENSION = ".ftl"; + private static final String XML_EXTENSION = ".xml"; + + private static final String DEFAULT_TEMPLATE_PATH = "/template/"; + + // private BlueprintGenerator blueprintGenerator; + private ru.entaxy.base.generator.template.Template template; + @Activate + public void activate() { + GeneratorFactory.register(FTLGenerator.GENERATOR_NAME, this); + } + + @Deactivate + public void deactivate() { + GeneratorFactory.unregister(GENERATOR_NAME); + } + @Override - public Blueprint generate(Map properties) throws Exception { - Map params = (Map)properties; - log.debug("\nTemplateLocation: {}\nTemplateName: {}\nConnectionName: {}", - template.getTemplateLocation(), template.getTemplateName(), params.get("connectionName")); - Blueprint blueprint = getBlueprintGenerator().createBlueprint(template.getTemplateLocation(), - template.getTemplateName(), params.get("connectionName"), params); - // TODO: 09.07.2021 Artifact wrapper needed instead of Blueprint (not only blueprint can be return from generator) - return blueprint; + public List getSupportedTemplateTypes() { + return Arrays.asList(new String[] {"ftl"}); + } + + @Override + public Generated generate(ru.entaxy.base.generator.template.Template template, Map properties) + throws Exception { + return generateForTemplate(template, properties); + } + + @Override + public Generated generate(Map properties) throws Exception { + prepareTemplate(properties); + return generateForTemplate(template, properties); + } + + public Generated generateForTemplate(ru.entaxy.base.generator.template.Template template, + Map properties) throws Exception { + + URL templateURL = template.getTemplateLocation()==null + ?FrameworkUtil.getBundle(FTLGenerator.class).getEntry(DEFAULT_TEMPLATE_PATH) + :template.getTemplateLocation(); + return doGenerate( + templateURL, + template.getTemplateFullName(), + properties); + } - public void setTemplate(Template template) { + + protected static class Enricher { + Generated origin; + + Map properties = new HashMap<>(); + + String extraPrefix = "extra."; + + public Enricher(Generated origin) { + this.origin = origin; + } + + public Enricher cleanOrigin() { + this.origin.getProperties().clear(); + return this; + } + + public Enricher property(String name, Object value) { + properties.put(name, value); + return this; + } + + public Enricher properties(Map properties) { + this.properties.putAll(properties); + return this; + } + + public Enricher extraPrefix(String extraPrefix) { + this.extraPrefix = extraPrefix; + return this; + } + + public Enricher extra(String name, Object value) { + properties.put(extraPrefix + name, value); + return this; + } + + public Enricher extras(Map properties) { + for (Map.Entry entry: properties.entrySet()) + this.properties.put(extraPrefix + entry.getKey(), entry.getValue()); + return this; + } + + public Generated get() { + this.origin.getProperties().putAll(this.properties); + this.origin.getProperties().put("_extraPrefix", extraPrefix); + return this.origin; + } + } + + protected static Enricher enrich(Generated origin) { + return new Enricher(origin); + } + + private Generated doGenerate(URL templateUrl, String templateFullName, Map params) + throws IOException, TemplateException, TemplateNotFound { + Template temp = getTemplateByFullName(templateUrl, templateFullName); + Object value = temp.getCustomAttribute(FTLGenerator.ATTR_GENERATED_TYPE); + String type = null==value?null:value.toString(); + log.info("--TEMPLATE--\n" + templateUrl.toString() + templateFullName + "\ngenerated.type: " + (null==value?Generated.GENERATED_TYPE_UNKNOWN:value.toString())); + try (StringWriter writer = new StringWriter()) { + temp.process(params, writer); + return enrich(Generated.create(type, writer.toString())) + .properties(params) + .extraPrefix("generator.") + .extra("templateUrl", templateUrl) + .extra("templateFullName", value) + .get(); + } + } + + + protected void prepareTemplate(Map generationProperties) { + if (this.template != null) + return; + + Map finalPropertes = new HashMap<>(); + finalPropertes.putAll(initialProperties); + finalPropertes.putAll(generationProperties); + + TemplateImpl temp = new TemplateImpl(); + temp.setBundleContext( + (BundleContext)finalPropertes.getOrDefault(Generator.PROP_TARGET_BUNDLE_CONTEXT + , FrameworkUtil.getBundle(FTLGenerator.class).getBundleContext()) + ); + temp.setTemplateName((String)finalPropertes.getOrDefault(PROP_TEMPLATE_NAME + , (String)finalPropertes.getOrDefault(Generator.PROP_USAGE_TYPE + , "root"))); + temp.setPath((String)finalPropertes.getOrDefault(PROP_TEMPLATE_NAME + , DEFAULT_TEMPLATE_PATH) + ); + + temp.setTemplateFullName(temp.getTemplateFileName() + FTL_EXTENSION); + + this.template = temp; + + } + + private Generated doGenerate(URL templateUrl, String templateName, String systemName, Map params) + throws IOException, TemplateException, TemplateNotFound { + Template temp = getTemplateByName(templateUrl, templateName); + Object value = temp.getCustomAttribute(FTLGenerator.ATTR_GENERATED_TYPE); + String type = null==value?null:value.toString(); + log.info("--BLUEPRINT--\n" + templateUrl.toString() + templateName + "\ngenerated.type: " + (null==value?Generated.GENERATED_TYPE_UNKNOWN:value.toString())); + try (StringWriter writer = new StringWriter()) { + temp.process(params, writer); + return Generated.create(type, writer.toString()); + } + } + + private Template getTemplateByFullName(URL templateUrl, String templateFullName) throws IOException, TemplateNotFound { + Configuration cfg = getConfiguration(templateUrl); + return cfg.getTemplate(templateFullName); + } + + private Template getTemplateByName(URL templateUrl, String templateName) throws IOException, TemplateNotFound { + return getTemplateByFullName(templateUrl, templateName + FTL_EXTENSION); + } + + private Configuration getConfiguration(URL templateUrl) throws TemplateNotFound { + Configuration freemarkerConfig = new Configuration(); + freemarkerConfig.setObjectWrapper(new DefaultObjectWrapper()); + freemarkerConfig.setLocalizedLookup(false); + freemarkerConfig.setTemplateLoader(getURLTemplateLoader(templateUrl)); + freemarkerConfig.setInterpolationSyntax(SQUARE_BRACKET_INTERPOLATION_SYNTAX); + freemarkerConfig.setTagSyntax(SQUARE_BRACKET_TAG_SYNTAX); + return freemarkerConfig; + } + + private URLTemplateLoader getURLTemplateLoader(URL templateUrl) { + return new URLTemplateLoader() { + @Override + protected URL getURL(String templateName) { + try { + return new URL(templateUrl + templateName); + } catch (MalformedURLException e) { + log.error(e.getMessage(), e); + } + return null; + } + }; + } + + @Deprecated + public void setTemplate(ru.entaxy.base.generator.template.Template template) { this.template = template; } - public BlueprintGenerator getBlueprintGenerator() { - if (blueprintGenerator == null) { - BundleContext bundleContext = FrameworkUtil.getBundle(BlueprintGenerator.class).getBundleContext(); - ServiceReference blueprintGeneratorServiceReference = - bundleContext.getServiceReference(BlueprintGenerator.class); - blueprintGenerator = bundleContext.getService(blueprintGeneratorServiceReference); - } - return blueprintGenerator; - } - } diff --git a/platform/runtime/base/connecting/generator/generator-api/pom.xml b/platform/runtime/base/connecting/generator/generator-api/pom.xml index 9f5924b..ce49e0a 100644 --- a/platform/runtime/base/connecting/generator/generator-api/pom.xml +++ b/platform/runtime/base/connecting/generator/generator-api/pom.xml @@ -5,7 +5,7 @@ ru.entaxy.esb.platform.runtime.base.connecting generator - 1.8.0 + 1.8.1 4.0.0 @@ -18,15 +18,56 @@ + ru.entaxy.base.generator.template, ru.entaxy.esb.platform.runtime.base.connecting.generator + + ru.entaxy.base.generator.template.impl, + ru.entaxy.esb.platform.runtime.base.connecting.generator.impl + - + + + org.apache.karaf + org.apache.karaf.util + + + ru.entaxy.esb.platform.runtime.base + base-support + ${project.version} + - ru.entaxy.esb.system.management.blueprint.generator - blueprint-generator - ${project.version} + com.google.code.gson + gson - + + org.osgi + org.osgi.service.component.annotations + 1.4.0 + compile + + + ru.entaxy.esb.system.core + template + ${project.version} + + + + + + + org.apache.felix + maven-bundle-plugin + ${maven-bundle-plugin.version} + true + + + <_dsannotations>* + + + + + + \ No newline at end of file diff --git a/platform/runtime/base/connecting/generator/generator-api/src/main/java/ru/entaxy/base/generator/template/Template.java b/platform/runtime/base/connecting/generator/generator-api/src/main/java/ru/entaxy/base/generator/template/Template.java new file mode 100644 index 0000000..ee86d45 --- /dev/null +++ b/platform/runtime/base/connecting/generator/generator-api/src/main/java/ru/entaxy/base/generator/template/Template.java @@ -0,0 +1,33 @@ +/*- + * ~~~~~~licensing~~~~~~ + * generator-api + * ========== + * 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.base.generator.template; + +import java.net.URL; + +public interface Template { + + public URL getTemplateLocation(); + public String getId(); + public String getType(); + public String getTemplateName(); + public String getTemplateFileName(); + public String getTemplateFullName(); + +} diff --git a/platform/runtime/base/connecting/generator/generator-api/src/main/java/ru/entaxy/base/generator/template/TemplateAwareGenerator.java b/platform/runtime/base/connecting/generator/generator-api/src/main/java/ru/entaxy/base/generator/template/TemplateAwareGenerator.java new file mode 100644 index 0000000..ed24c04 --- /dev/null +++ b/platform/runtime/base/connecting/generator/generator-api/src/main/java/ru/entaxy/base/generator/template/TemplateAwareGenerator.java @@ -0,0 +1,32 @@ +/*- + * ~~~~~~licensing~~~~~~ + * generator-api + * ========== + * 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.base.generator.template; + +import java.util.List; +import java.util.Map; + +import ru.entaxy.esb.platform.runtime.base.connecting.generator.Generated; + +public interface TemplateAwareGenerator { + + public List getSupportedTemplateTypes(); + public Generated generate(Template template, Map properties) throws Exception; + +} diff --git a/platform/runtime/base/connecting/generator/generator-api/src/main/java/ru/entaxy/base/generator/template/TemplateImpl.java b/platform/runtime/base/connecting/generator/generator-api/src/main/java/ru/entaxy/base/generator/template/TemplateImpl.java new file mode 100644 index 0000000..0396a93 --- /dev/null +++ b/platform/runtime/base/connecting/generator/generator-api/src/main/java/ru/entaxy/base/generator/template/TemplateImpl.java @@ -0,0 +1,124 @@ +/*- + * ~~~~~~licensing~~~~~~ + * generator-api + * ========== + * 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.base.generator.template; + +import java.net.MalformedURLException; +import java.net.URL; + +import org.osgi.framework.BundleContext; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import ru.entaxy.base.generator.template.impl.ProvidedTemplate; +import ru.entaxy.platform.base.support.CommonUtils; + +public class TemplateImpl implements Template { + + private static final Logger log = LoggerFactory.getLogger(TemplateImpl.class); + + protected BundleContext bundleContext; + + protected String id; + protected String name; + protected String filename; + protected String fullname; + protected String type; + protected String path; + protected String description; + + protected String templateLocation; + + public void load(ProvidedTemplate providedTemplate) { + id = providedTemplate.getId(); + name = providedTemplate.getName(); + filename = providedTemplate.getFilename(); + fullname = providedTemplate.getFullname(); + type = providedTemplate.getType(); + path = providedTemplate.getPath(); + if (!path.endsWith("/")) + path += "/"; + description = providedTemplate.getDescription(); + } + + @Override + public URL getTemplateLocation() { + if (CommonUtils.isValid(templateLocation)) + try { + return new URL(templateLocation); + } catch (MalformedURLException e) { + log.warn("Invalid template location: [" + templateLocation + "]", e); + } + return this.bundleContext.getBundle().getEntry(path); + } + + @Override + public String getTemplateFileName() { + return !CommonUtils.isValid(filename) ? name : filename; + } + + @Override + public String getTemplateFullName() { + return CommonUtils.getValid(fullname, getTemplateFileName() + "." + type); + }; + + @Override + public String getType() { + return type; + } + + @Override + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public void setType(String type) { + this.type = type; + } + + public void setTemplateFullName(String fullname) { + this.fullname = fullname; + } + + public void setTemplateLocation(String templateLocation) { + this.templateLocation = templateLocation; + } + + public void setPath(String path) { + this.path = path; + } + + @Override + public String getTemplateName() { + return name; + } + + public void setTemplateName(String name) { + this.name = name; + } + + public void setBundleContext(BundleContext bundleContext) { + this.bundleContext = bundleContext; + } + +} diff --git a/platform/runtime/base/connecting/generator/generator-api/src/main/java/ru/entaxy/base/generator/template/TemplateService.java b/platform/runtime/base/connecting/generator/generator-api/src/main/java/ru/entaxy/base/generator/template/TemplateService.java new file mode 100644 index 0000000..80377e4 --- /dev/null +++ b/platform/runtime/base/connecting/generator/generator-api/src/main/java/ru/entaxy/base/generator/template/TemplateService.java @@ -0,0 +1,36 @@ +/*- + * ~~~~~~licensing~~~~~~ + * generator-api + * ========== + * 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.base.generator.template; + +import java.util.List; + +public interface TemplateService { + + public static final String TEMPLATE_PROVIDER_HEADER = "Entaxy-Template-Provider"; + + public static final String PROP_ID = "template.id"; + public static final String PROP_TYPE = "template.type"; + public static final String PROP_NAME = "template.name"; + public static final String PROP_DESCRIPTION = "template.description"; + + public List