Organize Imports for Checkstyle compliance.
Checkstyle compliance: line length.
Checkstyle compliance: various types of small changes.
Checkstyle compliant Exception handling.
Checkstyle final clean up & enforcement.
Change-Id: I733c6883a59a27b680c8e35b43f42f649a06906a
Signed-off-by: matus.kubica <matus.kubica@pantheon.tech>
}
/**
+ * Get priority number.
+ *
* @return priority number or Optional.absent otherwise
*/
public Optional<Integer> getPriority() {
}
public HandlingPriority increasePriority(int priorityIncrease) {
- Preconditions.checkState(priority!=null, "Unable to increase priority for %s", this);
+ Preconditions.checkState(priority != null, "Unable to increase priority for %s", this);
Preconditions.checkArgument(priorityIncrease > 0, "Negative increase");
Preconditions.checkArgument(Long.valueOf(priority) + priorityIncrease < Integer.MAX_VALUE,
"Resulting priority cannot be higher than %s", Integer.MAX_VALUE);
}
@Override
- public int compareTo(HandlingPriority o) {
- if (this == o) {
+ public int compareTo(HandlingPriority priority) {
+ if (this == priority) {
return 0;
}
if (isCannotHandle()) {
return -1;
}
- if (o.isCannotHandle()) {
+ if (priority.isCannotHandle()) {
return 1;
}
- if (priority > o.priority){
+ if (this.priority > priority.priority) {
return 1;
}
- if (priority.equals(o.priority)){
+ if (this.priority.equals(priority.priority)) {
return 0;
}
- if (priority < o.priority){
+ if (this.priority < priority.priority) {
return -1;
}
- throw new IllegalStateException("Unexpected state comparing " + this + " with " + o);
+ throw new IllegalStateException("Unexpected state comparing " + this + " with " + priority);
}
@Override
- public boolean equals(Object o) {
- if (this == o){
+ public boolean equals(Object obj) {
+ if (this == obj) {
return true;
}
- if (!(o instanceof HandlingPriority)){
+ if (!(obj instanceof HandlingPriority)) {
return false;
}
- HandlingPriority that = (HandlingPriority) o;
+ HandlingPriority that = (HandlingPriority) obj;
- if (priority != null ? !priority.equals(that.priority) : that.priority != null){
+ if (priority != null ? !priority.equals(that.priority) : that.priority != null) {
return false;
}
* operations are chained (ordered by HandlingPriority returned by canHandle
* method) and executed.
*
+ * <p>
* Operation can be declared as singleton or last in chain (see abstract
* implementations in netconf-util). If the operation is not singleton or last,
* it is responsible for the execution of subsequent operation and for merging
* the results.
- *
*/
public interface NetconfOperation {
* HandlingPriority.HANDLE_WITH_DEFAULT_PRIORITY.
*
* @param message request message
- * @return
+ * @return {@code handling priority}
*/
HandlingPriority canHandle(Document message) throws DocumentedException;
* last/singleton operation, subsequentOperation must indicate termination
* point.
*
- * @param requestMessage
- * @param subsequentOperation
- * execution of subsequent netconf operation
- * @return
- * @throws DocumentedException
+ * @param requestMessage request message
+ * @param subsequentOperation execution of subsequent netconf operation
+ * @return {@code document}
+ * @throws DocumentedException if operation fails
*/
Document handle(Document requestMessage, NetconfOperationChainedExecution subsequentOperation)
throws DocumentedException;
public interface NetconfOperationChainedExecution {
/**
+ * Check if this is termination point in operation execution.
+ *
* @return true if this is termination point in operation execution, false
- * if there is a subsequent operation present that needs to be
- * executed
+ * if there is a subsequent operation present that needs to be
+ * executed.
*/
boolean isExecutionTermination();
/**
- * Do not execute if this is termination point
+ * Do not execute if this is termination point.
*/
Document execute(Document requestMessage) throws DocumentedException;
- public static final NetconfOperationChainedExecution EXECUTION_TERMINATION_POINT = new NetconfOperationChainedExecution() {
+ NetconfOperationChainedExecution EXECUTION_TERMINATION_POINT = new NetconfOperationChainedExecution() {
@Override
public boolean isExecutionTermination() {
return true;
@Override
public Document execute(Document requestMessage) throws DocumentedException {
- throw new IllegalStateException("This execution represents the termination point in operation execution and cannot be executed itself");
+ throw new IllegalStateException("This execution represents the termination point in operation execution "
+ + "and cannot be executed itself");
}
};
import java.util.Set;
/**
- *
+ * Service of netconf operations.
*/
public interface NetconfOperationService extends AutoCloseable {
Set<Capability> getCapabilities();
/**
- * Supported capabilities may change over time, registering a listener allows for push based information retrieval about current notifications
+ * Supported capabilities may change over time, registering a listener allows for push based information
+ * retrieval about current notifications.
*/
AutoCloseable registerCapabilityListener(CapabilityListener listener);