### Eclipse Workspace Patch 1.0
#P org.apache.karaf.scr.management
Index: src/main/java/org/apache/karaf/scr/management/ScrsMBean.java
===================================================================
--- src/main/java/org/apache/karaf/scr/management/ScrsMBean.java (revision 1357271)
+++ src/main/java/org/apache/karaf/scr/management/ScrsMBean.java (working copy)
@@ -1,29 +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;
-
-public interface ScrsMBean {
-
- String[] listComponents() throws Exception;
-
- boolean isComponentActive(String componentName) throws Exception;
-
- void activateComponent(String componentName) throws Exception;
-
- void deactiveateComponent(String componentName) throws Exception;
-
-}
Index: src/main/java/org/apache/karaf/scr/management/ScrServiceMBean.java
===================================================================
--- src/main/java/org/apache/karaf/scr/management/ScrServiceMBean.java (revision 0)
+++ src/main/java/org/apache/karaf/scr/management/ScrServiceMBean.java (revision 0)
@@ -0,0 +1,29 @@
+/*
+ * 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;
+
+public interface ScrServiceMBean {
+ String[] listComponents() throws Exception;
+
+ boolean isComponentActive(String componentName) throws Exception;
+
+ int componentState(String componentName) throws Exception;
+
+ void activateComponent(String componentName) throws Exception;
+
+ void deactiveateComponent(String componentName) throws Exception;
+}
Index: src/main/resources/OSGI-INF/blueprint/blueprint.xml
===================================================================
--- src/main/resources/OSGI-INF/blueprint/blueprint.xml (revision 1357271)
+++ src/main/resources/OSGI-INF/blueprint/blueprint.xml (working copy)
@@ -1,33 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: src/main/java/org/apache/karaf/scr/management/internal/ScrServiceMBeanImpl.java
===================================================================
--- src/main/java/org/apache/karaf/scr/management/internal/ScrServiceMBeanImpl.java (revision 0)
+++ src/main/java/org/apache/karaf/scr/management/internal/ScrServiceMBeanImpl.java (revision 0)
@@ -0,0 +1,188 @@
+/*
+ * 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.HashMap;
+import java.util.Map;
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import javax.management.MBeanServer;
+import javax.management.NotCompliantMBeanException;
+import javax.management.ObjectName;
+import javax.management.StandardMBean;
+
+import aQute.bnd.annotation.component.Activate;
+import aQute.bnd.annotation.component.Deactivate;
+import aQute.bnd.annotation.component.Reference;
+
+import org.apache.felix.scr.Component;
+import org.apache.felix.scr.ScrService;
+import org.apache.karaf.scr.management.ScrServiceMBean;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@aQute.bnd.annotation.component.Component(
+ name = ScrServiceMBeanImpl.COMPONENT_NAME,
+ enabled = true,
+ immediate = true)
+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
+ */
+ public ScrServiceMBeanImpl() throws NotCompliantMBeanException {
+ super(ScrServiceMBean.class);
+ }
+
+ /**
+ * Service component activation call back. Called when all dependencies are satisfied.
+ *
+ * @throws Exception
+ */
+ @Activate
+ public void activate() throws Exception {
+ LOGGER.info("Activating the " + COMPONENT_LABEL);
+ Map