[KARAF-5529] Rewrite SCR management layer to more closely follow the real object mode
diff --git a/scr/management/src/main/java/org/apache/karaf/scr/management/ScrServiceMBean.java b/scr/management/src/main/java/org/apache/karaf/scr/management/ScrServiceMBean.java
deleted file mode 100644
index 663eb90..0000000
--- a/scr/management/src/main/java/org/apache/karaf/scr/management/ScrServiceMBean.java
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.scr.management;
-
-import javax.management.MBeanException;
-import javax.management.openmbean.TabularData;
-
-/**
- * The management interface for SCR Components.
- */
-public interface ScrServiceMBean {
-
- String COMPONENT_ID = "Id";
- String COMPONENT_NAME = "Name";
- String COMPONENT_STATE = "State";
- String COMPONENT_PROPERTIES = "Properties";
- String COMPONENT_REFERENCES = "References";
-
- String PROPERTY_KEY = "Key";
- String PROPERTY_VALUE = "Value";
-
- String REFERENCE_NAME = "Name";
- String REFERENCE_SATISFIED = "Satisfied";
-
- String REFERENCE_CARDINALITY = "Cardinality";
- String REFERENCE_CARDINALITY_SINGLE = "Single";
- String REFERENCE_CARDINALITY_MULTIPLE = "Multiple";
- String REFERENCE_AVAILABILITY = "Availability";
- String REFERENCE_AVAILABILITY_OPTIONAL = "Optional";
- String REFERENCE_AVAILABILITY_MANDATORY = "Mandatory";
-
- String REFERENCE_POLICY = "Policy";
- String REFERENCE_POLICY_DYNAMIC = "Dynamic";
- String REFERENCE_POLICY_STATIC = "Static";
-
- String REFERENCE_BOUND_SERVICES = "Bound Services";
-
- /**
- * The item names in the CompositeData representing a component
- */
- String[] COMPONENT = {COMPONENT_ID, COMPONENT_NAME, COMPONENT_STATE,
- COMPONENT_PROPERTIES, COMPONENT_REFERENCES};
-
- String[] PROPERTY = {PROPERTY_KEY, PROPERTY_VALUE};
-
- String[] REFERENCE = {REFERENCE_NAME, REFERENCE_SATISFIED, REFERENCE_CARDINALITY, REFERENCE_AVAILABILITY, REFERENCE_POLICY, REFERENCE_BOUND_SERVICES};
-
- /**
- * Display a {@link TabularData} with all the component details.
- *
- * @return A {@link TabularData} containing all SCR components.
- */
- TabularData getComponents();
-
- /**
- * Present a {@code String} array of components currently registered with the SCR.
- *
- * @return A {@code String[]} containing all SCR components ID.
- */
- String[] listComponents();
-
- /**
- * Verify if the named component is currently in an ACTIVE state.
- *
- * @param componentName The component name.
- * @return True if the component is ACTIVE, otherwise false.
- * @throws MBeanException If the check fails.
- */
- boolean isComponentActive(String componentName) throws MBeanException;
-
- /**
- * Return the named components state.
- *
- * @param componentName The component name.
- * @return The component status.
- */
- int componentState(String componentName);
-
- /**
- * Activate a component that is currently in a DISABLED state.
- *
- * @param componentName The component name.
- */
- void activateComponent(String componentName);
-
- /**
- * Disable a component that is not in an ACTIVE state.
- *
- * @param componentName The component name.
- */
- void deactivateComponent(String componentName);
-
-}
diff --git a/scr/management/src/main/java/org/apache/karaf/scr/management/ServiceComponentRuntimeMBean.java b/scr/management/src/main/java/org/apache/karaf/scr/management/ServiceComponentRuntimeMBean.java
new file mode 100644
index 0000000..a630209
--- /dev/null
+++ b/scr/management/src/main/java/org/apache/karaf/scr/management/ServiceComponentRuntimeMBean.java
@@ -0,0 +1,148 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.scr.management;
+
+import javax.management.openmbean.TabularData;
+
+/**
+ * The management interface for SCR Components.
+ */
+public interface ServiceComponentRuntimeMBean {
+
+ String COMPONENT_BUNDLE_ID = "BundleId";
+ String COMPONENT_NAME = "Name";
+ String COMPONENT_FACTORY = "Factory";
+ String COMPONENT_SCOPE = "Scope";
+ String COMPONENT_IMPLEMENTATION_CLASS = "ImplementationClass";
+ String COMPONENT_DEFAULT_ENABLED = "DefaultEnabled";
+ String COMPONENT_IMMEDIATE = "Immediate";
+ String COMPONENT_SERVICE_INTERFACES = "ServiceInterfaces";
+ String COMPONENT_PROPERTIES = "Properties";
+ String COMPONENT_REFERENCES = "References";
+ String COMPONENT_ACTIVATE = "Activate";
+ String COMPONENT_DEACTIVATE = "Deactivate";
+ String COMPONENT_MODIFIED = "Modified";
+ String COMPONENT_CONFIGURATION_POLICY = "ConfigurationPolicy";
+ String COMPONENT_CONFIGURATION_PID = "ConfigurationId";
+ String COMPONENT_STATE = "State";
+ String COMPONENT_ID = "Id";
+ String COMPONENT_SATISFIED_REFERENCES = "SatisfiedReferences";
+ String COMPONENT_UNSATISFIED_REFERENCES = "UnsatisfiedReferences";
+
+ String PROPERTY_KEY = "Key";
+ String PROPERTY_VALUE = "Value";
+
+ /*
+ itemValues[0] = reference.name;
+ itemValues[1] = reference.interfaceName;
+ itemValues[2] = reference.cardinality;
+ itemValues[3] = reference.policy;
+ itemValues[4] = reference.policyOption;
+ itemValues[5] = reference.target;
+ itemValues[6] = reference.bind;
+ itemValues[7] = reference.unbind;
+ itemValues[8] = reference.updated;
+ itemValues[9] = reference.field;
+ itemValues[10] = reference.fieldOption;
+ itemValues[11] = reference.scope;
+
+ */
+ String REFERENCE_NAME = "Name";
+ String REFERENCE_INTERFACE_NAME = "InterfaceName";
+ String REFERENCE_CARDINALITY = "Cardinality";
+ String REFERENCE_POLICY = "Policy";
+ String REFERENCE_POLICY_OPTION = "PolicyOption";
+ String REFERENCE_TARGET = "Target";
+ String REFERENCE_BIND = "Bind";
+ String REFERENCE_UNBIND = "Unbind";
+ String REFERENCE_UPDATED = "Updated";
+ String REFERENCE_FIELD = "Field";
+ String REFERENCE_FIELD_OPTION = "FieldOption";
+ String REFERENCE_SCOPE = "Scope";
+
+ String REFERENCE_BOUND_SERVICES = "BoundServices";
+
+ /**
+ * The item names in the CompositeData representing a component
+ */
+ String[] COMPONENT_DESCRIPTION = {COMPONENT_BUNDLE_ID, COMPONENT_NAME, COMPONENT_FACTORY,
+ COMPONENT_SCOPE, COMPONENT_IMPLEMENTATION_CLASS, COMPONENT_DEFAULT_ENABLED,
+ COMPONENT_IMMEDIATE, COMPONENT_SERVICE_INTERFACES,
+ COMPONENT_PROPERTIES, COMPONENT_REFERENCES,
+ COMPONENT_ACTIVATE, COMPONENT_DEACTIVATE, COMPONENT_MODIFIED,
+ COMPONENT_CONFIGURATION_POLICY, COMPONENT_CONFIGURATION_PID};
+
+ String[] COMPONENT_CONFIGURATION = {COMPONENT_BUNDLE_ID, COMPONENT_NAME,
+ COMPONENT_STATE, COMPONENT_ID,
+ COMPONENT_PROPERTIES,
+ COMPONENT_SATISFIED_REFERENCES, COMPONENT_UNSATISFIED_REFERENCES
+ };
+
+ String[] PROPERTY = {PROPERTY_KEY, PROPERTY_VALUE};
+
+ String[] REFERENCE = {REFERENCE_NAME, REFERENCE_INTERFACE_NAME,
+ REFERENCE_CARDINALITY, REFERENCE_POLICY,
+ REFERENCE_POLICY_OPTION, REFERENCE_TARGET,
+ REFERENCE_BIND, REFERENCE_UNBIND, REFERENCE_UPDATED,
+ REFERENCE_FIELD, REFERENCE_FIELD_OPTION, REFERENCE_SCOPE};
+
+ String[] SVC_REFERENCE = {REFERENCE_NAME, REFERENCE_TARGET, REFERENCE_BOUND_SERVICES};
+
+ /**
+ * Display a {@link TabularData} with all the component details.
+ *
+ * @return A {@link TabularData} containing all SCR components.
+ */
+ TabularData getComponents();
+
+ /**
+ * Display a {@link TabularData} with all the component configurations details.
+ *
+ * @return A {@link TabularData} containing all SCR components.
+ */
+ TabularData getComponentConfigs();
+
+ /**
+ * Present a {@code String} array of components currently registered with the SCR.
+ *
+ * @return A {@code String[]} containing all SCR components ID.
+ */
+ TabularData getComponentConfigs(long bundleId, String componentName);
+
+ /**
+ * Check if the named component is currently enabled.
+ *
+ * @param componentName The component name.
+ * @return True if the component is ACTIVE, otherwise false.
+ */
+ boolean isComponentEnabled(long bundleId, String componentName);
+
+ /**
+ * Enable a component.
+ *
+ * @param componentName The component name.
+ */
+ void enableComponent(long bundleId, String componentName);
+
+ /**
+ * Disable a component.
+ *
+ * @param componentName The component name.
+ */
+ void disableComponent(long bundleId, String componentName);
+
+}
diff --git a/scr/management/src/main/java/org/apache/karaf/scr/management/codec/JmxComponent.java b/scr/management/src/main/java/org/apache/karaf/scr/management/codec/JmxComponent.java
deleted file mode 100644
index bec4673..0000000
--- a/scr/management/src/main/java/org/apache/karaf/scr/management/codec/JmxComponent.java
+++ /dev/null
@@ -1,146 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.scr.management.codec;
-
-import org.apache.karaf.scr.management.ScrServiceMBean;
-import org.apache.karaf.scr.management.internal.ScrService;
-
-import javax.management.openmbean.CompositeData;
-import javax.management.openmbean.CompositeDataSupport;
-import javax.management.openmbean.CompositeType;
-import javax.management.openmbean.OpenDataException;
-import javax.management.openmbean.OpenType;
-import javax.management.openmbean.SimpleType;
-import javax.management.openmbean.TabularData;
-import javax.management.openmbean.TabularDataSupport;
-import javax.management.openmbean.TabularType;
-import java.util.Arrays;
-
-public class JmxComponent {
-
-
- /**
- * The CompositeType which represents a single component
- */
- public final static CompositeType COMPONENT = createComponentType();
-
- /**
- * The TabularType which represents a list of components
- */
- public final static TabularType COMPONENT_TABLE = createComponentTableType();
-
- private final CompositeData data;
-
- public JmxComponent(ScrService.Component component) {
- try {
- String[] itemNames = ScrServiceMBean.COMPONENT;
- Object[] itemValues = new Object[itemNames.length];
- itemValues[0] = component.getId();
- itemValues[1] = component.getName();
- itemValues[2] = getState(component);
- itemValues[3] = JmxProperty.tableFrom(component.getProperties());
- itemValues[4] = JmxReference.tableFrom(component.getReferences());
- data = new CompositeDataSupport(COMPONENT, itemNames, itemValues);
- } catch (OpenDataException e) {
- throw new IllegalStateException("Cannot form feature open data", e);
- }
- }
-
- public CompositeData asCompositeData() {
- return data;
- }
-
- public static TabularData tableFrom(ScrService.Component... components) {
- return tableFrom(Arrays.asList(components));
- }
-
- public static TabularData tableFrom(Iterable<ScrService.Component> components) {
- TabularDataSupport table = new TabularDataSupport(COMPONENT_TABLE);
- for (ScrService.Component component : components) {
- table.put(new JmxComponent(component).asCompositeData());
- }
- return table;
- }
-
- private static CompositeType createComponentType() {
- try {
- String description = "This type encapsulates Scr references";
- String[] itemNames = ScrServiceMBean.COMPONENT;
- OpenType[] itemTypes = new OpenType[itemNames.length];
- String[] itemDescriptions = new String[itemNames.length];
- itemTypes[0] = SimpleType.LONG;
- itemTypes[1] = SimpleType.STRING;
- itemTypes[2] = SimpleType.STRING;
- itemTypes[3] = JmxProperty.PROPERTY_TABLE;
- itemTypes[4] = JmxReference.REFERENCE_TABLE;
-
- itemDescriptions[0] = "The id of the component";
- itemDescriptions[1] = "The name of the component";
- itemDescriptions[2] = "The state of the component";
- itemDescriptions[3] = "The properties of the component";
- itemDescriptions[4] = "The references of the component";
-
- return new CompositeType("Component", description, itemNames,
- itemDescriptions, itemTypes);
- } catch (OpenDataException e) {
- throw new IllegalStateException("Unable to build component type", e);
- }
- }
-
- private static TabularType createComponentTableType() {
- try {
- return new TabularType("Component", "The table of all components",
- COMPONENT, ScrServiceMBean.COMPONENT);
- } catch (OpenDataException e) {
- throw new IllegalStateException("Unable to build components table type", e);
- }
- }
-
-
- /**
- * Returns a literal for the {@link ScrService.Component} state.
- * @param component The target {@link ScrService.Component}.
- * @return
- */
- private static String getState(ScrService.Component component) {
- switch (component.getState()) {
- case ScrService.Component.STATE_ACTIVE:
- return "Active";
- case ScrService.Component.STATE_ACTIVATING:
- return "Activating";
- case ScrService.Component.STATE_DEACTIVATING:
- return "Deactivating";
- case ScrService.Component.STATE_DISABLED:
- return "Disabled";
- case ScrService.Component.STATE_DISABLING:
- return "Disabling";
- case ScrService.Component.STATE_DISPOSED:
- return "Disposed";
- case ScrService.Component.STATE_DISPOSING:
- return "Disposing";
- case ScrService.Component.STATE_ENABLING:
- return "Enabling";
- case ScrService.Component.STATE_FACTORY:
- return "Factory";
- case ScrService.Component.STATE_REGISTERED:
- return "Registered";
- case ScrService.Component.STATE_UNSATISFIED:
- return "Unsatisfied";
- }
- return "Unknown";
- }
-}
diff --git a/scr/management/src/main/java/org/apache/karaf/scr/management/codec/JmxComponentConfiguration.java b/scr/management/src/main/java/org/apache/karaf/scr/management/codec/JmxComponentConfiguration.java
new file mode 100644
index 0000000..5aa819b
--- /dev/null
+++ b/scr/management/src/main/java/org/apache/karaf/scr/management/codec/JmxComponentConfiguration.java
@@ -0,0 +1,143 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.scr.management.codec;
+
+import org.apache.karaf.scr.management.ServiceComponentRuntimeMBean;
+import org.osgi.service.component.runtime.dto.ComponentConfigurationDTO;
+
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeDataSupport;
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.OpenDataException;
+import javax.management.openmbean.OpenType;
+import javax.management.openmbean.SimpleType;
+import javax.management.openmbean.TabularData;
+import javax.management.openmbean.TabularDataSupport;
+import javax.management.openmbean.TabularType;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.stream.Stream;
+
+public class JmxComponentConfiguration {
+
+
+ /**
+ * The CompositeType which represents a single component
+ */
+ public final static CompositeType COMPONENT_CONFIGURATION = createComponentConfigurationType();
+
+ /**
+ * The TabularType which represents a list of components
+ */
+ public final static TabularType COMPONENT_TABLE = createComponentTableType();
+
+ private final CompositeData data;
+
+ public JmxComponentConfiguration(ComponentConfigurationDTO component) {
+ try {
+ String[] itemNames = ServiceComponentRuntimeMBean.COMPONENT_CONFIGURATION;
+ Object[] itemValues = new Object[itemNames.length];
+ itemValues[0] = component.description.bundle.id;
+ itemValues[1] = component.description.name;
+ itemValues[2] = getState(component);
+ itemValues[3] = component.id;
+ itemValues[4] = JmxProperty.tableFrom(component.properties);
+ itemValues[5] = JmxSvcReference.tableFrom(component.satisfiedReferences);
+ itemValues[6] = JmxSvcReference.tableFrom(component.unsatisfiedReferences);
+ data = new CompositeDataSupport(COMPONENT_CONFIGURATION, itemNames, itemValues);
+ } catch (OpenDataException e) {
+ throw new IllegalStateException("Cannot form feature open data", e);
+ }
+ }
+
+ private String getState(ComponentConfigurationDTO component) {
+ switch (component.state) {
+ case ComponentConfigurationDTO.UNSATISFIED_CONFIGURATION:
+ return "Unsatisfied configuration";
+ case ComponentConfigurationDTO.UNSATISFIED_REFERENCE:
+ return "Unstatisfied reference";
+ case ComponentConfigurationDTO.SATISFIED:
+ return "Statisfied";
+ case ComponentConfigurationDTO.ACTIVE:
+ return "Active";
+ }
+ return "Unknown";
+ }
+
+ public CompositeData asCompositeData() {
+ return data;
+ }
+
+ public static TabularData tableFrom(ComponentConfigurationDTO... components) {
+ return tableFrom(Arrays.asList(components));
+ }
+
+ public static TabularData tableFrom(Collection<ComponentConfigurationDTO> components) {
+ return tableFrom(components.stream());
+ }
+
+ public static TabularData tableFrom(Stream<ComponentConfigurationDTO> components) {
+ return components
+ .map(JmxComponentConfiguration::new)
+ .map(JmxComponentConfiguration::asCompositeData)
+ .collect(
+ () -> new TabularDataSupport(COMPONENT_TABLE),
+ TabularDataSupport::put,
+ TabularDataSupport::putAll
+ );
+ }
+
+ private static CompositeType createComponentConfigurationType() {
+ try {
+ String description = "This type encapsulates Scr references";
+ String[] itemNames = ServiceComponentRuntimeMBean.COMPONENT_CONFIGURATION;
+ OpenType[] itemTypes = new OpenType[itemNames.length];
+ String[] itemDescriptions = new String[itemNames.length];
+ itemTypes[0] = SimpleType.LONG;
+ itemTypes[1] = SimpleType.STRING;
+ itemTypes[2] = SimpleType.STRING;
+ itemTypes[3] = SimpleType.LONG;
+ itemTypes[4] = JmxProperty.PROPERTY_TABLE;
+ itemTypes[5] = JmxSvcReference.SVC_REFERENCE_TABLE;
+ itemTypes[6] = JmxSvcReference.SVC_REFERENCE_TABLE;
+
+ itemDescriptions[0] = "The bundle id of the component";
+ itemDescriptions[1] = "The name of the component";
+ itemDescriptions[2] = "The state of the component";
+ itemDescriptions[3] = "The id of the component";
+ itemDescriptions[4] = "The properties of the component";
+ itemDescriptions[5] = "The references of the component";
+ itemDescriptions[6] = "The references of the component";
+
+ return new CompositeType("Component", description, itemNames,
+ itemDescriptions, itemTypes);
+ } catch (OpenDataException e) {
+ throw new IllegalStateException("Unable to build component type", e);
+ }
+ }
+
+ private static TabularType createComponentTableType() {
+ try {
+ return new TabularType("Configuration", "The table of component configurations",
+ COMPONENT_CONFIGURATION, ServiceComponentRuntimeMBean.COMPONENT_CONFIGURATION);
+ } catch (OpenDataException e) {
+ throw new IllegalStateException("Unable to build components table type", e);
+ }
+ }
+
+
+}
diff --git a/scr/management/src/main/java/org/apache/karaf/scr/management/codec/JmxComponentDescription.java b/scr/management/src/main/java/org/apache/karaf/scr/management/codec/JmxComponentDescription.java
new file mode 100644
index 0000000..3989e50
--- /dev/null
+++ b/scr/management/src/main/java/org/apache/karaf/scr/management/codec/JmxComponentDescription.java
@@ -0,0 +1,145 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.scr.management.codec;
+
+import org.apache.karaf.scr.management.ServiceComponentRuntimeMBean;
+import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO;
+
+import javax.management.openmbean.ArrayType;
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeDataSupport;
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.OpenDataException;
+import javax.management.openmbean.OpenType;
+import javax.management.openmbean.SimpleType;
+import javax.management.openmbean.TabularData;
+import javax.management.openmbean.TabularDataSupport;
+import javax.management.openmbean.TabularType;
+import java.util.Arrays;
+
+public class JmxComponentDescription {
+
+
+ /**
+ * The CompositeType which represents a single component
+ */
+ public final static CompositeType COMPONENT = createComponentType();
+
+ /**
+ * The TabularType which represents a list of components
+ */
+ public final static TabularType COMPONENT_TABLE = createComponentTableType();
+
+ private final CompositeData data;
+
+ public JmxComponentDescription(ComponentDescriptionDTO component) {
+ try {
+ String[] itemNames = ServiceComponentRuntimeMBean.COMPONENT_DESCRIPTION;
+ Object[] itemValues = new Object[itemNames.length];
+ itemValues[0] = component.bundle.id;
+ itemValues[1] = component.name;
+ itemValues[2] = component.factory;
+ itemValues[3] = component.scope;
+ itemValues[4] = component.implementationClass;
+ itemValues[5] = component.defaultEnabled;
+ itemValues[6] = component.immediate;
+ itemValues[7] = component.serviceInterfaces;
+ itemValues[8] = JmxProperty.tableFrom(component.properties);
+ itemValues[9] = JmxReference.tableFrom(component.references);
+ itemValues[10] = component.activate;
+ itemValues[11] = component.deactivate;
+ itemValues[12] = component.modified;
+ itemValues[13] = component.configurationPolicy;
+ itemValues[14] = component.configurationPid;
+ data = new CompositeDataSupport(COMPONENT, itemNames, itemValues);
+ } catch (OpenDataException e) {
+ throw new IllegalStateException("Cannot form feature open data", e);
+ }
+ }
+
+ public CompositeData asCompositeData() {
+ return data;
+ }
+
+ public static TabularData tableFrom(ComponentDescriptionDTO... components) {
+ return tableFrom(Arrays.asList(components));
+ }
+
+ public static TabularData tableFrom(Iterable<ComponentDescriptionDTO> components) {
+ TabularDataSupport table = new TabularDataSupport(COMPONENT_TABLE);
+ for (ComponentDescriptionDTO component : components) {
+ table.put(new JmxComponentDescription(component).asCompositeData());
+ }
+ return table;
+ }
+
+ private static CompositeType createComponentType() {
+ try {
+ String description = "This type encapsulates Scr references";
+ String[] itemNames = ServiceComponentRuntimeMBean.COMPONENT_DESCRIPTION;
+ OpenType[] itemTypes = new OpenType[itemNames.length];
+ String[] itemDescriptions = new String[itemNames.length];
+ itemTypes[0] = SimpleType.LONG;
+ itemTypes[1] = SimpleType.STRING;
+ itemTypes[2] = SimpleType.STRING;
+ itemTypes[3] = SimpleType.STRING;
+ itemTypes[4] = SimpleType.STRING;
+ itemTypes[5] = SimpleType.BOOLEAN;
+ itemTypes[6] = SimpleType.BOOLEAN;
+ itemTypes[7] = new ArrayType<String>(1, SimpleType.STRING);
+ itemTypes[8] = JmxProperty.PROPERTY_TABLE;
+ itemTypes[9] = JmxReference.REFERENCE_TABLE;
+ itemTypes[10] = SimpleType.STRING;
+ itemTypes[11] = SimpleType.STRING;
+ itemTypes[12] = SimpleType.STRING;
+ itemTypes[13] = SimpleType.STRING;
+ itemTypes[14] = new ArrayType<String>(1, SimpleType.STRING);
+
+ itemDescriptions[0] = "The bundle id of the component";
+ itemDescriptions[1] = "The name of the component";
+ itemDescriptions[2] = "factory";
+ itemDescriptions[3] = "scope";
+ itemDescriptions[4] = "implementationClass";
+ itemDescriptions[5] = "defaultEnabled";
+ itemDescriptions[6] = "immediate";
+ itemDescriptions[7] = "serviceInterfaces";
+ itemDescriptions[8] = "properties";
+ itemDescriptions[9] = "references";
+ itemDescriptions[10] = "activate";
+ itemDescriptions[11] = "deactivate";
+ itemDescriptions[12] = "modified";
+ itemDescriptions[13] = "configurationPolicy";
+ itemDescriptions[14] = "configurationPid";
+
+ return new CompositeType("Component", description, itemNames,
+ itemDescriptions, itemTypes);
+ } catch (OpenDataException e) {
+ throw new IllegalStateException("Unable to build component type", e);
+ }
+ }
+
+ private static TabularType createComponentTableType() {
+ try {
+ return new TabularType("ComponentDescription", "The table of all components",
+ COMPONENT, ServiceComponentRuntimeMBean.COMPONENT_DESCRIPTION);
+ } catch (OpenDataException e) {
+ throw new IllegalStateException("Unable to build components table type", e);
+ }
+ }
+
+
+}
diff --git a/scr/management/src/main/java/org/apache/karaf/scr/management/codec/JmxProperty.java b/scr/management/src/main/java/org/apache/karaf/scr/management/codec/JmxProperty.java
index cfb37e0..97beb91 100644
--- a/scr/management/src/main/java/org/apache/karaf/scr/management/codec/JmxProperty.java
+++ b/scr/management/src/main/java/org/apache/karaf/scr/management/codec/JmxProperty.java
@@ -16,7 +16,7 @@
*/
package org.apache.karaf.scr.management.codec;
-import org.apache.karaf.scr.management.ScrServiceMBean;
+import org.apache.karaf.scr.management.ServiceComponentRuntimeMBean;
import javax.management.openmbean.CompositeData;
import javax.management.openmbean.CompositeDataSupport;
@@ -27,8 +27,7 @@
import javax.management.openmbean.TabularData;
import javax.management.openmbean.TabularDataSupport;
import javax.management.openmbean.TabularType;
-import java.util.Dictionary;
-import java.util.Enumeration;
+import java.util.Map;
public class JmxProperty {
@@ -47,7 +46,7 @@
public JmxProperty(String key, String value) {
try {
- String[] itemNames = ScrServiceMBean.PROPERTY;
+ String[] itemNames = ServiceComponentRuntimeMBean.PROPERTY;
Object[] itemValues = new Object[itemNames.length];
itemValues[0] = key;
itemValues[1] = value;
@@ -61,13 +60,12 @@
return data;
}
- public static TabularData tableFrom(Dictionary properties) {
+ public static TabularData tableFrom(Map<String, Object> properties) {
TabularDataSupport table = new TabularDataSupport(PROPERTY_TABLE);
- Enumeration p = properties.keys();
- while (p.hasMoreElements()) {
- Object key = p.nextElement();
- Object value = properties.get(key);
- table.put(new JmxProperty(String.valueOf(key), String.valueOf(value)).asCompositeData());
+ for (Map.Entry<String, Object> e : properties.entrySet()) {
+ String key = e.getKey();
+ Object value = e.getValue();
+ table.put(new JmxProperty(key, String.valueOf(value)).asCompositeData());
}
return table;
}
@@ -75,7 +73,7 @@
private static CompositeType createPropertyType() {
try {
String description = "This type encapsulates Scr properties";
- String[] itemNames = ScrServiceMBean.PROPERTY;
+ String[] itemNames = ServiceComponentRuntimeMBean.PROPERTY;
OpenType[] itemTypes = new OpenType[itemNames.length];
String[] itemDescriptions = new String[itemNames.length];
itemTypes[0] = SimpleType.STRING;
@@ -94,7 +92,7 @@
private static TabularType createPropertyTableType() {
try {
return new TabularType("References", "The table of all properties",
- PROPERTY, new String[] {ScrServiceMBean.PROPERTY_KEY});
+ PROPERTY, new String[] {ServiceComponentRuntimeMBean.PROPERTY_KEY});
} catch (OpenDataException e) {
throw new IllegalStateException("Unable to build properties table type", e);
}
diff --git a/scr/management/src/main/java/org/apache/karaf/scr/management/codec/JmxReference.java b/scr/management/src/main/java/org/apache/karaf/scr/management/codec/JmxReference.java
index deb4334..930b15c 100644
--- a/scr/management/src/main/java/org/apache/karaf/scr/management/codec/JmxReference.java
+++ b/scr/management/src/main/java/org/apache/karaf/scr/management/codec/JmxReference.java
@@ -16,11 +16,9 @@
*/
package org.apache.karaf.scr.management.codec;
-import org.apache.karaf.scr.management.ScrServiceMBean;
-import org.apache.karaf.scr.management.internal.ScrService;
-import org.osgi.framework.Constants;
+import org.apache.karaf.scr.management.ServiceComponentRuntimeMBean;
+import org.osgi.service.component.runtime.dto.ReferenceDTO;
-import javax.management.openmbean.ArrayType;
import javax.management.openmbean.CompositeData;
import javax.management.openmbean.CompositeDataSupport;
import javax.management.openmbean.CompositeType;
@@ -44,18 +42,23 @@
public final static TabularType REFERENCE_TABLE = createReferenceTableType();
private final CompositeData data;
- //String[] COMPONENT = { REFERENCE_NAME, REFERENCE_STATE, REFERENCE_CARDINALITY, REFERENCE_AVAILABILITY, REFERENCE_POLICY, REFERENCE_BOUND_SERVICES};
- public JmxReference(ScrService.Reference reference) {
+ public JmxReference(ReferenceDTO reference) {
try {
- String[] itemNames = ScrServiceMBean.REFERENCE;
+ String[] itemNames = ServiceComponentRuntimeMBean.REFERENCE;
Object[] itemValues = new Object[itemNames.length];
- itemValues[0] = reference.getName();
- itemValues[1] = reference.isSatisfied();
- itemValues[2] = getCardinality(reference);
- itemValues[3] = getAvailability(reference);
- itemValues[4] = getPolicy(reference);
- itemValues[5] = getBoundServices(reference);
+ itemValues[0] = reference.name;
+ itemValues[1] = reference.interfaceName;
+ itemValues[2] = reference.cardinality;
+ itemValues[3] = reference.policy;
+ itemValues[4] = reference.policyOption;
+ itemValues[5] = reference.target;
+ itemValues[6] = reference.bind;
+ itemValues[7] = reference.unbind;
+ itemValues[8] = reference.updated;
+ itemValues[9] = reference.field;
+ itemValues[10] = reference.fieldOption;
+ itemValues[11] = reference.scope;
data = new CompositeDataSupport(REFERENCE, itemNames, itemValues);
} catch (OpenDataException e) {
throw new IllegalStateException("Cannot form feature open data", e);
@@ -66,10 +69,10 @@
return data;
}
- public static TabularData tableFrom(ScrService.Reference... references) {
+ public static TabularData tableFrom(ReferenceDTO[] references) {
TabularDataSupport table = new TabularDataSupport(REFERENCE_TABLE);
if (references != null) {
- for (ScrService.Reference reference : references) {
+ for (ReferenceDTO reference : references) {
table.put(new JmxReference(reference).asCompositeData());
}
}
@@ -79,22 +82,34 @@
private static CompositeType createReferenceType() {
try {
String description = "This type encapsulates Scr references";
- String[] itemNames = ScrServiceMBean.REFERENCE;
+ String[] itemNames = ServiceComponentRuntimeMBean.REFERENCE;
OpenType[] itemTypes = new OpenType[itemNames.length];
String[] itemDescriptions = new String[itemNames.length];
itemTypes[0] = SimpleType.STRING;
- itemTypes[1] = SimpleType.BOOLEAN;
+ itemTypes[1] = SimpleType.STRING;
itemTypes[2] = SimpleType.STRING;
itemTypes[3] = SimpleType.STRING;
itemTypes[4] = SimpleType.STRING;
- itemTypes[5] = new ArrayType(1, SimpleType.STRING);
+ itemTypes[5] = SimpleType.STRING;
+ itemTypes[6] = SimpleType.STRING;
+ itemTypes[7] = SimpleType.STRING;
+ itemTypes[8] = SimpleType.STRING;
+ itemTypes[9] = SimpleType.STRING;
+ itemTypes[10] = SimpleType.STRING;
+ itemTypes[11] = SimpleType.STRING;
itemDescriptions[0] = "The name of the reference";
- itemDescriptions[1] = "The state of the reference";
+ itemDescriptions[1] = "The interface name of the reference";
itemDescriptions[2] = "The cardinality of the reference";
- itemDescriptions[3] = "The availability of the reference";
- itemDescriptions[4] = "The policy of the reference";
- itemDescriptions[5] = "The bound services";
+ itemDescriptions[3] = "The policy of the reference";
+ itemDescriptions[4] = "The policy option of the reference";
+ itemDescriptions[5] = "The target";
+ itemDescriptions[6] = "The bind";
+ itemDescriptions[7] = "The unbind";
+ itemDescriptions[8] = "The updated";
+ itemDescriptions[9] = "The field";
+ itemDescriptions[10] = "The field option";
+ itemDescriptions[11] = "The scope";
return new CompositeType("Reference", description, itemNames,
itemDescriptions, itemTypes);
@@ -106,66 +121,11 @@
private static TabularType createReferenceTableType() {
try {
return new TabularType("References", "The table of all references",
- REFERENCE, new String[] {ScrServiceMBean.REFERENCE_NAME});
+ REFERENCE, new String[] {ServiceComponentRuntimeMBean.REFERENCE_NAME});
} catch (OpenDataException e) {
throw new IllegalStateException("Unable to build references table type", e);
}
}
- /**
- * Returns a literal for the {@link ScrService.Reference} cardinality.
- * @param reference The target {@link ScrService.Reference}.
- * @return "Multiple" or "Single".
- */
- private static String getCardinality(ScrService.Reference reference) {
- if (reference.isMultiple()) {
- return ScrServiceMBean.REFERENCE_CARDINALITY_MULTIPLE;
- } else {
- return ScrServiceMBean.REFERENCE_CARDINALITY_SINGLE;
- }
- }
-
- /**
- * Returns a literal for the {@link ScrService.Reference} availability.
- * @param reference The target {@link ScrService.Reference}.
- * @return "Mandatory" or "Optional".
- */
- private static String getAvailability(ScrService.Reference reference) {
- if (reference.isOptional()) {
- return ScrServiceMBean.REFERENCE_AVAILABILITY_OPTIONAL;
- } else {
- return ScrServiceMBean.REFERENCE_AVAILABILITY_MANDATORY;
- }
- }
-
- /**
- * Returns a literal for the {@link ScrService.Reference} policy.
- * @param reference The target {@link ScrService.Reference}.
- * @return "Static" or "Dynamic".
- */
- private static String getPolicy(ScrService.Reference reference) {
- if (reference.isStatic()) {
- return ScrServiceMBean.REFERENCE_POLICY_STATIC;
- } else {
- return ScrServiceMBean.REFERENCE_POLICY_DYNAMIC;
- }
- }
-
- /**
- * Returns The bound service ids.
- * @param reference The target {@link ScrService.Reference}.
- * @return
- */
- private static String[] getBoundServices(ScrService.Reference reference) {
- if (reference.getBoundServiceReferences() == null || reference.getBoundServiceReferences().length == 0) {
- return new String[0];
- } else {
- String[] ids = new String[reference.getBoundServiceReferences().length];
- for (int i=0; i < reference.getBoundServiceReferences().length; i++) {
- ids[i] = String.valueOf(reference.getBoundServiceReferences()[i].getProperty(Constants.SERVICE_ID));
- }
- return ids;
- }
- }
}
diff --git a/scr/management/src/main/java/org/apache/karaf/scr/management/codec/JmxSvcReference.java b/scr/management/src/main/java/org/apache/karaf/scr/management/codec/JmxSvcReference.java
new file mode 100644
index 0000000..d5d5a50
--- /dev/null
+++ b/scr/management/src/main/java/org/apache/karaf/scr/management/codec/JmxSvcReference.java
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.scr.management.codec;
+
+import org.apache.karaf.scr.management.ServiceComponentRuntimeMBean;
+import org.osgi.framework.dto.ServiceReferenceDTO;
+import org.osgi.service.component.runtime.dto.SatisfiedReferenceDTO;
+import org.osgi.service.component.runtime.dto.UnsatisfiedReferenceDTO;
+
+import javax.management.openmbean.ArrayType;
+import javax.management.openmbean.CompositeData;
+import javax.management.openmbean.CompositeDataSupport;
+import javax.management.openmbean.CompositeType;
+import javax.management.openmbean.OpenDataException;
+import javax.management.openmbean.OpenType;
+import javax.management.openmbean.SimpleType;
+import javax.management.openmbean.TabularData;
+import javax.management.openmbean.TabularDataSupport;
+import javax.management.openmbean.TabularType;
+
+public class JmxSvcReference {
+
+ /**
+ * The CompositeType which represents a single reference
+ */
+ public final static CompositeType SVC_REFERENCE = createReferenceType();
+
+ /**
+ * The TabularType which represents a list of references
+ */
+ public final static TabularType SVC_REFERENCE_TABLE = createReferenceTableType();
+
+ private final CompositeData data;
+ //String[] COMPONENT_CONFIGURATION = { REFERENCE_NAME, REFERENCE_STATE, REFERENCE_CARDINALITY, REFERENCE_AVAILABILITY, REFERENCE_POLICY, REFERENCE_BOUND_SERVICES};
+
+ public JmxSvcReference(SatisfiedReferenceDTO reference) {
+ try {
+ String[] itemNames = ServiceComponentRuntimeMBean.SVC_REFERENCE;
+ Object[] itemValues = new Object[itemNames.length];
+ itemValues[0] = reference.name;
+ itemValues[1] = reference.target;
+ itemValues[2] = getBoundServices(reference.boundServices);
+ data = new CompositeDataSupport(SVC_REFERENCE, itemNames, itemValues);
+ } catch (OpenDataException e) {
+ throw new IllegalStateException("Cannot form feature open data", e);
+ }
+ }
+
+ public JmxSvcReference(UnsatisfiedReferenceDTO reference) {
+ try {
+ String[] itemNames = ServiceComponentRuntimeMBean.SVC_REFERENCE;
+ Object[] itemValues = new Object[itemNames.length];
+ itemValues[0] = reference.name;
+ itemValues[1] = reference.target;
+ itemValues[2] = getBoundServices(reference.targetServices);
+ data = new CompositeDataSupport(SVC_REFERENCE, itemNames, itemValues);
+ } catch (OpenDataException e) {
+ throw new IllegalStateException("Cannot form feature open data", e);
+ }
+ }
+
+ public CompositeData asCompositeData() {
+ return data;
+ }
+
+ public static TabularData tableFrom(SatisfiedReferenceDTO[] references) {
+ TabularDataSupport table = new TabularDataSupport(SVC_REFERENCE_TABLE);
+ if (references != null) {
+ for (SatisfiedReferenceDTO reference : references) {
+ table.put(new JmxSvcReference(reference).asCompositeData());
+ }
+ }
+ return table;
+ }
+
+ public static TabularData tableFrom(UnsatisfiedReferenceDTO[] references) {
+ TabularDataSupport table = new TabularDataSupport(SVC_REFERENCE_TABLE);
+ if (references != null) {
+ for (UnsatisfiedReferenceDTO reference : references) {
+ table.put(new JmxSvcReference(reference).asCompositeData());
+ }
+ }
+ return table;
+ }
+
+ private static CompositeType createReferenceType() {
+ try {
+ String description = "This type encapsulates Scr references";
+ String[] itemNames = ServiceComponentRuntimeMBean.SVC_REFERENCE;
+ OpenType[] itemTypes = new OpenType[itemNames.length];
+ String[] itemDescriptions = new String[itemNames.length];
+ itemTypes[0] = SimpleType.STRING;
+ itemTypes[1] = SimpleType.STRING;
+ itemTypes[2] = new ArrayType<String>(1, SimpleType.LONG);
+
+ itemDescriptions[0] = "The name of the reference";
+ itemDescriptions[1] = "The target of the reference";
+ itemDescriptions[2] = "The bound services";
+
+ return new CompositeType("Reference", description, itemNames,
+ itemDescriptions, itemTypes);
+ } catch (OpenDataException e) {
+ throw new IllegalStateException("Unable to build reference type", e);
+ }
+ }
+
+ private static TabularType createReferenceTableType() {
+ try {
+ return new TabularType("References", "The table of all references",
+ SVC_REFERENCE, new String[] {ServiceComponentRuntimeMBean.REFERENCE_NAME});
+ } catch (OpenDataException e) {
+ throw new IllegalStateException("Unable to build references table type", e);
+ }
+ }
+
+
+ /**
+ * Returns The bound service ids.
+ * @param references The target {@link ServiceReferenceDTO}[].
+ * @return
+ */
+ private static Long[] getBoundServices(ServiceReferenceDTO[] references) {
+ if (references == null || references.length == 0) {
+ return new Long[0];
+ } else {
+ Long[] ids = new Long[references.length];
+ for (int i=0; i < references.length; i++) {
+ ids[i] = references[i].id;
+ }
+ return ids;
+ }
+ }
+}
diff --git a/scr/management/src/main/java/org/apache/karaf/scr/management/internal/ScrService.java b/scr/management/src/main/java/org/apache/karaf/scr/management/internal/ScrService.java
deleted file mode 100644
index 0d8d5b5..0000000
--- a/scr/management/src/main/java/org/apache/karaf/scr/management/internal/ScrService.java
+++ /dev/null
@@ -1,507 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.karaf.scr.management.internal;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Dictionary;
-import java.util.Hashtable;
-import java.util.List;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Constants;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.dto.ServiceReferenceDTO;
-import org.osgi.service.component.ComponentInstance;
-import org.osgi.service.component.runtime.ServiceComponentRuntime;
-import org.osgi.service.component.runtime.dto.ComponentConfigurationDTO;
-import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO;
-import org.osgi.service.component.runtime.dto.ReferenceDTO;
-import org.osgi.service.component.runtime.dto.SatisfiedReferenceDTO;
-
-public class ScrService
-{
-
- private final BundleContext context;
- private final ServiceComponentRuntime runtime;
-
-
- public ScrService(BundleContext context, final ServiceComponentRuntime runtime)
- {
- // we always use the system bundle to avoid problems if subsystems etc.
- // are used and the SCR implemented extends those "invisible" bundles
- this.context = context.getBundle(0).getBundleContext();
- this.runtime = runtime;
- }
-
-
- // ScrService
-
- public Component[] getComponents()
- {
- List<Component> result = new ArrayList<>();
-
- final Collection<ComponentDescriptionDTO> descriptions = this.runtime.getComponentDescriptionDTOs();
- for(final ComponentDescriptionDTO descDTO : descriptions )
- {
- final Collection<ComponentConfigurationDTO> configs = this.runtime.getComponentConfigurationDTOs(descDTO);
- ComponentConfigurationDTO configDTO = null;
- if ( !configs.isEmpty() )
- {
- configDTO = configs.iterator().next();
- }
- result.add(new Component(this.context, this.runtime, descDTO, configDTO));
- }
-
- return result.toArray( new Component[result.size()] );
- }
-
-
- public Component[] getComponents(final String componentName )
- {
- List<Component> result = new ArrayList<Component>();
-
- final Collection<ComponentDescriptionDTO> descriptions = this.runtime.getComponentDescriptionDTOs();
- for(final ComponentDescriptionDTO descDTO : descriptions )
- {
- if ( descDTO.name.equals(componentName) ) {
- final Collection<ComponentConfigurationDTO> configs = this.runtime.getComponentConfigurationDTOs(descDTO);
- ComponentConfigurationDTO configDTO = null;
- if ( !configs.isEmpty() )
- {
- configDTO = configs.iterator().next();
- }
- result.add(new Component(this.context, this.runtime, descDTO, configDTO));
- }
- }
-
- return result.isEmpty() ? null : result.toArray( new Component[result.size()] );
- }
-
-
- public static final class Component
- {
- /**
- * The Component has just been created and is still disabled or it has
- * been disabled by calling the {@link #disable()} method (value is 1).
- */
- public static final int STATE_DISABLED = 1;
-
- /**
- * The Component is being enabled (value is 512). After the component has
- * been enabled it enters the {@link #STATE_UNSATISFIED} state.
- * @since 1.2
- * @deprecated since 1.8.0
- */
- @Deprecated
- public static final int STATE_ENABLING = 512;
-
- /**
- * The Component has been enabled and is now going to be activated (value
- * is 2).
- * @deprecated as of version 1.2 the enabled state is collapsed into the
- * {@link #STATE_UNSATISFIED} state. This status code is never returned
- * from the {@link #getState()} method.
- */
- @Deprecated
- public static final int STATE_ENABLED = 2;
-
- /**
- * The Component activation failed because any dependency is not satisfied
- * (value is 4).
- */
- public static final int STATE_UNSATISFIED = 4;
-
- /**
- * The Component is currently being activated either because it has been
- * enabled or because any dependency which was previously unsatisfied has
- * become satisfied (value is 8).
- * @deprecated since 1.8.0 transient states are no longer used
- */
- @Deprecated
- public static final int STATE_ACTIVATING = 8;
-
- /**
- * The Component has successfully been activated and is fully functional
- * (value is 16). This is the state of immediate components after
- * successful activation. Delayed and Service Factory Components enter
- * this state when the service instance has actually been instantiated because
- * the service has been acquired.
- */
- public static final int STATE_ACTIVE = 16;
-
- /**
- * The Component has successfully been activated but is a Delayed or Service
- * Factory Component pending instantiation on first use (value is 32).
- */
- public static final int STATE_REGISTERED = 32;
-
- /**
- * The Component is a Component Factory ready to create Component instances
- * with the <code>ComponentFactory.newInstance(Dictionary)</code> method
- * or (if enabled with the <code>ds.factory.enabled</code> configuration) to
- * manage Component instances from configuration data received from the
- * Configuration Admin Service (value is 64).
- */
- public static final int STATE_FACTORY = 64;
-
- /**
- * The Component is being deactivated either because it is being disabled
- * or because a dependency is not satisfied any more (value is 128). After
- * deactivation the Component enters the {@link #STATE_UNSATISFIED} state.
- * @deprecated since 1.8.0 transient states are no longer used
- */
- @Deprecated
- public static final int STATE_DEACTIVATING = 128;
-
- /**
- * The Component is being disabled (value is 1024). After the component has
- * been disabled it enters the {@link #STATE_DISABLED} state.
- * @since 1.2
- * @deprecated since 1.8.0 transient states are no longer used
- */
- @Deprecated
- public static final int STATE_DISABLING = 1024;
-
- /**
- * The Component is being disposed off (value is 2048). After the component
- * has been disposed off it enters the {@link #STATE_DESTROYED} state.
- * @since 1.2
- * @deprecated since 1.8.0 transient states are no longer used
- */
- @Deprecated
- public static final int STATE_DISPOSING = 2048;
-
- /**
- * The Component has been destroyed and cannot be used any more (value is
- * 256). This state is only used when the bundle declaring the component
- * is being stopped and all components have to be removed.
- * @deprecated as of version 1.2 this constant has been renamed to
- * {@link #STATE_DISPOSED}.
- */
- @Deprecated
- public static final int STATE_DESTROYED = 256;
-
- /**
- * The Component has been disposed off and cannot be used any more (value is
- * 256). This state is used when the bundle declaring the component
- * is being stopped and all components have to be removed. This status is
- * also the final status of a component after the
- * <code>ComponentInstance.dispose()</code> method has been called.
- * @since 1.2
- */
- public static final int STATE_DISPOSED = 256;
-
- private final ComponentDescriptionDTO description;
-
- private final ComponentConfigurationDTO configuration;
-
- private final BundleContext bundleContext;
-
- private final ServiceComponentRuntime runtime;
-
- public Component(final BundleContext bundleContext,
- final ServiceComponentRuntime runtime,
- final ComponentDescriptionDTO description,
- final ComponentConfigurationDTO configuration)
- {
- this.bundleContext = bundleContext;
- this.description = description;
- this.configuration = configuration;
- this.runtime = runtime;
- }
-
- public long getId()
- {
- return configuration != null ? configuration.id : -1;
- }
-
- public String getName()
- {
- return description.name;
- }
-
- public int getState()
- {
- if ( configuration == null )
- {
- return STATE_UNSATISFIED; // TODO Check!
- }
- final int s = configuration.state;
- switch ( s )
- {
- case ComponentConfigurationDTO.ACTIVE : return STATE_ACTIVE;
- case ComponentConfigurationDTO.SATISFIED : return STATE_ENABLED;
- case ComponentConfigurationDTO.UNSATISFIED_CONFIGURATION : return STATE_UNSATISFIED;
- case ComponentConfigurationDTO.UNSATISFIED_REFERENCE : return STATE_UNSATISFIED;
- default: // satisfied
- return STATE_ENABLED;
- }
- }
-
- public Bundle getBundle()
- {
- return this.bundleContext.getBundle(this.description.bundle.id);
- }
-
- public String getFactory()
- {
- return this.description.factory;
- }
-
- public boolean isServiceFactory()
- {
- return !"singleton".equals(this.description.scope);
- }
-
- public String getClassName()
- {
- return this.description.implementationClass;
- }
-
- public boolean isDefaultEnabled()
- {
- return this.description.defaultEnabled;
- }
-
- public boolean isImmediate()
- {
- return this.description.immediate;
- }
-
- public String[] getServices()
- {
- return this.description.serviceInterfaces.length == 0 ? null : this.description.serviceInterfaces;
- }
-
- public Dictionary getProperties()
- {
- return new Hashtable<>(this.description.properties);
- }
-
- public Reference[] getReferences()
- {
- if ( this.configuration == null )
- {
- return null;
- }
-
- final List<Reference> result = new ArrayList<Reference>();
- for(final ReferenceDTO dto : this.description.references)
- {
- SatisfiedReferenceDTO sRef = null;
- for(final SatisfiedReferenceDTO r : this.configuration.satisfiedReferences)
- {
- if ( r.name.equals(dto.name) )
- {
- sRef = r;
- break;
- }
- }
- result.add(new Reference(this.bundleContext, dto, sRef));
- }
-
- if ( result.isEmpty() )
- {
- return null;
- }
-
- return result.toArray(new Reference[result.size()]);
- }
-
- public ComponentInstance getComponentInstance()
- {
- // returning null as we should have never returned this in the first place
- return null;
- }
-
- public String getActivate()
- {
- return this.description.activate;
- }
-
- public boolean isActivateDeclared()
- {
- return this.description.activate != null;
- }
-
- public String getDeactivate()
- {
- return this.description.deactivate;
- }
-
- public boolean isDeactivateDeclared()
- {
- return this.description.deactivate != null;
- }
-
- public String getModified()
- {
- return this.description.modified;
- }
-
- public String getConfigurationPolicy()
- {
- return this.description.configurationPolicy;
- }
-
- public String getConfigurationPid()
- {
- final String[] pids = this.description.configurationPid;
- return pids[0];
- }
-
- public boolean isConfigurationPidDeclared()
- {
- return true;
- }
-
- public void enable()
- {
- // noop as the old model was broken
- }
-
- public void disable()
- {
- // noop as the old model was broken
- }
- }
-
- public static final class Reference
- {
- // constant for option single reference - 0..1
- private static final String CARDINALITY_0_1 = "0..1";
-
- // constant for option multiple reference - 0..n
- private static final String CARDINALITY_0_N = "0..n";
-
- // constant for required multiple reference - 1..n
- private static final String CARDINALITY_1_N = "1..n";
-
- // constant for static policy
- private static final String POLICY_STATIC = "static";
-
- // constant for reluctant policy option
- private static final String POLICY_OPTION_RELUCTANT = "reluctant";
-
- private final ReferenceDTO dto;
-
- private final SatisfiedReferenceDTO satisfiedDTO;
-
- private final BundleContext bundleContext;
-
- public Reference(
- final BundleContext bundleContext,
- final ReferenceDTO dto,
- final SatisfiedReferenceDTO satisfied)
- {
- this.bundleContext = bundleContext;
- this.dto = dto;
- this.satisfiedDTO = satisfied;
- }
-
- public String getName()
- {
- return dto.name;
- }
-
- public String getServiceName()
- {
- return dto.interfaceName;
- }
-
- public ServiceReference[] getServiceReferences()
- {
- if ( this.satisfiedDTO == null )
- {
- return null;
- }
- final List<ServiceReference<?>> refs = new ArrayList<ServiceReference<?>>();
- for(ServiceReferenceDTO dto : this.satisfiedDTO.boundServices)
- {
- try
- {
- final ServiceReference<?>[] serviceRefs = this.bundleContext.getServiceReferences((String)null,
- "(" + Constants.SERVICE_ID + "=" + String.valueOf(dto.id) + ")");
- if ( serviceRefs != null && serviceRefs.length > 0 )
- {
- refs.add(serviceRefs[0]);
- }
- }
- catch ( final InvalidSyntaxException ise)
- {
- // ignore
- }
- }
- return refs.toArray(new ServiceReference<?>[refs.size()]);
- }
-
- public ServiceReference<?>[] getBoundServiceReferences()
- {
- return this.getServiceReferences();
- }
-
- public boolean isSatisfied()
- {
- return this.satisfiedDTO != null;
- }
-
- public boolean isOptional()
- {
- return CARDINALITY_0_1.equals(dto.cardinality) || CARDINALITY_0_N.equals(dto.cardinality);
- }
-
- public boolean isMultiple()
- {
- return CARDINALITY_1_N.equals(dto.cardinality) || CARDINALITY_0_N.equals(dto.cardinality);
- }
-
- public boolean isStatic()
- {
- return POLICY_STATIC.equals(dto.policy);
- }
-
- public boolean isReluctant()
- {
- return POLICY_OPTION_RELUCTANT.equals(dto.policyOption);
- }
-
- public String getTarget()
- {
- return this.dto.target;
- }
-
- public String getBindMethodName()
- {
- return this.dto.bind;
- }
-
- public String getUnbindMethodName()
- {
- return this.dto.unbind;
- }
-
- public String getUpdatedMethodName()
- {
- return this.dto.unbind;
- }
- }
-}
diff --git a/scr/management/src/main/java/org/apache/karaf/scr/management/internal/ScrServiceMBeanImpl.java b/scr/management/src/main/java/org/apache/karaf/scr/management/internal/ScrServiceMBeanImpl.java
deleted file mode 100644
index 625e006..0000000
--- a/scr/management/src/main/java/org/apache/karaf/scr/management/internal/ScrServiceMBeanImpl.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.karaf.scr.management.internal;
-
-import org.apache.karaf.scr.management.ScrServiceMBean;
-import org.apache.karaf.scr.management.codec.JmxComponent;
-import org.osgi.framework.FrameworkUtil;
-import org.osgi.service.component.annotations.Activate;
-import org.osgi.service.component.annotations.Component;
-import org.osgi.service.component.annotations.Deactivate;
-import org.osgi.service.component.annotations.Reference;
-import org.osgi.service.component.runtime.ServiceComponentRuntime;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import javax.management.MBeanException;
-import javax.management.MBeanServer;
-import javax.management.NotCompliantMBeanException;
-import javax.management.ObjectName;
-import javax.management.StandardMBean;
-import javax.management.openmbean.TabularData;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.concurrent.locks.ReadWriteLock;
-import java.util.concurrent.locks.ReentrantReadWriteLock;
-
-@Component(
- name = ScrServiceMBeanImpl.COMPONENT_NAME,
- enabled = true,
- immediate = true,
- properties = {"org/apache/karaf/scr/management/internal/ScrServiceMBeanImpl.properties"})
-public class ScrServiceMBeanImpl extends StandardMBean implements ScrServiceMBean {
-
- public static final String OBJECT_NAME = "org.apache.karaf:type=scr,name=" + System.getProperty("karaf.name", "root");
-
- public static final String COMPONENT_NAME = "ScrServiceMBean";
-
- public static final String COMPONENT_LABEL = "Apache Karaf SCR Service MBean";
-
- private static final Logger LOGGER = LoggerFactory.getLogger(ScrServiceMBeanImpl.class);
-
- private MBeanServer mBeanServer;
-
- private ScrService scrService;
-
- private ReadWriteLock lock = new ReentrantReadWriteLock();
-
- /**
- * Creates new Declarative Services MBean.
- *
- * @throws NotCompliantMBeanException If the MBean is not a valid MBean.
- */
- public ScrServiceMBeanImpl() throws NotCompliantMBeanException {
- super(ScrServiceMBean.class);
- }
-
- /**
- * Service component activation call back. Called when all dependencies are satisfied.
- *
- * @throws Exception If the activation fails.
- */
- @Activate
- public void activate() throws Exception {
- LOGGER.info("Activating the " + COMPONENT_LABEL);
- Map<Object, String> mbeans = new HashMap<>();
- mbeans.put(this, "org.apache.karaf:type=scr,name=${karaf.name}");
- try {
- lock.writeLock().lock();
- if (mBeanServer != null) {
- mBeanServer.registerMBean(this, new ObjectName(OBJECT_NAME));
- }
- } catch (Exception e) {
- LOGGER.error("Exception registering the SCR Management MBean: " + e.getLocalizedMessage(), e);
- } finally {
- lock.writeLock().unlock();
- }
- }
-
- /**
- * Service component deactivation call back. Called after the component is in an active
- * state when any dependencies become unsatisfied.
- *
- * @throws Exception If the deactivation fails.
- */
- @Deactivate
- public void deactivate() throws Exception {
- LOGGER.info("Deactivating the " + COMPONENT_LABEL);
- try {
- lock.writeLock().lock();
- if (mBeanServer != null) {
- mBeanServer.unregisterMBean(new ObjectName(OBJECT_NAME));
- }
- } finally {
- lock.writeLock().unlock();
- }
- }
-
- @Override
- public TabularData getComponents() {
- try {
- return JmxComponent.tableFrom(scrService.getComponents());
- } catch (Exception e) {
- e.printStackTrace(System.out);
- return null;
- }
- }
-
- public String[] listComponents() {
- ScrService.Component[] components = scrService.getComponents();
- String[] componentNames = new String[components.length];
- for (int i = 0; i < componentNames.length; i++) {
- componentNames[i] = components[i].getName();
- }
- return componentNames;
- }
-
- public boolean isComponentActive(String componentName) throws MBeanException {
- try {
- return componentState(componentName) == ScrService.Component.STATE_ACTIVE;
- } catch (Exception e) {
- throw new MBeanException(null, e.toString());
- }
- }
-
- public int componentState(String componentName) {
- int state = -1;
- final ScrService.Component component = findComponent(componentName);
- if (component != null)
- state = component.getState();
- else
- LOGGER.warn("No component found for name: " + componentName);
- return state;
- }
-
- public void activateComponent(String componentName) {
- final ScrService.Component component = findComponent(componentName);
- if (component != null)
- component.enable();
- else
- LOGGER.warn("No component found for name: " + componentName);
- }
-
- public void deactivateComponent(String componentName) {
- final ScrService.Component component = findComponent(componentName);
- if (component != null)
- component.disable();
- else
- LOGGER.warn("No component found for name: " + componentName);
- }
-
- private ScrService.Component findComponent(String componentName) {
- ScrService.Component answer = null;
- if (scrService.getComponents(componentName) != null) {
- ScrService.Component[] components = scrService.getComponents(componentName);
- for (ScrService.Component component : components) {
- answer = component;
- }
- }
- return answer;
- }
-
- @Reference
- public void setmBeanServer(MBeanServer mBeanServer) {
- this.mBeanServer = mBeanServer;
- }
-
- public void unsetmBeanServer(MBeanServer mBeanServer) {
- this.mBeanServer = null;
- }
-
- @Reference
- public void setScrService(ServiceComponentRuntime scrService) {
- this.scrService = new ScrService(FrameworkUtil.getBundle(getClass()).getBundleContext(), scrService);
- }
-
- public void unsetScrService(ServiceComponentRuntime scrService) {
- this.scrService = null;
- }
-
-}
diff --git a/scr/management/src/main/java/org/apache/karaf/scr/management/internal/ServiceComponentRuntimeMBeanImpl.java b/scr/management/src/main/java/org/apache/karaf/scr/management/internal/ServiceComponentRuntimeMBeanImpl.java
new file mode 100644
index 0000000..95281e8
--- /dev/null
+++ b/scr/management/src/main/java/org/apache/karaf/scr/management/internal/ServiceComponentRuntimeMBeanImpl.java
@@ -0,0 +1,177 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.karaf.scr.management.internal;
+
+import org.apache.karaf.scr.management.ServiceComponentRuntimeMBean;
+import org.apache.karaf.scr.management.codec.JmxComponentConfiguration;
+import org.apache.karaf.scr.management.codec.JmxComponentDescription;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.service.component.annotations.Activate;
+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.runtime.ServiceComponentRuntime;
+import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import javax.management.MBeanServer;
+import javax.management.NotCompliantMBeanException;
+import javax.management.ObjectName;
+import javax.management.StandardMBean;
+import javax.management.openmbean.TabularData;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+@Component(
+ name = ServiceComponentRuntimeMBeanImpl.COMPONENT_NAME,
+ enabled = true,
+ immediate = true,
+ properties = {"org/apache/karaf/scr/management/internal/ServiceComponentRuntimeMBeanImpl.properties"})
+public class ServiceComponentRuntimeMBeanImpl extends StandardMBean implements ServiceComponentRuntimeMBean {
+
+ public static final String OBJECT_NAME = "org.apache.karaf:type=scr,name=" + System.getProperty("karaf.name", "root");
+
+ public static final String COMPONENT_NAME = "ServiceComponentRuntimeMBean";
+
+ public static final String COMPONENT_LABEL = "Apache Karaf ServiceComponentRuntime MBean";
+
+ private static final Logger LOGGER = LoggerFactory.getLogger(ServiceComponentRuntimeMBeanImpl.class);
+
+ private MBeanServer mBeanServer;
+
+ private BundleContext context;
+
+ private ServiceComponentRuntime scrService;
+
+ private ReadWriteLock lock = new ReentrantReadWriteLock();
+
+ /**
+ * Creates new Declarative Services MBean.
+ *
+ * @throws NotCompliantMBeanException If the MBean is not a valid MBean.
+ */
+ public ServiceComponentRuntimeMBeanImpl() throws NotCompliantMBeanException {
+ super(ServiceComponentRuntimeMBean.class);
+ }
+
+ /**
+ * Service component activation call back. Called when all dependencies are satisfied.
+ *
+ * @throws Exception If the activation fails.
+ */
+ @Activate
+ public void activate(BundleContext context) throws Exception {
+ LOGGER.info("Activating the " + COMPONENT_LABEL);
+ Map<Object, String> mbeans = new HashMap<>();
+ mbeans.put(this, "org.apache.karaf:type=scr,name=${karaf.name}");
+ try {
+ lock.writeLock().lock();
+ this.context = context;
+ if (mBeanServer != null) {
+ mBeanServer.registerMBean(this, new ObjectName(OBJECT_NAME));
+ }
+ } catch (Exception e) {
+ LOGGER.error("Exception registering the SCR Management MBean: " + e.getLocalizedMessage(), e);
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ /**
+ * Service component deactivation call back. Called after the component is in an active
+ * state when any dependencies become unsatisfied.
+ *
+ * @throws Exception If the deactivation fails.
+ */
+ @Deactivate
+ public void deactivate() throws Exception {
+ LOGGER.info("Deactivating the " + COMPONENT_LABEL);
+ try {
+ lock.writeLock().lock();
+ if (mBeanServer != null) {
+ mBeanServer.unregisterMBean(new ObjectName(OBJECT_NAME));
+ }
+ } finally {
+ lock.writeLock().unlock();
+ }
+ }
+
+ @Override
+ public TabularData getComponents() {
+ return JmxComponentDescription.tableFrom(scrService.getComponentDescriptionDTOs());
+ }
+
+ @Override
+ public TabularData getComponentConfigs() {
+ return JmxComponentConfiguration.tableFrom(
+ scrService.getComponentDescriptionDTOs().stream()
+ .map(c -> scrService.getComponentConfigurationDTOs(c))
+ .flatMap(Collection::stream));
+ }
+
+ @Override
+ public TabularData getComponentConfigs(long bundleId, String componentName) {
+ return JmxComponentConfiguration.tableFrom(
+ scrService.getComponentConfigurationDTOs(
+ findComponent(bundleId, componentName)));
+ }
+
+ public boolean isComponentEnabled(long bundleId, String componentName) {
+ return scrService.isComponentEnabled(findComponent(bundleId, componentName));
+ }
+
+ public void enableComponent(long bundleId, String componentName) {
+ scrService.enableComponent(findComponent(bundleId, componentName));
+ }
+
+ public void disableComponent(long bundleId, String componentName) {
+ scrService.disableComponent(findComponent(bundleId, componentName));
+ }
+
+ private ComponentDescriptionDTO findComponent(long bundleId, String componentName) {
+ Bundle bundle = context.getBundle(bundleId);
+ if (bundle != null) {
+ return scrService.getComponentDescriptionDTO(bundle, componentName);
+ } else {
+ throw new IllegalArgumentException("No component found for name: " + componentName);
+ }
+ }
+
+ @Reference
+ public void setmBeanServer(MBeanServer mBeanServer) {
+ this.mBeanServer = mBeanServer;
+ }
+
+ public void unsetmBeanServer(MBeanServer mBeanServer) {
+ this.mBeanServer = null;
+ }
+
+ @Reference
+ public void setScrService(ServiceComponentRuntime scrService) {
+ this.scrService = scrService;
+ }
+
+ public void unsetScrService(ServiceComponentRuntime scrService) {
+ this.scrService = null;
+ }
+
+}
diff --git a/scr/management/src/main/resources/org/apache/karaf/scr/management/internal/ScrServiceMBeanImpl.properties b/scr/management/src/main/resources/org/apache/karaf/scr/management/internal/ServiceComponentRuntimeMBeanImpl.properties
similarity index 100%
rename from scr/management/src/main/resources/org/apache/karaf/scr/management/internal/ScrServiceMBeanImpl.properties
rename to scr/management/src/main/resources/org/apache/karaf/scr/management/internal/ServiceComponentRuntimeMBeanImpl.properties