You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2012/05/10 08:13:52 UTC
svn commit: r1336490 - in
/karaf/cellar/branches/cellar-2.2.x/management/src/main:
java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java
resources/OSGI-INF/blueprint/blueprint.xml
Author: jbonofre
Date: Thu May 10 06:13:52 2012
New Revision: 1336490
URL: http://svn.apache.org/viewvc?rev=1336490&view=rev
Log:
[KARAF-1429] CellarFeatureMBean now checks if feature is allowed outbound
Modified:
karaf/cellar/branches/cellar-2.2.x/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java
karaf/cellar/branches/cellar-2.2.x/management/src/main/resources/OSGI-INF/blueprint/blueprint.xml
Modified: karaf/cellar/branches/cellar-2.2.x/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java?rev=1336490&r1=1336489&r2=1336490&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java (original)
+++ karaf/cellar/branches/cellar-2.2.x/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java Thu May 10 06:13:52 2012
@@ -13,19 +13,18 @@
*/
package org.apache.karaf.cellar.management.internal;
-import org.apache.karaf.cellar.core.ClusterManager;
-import org.apache.karaf.cellar.core.Configurations;
-import org.apache.karaf.cellar.core.Group;
-import org.apache.karaf.cellar.core.GroupManager;
+import org.apache.karaf.cellar.core.*;
import org.apache.karaf.cellar.core.control.SwitchStatus;
import org.apache.karaf.cellar.core.event.EventProducer;
import org.apache.karaf.cellar.core.event.EventTransportFactory;
+import org.apache.karaf.cellar.core.event.EventType;
import org.apache.karaf.cellar.features.Constants;
import org.apache.karaf.cellar.features.FeatureInfo;
import org.apache.karaf.cellar.features.RemoteFeaturesEvent;
import org.apache.karaf.cellar.management.CellarFeaturesMBean;
import org.apache.karaf.features.Feature;
import org.apache.karaf.features.FeatureEvent;
+import org.osgi.service.cm.ConfigurationAdmin;
import javax.management.NotCompliantMBeanException;
import javax.management.StandardMBean;
@@ -40,6 +39,7 @@ public class CellarFeaturesMBeanImpl ext
private ClusterManager clusterManager;
private GroupManager groupManager;
private EventProducer eventProducer;
+ private ConfigurationAdmin configurationAdmin;
public CellarFeaturesMBeanImpl() throws NotCompliantMBeanException {
super(CellarFeaturesMBean.class);
@@ -69,6 +69,14 @@ public class CellarFeaturesMBeanImpl ext
this.eventProducer = eventProducer;
}
+ public ConfigurationAdmin getConfigurationAdmin() {
+ return configurationAdmin;
+ }
+
+ public void setConfigurationAdmin(ConfigurationAdmin configurationAdmin) {
+ this.configurationAdmin = configurationAdmin;
+ }
+
public void install(String groupName, String name, String version) throws Exception {
// check if the cluster group exists
Group group = groupManager.findGroupByName(groupName);
@@ -81,6 +89,15 @@ public class CellarFeaturesMBeanImpl ext
throw new IllegalStateException("Cluster event producer is OFF for this node");
}
+ // check if the feature is allowed outbound
+ CellarSupport support = new CellarSupport();
+ support.setClusterManager(this.clusterManager);
+ support.setGroupManager(this.groupManager);
+ support.setConfigurationAdmin(this.configurationAdmin);
+ if (!support.isAllowed(group, Constants.FEATURES_CATEGORY, name, EventType.OUTBOUND)) {
+ throw new IllegalArgumentException("Feature " + name + " is blocked outbound");
+ }
+
ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
@@ -138,6 +155,15 @@ public class CellarFeaturesMBeanImpl ext
throw new IllegalStateException("Cluster event producer is OFF for this node");
}
+ // check if the feature is allowed outbound
+ CellarSupport support = new CellarSupport();
+ support.setClusterManager(this.clusterManager);
+ support.setGroupManager(this.groupManager);
+ support.setConfigurationAdmin(this.configurationAdmin);
+ if (!support.isAllowed(group, Constants.FEATURES_CATEGORY, name, EventType.OUTBOUND)) {
+ throw new IllegalArgumentException("Feature " + name + " is blocked outbound");
+ }
+
ClassLoader originalClassLoader = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
Modified: karaf/cellar/branches/cellar-2.2.x/management/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.2.x/management/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=1336490&r1=1336489&r2=1336490&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.2.x/management/src/main/resources/OSGI-INF/blueprint/blueprint.xml (original)
+++ karaf/cellar/branches/cellar-2.2.x/management/src/main/resources/OSGI-INF/blueprint/blueprint.xml Thu May 10 06:13:52 2012
@@ -46,6 +46,7 @@
<property name="clusterManager" ref="clusterManager"/>
<property name="groupManager" ref="groupManager"/>
<property name="eventProducer" ref="eventProducer"/>
+ <property name="configurationAdmin" ref="configurationAdmin"/>
</bean>
<bean id="cellarGroupMBean" class="org.apache.karaf.cellar.management.internal.CellarGroupMBeanImpl">