release version 1.10.0
This commit is contained in:
@ -3,7 +3,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>
|
||||
<artifactId>service-management</artifactId>
|
||||
@ -14,11 +14,10 @@
|
||||
|
||||
<properties>
|
||||
<bundle.osgi.export.pkg>
|
||||
ru.entaxy.esb.platform.core.management.service
|
||||
ru.entaxy.platform.core.management.service
|
||||
</bundle.osgi.export.pkg>
|
||||
<bundle.osgi.private.pkg>
|
||||
ru.entaxy.esb.platform.core.management.service.impl,
|
||||
ru.entaxy.esb.platform.core.management.service.impl.tracker
|
||||
ru.entaxy.platform.core.management.service.impl
|
||||
</bundle.osgi.private.pkg>
|
||||
</properties>
|
||||
|
||||
@ -51,11 +50,18 @@
|
||||
<artifactId>objects-core</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.platform.runtime.core.management</groupId>
|
||||
<artifactId>object-management</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<!--
|
||||
<dependency>
|
||||
<groupId>ru.entaxy.esb.system.management.bundle.manager</groupId>
|
||||
<artifactId>bundle-manager</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
-->
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
@ -1,52 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* service-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.service;
|
||||
|
||||
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.RuntimeTypedMBean;
|
||||
import ru.entaxy.esb.platform.base.management.core.utils.BundleAwareMBean;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATION_ENRICH)
|
||||
public interface ServiceMBean extends BundleAwareMBean, RuntimeTypedMBean {
|
||||
|
||||
public static interface Helper {
|
||||
|
||||
public static Qualifier getQualifier(String name) {
|
||||
return ServicesMBean.Q_SERVICES.qualifier(SERVICE_KEY, name);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static final String CAPABILITY_NAMESPACE = "entaxy.runtime.service";
|
||||
|
||||
public static final String SERVICE_KEY = "service";
|
||||
|
||||
@Attribute
|
||||
String getName();
|
||||
}
|
@ -1,63 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* service-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.service;
|
||||
|
||||
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.base.management.core.api.Operation;
|
||||
import ru.entaxy.esb.platform.base.management.core.api.Parameter;
|
||||
|
||||
@MBeanAnnotated(policy = MBeanExportPolicy.ANNOTATION_ENRICH)
|
||||
public interface ServicesMBean {
|
||||
|
||||
public static final String CAPABILITY_NAMESPACE = "entaxy.runtime.service";
|
||||
|
||||
public static final String SERVICES_KEY = "category";
|
||||
|
||||
public static final String SERVICES_KEY_VALUE = "services";
|
||||
|
||||
public static final Qualifier Q_SERVICES = ManagementCore.Q_RUNTIME
|
||||
.qualifier(ServicesMBean.SERVICES_KEY, ServicesMBean.SERVICES_KEY_VALUE);
|
||||
|
||||
@Operation(desc = "Gets service's configuration")
|
||||
public String getServiceConfig(
|
||||
@Parameter(name = "idOrName", desc = "Service id or name") String idOrName) throws Exception;
|
||||
|
||||
@Operation(desc = "Start service")
|
||||
public void startService(
|
||||
@Parameter(name = "idOrName", desc = "Service id or name") String idOrName) throws Exception;
|
||||
|
||||
@Operation(desc = "Stop service")
|
||||
public void stopService(
|
||||
@Parameter(name = "idOrName", desc = "Service id or name") String idOrName) throws Exception;
|
||||
|
||||
@Operation(desc = "Uninstall service")
|
||||
public void uninstallService(
|
||||
@Parameter(name = "idOrName", desc = "Service id or name") String idOrName) throws Exception;
|
||||
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* service-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.service.impl;
|
||||
|
||||
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.service.ServiceMBean;
|
||||
import ru.entaxy.esb.platform.core.management.service.impl.tracker.ManagedService;
|
||||
|
||||
@EntaxyRuntimeTyped(name = "entaxy.runtime.service")
|
||||
public class ServiceMBeanImpl extends BundleAwareMBeanImpl<ManagedService, ServiceMBean> implements ServiceMBean {
|
||||
|
||||
public ServiceMBeanImpl(BundleContext bundleContext, ManagedService managedProfile)
|
||||
throws NotCompliantMBeanException {
|
||||
super(ServiceMBean.class, managedProfile);
|
||||
this.bundleContext = bundleContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return this.managedObject.getName();
|
||||
}
|
||||
|
||||
}
|
@ -1,137 +0,0 @@
|
||||
/*-
|
||||
* ~~~~~~licensing~~~~~~
|
||||
* service-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.service.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.*;
|
||||
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.service.ServiceMBean;
|
||||
import ru.entaxy.esb.platform.core.management.service.ServicesMBean;
|
||||
import ru.entaxy.esb.platform.core.management.service.impl.tracker.DeployedServiceCustomizer;
|
||||
import ru.entaxy.esb.platform.core.management.service.impl.tracker.ManagedService;
|
||||
import ru.entaxy.esb.platform.core.management.service.impl.tracker.ManagedServiceListener;
|
||||
import ru.entaxy.esb.system.management.bundle.manager.BundleManager;
|
||||
import ru.entaxy.platform.base.objects.EntaxyObjectService;
|
||||
import ru.entaxy.platform.base.support.osgi.tracker.BundleTrackerUtils;
|
||||
import ru.entaxy.platform.base.support.osgi.tracker.filter.BundleCapabilityFilter;
|
||||
|
||||
@Component(service = { ServicesMBean.class, DynamicMBean.class, MBeanRegistration.class }, property = {
|
||||
ManagementCore.JMX_OBJECTNAME + "=" + ManagementCore.Q_RUNTIME_S + "," + ServicesMBean.SERVICES_KEY + "="
|
||||
+ ServicesMBean.SERVICES_KEY_VALUE }, scope = ServiceScope.SINGLETON, immediate = true)
|
||||
public class ServicesMBeanImpl extends AnnotatedMBean<ServicesMBean> implements ServicesMBean {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ServicesMBeanImpl.class);
|
||||
|
||||
protected BundleContext bundleContext;
|
||||
|
||||
protected BundleTracker<List<ManagedService>> tracker;
|
||||
|
||||
private String SERVICE_RUNTIME_TYPE = "entaxy.runtime.service";
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY)
|
||||
public EntaxyObjectService entaxyObjectService;
|
||||
|
||||
@Reference(cardinality = ReferenceCardinality.MANDATORY)
|
||||
private BundleManager bundleManager;
|
||||
|
||||
protected static class ManagedServiceDescriptor {
|
||||
|
||||
ManagedService profile;
|
||||
ServiceRegistration<ServiceMBean> registration;
|
||||
|
||||
}
|
||||
|
||||
protected Map<String, ManagedServiceDescriptor> managed = new HashMap<>();
|
||||
|
||||
public ServicesMBeanImpl() throws NotCompliantMBeanException {
|
||||
super(ServicesMBean.class);
|
||||
}
|
||||
|
||||
@Activate
|
||||
public void activate(ComponentContext componentContext) {
|
||||
this.bundleContext = componentContext.getBundleContext();
|
||||
|
||||
//tracker = new DeployedProfileTrackerOld(bundleContext, this);
|
||||
tracker = BundleTrackerUtils.<List<ManagedService>>createBuilder()
|
||||
.customizer(
|
||||
(new DeployedServiceCustomizer())
|
||||
.listener(new ManagedServiceListener(bundleContext))
|
||||
)
|
||||
.addFilter(
|
||||
(new BundleCapabilityFilter()).namespace(ServiceMBean.CAPABILITY_NAMESPACE)
|
||||
)
|
||||
.bundleContext(bundleContext)
|
||||
.bundleState(Bundle.ACTIVE | Bundle.INSTALLED | Bundle.RESOLVED | Bundle.STARTING | Bundle.STOPPING)
|
||||
.get();
|
||||
tracker.open();
|
||||
}
|
||||
|
||||
@Deactivate
|
||||
public void deactivate() {
|
||||
tracker.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getServiceConfig(String idOrName) {
|
||||
return entaxyObjectService.findObject(idOrName, SERVICE_RUNTIME_TYPE).getConfiguration();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startService(String idOrName) throws Exception {
|
||||
long bundleId = entaxyObjectService.findObject(idOrName, SERVICE_RUNTIME_TYPE).getBundleInfo().getBundleId();
|
||||
bundleManager.startBundle(bundleContext.getBundle(bundleId).getSymbolicName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopService(String idOrName) throws Exception {
|
||||
long bundleId = entaxyObjectService.findObject(idOrName, SERVICE_RUNTIME_TYPE).getBundleInfo().getBundleId();
|
||||
bundleManager.stopBundle(bundleContext.getBundle(bundleId).getSymbolicName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void uninstallService(String idOrName) throws Exception {
|
||||
long bundleId = entaxyObjectService.findObject(idOrName, SERVICE_RUNTIME_TYPE).getBundleInfo().getBundleId();
|
||||
Bundle bundle = bundleContext.getBundle(bundleId);
|
||||
bundleManager.uninstallBundleByName(bundle.getSymbolicName(), "service", bundle.getVersion().toString());
|
||||
// todo remove all connected resources
|
||||
}
|
||||
}
|
@ -1,64 +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.service.impl.tracker;
|
||||
|
||||
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 DeployedServiceCustomizer extends ExtendedBundleTrackerCustomizer<List<ManagedService>> {
|
||||
|
||||
@Override
|
||||
protected List<ManagedService> 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<ManagedService> result = new ArrayList<>();
|
||||
for (BundleCapability capability: capabilities) {
|
||||
Object val = capability.getAttributes().get("name");
|
||||
String name = val==null?"":val.toString();
|
||||
if (!CommonUtils.isValid(name))
|
||||
continue;
|
||||
|
||||
ManagedService mp = (new ManagedService())
|
||||
.name(name);
|
||||
enrich(bundle, event, filterResults, mp);
|
||||
result.add(mp);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
@ -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.service.impl.tracker;
|
||||
|
||||
import ru.entaxy.esb.platform.base.management.core.utils.BundleAwareManagedObjectImpl;
|
||||
|
||||
public class ManagedService extends BundleAwareManagedObjectImpl {
|
||||
|
||||
protected String name;
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public ManagedService name(String name) {
|
||||
setName(name);
|
||||
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.service.impl.tracker;
|
||||
|
||||
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.service.ServiceMBean;
|
||||
import ru.entaxy.esb.platform.core.management.service.impl.ServiceMBeanImpl;
|
||||
|
||||
public class ManagedServiceListener extends ManagedObjectsListener<List<ManagedService>
|
||||
, ManagedService, ServiceMBean, ServiceMBeanImpl> {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(ManagedServiceListener.class);
|
||||
|
||||
// protected Helpers helpers;
|
||||
|
||||
public ManagedServiceListener(BundleContext bundleContext) {
|
||||
super(bundleContext, ServiceMBean.class);
|
||||
// this.helpers = helpers;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterator<ManagedService> getIterator(List<ManagedService> managedObject) {
|
||||
return managedObject.iterator();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getKeyValue(ManagedService object) {
|
||||
return object.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ServiceMBeanImpl createService(ManagedService managedObject) {
|
||||
try {
|
||||
return new ServiceMBeanImpl(bundleContext, managedObject);
|
||||
} catch (Exception e) {
|
||||
log.error("Error creating service", e);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getJmxObjectName(ManagedService managedObject) {
|
||||
return ServiceMBean.Helper.getQualifier(managedObject.getName()).getValue();
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user