Checkstyle and PMD violations fixed for IControllerRegistryService class.
Missed a couple of Checkstyle problems.
Change-Id: Icd001458ddb659547bc1f4c6027c308504865540
Reapply checkstyle/PMD changes based on new rulesets.
Put 'public' declarations back on methods
Fixed javadoc comment formatting that got mangkled
by idea.
Change-Id: Icd001458ddb659547bc1f4c6027c308504865540
diff --git a/src/main/java/net/onrc/onos/registry/controller/IControllerRegistryService.java b/src/main/java/net/onrc/onos/registry/controller/IControllerRegistryService.java
index 41f7d55..55802b0 100755
--- a/src/main/java/net/onrc/onos/registry/controller/IControllerRegistryService.java
+++ b/src/main/java/net/onrc/onos/registry/controller/IControllerRegistryService.java
@@ -9,138 +9,151 @@
/**
* A registry service that allows ONOS to register controllers and switches
* in a way that is global to the entire ONOS cluster. The registry is the
- * arbiter for allowing controllers to control switches.
- *
- * The OVS/OF1.{2,3} fault tolerance model is a switch connects to multiple
+ * arbiter for allowing controllers to control switches.
+ *
+ * The OVS/OF1.{2,3} fault tolerance model is a switch connects to multiple
* controllers, and the controllers send role requests to determine what their
* role is in controlling the switch.
- *
- * The ONOS fault tolerance model allows only a single controller to have
- * control of a switch (MASTER role) at once. Controllers therefore need a
+ *
+ * The ONOS fault tolerance model allows only a single controller to have
+ * control of a switch (MASTER role) at once. Controllers therefore need a
* mechanism that enables them to decide who should control a each switch.
* The registry service provides this mechanism.
- *
- * @author jono
*
+ * @author jono
*/
public interface IControllerRegistryService extends IFloodlightService {
-
- /**
- * Callback interface for control change events
- *
- */
- public interface ControlChangeCallback {
- /**
- * Called whenever the control changes from the point of view of the
- * registry. The callee can check whether they have control or not
- * using the hasControl parameter.
- * @param dpid The switch that control has changed for
- * @param hasControl Whether the listener now has control or not
- */
- public void controlChanged(long dpid, boolean hasControl);
- }
-
- /**
- * Request for control of a switch. This method does not block. When
- * control for a switch changes, the controlChanged method on the
- * callback object will be called. This happens any time the control
- * changes while the request is still active (until releaseControl is
- * called)
- * @param dpid Switch to request control for
- * @param cb Callback that will be used to notify caller of control
- * changes
- * @throws RegistryException Errors contacting the registry service
- */
- public void requestControl(long dpid, ControlChangeCallback cb)
- throws RegistryException;
-
- /**
- * Stop trying to take control of a switch. This removes the entry
- * for this controller requesting this switch in the registry.
- * If the controller had control when this is called, another controller
- * will now gain control of the switch. This call doesn't block.
- * @param dpid Switch to release control of
- */
- public void releaseControl(long dpid);
-
- /**
- * Check whether the controller has control of the switch
- * This call doesn't block.
- * @param dpid Switch to check control of
- * @return
- */
- public boolean hasControl(long dpid);
- /**
- * Check whether this instance is the leader for the cluster.
- * This call doesn't block.
- *
- * @return true if the instance is the leader for the cluster,
- * otherwise false.
- */
- public boolean isClusterLeader();
-
- /**
- * Get the unique ID used to identify this controller in the cluster
- * @return
- */
- public String getControllerId ();
-
- /**
- * Register a controller to the ONOS cluster. Must be called before
- * the registry can be used to take control of any switches.
- * @param controllerId A unique string ID identifying this controller
- * in the cluster
- * @throws errors connecting to registry service,
- * controllerId already registered
- */
- public void registerController(String controllerId) throws RegistryException;
-
- /**
- * Get all controllers in the cluster
- * @return Collection of controller IDs
- */
- public Collection<String> getAllControllers() throws RegistryException;
-
- /**
- * Get all switches in the cluster, along with which controller is
- * in control of them (if any) and any other controllers that have
- * requested control.
- * @return
- */
- public Map<String, List<ControllerRegistryEntry>> getAllSwitches();
-
- /**
- * Get the controller that has control of a given switch
- * @param dpid Switch to find controller for
- * @return controller ID
- * @throws RegistryException Errors contacting registry service
- */
- public String getControllerForSwitch(long dpid) throws RegistryException;
-
- /**
- * Get all switches controlled by a given controller
- * @param controllerId
- * @return Collection of dpids
- */
- public Collection<Long> getSwitchesControlledByController(String controllerId);
-
+ /**
+ * Callback interface for control change events.
+ */
+ public interface ControlChangeCallback {
/**
- * Get
- * @return
+ * Called whenever the control changes from the point of view of the
+ * registry. The callee can check whether they have control or not
+ * using the hasControl parameter.
+ *
+ * @param dpid The switch that control has changed for
+ * @param hasControl Whether the listener now has control or not
*/
- public IdBlock allocateUniqueIdBlock();
-
- /**
- * Get next unique id and retrieve a new range of ids if needed.
- */
- public IdBlock allocateUniqueIdBlock(long range);
+ void controlChanged(long dpid, boolean hasControl);
+ }
+
+ /**
+ * Request for control of a switch. This method does not block. When
+ * control for a switch changes, the controlChanged method on the
+ * callback object will be called. This happens any time the control
+ * changes while the request is still active (until releaseControl is
+ * called)
+ *
+ * @param dpid Switch to request control for
+ * @param cb Callback that will be used to notify caller of control
+ * changes
+ * @throws RegistryException Errors contacting the registry service
+ */
+ public void requestControl(long dpid, ControlChangeCallback cb)
+ throws RegistryException;
+
+ /**
+ * Stop trying to take control of a switch. This removes the entry
+ * for this controller requesting this switch in the registry.
+ * If the controller had control when this is called, another controller
+ * will now gain control of the switch. This call doesn't block.
+ *
+ * @param dpid Switch to release control of
+ */
+ public void releaseControl(long dpid);
+
+ /**
+ * Check whether the controller has control of the switch
+ * This call doesn't block.
+ *
+ * @param dpid Switch to check control of
+ * @return true if controller has control of the switch.
+ */
+ public boolean hasControl(long dpid);
+
+ /**
+ * Check whether this instance is the leader for the cluster.
+ * This call doesn't block.
+ *
+ * @return true if the instance is the leader for the cluster,
+ * otherwise false.
+ */
+ public boolean isClusterLeader();
+
+ /**
+ * Get the unique ID used to identify this controller in the cluster.
+ *
+ * @return controller ID.
+ */
+ public String getControllerId();
+
+ /**
+ * Register a controller to the ONOS cluster. Must be called before
+ * the registry can be used to take control of any switches.
+ *
+ * @param controllerId A unique string ID identifying this controller
+ * in the cluster
+ * @throws RegistryException for errors connecting to registry service,
+ * controllerId already registered
+ */
+ public void registerController(String controllerId)
+ throws RegistryException;
+
+ /**
+ * Get all controllers in the cluster.
+ *
+ * @return Collection of controller IDs
+ * @throws RegistryException on error
+ */
+ public Collection<String> getAllControllers() throws RegistryException;
+
+ /**
+ * Get all switches in the cluster, along with which controller is
+ * in control of them (if any) and any other controllers that have
+ * requested control.
+ *
+ * @return Map of all switches.
+ */
+ public Map<String, List<ControllerRegistryEntry>> getAllSwitches();
+
+ /**
+ * Get the controller that has control of a given switch.
+ *
+ * @param dpid Switch to find controller for
+ * @return controller ID
+ * @throws RegistryException Errors contacting registry service
+ */
+ public String getControllerForSwitch(long dpid) throws RegistryException;
+
+ /**
+ * Get all switches controlled by a given controller.
+ *
+ * @param controllerId ID of the controller
+ * @return Collection of dpids
+ */
+ public Collection<Long> getSwitchesControlledByController(String controllerId);
+
+ /**
+ * Get a unique Id Block.
+ *
+ * @return Id Block.
+ */
+ public IdBlock allocateUniqueIdBlock();
+
+ /**
+ * Get next unique id and retrieve a new range of ids if needed.
+ * @param range range to use for the identifier
+ * @return Id Block.
+ */
+ public IdBlock allocateUniqueIdBlock(long range);
- /**
- * Get a globally unique ID.
- *
- * @return a globally unique ID.
- */
- public long getNextUniqueId();
+ /**
+ * Get a globally unique ID.
+ *
+ * @return a globally unique ID.
+ */
+ public long getNextUniqueId();
}