karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject svn commit: r1470879 - in /karaf/cellar/branches/cellar-2.3.x/features/src/main/java/org/apache/karaf/cellar/features: FeaturesSupport.java FeaturesSynchronizer.java
Date Tue, 23 Apr 2013 10:21:11 GMT
Author: jbonofre
Date: Tue Apr 23 10:21:11 2013
New Revision: 1470879

URL: http://svn.apache.org/r1470879
Log:
Code cleanup.

Modified:
    karaf/cellar/branches/cellar-2.3.x/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSupport.java
    karaf/cellar/branches/cellar-2.3.x/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSynchronizer.java

Modified: karaf/cellar/branches/cellar-2.3.x/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSupport.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSupport.java?rev=1470879&r1=1470878&r2=1470879&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSupport.java
(original)
+++ karaf/cellar/branches/cellar-2.3.x/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSupport.java
Tue Apr 23 10:21:11 2013
@@ -37,12 +37,11 @@ public class FeaturesSupport extends Cel
     protected FeaturesService featuresService;
 
     public void init() {
-
+        // nothing to do
     }
 
     public void destroy() {
-
-
+        // nothing to do
     }
 
     /**
@@ -83,9 +82,10 @@ public class FeaturesSupport extends Cel
     }
 
     /**
-     * Pushes a {@code Feature} and its status to the distributed list of features.
+     * Push a {@code Feature} and its status to a cluster group.
      *
-     * @param feature
+     * @param feature the feature to push to the cluster group.
+     * @param group the cluster group where to push the feature.
      */
     public void pushFeature(Feature feature, Group group) {
         if (feature != null) {
@@ -103,10 +103,12 @@ public class FeaturesSupport extends Cel
     }
 
     /**
-     * Pushes a {@code Feature} and its status to the distributed list of features.
+     * Push a {@code Feature} and its status to a cluster group.
      * This version of the method force the bundle status, without looking the features service.
      *
-     * @param feature
+     * @param feature the feature to push to the cluster group.
+     * @param group the cluster group where to push the feature.
+     * @param force true to force the bundle status as well, false else.
      */
     public void pushFeature(Feature feature, Group group, Boolean force) {
         if (feature != null) {
@@ -123,9 +125,10 @@ public class FeaturesSupport extends Cel
     }
 
     /**
-     * Pushed a {@code Repository} to the distributed list of repositories.
+     * Push a {@code Repository} to a cluster group.
      *
-     * @param repository
+     * @param repository the features repository to push.
+     * @param group the cluster group where to push.
      */
     public void pushRepository(Repository repository, Group group) {
         String groupName = group.getName();
@@ -145,9 +148,10 @@ public class FeaturesSupport extends Cel
     }
 
     /**
-     * Removes a {@code Repository} to the distributed list of repositories.
+     * Remove a {@code Repository} from a cluster group.
      *
-     * @param repository
+     * @param repository the features repository to remove from the cluster group.
+     * @param group the cluster group where to remove from.
      */
     public void removeRepository(Repository repository, Group group) {
         String groupName = group.getName();

Modified: karaf/cellar/branches/cellar-2.3.x/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSynchronizer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSynchronizer.java?rev=1470879&r1=1470878&r2=1470879&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSynchronizer.java
(original)
+++ karaf/cellar/branches/cellar-2.3.x/features/src/main/java/org/apache/karaf/cellar/features/FeaturesSynchronizer.java
Tue Apr 23 10:21:11 2013
@@ -13,13 +13,11 @@
  */
 package org.apache.karaf.cellar.features;
 
-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.Synchronizer;
 import org.apache.karaf.cellar.core.event.EventType;
 import org.apache.karaf.features.Feature;
-import org.apache.karaf.features.FeaturesService;
 import org.apache.karaf.features.Repository;
 import org.osgi.service.cm.Configuration;
 import org.slf4j.Logger;
@@ -40,9 +38,6 @@ public class FeaturesSynchronizer extend
 
     private static final transient Logger LOGGER = LoggerFactory.getLogger(FeaturesSynchronizer.class);
 
-    /**
-     * Initialization method
-     */
     public void init() {
         super.init();
         Set<Group> groups = groupManager.listLocalGroups();
@@ -56,15 +51,14 @@ public class FeaturesSynchronizer extend
         }
     }
 
-    /**
-     * Destruction method
-     */
     public void destroy() {
         super.destroy();
     }
 
     /**
-     * Pulls the features from the cluster.
+     * Get and update local features depending of the status in a cluster group.
+     *
+     * @param group the cluster group where to retrieve.
      */
     public void pull(Group group) {
         if (group != null) {
@@ -76,7 +70,7 @@ public class FeaturesSynchronizer extend
             try {
                 Thread.currentThread().setContextClassLoader(getClass().getClassLoader());
 
-                // retrieve features URLs from cluster
+                // get features URLs from the cluster group
                 if (clusterRepositories != null && !clusterRepositories.isEmpty())
{
                     for (String url : clusterRepositories) {
                         try {
@@ -92,7 +86,7 @@ public class FeaturesSynchronizer extend
                     }
                 }
 
-                // retrieve feature status in the cluster
+                // get features status from the cluster group
                 if (clusterFeatures != null && !clusterFeatures.isEmpty()) {
                     for (FeatureInfo info : clusterFeatures.keySet()) {
                         String name = info.getName();
@@ -108,7 +102,7 @@ public class FeaturesSynchronizer extend
                             if (locallyInstalled == null) {
                                 locallyInstalled = false;
                             }
-                            // if feature needs to be installed locally.
+                            // if feature has to be installed locally
                             if (clusterInstalled && !locallyInstalled) {
                                 try {
                                     LOGGER.debug("CELLAR FEATURES: installing feature {}/{}",
info.getName(), info.getVersion());
@@ -135,7 +129,9 @@ public class FeaturesSynchronizer extend
     }
 
     /**
-     * Push features to the cluster.
+     * Push local features status to a cluster group.
+     *
+     * @param group the cluster group where to push.
      */
     public void push(Group group) {
         if (group != null) {
@@ -157,7 +153,7 @@ public class FeaturesSynchronizer extend
                     LOGGER.warn("CELLAR FEATURES: unable to list features", e);
                 }
 
-                // process repository list
+                // push the local features repositories to the cluster group
                 if (repositoryList != null && repositoryList.length > 0) {
                     for (Repository repository : repositoryList) {
                         pushRepository(repository, group);
@@ -165,7 +161,7 @@ public class FeaturesSynchronizer extend
                     }
                 }
 
-                // process features list
+                // push the local features status to the cluster group
                 if (featuresList != null && featuresList.length > 0) {
                     for (Feature feature : featuresList) {
                         pushFeature(feature, group);
@@ -178,6 +174,12 @@ public class FeaturesSynchronizer extend
         }
     }
 
+    /**
+     * Check if the features synchronization is enabled for a cluster group.
+     *
+     * @param group the cluster group.
+     * @return true if sync is enabled for the cluster group, false else.
+     */
     public Boolean isSyncEnabled(Group group) {
         Boolean result = Boolean.FALSE;
         String groupName = group.getName();
@@ -196,20 +198,4 @@ public class FeaturesSynchronizer extend
         return result;
     }
 
-    public ClusterManager getCollectionManager() {
-        return clusterManager;
-    }
-
-    public void setCollectionManager(ClusterManager clusterManager) {
-        this.clusterManager = clusterManager;
-    }
-
-    public FeaturesService getFeaturesService() {
-        return featuresService;
-    }
-
-    public void setFeaturesService(FeaturesService featuresService) {
-        this.featuresService = featuresService;
-    }
-
 }



Mime
View raw message