initial public commit
This commit is contained in:
201
system/system-management/bridge-profile-manager/LICENSE.txt
Normal file
201
system/system-management/bridge-profile-manager/LICENSE.txt
Normal file
@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
126
system/system-management/bridge-profile-manager/pom.xml
Normal file
126
system/system-management/bridge-profile-manager/pom.xml
Normal file
@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>ru.entaxy.esb.system</groupId>
|
||||
<artifactId>management</artifactId>
|
||||
<version>1.8.0</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>ru.entaxy.esb.system.management.bridge.profile.manager</groupId>
|
||||
<artifactId>bridge-profile-manager</artifactId>
|
||||
<packaging>bundle</packaging>
|
||||
|
||||
<name>SYSTEM :: ENTAXY :: SYSTEM :: MANAGEMENT :: BRIDGE :: PROFILE :: MANAGER</name>
|
||||
<description>SYSTEM :: ENTAXY :: SYSTEM :: MANAGEMENT :: BRIDGE :: PROFILE :: MANAGER</description>
|
||||
|
||||
<properties>
|
||||
<bundle.osgi.export.pkg>
|
||||
ru.entaxy.esb.system.management.bridge.profile.manager.service,
|
||||
ru.entaxy.esb.system.management.bridge.profile.manager.*
|
||||
</bundle.osgi.export.pkg>
|
||||
<bundle.osgi.import.pkg>
|
||||
!com.sun.org.apache.xml.internal.dtm.ref,
|
||||
!org.mapstruct.*,
|
||||
!com.google.gson,
|
||||
ru.entaxy.esb.system.management.bundle.manager,
|
||||
ru.entaxy.esb.system.management.bundle.jpa,
|
||||
ru.entaxy.esb.system.management.bundle.jpa.entity,
|
||||
ru.entaxy.esb.system.management.bundle.jpa.dto,
|
||||
ru.entaxy.esb.system.core.template,
|
||||
ru.entaxy.esb.system.jpa,
|
||||
ru.entaxy.esb.system.profile.commons,
|
||||
ru.entaxy.esb.system.profile.commons.connectors,
|
||||
ru.entaxy.esb.system.core.dispatcher,
|
||||
org.apache.commons.logging,
|
||||
org.osgi.service.blueprint;version="[1.0.0,2.0.0)",
|
||||
*
|
||||
</bundle.osgi.import.pkg>
|
||||
<bundle.osgi.embed.dependency>
|
||||
gson
|
||||
</bundle.osgi.embed.dependency>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>javax.interceptor</groupId>
|
||||
<artifactId>javax.interceptor-api</artifactId>
|
||||
<version>${javax.interceptor.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.system.registry.systems</groupId>
|
||||
<artifactId>system-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.system.registry.profile.commons</groupId>
|
||||
<artifactId>profile-commons</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.system.core</groupId>
|
||||
<artifactId>template</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.system.registry.connector</groupId>
|
||||
<artifactId>connector-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.system.management.bundle.jpa</groupId>
|
||||
<artifactId>bundle-service</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct</artifactId>
|
||||
<version>${mapstruct.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-processor</artifactId>
|
||||
<version>${mapstruct.version}</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.system.management.bundle.manager</groupId>
|
||||
<artifactId>bundle-manager</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>${gson.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.camel</groupId>
|
||||
<artifactId>camel-core</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.5.1</version>
|
||||
<configuration>
|
||||
<source>1.8</source>
|
||||
<target>1.8</target>
|
||||
<annotationProcessorPaths>
|
||||
<path>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-processor</artifactId>
|
||||
<version>${mapstruct.version}</version>
|
||||
</path>
|
||||
</annotationProcessorPaths>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
@ -0,0 +1,43 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* bridge-profile-manager
|
||||
* ==========
|
||||
* 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.system.management.bridge.profile.manager;
|
||||
|
||||
import ru.entaxy.esb.system.management.bridge.profile.manager.dto.BridgeProfileDto;
|
||||
import ru.entaxy.esb.system.management.bridge.profile.manager.sender.BridgeProfileType;
|
||||
import ru.entaxy.esb.system.management.bundle.jpa.dto.BundleDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BridgeProfileManager {
|
||||
|
||||
BundleDto installBridgeProfile(BridgeProfileDto bridgeProfileDto) throws Exception;
|
||||
|
||||
BundleDto startBridgeProfile(BridgeProfileDto bridgeProfileDto) throws Exception;
|
||||
|
||||
BundleDto stopBridgeProfile(BridgeProfileDto bridgeProfileDto) throws Exception;
|
||||
|
||||
BridgeProfileType getBridgeProfile(BridgeProfileDto bridgeProfileDto) throws Exception;
|
||||
|
||||
List<BridgeProfileType> getBridgeProfiles() throws Exception;
|
||||
|
||||
BundleDto uninstallBridgeProfile(BridgeProfileDto bridgeProfileDto) throws Exception;
|
||||
|
||||
List<String> getListEsb() throws Exception;
|
||||
}
|
@ -0,0 +1,136 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* bridge-profile-manager
|
||||
* ==========
|
||||
* 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.system.management.bridge.profile.manager;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import ru.entaxy.esb.system.common.exception.EsbNotFound;
|
||||
import ru.entaxy.esb.system.jpa.SystemService;
|
||||
import ru.entaxy.esb.system.jpa.entity.System;
|
||||
import ru.entaxy.esb.system.management.bridge.profile.manager.dto.BridgeProfileDto;
|
||||
import ru.entaxy.esb.system.management.bridge.profile.manager.mapper.BridgeProfileMapper;
|
||||
import ru.entaxy.esb.system.management.bridge.profile.manager.sender.BridgeProfileSender;
|
||||
import ru.entaxy.esb.system.management.bridge.profile.manager.sender.BridgeProfileType;
|
||||
import ru.entaxy.esb.system.management.bridge.profile.manager.service.BridgeService;
|
||||
import ru.entaxy.esb.system.management.bundle.jpa.dto.BundleDto;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class BridgeProfileManagerImpl implements BridgeProfileManager {
|
||||
|
||||
private static final Gson gson = new Gson();
|
||||
|
||||
private BridgeProfileSender bridgeProfileSender;
|
||||
private SystemService systemService;
|
||||
private BridgeProfileMapper bridgeProfileMapper;
|
||||
private BridgeService bridgeService;
|
||||
|
||||
@Override
|
||||
public BundleDto installBridgeProfile(BridgeProfileDto bridgeProfileDto) throws Exception {
|
||||
System system = systemService.getByUuid(bridgeProfileDto.getProfileUuid());
|
||||
systemService.addExportAllowed(system, bridgeProfileDto.getEsbName());
|
||||
BundleDto bundleDto;
|
||||
try {
|
||||
checkOnConnectEsbBridge(bridgeProfileDto.getEsbName());
|
||||
bundleDto = gson.fromJson(sendOnOtherEsb(system, bridgeProfileDto.getEsbName(),
|
||||
"create"), BundleDto.class);
|
||||
} catch (Exception ex) {
|
||||
systemService.removeExportAllowed(system, bridgeProfileDto.getEsbName());
|
||||
throw ex;
|
||||
}
|
||||
return bundleDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BundleDto startBridgeProfile(BridgeProfileDto bridgeProfileDto) throws Exception {
|
||||
System system = systemService.getByUuid(bridgeProfileDto.getProfileUuid());
|
||||
checkOnConnectEsbBridge(bridgeProfileDto.getEsbName());
|
||||
systemService.addExportAllowed(system, bridgeProfileDto.getEsbName());
|
||||
BundleDto bundleDto = gson.fromJson(sendOnOtherEsb(system, bridgeProfileDto.getEsbName(),
|
||||
"start"), BundleDto.class);
|
||||
return bundleDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BundleDto stopBridgeProfile(BridgeProfileDto bridgeProfileDto) throws Exception {
|
||||
System system = systemService.getByUuid(bridgeProfileDto.getProfileUuid());
|
||||
checkOnConnectEsbBridge(bridgeProfileDto.getEsbName());
|
||||
systemService.addExportAllowed(system, bridgeProfileDto.getEsbName());
|
||||
BundleDto bundleDto = gson.fromJson(sendOnOtherEsb(system, bridgeProfileDto.getEsbName(),
|
||||
"stop"), BundleDto.class);
|
||||
return bundleDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BridgeProfileType getBridgeProfile(BridgeProfileDto request) throws Exception {
|
||||
System system = systemService.getByUuid(request.getProfileUuid());
|
||||
checkOnConnectEsbBridge(request.getEsbName());
|
||||
systemService.addExportAllowed(system, request.getEsbName());
|
||||
BridgeProfileType response = gson.fromJson(sendOnOtherEsb(system, request.getEsbName(),
|
||||
"get"), BridgeProfileType.class);
|
||||
return response;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BridgeProfileType> getBridgeProfiles() throws Exception {
|
||||
return bridgeProfileMapper.toBridgeProfileTypes(systemService.getFullSystemListByNotOrigin());
|
||||
}
|
||||
|
||||
@Override
|
||||
public BundleDto uninstallBridgeProfile(BridgeProfileDto bridgeProfileDto) throws Exception {
|
||||
System system = systemService.getByUuid(bridgeProfileDto.getProfileUuid());
|
||||
checkOnConnectEsbBridge(bridgeProfileDto.getEsbName());
|
||||
systemService.removeExportAllowed(system, bridgeProfileDto.getEsbName());
|
||||
BundleDto bundleDto = gson.fromJson(sendOnOtherEsb(system, bridgeProfileDto.getEsbName(),
|
||||
"uninstall"), BundleDto.class);
|
||||
return bundleDto;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getListEsb() throws Exception {
|
||||
return bridgeService.getEsbList();
|
||||
}
|
||||
|
||||
private String sendOnOtherEsb(System system, String exportAllowed, String command) {
|
||||
return bridgeProfileSender.sendOnOtherEsb(bridgeProfileMapper.toBridgeProfileType(system),
|
||||
exportAllowed, command);
|
||||
}
|
||||
|
||||
public void checkOnConnectEsbBridge(String esbName) {
|
||||
if (!bridgeService.getEsbList().contains(esbName)) {
|
||||
throw new EsbNotFound("ESB not found {" + esbName + "}");
|
||||
}
|
||||
}
|
||||
|
||||
public void setSystemService(SystemService systemService) {
|
||||
this.systemService = systemService;
|
||||
}
|
||||
|
||||
public void setBridgeProfileMapper(BridgeProfileMapper bridgeProfileMapper) {
|
||||
this.bridgeProfileMapper = bridgeProfileMapper;
|
||||
}
|
||||
|
||||
public void setBridgeService(BridgeService bridgeService) {
|
||||
this.bridgeService = bridgeService;
|
||||
}
|
||||
|
||||
public void setBridgeProfileSender(BridgeProfileSender bridgeProfileSender) {
|
||||
this.bridgeProfileSender = bridgeProfileSender;
|
||||
}
|
||||
}
|
@ -0,0 +1,69 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* bridge-profile-manager
|
||||
* ==========
|
||||
* 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.system.management.bridge.profile.manager.dto;
|
||||
|
||||
public class BridgeProfileDto {
|
||||
|
||||
private String profileUuid;
|
||||
private String esbName;
|
||||
private String status;
|
||||
private String origin;
|
||||
private String createdBy;
|
||||
|
||||
public String getProfileUuid() {
|
||||
return profileUuid;
|
||||
}
|
||||
|
||||
public void setProfileUuid(String profileUuid) {
|
||||
this.profileUuid = profileUuid;
|
||||
}
|
||||
|
||||
public String getEsbName() {
|
||||
return esbName;
|
||||
}
|
||||
|
||||
public void setEsbName(String esbName) {
|
||||
this.esbName = esbName;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getOrigin() {
|
||||
return origin;
|
||||
}
|
||||
|
||||
public void setOrigin(String origin) {
|
||||
this.origin = origin;
|
||||
}
|
||||
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
}
|
@ -0,0 +1,61 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* bridge-profile-manager
|
||||
* ==========
|
||||
* 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.system.management.bridge.profile.manager.mapper;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.Mappings;
|
||||
import ru.entaxy.esb.system.jpa.entity.System;
|
||||
import ru.entaxy.esb.system.management.bridge.profile.manager.sender.BridgeProfileType;
|
||||
import ru.entaxy.esb.system.management.bundle.jpa.dto.BundleDto;
|
||||
import ru.entaxy.esb.system.management.bundle.jpa.entity.BundleEntity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface BridgeProfileMapper {
|
||||
|
||||
@Mappings({
|
||||
@Mapping(source = "bundleName", target = "name"),
|
||||
@Mapping(source = "bundleUrl", target = "url"),
|
||||
})
|
||||
BundleEntity toBundleEntity(BundleDto bundle);
|
||||
|
||||
@Mappings({
|
||||
@Mapping(target = "bundleName", source = "name"),
|
||||
@Mapping(target = "bundleUrl", source = "url"),
|
||||
})
|
||||
BundleDto toBundleDto(BundleEntity bundle);
|
||||
|
||||
@Mappings({
|
||||
@Mapping(source = "name", target = "profileName"),
|
||||
@Mapping(source = "bundleEntity.status", target = "status"),
|
||||
})
|
||||
BridgeProfileType toBridgeProfileType(System system);
|
||||
|
||||
@Mappings({
|
||||
@Mapping(source = "profileName", target = "name"),
|
||||
@Mapping(target = "createDate", expression = "java(new java.util.Date())"),
|
||||
@Mapping(source = "status", target = "bundleEntity.status"),
|
||||
})
|
||||
System toSystemEntity(BridgeProfileType bridgeProfileType);
|
||||
|
||||
List<BridgeProfileType> toBridgeProfileTypes(List<System> systemList);
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* bridge-profile-manager
|
||||
* ==========
|
||||
* 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.system.management.bridge.profile.manager.recipient;
|
||||
|
||||
public interface BridgeProfileRecipientManager {
|
||||
|
||||
String installBridgeProfile(String json, String origin) throws Exception;
|
||||
|
||||
String startBridgeProfile(String json, String origin) throws Exception;
|
||||
|
||||
String stopBridgeProfile(String json, String origin) throws Exception;
|
||||
|
||||
String getBridgeProfile(String json, String origin) throws Exception;
|
||||
|
||||
String uninstallBridgeProfile(String json, String origin) throws Exception;
|
||||
|
||||
void restore() throws Exception;
|
||||
}
|
@ -0,0 +1,152 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* bridge-profile-manager
|
||||
* ==========
|
||||
* 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.system.management.bridge.profile.manager.recipient;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import ru.entaxy.esb.system.jpa.SystemService;
|
||||
import ru.entaxy.esb.system.jpa.entity.System;
|
||||
import ru.entaxy.esb.system.management.bridge.profile.manager.mapper.BridgeProfileMapper;
|
||||
import ru.entaxy.esb.system.management.bridge.profile.manager.sender.BridgeProfileType;
|
||||
import ru.entaxy.esb.system.management.bundle.jpa.dto.BundleDto;
|
||||
import ru.entaxy.esb.system.management.bundle.jpa.dto.BundleStatus;
|
||||
import ru.entaxy.esb.system.management.bundle.manager.BundleManager;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class BridgeProfileRecipientManagerImpl implements BridgeProfileRecipientManager {
|
||||
|
||||
private static final Log LOG = LogFactory.getLog(BridgeProfileRecipientManagerImpl.class);
|
||||
|
||||
private static final String BRIDGE_PROFILE = "bridge-profile";
|
||||
private static final String ORIGIN = "origin";
|
||||
private static final Gson gson = new Gson();
|
||||
|
||||
private boolean isRestoreFromDB;
|
||||
|
||||
private BundleManager bundleManager;
|
||||
private SystemService systemService;
|
||||
private BridgeProfileMapper bridgeProfileMapper;
|
||||
|
||||
@Override
|
||||
public String installBridgeProfile(String json, String origin) throws Exception {
|
||||
System system = createSystem(gson.fromJson(json, BridgeProfileType.class), origin);
|
||||
BundleDto bundle = bundleManager.installAndStartBundle(system.getName(), BRIDGE_PROFILE,
|
||||
String.valueOf(system.getVersion()), getParam(origin));
|
||||
systemService.setBundleEntity(system, bridgeProfileMapper.toBundleEntity(bundle));
|
||||
return gson.toJson(bundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String startBridgeProfile(String json, String origin) throws Exception {
|
||||
BridgeProfileType bridgeProfileType = gson.fromJson(json, BridgeProfileType.class);
|
||||
System system = systemService.getByUuid(bridgeProfileType.getUuid());
|
||||
BundleDto bundle = bundleManager.startBundle(bridgeProfileMapper.toBundleDto(system.getBundleEntity()));
|
||||
systemService.setBundleEntity(system, bridgeProfileMapper.toBundleEntity(bundle));
|
||||
return gson.toJson(bundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String stopBridgeProfile(String json, String origin) throws Exception {
|
||||
BridgeProfileType bridgeProfileType = gson.fromJson(json, BridgeProfileType.class);
|
||||
System system = systemService.getByUuid(bridgeProfileType.getUuid());
|
||||
BundleDto bundle = bundleManager.stopBundle(bridgeProfileMapper.toBundleDto(system.getBundleEntity()));
|
||||
systemService.setBundleEntity(system, bridgeProfileMapper.toBundleEntity(bundle));
|
||||
return gson.toJson(bundle);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getBridgeProfile(String json, String origin) throws Exception {
|
||||
BridgeProfileType bridgeProfileType = gson.fromJson(json, BridgeProfileType.class);
|
||||
System system = systemService.getByUuid(bridgeProfileType.getUuid());
|
||||
return gson.toJson(bridgeProfileMapper.toBridgeProfileType(system));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String uninstallBridgeProfile(String json, String origin) throws Exception {
|
||||
BridgeProfileType bridgeProfileType = gson.fromJson(json, BridgeProfileType.class);
|
||||
System system = systemService.getByUuid(bridgeProfileType.getUuid());
|
||||
bundleManager.uninstallBundle(system.getName(), BRIDGE_PROFILE,
|
||||
String.valueOf(system.getVersion()));
|
||||
systemService.remove(system);
|
||||
return gson.toJson(new BundleDto(system.getName(), BundleStatus.UNINSTALL));
|
||||
}
|
||||
|
||||
private HashMap<String, String> getParam(String origin) {
|
||||
HashMap<String, String> param = new HashMap<>();
|
||||
param.put(ORIGIN, origin);
|
||||
return param;
|
||||
}
|
||||
|
||||
private System createSystem(BridgeProfileType bridgeProfileType, String origin) {
|
||||
System system = bridgeProfileMapper.toSystemEntity(bridgeProfileType);
|
||||
system.setOrigin(origin);
|
||||
system.setBundleEntity(null);
|
||||
return systemService.create(system);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void restore() throws Exception {
|
||||
if (!isRestoreFromDB)
|
||||
return;
|
||||
for (System system : systemService.getSystemList()) {
|
||||
if (system.getOrigin() != null && !system.getOrigin().isEmpty()) {
|
||||
try {
|
||||
LOG.info("Restore bridge profile of system " + system.getName());
|
||||
bundleManager.restore(bridgeProfileMapper.toBundleDto(system.getBundleEntity()));
|
||||
} catch (IOException e) {
|
||||
LOG.warn("Recreate bridge profile of system " + system.getName());
|
||||
restoreProfile(system);
|
||||
}
|
||||
} else {
|
||||
LOG.info("No bridge brofile founded in system");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void restoreProfile(System system) throws Exception {
|
||||
BundleDto bundle = bundleManager.installBundle(system.getName(), BRIDGE_PROFILE,
|
||||
String.valueOf(system.getVersion()), getParam(system.getOrigin()));
|
||||
|
||||
bundle.setStatus(bridgeProfileMapper.toBundleDto(system.getBundleEntity()).getStatus());
|
||||
|
||||
bundleManager.checkCurrentBundleStatus(bundle);
|
||||
|
||||
systemService.setBundleEntity(system, bridgeProfileMapper.toBundleEntity(bundle));
|
||||
}
|
||||
|
||||
public void setBundleManager(BundleManager bundleManager) {
|
||||
this.bundleManager = bundleManager;
|
||||
}
|
||||
|
||||
public void setSystemService(SystemService systemService) {
|
||||
this.systemService = systemService;
|
||||
}
|
||||
|
||||
public void setBridgeProfileMapper(BridgeProfileMapper bridgeProfileMapper) {
|
||||
this.bridgeProfileMapper = bridgeProfileMapper;
|
||||
}
|
||||
|
||||
public void setIsRestoreFromDB(String isRestoreFromDB) {
|
||||
this.isRestoreFromDB = Boolean.parseBoolean(isRestoreFromDB);
|
||||
}
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* bridge-profile-manager
|
||||
* ==========
|
||||
* 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.system.management.bridge.profile.manager.sender;
|
||||
|
||||
public interface BridgeProfileSender {
|
||||
|
||||
String sendOnOtherEsb(BridgeProfileType bridgeProfileType, String esbName, String command);
|
||||
}
|
@ -0,0 +1,63 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* bridge-profile-manager
|
||||
* ==========
|
||||
* 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.system.management.bridge.profile.manager.sender;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import org.apache.camel.CamelContext;
|
||||
import org.apache.camel.Exchange;
|
||||
import org.apache.camel.ProducerTemplate;
|
||||
import org.apache.camel.builder.ExchangeBuilder;
|
||||
|
||||
public class BridgeProfileSenderImpl implements BridgeProfileSender {
|
||||
|
||||
private static final String HEADER_BRIDGE_NAME = "NTX_Bridge";
|
||||
private static final String HEADER_COMMAND = "NTX_CommandBridgeProfileManager";
|
||||
private static final String HEADER_DESTINATION_SYSTEM = "NTX_DestinationQueueAfterBridge";
|
||||
|
||||
private static final Gson gson = new Gson();
|
||||
|
||||
private CamelContext context;
|
||||
|
||||
@Override
|
||||
public String sendOnOtherEsb(BridgeProfileType bridgeProfileType, String esbName, String command) {
|
||||
Exchange exchange = ExchangeBuilder.anExchange(context)
|
||||
.withHeader(HEADER_DESTINATION_SYSTEM, "profile-controller-route")
|
||||
.withHeader(HEADER_BRIDGE_NAME, esbName)
|
||||
.withHeader(HEADER_COMMAND, command)
|
||||
.withBody(gson.toJson(bridgeProfileType))
|
||||
.build();
|
||||
|
||||
ProducerTemplate template = exchange.getContext().createProducerTemplate();
|
||||
template.send("direct-vm:send-message", exchange);
|
||||
|
||||
return exchange.getOut() != null && exchange.getOut().getBody() != null ?
|
||||
exchange.getOut().getBody().toString() : null;
|
||||
}
|
||||
|
||||
public CamelContext getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(CamelContext context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,116 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* bridge-profile-manager
|
||||
* ==========
|
||||
* 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.system.management.bridge.profile.manager.sender;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class BridgeProfileType implements Serializable {
|
||||
|
||||
private String uuid;
|
||||
private String profileName;
|
||||
private String status;
|
||||
private String description;
|
||||
private String version;
|
||||
private String createdBy;
|
||||
private String createdDate;
|
||||
private String editedBy;
|
||||
private String editedDate;
|
||||
private String origin;
|
||||
|
||||
public String getProfileName() {
|
||||
return profileName;
|
||||
}
|
||||
|
||||
public void setProfileName(String profileName) {
|
||||
this.profileName = profileName;
|
||||
}
|
||||
|
||||
public String getUuid() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
public void setUuid(String uuid) {
|
||||
this.uuid = uuid;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getCreatedBy() {
|
||||
return createdBy;
|
||||
}
|
||||
|
||||
public void setCreatedBy(String createdBy) {
|
||||
this.createdBy = createdBy;
|
||||
}
|
||||
|
||||
public String getCreatedDate() {
|
||||
return createdDate;
|
||||
}
|
||||
|
||||
public void setCreatedDate(String createdDate) {
|
||||
this.createdDate = createdDate;
|
||||
}
|
||||
|
||||
public String getEditedBy() {
|
||||
return editedBy;
|
||||
}
|
||||
|
||||
public void setEditedBy(String editedBy) {
|
||||
this.editedBy = editedBy;
|
||||
}
|
||||
|
||||
public String getEditedDate() {
|
||||
return editedDate;
|
||||
}
|
||||
|
||||
public void setEditedDate(String editedDate) {
|
||||
this.editedDate = editedDate;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public String getOrigin() {
|
||||
return origin;
|
||||
}
|
||||
|
||||
public void setOrigin(String origin) {
|
||||
this.origin = origin;
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* bridge-profile-manager
|
||||
* ==========
|
||||
* 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.system.management.bridge.profile.manager.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface BridgeService {
|
||||
|
||||
List<String> getEsbList();
|
||||
}
|
@ -0,0 +1,122 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
~~~~~~licensing~~~~~~
|
||||
bridge-profile-manager
|
||||
==========
|
||||
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~~~~~~
|
||||
-->
|
||||
|
||||
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.1.0"
|
||||
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0 https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
|
||||
|
||||
<cm:property-placeholder persistent-id="ru.entaxy.esb" update-strategy="reload">
|
||||
<cm:default-properties>
|
||||
<cm:property name="is.restore.from.db" value="true"/>
|
||||
</cm:default-properties>
|
||||
</cm:property-placeholder>
|
||||
|
||||
<reference id="pooledConnectionFactory" interface="javax.jms.ConnectionFactory"/>
|
||||
<bean id="jms" class="org.apache.camel.component.jms.JmsComponent">
|
||||
<property name="connectionFactory" ref="pooledConnectionFactory"/>
|
||||
</bean>
|
||||
|
||||
<bean id="bridgeProfileManager"
|
||||
class="ru.entaxy.esb.system.management.bridge.profile.manager.BridgeProfileManagerImpl">
|
||||
<property name="systemService" ref="systemService"/>
|
||||
<property name="bridgeService" ref="bridgeService"/>
|
||||
<property name="bridgeProfileMapper" ref="bridgeProfileMapper"/>
|
||||
<property name="bridgeProfileSender" ref="bridgeProfileSender"/>
|
||||
</bean>
|
||||
|
||||
<bean id="bridgeProfileRecipientManager"
|
||||
class="ru.entaxy.esb.system.management.bridge.profile.manager.recipient.BridgeProfileRecipientManagerImpl"
|
||||
init-method="restore">
|
||||
<property name="isRestoreFromDB" value="${is.restore.from.db}"/>
|
||||
|
||||
<property name="systemService" ref="systemService"/>
|
||||
<property name="bundleManager" ref="bundleManager"/>
|
||||
<property name="bridgeProfileMapper" ref="bridgeProfileMapper"/>
|
||||
</bean>
|
||||
|
||||
<service ref="bridgeProfileManager"
|
||||
interface="ru.entaxy.esb.system.management.bridge.profile.manager.BridgeProfileManager"/>
|
||||
|
||||
<bean id="bridgeProfileMapper"
|
||||
class="ru.entaxy.esb.system.management.bridge.profile.manager.mapper.BridgeProfileMapperImpl"/>
|
||||
|
||||
<bean id="bridgeProfileSender"
|
||||
class="ru.entaxy.esb.system.management.bridge.profile.manager.sender.BridgeProfileSenderImpl">
|
||||
<property name="context" ref="system-management-service"/>
|
||||
</bean>
|
||||
|
||||
<reference id="bridgeService" interface="ru.entaxy.esb.system.management.bridge.profile.manager.service.BridgeService"
|
||||
timeout="30000"
|
||||
availability="optional"/>
|
||||
|
||||
<reference id="systemService"
|
||||
interface="ru.entaxy.esb.system.jpa.SystemService"
|
||||
timeout="30000"
|
||||
availability="mandatory"/>
|
||||
|
||||
<reference id="bundleManager"
|
||||
interface="ru.entaxy.esb.system.management.bundle.manager.BundleManager"
|
||||
timeout="30000"
|
||||
availability="mandatory"/>
|
||||
|
||||
<camelContext id="system-management-service" xmlns="http://camel.apache.org/schema/blueprint">
|
||||
|
||||
<route id="direct-profile-controller-route">
|
||||
<from uri="direct-vm:send-message"/>
|
||||
<setHeader name="NTX_ExchangePattern">
|
||||
<simple>InOut</simple>
|
||||
</setHeader>
|
||||
<toD uri="jms:queue:entaxy.local.out.${headers.NTX_Bridge}?exchangePattern=InOut"/>
|
||||
</route>
|
||||
|
||||
<route id="profile-controller-route">
|
||||
<from uri="jms:queue:entaxy.profile.controller.route"/>
|
||||
<choice>
|
||||
<when>
|
||||
<simple>${headers.NTX_CommandBridgeProfileManager} == "create"</simple>
|
||||
<to uri="bean:bridgeProfileRecipientManager?
|
||||
method=installBridgeProfile(${body}, ${headers.NTX_Origin})"/>
|
||||
</when>
|
||||
<when>
|
||||
<simple>${headers.NTX_CommandBridgeProfileManager} == "start"</simple>
|
||||
<to uri="bean:bridgeProfileRecipientManager?
|
||||
method=startBridgeProfile(${body}, ${headers.NTX_Origin})"/>
|
||||
</when>
|
||||
<when>
|
||||
<simple>${headers.NTX_CommandBridgeProfileManager} == "stop"</simple>
|
||||
<to uri="bean:bridgeProfileRecipientManager?
|
||||
method=stopBridgeProfile(${body}, ${headers.NTX_Origin})"/>
|
||||
</when>
|
||||
<when>
|
||||
<simple>${headers.NTX_CommandBridgeProfileManager} == "uninstall"</simple>
|
||||
<to uri="bean:bridgeProfileRecipientManager?
|
||||
method=uninstallBridgeProfile(${body})"/>
|
||||
</when>
|
||||
<when>
|
||||
<simple>${headers.NTX_CommandBridgeProfileManager} == "get"</simple>
|
||||
<to uri="bean:bridgeProfileRecipientManager?
|
||||
method=getBridgeProfile(${body})"/>
|
||||
</when>
|
||||
</choice>
|
||||
</route>
|
||||
</camelContext>
|
||||
</blueprint>
|
Reference in New Issue
Block a user