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 2013/04/24 15:23:56 UTC
svn commit: r1471401 [1/2] - in /karaf/cellar/branches/cellar-2.3.x:
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/completer/
core/src/main/java...
Author: jbonofre
Date: Wed Apr 24 13:23:54 2013
New Revision: 1471401
URL: http://svn.apache.org/r1471401
Log:
Code cleanup.
Added:
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/AllNodeCompleter.java
- copied, changed from r1471046, karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/completer/AllNodeCompleter.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/NodeCompleterSupport.java
- copied, changed from r1471046, karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/completer/NodeCompleterSupport.java
Removed:
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/completer/AllNodeCompleter.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/completer/NodeCompleterSupport.java
Modified:
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/ClusterManager.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Configurations.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Consumer.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Dispatcher.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Group.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/GroupManager.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Handler.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/HandlerRegistry.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/MultiNode.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Producer.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Synchronizer.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/BasicCommandStore.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/ClusteredExecutionContext.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/Command.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/CommandHandler.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/CommandStore.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/ExecutionContext.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/Result.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/ResultHandler.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/TimeoutResult.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/TimeoutTask.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/BasicSwitch.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommand.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommandHandler.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchResult.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchResultHandler.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupCommand.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupCommandHandler.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupResult.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupResultHandler.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommand.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommandHandler.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersResult.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersResultHandler.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommand.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommandHandler.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchResult.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchResultHandler.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/Switch.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/discovery/Discovery.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/discovery/DiscoveryService.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/Event.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventConsumer.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventDispatchTask.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventDispatcher.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandler.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandlerRegistry.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandlerServiceRegistry.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandlerServiceRegistryDispatcher.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventProducer.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventTracker.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventTransportFactory.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/exception/ProducerNotFoundException.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/exception/StoreNotFoundException.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/shell/CellarCommandSupport.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/AllGroupsCompleter.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/GroupCompleterSupport.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/LocalGroupsCompleter.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/OtherGroupsCompleter.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/utils/CellarUtils.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/utils/CombinedClassLoader.java
karaf/cellar/branches/cellar-2.3.x/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
karaf/cellar/branches/cellar-2.3.x/core/src/test/java/org/apache/karaf/cellar/core/CellarSupportTest.java
karaf/cellar/branches/cellar-2.3.x/core/src/test/java/org/apache/karaf/cellar/core/utils/CellarUtilsTest.java
karaf/cellar/branches/cellar-2.3.x/shell/src/main/resources/OSGI-INF/blueprint/shell-cluster.xml
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java Wed Apr 24 13:23:54 2013
@@ -28,7 +28,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
- * Cellar support.
+ * Generic Cellar support. This class provides util methods used in several other classes.
*/
public class CellarSupport {
@@ -39,12 +39,13 @@ public class CellarSupport {
protected ConfigurationAdmin configurationAdmin;
/**
- * Lists the BlackList/WhiteList for the specified category..
+ * Get the list of entries for resource, cluster group, and event type.
*
- * @param listType whitelist or blacklist.
- * @param category the lookup category.
- * @param group the target group name.
- * @return the corresponding list entries.
+ * @param listType the list type (blacklist or whitelist).
+ * @param group the cluster group name.
+ * @param category the resource category name.
+ * @param type the event type (inbound, outbound).
+ * @return a set of list entries.
*/
public Set<String> getListEntries(String listType, String group, String category, EventType type) {
Set<String> result = null;
@@ -84,13 +85,13 @@ public class CellarSupport {
}
/**
- * Lists the BlackList for the specified feature.
+ * Get the list of entries for resource, cluster groups, and event type.
*
- * @param category
- * @param groups
- * @param category
- * @param type
- * @return
+ * @param listType the list type (blacklist, whitelist).
+ * @param groups a collection of cluster groups.
+ * @param category the resource category name.
+ * @param type the event type (inbound, outbound).
+ * @return a set of list entries.
*/
public Set<String> getListEntries(String listType, Collection<String> groups, String category, EventType type) {
Set<String> result = null;
@@ -107,14 +108,14 @@ public class CellarSupport {
return result;
}
-
/**
- * Lists the BlackList for the specified feature.
+ * Get the list of entries for resource, cluster group, and event type.
*
- * @param category
- * @param category
- * @param type
- * @return
+ * @param listType the list type (blacklist, whitelist).
+ * @param group the cluster group.
+ * @param category the resource category name.
+ * @param type the event type (inbound, outbound).
+ * @return a set of list entries.
*/
public Set<String> getListEntries(String listType, Group group, String category, EventType type) {
Set<String> result = null;
@@ -130,21 +131,20 @@ public class CellarSupport {
return result;
}
-
/**
- * Returns true if the specified event is allowed.
+ * Check if a given cluster event is allowed for a resource and cluster group.
*
- * @param category
- * @param event
- * @param type
- * @return
+ * @param group the cluster group.
+ * @param category the resource category name.
+ * @param event the cluster event.
+ * @param type the cluster event type (inbound, outbound).
*/
public Boolean isAllowed(Group group, String category, String event, EventType type) {
Boolean result = true;
Set<String> whiteList = getListEntries(Configurations.WHITELIST, group, category, type);
Set<String> blackList = getListEntries(Configurations.BLACKLIST, group, category, type);
- //If no white listed items we assume all are accepted.
+ // if no white listed items we assume all are accepted
if (whiteList != null && !whiteList.isEmpty()) {
result = false;
for (String whiteListItem : whiteList) {
@@ -154,7 +154,7 @@ public class CellarSupport {
}
}
- //If any blackList item matched, then false is returned.
+ // if any blackList item matched, then false is returned
if (blackList != null && !blackList.isEmpty()) {
for (String blackListItem : blackList) {
if (wildCardMatch(event, blackListItem)) {
@@ -167,11 +167,11 @@ public class CellarSupport {
}
/**
- * Matches text using a pattern containing wildcards.
+ * Check if an item matches a wildcard pattern.
*
- * @param item
- * @param pattern
- * @return
+ * @param item the item to check.
+ * @param pattern the wildcard pattern.
+ * @return true if the item matches the pattern, false else.
*/
protected boolean wildCardMatch(String item, String pattern) {
// update the pattern to have a valid regex pattern
@@ -179,11 +179,9 @@ public class CellarSupport {
// use the regex
Pattern p = Pattern.compile(pattern);
Matcher m = p.matcher(item);
-
return m.matches();
}
-
public ConfigurationAdmin getConfigurationAdmin() {
return configurationAdmin;
}
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/ClusterManager.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/ClusterManager.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/ClusterManager.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/ClusterManager.java Wed Apr 24 13:23:54 2013
@@ -13,101 +13,97 @@
*/
package org.apache.karaf.cellar.core;
-import org.apache.karaf.cellar.core.event.EventConsumer;
-import org.apache.karaf.cellar.core.event.EventProducer;
-
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Set;
/**
- * Cluster manager interface.
+ * Description of a cluster manager.
*/
public interface ClusterManager {
/**
- * Returns a named distributed map.
+ * Get a map from the cluster.
*
- * @param mapName
- * @return
+ * @param mapName the map name.
+ * @return the map.
*/
public Map getMap(String mapName);
/**
- * Returns a named distributed list.
+ * Get a list from the cluster.
*
- * @param listName
- * @return
+ * @param listName the list name.
+ * @return the list.
*/
public List getList(String listName);
-
/**
- * Returns a named distributed list.
+ * Get a set from the cluster.
*
- * @param setName
- * @return
+ * @param setName the set name.
+ * @return the set.
*/
public Set getSet(String setName);
-
/**
- * Returns a list of {@code Node}s.
+ * Get the nodes in the cluster.
*
- * @return
+ * @return a set of nodes in the cluster.
*/
public Set<Node> listNodes();
/**
- * Returns the {@link Node} with specified id.
+ * Get the nodes with given IDs.
*
- * @return
+ * @param ids the node IDs.
+ * @return a set of nodes in the cluster matching the given IDs.
*/
public Set<Node> listNodes(Collection<String> ids);
/**
- * Returns the {@link Node} with specified {@link Group}.
+ * Get the nodes member of a given cluster group.
*
- * @return
+ * @param group the cluster group.
+ * @return a set of nodes member of the cluster group.
*/
public Set<Node> listNodesByGroup(Group group);
-
/**
- * Returns the {@link Node} with specified id.
+ * Get a node with a given ID.
*
- * @return
+ * @param id the node ID.
+ * @return the node.
*/
public Node findNodeById(String id);
-
/**
- * Returns the {@link Node} on which the command was executed.
+ * Get the local node.
*
- * @return
+ * @return the local node.
*/
public Node getNode();
/**
- * Generate an Id unique across the cluster.
+ * Generate an unique ID across the cluster.
*
- * @return
+ * @return the generated unique ID.
*/
public String generateId();
/**
- * Start the clustering support on the {@link Node}.
+ * Start the local node.
*/
public void start();
/**
- * Stops the node.
+ * Stop the local node.
*/
public void stop();
/**
- * Restarts the clustering support on the {@link Node}.
+ * Restart the local node.
*/
public void restart();
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Configurations.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Configurations.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Configurations.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Configurations.java Wed Apr 24 13:23:54 2013
@@ -14,7 +14,7 @@
package org.apache.karaf.cellar.core;
/**
- * Configurations.
+ * Cellar configuration constants..
*/
public class Configurations {
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Consumer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Consumer.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Consumer.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Consumer.java Wed Apr 24 13:23:54 2013
@@ -18,21 +18,21 @@ import org.apache.karaf.cellar.core.cont
import java.io.Serializable;
/**
- * Generic consumer interface.
+ * Cluster event consumer.
*/
public interface Consumer<T extends Serializable> {
/**
* Consume an object.
*
- * @param obj
+ * @param obj the object to consume.
*/
public void consume(T obj);
/**
- * Returns the {@code Switch}.
+ * Get the consumer switch.
*
- * @return
+ * @return the consumer switch.
*/
public Switch getSwitch();
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Dispatcher.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Dispatcher.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Dispatcher.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Dispatcher.java Wed Apr 24 13:23:54 2013
@@ -21,9 +21,9 @@ import java.io.Serializable;
public interface Dispatcher<T extends Serializable> {
/**
- * Dispatches the object to the appropriate handler.
+ * Dispatch the object to the appropriate handler.
*
- * @param obj
+ * @param obj the object to dispatch.
*/
public void dispatch(T obj);
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Group.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Group.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Group.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Group.java Wed Apr 24 13:23:54 2013
@@ -18,18 +18,13 @@ import java.util.HashSet;
import java.util.Set;
/**
- * Cellar group.
+ * Cellar cluster group.
*/
public class Group implements MultiNode, Serializable {
private String name;
private Set<Node> nodes = new HashSet<Node>();
- /**
- * Constructor
- *
- * @param name
- */
public Group(String name) {
this.name = name;
}
@@ -42,10 +37,12 @@ public class Group implements MultiNode,
this.name = name;
}
+ @Override
public Set<Node> getNodes() {
return nodes;
}
+ @Override
public void setNodes(Set<Node> nodes) {
this.nodes = nodes;
}
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/GroupManager.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/GroupManager.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/GroupManager.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/GroupManager.java Wed Apr 24 13:23:54 2013
@@ -17,51 +17,52 @@ import java.util.Map;
import java.util.Set;
/**
- * Generic group manager interface.
+ * Description of a cluster group manager.
*/
public interface GroupManager {
/**
- * Returns the local {@link Node}.
+ * Get the local node.
*
- * @return
+ * @return the local node.
*/
public Node getNode();
/**
- * Creates {@link Group}
+ * Create a new cluster group.
*
- * @param groupName
- * @return
+ * @param groupName the new cluster group name.
+ * @return the create cluster group.
*/
public Group createGroup(String groupName);
/**
- * Deletes {@link Group}
+ * Delete an existing cluster group.
*
- * @param groupName
+ * @param groupName the cluster group name to delete.
*/
public void deleteGroup(String groupName);
/**
- * Return the {@link Group} by name.
+ * Get a cluster group identified by a name.
*
- * @param groupName
- * @return
+ * @param groupName the cluster group name to look for.
+ * @return the cluster group.
*/
public Group findGroupByName(String groupName);
/**
- * Returns a map of {@link Node}s.
+ * Get the cluster groups.
*
- * @return
+ * @return a map with cluster groups name and group.
*/
public Map<String, Group> listGroups();
/**
- * Returns the {@link Group}s of the specified {@link Node}.
+ * Get the list of "local" cluster groups.
+ * A "local" cluster group is a group "hosting" the local node.
*
- * @return
+ * @return a set of local cluster groups.
*/
public Set<Group> listLocalGroups();
@@ -74,62 +75,60 @@ public interface GroupManager {
public boolean isLocalGroup(String groupName);
/**
- * Returns the {@link Group}s of the specified {@link Node}.
+ * Get all cluster groups.
*
- * @return
+ * @return a set containing all cluster groups.
*/
public Set<Group> listAllGroups();
/**
- * Returns the {@link Group}s of the specified {@link Node}.
+ * Get the cluster groups "hosting" a given node.
*
- * @param node
- * @return
+ * @param node the node.
+ * @return a set with cluster groups "hosting" a node.
*/
public Set<Group> listGroups(Node node);
/**
- * Retrurns the {@link Group} names of the current {@Node}.
+ * Get the cluster groups names of the local node.
*
- * @return
+ * @return a set of cluster groups names.
*/
public Set<String> listGroupNames();
/**
- * Returns the {@link Group} names of the specified {@link Node}.
+ * Get the cluster groups names of a given node.
*
- * @param node
- * @return
+ * @param node the node.
+ * @return a set of cluster groups names.
*/
public Set<String> listGroupNames(Node node);
-
/**
- * Registers current {@link Node} to the {@link Group}.
+ * Register the local node in a cluster group.
*
- * @param group
+ * @param group the cluster group where to register the local node.
*/
public void registerGroup(Group group);
/**
- * Registers current {@link Node} to the {@link Group}.
+ * Register the local node in a cluster group.
*
- * @param groupName
+ * @param groupName the cluster group name where to register the local node.
*/
public void registerGroup(String groupName);
-
/**
- * UnRegisters current {@link Node} to the {@link Group}.
+ * Un-register the local node from a cluster group.
*
- * @param group
+ * @param group the cluster group.
*/
public void unRegisterGroup(Group group);
/**
- * UnRegisters current {@link Node} to the {@link Group}.
+ * Un-register the local node from a cluster group.
*
- * @param groupName
+ * @param groupName the cluster group name.
*/
public void unRegisterGroup(String groupName);
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Handler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Handler.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Handler.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Handler.java Wed Apr 24 13:23:54 2013
@@ -18,21 +18,21 @@ import org.apache.karaf.cellar.core.cont
import java.io.Serializable;
/**
- * Generic handler.
+ * Description of a cluster event handler.
*/
public interface Handler<T extends Serializable> {
/**
- * Returns the Class of the object that is to be handled.
+ * Get the event type that the handler can handle.
*
- * @return
+ * @return the event type class.
*/
public Class<T> getType();
/**
- * Returns the {@code Switch}.
+ * Get the handler switch.
*
- * @return
+ * @return the handler switch.
*/
public Switch getSwitch();
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/HandlerRegistry.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/HandlerRegistry.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/HandlerRegistry.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/HandlerRegistry.java Wed Apr 24 13:23:54 2013
@@ -16,15 +16,15 @@ package org.apache.karaf.cellar.core;
import java.io.Serializable;
/**
- * Handler registry interface.
+ * Description of a handler registry.
*/
public interface HandlerRegistry<T extends Serializable, H extends Handler<T>> {
/**
- * Returns the {@code Handler} for the given object.
+ * Get the handler which is able to handle a given object.
*
- * @param obj
- * @return
+ * @param obj the object to handle.
+ * @return the handler able to handle the object, null if no handler found.
*/
public H getHandler(T obj);
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/MultiNode.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/MultiNode.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/MultiNode.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/MultiNode.java Wed Apr 24 13:23:54 2013
@@ -16,9 +16,23 @@ package org.apache.karaf.cellar.core;
import java.io.Serializable;
import java.util.Set;
+/**
+ * Multiple node container. A cluster group is an implementation of a multiple nodes container.
+ */
public interface MultiNode extends Serializable {
+ /**
+ * Set the nodes in the multiple nodes container.
+ *
+ * @param nodes a set with the nodes in the container.
+ */
public void setNodes(Set<Node> nodes);
+
+ /**
+ * Get the nodes in the multiple nodes container.
+ *
+ * @return a set of the nodes in the container.
+ */
public Set<Node> getNodes();
}
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Producer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Producer.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Producer.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Producer.java Wed Apr 24 13:23:54 2013
@@ -18,21 +18,21 @@ import org.apache.karaf.cellar.core.cont
import java.io.Serializable;
/**
- * Generic producer interface.
+ * Description of a cluster event producer.
*/
public interface Producer<T extends Serializable> {
/**
- * Produce an object.
+ * Produce an object and send to the cluster.
*
- * @param obj
+ * @param obj the object to produce and send to the cluster.
*/
public void produce(T obj);
/**
- * Returns the {@code Switch}.
+ * Get the producer switch.
*
- * @return
+ * @return the producer switch.
*/
public Switch getSwitch();
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Synchronizer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Synchronizer.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Synchronizer.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/Synchronizer.java Wed Apr 24 13:23:54 2013
@@ -14,24 +14,29 @@
package org.apache.karaf.cellar.core;
/**
- * Generic synchronizer interface.
+ * Description of a synchronizer.
*/
public interface Synchronizer {
/**
- * Pushes local state to the shared resource.
+ * Push local resources states to a cluster group.
+ *
+ * @param group the cluster group where to push the resources states.
*/
public void push(Group group);
/**
- * Pull state changes from the shared resource.
+ * Pull the resources states from a cluster group, and update the local resources states.
+ *
+ * @param group the cluster group where to get the resources states.
*/
public void pull(Group group);
/**
- * Returns true if synchronization is enabled.
+ * Check if the sync flag is enabled for a given cluster group.
*
- * @return
+ * @param group the cluster group where to check the sync flag.
+ * @return true if the sync flag is enabled, false else.
*/
public Boolean isSyncEnabled(Group group);
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/BasicCommandStore.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/BasicCommandStore.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/BasicCommandStore.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/BasicCommandStore.java Wed Apr 24 13:23:54 2013
@@ -23,10 +23,22 @@ public class BasicCommandStore implement
private ConcurrentMap<String, Command> pending = new ConcurrentHashMap<String, Command>();
+ /**
+ * Get the pending commands in the store.
+ *
+ * @return the map of pending commands.
+ */
+ @Override
public ConcurrentMap<String, Command> getPending() {
return pending;
}
+ /**
+ * Set the pending commands in the store.
+ *
+ * @param pending the map of pending commands.
+ */
+ @Override
public void setPending(ConcurrentMap<String, Command> pending) {
this.pending = pending;
}
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/ClusteredExecutionContext.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/ClusteredExecutionContext.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/ClusteredExecutionContext.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/ClusteredExecutionContext.java Wed Apr 24 13:23:54 2013
@@ -34,6 +34,7 @@ public class ClusteredExecutionContext i
private ScheduledExecutorService timeoutScheduler = new ScheduledThreadPoolExecutor(10);
public ClusteredExecutionContext() {
+ // nothing to do
}
public ClusteredExecutionContext(Producer producer, CommandStore commandStore) {
@@ -41,6 +42,16 @@ public class ClusteredExecutionContext i
this.commandStore = commandStore;
}
+ /**
+ * Execute a command in this context.
+ *
+ * @param command the command to execute.
+ * @return the result of the command execution.
+ * @throws StoreNotFoundException if the commands store is not found.
+ * @throws ProducerNotFoundException if no cluster event producer is found.
+ * @throws InterruptedException if the command execution has been interrupted.
+ */
+ @Override
public <R extends Result, C extends Command<R>> Map<Node, R> execute(C command) throws StoreNotFoundException, ProducerNotFoundException, InterruptedException {
if (command == null) {
throw new StoreNotFoundException("Command store not found");
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/Command.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/Command.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/Command.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/Command.java Wed Apr 24 13:23:54 2013
@@ -40,13 +40,18 @@ public class Command<R extends Result> e
this.force = true;
}
+ /**
+ * Set the force flag for the execution of this command.
+ *
+ * @return true if the force flag is set, false else.
+ */
@Override
public Boolean getForce() {
return true;
}
/**
- * Process the event of timeout.
+ * Handle a command execution timeout.
*/
public void onTimeout() {
try {
@@ -57,9 +62,9 @@ public class Command<R extends Result> e
}
/**
- * Adds {@code Results} to the result queue.
+ * Add command execution results into the results queue.
*
- * @param results
+ * @param results the command execution results.
*/
public void addResults(R... results) {
if (results != null && results.length > 0) {
@@ -78,11 +83,10 @@ public class Command<R extends Result> e
}
/**
- * Returns the responses.
- * If no results found it returns an empty map.
+ * Get the command execution results from the results queue.
*
- * @return
- * @throws Exception
+ * @return the map of command execution results.
+ * @throws Exception if the command execution has timed out.
*/
public Map<Node, R> getResult() throws InterruptedException {
Map<Node, R> nodeResults = null;
@@ -92,7 +96,6 @@ public class Command<R extends Result> e
return nodeResults;
}
-
public long getTimeout() {
return timeout;
}
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/CommandHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/CommandHandler.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/CommandHandler.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/CommandHandler.java Wed Apr 24 13:23:54 2013
@@ -23,17 +23,18 @@ import java.util.HashSet;
import java.util.Set;
/**
- * Command handler.
+ * Cluster command event handler.
*/
public abstract class CommandHandler<C extends Command<R>, R extends Result> extends CellarSupport implements EventHandler<C> {
protected Producer producer;
/**
- * Hanldes the the {@code Command}.
+ * Handles a received cluster command event.
*
- * @param command
+ * @param command the received cluster command event.
*/
+ @Override
public void handle(C command) {
if (producer != null) {
R result = execute(command);
@@ -47,31 +48,33 @@ public abstract class CommandHandler<C e
}
/**
- * Executes a {@code Command} and returns a {@code Result}.
+ * Execute a command.
*
- * @param command
- * @return
+ * @param command the command to execute.
+ * @return the command execution result.
*/
public abstract R execute(C command);
+ /**
+ * Get the cluster event type handled by this handler.
+ *
+ * @return the cluster event type handled by this handler.
+ */
+ @Override
public abstract Class<C> getType();
- public abstract Switch getSwitch();
-
/**
- * Returns the {@code Producer}.
+ * Get the handler switch.
*
- * @return
+ * @return the handler switch.
*/
+ @Override
+ public abstract Switch getSwitch();
+
public Producer getProducer() {
return producer;
}
- /**
- * Sets the {@code Producer}.
- *
- * @param producer
- */
public void setProducer(Producer producer) {
this.producer = producer;
}
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/CommandStore.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/CommandStore.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/CommandStore.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/CommandStore.java Wed Apr 24 13:23:54 2013
@@ -20,8 +20,18 @@ import java.util.concurrent.ConcurrentMa
*/
public interface CommandStore {
+ /**
+ * Get the list of pending commands from the store.
+ *
+ * @return the map of pending commands in the store.
+ */
public ConcurrentMap<String, Command> getPending();
+ /**
+ * Set the list of pending commands in the store.
+ *
+ * @param pending the map of pending commands in the store.
+ */
public void setPending(ConcurrentMap<String, Command> pending);
}
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/ExecutionContext.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/ExecutionContext.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/ExecutionContext.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/ExecutionContext.java Wed Apr 24 13:23:54 2013
@@ -23,13 +23,11 @@ import java.util.Map;
public interface ExecutionContext {
/**
- * Execute {@link Command} and retrieve {@link Result}.
+ * Execute a {@link Command}
*
- * @param command
- * @param <R>
- * @param <C>
- * @return
- * @throws Exception
+ * @param command the {@link Command} to execute.
+ * @return the command execution {@link Result}.
+ * @throws Exception in case of command execution failure.
*/
public <R extends Result, C extends Command<R>> Map<Node, R> execute(C command) throws Exception;
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/Result.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/Result.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/Result.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/Result.java Wed Apr 24 13:23:54 2013
@@ -16,7 +16,7 @@ package org.apache.karaf.cellar.core.com
import org.apache.karaf.cellar.core.event.Event;
/**
- * Result event.
+ * Cluster command execution result event.
*/
public class Result extends Event {
@@ -25,6 +25,11 @@ public class Result extends Event {
this.force = true;
}
+ /**
+ * Get the force flag in the cluster result event.
+ *
+ * @return true if the force flag is set on the cluster result event, false else.
+ */
@Override
public Boolean getForce() {
return true;
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/ResultHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/ResultHandler.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/ResultHandler.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/ResultHandler.java Wed Apr 24 13:23:54 2013
@@ -19,7 +19,7 @@ import org.apache.karaf.cellar.core.cont
import org.apache.karaf.cellar.core.event.EventHandler;
/**
- * An event handler class the handles result event.
+ * Cluster command execution result event handler.
*/
public class ResultHandler<R extends Result> implements EventHandler<R> {
@@ -29,10 +29,12 @@ public class ResultHandler<R extends Res
private CommandStore commandStore;
/**
- * Retrieves the correlated command from the store and sets the result on the command object.
+ * Handle a received cluster command execution result event.
+ * The method correlates the cluster result event with a pending command in the command store.
*
- * @param result
+ * @param result the cluster command execution result event to handle.
*/
+ @Override
public void handle(R result) {
if (commandStore != null && commandStore.getPending() != null) {
String id = result.getId();
@@ -44,10 +46,16 @@ public class ResultHandler<R extends Res
}
}
+ @Override
public Class<R> getType() {
return null;
}
+ @Override
+ public Switch getSwitch() {
+ return handlerSwitch;
+ }
+
public CommandStore getCommandStore() {
return commandStore;
}
@@ -56,8 +64,4 @@ public class ResultHandler<R extends Res
this.commandStore = commandStore;
}
- public Switch getSwitch() {
- return handlerSwitch;
- }
-
}
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/TimeoutResult.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/TimeoutResult.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/TimeoutResult.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/TimeoutResult.java Wed Apr 24 13:23:54 2013
@@ -14,7 +14,7 @@
package org.apache.karaf.cellar.core.command;
/**
- * A result that is used to denote that no result has been received during the timeout.
+ * Cluster command execution timeout result event.
*/
public class TimeoutResult extends Result {
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/TimeoutTask.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/TimeoutTask.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/TimeoutTask.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/command/TimeoutTask.java Wed Apr 24 13:23:54 2013
@@ -14,7 +14,7 @@
package org.apache.karaf.cellar.core.command;
/**
- * A Runnable task that is used for scheduling command timeout events.
+ * Runnable task that is used for scheduling command timeout events.
*/
public class TimeoutTask implements Runnable {
@@ -29,6 +29,7 @@ public class TimeoutTask implements Runn
/**
* Runs the timeout task.
*/
+ @Override
public void run() {
//Check if command is still pending.
Boolean pending = store.getPending().containsKey(command);
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/BasicSwitch.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/BasicSwitch.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/BasicSwitch.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/BasicSwitch.java Wed Apr 24 13:23:54 2013
@@ -21,48 +21,47 @@ public class BasicSwitch implements Swit
private SwitchStatus status = SwitchStatus.ON;
private String name;
- /**
- * Constructor
- *
- * @param name
- */
public BasicSwitch(String name) {
this.name = name;
}
- /**
- * Constructor
- *
- * @param name
- * @param status
- */
public BasicSwitch(String name, SwitchStatus status) {
this.status = status;
this.name = name;
}
+ /**
+ * Turn on the switch.
+ */
+ @Override
public void turnOn() {
this.status = SwitchStatus.ON;
}
+ /**
+ * Turn off the switch.
+ */
+ @Override
public void turnOff() {
this.status = SwitchStatus.OFF;
}
/**
- * Returns the status of the {@code Switch}.
+ * Get the current status of the switch.
*
- * @return
+ * @return the current switch status.
*/
+ @Override
public SwitchStatus getStatus() {
return status;
}
/**
- * Returns the name of the {@code Switch}.
+ * Get the name of the switch.
*
- * @return
+ * @return the switch name.
*/
+ @Override
public String getName() {
return name;
}
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommand.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommand.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommand.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommand.java Wed Apr 24 13:23:54 2013
@@ -16,46 +16,34 @@ package org.apache.karaf.cellar.core.con
import org.apache.karaf.cellar.core.command.Command;
/**
- * Consumer switch command.
+ * Cluster consumer switch command event.
*/
public class ConsumerSwitchCommand extends Command<ConsumerSwitchResult> {
private SwitchStatus status = null;
- /**
- * Constructor
- *
- * @param id
- */
public ConsumerSwitchCommand(String id) {
super(id);
}
- /**
- * Constructor
- *
- * @param id
- * @param status
- */
public ConsumerSwitchCommand(String id, SwitchStatus status) {
super(id);
this.status = status;
}
-
/**
- * Returns the {@code SwitchStatus}
+ * Get the consumer switch status.
*
- * @return
+ * @return the consumer switch status.
*/
public SwitchStatus getStatus() {
return status;
}
/**
- * Sets the {@code SwitchStatus}
+ * Set the status of the consumer switch.
*
- * @param status
+ * @param status the new status of the consumer switch.
*/
public void setStatus(SwitchStatus status) {
this.status = status;
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommandHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommandHandler.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommandHandler.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommandHandler.java Wed Apr 24 13:23:54 2013
@@ -21,7 +21,7 @@ import org.osgi.service.cm.Configuration
import java.util.Dictionary;
/**
- * Consumer switch command handler.
+ * Cluster consumer switch command event handler.
*/
public class ConsumerSwitchCommandHandler extends CommandHandler<ConsumerSwitchCommand, ConsumerSwitchResult> {
@@ -31,10 +31,11 @@ public class ConsumerSwitchCommandHandle
private Consumer consumer;
/**
- * Handle the {@code ProducerSwitchCommand} command.
+ * Handle a received cluster consumer switch command event.
*
- * @param command
+ * @param command the received consumer switch command event to handle.
*/
+ @Override
public ConsumerSwitchResult execute(ConsumerSwitchCommand command) {
// query
if (command.getStatus() == null) {
@@ -57,9 +58,9 @@ public class ConsumerSwitchCommandHandle
}
/**
- * Store the consumer current status in ConfigurationAdmin.
+ * Store the consumer switch status in ConfigurationAdmin.
*
- * @param switchStatus the producer switch status to store.
+ * @param switchStatus the consumer switch status to store.
*/
private void persist(SwitchStatus switchStatus) {
try {
@@ -76,10 +77,12 @@ public class ConsumerSwitchCommandHandle
}
}
+ @Override
public Class<ConsumerSwitchCommand> getType() {
return ConsumerSwitchCommand.class;
}
+ @Override
public Switch getSwitch() {
return commandSwitch;
}
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchResult.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchResult.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchResult.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchResult.java Wed Apr 24 13:23:54 2013
@@ -16,40 +16,22 @@ package org.apache.karaf.cellar.core.con
import org.apache.karaf.cellar.core.command.Result;
/**
- * Consumer switch result.
+ * Cluster consumer switch result event.
*/
public class ConsumerSwitchResult extends Result {
protected Boolean success = Boolean.TRUE;
protected Boolean status = Boolean.TRUE;
- /**
- * Constructor
- *
- * @param id
- */
public ConsumerSwitchResult(String id) {
super(id);
}
- /**
- * Constructor
- *
- * @param id
- * @param success
- */
public ConsumerSwitchResult(String id, Boolean success) {
super(id);
this.success = success;
}
- /**
- * Constructor
- *
- * @param id
- * @param success
- * @param status
- */
public ConsumerSwitchResult(String id, Boolean success, Boolean status) {
super(id);
this.success = success;
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchResultHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchResultHandler.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchResultHandler.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchResultHandler.java Wed Apr 24 13:23:54 2013
@@ -16,7 +16,7 @@ package org.apache.karaf.cellar.core.con
import org.apache.karaf.cellar.core.command.ResultHandler;
/**
- * Consumer switch result handler.
+ * Handler for cluster consumer switch result event.
*/
public class ConsumerSwitchResultHandler extends ResultHandler<ConsumerSwitchResult> {
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupCommand.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupCommand.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupCommand.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupCommand.java Wed Apr 24 13:23:54 2013
@@ -16,7 +16,7 @@ package org.apache.karaf.cellar.core.con
import org.apache.karaf.cellar.core.command.Command;
/**
- * Manager group command.
+ * Cluster manage group command event.
*/
public class ManageGroupCommand extends Command<ManageGroupResult> {
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupCommandHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupCommandHandler.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupCommandHandler.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupCommandHandler.java Wed Apr 24 13:23:54 2013
@@ -22,7 +22,7 @@ import java.util.Map;
import java.util.Set;
/**
- * Manager group command handler.
+ * Cluster manage group command event handler.
*/
public class ManageGroupCommandHandler extends CommandHandler<ManageGroupCommand, ManageGroupResult> {
@@ -60,9 +60,9 @@ public class ManageGroupCommandHandler e
}
/**
- * Adds the {@link Group} list to the result.
+ * Add the cluster {@link Group} list to the result.
*
- * @param result
+ * @param result the cluster manage group result event.
*/
public void addGroupListToResult(ManageGroupResult result) {
Set<Group> groups = groupManager.listAllGroups();
@@ -75,9 +75,9 @@ public class ManageGroupCommandHandler e
}
/**
- * Adds {@link Node} to the target {@link Group}.
+ * Add a {@link Node} to the target cluster {@link Group}.
*
- * @param targetGroupName
+ * @param targetGroupName the target cluster group to join.
*/
public void joinGroup(String targetGroupName) {
Node node = clusterManager.getNode();
@@ -95,9 +95,9 @@ public class ManageGroupCommandHandler e
}
/**
- * Removes {@link Node} from the target {@link Group}.
+ * Remove a {@link Node} from the target cluster {@link Group}.
*
- * @param targetGroupName
+ * @param targetGroupName the target cluster group where to remove the node.
*/
public void quitGroup(String targetGroupName) {
Node node = clusterManager.getNode();
@@ -111,9 +111,8 @@ public class ManageGroupCommandHandler e
}
}
-
/**
- * Removes {@link Node} from ALL {@link Group}s.
+ * Remove a {@link Node} from all cluster {@link Group}s.
*/
public void purgeGroups() {
Node node = clusterManager.getNode();
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupResult.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupResult.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupResult.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupResult.java Wed Apr 24 13:23:54 2013
@@ -20,7 +20,7 @@ import java.util.HashSet;
import java.util.Set;
/**
- * Manager group result.
+ * Cluster manage group result event.
*/
public class ManageGroupResult extends Result {
@@ -46,4 +46,5 @@ public class ManageGroupResult extends R
public void setGroups(Set<Group> groups) {
this.groups = groups;
}
+
}
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupResultHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupResultHandler.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupResultHandler.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupResultHandler.java Wed Apr 24 13:23:54 2013
@@ -16,7 +16,7 @@ package org.apache.karaf.cellar.core.con
import org.apache.karaf.cellar.core.command.ResultHandler;
/**
- * Manager group result handler.
+ * Handler on cluster manage group result handler event.
*/
public class ManageGroupResultHandler extends ResultHandler<ManageGroupResult> {
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommand.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommand.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommand.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommand.java Wed Apr 24 13:23:54 2013
@@ -16,18 +16,13 @@ package org.apache.karaf.cellar.core.con
import org.apache.karaf.cellar.core.command.Command;
/**
- * Manage handlers command.
+ * Cluster manage handlers command event.
*/
public class ManageHandlersCommand extends Command<ManageHandlersResult> {
private String handlerName;
private Boolean status = Boolean.TRUE;
- /**
- * Constructor
- *
- * @param id
- */
public ManageHandlersCommand(String id) {
super(id);
}
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommandHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommandHandler.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommandHandler.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommandHandler.java Wed Apr 24 13:23:54 2013
@@ -25,11 +25,10 @@ import org.osgi.service.cm.Configuration
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.swing.plaf.basic.BasicInternalFrameTitlePane;
import java.util.Dictionary;
/**
- * Manage handlers command handler.
+ * Handler for cluster manage handlers command handler event.
*/
public class ManageHandlersCommandHandler extends CommandHandler<ManageHandlersCommand, ManageHandlersResult> {
@@ -42,10 +41,10 @@ public class ManageHandlersCommandHandle
private Consumer consumer;
/**
- * Returns a map containing all managed {@code EventHandler}s and their status.
+ * Execute the cluster manage handlers command event and get the result.
*
- * @param command
- * @return
+ * @param command the cluster manage handlers command event.
+ * @return the cluster manage handlers result event.
*/
@Override
public ManageHandlersResult execute(ManageHandlersCommand command) {
@@ -96,7 +95,7 @@ public class ManageHandlersCommandHandle
/**
* Store the handler switch configuration in configuration admin.
*
- * @param handler the handler to store
+ * @param handler the handler to store.
* @param switchStatus the switch status to store.
*/
private void persist(String handler, SwitchStatus switchStatus) {
@@ -123,4 +122,5 @@ public class ManageHandlersCommandHandle
public Switch getSwitch() {
return commandSwitch;
}
+
}
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersResult.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersResult.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersResult.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersResult.java Wed Apr 24 13:23:54 2013
@@ -19,17 +19,12 @@ import java.util.HashMap;
import java.util.Map;
/**
- * Manage handler result.
+ * Cluster manage handlers result event.
*/
public class ManageHandlersResult extends Result {
public Map<String, String> handlers = new HashMap<String, String>();
- /**
- * Constructor.
- *
- * @param id
- */
public ManageHandlersResult(String id) {
super(id);
}
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersResultHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersResultHandler.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersResultHandler.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersResultHandler.java Wed Apr 24 13:23:54 2013
@@ -16,7 +16,7 @@ package org.apache.karaf.cellar.core.con
import org.apache.karaf.cellar.core.command.ResultHandler;
/**
- * Manage handlers result handler.
+ * Handler for cluster manage handlers result event.
*/
public class ManageHandlersResultHandler extends ResultHandler<ManageHandlersResult> {
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommand.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommand.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommand.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommand.java Wed Apr 24 13:23:54 2013
@@ -16,45 +16,34 @@ package org.apache.karaf.cellar.core.con
import org.apache.karaf.cellar.core.command.Command;
/**
- * Producer switch command.
+ * Cluster producer switch command event.
*/
public class ProducerSwitchCommand extends Command<ProducerSwitchResult> {
private SwitchStatus status = null;
- /**
- * Constructor
- *
- * @param id
- */
public ProducerSwitchCommand(String id) {
super(id);
}
- /**
- * Constructor
- *
- * @param id
- * @param status
- */
public ProducerSwitchCommand(String id, SwitchStatus status) {
super(id);
this.status = status;
}
/**
- * Returns the {@code SwitchStatus}
+ * Get the current producer switch status.
*
- * @return
+ * @return the current producer switch status.
*/
public SwitchStatus getStatus() {
return status;
}
/**
- * Sets the {@code SwitchStatus}
+ * Set the new producer switch status.
*
- * @param status
+ * @param status the new producer switch status.
*/
public void setStatus(SwitchStatus status) {
this.status = status;
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommandHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommandHandler.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommandHandler.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommandHandler.java Wed Apr 24 13:23:54 2013
@@ -17,12 +17,11 @@ import org.apache.karaf.cellar.core.Conf
import org.apache.karaf.cellar.core.Producer;
import org.apache.karaf.cellar.core.command.CommandHandler;
import org.osgi.service.cm.Configuration;
-import org.osgi.service.cm.ConfigurationAdmin;
import java.util.Dictionary;
/**
- * Producer switch command handler.
+ * Handler for cluster producer switch command event.
*/
public class ProducerSwitchCommandHandler extends CommandHandler<ProducerSwitchCommand, ProducerSwitchResult> {
@@ -30,10 +29,12 @@ public class ProducerSwitchCommandHandle
private final Switch commandSwitch = new BasicSwitch(SWITCH_ID);
/**
- * Handle the {@code ProducerSwitchCommand} command.
+ * Handle a received cluster producer switch command event.
*
- * @param command
+ * @param command the received cluster producer switch command event.
+ * @return the cluster producer switch result.
*/
+ @Override
public ProducerSwitchResult execute(ProducerSwitchCommand command) {
// query
if (command.getStatus() == null) {
@@ -75,18 +76,32 @@ public class ProducerSwitchCommandHandle
}
}
+ /**
+ * Get the cluster event type that this handler can handle.
+ *
+ * @return the producer switch command event type.
+ */
+ @Override
public Class<ProducerSwitchCommand> getType() {
return ProducerSwitchCommand.class;
}
+ /**
+ * Get the handler switch.
+ *
+ * @return the handler switch.
+ */
+ @Override
public Switch getSwitch() {
return commandSwitch;
}
+ @Override
public Producer getProducer() {
return producer;
}
+ @Override
public void setProducer(Producer producer) {
this.producer = producer;
}
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchResult.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchResult.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchResult.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchResult.java Wed Apr 24 13:23:54 2013
@@ -16,40 +16,22 @@ package org.apache.karaf.cellar.core.con
import org.apache.karaf.cellar.core.command.Result;
/**
- * Producer switch result.
+ * Cluster producer switch result event.
*/
public class ProducerSwitchResult extends Result {
protected Boolean success = Boolean.TRUE;
protected Boolean status = Boolean.TRUE;
- /**
- * Constructor
- *
- * @param id
- */
public ProducerSwitchResult(String id) {
super(id);
}
- /**
- * Constructor
- *
- * @param id
- * @param success
- */
public ProducerSwitchResult(String id, Boolean success) {
super(id);
this.success = success;
}
- /**
- * Constructor
- *
- * @param id
- * @param success
- * @param status
- */
public ProducerSwitchResult(String id, Boolean success, Boolean status) {
super(id);
this.success = success;
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchResultHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchResultHandler.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchResultHandler.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchResultHandler.java Wed Apr 24 13:23:54 2013
@@ -16,10 +16,15 @@ package org.apache.karaf.cellar.core.con
import org.apache.karaf.cellar.core.command.ResultHandler;
/**
- * Producer switch result handler.
+ * Handler for the cluster producer switch result event.
*/
public class ProducerSwitchResultHandler extends ResultHandler<ProducerSwitchResult> {
+ /**
+ * Get the event type that this handler can handle.
+ *
+ * @return the cluster producer switch result event type.
+ */
@Override
public Class<ProducerSwitchResult> getType() {
return ProducerSwitchResult.class;
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/Switch.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/Switch.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/Switch.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/control/Switch.java Wed Apr 24 13:23:54 2013
@@ -14,31 +14,31 @@
package org.apache.karaf.cellar.core.control;
/**
- * An interface that describes objects that can be turned on/off and act like a switch.
+ * Description of a switch, that it can be turned on or off.
*/
public interface Switch {
/**
- * Returns the name of the Switch.
+ * Get the name of the switch.
*
- * @return
+ * @return the switch name.
*/
public String getName();
/**
- * Turns on.
+ * Turn on the switch.
*/
public void turnOn();
/**
- * Turns off
+ * Turn off the switch.
*/
public void turnOff();
/**
- * Returns the status of the switch.
+ * Get the current status of the switch.
*
- * @return
+ * @return the current switch status.
*/
public SwitchStatus getStatus();
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/discovery/Discovery.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/discovery/Discovery.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/discovery/Discovery.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/discovery/Discovery.java Wed Apr 24 13:23:54 2013
@@ -13,6 +13,9 @@
*/
package org.apache.karaf.cellar.core.discovery;
+/**
+ * Discovery configuration constants.
+ */
public class Discovery {
public static final String PID = "org.apache.karaf.cellar.discovery";
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/discovery/DiscoveryService.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/discovery/DiscoveryService.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/discovery/DiscoveryService.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/discovery/DiscoveryService.java Wed Apr 24 13:23:54 2013
@@ -15,27 +15,30 @@ package org.apache.karaf.cellar.core.dis
import java.util.Set;
+/**
+ * Description of a discovery service.
+ */
public interface DiscoveryService {
/**
- * Sign In to the {@link BlackboardDiscoveryService}.
+ * Sign in on the discovery service.
*/
void signIn();
/**
- * Refresh to the {@link BlackboardDiscoveryService}.
+ * Refresh the discovery service.
*/
void refresh();
/**
- * Sign Out of the {@link BlackboardDiscoveryService}.
+ * Sign out from the discovery service.
*/
void signOut();
/**
- * Returns a {@link java.util.Set} of peers that where discovered.
+ * Get the list of peers found by the discovery service.
*
- * @return
+ * @return a set of peers.
*/
Set<String> discoverMembers();
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/Event.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/Event.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/Event.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/Event.java Wed Apr 24 13:23:54 2013
@@ -20,7 +20,7 @@ import java.io.Serializable;
import java.util.Set;
/**
- * Represents an event that is broadcasted to the cluster.
+ * This class represents a cluster event that is broad-casted to the cluster.
* The event is always generated by a single node (source) but can have none or multiple destinations.
*/
public class Event implements Serializable {
@@ -32,11 +32,6 @@ public class Event implements Serializab
protected Boolean force = Boolean.FALSE;
protected Boolean postPublish = Boolean.FALSE;
- /**
- * Constructor
- *
- * @param id
- */
public Event(String id) {
this.id = id;
}
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventConsumer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventConsumer.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventConsumer.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventConsumer.java Wed Apr 24 13:23:54 2013
@@ -16,29 +16,32 @@ package org.apache.karaf.cellar.core.eve
import org.apache.karaf.cellar.core.Consumer;
/**
- * Event consumer.
+ * Describe a cluster event consumer.
*/
public interface EventConsumer<E extends Event> extends Consumer<E> {
/**
- * Consumes {@code Event}s to the cluster.
+ * Consume a cluster {@code Event} from the cluster.
*
* @param event
*/
+ @Override
public void consume(E event);
/**
- * Start consuming
+ * Start the consumer.
*/
public void start();
/**
- * Stop consuming
+ * Stop the consumer.
*/
public void stop();
/**
- * Returns true if Consumer is consuming
+ * Check if the consumer is active.
+ *
+ * @return true if the consumer is active, false else.
*/
public Boolean isConsuming();
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventDispatchTask.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventDispatchTask.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventDispatchTask.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventDispatchTask.java Wed Apr 24 13:23:54 2013
@@ -28,38 +28,17 @@ public class EventDispatchTask<E extends
private long timeout = 10000;
private long interval = 1000;
- /**
- * Constructor
- *
- * @param event
- * @param handlerRegistry
- */
public EventDispatchTask(E event, EventHandlerRegistry handlerRegistry) {
this.event = event;
this.handlerRegistry = handlerRegistry;
}
- /**
- * Constructor
- *
- * @param event
- * @param handlerRegistry
- * @param timeout
- */
public EventDispatchTask(E event, EventHandlerRegistry handlerRegistry, long timeout) {
this.event = event;
this.handlerRegistry = handlerRegistry;
this.timeout = timeout;
}
- /**
- * Constructor
- *
- * @param handlerRegistry
- * @param timeout
- * @param interval
- * @param event
- */
public EventDispatchTask(EventHandlerRegistry handlerRegistry, long timeout, long interval, E event) {
this.handlerRegistry = handlerRegistry;
this.timeout = timeout;
@@ -67,6 +46,7 @@ public class EventDispatchTask<E extends
this.event = event;
}
+ @Override
public void run() {
try {
boolean dispatched = false;
@@ -80,7 +60,7 @@ public class EventDispatchTask<E extends
try {
Thread.sleep(interval);
} catch (InterruptedException e) {
- LOGGER.warn("Interupted while waiting for event handler", e);
+ LOGGER.warn("Interrupted while waiting for event handler", e);
}
}
}
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventDispatcher.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventDispatcher.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventDispatcher.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventDispatcher.java Wed Apr 24 13:23:54 2013
@@ -16,15 +16,17 @@ package org.apache.karaf.cellar.core.eve
import org.apache.karaf.cellar.core.Dispatcher;
/**
- * A dispatcher which dispatches each event to the appropriate Handler.
+ * Describe a cluster event dispatcher.
+ * A dispatcher dispatches each cluster event to the appropriate handler.
*/
public interface EventDispatcher<E extends Event> extends Dispatcher<E> {
/**
- * Dispatches the Event to the appropriate handler.
+ * Dispatch a cluster event to the appropriate handler.
*
- * @param event
+ * @param event the cluster event.
*/
+ @Override
public void dispatch(E event);
}
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandler.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandler.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandler.java Wed Apr 24 13:23:54 2013
@@ -13,18 +13,19 @@
*/
package org.apache.karaf.cellar.core.event;
-
import org.apache.karaf.cellar.core.Handler;
/**
- * Event handler interface.
+ * Description of a cluster event handler.
*/
public interface EventHandler<E extends Event> extends Handler<E> {
public static String MANAGED_FILTER = "(managed=true)";
/**
- * Called to handle {@code Event}.
+ * Handle a cluster event.
+ *
+ * @param event the cluster event to handle.
*/
public void handle(E event);
Modified: karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandlerRegistry.java
URL: http://svn.apache.org/viewvc/karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandlerRegistry.java?rev=1471401&r1=1471400&r2=1471401&view=diff
==============================================================================
--- karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandlerRegistry.java (original)
+++ karaf/cellar/branches/cellar-2.3.x/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandlerRegistry.java Wed Apr 24 13:23:54 2013
@@ -11,20 +11,23 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.karaf.cellar.core.event;
import org.apache.karaf.cellar.core.Handler;
import org.apache.karaf.cellar.core.HandlerRegistry;
+/**
+ * Description of a cluster event handlers registry.
+ */
public interface EventHandlerRegistry<E extends Event> extends HandlerRegistry<E, Handler<E>> {
/**
- * Returns the {@code EventHandler} for the given {@code Event}.
+ * Get the handler which is able to handle a given cluster event.
*
- * @param event
- * @return
+ * @param event the cluster event to handle.
+ * @return the handler which is able to handle the cluster event.
*/
+ @Override
public EventHandler<E> getHandler(E event);
}