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 11:39:26 UTC
svn commit: r1471327 [1/2] - in /karaf/cellar/trunk/core/src:
main/java/org/apache/karaf/cellar/core/
main/java/org/apache/karaf/cellar/core/command/
main/java/org/apache/karaf/cellar/core/completer/
main/java/org/apache/karaf/cellar/core/control/ main...
Author: jbonofre
Date: Wed Apr 24 09:39:25 2013
New Revision: 1471327
URL: http://svn.apache.org/r1471327
Log:
Code cleanup
Modified:
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/ClusterManager.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Configurations.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Consumer.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Dispatcher.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Group.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/GroupManager.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Handler.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/HandlerRegistry.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/MultiNode.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Node.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Producer.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Synchronizer.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/BasicCommandStore.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/ClusteredExecutionContext.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/Command.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/CommandHandler.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/ResultHandler.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/TimeoutTask.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/completer/AllNodeCompleter.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/completer/NodeCompleterSupport.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/BasicSwitch.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommand.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommandHandler.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchResult.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupCommandHandler.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommand.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommandHandler.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersResult.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommand.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommandHandler.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchResult.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/Switch.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/discovery/Discovery.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/discovery/DiscoveryTask.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/Event.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventConsumer.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventDispatchTask.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventDispatcher.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandler.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandlerRegistry.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandlerRegistryDispatcher.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandlerServiceRegistry.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventProducer.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventTracker.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventTransportFactory.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/exception/ProducerNotFoundException.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/exception/StoreNotFoundException.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/CellarCommandSupport.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/AllGroupsCompleter.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/GroupCompleterSupport.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/LocalGroupsCompleter.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/OtherGroupsCompleter.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/utils/CellarUtils.java
karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/utils/CombinedClassLoader.java
karaf/cellar/trunk/core/src/main/resources/OSGI-INF/blueprint/blueprint.xml
karaf/cellar/trunk/core/src/test/java/org/apache/karaf/cellar/core/CellarSupportTest.java
karaf/cellar/trunk/core/src/test/java/org/apache/karaf/cellar/core/utils/CellarUtilsTest.java
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/CellarSupport.java Wed Apr 24 09:39:25 2013
@@ -28,7 +28,7 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
- * Cellar support.
+ * Cellar generic support. This class provides a set of util methods used by other classes.
*/
public class CellarSupport {
@@ -39,11 +39,13 @@ public class CellarSupport {
protected ConfigurationAdmin configurationAdmin;
/**
- * Lists the BlackList for the specified feature.
+ * Get a set of resources in the Cellar cluster groups configuration.
*
- * @param category
- * @param group
- * @return
+ * @param listType the comma separated list of resources.
+ * @param group the cluster group name.
+ * @param category the resource category name.
+ * @param type the event type (inbound, outbound).
+ * @return the set of resources.
*/
public Set<String> getListEntries(String listType, String group, String category, EventType type) {
Set<String> result = null;
@@ -83,13 +85,13 @@ public class CellarSupport {
}
/**
- * Lists the BlackList for the specified feature.
+ * Get the resources in the Cellar cluster groups configuration.
*
- * @param category
- * @param groups
- * @param category
- * @param type
- * @return
+ * @param listType the comma separated string of resources.
+ * @param groups the cluster groups names.
+ * @param category the resource category name.
+ * @param type the event type (inbound, outbound).
+ * @return the set of resources.
*/
public Set<String> getListEntries(String listType, Collection<String> groups, String category, EventType type) {
Set<String> result = null;
@@ -107,12 +109,13 @@ public class CellarSupport {
}
/**
- * Lists the BlackList for the specified feature.
+ * Get a set of resources in the Cellar cluster groups configuration.
*
- * @param category
- * @param category
- * @param type
- * @return
+ * @param listType a comma separated string of resources.
+ * @param group the cluster group.
+ * @param category the resource category name.
+ * @param type the event type (inbound, outbound).
+ * @return the set of resources.
*/
public Set<String> getListEntries(String listType, Group group, String category, EventType type) {
Set<String> result = null;
@@ -129,19 +132,19 @@ public class CellarSupport {
}
/**
- * Returns true if the specified event is allowed.
+ * Check if a resource is allowed for a type of cluster event.
*
- * @param category
- * @param event
- * @param type
- * @return
+ * @param group the cluster group.
+ * @param category the resource category name.
+ * @param event the resource name.
+ * @param type the 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) {
@@ -150,7 +153,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)) {
@@ -163,11 +166,11 @@ public class CellarSupport {
}
/**
- * Matches text using a pattern containing wildcards.
+ * Check if a string match a regex.
*
- * @param item
- * @param pattern
- * @return
+ * @param item the string to check.
+ * @param pattern the regex pattern.
+ * @return true if the item string matches the pattern, false else.
*/
protected boolean wildCardMatch(String item, String pattern) {
// update the pattern to have a valid regex pattern
@@ -175,11 +178,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/trunk/core/src/main/java/org/apache/karaf/cellar/core/ClusterManager.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/ClusterManager.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/ClusterManager.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/ClusterManager.java Wed Apr 24 09:39:25 2013
@@ -24,87 +24,86 @@ import java.util.Set;
public interface ClusterManager {
/**
- * Returns a named distributed map.
+ * Get a map in the cluster.
*
- * @param mapName
- * @return
+ * @param mapName the map name in the cluster.
+ * @return the map in the cluster.
*/
public Map getMap(String mapName);
/**
- * Returns a named distributed list.
+ * Get a list in the cluster.
*
- * @param listName
- * @return
+ * @param listName the list name in the cluster.
+ * @return the list in the cluster.
*/
public List getList(String listName);
-
/**
- * Returns a named distributed list.
+ * Get a set in the cluster.
*
- * @param setName
- * @return
+ * @param setName the set name in the cluster.
+ * @return the set in the cluster.
*/
public Set getSet(String setName);
-
/**
- * Returns a list of {@code Node}s.
+ * Get the nodes in the cluster.
*
- * @return
+ * @return the set of nodes in the cluster.
*/
public Set<Node> listNodes();
/**
- * Returns the {@link Node} with specified id.
+ * Get the nodes with a given ID.
*
- * @return
+ * @param ids the collection of ID to look for.
+ * @return the set of nodes.
*/
public Set<Node> listNodes(Collection<String> ids);
/**
- * Returns the {@link Node} with specified {@link Group}.
+ * Get the nodes in a given cluster group.
*
- * @return
+ * @param group the cluster group.
+ * @return the set of nodes in the cluster group.
*/
public Set<Node> listNodesByGroup(Group group);
-
/**
- * Returns the {@link Node} with specified id.
+ * Get a node identified by a given ID.
*
- * @return
+ * @param id the id of the node to look for.
+ * @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 a unique ID across the cluster.
*/
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/trunk/core/src/main/java/org/apache/karaf/cellar/core/Configurations.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Configurations.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Configurations.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Configurations.java Wed Apr 24 09:39:25 2013
@@ -14,7 +14,7 @@
package org.apache.karaf.cellar.core;
/**
- * Configurations.
+ * Configurations constants.
*/
public class Configurations {
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Consumer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Consumer.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Consumer.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Consumer.java Wed Apr 24 09:39:25 2013
@@ -25,14 +25,14 @@ public interface Consumer<T extends Seri
/**
* 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/trunk/core/src/main/java/org/apache/karaf/cellar/core/Dispatcher.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Dispatcher.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Dispatcher.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Dispatcher.java Wed Apr 24 09:39:25 2013
@@ -21,9 +21,9 @@ import java.io.Serializable;
public interface Dispatcher<T extends Serializable> {
/**
- * Dispatches the object to the appropriate handler.
+ * Dispatch an object to the appropriate handler.
*
- * @param obj
+ * @param obj the object to dispatch.
*/
public void dispatch(T obj);
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Group.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Group.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Group.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Group.java Wed Apr 24 09:39:25 2013
@@ -13,23 +13,17 @@
*/
package org.apache.karaf.cellar.core;
-import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;
/**
- * Cellar group.
+ * Cellar cluster group.
*/
public class Group implements MultiNode {
private String name;
private Set<Node> nodes = new HashSet<Node>();
- /**
- * Constructor
- *
- * @param name
- */
public Group(String name) {
this.name = name;
}
@@ -42,10 +36,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/trunk/core/src/main/java/org/apache/karaf/cellar/core/GroupManager.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/GroupManager.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/GroupManager.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/GroupManager.java Wed Apr 24 09:39:25 2013
@@ -17,120 +17,119 @@ import java.util.Map;
import java.util.Set;
/**
- * Generic group manager interface.
+ * Generic cluster group manager interface.
*/
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 created 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.
+ * Look for a cluster group with a given name.
*
- * @param groupName
- * @return
+ * @param groupName the cluster group name to look for.
+ * @return the cluster group found, or null if no cluster group found.
*/
public Group findGroupByName(String groupName);
/**
- * Returns a map of {@link Node}s.
+ * Get the list of cluster groups.
*
- * @return
+ * @return a map of cluster groups name and cluster groups.
*/
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 means a cluster group where the local node is belonging.
*
- * @return
+ * @return a set of local cluster groups.
*/
public Set<Group> listLocalGroups();
/**
- * Check if the local node is part of the given group.
+ * Check if a given cluster group is a local one.
+ * A "local" clsuter group means a cluster group where the local node is belonging.
*
- * @param groupName the group name.
- * @return true if the local node is part of the group, false else.
+ * @param groupName the cluster group name.
+ * @return true if the cluster group is a local one, false else.
*/
public boolean isLocalGroup(String groupName);
/**
- * Returns the {@link Group}s of the specified {@link Node}.
+ * Get the list of all cluster groups "hosting" the local node.
*
- * @return
+ * @return the list of all cluster groups "hosting" the local node.
*/
public Set<Group> listAllGroups();
-
/**
- * Returns the {@link Group}s of the specified {@link Node}.
+ * Get the cluster groups where a given node is belonging.
*
- * @param node
- * @return
+ * @param node the node.
+ * @return the set of cluster groups "hosting" the node.
*/
public Set<Group> listGroups(Node node);
/**
- * Retrurns the {@link Group} names of the current {@Node}.
+ * Get the cluster group names "hosting" the local node.
*
- * @return
+ * @return the set of cluster group names "hosting" the local node.
*/
public Set<String> listGroupNames();
/**
- * Returns the {@link Group} names of the specified {@link Node}.
+ * Get the cluster group names "hosting" a given node.
*
- * @param node
- * @return
+ * @param node the node.
+ * @return the set of cluster group names "hosting" the given node.
*/
public Set<String> listGroupNames(Node node);
-
/**
- * Registers current {@link Node} to the {@link Group}.
+ * Register the local node in a given cluster group.
*
- * @param group
+ * @param group the cluster group to join.
*/
public void registerGroup(Group group);
/**
- * Registers current {@link Node} to the {@link Group}.
+ * Register the locla node in a given cluster group.
*
- * @param groupName
+ * @param groupName the cluster group name to join.
*/
public void registerGroup(String groupName);
-
/**
- * UnRegisters current {@link Node} to the {@link Group}.
+ * Un-register the local node from a given cluster group.
*
- * @param group
+ * @param group the cluster group to quit.
*/
public void unRegisterGroup(Group group);
/**
- * UnRegisters current {@link Node} to the {@link Group}.
+ * Un-register the local node from a given cluster group.
*
- * @param groupName
+ * @param groupName the cluster group name to quite.
*/
public void unRegisterGroup(String groupName);
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Handler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Handler.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Handler.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Handler.java Wed Apr 24 09:39:25 2013
@@ -23,16 +23,16 @@ import java.io.Serializable;
public interface Handler<T extends Serializable> {
/**
- * Returns the Class of the object that is to be handled.
+ * Get the type of the event handled by this handler.
*
- * @return
+ * @return the type of the event that the handler can handle.
*/
public Class<T> getType();
/**
- * Returns the {@code Switch}.
+ * Get the handler switch.
*
- * @return
+ * @return the handler switch.
*/
public Switch getSwitch();
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/HandlerRegistry.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/HandlerRegistry.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/HandlerRegistry.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/HandlerRegistry.java Wed Apr 24 09:39:25 2013
@@ -21,10 +21,10 @@ import java.io.Serializable;
public interface HandlerRegistry<T extends Serializable, H extends Handler<T>> {
/**
- * Returns the {@code Handler} for the given object.
+ * Get the handler that can handle a given cluster event.
*
- * @param obj
- * @return
+ * @param obj the cluster event to handle.
+ * @return the handler in the registry that can handle the given cluster event.
*/
public H getHandler(T obj);
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/MultiNode.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/MultiNode.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/MultiNode.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/MultiNode.java Wed Apr 24 09:39:25 2013
@@ -16,9 +16,23 @@ package org.apache.karaf.cellar.core;
import java.io.Serializable;
import java.util.Set;
+/**
+ * Multiple nodes container (group) interface.
+ */
public interface MultiNode extends Serializable {
+ /**
+ * Set the nodes hosted in the multi-node container.
+ *
+ * @param nodes the set of nodes to store in this container.
+ */
public void setNodes(Set<Node> nodes);
+
+ /**
+ * Get the list of nodes in the multi-node container.
+ *
+ * @return the set of nodes in the multi-node container.
+ */
public Set<Node> getNodes();
}
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Node.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Node.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Node.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Node.java Wed Apr 24 09:39:25 2013
@@ -21,23 +21,23 @@ import java.io.Serializable;
public interface Node extends Serializable {
/**
- * Returns the identifier of the node.
+ * Get the ID of the node.
*
- * @return
+ * @return the node ID.
*/
public String getId();
/**
- * Returns the name of the host
+ * Get the hostname of the node.
*
- * @return
+ * @return the node hostname.
*/
public String getHost();
/**
- * Returns the Port of the host
+ * Get the port number of the node.
*
- * @return
+ * @return the node port number.
*/
public int getPort();
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Producer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Producer.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Producer.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Producer.java Wed Apr 24 09:39:25 2013
@@ -25,14 +25,14 @@ public interface Producer<T extends Seri
/**
* Produce an object.
*
- * @param obj
+ * @param obj the object to produce.
*/
public void produce(T obj);
/**
- * Returns the {@code Switch}.
+ * Get the producer switch.
*
- * @return
+ * @return the producer switch.
*/
public Switch getSwitch();
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Synchronizer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Synchronizer.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Synchronizer.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/Synchronizer.java Wed Apr 24 09:39:25 2013
@@ -19,19 +19,24 @@ package org.apache.karaf.cellar.core;
public interface Synchronizer {
/**
- * Pushes local state to the shared resource.
+ * Push local resources states in a cluster group.
+ *
+ * @param group the cluster group where to push local resources states.
*/
public void push(Group group);
/**
- * Pull state changes from the shared resource.
+ * Pull resources states from a cluster group to update local states.
+ *
+ * @param group the cluster group where to pull 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.
+ * @return true if sync flag is enabled, false else.
*/
public Boolean isSyncEnabled(Group group);
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/BasicCommandStore.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/BasicCommandStore.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/BasicCommandStore.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/BasicCommandStore.java Wed Apr 24 09:39:25 2013
@@ -23,10 +23,12 @@ public class BasicCommandStore implement
private ConcurrentMap<String, Command> pending = new ConcurrentHashMap<String, Command>();
+ @Override
public ConcurrentMap<String, Command> getPending() {
return pending;
}
+ @Override
public void setPending(ConcurrentMap<String, Command> pending) {
this.pending = pending;
}
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/ClusteredExecutionContext.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/ClusteredExecutionContext.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/ClusteredExecutionContext.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/ClusteredExecutionContext.java Wed Apr 24 09:39:25 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,7 @@ public class ClusteredExecutionContext i
this.commandStore = commandStore;
}
+ @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/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/Command.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/Command.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/Command.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/Command.java Wed Apr 24 09:39:25 2013
@@ -57,9 +57,9 @@ public class Command<R extends Result> e
}
/**
- * Adds {@code Results} to the result queue.
+ * Add {@code Results} to the result queue.
*
- * @param results
+ * @param results the results in the queue.
*/
public void addResults(R... results) {
if (results != null && results.length > 0) {
@@ -78,11 +78,11 @@ public class Command<R extends Result> e
}
/**
- * Returns the responses.
- * If no results found it returns an empty map.
+ * Return the responses.
+ * If no result is found, it returns an empty map.
*
- * @return
- * @throws Exception
+ * @return a map of results.
+ * @throws Exception in case of interruption.
*/
public Map<Node, R> getResult() throws InterruptedException {
Map<Node, R> nodeResults = null;
@@ -92,7 +92,6 @@ public class Command<R extends Result> e
return nodeResults;
}
-
public long getTimeout() {
return timeout;
}
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/CommandHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/CommandHandler.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/CommandHandler.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/CommandHandler.java Wed Apr 24 09:39:25 2013
@@ -30,10 +30,11 @@ public abstract class CommandHandler<C e
protected Producer producer;
/**
- * Handles the the {@code Command}.
+ * Handle a {@code Command}.
*
- * @param command
+ * @param command the command to handle.
*/
+ @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 {@code Command} and return a {@code Result}.
*
- * @param command
- * @return
+ * @param command the command to execute.
+ * @return the result of the execution.
*/
public abstract R execute(C command);
+ /**
+ * Get the type of the command.
+ *
+ * @return the type class.
+ */
+ @Override
public abstract Class<C> getType();
- public abstract Switch getSwitch();
-
/**
- * Returns the {@code Producer}.
+ * Get the switch of the command handler.
*
- * @return
+ * @return the command 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/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/ResultHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/ResultHandler.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/ResultHandler.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/ResultHandler.java Wed Apr 24 09:39:25 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.
+ * Handler for the cluster result events.
*/
public class ResultHandler<R extends Result> implements EventHandler<R> {
@@ -29,10 +29,11 @@ public class ResultHandler<R extends Res
private CommandStore commandStore;
/**
- * Retrieves the correlated command from the store and sets the result on the command object.
+ * Retrieve the correlated command from the store and set the result on the command object.
*
- * @param result
+ * @param result the cluster result event.
*/
+ @Override
public void handle(R result) {
if (commandStore != null && commandStore.getPending() != null) {
String id = result.getId();
@@ -44,10 +45,26 @@ public class ResultHandler<R extends Res
}
}
+ /**
+ * Get the type of result.
+ *
+ * @return the result type.
+ */
+ @Override
public Class<R> getType() {
return null;
}
+ /**
+ * Get the result handler switch.
+ *
+ * @return the result handler switch.
+ */
+ @Override
+ public Switch getSwitch() {
+ return handlerSwitch;
+ }
+
public CommandStore getCommandStore() {
return commandStore;
}
@@ -56,8 +73,4 @@ public class ResultHandler<R extends Res
this.commandStore = commandStore;
}
- public Switch getSwitch() {
- return handlerSwitch;
- }
-
}
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/TimeoutTask.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/TimeoutTask.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/TimeoutTask.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/command/TimeoutTask.java Wed Apr 24 09:39:25 2013
@@ -29,8 +29,9 @@ public class TimeoutTask implements Runn
/**
* Runs the timeout task.
*/
+ @Override
public void run() {
- //Check if command is still pending.
+ // check if command is still pending
Boolean pending = store.getPending().containsKey(command);
if (pending) {
store.getPending().remove(command);
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/completer/AllNodeCompleter.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/completer/AllNodeCompleter.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/completer/AllNodeCompleter.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/completer/AllNodeCompleter.java Wed Apr 24 09:39:25 2013
@@ -23,8 +23,8 @@ public class AllNodeCompleter extends No
/**
* Always returns true.
*
- * @param node
- * @return
+ * @param node the node.
+ * @return return true.
*/
@Override
protected boolean acceptsNode(Node node) {
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/completer/NodeCompleterSupport.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/completer/NodeCompleterSupport.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/completer/NodeCompleterSupport.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/completer/NodeCompleterSupport.java Wed Apr 24 09:39:25 2013
@@ -27,6 +27,7 @@ public abstract class NodeCompleterSuppo
private ClusterManager clusterManager;
+ @Override
public int complete(String buffer, int cursor, List<String> candidates) {
StringsCompleter delegate = new StringsCompleter();
try {
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/BasicSwitch.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/BasicSwitch.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/BasicSwitch.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/BasicSwitch.java Wed Apr 24 09:39:25 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}.
+ * Return the current status of the {@code Switch}.
*
* @return
*/
+ @Override
public SwitchStatus getStatus() {
return status;
}
/**
- * Returns the name of the {@code Switch}.
+ * Return the name of the {@code Switch}.
*
* @return
*/
+ @Override
public String getName() {
return name;
}
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommand.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommand.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommand.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommand.java Wed Apr 24 09:39:25 2013
@@ -22,40 +22,28 @@ public class ConsumerSwitchCommand exten
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}
+ * Return the {@code SwitchStatus}.
*
- * @return
+ * @return the current switch status.
*/
public SwitchStatus getStatus() {
return status;
}
/**
- * Sets the {@code SwitchStatus}
+ * Set the {@code SwitchStatus}.
*
- * @param status
+ * @param status the new switch status.
*/
public void setStatus(SwitchStatus status) {
this.status = status;
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommandHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommandHandler.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommandHandler.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchCommandHandler.java Wed Apr 24 09:39:25 2013
@@ -76,10 +76,12 @@ public class ConsumerSwitchCommandHandle
}
}
+ @Override
public Class<ConsumerSwitchCommand> getType() {
return ConsumerSwitchCommand.class;
}
+ @Override
public Switch getSwitch() {
return commandSwitch;
}
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchResult.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchResult.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchResult.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ConsumerSwitchResult.java Wed Apr 24 09:39:25 2013
@@ -23,33 +23,15 @@ public class ConsumerSwitchResult extend
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/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupCommandHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupCommandHandler.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupCommandHandler.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageGroupCommandHandler.java Wed Apr 24 09:39:25 2013
@@ -60,9 +60,9 @@ public class ManageGroupCommandHandler e
}
/**
- * Adds the {@link Group} list to the result.
+ * Add the {@link Group} list to the result.
*
- * @param result
+ * @param result the result where to add the group list.
*/
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 {@link Node} to the target {@link Group}.
*
- * @param targetGroupName
+ * @param targetGroupName the target group name where to add the node.
*/
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 {@link Group}.
*
- * @param targetGroupName
+ * @param targetGroupName the target group name where to remove the node.
*/
public void quitGroup(String targetGroupName) {
Node node = clusterManager.getNode();
@@ -112,7 +112,7 @@ public class ManageGroupCommandHandler e
}
/**
- * Removes {@link Node} from ALL {@link Group}s.
+ * Remove {@link Node} from all {@link Group}s.
*/
public void purgeGroups() {
Node node = clusterManager.getNode();
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommand.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommand.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommand.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommand.java Wed Apr 24 09:39:25 2013
@@ -23,11 +23,6 @@ public class ManageHandlersCommand exten
private String handlerName;
private Boolean status = Boolean.TRUE;
- /**
- * Constructor
- *
- * @param id
- */
public ManageHandlersCommand(String id) {
super(id);
}
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommandHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommandHandler.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommandHandler.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersCommandHandler.java Wed Apr 24 09:39:25 2013
@@ -42,10 +42,10 @@ public class ManageHandlersCommandHandle
private Consumer consumer;
/**
- * Returns a map containing all managed {@code EventHandler}s and their status.
+ * Return a map containing all managed {@code EventHandler}s and their status.
*
- * @param command
- * @return
+ * @param command the manage handlers command to execute.
+ * @return a result containing the map of event handlers (and their status).
*/
@Override
public ManageHandlersResult execute(ManageHandlersCommand command) {
@@ -95,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) {
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersResult.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersResult.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersResult.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ManageHandlersResult.java Wed Apr 24 09:39:25 2013
@@ -25,11 +25,6 @@ public class ManageHandlersResult extend
public Map<String, String> handlers = new HashMap<String, String>();
- /**
- * Constructor.
- *
- * @param id
- */
public ManageHandlersResult(String id) {
super(id);
}
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommand.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommand.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommand.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommand.java Wed Apr 24 09:39:25 2013
@@ -22,40 +22,19 @@ public class ProducerSwitchCommand exten
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}
- *
- * @return
- */
public SwitchStatus getStatus() {
return status;
}
- /**
- * Sets the {@code SwitchStatus}
- *
- * @param status
- */
public void setStatus(SwitchStatus status) {
this.status = status;
}
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommandHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommandHandler.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommandHandler.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchCommandHandler.java Wed Apr 24 09:39:25 2013
@@ -17,7 +17,6 @@ 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;
@@ -30,10 +29,12 @@ public class ProducerSwitchCommandHandle
private final Switch commandSwitch = new BasicSwitch(SWITCH_ID);
/**
- * Handle the {@code ProducerSwitchCommand} command.
+ * Execute a producer switch command.
*
- * @param command
+ * @param command the producer switch command to execute.
+ * @return the result of the command execution.
*/
+ @Override
public ProducerSwitchResult execute(ProducerSwitchCommand command) {
// query
if (command.getStatus() == null) {
@@ -75,18 +76,22 @@ public class ProducerSwitchCommandHandle
}
}
+ @Override
public Class<ProducerSwitchCommand> getType() {
return ProducerSwitchCommand.class;
}
+ @Override
public Switch getSwitch() {
return commandSwitch;
}
+ @Override
public Producer getProducer() {
return producer;
}
+ @Override
public void setProducer(Producer producer) {
this.producer = producer;
}
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchResult.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchResult.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchResult.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/ProducerSwitchResult.java Wed Apr 24 09:39:25 2013
@@ -23,33 +23,15 @@ public class ProducerSwitchResult extend
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/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/Switch.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/Switch.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/Switch.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/control/Switch.java Wed Apr 24 09:39:25 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.
+ * An interface that describes switch that can be turned on/off.
*/
public interface Switch {
/**
- * Returns the name of the Switch.
+ * Returns the name of the switch.
*
- * @return
+ * @return the switch name.
*/
public String getName();
/**
- * Turns on.
+ * Turns on the switch.
*/
public void turnOn();
/**
- * Turns off
+ * Turns off the switch.
*/
public void turnOff();
/**
- * Returns the status of the switch.
+ * Returns the current status of the switch.
*
- * @return
+ * @return the current status of the switch.
*/
public SwitchStatus getStatus();
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/discovery/Discovery.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/discovery/Discovery.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/discovery/Discovery.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/discovery/Discovery.java Wed Apr 24 09:39:25 2013
@@ -11,9 +11,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.karaf.cellar.core.discovery;
+/**
+ * Constants for Discovery.
+ */
public class Discovery {
public static final String PID = "org.apache.karaf.cellar.discovery";
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/discovery/DiscoveryTask.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/discovery/DiscoveryTask.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/discovery/DiscoveryTask.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/discovery/DiscoveryTask.java Wed Apr 24 09:39:25 2013
@@ -14,10 +14,8 @@
package org.apache.karaf.cellar.core.discovery;
import java.io.IOException;
-import java.util.Collections;
import java.util.Dictionary;
import java.util.Hashtable;
-import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
@@ -40,18 +38,18 @@ public class DiscoveryTask implements Ru
private ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
public void init() {
- LOGGER.debug("CELLAR DISCOVERY: a new Task initalized");
+ LOGGER.debug("CELLAR DISCOVERY: a new Task initialized");
scheduler.scheduleWithFixedDelay(this, 10, 10, TimeUnit.SECONDS);
}
public void destroy() {
- LOGGER.debug("CELLAR DISCOVERY: task is beeing destroyed");
+ LOGGER.debug("CELLAR DISCOVERY: task is being destroyed");
scheduler.shutdown();
}
@Override
public void run() {
- LOGGER.trace("CELLAR DISCOVERY: Starting the discovery task.");
+ LOGGER.trace("CELLAR DISCOVERY: starting the discovery task");
if (configurationAdmin != null) {
Set<String> members = new LinkedHashSet<String>();
@@ -60,15 +58,15 @@ public class DiscoveryTask implements Ru
service.refresh();
Set<String> discovered = service.discoverMembers();
members.addAll(discovered);
- LOGGER.trace("CELLAR DISCOVERY: Service {} found members {}", service, discovered);
+ LOGGER.trace("CELLAR DISCOVERY: service {} found members {}", service, discovered);
}
try {
LOGGER.trace("CELLAR DISCOVERY: retrieving configuration for PID={}", Discovery.PID);
Configuration configuration = configurationAdmin.getConfiguration(Discovery.PID);
Dictionary properties = configuration.getProperties();
if (properties == null) {
- //this is a new configuration ...
- LOGGER.trace("CELLAR DISCOVERY: configuration is new!");
+ // this is a new configuration ...
+ LOGGER.trace("CELLAR DISCOVERY: configuration is new");
properties = new Hashtable();
}
String newMemberText = CellarUtils.createStringFromSet(members, true);
@@ -81,7 +79,7 @@ public class DiscoveryTask implements Ru
LOGGER.trace("CELLAR DISCOVERY: found a valid member in the configuration will skip");
}
} catch (IOException e) {
- LOGGER.error("Failed to update member list", e);
+ LOGGER.error("CELLAR DISCOVERY: failed to update member list", e);
}
} else {
LOGGER.trace("CELLAR DISCOVERY: no discovery services found ... ");
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/Event.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/Event.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/Event.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/Event.java Wed Apr 24 09:39:25 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 an 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/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventConsumer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventConsumer.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventConsumer.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventConsumer.java Wed Apr 24 09:39:25 2013
@@ -21,24 +21,27 @@ import org.apache.karaf.cellar.core.Cons
public interface EventConsumer<E extends Event> extends Consumer<E> {
/**
- * Consumes {@code Event}s to the cluster.
+ * Consume {@code Event}s to the cluster.
*
- * @param event
+ * @param event the cluster event to consume.
*/
+ @Override
public void consume(E event);
/**
- * Start consuming
+ * Start to consume cluster events.
*/
public void start();
/**
- * Stop consuming
+ * Stop to consume cluster events.
*/
public void stop();
/**
- * Returns true if Consumer is consuming
+ * Check the current event consumer status.
+ *
+ * @return true if the consumer is consuming, false else.
*/
public Boolean isConsuming();
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventDispatchTask.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventDispatchTask.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventDispatchTask.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventDispatchTask.java Wed Apr 24 09:39:25 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,28 +46,29 @@ public class EventDispatchTask<E extends
this.event = event;
}
+ @Override
public void run() {
try {
- boolean dispatched = false;
+ boolean dispatched = false;
- for (long delay = 0; delay < timeout && !dispatched; delay += interval) {
- EventHandler handler = handlerRegistry.getHandler(event);
- if (handler != null) {
- handler.handle(event);
- dispatched = true;
- } else {
- try {
- Thread.sleep(interval);
- } catch (InterruptedException e) {
- LOGGER.warn("Interupted while waiting for event handler", e);
+ for (long delay = 0; delay < timeout && !dispatched; delay += interval) {
+ EventHandler handler = handlerRegistry.getHandler(event);
+ if (handler != null) {
+ handler.handle(event);
+ dispatched = true;
+ } else {
+ try {
+ Thread.sleep(interval);
+ } catch (InterruptedException e) {
+ LOGGER.warn("Interrupted while waiting for cluster event handler", e);
+ }
}
}
- }
- if (!dispatched) {
- LOGGER.warn("Failed to retrieve handler for event {}", event.getClass());
- }
- }catch(Exception ex) {
- LOGGER.error("Error while dispatching task",ex);
+ if (!dispatched) {
+ LOGGER.warn("Failed to retrieve handler for cluster event {}", event.getClass());
+ }
+ } catch (Exception ex) {
+ LOGGER.error("Error while dispatching task", ex);
}
}
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventDispatcher.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventDispatcher.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventDispatcher.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventDispatcher.java Wed Apr 24 09:39:25 2013
@@ -16,14 +16,14 @@ package org.apache.karaf.cellar.core.eve
import org.apache.karaf.cellar.core.Dispatcher;
/**
- * A dispatcher which dispatches each event to the appropriate Handler.
+ * A dispatcher which 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 the cluster event to the appropriate handler.
*
- * @param event
+ * @param event the cluster event to dispatch.
*/
public void dispatch(E event);
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandler.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandler.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandler.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandler.java Wed Apr 24 09:39:25 2013
@@ -23,7 +23,9 @@ public interface EventHandler<E extends
public static String MANAGED_FILTER = "(managed=true)";
/**
- * Called to handle {@code Event}.
+ * Handle a cluster {@code Event}.
+ *
+ * @param event the cluster event to handle.
*/
public void handle(E event);
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandlerRegistry.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandlerRegistry.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandlerRegistry.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandlerRegistry.java Wed Apr 24 09:39:25 2013
@@ -19,11 +19,12 @@ import org.apache.karaf.cellar.core.Hand
public interface EventHandlerRegistry<E extends Event> extends HandlerRegistry<E, Handler<E>> {
/**
- * Returns the {@code EventHandler} for the given {@code Event}.
+ * Return the cluster {@code EventHandler} for a given cluster {@code Event}.
*
- * @param event
- * @return
+ * @param event the cluster event to handle.
+ * @return the cluster event handler to use.
*/
+ @Override
public EventHandler<E> getHandler(E event);
}
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandlerRegistryDispatcher.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandlerRegistryDispatcher.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandlerRegistryDispatcher.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandlerRegistryDispatcher.java Wed Apr 24 09:39:25 2013
@@ -24,9 +24,6 @@ public class EventHandlerRegistryDispatc
private ExecutorService threadPool;
private EventHandlerRegistry handlerRegistry;
- /**
- * Initialization
- */
public void init() {
if (threadPool == null) {
threadPool = Executors.newCachedThreadPool();
@@ -34,9 +31,9 @@ public class EventHandlerRegistryDispatc
}
/**
- * Dispatches an {@code Event} to the appropriate {@code EventHandler}.
+ * Dispatch a cluster {@code Event} to the appropriate cluster {@code EventHandler}.
*
- * @param event
+ * @param event the cluster event to dispatch.
*/
public void dispatch(E event) {
EventDispatchTask task = new EventDispatchTask(event, handlerRegistry);
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandlerServiceRegistry.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandlerServiceRegistry.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandlerServiceRegistry.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventHandlerServiceRegistry.java Wed Apr 24 09:39:25 2013
@@ -13,32 +13,23 @@
*/
package org.apache.karaf.cellar.core.event;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.InvalidSyntaxException;
-import org.osgi.framework.ServiceReference;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.ConcurrentMap;
/**
* Event handler service registry.
*/
public class EventHandlerServiceRegistry<E extends Event> implements EventHandlerRegistry<E> {
- private static final transient Logger LOGGER = LoggerFactory.getLogger(EventHandlerRegistryDispatcher.class);
-
private Map<Class,EventHandler> eventHandlerMap = new ConcurrentHashMap<Class,EventHandler>();
/**
- * Returns the appropriate {@code EventHandler} found inside the {@code HandlerRegistry}.
+ * Return the appropriate cluster {@code EventHandler} found inside the cluster {@code HandlerRegistry}.
*
- * @param event
- * @return
+ * @param event the cluster event to handle.
+ * @return the corresponding cluster event handler to use.
*/
+ @Override
public EventHandler<E> getHandler(E event) {
if (event != null) {
Class clazz = event.getClass();
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventProducer.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventProducer.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventProducer.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventProducer.java Wed Apr 24 09:39:25 2013
@@ -16,15 +16,16 @@ package org.apache.karaf.cellar.core.eve
import org.apache.karaf.cellar.core.Producer;
/**
- * Transmits events to the cluster.
+ * Broadcast cluster events to the cluster.
*/
public interface EventProducer<E extends Event> extends Producer<E> {
/**
- * Produce {@code Event}s to the cluster.
+ * Produce and broadcast cluster {@code Event}s to the cluster.
*
- * @param event
+ * @param event the cluster event to produce and broadcast.
*/
+ @Override
public void produce(E event);
}
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventTracker.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventTracker.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventTracker.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventTracker.java Wed Apr 24 09:39:25 2013
@@ -14,29 +14,29 @@
package org.apache.karaf.cellar.core.event;
/**
- * Event tracker interface.
+ * Track a cluster event.
*/
public interface EventTracker<E extends Event> {
/**
- * Starts tracking the occurance of an {@code Event}.
+ * Start to track the occurrence of a cluster {@code Event}.
*
- * @param event
+ * @param event the cluster event to track.
*/
public void start(E event);
/**
- * Stops tracking the occurance of an {@code Event}.
+ * Stop to track the occurrence of a cluster {@code Event}.
*
- * @param event
+ * @param event the cluster event to track.
*/
public void stop(E event);
/**
- * Returns true if the {@code Event} is being tracked.
+ * Check if a cluster event is pending.
*
- * @param event
- * @return
+ * @param event the cluster event to check.
+ * @return true if the cluster event is pending, false else.
*/
public Boolean isPending(E event);
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventTransportFactory.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventTransportFactory.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventTransportFactory.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/event/EventTransportFactory.java Wed Apr 24 09:39:25 2013
@@ -13,23 +13,26 @@
*/
package org.apache.karaf.cellar.core.event;
+/**
+ * A factory to create producer and consumer of cluster events.
+ */
public interface EventTransportFactory {
/**
- * Returns an Event Producer that produces {@link Event}s for a specific {@link org.apache.karaf.cellar.core.Group}.
+ * Return a cluster {@link EventProducer} that produces cluster {@link Event}s for a specific cluster {@link org.apache.karaf.cellar.core.Group}.
*
- * @param name
- * @param pubsub
- * @return
+ * @param name the event producer name.
+ * @param pubsub true to enable pubsub mode, false else.
+ * @return the cluster event producer.
*/
public EventProducer getEventProducer(String name, Boolean pubsub);
/**
- * Returns an Event Consumer that consumes {@link Event}s for a specific {@link org.apache.karaf.cellar.core.Group}.
+ * Return a cluster {@link EventConsumer} that consumes cluster {@link Event}s for a specific cluster {@link org.apache.karaf.cellar.core.Group}.
*
- * @param name
- * @param pubsub
- * @return
+ * @param name the event consumer name.
+ * @param pubsub true to enable pubsub mode, false else.
+ * @return the cluster event consumer.
*/
public EventConsumer getEventConsumer(String name, Boolean pubsub);
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/exception/ProducerNotFoundException.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/exception/ProducerNotFoundException.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/exception/ProducerNotFoundException.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/exception/ProducerNotFoundException.java Wed Apr 24 09:39:25 2013
@@ -13,9 +13,13 @@
*/
package org.apache.karaf.cellar.core.exception;
+/**
+ * Exception raised when no cluster event producer has been found.
+ */
public class ProducerNotFoundException extends Exception {
public ProducerNotFoundException() {
+ // nothing to do
}
public ProducerNotFoundException(String message) {
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/exception/StoreNotFoundException.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/exception/StoreNotFoundException.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/exception/StoreNotFoundException.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/exception/StoreNotFoundException.java Wed Apr 24 09:39:25 2013
@@ -13,9 +13,13 @@
*/
package org.apache.karaf.cellar.core.exception;
+/**
+ * Exception raised with a store is not found.
+ */
public class StoreNotFoundException extends Exception {
public StoreNotFoundException() {
+ // nothing to do
}
public StoreNotFoundException(String message) {
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/CellarCommandSupport.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/CellarCommandSupport.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/CellarCommandSupport.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/CellarCommandSupport.java Wed Apr 24 09:39:25 2013
@@ -15,7 +15,6 @@ package org.apache.karaf.cellar.core.she
import org.apache.karaf.cellar.core.ClusterManager;
import org.apache.karaf.cellar.core.GroupManager;
-import org.apache.karaf.cellar.core.event.EventTransportFactory;
import org.apache.karaf.shell.console.OsgiCommandSupport;
import org.osgi.service.cm.ConfigurationAdmin;
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/AllGroupsCompleter.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/AllGroupsCompleter.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/AllGroupsCompleter.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/AllGroupsCompleter.java Wed Apr 24 09:39:25 2013
@@ -16,10 +16,16 @@ package org.apache.karaf.cellar.core.she
import org.apache.karaf.cellar.core.Group;
/**
- * All groups completer.
+ * Completer for all cluster groups.
*/
public class AllGroupsCompleter extends GroupCompleterSupport {
+ /**
+ * Accept all cluster groups for completion.
+ *
+ * @param group the cluster group to check.
+ * @return always return true.
+ */
@Override
protected boolean acceptsGroup(Group group) {
return true;
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/GroupCompleterSupport.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/GroupCompleterSupport.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/GroupCompleterSupport.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/GroupCompleterSupport.java Wed Apr 24 09:39:25 2013
@@ -21,14 +21,21 @@ import org.apache.karaf.shell.console.co
import java.util.List;
/**
- * Abstract group completer.
+ * Abstract cluster group completer.
*/
public abstract class GroupCompleterSupport implements Completer {
protected GroupManager groupManager;
+ /**
+ * Check if a cluster group should be accepted for completion.
+ *
+ * @param group the cluster group to check.
+ * @return true if the cluster group has been accepted, false else.
+ */
protected abstract boolean acceptsGroup(Group group);
+ @Override
public int complete(String buffer, int cursor, List<String> candidates) {
StringsCompleter delegate = new StringsCompleter();
try {
@@ -41,12 +48,11 @@ public abstract class GroupCompleterSupp
}
}
} catch (Exception e) {
- // Ignore
+ // ignore
}
return delegate.complete(buffer, cursor, candidates);
}
-
public GroupManager getGroupManager() {
return groupManager;
}
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/LocalGroupsCompleter.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/LocalGroupsCompleter.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/LocalGroupsCompleter.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/LocalGroupsCompleter.java Wed Apr 24 09:39:25 2013
@@ -17,10 +17,16 @@ import org.apache.karaf.cellar.core.Grou
import org.apache.karaf.cellar.core.Node;
/**
- * Local groups completer.
+ * Local cluster groups completer.
*/
public class LocalGroupsCompleter extends GroupCompleterSupport {
+ /**
+ * Add cluster groups where the local node is belonging.
+ *
+ * @param group the cluster group candidate for completion.
+ * @return true if the cluster group has been accepted, false else.
+ */
@Override
protected boolean acceptsGroup(Group group) {
Node node = groupManager.getNode();
Modified: karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/OtherGroupsCompleter.java
URL: http://svn.apache.org/viewvc/karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/OtherGroupsCompleter.java?rev=1471327&r1=1471326&r2=1471327&view=diff
==============================================================================
--- karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/OtherGroupsCompleter.java (original)
+++ karaf/cellar/trunk/core/src/main/java/org/apache/karaf/cellar/core/shell/completer/OtherGroupsCompleter.java Wed Apr 24 09:39:25 2013
@@ -21,6 +21,12 @@ import org.apache.karaf.cellar.core.Node
*/
public class OtherGroupsCompleter extends GroupCompleterSupport {
+ /**
+ * Accept the cluster groups which don't include the local node.
+ *
+ * @param group the cluster group to check.
+ * @return true if the cluster group doesn't include the local node, false else.
+ */
@Override
protected boolean acceptsGroup(Group group) {
Node node = groupManager.getNode();