You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by io...@apache.org on 2011/08/26 22:52:10 UTC

svn commit: r1162249 [2/2] - in /karaf/cellar/trunk: ./ core/src/main/java/org/apache/karaf/cellar/core/ core/src/main/java/org/apache/karaf/cellar/core/command/ core/src/main/java/org/apache/karaf/cellar/core/event/ core/src/main/java/org/apache/karaf...

Modified: karaf/cellar/trunk/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/TopicConsumer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/TopicConsumer.java?rev=1162249&r1=1162248&r2=1162249&view=diff
==============================================================================
--- karaf/cellar/trunk/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/TopicConsumer.java (original)
+++ karaf/cellar/trunk/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/TopicConsumer.java Fri Aug 26 20:52:08 2011
@@ -42,21 +42,14 @@ public class TopicConsumer<E extends Eve
      * Initialization method.
      */
     public void init() {
-        if (topic != null) {
-            topic.addMessageListener(this);
-        } else {
-            topic = instance.getTopic(Constants.TOPIC);
-            topic.addMessageListener(this);
-        }
+        start();
     }
 
     /**
      * Destruction method.
      */
     public void destroy() {
-        if (topic != null) {
-            topic.removeMessageListener(this);
-        }
+        stop();
     }
 
     /**
@@ -67,7 +60,25 @@ public class TopicConsumer<E extends Eve
     public void consume(E event) {
         //Check if event has a specified destination.
         if ((event.getDestination() == null || event.getDestination().contains(node)) && (eventSwitch.getStatus().equals(SwitchStatus.ON) || event.getForce())) {
-                dispatcher.dispatch(event);
+            dispatcher.dispatch(event);
+        }
+    }
+
+    @Override
+    public void start() {
+        if (topic != null) {
+            topic.addMessageListener(this);
+        } else {
+            topic = instance.getTopic(Constants.TOPIC);
+            topic.addMessageListener(this);
+        }
+
+    }
+
+    @Override
+    public void stop() {
+        if (topic != null) {
+            topic.removeMessageListener(this);
         }
     }
 

Modified: karaf/cellar/trunk/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastServiceFactory.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastServiceFactory.java?rev=1162249&r1=1162248&r2=1162249&view=diff
==============================================================================
--- karaf/cellar/trunk/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastServiceFactory.java (original)
+++ karaf/cellar/trunk/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastServiceFactory.java Fri Aug 26 20:52:08 2011
@@ -44,6 +44,21 @@ public class HazelcastServiceFactory imp
 
     private static final transient Logger LOGGER = LoggerFactory.getLogger(HazelcastServiceFactory.class);
 
+    public static final String USERNAME="username";
+    public static final String PASSWORD="password";
+
+
+    public static final String MULTICAST_ENABLED="multicastEnabled";
+    public static final String MULTICAST_GROUP="multicastGroup";
+    public static final String MULTICAST_PORT="multicastPort";
+    public static final String MULTICAST_TIMEOUT_IN_SECONDS="multicastTimeoutSeconds";
+
+    public static final String TCPIP_ENABLED="tcpIpEnabled";
+    public static final String TCPIP_MEMBERS="tcpIpMembers";
+
+
+
+
     private String username = GroupConfig.DEFAULT_GROUP_NAME;
     private String password = GroupConfig.DEFAULT_GROUP_PASSWORD;
 
@@ -94,49 +109,70 @@ public class HazelcastServiceFactory imp
             //We need it to properly instantiate Hazelcast.
             Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
             if (properties != null) {
-                String newUsername = (String) properties.get("username");
-                if (username != null && newUsername != null && !username.endsWith(newUsername)) {
-                    this.username = newUsername;
-                    updated = Boolean.TRUE;
+                if (properties.containsKey(USERNAME)) {
+                    String newUsername = (String) properties.get(USERNAME);
+                    if (username != null && newUsername != null && !username.endsWith(newUsername)) {
+                        this.username = newUsername;
+                        updated = Boolean.TRUE;
+                    }
                 }
 
-                String newPassword = (String) properties.get("password");
-                if (password != null && !password.equals(newPassword)) {
-                    this.password = newPassword;
-                    updated = Boolean.TRUE;
+                if (properties.containsKey(PASSWORD)) {
+                    String newPassword = (String) properties.get(PASSWORD);
+                    if (password != null && !password.equals(newPassword)) {
+                        this.password = newPassword;
+                        updated = Boolean.TRUE;
+                    }
                 }
 
-                Boolean newMulticastEnabled = Boolean.parseBoolean((String) properties.get("multicastEnabled"));
+                Boolean newMulticastEnabled = Boolean.parseBoolean((String) properties.get(MULTICAST_ENABLED));
                 if (multicastEnabled != newMulticastEnabled) {
                     this.multicastEnabled = newMulticastEnabled;
                     updated = Boolean.TRUE;
                 }
 
-                String newMulticastGroup = (String) properties.get("multicastGroup");
-                if (multicastGroup != null && newMulticastGroup != null && !multicastGroup.endsWith(newMulticastGroup)) {
-                    this.multicastGroup = newMulticastGroup;
-                    updated = Boolean.TRUE;
+                if (properties.containsKey(MULTICAST_GROUP)) {
+                    String newMulticastGroup = (String) properties.get(MULTICAST_GROUP);
+                    if (multicastGroup != null && newMulticastGroup != null && !multicastGroup.endsWith(newMulticastGroup)) {
+                        this.multicastGroup = newMulticastGroup;
+                        updated = Boolean.TRUE;
+                    }
+
                 }
 
-                int newMulticastPort = Integer.parseInt((String) properties.get("multicastPort"));
-                if (multicastPort != 0 && multicastPort != newMulticastPort) {
-                    this.multicastPort = newMulticastPort;
-                    updated = Boolean.TRUE;
+                if (properties.containsKey(MULTICAST_PORT)) {
+                    try {
+                        int newMulticastPort = Integer.parseInt((String) properties.get(MULTICAST_PORT));
+                        if (multicastPort != 0 && multicastPort != newMulticastPort) {
+                            this.multicastPort = newMulticastPort;
+                            updated = Boolean.TRUE;
+                        }
+                    } catch (NumberFormatException ex) {
+                        LOGGER.warn("Could not parse port number", ex);
+                    }
                 }
 
-                int newMulticastTimeoutSeconds = Integer.parseInt((String) properties.get("multicastTimeoutSeconds"));
-                if (multicastTimeoutSeconds != 0 && multicastTimeoutSeconds != newMulticastTimeoutSeconds) {
-                    this.multicastTimeoutSeconds = newMulticastTimeoutSeconds;
-                    updated = Boolean.TRUE;
+                if (properties.containsKey(MULTICAST_TIMEOUT_IN_SECONDS)) {
+                    try {
+                        int newMulticastTimeoutSeconds = Integer.parseInt((String) properties.get(MULTICAST_TIMEOUT_IN_SECONDS));
+                        if (multicastTimeoutSeconds != 0 && multicastTimeoutSeconds != newMulticastTimeoutSeconds) {
+                            this.multicastTimeoutSeconds = newMulticastTimeoutSeconds;
+                            updated = Boolean.TRUE;
+                        }
+                    } catch (NumberFormatException ex) {
+                        LOGGER.warn("Could not parse multicast timeout in seconds", ex);
+                    }
                 }
 
-                Boolean newTcpIpEnabled = Boolean.parseBoolean((String) properties.get("tcpIpEnabled"));
-                if (tcpIpEnabled != newTcpIpEnabled) {
-                    this.tcpIpEnabled = newTcpIpEnabled;
-                    updated = Boolean.TRUE;
+                if (properties.containsKey(TCPIP_ENABLED)) {
+                    Boolean newTcpIpEnabled = Boolean.parseBoolean((String) properties.get(TCPIP_ENABLED));
+                    if (tcpIpEnabled != newTcpIpEnabled) {
+                        this.tcpIpEnabled = newTcpIpEnabled;
+                        updated = Boolean.TRUE;
+                    }
                 }
 
-                Set<String> newTcpIpMemberSet = createSetFromString((String) properties.get("tcpIpMembers"));
+                Set<String> newTcpIpMemberSet = createSetFromString((String) properties.get(TCPIP_MEMBERS));
                 if (tcpIpMemberSet != null && newTcpIpMemberSet != null && !collectionEquals(tcpIpMemberSet, newTcpIpMemberSet)) {
                     tcpIpMemberSet = newTcpIpMemberSet;
                     updated = Boolean.TRUE;
@@ -313,7 +349,9 @@ public class HazelcastServiceFactory imp
     }
 
     public void setUsername(String username) {
-        this.username = username;
+        if (username != null) {
+            this.username = username;
+        }
     }
 
     public String getPassword() {
@@ -321,7 +359,9 @@ public class HazelcastServiceFactory imp
     }
 
     public void setPassword(String password) {
-        this.password = password;
+        if (password != null) {
+            this.password = password;
+        }
     }
 
     public boolean isMulticastEnabled() {

Modified: karaf/cellar/trunk/hazelcast/src/main/resources/META-INF/spring/beans.xml
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/hazelcast/src/main/resources/META-INF/spring/beans.xml?rev=1162249&r1=1162248&r2=1162249&view=diff
==============================================================================
--- karaf/cellar/trunk/hazelcast/src/main/resources/META-INF/spring/beans.xml (original)
+++ karaf/cellar/trunk/hazelcast/src/main/resources/META-INF/spring/beans.xml Fri Aug 26 20:52:08 2011
@@ -53,13 +53,19 @@
         <property name="configurationAdmin" ref="configurationAdmin"/>
     </bean>
 
-    <!-- Cluster Manager -->
+    <!-- Group Manager -->
     <bean id="groupManager" class="org.apache.karaf.cellar.hazelcast.HazelcastGroupManager" init-method="init">
         <property name="instance" ref="hazelcast"/>
-        <property name="dispatcher" ref="dispatcher"/>
         <property name="configurationAdmin" ref="configurationAdmin"/>
+        <property name="eventTransportFactory" ref="eventTransportFactory"/>
     </bean>
 
+    <bean id="eventTransportFactory" class="org.apache.karaf.cellar.hazelcast.HazelcastEventTransportFactory">
+        <property name="dispatcher"  ref="dispatcher"/>
+        <property name="instance" ref="hazelcast"/>
+    </bean>
+
+
     <!-- Hazelcast Cluster and Node -->
     <bean id="node" factory-bean="clusterManager" factory-method="getNode"/>
 
@@ -142,6 +148,7 @@
 
     <osgi:service ref="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager"/>
     <osgi:service ref="groupManager" interface="org.apache.karaf.cellar.core.GroupManager"/>
+    <osgi:service ref="eventTransportFactory" interface="org.apache.karaf.cellar.core.event.EventTransportFactory"/>
     <osgi:service ref="executionContext" interface="org.apache.karaf.cellar.core.command.ExecutionContext"/>
     <osgi:service ref="commandStore" interface="org.apache.karaf.cellar.core.command.CommandStore"/>
 

Modified: karaf/cellar/trunk/management/pom.xml
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/management/pom.xml?rev=1162249&r1=1162248&r2=1162249&view=diff
==============================================================================
--- karaf/cellar/trunk/management/pom.xml (original)
+++ karaf/cellar/trunk/management/pom.xml Fri Aug 26 20:52:08 2011
@@ -1,4 +1,18 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed 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.
+  -->
+
 <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
 
     <!--

Modified: karaf/cellar/trunk/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java?rev=1162249&r1=1162248&r2=1162249&view=diff
==============================================================================
--- karaf/cellar/trunk/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java (original)
+++ karaf/cellar/trunk/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarFeaturesMBeanImpl.java Fri Aug 26 20:52:08 2011
@@ -18,6 +18,7 @@ import org.apache.karaf.cellar.core.Conf
 import org.apache.karaf.cellar.core.Group;
 import org.apache.karaf.cellar.core.GroupManager;
 import org.apache.karaf.cellar.core.event.EventProducer;
+import org.apache.karaf.cellar.core.event.EventTransportFactory;
 import org.apache.karaf.cellar.features.Constants;
 import org.apache.karaf.cellar.features.FeatureInfo;
 import org.apache.karaf.cellar.features.RemoteFeaturesEvent;
@@ -35,6 +36,7 @@ import java.util.Map;
 public class CellarFeaturesMBeanImpl extends StandardMBean implements CellarFeaturesMBean {
 
     private ClusterManager clusterManager;
+    private EventTransportFactory eventTransportFactory;
     private GroupManager groupManager;
 
     public ClusterManager getClusterManager() {
@@ -53,13 +55,21 @@ public class CellarFeaturesMBeanImpl ext
         this.groupManager = groupManager;
     }
 
+    public EventTransportFactory getEventTransportFactory() {
+        return eventTransportFactory;
+    }
+
+    public void setEventTransportFactory(EventTransportFactory eventTransportFactory) {
+        this.eventTransportFactory = eventTransportFactory;
+    }
+
     public CellarFeaturesMBeanImpl() throws NotCompliantMBeanException {
         super(CellarFeaturesMBean.class);
     }
 
     public void install(String groupName, String name, String version) throws Exception {
         Group group = groupManager.findGroupByName(groupName);
-        EventProducer producer = clusterManager.getEventProducer(groupName);
+        EventProducer producer = eventTransportFactory.getEventProducer(groupName,true);
         RemoteFeaturesEvent event = new RemoteFeaturesEvent(name, version, FeatureEvent.EventType.FeatureInstalled);
         event.setForce(true);
         event.setSourceGroup(group);
@@ -72,7 +82,7 @@ public class CellarFeaturesMBeanImpl ext
 
     public void uninstall(String groupName, String name, String version) throws Exception {
         Group group = groupManager.findGroupByName(groupName);
-        EventProducer producer = clusterManager.getEventProducer(groupName);
+        EventProducer producer = eventTransportFactory.getEventProducer(groupName,true);
         RemoteFeaturesEvent event = new RemoteFeaturesEvent(name, version, FeatureEvent.EventType.FeatureUninstalled);
         event.setForce(true);
         event.setSourceGroup(group);

Modified: karaf/cellar/trunk/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarMBeanImpl.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarMBeanImpl.java?rev=1162249&r1=1162248&r2=1162249&view=diff
==============================================================================
--- karaf/cellar/trunk/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarMBeanImpl.java (original)
+++ karaf/cellar/trunk/management/src/main/java/org/apache/karaf/cellar/management/internal/CellarMBeanImpl.java Fri Aug 26 20:52:08 2011
@@ -3,6 +3,20 @@
  * 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.
+ */
+
+/*
+ * Licensed 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

Modified: karaf/cellar/trunk/management/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/management/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=1162249&r1=1162248&r2=1162249&view=diff
==============================================================================
--- karaf/cellar/trunk/management/src/main/resources/OSGI-INF/blueprint/blueprint.xml (original)
+++ karaf/cellar/trunk/management/src/main/resources/OSGI-INF/blueprint/blueprint.xml Fri Aug 26 20:52:08 2011
@@ -17,6 +17,7 @@
     <!-- Reference to the Cellar services -->
     <reference id="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager"/>
     <reference id="groupManager" interface="org.apache.karaf.cellar.core.GroupManager"/>
+    <reference id="eventTransportFactory" interface="org.apache.karaf.cellar.core.event.EventTransportFactory"/>
     <reference id="executionContext" interface="org.apache.karaf.cellar.core.command.ExecutionContext"/>
 
     <reference id="mbeanServer" interface="javax.management.MBeanServer">
@@ -39,6 +40,7 @@
 
     <bean id="cellarFeaturesMBean" class="org.apache.karaf.cellar.management.internal.CellarFeaturesMBeanImpl">
         <property name="clusterManager" ref="clusterManager"/>
+        <property name="eventTransportFactory" ref="eventTransportFactory"/>
         <property name="groupManager" ref="groupManager"/>
     </bean>
 

Modified: karaf/cellar/trunk/pom.xml
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/pom.xml?rev=1162249&r1=1162248&r2=1162249&view=diff
==============================================================================
--- karaf/cellar/trunk/pom.xml (original)
+++ karaf/cellar/trunk/pom.xml Fri Aug 26 20:52:08 2011
@@ -37,15 +37,17 @@
         <easymock.version>2.4</easymock.version>
         <felix.configadmin.version>1.2.8</felix.configadmin.version>
         <felix.webconsole.version>3.1.8</felix.webconsole.version>
+        <hazelcast.version>1.9.3</hazelcast.version>
+        <jclouds.version>1.0.0</jclouds.version>
+        <joda-time.version>1.6.2</joda-time.version>
+        <junit.version>4.7</junit.version>
         <junit.bundle.version>4.7_3</junit.bundle.version>
         <karaf.version>3.0.0-SNAPSHOT</karaf.version>
-        <hazelcast.version>1.9.3</hazelcast.version>
         <osgi.version>4.2.0</osgi.version>
+        <pax.url.version>1.3.4</pax.url.version>
         <servlet.api.version>2.5</servlet.api.version>
         <slf4j.version>1.6.1</slf4j.version>
         <spring.osgi.version>1.2.1</spring.osgi.version>
-        <jclouds.version>1.0.0</jclouds.version>
-        <joda-time.version>1.6.2</joda-time.version>
     </properties>
 
     <modules>
@@ -53,6 +55,7 @@
         <module>config</module>
         <module>features</module>
         <module>bundle</module>
+        <module>dosgi</module>
         <module>shell</module>
         <module>hazelcast</module>
         <module>utils</module>
@@ -155,12 +158,12 @@
                 <artifactId>org.apache.karaf.cellar.utils</artifactId>
                 <version>${project.version}</version>
             </dependency>
-
-            <!-- Easymock -->
             <dependency>
-                <groupId>org.easymock</groupId>
-                <artifactId>easymock</artifactId>
-                <version>${easymock.version}</version>
+                <groupId>org.apache.karaf.cellar</groupId>
+                <artifactId>apache-karaf-cellar</artifactId>
+                <version>${project.version}</version>
+                <type>xml</type>
+                <classifier>features</classifier>
             </dependency>
 
             <!-- Felix -->
@@ -199,6 +202,12 @@
                 <version>${karaf.version}</version>
             </dependency>
 
+            <dependency>
+                <groupId>org.apache.karaf.tooling</groupId>
+                <artifactId>org.apache.karaf.tooling.testing</artifactId>
+                <version>${karaf.version}</version>
+            </dependency>
+
             <!-- OSGi -->
             <dependency>
                 <groupId>org.osgi</groupId>
@@ -265,6 +274,25 @@
                 <version>${joda-time.version}</version>
             </dependency>
 
+            <dependency>
+                <groupId>org.ops4j.pax.url</groupId>
+                <artifactId>pax-url-mvn</artifactId>
+                <version>${pax.url.version}</version>
+            </dependency>
+
+            <!-- Testing -->
+            <dependency>
+                <groupId>junit</groupId>
+                <artifactId>junit</artifactId>
+                <version>${junit.version}</version>
+            </dependency>
+
+            <!-- Easymock -->
+            <dependency>
+                <groupId>org.easymock</groupId>
+                <artifactId>easymock</artifactId>
+                <version>${easymock.version}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 
@@ -448,6 +476,22 @@
                     </execution>
                 </executions>
             </plugin>
+            <!-- generate dependencies versions -->
+            <plugin>
+                <groupId>org.apache.servicemix.tooling</groupId>
+                <artifactId>depends-maven-plugin</artifactId>
+                <version>1.1</version>
+                <inherited>true</inherited>
+                <executions>
+                    <execution>
+                        <id>generate-depends-file</id>
+                        <goals>
+                            <goal>generate-depends-file</goal>
+                        </goals>
+                        <phase>compile</phase>
+                    </execution>
+                </executions>
+            </plugin>
         </plugins>
     </build>
 

Modified: karaf/cellar/trunk/utils/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/utils/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=1162249&r1=1162248&r2=1162249&view=diff
==============================================================================
--- karaf/cellar/trunk/utils/src/main/resources/OSGI-INF/blueprint/blueprint.xml (original)
+++ karaf/cellar/trunk/utils/src/main/resources/OSGI-INF/blueprint/blueprint.xml Fri Aug 26 20:52:08 2011
@@ -27,10 +27,10 @@
     <!-- OSGi Services  & References -->
     <service ref="pingHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
     <service ref="pongHandler" interface="org.apache.karaf.cellar.core.event.EventHandler"/>
-    <reference id="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager"/>
-    <reference id="eventProducer" interface="org.apache.karaf.cellar.core.event.EventProducer"/>
+
+    <reference id="clusterManager" interface="org.apache.karaf.cellar.core.ClusterManager" availability="optional"/>
+    <reference id="commandStore" interface="org.apache.karaf.cellar.core.command.CommandStore" availability="optional"/>
+    <reference id="producer" interface="org.apache.karaf.cellar.core.event.EventProducer" filter="(!(type = group))" availability="optional"/>
     <reference id="configurationAdmin" interface="org.osgi.service.cm.ConfigurationAdmin"/>
-    <reference id="commandStore" interface="org.apache.karaf.cellar.core.command.CommandStore"/>
-    <reference id="producer" interface="org.apache.karaf.cellar.core.event.EventProducer"/>
 
 </blueprint>



Re: Hazelcast commit (svn commit: r1162249 [2/2] - in /karaf/cellar/trunk...)

Posted by Ioannis Canellos <io...@gmail.com>.
>
> thanks for taking to review this long commit.
>
That's was meant to be something like "Thanks for taking the time ... "

-- 
*Ioannis Canellos*
*
 http://iocanel.blogspot.com

Apache Karaf <http://karaf.apache.org/> Committer & PMC
Apache ServiceMix <http://servicemix.apache.org/>  Committer
Apache Gora <http://incubator.apache.org/gora/> Committer
*

Re: Hazelcast commit (svn commit: r1162249 [2/2] - in /karaf/cellar/trunk...)

Posted by Ioannis Canellos <io...@gmail.com>.
Hi Glenn,

thanks for taking to review this long commit.

The story behind the null value check is quite long, but it goes like this:

Along with this commit I also created some integration tests with pax-exam
(which are not part of this commit, at least not yet). For the needs of
these tests I wanted to test the hazelcast factory. This factory is a
managed bean and normally retrieves its configuration via the config admin.
This is something I could not get working with pax-exam and so I added this
check, since I thought that if username/password are null its safe to
fallback to the defaults. If you think that this is harmfull then I guess I
have to find an other workaround till I get the pax-exam working.

-- 
*Ioannis Canellos*
*
 http://iocanel.blogspot.com

Apache Karaf <http://karaf.apache.org/> Committer & PMC
Apache ServiceMix <http://servicemix.apache.org/>  Committer
Apache Gora <http://incubator.apache.org/gora/> Committer
*

Hazelcast commit (svn commit: r1162249 [2/2] - in /karaf/cellar/trunk...)

Posted by Glen Mazza <gm...@talend.com>.
On 08/26/2011 04:52 PM, iocanel@apache.org wrote:
> Modified: karaf/cellar/trunk/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastServiceFactory.java
> URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastServiceFactory.java?rev=1162249&r1=1162248&r2=1162249&view=diff
> ==============================================================================
> --- karaf/cellar/trunk/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastServiceFactory.java (original)
> +++ karaf/cellar/trunk/hazelcast/src/main/java/org/apache/karaf/cellar/hazelcast/factory/HazelcastServiceFactory.java Fri Aug 26 20:52:08 2011
> @@ -44,6 +44,21 @@ public class HazelcastServiceFactory imp
>
>
>       public void setUsername(String username) {
> -        this.username = username;
> +        if (username != null) {
> +            this.username = username;
> +        }
>       }
>
>       public String getPassword() {
> @@ -321,7 +359,9 @@ public class HazelcastServiceFactory imp
>       }
>
>       public void setPassword(String password) {
> -        this.password = password;
> +        if (password != null) {
> +            this.password = password;
> +        }
>       }
>

Are you sure you want to implement it this way (retain the old username 
and password if the caller tries to set either to "null"?)  I'm not sure 
how username and password are being used here, but if the caller sets 
the username and password to "null" that's usually (?) to indicate that 
no more authorizations (actions) are wanted--to refuse everything 
afterwards.  But with the above implementation in order to accomplish 
the same thing you'd need to set bogus non-zero-length usernames and 
passwords instead--something strange to be encouraging.

Glen

-- 
Glen Mazza
Talend - http://www.talend.com/ai
Blog - http://www.jroller.com/gmazza
Twitter - glenmazza