ENTAXY-480 release version 1.8.3

This commit is contained in:
2023-08-03 04:44:09 +03:00
parent 603889d627
commit 5844a2e5cf
2546 changed files with 11242 additions and 207556 deletions

View File

@ -1,13 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>ru.entaxy.esb.platform.runtime.core</groupId>
<artifactId>management</artifactId>
<version>1.8.2.2</version>
<version>1.8.3</version>
</parent>
<groupId>ru.entaxy.esb.platform.runtime.core.management</groupId>
@ -64,6 +62,11 @@
<artifactId>system-api</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>ru.entaxy.esb.platform.runtime.base.objects-base</groupId>
<artifactId>objects-core</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -55,7 +55,16 @@ public interface ConnectorMBean extends BundleAwareMBean, RuntimeTypedMBean {
@Attribute(desc = "Connector registered name used in registry")
public String getRegisteredName();
@Attribute(desc = "Connector system")
public String getSystem();
@Attribute(desc = "Connector classifier")
public String getClassifier();
@Attribute(desc = "Connector direction")
public String getDirection();
@Operation(desc = "Starts the connector")
public void start() throws Exception;

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -20,9 +20,10 @@
package ru.entaxy.esb.platform.core.management.profile;
import ru.entaxy.esb.platform.base.management.core.Qualifier;
import ru.entaxy.esb.platform.base.management.core.api.RuntimeTypedMBean;
import ru.entaxy.esb.platform.base.management.core.api.*;
import ru.entaxy.esb.platform.base.management.core.utils.BundleAwareMBean;
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATION_ENRICH)
public interface DefaultRouteMBean extends BundleAwareMBean, RuntimeTypedMBean {
public static interface Helper {
@ -41,5 +42,8 @@ public interface DefaultRouteMBean extends BundleAwareMBean, RuntimeTypedMBean {
public static final String ROUTE_KEY_VALUE_DEFAULT = "default";
public boolean isDefault();
@Operation(desc = "Gets route's configuration")
public String doGetRouteConfig() throws Exception;
}

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -80,7 +80,11 @@ public interface ProfileMBean extends BundleAwareMBean, RuntimeTypedMBean {
@Operation(desc = "Stops connector in profile")
public void stopConnector(
@Parameter(name = "connectorName", desc = "Connector name") String connectorName) throws Exception;
@Operation(desc = "Gets connector's configuration")
public String getConnectorConfig(
@Parameter(name = "connectorName", desc = "Connector name") String connectorName) throws Exception;
@Operation(desc = "Creates account for this system", impact = MBeanOperationInfo.ACTION)
public void createAccount(
@Parameter(name = "login", desc = "Login") String login

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -29,7 +29,10 @@ public interface ProfileManager {
@Parameter(desc = "Profile ID", name = "id") String id,
@Parameter(desc = "System name", name = "name") String name,
@Parameter(desc = "Description", name = "description") String description) throws Exception;
@Operation(desc = "Get profile configuration")
public String getProfileConfig(@Parameter(desc = "Profile ID or system name", name = "idOrName") String idOrName) throws Exception;
@Operation(desc = "Start profile")
public void startProfile(@Parameter(desc = "Profile ID or system name", name = "idOrName") String idOrName) throws Exception;

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -69,6 +69,11 @@ public class ProfileHelperImpl implements ProfileHelper {
public void createProfile(String id, String name, String description) throws Exception {
throw new OperationNotSupportedException(EXPLANATION);
}
@Override
public String getProfileConfig(String idOrName) throws Exception {
throw new OperationNotSupportedException(EXPLANATION);
}
};
}
@ -101,6 +106,11 @@ public class ProfileHelperImpl implements ProfileHelper {
getEffectiveProfileManager().createProfile(id, name, description);
}
@Override
public String getProfileConfig(String idOrName) throws Exception {
return getEffectiveProfileManager().getProfileConfig(idOrName);
}
@Override
public void startProfile(String idOrName) throws Exception {
getEffectiveProfileManager().startProfile(idOrName);

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -110,6 +110,11 @@ public class ProfileMBeanImpl extends BundleAwareMBeanImpl<ManagedProfile, Profi
this.helpers.connectorHelper.stopConnector(getName(), connectorName);
}
@Override
public String getConnectorConfig(String connectorName) throws Exception {
return helpers.entaxyObjectService.findObject(connectorName, "entaxy.runtime.connector").getConfiguration();
}
@Override
public List<String> getAllowedTargets() {
try {

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -113,7 +113,7 @@ public class ProfilesMBeanImpl extends AnnotatedMBean<ProfilesMBean>
routeTracker = BundleTrackerUtils.<List<ManagedRoute>>createBuilder()
.customizer(
(new DeployedDefaultRouteCustomizer())
.listener(new ManagedRoutesListener(bundleContext))
.listener(new ManagedRoutesListener(bundleContext, helpers))
)
.addFilter(
(new BundleCapabilityFilter()).namespace(DefaultRouteMBean.CAPABILITY_NAMESPACE)
@ -153,6 +153,11 @@ public class ProfilesMBeanImpl extends AnnotatedMBean<ProfilesMBean>
this.helpers.profileHelper.createProfile(id, name, description);
}
@Override
public String getProfileConfig(String idOrName) throws Exception {
return this.helpers.entaxyObjectService.findObject(idOrName, "entaxy.runtime.profile").getConfiguration();
}
@Override
public void startProfile(String idOrName) throws Exception {
this.helpers.profileHelper.startProfile(idOrName);

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -55,7 +55,22 @@ public class ConnectorMBeanImpl extends BundleAwareMBeanImpl<ManagedConnector, C
public String getRegisteredName() {
return this.managedObject.getRegisteredName();
}
@Override
public String getSystem() {
return this.managedObject.getSystem();
}
@Override
public String getClassifier() {
return this.managedObject.getClassifier();
}
@Override
public String getDirection() {
return this.managedObject.getDirection();
}
@Override
public void start() throws Exception {
this.helpers.connectorHelper.startConnector(this.managedObject.getSystem(), this.getRegisteredName());

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -52,17 +52,28 @@ public class DeployedConnectorCustomizer extends ExtendedBundleTrackerCustomizer
continue;
val = capability.getAttributes().get("templateId");
String templateId = val==null?"":val.toString();
String factoryId = val==null?"":val.toString();
val = capability.getAttributes().get("factory");
factoryId = val==null?factoryId:val.toString();
val = capability.getAttributes().get("bundleName");
String registeredName = val==null?"":val.toString();
val = capability.getAttributes().get("classifier");
String classifier = val==null?"":val.toString();
val = capability.getAttributes().get("direction");
String direction = val==null?"":val.toString();
ManagedConnector mc = (new ManagedConnector())
.name(name)
.system(system)
.factoryId(templateId)
.registeredName(registeredName);
.factoryId(factoryId)
.registeredName(registeredName)
.classifier(classifier)
.direction(direction);
enrich(bundle, event, filterResults, mc);
result.add(mc);
}

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -30,7 +30,11 @@ public class ManagedConnector extends BundleAwareManagedObjectImpl {
protected String registeredName;
protected String factoryId;
protected String classifier;
protected String direction;
public String getName() {
return name;
}
@ -82,4 +86,30 @@ public class ManagedConnector extends BundleAwareManagedObjectImpl {
this.setRegisteredName(registeredNameValue);
return this;
};
public String getClassifier() {
return classifier;
}
public void setClassifier(String classifier) {
this.classifier = classifier;
}
public ManagedConnector classifier(String classifierValue) {
this.setClassifier(classifierValue);
return this;
}
public String getDirection() {
return direction;
}
public void setDirection(String direction) {
this.direction = direction;
}
public ManagedConnector direction(String directionValue) {
this.setDirection(directionValue);
return this;
}
}

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -28,6 +28,7 @@ import ru.entaxy.esb.platform.core.management.profile.impl.connector.ConnectorHe
import ru.entaxy.esb.platform.core.management.profile.impl.permission.PermissionHelper;
import ru.entaxy.esb.system.auth.basic.jpa.api.BasicAuthService;
import ru.entaxy.esb.system.jpa.SystemService;
import ru.entaxy.platform.base.objects.EntaxyObjectService;
@Component (service = Helpers.class, immediate = true)
public class Helpers {
@ -46,4 +47,7 @@ public class Helpers {
@Reference (cardinality = ReferenceCardinality.MANDATORY)
public PermissionHelper permissionHelper;
@Reference (cardinality = ReferenceCardinality.MANDATORY)
public EntaxyObjectService entaxyObjectService;
}

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,21 +26,28 @@ import org.osgi.framework.BundleContext;
import ru.entaxy.esb.platform.base.management.core.api.EntaxyRuntimeTyped;
import ru.entaxy.esb.platform.base.management.core.utils.BundleAwareMBeanImpl;
import ru.entaxy.esb.platform.core.management.profile.DefaultRouteMBean;
import ru.entaxy.esb.platform.core.management.profile.impl.helper.Helpers;
//@TODO move string to constant
@EntaxyRuntimeTyped(name = "entaxy.runtime.default-route")
public class DefaultRouteMBeanImpl extends BundleAwareMBeanImpl<ManagedRoute, DefaultRouteMBean> implements DefaultRouteMBean {
public DefaultRouteMBeanImpl(BundleContext bundleContext, ManagedRoute managedRoute) throws NotCompliantMBeanException {
Helpers helpers;
public DefaultRouteMBeanImpl(BundleContext bundleContext, ManagedRoute managedRoute, Helpers helpers) throws NotCompliantMBeanException {
super(DefaultRouteMBean.class, managedRoute);
this.bundleContext = bundleContext;
this.managedObject = managedRoute;
this.helpers = helpers;
}
@Override
public boolean isDefault() {
return this.managedObject.isDefault();
}
@Override
public String doGetRouteConfig() throws Exception {
return this.helpers.entaxyObjectService.findObject(managedObject.getName(), "entaxy.runtime.default-route").getConfiguration();
}
}

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -41,12 +41,17 @@ public class DeployedDefaultRouteCustomizer extends ExtendedBundleTrackerCustomi
capabilities = new ArrayList<>();
List<ManagedRoute> result = new ArrayList<>();
for (BundleCapability capability: capabilities) {
Object val = capability.getAttributes().get("name");
Object val = capability.getAttributes().get("objectId"); // fixme this is temporary solution
String name = val==null?"":val.toString();
if (!CommonUtils.isValid(name))
continue;
val = capability.getAttributes().get("system");
String profile = val==null?"":val.toString();
if (!CommonUtils.isValid(profile))
continue;
ManagedRoute mr = (new ManagedRoute())
.name(name)
.profile(profile)
.defaultRoute(true);
enrich(bundle, event, filterResults, mr);
result.add(mr);

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,7 +26,9 @@ public class ManagedRoute extends BundleAwareManagedObjectImpl {
protected boolean isDefault;
protected String name;
protected String profile;
public boolean isDefault() {
return isDefault;
}
@ -52,5 +54,17 @@ public class ManagedRoute extends BundleAwareManagedObjectImpl {
setName(name);
return this;
}
public String getProfile() {
return profile;
}
public void setProfile(String profile) {
this.profile = profile;
}
public ManagedRoute profile(String profile) {
setProfile(profile);
return this;
}
}

View File

@ -2,7 +2,7 @@
* ~~~~~~licensing~~~~~~
* profile-management
* ==========
* Copyright (C) 2020 - 2021 EmDev LLC
* Copyright (C) 2020 - 2023 EmDev LLC
* ==========
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -28,13 +28,17 @@ import org.slf4j.LoggerFactory;
import ru.entaxy.esb.platform.base.management.core.utils.ManagedObjectsListener;
import ru.entaxy.esb.platform.core.management.profile.DefaultRouteMBean;
import ru.entaxy.esb.platform.core.management.profile.impl.helper.Helpers;
public class ManagedRoutesListener extends ManagedObjectsListener<List<ManagedRoute>, ManagedRoute, DefaultRouteMBean, DefaultRouteMBeanImpl> {
private static final Logger log = LoggerFactory.getLogger(ManagedRoutesListener.class);
public ManagedRoutesListener(BundleContext bundleContext) {
protected Helpers helpers;
public ManagedRoutesListener(BundleContext bundleContext, Helpers helpers) {
super(bundleContext, DefaultRouteMBean.class);
this.helpers = helpers;
}
@Override
@ -51,7 +55,7 @@ public class ManagedRoutesListener extends ManagedObjectsListener<List<ManagedRo
@Override
protected DefaultRouteMBeanImpl createService(ManagedRoute managedObject) {
try {
return new DefaultRouteMBeanImpl(bundleContext, managedObject);
return new DefaultRouteMBeanImpl(bundleContext, managedObject, helpers);
} catch (Exception e) {
log.error("Error creating service", e);
return null;
@ -60,7 +64,7 @@ public class ManagedRoutesListener extends ManagedObjectsListener<List<ManagedRo
@Override
protected String getJmxObjectName(ManagedRoute managedObject) {
return DefaultRouteMBean.Helper.getQualifier(managedObject.getName()).getValue();
return DefaultRouteMBean.Helper.getQualifier(managedObject.getProfile()).getValue();
}
}