From c1e1ce0808419c67ffcba5b18c93ee4fa6af59bf Mon Sep 17 00:00:00 2001 From: Jozef Bacigal Date: Thu, 2 Mar 2017 14:50:17 +0100 Subject: [PATCH] Fix checkstyle warnings - org.opendaylight.openflowplugin.api.openflow.md.core Change-Id: I98490f3a4054bcfdb1339ac490d432ece0539097 Signed-off-by: Jozef Bacigal (cherry picked from commit b1723fcc1e90149c95159e553a1084a046cf25c3) --- ...AbstractModelDrivenSwitchRegistration.java | 5 +- .../openflow/md/core/ConnectionConductor.java | 55 ++++++++++--------- .../api/openflow/md/core/ErrorHandler.java | 9 +-- .../openflow/md/core/HandshakeListener.java | 8 +-- .../openflow/md/core/HandshakeManager.java | 12 ++-- .../md/core/IMDMessageTranslator.java | 13 ++--- .../md/core/NotificationEnqueuer.java | 11 ++-- .../md/core/NotificationQueueWrapper.java | 21 ++++--- .../connection/ConnectionManagerImpl.java | 4 +- .../md/core/ConnectionConductorImpl.java | 4 +- .../md/core/HandshakeManagerImpl.java | 2 +- .../md/core/HandshakeManagerImplTest.java | 2 +- .../openflow/md/core/MessageFactoryTest.java | 12 +--- 13 files changed, 69 insertions(+), 89 deletions(-) diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/AbstractModelDrivenSwitchRegistration.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/AbstractModelDrivenSwitchRegistration.java index e710c608aa..2672c08f21 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/AbstractModelDrivenSwitchRegistration.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/AbstractModelDrivenSwitchRegistration.java @@ -9,8 +9,9 @@ package org.opendaylight.openflowplugin.api.openflow.md; import org.opendaylight.yangtools.concepts.AbstractObjectRegistration; -public abstract class AbstractModelDrivenSwitchRegistration extends AbstractObjectRegistration - implements ModelDrivenSwitchRegistration { +public abstract class AbstractModelDrivenSwitchRegistration + extends AbstractObjectRegistration + implements ModelDrivenSwitchRegistration { protected AbstractModelDrivenSwitchRegistration(final ModelDrivenSwitch instance) { super(instance); diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/ConnectionConductor.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/ConnectionConductor.java index e1ea51f563..6d517eb73e 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/ConnectionConductor.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/ConnectionConductor.java @@ -18,93 +18,94 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731 import org.opendaylight.yangtools.yang.binding.DataObject; -/** - * @author mirehak - */ public interface ConnectionConductor { - /** distinguished connection states */ - public enum CONDUCTOR_STATE { - /** initial phase of talking to switch */ + /** distinguished connection states. */ + @SuppressWarnings({"checkstyle:abbreviationaswordinname", "checkstyle:typename"}) + enum CONDUCTOR_STATE { + /** initial phase of talking to switch. */ HANDSHAKING, - /** standard phase - interacting with switch */ + /** standard phase - interacting with switch. */ WORKING, - /** connection is idle, waiting for echo reply from switch */ + /** connection is idle, waiting for echo reply from switch. */ TIMEOUTING, - /** talking to switch is over - resting in pieces */ + /** talking to switch is over - resting in pieces. */ RIP } - /** supported version ordered by height (highest version is at the beginning) */ - List versionOrder = Lists.newArrayList((short) 0x04, (short) 0x01); + /** supported version ordered by height (highest version is at the beginning). */ + List VERSION_ORDER = Lists.newArrayList((short) 0x04, (short) 0x01); /** - * initialize wiring around {@link ConnectionAdapter} + * initialize wiring around {@link ConnectionAdapter}. */ void init(); /** - * @return the negotiated version + * return the negotiated version. */ Short getVersion(); /** - * @return the state of conductor + * return the state of conductor. */ CONDUCTOR_STATE getConductorState(); /** - * @param conductorState + * Setter. + * @param conductorState state */ void setConductorState(CONDUCTOR_STATE conductorState); /** - * terminates owned connection + * terminates owned connection. * @return future result of disconnect action */ Future disconnect(); /** - * assign corresponding {@link SessionContext} to this conductor (to handle disconnect caused by switch) - * @param context + * assign corresponding {@link SessionContext} to this conductor (to handle disconnect caused by switch). + * @param context session context */ void setSessionContext(SessionContext context); /** - * assign corresponding {@link org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher} to this conductor - * to handle disconnect caused by switch. This involves auxiliary conductors only. - * @param auxiliaryKey + * assign corresponding {@link org.opendaylight.openflowplugin.api.openflow.md.core.SwitchConnectionDistinguisher} + * to this conductor to handle disconnect caused by switch. This involves auxiliary conductors only. + * @param auxiliaryKey key */ void setConnectionCookie(SwitchConnectionDistinguisher auxiliaryKey); /** - * @return the sessionContext + * return the sessionContext. */ SessionContext getSessionContext(); /** - * @return the auxiliaryKey (null if this is a primary connection) + * return the auxiliaryKey (null if this is a primary connection). */ SwitchConnectionDistinguisher getAuxiliaryKey(); /** - * @return the connectionAdapter + * return the connectionAdapter. */ ConnectionAdapter getConnectionAdapter(); /** - * assign global queueKeeper - * @param queueKeeper + * assign global queueKeeper. + * @param queueKeeper keeper */ void setQueueProcessor(QueueProcessor queueKeeper); /** + * Setter. * @param errorHandler for internal exception handling */ void setErrorHandler(ErrorHandler errorHandler); /** - * @param conductorId + * Setter. + * @param conductorId id */ void setId(int conductorId); diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/ErrorHandler.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/ErrorHandler.java index 282dfc603c..6f930d7cc2 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/ErrorHandler.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/ErrorHandler.java @@ -9,16 +9,13 @@ package org.opendaylight.openflowplugin.api.openflow.md.core; import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext; -/** - * @author mirehak - * - */ public interface ErrorHandler { /** - * @param e cause + * Exception handler. + * @param throwable cause * @param sessionContext of source */ - void handleException(Throwable e, SessionContext sessionContext); + void handleException(Throwable throwable, SessionContext sessionContext); } diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/HandshakeListener.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/HandshakeListener.java index 5140977e4f..ae7bfc4084 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/HandshakeListener.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/HandshakeListener.java @@ -10,13 +10,10 @@ package org.opendaylight.openflowplugin.api.openflow.md.core; import org.opendaylight.openflowplugin.api.openflow.connection.HandshakeContext; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput; -/** - * @author mirehak - * - */ public interface HandshakeListener { /** + * Handshake successfull. * @param featureOutput obtained * @param version negotiated */ @@ -29,7 +26,8 @@ public interface HandshakeListener { void onHandshakeFailure(); /** - * @param handshakeContext + * Setter. + * @param handshakeContext context */ void setHandshakeContext(HandshakeContext handshakeContext); } diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/HandshakeManager.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/HandshakeManager.java index 5b7b70ac36..80e2af6943 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/HandshakeManager.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/HandshakeManager.java @@ -9,34 +9,34 @@ package org.opendaylight.openflowplugin.api.openflow.md.core; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessage; -/** - * @author mirehak - */ public interface HandshakeManager { /** - * @return negotiated version + * return negotiated version. */ Short getVersion(); /** + * Setter. * @param errorHandler the errorHandler to set */ void setErrorHandler(ErrorHandler errorHandler); /** + * Setter. * @param handshakeListener the handshakeListener to set */ void setHandshakeListener(HandshakeListener handshakeListener); /** - * @param isBitmapNegotiationEnable + * should use negotiation bit map. + * @param isBitmapNegotiationEnable yes/no */ void setUseVersionBitmap(boolean isBitmapNegotiationEnable); /** + * process current handshake step. * @param receivedHello message from device we need to act upon - * process current handshake step */ void shake(HelloMessage receivedHello); } diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/IMDMessageTranslator.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/IMDMessageTranslator.java index d91014e494..d03f20d1c9 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/IMDMessageTranslator.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/IMDMessageTranslator.java @@ -10,7 +10,7 @@ package org.opendaylight.openflowplugin.api.openflow.md.core; import org.opendaylight.openflowplugin.api.openflow.md.core.session.SessionContext; /** - * translates between messages + * translates between messages. * @param source message type (IN) * @param result message type (OUT) */ @@ -18,14 +18,9 @@ public interface IMDMessageTranslator { /** * This method is called in order to translate message to MD-SAL or from MD-SAL. - * - * @param cookie - * auxiliary connection identifier - * @param sc - * The SessionContext which sent the OF message - * @param msg - * The OF message - * + * @param cookie auxiliary connection identifier + * @param sc The SessionContext which sent the OF message + * @param msg The OF message * @return translated message */ O translate(SwitchConnectionDistinguisher cookie, SessionContext sc, I msg); diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/NotificationEnqueuer.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/NotificationEnqueuer.java index f312a41aa3..69a83e0e77 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/NotificationEnqueuer.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/NotificationEnqueuer.java @@ -1,6 +1,6 @@ -/** +/* * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * + * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html @@ -8,14 +8,13 @@ package org.opendaylight.openflowplugin.api.openflow.md.core; /** - * provider of wrapped notification enqueue + * provider of wrapped notification enqueue. */ public interface NotificationEnqueuer { /** - * enqueue given notification into standard message processing queue - * - * @param notification + * enqueue given notification into standard message processing queue. + * @param notification notification */ void enqueueNotification(NotificationQueueWrapper notification); diff --git a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/NotificationQueueWrapper.java b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/NotificationQueueWrapper.java index 81d740fea9..6d50a22859 100644 --- a/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/NotificationQueueWrapper.java +++ b/openflowplugin-api/src/main/java/org/opendaylight/openflowplugin/api/openflow/md/core/NotificationQueueWrapper.java @@ -1,6 +1,6 @@ -/** +/* * Copyright (c) 2014 Cisco Systems, Inc. and others. All rights reserved. - * + * * This program and the accompanying materials are made available under the * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html @@ -12,24 +12,22 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731 import org.opendaylight.yangtools.yang.binding.DataContainer; import org.opendaylight.yangtools.yang.binding.Notification; -/** - * - */ public class NotificationQueueWrapper implements OfHeader { - + private final Notification notification; private final Short version; private Long xid = -1L; - + /** - * @param notification - * @param version + * Notofication queue wrapper. + * @param notification notofication + * @param version version */ public NotificationQueueWrapper(final Notification notification, final Short version) { Preconditions.checkArgument(notification != null, "wrapped notification must not be null"); Preconditions.checkArgument(version != null, "message version of wrapped notification must not be null"); - this.notification = notification; + this.notification = notification; this.version = version; } @@ -49,13 +47,14 @@ public class NotificationQueueWrapper implements OfHeader { } /** - * @return the notification + * return the notification. */ public Notification getNotification() { return notification; } /** + * Setter. * @param xid the xid to set */ public void setXid(Long xid) { diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/connection/ConnectionManagerImpl.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/connection/ConnectionManagerImpl.java index f9bc7d4c60..d954f0b24e 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/connection/ConnectionManagerImpl.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/connection/ConnectionManagerImpl.java @@ -82,8 +82,8 @@ public class ConnectionManagerImpl implements ConnectionManager { private HandshakeManager createHandshakeManager(final ConnectionAdapter connectionAdapter, final HandshakeListener handshakeListener) { HandshakeManagerImpl handshakeManager = new HandshakeManagerImpl(connectionAdapter, - ConnectionConductor.versionOrder.get(0), - ConnectionConductor.versionOrder); + ConnectionConductor.VERSION_ORDER.get(0), + ConnectionConductor.VERSION_ORDER); handshakeManager.setUseVersionBitmap(BITMAP_NEGOTIATION_ENABLED); handshakeManager.setHandshakeListener(handshakeListener); handshakeManager.setErrorHandler(new ErrorHandlerSimpleImpl()); diff --git a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/ConnectionConductorImpl.java b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/ConnectionConductorImpl.java index 8c3f2901f0..3b4d6bafbd 100644 --- a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/ConnectionConductorImpl.java +++ b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/ConnectionConductorImpl.java @@ -124,8 +124,8 @@ public class ConnectionConductorImpl implements OpenflowProtocolListener, conductorState = CONDUCTOR_STATE.HANDSHAKING; firstHelloProcessed = false; handshakeManager = new HandshakeManagerImpl(connectionAdapter, - ConnectionConductor.versionOrder.get(0), - ConnectionConductor.versionOrder); + ConnectionConductor.VERSION_ORDER.get(0), + ConnectionConductor.VERSION_ORDER); handshakeManager.setUseVersionBitmap(isBitmapNegotiationEnable); handshakeManager.setHandshakeListener(this); portFeaturesUtils = PortFeaturesUtil.getInstance(); diff --git a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/HandshakeManagerImpl.java b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/HandshakeManagerImpl.java index 78997ef27c..785a568b4a 100644 --- a/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/HandshakeManagerImpl.java +++ b/openflowplugin/src/main/java/org/opendaylight/openflowplugin/openflow/md/core/HandshakeManagerImpl.java @@ -267,7 +267,7 @@ public class HandshakeManagerImpl implements HandshakeManager { for(Elements element : list) { List bitmap = element.getVersionBitmap(); // check for version bitmap - for(short bitPos : ConnectionConductor.versionOrder) { + for(short bitPos : ConnectionConductor.VERSION_ORDER) { // with all the version it should work. if(bitmap.get(bitPos % Integer.SIZE)) { supportedHighestVersion = bitPos; diff --git a/openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/HandshakeManagerImplTest.java b/openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/HandshakeManagerImplTest.java index 2b1210bdfc..6db520e4b0 100644 --- a/openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/HandshakeManagerImplTest.java +++ b/openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/HandshakeManagerImplTest.java @@ -69,7 +69,7 @@ public class HandshakeManagerImplTest { @Before public void setUp() { handshakeManager = new HandshakeManagerImpl(adapter, OFConstants.OFP_VERSION_1_3, - ConnectionConductor.versionOrder); + ConnectionConductor.VERSION_ORDER); handshakeManager.setErrorHandler(errorHandler); handshakeManager.setHandshakeListener(handshakeListener); handshakeManager.setUseVersionBitmap(false); diff --git a/openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/MessageFactoryTest.java b/openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/MessageFactoryTest.java index 0169cc71d9..773b161deb 100644 --- a/openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/MessageFactoryTest.java +++ b/openflowplugin/src/test/java/org/opendaylight/openflowplugin/openflow/md/core/MessageFactoryTest.java @@ -15,15 +15,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev13 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.hello.Elements; -/** - * @author mirehak - * - */ public class MessageFactoryTest { - /** - * Test method for {@link org.opendaylight.openflowplugin.openflow.md.core.MessageFactory#createHelloInputWoElements(java.lang.Short, java.lang.Long)}. - */ @Test public void testCreateHelloInputWoElements() { short highestVersion = (short) 0x04; @@ -35,9 +28,6 @@ public class MessageFactoryTest { Assert.assertNull(helloMsg.getElements()); } - /** - * Test method for {@link org.opendaylight.openflowplugin.openflow.md.core.MessageFactory#createHelloInputWithElements(java.lang.Short, java.lang.Long, java.util.List)}. - */ @Test public void testCreateHelloInputWithElements() { short highestVersion = (short) 0x04; @@ -46,7 +36,7 @@ public class MessageFactoryTest { false, true, false, false, true}; HelloInput helloMsg = MessageFactory.createHelloInput(highestVersion, xid, - ConnectionConductor.versionOrder); + ConnectionConductor.VERSION_ORDER); Assert.assertEquals(highestVersion, helloMsg.getVersion().shortValue()); Assert.assertEquals(xid, helloMsg.getXid().longValue()); Assert.assertEquals(1, helloMsg.getElements().size()); -- 2.36.6