release version 1.10.0
This commit is contained in:
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.core</groupId>
|
||||
<artifactId>management</artifactId>
|
||||
<version>1.9.0</version>
|
||||
<version>1.10.0</version>
|
||||
</parent>
|
||||
|
||||
<groupId>ru.entaxy.esb.platform.runtime.core.management</groupId>
|
||||
@ -17,18 +17,22 @@
|
||||
|
||||
<properties>
|
||||
<bundle.osgi.export.pkg>
|
||||
ru.entaxy.esb.platform.core.management.profile,
|
||||
ru.entaxy.esb.platform.core.management.profile.api
|
||||
ru.entaxy.platform.core.management.profile,
|
||||
ru.entaxy.platform.core.management.profile.support.legacy
|
||||
</bundle.osgi.export.pkg>
|
||||
<bundle.osgi.private.pkg>
|
||||
ru.entaxy.esb.platform.base.management.core.utils,
|
||||
ru.entaxy.platform.base.support.osgi.tracker,
|
||||
ru.entaxy.platform.base.support.osgi.tracker.filter,
|
||||
ru.entaxy.esb.platform.core.management.profile.impl*
|
||||
ru.entaxy.platform.core.management.profile.impl*,
|
||||
ru.entaxy.platform.core.management.profile.support*,
|
||||
ru.entaxy.esb.platform.core.management.profile.helper.*
|
||||
</bundle.osgi.private.pkg>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.core.management</groupId>
|
||||
<artifactId>object-management</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.osgi</groupId>
|
||||
<artifactId>org.osgi.service.component.annotations</artifactId>
|
||||
@ -52,16 +56,13 @@
|
||||
<artifactId>management-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.system.auth.basic.api</groupId>
|
||||
<artifactId>basic-auth-api</artifactId>
|
||||
<version>${project.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.platform.runtime.base.objects-base</groupId>
|
||||
<artifactId>objects-core</artifactId>
|
||||
|
@ -1,83 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Attribute;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Operation;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.RuntimeTypedMBean;
|
||||
import ru.entaxy.esb.platform.base.management.core.utils.BundleAwareMBean;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATION_ENRICH)
|
||||
public interface ConnectorMBean extends BundleAwareMBean, RuntimeTypedMBean {
|
||||
|
||||
public static interface Helper {
|
||||
|
||||
public static Qualifier getQualifier(String profileName, String connectorName) {
|
||||
return ConnectorsMBean.Helper.getQualifier(profileName).qualifier(CONNECTOR_KEY, connectorName);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final String CAPABILITY_NAMESPACE = "entaxy.runtime.connector";
|
||||
|
||||
public static final String CONNECTOR_KEY = "connector";
|
||||
|
||||
public static final String CONNECTOR_KEY_VALUE_DEFAULT = "default";
|
||||
|
||||
// TODO implement if needed
|
||||
// public boolean isDefault();
|
||||
|
||||
@Attribute(desc = "Factory ID used to create the connector")
|
||||
public String getFactoryId();
|
||||
|
||||
@Attribute(desc = "Connector name")
|
||||
public String getName();
|
||||
|
||||
@Attribute(desc = "Connector registered name used in registry")
|
||||
public String getRegisteredName();
|
||||
|
||||
@Attribute(desc = "Connector system")
|
||||
public String getSystem();
|
||||
|
||||
@Attribute(desc = "Connector classifier")
|
||||
public String getClassifier();
|
||||
|
||||
@Attribute(desc = "Connector display name")
|
||||
public String getDisplayName();
|
||||
|
||||
@Attribute(desc = "Connector direction")
|
||||
public String getDirection();
|
||||
|
||||
@Operation(desc = "Starts the connector")
|
||||
public void start() throws Exception;
|
||||
|
||||
@Operation(desc = "Stops the connector")
|
||||
public void stop() throws Exception;
|
||||
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
|
||||
public interface ConnectorsMBean {
|
||||
public static interface Helper {
|
||||
public static Qualifier getQualifier(String profileName) {
|
||||
return ProfileMBean.Helper
|
||||
.getQualifier(profileName)
|
||||
.qualifier(CONNECTORS_KEY, CONNECTORS_KEY_VALUE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final String CONNECTORS_KEY = "section";
|
||||
public static final String CONNECTORS_KEY_VALUE = "connectors";
|
||||
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
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 {
|
||||
|
||||
public static Qualifier getQualifier(String profileName) {
|
||||
return RoutesMBean.Helper.getQualifier(profileName).qualifier(ROUTE_KEY, ROUTE_KEY_VALUE_DEFAULT);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static final String CAPABILITY_NAMESPACE = "entaxy.runtime.default-route";
|
||||
|
||||
public static final String ROUTE_KEY = "route";
|
||||
|
||||
public static final String ROUTE_KEY_VALUE_DEFAULT = "default";
|
||||
|
||||
public boolean isDefault();
|
||||
|
||||
@Operation(desc = "Gets route's configuration")
|
||||
public String doGetRouteConfig() throws Exception;
|
||||
|
||||
}
|
@ -1,109 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.management.MBeanOperationInfo;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Attribute;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Operation;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Parameter;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.RuntimeTypedMBean;
|
||||
import ru.entaxy.esb.platform.base.management.core.utils.BundleAwareMBean;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATION_ENRICH)
|
||||
public interface ProfileMBean extends BundleAwareMBean, RuntimeTypedMBean {
|
||||
|
||||
public static interface Helper {
|
||||
|
||||
public static Qualifier getQualifier(String name) {
|
||||
return ProfilesMBean.Q_PROFILES.qualifier(PROFILE_KEY, name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final String CAPABILITY_NAMESPACE = "entaxy.runtime.profile";
|
||||
|
||||
public static final String PROFILE_KEY = "profile";
|
||||
|
||||
@Attribute
|
||||
public String getName();
|
||||
|
||||
@Attribute
|
||||
public String getDescription();
|
||||
|
||||
@Attribute
|
||||
public String getBasicAuthAccount();
|
||||
|
||||
@Attribute
|
||||
public String getUuid();
|
||||
|
||||
@Attribute(desc = "Systems the current can send messages to")
|
||||
public List<String> getAllowedTargets();
|
||||
|
||||
@Attribute(desc = "Systems the current can receive messages from")
|
||||
public List<String> getAllowedSources();
|
||||
|
||||
|
||||
@Operation(desc = "Adds connector to profile")
|
||||
public void addConnector(
|
||||
@Parameter(name = "factoryId", desc = "Connector factory ID") String connectorFactoryId
|
||||
, @Parameter(name = "parameters", desc = "Connector parameters") Map<String, String> parameters) throws Exception;
|
||||
|
||||
@Operation(desc = "Removes connector from profile")
|
||||
public void removeConnector(
|
||||
@Parameter(name = "connectorName", desc = "Connector name") String connectorName) throws Exception;
|
||||
|
||||
@Operation(desc = "Starts connector in profile")
|
||||
public void startConnector(
|
||||
@Parameter(name = "connectorName", desc = "Connector name") String connectorName) throws Exception;
|
||||
|
||||
@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
|
||||
, @Parameter(name = "password", desc = "Password") String password) throws Exception;
|
||||
|
||||
@Operation(desc = "Allow this system to send messages to other system")
|
||||
public void allowTarget(
|
||||
@Parameter(name="targetIdOrName", desc = "Target system Id or Name")String idOrName) throws Exception;
|
||||
|
||||
@Operation(desc = "Allow this system to receive messages from other system")
|
||||
public void allowSource(
|
||||
@Parameter(name="sourceIdOrName", desc = "Source system Id or Name")String idOrName) throws Exception;
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.ManagementCore;
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanAnnotated;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.MBeanExportPolicy;
|
||||
import ru.entaxy.esb.platform.core.management.profile.api.ProfileManager;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATION_ENRICH)
|
||||
public interface ProfilesMBean extends ProfileManager {
|
||||
|
||||
public static final String CAPABILITY_NAMESPACE_DEFAULT_ROUTE = "entaxy.runtime.default-route";
|
||||
|
||||
public static final String PROFILES_KEY = "category";
|
||||
|
||||
public static final String PROFILES_KEY_VALUE = "profiles";
|
||||
|
||||
public static final Qualifier Q_PROFILES = ManagementCore.Q_RUNTIME
|
||||
.qualifier(ProfilesMBean.PROFILES_KEY, ProfilesMBean.PROFILES_KEY_VALUE);
|
||||
|
||||
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.Qualifier;
|
||||
|
||||
public interface RoutesMBean {
|
||||
|
||||
public static interface Helper {
|
||||
public static Qualifier getQualifier(String profileName) {
|
||||
return ProfileMBean.Helper
|
||||
.getQualifier(profileName)
|
||||
.qualifier(ROUTES_KEY, ROUTES_KEY_VALUE);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final String ROUTES_KEY = "section";
|
||||
public static final String ROUTES_KEY_VALUE = "routes";
|
||||
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile.api;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface ConnectorManager {
|
||||
|
||||
public void addConnector(String idOrName, String connectorFactoryId, Map<String, String> parameters) throws Exception;
|
||||
|
||||
public void removeConnector(String idOrName, String connectorName) throws Exception;
|
||||
|
||||
public void startConnector(String idOrName, String connectorName) throws Exception;
|
||||
|
||||
public void stopConnector(String idOrName, String connectorName) throws Exception;
|
||||
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile.api;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface PermissionManager {
|
||||
|
||||
public List<String> getObjectPermissions(String objectId) throws Exception;
|
||||
|
||||
public List<String> getSubjectPermissions(String subjectId) throws Exception;
|
||||
|
||||
public void createPermission(String objectId, String subjectId) throws Exception;
|
||||
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile.api;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Operation;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Parameter;
|
||||
|
||||
public interface ProfileManager {
|
||||
|
||||
@Operation(desc = "Create and deploy new profile")
|
||||
public void createProfile(
|
||||
@Parameter(desc = "Profile ID", name = "id") String id,
|
||||
@Parameter(desc = "System name", name = "name") String name,
|
||||
@Parameter(desc = "Description", name = "description") String description) throws Exception;
|
||||
|
||||
@Operation(desc = "Get profile configuration")
|
||||
public String getProfileConfig(@Parameter(desc = "Profile ID or system name", name = "idOrName") String idOrName) throws Exception;
|
||||
|
||||
@Operation(desc = "Start profile")
|
||||
public void startProfile(@Parameter(desc = "Profile ID or system name", name = "idOrName") String idOrName) throws Exception;
|
||||
|
||||
@Operation(desc = "Stop profile")
|
||||
public void stopProfile(@Parameter(desc = "Profile ID or system name", name = "idOrName") String idOrName) throws Exception;
|
||||
|
||||
@Operation(desc = "Uninstall profile")
|
||||
public void uninstallProfile(@Parameter(desc = "Profile ID or system name", name = "idOrName") String idOrName) throws Exception;
|
||||
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile.impl;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleEvent;
|
||||
import org.osgi.framework.wiring.BundleCapability;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.utils.ExtendedBundleTrackerCustomizer;
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
import ru.entaxy.platform.base.support.osgi.tracker.filter.BundleCapabilityFilter;
|
||||
|
||||
public class DeployedProfileCustomizer extends ExtendedBundleTrackerCustomizer<List<ManagedProfile>> {
|
||||
|
||||
@Override
|
||||
protected List<ManagedProfile> createManagedObject(Bundle bundle, BundleEvent event,
|
||||
Map<String, List<?>> filterResults) {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<BundleCapability> capabilities = (List<BundleCapability>)filterResults.get(BundleCapabilityFilter.DEFAULT_FILTER_ID);
|
||||
if (capabilities==null)
|
||||
capabilities = new ArrayList<>();
|
||||
List<ManagedProfile> result = new ArrayList<>();
|
||||
for (BundleCapability capability: capabilities) {
|
||||
Object val = capability.getAttributes().get("name");
|
||||
String name = val==null?"":val.toString();
|
||||
if (!CommonUtils.isValid(name))
|
||||
continue;
|
||||
|
||||
val = capability.getAttributes().get("desc");
|
||||
String desc;
|
||||
try {
|
||||
desc = val==null?"":new String(val.toString().getBytes(StandardCharsets.ISO_8859_1), "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
desc = val==null?"":val.toString();
|
||||
}
|
||||
|
||||
|
||||
ManagedProfile mp = (new ManagedProfile())
|
||||
.name(name)
|
||||
.description(desc);
|
||||
enrich(bundle, event, filterResults, mp);
|
||||
result.add(mp);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile.impl;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.utils.BundleAwareManagedObjectImpl;
|
||||
|
||||
public class ManagedProfile extends BundleAwareManagedObjectImpl {
|
||||
|
||||
protected String name;
|
||||
|
||||
protected String description;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public ManagedProfile name(String name) {
|
||||
setName(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ManagedProfile description(String desc) {
|
||||
setDescription(desc);
|
||||
return this;
|
||||
}
|
||||
|
||||
}
|
@ -1,114 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile.impl;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.FrameworkUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.utils.ManagedObjectsListener;
|
||||
import ru.entaxy.esb.platform.core.management.profile.ProfileMBean;
|
||||
import ru.entaxy.esb.platform.core.management.profile.impl.helper.Helpers;
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
import ru.entaxy.platform.base.support.osgi.bundle.BundleCapabilityHelper;
|
||||
import ru.entaxy.platform.base.support.osgi.bundle.CapabilityDescriptor;
|
||||
|
||||
public class ManagedProfilesListener extends ManagedObjectsListener<List<ManagedProfile>
|
||||
, ManagedProfile, ProfileMBean, ProfileMBeanImpl> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ManagedProfilesListener.class);
|
||||
|
||||
protected Helpers helpers;
|
||||
|
||||
public ManagedProfilesListener(BundleContext bundleContext, Helpers helpers) {
|
||||
super(bundleContext, ProfileMBean.class);
|
||||
this.helpers = helpers;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterator<ManagedProfile> getIterator(List<ManagedProfile> managedObject) {
|
||||
return managedObject.iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getKeyValue(ManagedProfile object) {
|
||||
return object.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ProfileMBeanImpl createService(ManagedProfile managedObject) {
|
||||
try {
|
||||
return new ProfileMBeanImpl(bundleContext, managedObject, helpers);
|
||||
} catch (Exception e) {
|
||||
log.error("Error creating service", e);
|
||||
return null;
|
||||
} }
|
||||
|
||||
@Override
|
||||
protected String getJmxObjectName(ManagedProfile managedObject) {
|
||||
return ProfileMBean.Helper.getQualifier(managedObject.getName()).getValue();
|
||||
}
|
||||
|
||||
// TODO add method to refresh objects to parent class
|
||||
@Override
|
||||
public void modified(List<ManagedProfile> managedObject) {
|
||||
super.modified(managedObject);
|
||||
for (ManagedProfile mp: managedObject) {
|
||||
updateManagedProfile(mp);
|
||||
}
|
||||
}
|
||||
|
||||
protected void updateManagedProfile(ManagedProfile managedObject) {
|
||||
BundleCapabilityHelper helper = new BundleCapabilityHelper(bundleContext.getBundle(managedObject.getBundleId()));
|
||||
List<CapabilityDescriptor> capabilities = helper.getProvidedCapabilities(ProfileMBean.CAPABILITY_NAMESPACE);
|
||||
if (capabilities.isEmpty())
|
||||
return;
|
||||
|
||||
CapabilityDescriptor capability = capabilities.get(0);
|
||||
|
||||
Object val = capability.getAttributes().get("name");
|
||||
String name = val==null?"":val.toString();
|
||||
if (!CommonUtils.isValid(name))
|
||||
return;
|
||||
|
||||
val = capability.getAttributes().get("desc");
|
||||
String desc;
|
||||
try {
|
||||
desc = val==null?"":new String(val.toString().getBytes(StandardCharsets.ISO_8859_1), "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
desc = val==null?"":val.toString();
|
||||
}
|
||||
|
||||
managedObject.name(name).description(desc);
|
||||
}
|
||||
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile.impl;
|
||||
|
||||
import ru.entaxy.esb.platform.core.management.profile.api.ProfileManager;
|
||||
|
||||
public interface ProfileHelper extends ProfileManager {
|
||||
|
||||
}
|
@ -1,135 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile.impl;
|
||||
|
||||
import javax.naming.OperationNotSupportedException;
|
||||
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.CollectionType;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.service.component.annotations.ReferencePolicyOption;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.esb.platform.core.management.profile.api.ProfileManager;
|
||||
|
||||
@Component(service = {ProfileHelper.class},
|
||||
immediate = true)
|
||||
public class ProfileHelperImpl implements ProfileHelper {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ProfileHelperImpl.class);
|
||||
|
||||
protected static final String EXPLANATION = "ProfileManager not bound";
|
||||
|
||||
protected ProfileManager profileManager = null;
|
||||
|
||||
protected ProfileManager nullProfileManager = null;
|
||||
|
||||
@Activate
|
||||
public void activate(ComponentContext componentContext) {
|
||||
|
||||
this.nullProfileManager = new ProfileManager() {
|
||||
|
||||
@Override
|
||||
public void uninstallProfile(String idOrName) throws Exception {
|
||||
throw new OperationNotSupportedException(EXPLANATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopProfile(String idOrName) throws Exception {
|
||||
throw new OperationNotSupportedException(EXPLANATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startProfile(String idOrName) throws Exception {
|
||||
throw new OperationNotSupportedException(EXPLANATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
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);
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public ProfileManager getEffectiveProfileManager() {
|
||||
return profileManager!=null?profileManager:nullProfileManager;
|
||||
}
|
||||
|
||||
@Reference (collectionType = CollectionType.SERVICE
|
||||
, cardinality = ReferenceCardinality.OPTIONAL
|
||||
, policyOption = ReferencePolicyOption.GREEDY
|
||||
, service = ProfileManager.class
|
||||
, unbind = "unsetProfileManager")
|
||||
public void setProfileManager(ProfileManager profileManager) {
|
||||
this.profileManager = profileManager;
|
||||
log.debug(">> ProfileManager is bound");
|
||||
}
|
||||
|
||||
public void unsetProfileManager(ProfileManager profileManager) {
|
||||
this.profileManager = null;
|
||||
log.debug(">> ProfileManager is unbound");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void createProfile(String id, String name, String description) throws Exception {
|
||||
getEffectiveProfileManager().createProfile(id, name, description);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProfileConfig(String idOrName) throws Exception {
|
||||
return getEffectiveProfileManager().getProfileConfig(idOrName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startProfile(String idOrName) throws Exception {
|
||||
getEffectiveProfileManager().startProfile(idOrName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopProfile(String idOrName) throws Exception {
|
||||
getEffectiveProfileManager().stopProfile(idOrName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstallProfile(String idOrName) throws Exception {
|
||||
getEffectiveProfileManager().uninstallProfile(idOrName);
|
||||
}
|
||||
|
||||
}
|
@ -1,160 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
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.ProfileMBean;
|
||||
import ru.entaxy.esb.platform.core.management.profile.impl.helper.Helpers;
|
||||
import ru.entaxy.esb.system.auth.basic.jpa.api.entity.BasicAuthAccount;
|
||||
import ru.entaxy.esb.system.jpa.entity.System;
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
|
||||
// @TODO move string to constant
|
||||
@EntaxyRuntimeTyped(name = "entaxy.runtime.profile")
|
||||
public class ProfileMBeanImpl extends BundleAwareMBeanImpl<ManagedProfile, ProfileMBean> implements ProfileMBean {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ProfileMBeanImpl.class);
|
||||
|
||||
Helpers helpers;
|
||||
|
||||
public ProfileMBeanImpl(BundleContext bundleContext, ManagedProfile managedProfile
|
||||
, Helpers helpers)
|
||||
throws NotCompliantMBeanException {
|
||||
super(ProfileMBean.class, managedProfile);
|
||||
this.bundleContext = bundleContext;
|
||||
this.helpers = helpers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return managedObject.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return managedObject.getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUuid() {
|
||||
System system = helpers.systemService.getByName(getName());
|
||||
if (system == null)
|
||||
return "N/A";
|
||||
return system.getUuid();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String getBasicAuthAccount() {
|
||||
Optional<BasicAuthAccount> bas = this.helpers.basicAuthService.getBySystem(getUuid());
|
||||
if (bas.isPresent())
|
||||
return bas.get().getLogin();
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createAccount(String login, String password) throws Exception {
|
||||
if (CommonUtils.isValid(getBasicAuthAccount()))
|
||||
throw new IllegalArgumentException("Account already exists");
|
||||
// FIXME remove hardcoded
|
||||
this.helpers.basicAuthService.saveCommon(login
|
||||
, password
|
||||
, getUuid()
|
||||
, "admin"
|
||||
, "admin");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConnector(String connectorFactoryId, Map<String, String> parameters) throws Exception {
|
||||
this.helpers.connectorHelper.addConnector(getName(), connectorFactoryId, parameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeConnector(String connectorName) throws Exception {
|
||||
this.helpers.connectorHelper.removeConnector(getName(), connectorName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startConnector(String connectorName) throws Exception {
|
||||
this.helpers.connectorHelper.startConnector(getName(), connectorName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopConnector(String connectorName) throws Exception {
|
||||
this.helpers.connectorHelper.stopConnector(getName(), connectorName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getConnectorConfig(String connectorName) throws Exception {
|
||||
return helpers.entaxyObjectService.findObject(connectorName, "entaxy.runtime.connector").getConfiguration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAllowedTargets() {
|
||||
try {
|
||||
return helpers.permissionHelper.getObjectPermissions(getUuid());
|
||||
} catch (Exception e) {
|
||||
log.warn("getAllowedTargets not succeded", e);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAllowedSources() {
|
||||
try {
|
||||
return helpers.permissionHelper.getSubjectPermissions(getUuid());
|
||||
} catch (Exception e) {
|
||||
log.warn("getAllowedSources not succeded", e);
|
||||
}
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allowSource(String idOrName) throws Exception {
|
||||
helpers.permissionHelper.createPermission(idOrName, getUuid());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void allowTarget(String idOrName) throws Exception {
|
||||
helpers.permissionHelper.createPermission(getUuid(), idOrName);
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -1,182 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile.impl;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.management.DynamicMBean;
|
||||
import javax.management.MBeanRegistration;
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import org.osgi.framework.Bundle;
|
||||
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.Deactivate;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.service.component.annotations.ServiceScope;
|
||||
import org.osgi.util.tracker.BundleTracker;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.ManagementCore;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.AnnotatedMBean;
|
||||
import ru.entaxy.esb.platform.core.management.profile.ConnectorMBean;
|
||||
import ru.entaxy.esb.platform.core.management.profile.DefaultRouteMBean;
|
||||
import ru.entaxy.esb.platform.core.management.profile.ProfileMBean;
|
||||
import ru.entaxy.esb.platform.core.management.profile.ProfilesMBean;
|
||||
import ru.entaxy.esb.platform.core.management.profile.impl.connector.DeployedConnectorCustomizer;
|
||||
import ru.entaxy.esb.platform.core.management.profile.impl.connector.ManagedConnector;
|
||||
import ru.entaxy.esb.platform.core.management.profile.impl.connector.ManagedConnectorsListener;
|
||||
import ru.entaxy.esb.platform.core.management.profile.impl.helper.Helpers;
|
||||
import ru.entaxy.esb.platform.core.management.profile.impl.route.DeployedDefaultRouteCustomizer;
|
||||
import ru.entaxy.esb.platform.core.management.profile.impl.route.ManagedRoute;
|
||||
import ru.entaxy.esb.platform.core.management.profile.impl.route.ManagedRoutesListener;
|
||||
import ru.entaxy.platform.base.support.osgi.tracker.BundleTrackerUtils;
|
||||
import ru.entaxy.platform.base.support.osgi.tracker.filter.BundleCapabilityFilter;
|
||||
|
||||
@Component(service = { ProfilesMBean.class, DynamicMBean.class, MBeanRegistration.class }, property = {
|
||||
ManagementCore.JMX_OBJECTNAME + "=" + ManagementCore.Q_RUNTIME_S + "," + ProfilesMBean.PROFILES_KEY + "="
|
||||
+ ProfilesMBean.PROFILES_KEY_VALUE }, scope = ServiceScope.SINGLETON, immediate = true)
|
||||
public class ProfilesMBeanImpl extends AnnotatedMBean<ProfilesMBean>
|
||||
implements ProfilesMBean {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ProfilesMBeanImpl.class);
|
||||
|
||||
protected BundleContext bundleContext;
|
||||
|
||||
protected BundleTracker<List<ManagedProfile>> tracker;
|
||||
|
||||
protected BundleTracker<List<ManagedRoute>> routeTracker;
|
||||
|
||||
protected BundleTracker<List<ManagedConnector>> connectorTracker;
|
||||
|
||||
@Reference (cardinality = ReferenceCardinality.MANDATORY
|
||||
, service = Helpers.class
|
||||
, collectionType = CollectionType.SERVICE)
|
||||
Helpers helpers;
|
||||
|
||||
public ProfilesMBeanImpl() throws NotCompliantMBeanException {
|
||||
super(ProfilesMBean.class);
|
||||
}
|
||||
|
||||
protected static class ManagedProfileDescriptor {
|
||||
|
||||
ManagedProfile profile;
|
||||
ServiceRegistration<ProfileMBean> registration;
|
||||
|
||||
}
|
||||
|
||||
protected Map<String, ManagedProfileDescriptor> managed = new HashMap<>();
|
||||
|
||||
@Activate
|
||||
public void activate(ComponentContext componentContext) {
|
||||
this.bundleContext = componentContext.getBundleContext();
|
||||
|
||||
//tracker = new DeployedProfileTrackerOld(bundleContext, this);
|
||||
tracker = BundleTrackerUtils.<List<ManagedProfile>>createBuilder()
|
||||
.customizer(
|
||||
(new DeployedProfileCustomizer())
|
||||
.listener(new ManagedProfilesListener(bundleContext, this.helpers))
|
||||
)
|
||||
.addFilter(
|
||||
(new BundleCapabilityFilter()).namespace(ProfileMBean.CAPABILITY_NAMESPACE)
|
||||
)
|
||||
.bundleContext(bundleContext)
|
||||
.bundleState(Bundle.ACTIVE | Bundle.INSTALLED | Bundle.RESOLVED | Bundle.STARTING | Bundle.STOPPING)
|
||||
.get();
|
||||
tracker.open();
|
||||
|
||||
routeTracker = BundleTrackerUtils.<List<ManagedRoute>>createBuilder()
|
||||
.customizer(
|
||||
(new DeployedDefaultRouteCustomizer())
|
||||
.listener(new ManagedRoutesListener(bundleContext, helpers))
|
||||
)
|
||||
.addFilter(
|
||||
(new BundleCapabilityFilter()).namespace(DefaultRouteMBean.CAPABILITY_NAMESPACE)
|
||||
)
|
||||
.bundleContext(bundleContext)
|
||||
.bundleState(Bundle.ACTIVE | Bundle.INSTALLED | Bundle.RESOLVED | Bundle.STARTING | Bundle.STOPPING)
|
||||
.get();
|
||||
routeTracker.open();
|
||||
|
||||
connectorTracker = BundleTrackerUtils.<List<ManagedConnector>>createBuilder()
|
||||
.customizer(
|
||||
(new DeployedConnectorCustomizer())
|
||||
.listener(new ManagedConnectorsListener(bundleContext, this.helpers))
|
||||
)
|
||||
.addFilter(
|
||||
(new BundleCapabilityFilter()).namespace(ConnectorMBean.CAPABILITY_NAMESPACE)
|
||||
)
|
||||
.bundleContext(bundleContext)
|
||||
.bundleState(Bundle.ACTIVE | Bundle.INSTALLED | Bundle.RESOLVED | Bundle.STARTING | Bundle.STOPPING)
|
||||
.get();
|
||||
connectorTracker.open();
|
||||
}
|
||||
|
||||
@Deactivate
|
||||
public void deactivate() {
|
||||
tracker.close();
|
||||
routeTracker.close();
|
||||
connectorTracker.close();
|
||||
}
|
||||
|
||||
/*
|
||||
* ProfileManager implementation
|
||||
*/
|
||||
|
||||
@Override
|
||||
public void createProfile(String id, String name, String description) throws Exception {
|
||||
this.helpers.profileHelper.createProfile(id, name, description);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProfileConfig(String idOrName) throws Exception {
|
||||
return this.helpers.entaxyObjectService.findObject(idOrName, "entaxy.runtime.profile").getConfiguration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startProfile(String idOrName) throws Exception {
|
||||
this.helpers.profileHelper.startProfile(idOrName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopProfile(String idOrName) throws Exception {
|
||||
this.helpers.profileHelper.stopProfile(idOrName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstallProfile(String idOrName) throws Exception {
|
||||
this.helpers.profileHelper.uninstallProfile(idOrName);
|
||||
}
|
||||
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile.impl.connector;
|
||||
|
||||
import ru.entaxy.esb.platform.core.management.profile.api.ConnectorManager;
|
||||
|
||||
public interface ConnectorHelper extends ConnectorManager {
|
||||
|
||||
}
|
@ -1,124 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile.impl.connector;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import javax.naming.OperationNotSupportedException;
|
||||
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.CollectionType;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.service.component.annotations.ReferencePolicyOption;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.esb.platform.core.management.profile.api.ConnectorManager;
|
||||
import ru.entaxy.esb.platform.core.management.profile.impl.ProfileHelperImpl;
|
||||
|
||||
@Component(service = ConnectorHelper.class, immediate = true)
|
||||
public class ConnectorHelperImpl implements ConnectorHelper {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ProfileHelperImpl.class);
|
||||
|
||||
protected static final String EXPLANATION = "ConnectorManager not bound";
|
||||
|
||||
protected ConnectorManager connectorManager = null;
|
||||
|
||||
protected ConnectorManager nullConnectorManager = null;
|
||||
|
||||
@Activate
|
||||
public void activate(ComponentContext componentContext) {
|
||||
this.nullConnectorManager = new ConnectorManager() {
|
||||
|
||||
@Override
|
||||
public void stopConnector(String idOrName, String connectorName) throws Exception {
|
||||
throw new OperationNotSupportedException(EXPLANATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startConnector(String idOrName, String connectorName) throws Exception {
|
||||
throw new OperationNotSupportedException(EXPLANATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeConnector(String idOrName, String connectorName) throws Exception {
|
||||
throw new OperationNotSupportedException(EXPLANATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addConnector(String idOrName, String connectorFactoryId, Map<String, String> parameters)
|
||||
throws Exception {
|
||||
throw new OperationNotSupportedException(EXPLANATION);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
public ConnectorManager getEffectiveConnectorManager() {
|
||||
return connectorManager!=null?connectorManager:nullConnectorManager;
|
||||
}
|
||||
|
||||
@Reference (collectionType = CollectionType.SERVICE
|
||||
, cardinality = ReferenceCardinality.OPTIONAL
|
||||
, policyOption = ReferencePolicyOption.GREEDY
|
||||
, service = ConnectorManager.class
|
||||
, unbind = "unsetConnectorManager")
|
||||
public void setConnectorManager(ConnectorManager connectorManager) {
|
||||
this.connectorManager = connectorManager;
|
||||
log.debug(">> ConnectorManager is bound");
|
||||
}
|
||||
|
||||
public void unsetConnectorManager(ConnectorManager connectorManager) {
|
||||
this.connectorManager = null;
|
||||
log.debug(">> ConnectorManager is unbound");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void addConnector(String idOrName, String connectorFactoryId, Map<String, String> parameters)
|
||||
throws Exception {
|
||||
getEffectiveConnectorManager().addConnector(idOrName, connectorFactoryId, parameters);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeConnector(String idOrName, String connectorName) throws Exception {
|
||||
getEffectiveConnectorManager().removeConnector(idOrName, connectorName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startConnector(String idOrName, String connectorName) throws Exception {
|
||||
getEffectiveConnectorManager().startConnector(idOrName, connectorName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopConnector(String idOrName, String connectorName) throws Exception {
|
||||
getEffectiveConnectorManager().stopConnector(idOrName, connectorName);
|
||||
}
|
||||
|
||||
}
|
@ -1,94 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile.impl.connector;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.EntaxyRuntimeTyped;
|
||||
import ru.entaxy.esb.platform.base.management.core.utils.BundleAwareMBeanImpl;
|
||||
import ru.entaxy.esb.platform.core.management.profile.ConnectorMBean;
|
||||
import ru.entaxy.esb.platform.core.management.profile.impl.helper.Helpers;
|
||||
|
||||
//@TODO move string to constant
|
||||
@EntaxyRuntimeTyped(name = "entaxy.runtime.connector")
|
||||
public class ConnectorMBeanImpl extends BundleAwareMBeanImpl<ManagedConnector, ConnectorMBean> implements ConnectorMBean {
|
||||
|
||||
protected Helpers helpers;
|
||||
|
||||
public ConnectorMBeanImpl(BundleContext bundleContext, ManagedConnector managedObject, Helpers helpers)
|
||||
throws NotCompliantMBeanException {
|
||||
super(ConnectorMBean.class, managedObject);
|
||||
this.bundleContext = bundleContext;
|
||||
this.helpers = helpers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getFactoryId() {
|
||||
return this.managedObject.getFactoryId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.managedObject.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRegisteredName() {
|
||||
return this.managedObject.getRegisteredName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getSystem() {
|
||||
return this.managedObject.getSystem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getClassifier() {
|
||||
return this.managedObject.getClassifier();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return this.managedObject.getDisplayName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDirection() {
|
||||
return this.managedObject.getDirection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() throws Exception {
|
||||
this.helpers.connectorHelper.startConnector(this.managedObject.getSystem(), this.getRegisteredName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() throws Exception {
|
||||
this.helpers.connectorHelper.stopConnector(this.managedObject.getSystem(), this.getRegisteredName());
|
||||
}
|
||||
}
|
@ -1,100 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile.impl.connector;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleEvent;
|
||||
import org.osgi.framework.wiring.BundleCapability;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.utils.ExtendedBundleTrackerCustomizer;
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
import ru.entaxy.platform.base.support.osgi.tracker.filter.BundleCapabilityFilter;
|
||||
|
||||
public class DeployedConnectorCustomizer extends ExtendedBundleTrackerCustomizer<List<ManagedConnector>> {
|
||||
|
||||
@Override
|
||||
protected List<ManagedConnector> createManagedObject(Bundle bundle, BundleEvent event,
|
||||
Map<String, List<?>> filterResults) {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<BundleCapability> capabilities = (List<BundleCapability>)filterResults.get(BundleCapabilityFilter.DEFAULT_FILTER_ID);
|
||||
if (capabilities==null)
|
||||
capabilities = new ArrayList<>();
|
||||
List<ManagedConnector> result = new ArrayList<>();
|
||||
for (BundleCapability capability: capabilities) {
|
||||
Object val = capability.getAttributes().get("name");
|
||||
String name = val==null?"":val.toString();
|
||||
if (!CommonUtils.isValid(name))
|
||||
continue;
|
||||
val = capability.getAttributes().get("system");
|
||||
String system = val==null?"":val.toString();
|
||||
if (!CommonUtils.isValid(system))
|
||||
continue;
|
||||
|
||||
val = capability.getAttributes().get("templateId");
|
||||
String factoryId = val==null?"":val.toString();
|
||||
|
||||
val = capability.getAttributes().get("factory");
|
||||
factoryId = val==null?factoryId:val.toString();
|
||||
|
||||
val = capability.getAttributes().get("bundleName");
|
||||
String registeredName = val==null?"":val.toString();
|
||||
|
||||
val = capability.getAttributes().get("classifier");
|
||||
String classifier = val==null?"":val.toString();
|
||||
|
||||
val = capability.getAttributes().get("displayName");
|
||||
String displayName;
|
||||
try {
|
||||
displayName = val==null?"":new String(val.toString().getBytes(StandardCharsets.ISO_8859_1), "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
displayName = val==null?"":val.toString();
|
||||
}
|
||||
|
||||
val = capability.getAttributes().get("direction");
|
||||
String direction = val==null?"":val.toString();
|
||||
|
||||
|
||||
ManagedConnector mc = (new ManagedConnector())
|
||||
.name(name)
|
||||
.system(system)
|
||||
.factoryId(factoryId)
|
||||
.registeredName(registeredName)
|
||||
.classifier(classifier)
|
||||
.displayName(displayName)
|
||||
.direction(direction);
|
||||
enrich(bundle, event, filterResults, mc);
|
||||
result.add(mc);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -1,136 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile.impl.connector;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.utils.BundleAwareManagedObjectImpl;
|
||||
|
||||
public class ManagedConnector extends BundleAwareManagedObjectImpl {
|
||||
|
||||
protected String system;
|
||||
|
||||
protected String name;
|
||||
|
||||
protected String registeredName;
|
||||
|
||||
protected String factoryId;
|
||||
|
||||
protected String classifier;
|
||||
|
||||
protected String displayName;
|
||||
|
||||
protected String direction;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public ManagedConnector name(String name) {
|
||||
setName(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getSystem() {
|
||||
return system;
|
||||
}
|
||||
|
||||
public void setSystem(String system) {
|
||||
this.system = system;
|
||||
}
|
||||
|
||||
public ManagedConnector system(String system) {
|
||||
setSystem(system);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getFactoryId() {
|
||||
return factoryId;
|
||||
}
|
||||
|
||||
public void setFactoryId(String factoryId) {
|
||||
this.factoryId = factoryId;
|
||||
}
|
||||
|
||||
public ManagedConnector factoryId(String factoryIdValue) {
|
||||
this.setFactoryId(factoryIdValue);
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRegisteredName() {
|
||||
return registeredName;
|
||||
}
|
||||
|
||||
public void setRegisteredName(String registeredName) {
|
||||
this.registeredName = registeredName;
|
||||
};
|
||||
|
||||
public ManagedConnector registeredName(String registeredNameValue) {
|
||||
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 getDisplayName() {
|
||||
return displayName;
|
||||
}
|
||||
|
||||
public void setDisplayName(String displayName) {
|
||||
this.displayName = displayName;
|
||||
}
|
||||
|
||||
public ManagedConnector displayName(String displayNameValue) {
|
||||
this.setDisplayName(displayNameValue);
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,78 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile.impl.connector;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.utils.ManagedObjectsListener;
|
||||
import ru.entaxy.esb.platform.core.management.profile.ConnectorMBean;
|
||||
import ru.entaxy.esb.platform.core.management.profile.impl.helper.Helpers;
|
||||
|
||||
public class ManagedConnectorsListener extends ManagedObjectsListener<List<ManagedConnector>, ManagedConnector, ConnectorMBean, ConnectorMBeanImpl> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ManagedConnectorsListener.class);
|
||||
|
||||
protected Helpers helpers;
|
||||
|
||||
public ManagedConnectorsListener(BundleContext bundleContext, Helpers helpers) {
|
||||
super(bundleContext, ConnectorMBean.class);
|
||||
this.helpers = helpers;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterator<ManagedConnector> getIterator(List<ManagedConnector> managedObject) {
|
||||
return managedObject.iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getKeyValue(ManagedConnector object) {
|
||||
return object.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ConnectorMBeanImpl createService(ManagedConnector managedObject) {
|
||||
try {
|
||||
return new ConnectorMBeanImpl(bundleContext, managedObject, helpers);
|
||||
} catch (Exception e) {
|
||||
log.error("Error creating service", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getJmxObjectName(ManagedConnector managedObject) {
|
||||
return ConnectorMBean.Helper.getQualifier(
|
||||
managedObject.getSystem(),
|
||||
managedObject.getName()
|
||||
).getValue();
|
||||
}
|
||||
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile.impl.helper;
|
||||
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
|
||||
import ru.entaxy.esb.platform.core.management.profile.impl.ProfileHelper;
|
||||
import ru.entaxy.esb.platform.core.management.profile.impl.connector.ConnectorHelper;
|
||||
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 {
|
||||
|
||||
@Reference (cardinality = ReferenceCardinality.MANDATORY)
|
||||
public ProfileHelper profileHelper;
|
||||
|
||||
@Reference (cardinality = ReferenceCardinality.MANDATORY)
|
||||
public ConnectorHelper connectorHelper;
|
||||
|
||||
@Reference (cardinality = ReferenceCardinality.MANDATORY)
|
||||
public BasicAuthService basicAuthService;
|
||||
|
||||
@Reference (cardinality = ReferenceCardinality.MANDATORY)
|
||||
public SystemService systemService;
|
||||
|
||||
@Reference (cardinality = ReferenceCardinality.MANDATORY)
|
||||
public PermissionHelper permissionHelper;
|
||||
|
||||
@Reference (cardinality = ReferenceCardinality.MANDATORY)
|
||||
public EntaxyObjectService entaxyObjectService;
|
||||
}
|
@ -1,32 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile.impl.permission;
|
||||
|
||||
import ru.entaxy.esb.platform.core.management.profile.api.PermissionManager;
|
||||
|
||||
public interface PermissionHelper extends PermissionManager {
|
||||
|
||||
}
|
@ -1,109 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile.impl.permission;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.naming.OperationNotSupportedException;
|
||||
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.osgi.service.component.annotations.Activate;
|
||||
import org.osgi.service.component.annotations.CollectionType;
|
||||
import org.osgi.service.component.annotations.Component;
|
||||
import org.osgi.service.component.annotations.Reference;
|
||||
import org.osgi.service.component.annotations.ReferenceCardinality;
|
||||
import org.osgi.service.component.annotations.ReferencePolicyOption;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.esb.platform.core.management.profile.api.PermissionManager;
|
||||
|
||||
@Component(service = PermissionHelper.class, immediate = true)
|
||||
public class PermissionHelperImpl implements PermissionHelper {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(PermissionHelperImpl.class);
|
||||
|
||||
protected static final String EXPLANATION = "PermissionManager not bound";
|
||||
|
||||
protected PermissionManager permissionManager = null;
|
||||
|
||||
protected PermissionManager nullPermissionManager = null;
|
||||
|
||||
@Activate
|
||||
public void activate(ComponentContext componentContext) {
|
||||
this.nullPermissionManager = new PermissionManager() {
|
||||
|
||||
@Override
|
||||
public List<String> getSubjectPermissions(String subjectId) throws Exception {
|
||||
throw new OperationNotSupportedException(EXPLANATION); }
|
||||
|
||||
@Override
|
||||
public List<String> getObjectPermissions(String objectId) throws Exception {
|
||||
throw new OperationNotSupportedException(EXPLANATION); }
|
||||
|
||||
@Override
|
||||
public void createPermission(String objectId, String subjectId) throws Exception {
|
||||
throw new OperationNotSupportedException(EXPLANATION); }
|
||||
};
|
||||
}
|
||||
|
||||
public PermissionManager getEffectivePermissionManager() {
|
||||
return this.permissionManager!=null?this.permissionManager:this.nullPermissionManager;
|
||||
}
|
||||
|
||||
@Reference (collectionType = CollectionType.SERVICE
|
||||
, cardinality = ReferenceCardinality.OPTIONAL
|
||||
, policyOption = ReferencePolicyOption.GREEDY
|
||||
, service = PermissionManager.class
|
||||
, unbind = "unsetPermissionManager")
|
||||
public void setPermissionManager(PermissionManager permissionManager) {
|
||||
this.permissionManager = permissionManager;
|
||||
log.debug(">> PermissionManager is bound");
|
||||
}
|
||||
|
||||
public void unsetPermissionManager(PermissionManager permissionManager) {
|
||||
this.permissionManager = null;
|
||||
log.debug(">> PermissionManager is unbound");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> getObjectPermissions(String objectId) throws Exception {
|
||||
return getEffectivePermissionManager().getObjectPermissions(objectId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getSubjectPermissions(String subjectId) throws Exception {
|
||||
return getEffectivePermissionManager().getSubjectPermissions(subjectId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createPermission(String objectId, String subjectId) throws Exception {
|
||||
getEffectivePermissionManager().createPermission(objectId, subjectId);
|
||||
}
|
||||
|
||||
}
|
@ -1,59 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile.impl.route;
|
||||
|
||||
import javax.management.NotCompliantMBeanException;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.api.EntaxyRuntimeTyped;
|
||||
import ru.entaxy.esb.platform.base.management.core.utils.BundleAwareMBeanImpl;
|
||||
import ru.entaxy.esb.platform.core.management.profile.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 {
|
||||
|
||||
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();
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile.impl.route;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleEvent;
|
||||
import org.osgi.framework.wiring.BundleCapability;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.utils.ExtendedBundleTrackerCustomizer;
|
||||
import ru.entaxy.platform.base.support.CommonUtils;
|
||||
import ru.entaxy.platform.base.support.osgi.tracker.filter.BundleCapabilityFilter;
|
||||
|
||||
public class DeployedDefaultRouteCustomizer extends ExtendedBundleTrackerCustomizer<List<ManagedRoute>> {
|
||||
|
||||
@Override
|
||||
protected List<ManagedRoute> createManagedObject(Bundle bundle, BundleEvent event, Map<String, List<?>> filterResults) {
|
||||
@SuppressWarnings("unchecked")
|
||||
List<BundleCapability> capabilities = (List<BundleCapability>)filterResults.get(BundleCapabilityFilter.DEFAULT_FILTER_ID);
|
||||
if (capabilities==null)
|
||||
capabilities = new ArrayList<>();
|
||||
List<ManagedRoute> result = new ArrayList<>();
|
||||
for (BundleCapability capability: capabilities) {
|
||||
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("profile");
|
||||
String profile = val==null?"":val.toString();
|
||||
if (!CommonUtils.isValid(profile)) {
|
||||
// backward comp
|
||||
val = capability.getAttributes().get("system");
|
||||
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);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile.impl.route;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.utils.BundleAwareManagedObjectImpl;
|
||||
|
||||
public class ManagedRoute extends BundleAwareManagedObjectImpl {
|
||||
|
||||
protected boolean isDefault;
|
||||
|
||||
protected String name;
|
||||
|
||||
protected String profile;
|
||||
|
||||
public boolean isDefault() {
|
||||
return isDefault;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public void setDefault(boolean isDefault) {
|
||||
this.isDefault = isDefault;
|
||||
}
|
||||
|
||||
public ManagedRoute defaultRoute(boolean isDefault) {
|
||||
setDefault(isDefault);
|
||||
return this;
|
||||
}
|
||||
|
||||
public ManagedRoute name(String name) {
|
||||
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;
|
||||
}
|
||||
}
|
@ -1,76 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* profile-management
|
||||
* ==========
|
||||
* Copyright (C) 2020 - 2023 EmDev LLC
|
||||
* ==========
|
||||
* You may not use this file except in accordance with the License Terms of the Copyright
|
||||
* Holder located at: https://entaxy.ru/eula . All copyrights, all intellectual property
|
||||
* rights to the Software and any copies are the property of the Copyright Holder. Unless
|
||||
* it is explicitly allowed the Copyright Holder, the User is prohibited from using the
|
||||
* Software for commercial purposes to provide services to third parties.
|
||||
*
|
||||
* The Copyright Holder hereby declares that the Software is provided on an "AS IS".
|
||||
* Under no circumstances does the Copyright Holder guarantee or promise that the
|
||||
* Software provided by him will be suitable or not suitable for the specific purposes
|
||||
* of the User, that the Software will meet all commercial and personal subjective
|
||||
* expectations of the User, that the Software will work properly, without technical
|
||||
* errors, quickly and uninterruptedly.
|
||||
*
|
||||
* Under no circumstances shall the Copyright Holder or its Affiliates is not liable
|
||||
* to the User for any direct or indirect losses of the User, his expenses or actual
|
||||
* damage, including, downtime; loss of bussines; lost profit; lost earnings; loss
|
||||
* or damage to data, property, etc.
|
||||
* ~~~~~~/licensing~~~~~~
|
||||
*/
|
||||
package ru.entaxy.esb.platform.core.management.profile.impl.route;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.utils.ManagedObjectsListener;
|
||||
import ru.entaxy.esb.platform.core.management.profile.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);
|
||||
|
||||
protected Helpers helpers;
|
||||
|
||||
public ManagedRoutesListener(BundleContext bundleContext, Helpers helpers) {
|
||||
super(bundleContext, DefaultRouteMBean.class);
|
||||
this.helpers = helpers;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterator<ManagedRoute> getIterator(List<ManagedRoute> managedObject) {
|
||||
log.debug(">> getIterator");
|
||||
return managedObject.iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getKeyValue(ManagedRoute object) {
|
||||
return object.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected DefaultRouteMBeanImpl createService(ManagedRoute managedObject) {
|
||||
try {
|
||||
return new DefaultRouteMBeanImpl(bundleContext, managedObject, helpers);
|
||||
} catch (Exception e) {
|
||||
log.error("Error creating service", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getJmxObjectName(ManagedRoute managedObject) {
|
||||
return DefaultRouteMBean.Helper.getQualifier(managedObject.getProfile()).getValue();
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user