Enforce checkstyle for rsvp api/spi 09/61409/6
authorClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Mon, 7 Aug 2017 14:56:00 +0000 (16:56 +0200)
committerClaudio D. Gasparini <claudio.gasparini@pantheon.tech>
Sun, 20 Aug 2017 17:57:28 +0000 (17:57 +0000)
Change-Id: I7ceb91c1eaf1a1b3fb583eec31f08f5a497e4c8a
Signed-off-by: Claudio D. Gasparini <claudio.gasparini@pantheon.tech>
19 files changed:
rsvp/spi/pom.xml
rsvp/spi/src/main/java/org/opendaylight/protocol/rsvp/parser/spi/AbstractRSVPExtensionProviderActivator.java
rsvp/spi/src/main/java/org/opendaylight/protocol/rsvp/parser/spi/LabelRegistry.java
rsvp/spi/src/main/java/org/opendaylight/protocol/rsvp/parser/spi/RSVPExtensionProviderContext.java
rsvp/spi/src/main/java/org/opendaylight/protocol/rsvp/parser/spi/RSVPTeObjectRegistry.java
rsvp/spi/src/main/java/org/opendaylight/protocol/rsvp/parser/spi/pojo/ServiceLoaderRSVPExtensionProviderContext.java
rsvp/spi/src/main/java/org/opendaylight/protocol/rsvp/parser/spi/pojo/SimpleEROSubobjectRegistry.java
rsvp/spi/src/main/java/org/opendaylight/protocol/rsvp/parser/spi/pojo/SimpleLabelRegistry.java
rsvp/spi/src/main/java/org/opendaylight/protocol/rsvp/parser/spi/pojo/SimpleRROSubobjectRegistry.java
rsvp/spi/src/main/java/org/opendaylight/protocol/rsvp/parser/spi/pojo/SimpleRSVPExtensionProviderContext.java
rsvp/spi/src/main/java/org/opendaylight/protocol/rsvp/parser/spi/pojo/SimpleRSVPExtensionProviderContextActivator.java
rsvp/spi/src/main/java/org/opendaylight/protocol/rsvp/parser/spi/pojo/SimpleRSVPObjectRegistry.java
rsvp/spi/src/main/java/org/opendaylight/protocol/rsvp/parser/spi/pojo/SimpleXROSubobjectRegistry.java
rsvp/spi/src/main/java/org/opendaylight/protocol/rsvp/parser/spi/subobjects/AbstractRSVPObjectParser.java
rsvp/spi/src/main/java/org/opendaylight/protocol/rsvp/parser/spi/subobjects/CommonPathKeyParser.java
rsvp/spi/src/main/java/org/opendaylight/protocol/rsvp/parser/spi/subobjects/CommonUnnumberedInterfaceSubobjectParser.java
rsvp/spi/src/main/java/org/opendaylight/protocol/rsvp/parser/spi/subobjects/EROSubobjectListParser.java
rsvp/spi/src/main/java/org/opendaylight/protocol/rsvp/parser/spi/subobjects/RROSubobjectListParser.java
rsvp/spi/src/main/java/org/opendaylight/protocol/rsvp/parser/spi/subobjects/XROSubobjectListParser.java

index 8474848e3fb5f1af30d1bf5889a042563399b782..849d97504dca21181fcd6f6a3740316289475dca 100644 (file)
         </dependency>
     </dependencies>
 
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-checkstyle-plugin</artifactId>
+                <configuration>
+                    <propertyExpansion>checkstyle.violationSeverity=error</propertyExpansion>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
     <scm>
         <connection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</connection>
         <developerConnection>scm:git:ssh://git.opendaylight.org:29418/bgpcep.git</developerConnection>
index 1a8fdd9e7c0174d56e12a4c8dfaf9526c0acfd8e..d9989eb6488e90c4f258d7c49ccf7bf64fbad75f 100644 (file)
@@ -31,6 +31,7 @@ public abstract class AbstractRSVPExtensionProviderActivator implements AutoClos
     }
 
     @Override
+    @SuppressWarnings("checkstyle:IllegalCatch")
     public final synchronized void stop() {
         if (this.registrations == null) {
             return;
index 2250fbf47e619a4af417e49dd6b4c012381568c0..e9a75b33cb961033e4c8f28e00e8c2512f8ee82e 100644 (file)
@@ -15,12 +15,12 @@ public interface LabelRegistry {
     /**
      * Finds parser for given label C-type in the registry. Delegates parsing to found parser.
      *
-     * @param cType  label type, key in parser registry
+     * @param ctype  label type, key in parser registry
      * @param buffer label wrapped in ByteBuf
      * @return null if the parser for this label could not be found
      * @throws RSVPParsingException if the parsing did not succeed
      */
-    LabelType parseLabel(int cType, ByteBuf buffer) throws RSVPParsingException;
+    LabelType parseLabel(int ctype, ByteBuf buffer) throws RSVPParsingException;
 
     /**
      * Find serializer for given label. Delegates parsing to found serializer.
index 7d2680623ecb072f7a0fb268c5e57f9d57bd5a5f..a4ef81e78308d007af15eae11ca85c1d4c46a895 100644 (file)
@@ -14,25 +14,30 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.LabelType;
 
 public interface RSVPExtensionProviderContext extends RSVPExtensionConsumerContext {
-    void registerRsvpObjectParser(int classNum, int cType, RSVPTeObjectParser parser);
+    void registerRsvpObjectParser(int classNum, int ctype, RSVPTeObjectParser parser);
 
     void registerRsvpObjectSerializer(Class<? extends RsvpTeObject> objectClass, RSVPTeObjectSerializer serializer);
 
-    AutoCloseable registerXROSubobjectSerializer(Class<? extends SubobjectType> subobjectClass, XROSubobjectSerializer serializer);
+    AutoCloseable registerXROSubobjectSerializer(Class<? extends SubobjectType> subobjectClass,
+        XROSubobjectSerializer serializer);
 
     AutoCloseable registerXROSubobjectParser(int subobjectType, XROSubobjectParser parser);
 
-    AutoCloseable registerRROSubobjectSerializer(Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.SubobjectType> subobjectClass, RROSubobjectSerializer serializer);
+    AutoCloseable registerRROSubobjectSerializer(Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params
+        .xml.ns.yang.rsvp.rev150820.record.route.subobjects.SubobjectType> subobjectClass, RROSubobjectSerializer
+        serializer);
 
     AutoCloseable registerRROSubobjectParser(int subobjectType, RROSubobjectParser parser);
 
-    AutoCloseable registerEROSubobjectSerializer(Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.SubobjectType> subobjectClass, EROSubobjectSerializer serializer);
+    AutoCloseable registerEROSubobjectSerializer(Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params
+        .xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.SubobjectType> subobjectClass,
+        EROSubobjectSerializer serializer);
 
     AutoCloseable registerEROSubobjectParser(int subobjectType, EROSubobjectParser parser);
 
     AutoCloseable registerLabelSerializer(Class<? extends LabelType> labelClass, LabelSerializer serializer);
 
-    AutoCloseable registerLabelParser(int cType, LabelParser parser);
+    AutoCloseable registerLabelParser(int ctype, LabelParser parser);
 
     /**
      * Get the context-wide cache for a particular object type.
index 4d24d7122dd61271d3c77ab967461b9c1435e1f5..0626c3e94032aa60d38858f1f067fd5b7d24a936 100644 (file)
@@ -12,7 +12,7 @@ import io.netty.buffer.ByteBuf;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.RsvpTeObject;
 
 public interface RSVPTeObjectRegistry {
-    RsvpTeObject parseRSPVTe(int classNum, int cType, ByteBuf buffer) throws RSVPParsingException;
+    RsvpTeObject parseRSPVTe(int classNum, int ctype, ByteBuf buffer) throws RSVPParsingException;
 
     void serializeRSPVTe(RsvpTeObject parameter, ByteBuf bytes);
 }
index dda7edfadf57394c9e24ddd3e3345d70d330aa1b..9f856247459555cb55f43f671a4b8792fa6bcfca 100644 (file)
@@ -8,7 +8,6 @@
 
 package org.opendaylight.protocol.rsvp.parser.spi.pojo;
 
-
 import java.util.ServiceLoader;
 import org.opendaylight.protocol.rsvp.parser.spi.RSVPExtensionProviderActivator;
 import org.opendaylight.protocol.rsvp.parser.spi.RSVPExtensionProviderContext;
@@ -21,8 +20,8 @@ public final class ServiceLoaderRSVPExtensionProviderContext {
     public static RSVPExtensionProviderContext create() {
         final RSVPExtensionProviderContext ctx = new SimpleRSVPExtensionProviderContext();
 
-        final ServiceLoader<RSVPExtensionProviderActivator> loader = ServiceLoader.load(RSVPExtensionProviderActivator
-            .class);
+        final ServiceLoader<RSVPExtensionProviderActivator> loader = ServiceLoader
+            .load(RSVPExtensionProviderActivator.class);
         for (final RSVPExtensionProviderActivator a : loader) {
             a.start(ctx);
         }
@@ -38,11 +37,7 @@ public final class ServiceLoaderRSVPExtensionProviderContext {
         private static final RSVPExtensionProviderContext INSTANCE;
 
         static {
-            try {
-                INSTANCE = create();
-            } catch (final Exception e) {
-                throw new ExceptionInInitializerError(e);
-            }
+            INSTANCE = create();
         }
 
         private Holder() {
index 82cd233f066b89cad9a520407ad69d646bf153aa..96caeec2d3fd69dade5b38492acbf39f792529df 100644 (file)
@@ -21,7 +21,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 
 public final class SimpleEROSubobjectRegistry implements EROSubobjectRegistry {
-    private final HandlerRegistry<DataContainer, EROSubobjectParser, EROSubobjectSerializer> handlers = new HandlerRegistry<>();
+    private final HandlerRegistry<DataContainer, EROSubobjectParser, EROSubobjectSerializer> handlers =
+        new HandlerRegistry<>();
 
     public AutoCloseable registerSubobjectParser(final int subobjectType, final EROSubobjectParser parser) {
         Preconditions.checkArgument(subobjectType >= 0 && subobjectType <= Values.UNSIGNED_SHORT_MAX_VALUE);
@@ -29,12 +30,13 @@ public final class SimpleEROSubobjectRegistry implements EROSubobjectRegistry {
     }
 
     public AutoCloseable registerSubobjectSerializer(final Class<? extends SubobjectType> subobjectClass,
-                                                     final EROSubobjectSerializer serializer) {
+        final EROSubobjectSerializer serializer) {
         return this.handlers.registerSerializer(subobjectClass, serializer);
     }
 
     @Override
-    public SubobjectContainer parseSubobject(final int type, final ByteBuf buffer, final boolean loose) throws RSVPParsingException {
+    public SubobjectContainer parseSubobject(final int type, final ByteBuf buffer, final boolean loose) throws
+        RSVPParsingException {
         Preconditions.checkArgument(type >= 0 && type <= Values.UNSIGNED_SHORT_MAX_VALUE);
         final EROSubobjectParser parser = this.handlers.getParser(type);
         if (parser == null) {
@@ -45,7 +47,8 @@ public final class SimpleEROSubobjectRegistry implements EROSubobjectRegistry {
 
     @Override
     public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
-        final EROSubobjectSerializer serializer = this.handlers.getSerializer(subobject.getSubobjectType().getImplementedInterface());
+        final EROSubobjectSerializer serializer = this.handlers.getSerializer(subobject.getSubobjectType()
+            .getImplementedInterface());
         if (serializer == null) {
             return;
         }
index 192eee568b1b482cbd551e7cdcb61c19ad520541..6ceb722e897b6fd3e9ffc838a06ab7f7469d4cf1 100644 (file)
@@ -22,19 +22,20 @@ import org.opendaylight.yangtools.yang.binding.DataContainer;
 public final class SimpleLabelRegistry implements LabelRegistry {
     private final HandlerRegistry<DataContainer, LabelParser, LabelSerializer> handlers = new HandlerRegistry<>();
 
-    public AutoCloseable registerLabelParser(final int cType, final LabelParser parser) {
-        Preconditions.checkArgument(cType >= 0 && cType <= Values.UNSIGNED_BYTE_MAX_VALUE);
-        return this.handlers.registerParser(cType, parser);
+    public AutoCloseable registerLabelParser(final int ctype, final LabelParser parser) {
+        Preconditions.checkArgument(ctype >= 0 && ctype <= Values.UNSIGNED_BYTE_MAX_VALUE);
+        return this.handlers.registerParser(ctype, parser);
     }
 
-    public AutoCloseable registerLabelSerializer(final Class<? extends LabelType> labelClass, final LabelSerializer serializer) {
+    public AutoCloseable registerLabelSerializer(final Class<? extends LabelType> labelClass,
+        final LabelSerializer serializer) {
         return this.handlers.registerSerializer(labelClass, serializer);
     }
 
     @Override
-    public LabelType parseLabel(final int cType, final ByteBuf buffer) throws RSVPParsingException {
-        Preconditions.checkArgument(cType >= 0 && cType <= Values.UNSIGNED_BYTE_MAX_VALUE);
-        final LabelParser parser = this.handlers.getParser(cType);
+    public LabelType parseLabel(final int ctype, final ByteBuf buffer) throws RSVPParsingException {
+        Preconditions.checkArgument(ctype >= 0 && ctype <= Values.UNSIGNED_BYTE_MAX_VALUE);
+        final LabelParser parser = this.handlers.getParser(ctype);
         if (parser == null) {
             return null;
         }
@@ -42,7 +43,8 @@ public final class SimpleLabelRegistry implements LabelRegistry {
     }
 
     @Override
-    public void serializeLabel(final boolean unidirectional, final boolean global, final LabelType label, final ByteBuf buffer) {
+    public void serializeLabel(final boolean unidirectional, final boolean global, final LabelType label,
+        final ByteBuf buffer) {
         final LabelSerializer serializer = this.handlers.getSerializer(label.getImplementedInterface());
         if (serializer != null) {
             serializer.serializeLabel(unidirectional, global, label, buffer);
index 28dbe13d8916e71f916abb559f17c46f2599a7f4..3bc1bcb6c372f6b326864c3e0c67c433e2f9eb0b 100644 (file)
@@ -21,7 +21,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 
 public final class SimpleRROSubobjectRegistry implements RROSubobjectRegistry {
-    private final HandlerRegistry<DataContainer, RROSubobjectParser, RROSubobjectSerializer> handlers = new HandlerRegistry<>();
+    private final HandlerRegistry<DataContainer, RROSubobjectParser, RROSubobjectSerializer> handlers =
+        new HandlerRegistry<>();
 
     public AutoCloseable registerSubobjectParser(final int subobjectType, final RROSubobjectParser parser) {
         Preconditions.checkArgument(subobjectType >= 0 && subobjectType <= Values.UNSIGNED_SHORT_MAX_VALUE);
@@ -29,7 +30,7 @@ public final class SimpleRROSubobjectRegistry implements RROSubobjectRegistry {
     }
 
     public AutoCloseable registerSubobjectSerializer(final Class<? extends SubobjectType> subobjectClass,
-                                                     final RROSubobjectSerializer serializer) {
+        final RROSubobjectSerializer serializer) {
         return this.handlers.registerSerializer(subobjectClass, serializer);
     }
 
@@ -45,7 +46,8 @@ public final class SimpleRROSubobjectRegistry implements RROSubobjectRegistry {
 
     @Override
     public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
-        final RROSubobjectSerializer serializer = this.handlers.getSerializer(subobject.getSubobjectType().getImplementedInterface());
+        final RROSubobjectSerializer serializer = this.handlers.getSerializer(subobject.getSubobjectType()
+            .getImplementedInterface());
         if (serializer == null) {
             return;
         }
index 34cf490e7c534681edbb95177997fafc5fda5b8c..4087ffafa8dace854a20bb72593bd1afe73e9903 100644 (file)
@@ -27,7 +27,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.SubobjectType;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.label.subobject.LabelType;
 
-public class SimpleRSVPExtensionProviderContext extends SimpleRSVPExtensionConsumerContext implements RSVPExtensionProviderContext {
+public class SimpleRSVPExtensionProviderContext extends SimpleRSVPExtensionConsumerContext implements
+    RSVPExtensionProviderContext {
 
     private static final int DEFAULT_MAXIMUM_CACHED_OBJECTS = 100000;
 
@@ -37,8 +38,7 @@ public class SimpleRSVPExtensionProviderContext extends SimpleRSVPExtensionConsu
         public <T> T getSharedReference(final T object) {
             final Cache<Object, Object> cache = SimpleRSVPExtensionProviderContext.this.cacheRef.get();
 
-            @SuppressWarnings("unchecked")
-            final T ret = (T) cache.getIfPresent(object);
+            @SuppressWarnings("unchecked") final T ret = (T) cache.getIfPresent(object);
             if (ret == null) {
                 cache.put(object, object);
                 return object;
@@ -64,17 +64,19 @@ public class SimpleRSVPExtensionProviderContext extends SimpleRSVPExtensionConsu
 
 
     @Override
-    public void registerRsvpObjectParser(final int classNum, final int cType, final RSVPTeObjectParser parser) {
-        this.getRsvpRegistry().registerRsvpObjectParser(classNum, cType, parser);
+    public void registerRsvpObjectParser(final int classNum, final int ctype, final RSVPTeObjectParser parser) {
+        this.getRsvpRegistry().registerRsvpObjectParser(classNum, ctype, parser);
     }
 
     @Override
-    public void registerRsvpObjectSerializer(final Class<? extends RsvpTeObject> objectClass, final RSVPTeObjectSerializer serializer) {
+    public void registerRsvpObjectSerializer(final Class<? extends RsvpTeObject> objectClass,
+        final RSVPTeObjectSerializer serializer) {
         this.getRsvpRegistry().registerRsvpObjectSerializer(objectClass, serializer);
     }
 
     @Override
-    public AutoCloseable registerXROSubobjectSerializer(final Class<? extends SubobjectType> subobjectClass, final XROSubobjectSerializer serializer) {
+    public AutoCloseable registerXROSubobjectSerializer(final Class<? extends SubobjectType> subobjectClass,
+        final XROSubobjectSerializer serializer) {
         return this.getXROSubobjectHandlerRegistry().registerSubobjectSerializer(subobjectClass, serializer);
     }
 
@@ -84,7 +86,9 @@ public class SimpleRSVPExtensionProviderContext extends SimpleRSVPExtensionConsu
     }
 
     @Override
-    public AutoCloseable registerRROSubobjectSerializer(final Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.SubobjectType> subobjectClass, final RROSubobjectSerializer serializer) {
+    public AutoCloseable registerRROSubobjectSerializer(final Class<? extends org.opendaylight.yang.gen.v1.urn
+        .opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.subobjects.SubobjectType> subobjectClass,
+        final RROSubobjectSerializer serializer) {
         return this.getRROSubobjectHandlerRegistry().registerSubobjectSerializer(subobjectClass, serializer);
     }
 
@@ -94,7 +98,9 @@ public class SimpleRSVPExtensionProviderContext extends SimpleRSVPExtensionConsu
     }
 
     @Override
-    public AutoCloseable registerEROSubobjectSerializer(final Class<? extends org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.SubobjectType> subobjectClass, final EROSubobjectSerializer serializer) {
+    public AutoCloseable registerEROSubobjectSerializer(final Class<? extends org.opendaylight.yang.gen.v1.urn
+        .opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.SubobjectType>
+        subobjectClass, final EROSubobjectSerializer serializer) {
         return this.getEROSubobjectHandlerRegistry().registerSubobjectSerializer(subobjectClass, serializer);
     }
 
@@ -104,12 +110,13 @@ public class SimpleRSVPExtensionProviderContext extends SimpleRSVPExtensionConsu
     }
 
     @Override
-    public AutoCloseable registerLabelSerializer(final Class<? extends LabelType> labelClass, final LabelSerializer serializer) {
+    public AutoCloseable registerLabelSerializer(final Class<? extends LabelType> labelClass,
+        final LabelSerializer serializer) {
         return this.getLabelHandlerRegistry().registerLabelSerializer(labelClass, serializer);
     }
 
     @Override
-    public AutoCloseable registerLabelParser(final int cType, final LabelParser parser) {
-        return this.getLabelHandlerRegistry().registerLabelParser(cType, parser);
+    public AutoCloseable registerLabelParser(final int ctype, final LabelParser parser) {
+        return this.getLabelHandlerRegistry().registerLabelParser(ctype, parser);
     }
 }
index b8e22aa9b0d1ba454615a21b9655ff237c5063d9..120083cbee141cea462a9ac55df7c5ae666c0ea4 100644 (file)
@@ -26,7 +26,7 @@ public class SimpleRSVPExtensionProviderContextActivator implements AutoCloseabl
     private final List<RSVPExtensionProviderActivator> extensionActivators;
 
     public SimpleRSVPExtensionProviderContextActivator(final RSVPExtensionProviderContext providerContext,
-            final List<RSVPExtensionProviderActivator> extensionActivators) {
+        final List<RSVPExtensionProviderActivator> extensionActivators) {
         this.providerContext = Preconditions.checkNotNull(providerContext);
         this.extensionActivators = Preconditions.checkNotNull(extensionActivators);
     }
@@ -34,7 +34,7 @@ public class SimpleRSVPExtensionProviderContextActivator implements AutoCloseabl
     public void start() {
         LOG.debug("Starting {} RSVPExtensionProviderActivator instances", this.extensionActivators.size());
 
-        for(final RSVPExtensionProviderActivator e : this.extensionActivators) {
+        for (final RSVPExtensionProviderActivator e : this.extensionActivators) {
             e.start(this.providerContext);
         }
     }
@@ -43,7 +43,7 @@ public class SimpleRSVPExtensionProviderContextActivator implements AutoCloseabl
     public void close() {
         LOG.debug("Stopping {} RSVPExtensionProviderActivator instances", this.extensionActivators.size());
 
-        for(final RSVPExtensionProviderActivator e : this.extensionActivators) {
+        for (final RSVPExtensionProviderActivator e : this.extensionActivators) {
             e.stop();
         }
     }
index 8bb582b1263f09196320504969faac97ce0cb3af..1f8befeacf031766ecff89aca3edbb06b080eb3b 100644 (file)
@@ -26,19 +26,21 @@ public final class SimpleRSVPObjectRegistry implements RSVPTeObjectRegistry {
     private final Table<Integer, Integer, RSVPTeObjectParser> parserHandler = HashBasedTable.create();
     private final Map<Class<? extends RsvpTeObject>, RSVPTeObjectSerializer> serializerHandler = new HashMap<>();
 
-    public void registerRsvpObjectParser(final int classNum, final int cType, final RSVPTeObjectParser parser) {
+    public void registerRsvpObjectParser(final int classNum, final int ctype, final RSVPTeObjectParser parser) {
         Preconditions.checkArgument(classNum >= 0 && classNum <= Values.UNSIGNED_BYTE_MAX_VALUE);
-        Preconditions.checkArgument(cType >= 0 && cType <= Values.UNSIGNED_BYTE_MAX_VALUE);
-        this.parserHandler.put(classNum, cType, parser);
+        Preconditions.checkArgument(ctype >= 0 && ctype <= Values.UNSIGNED_BYTE_MAX_VALUE);
+        this.parserHandler.put(classNum, ctype, parser);
     }
 
-    public void registerRsvpObjectSerializer(final Class<? extends RsvpTeObject> objectClass, final RSVPTeObjectSerializer serializer) {
+    public void registerRsvpObjectSerializer(final Class<? extends RsvpTeObject> objectClass,
+        final RSVPTeObjectSerializer serializer) {
         this.serializerHandler.put(objectClass, serializer);
     }
 
     @Override
-    public RsvpTeObject parseRSPVTe(final int classNum, final int cType, final ByteBuf buffer) throws RSVPParsingException {
-        final RSVPTeObjectParser parser = this.parserHandler.get(classNum, cType);
+    public RsvpTeObject parseRSPVTe(final int classNum, final int ctype, final ByteBuf buffer)
+        throws RSVPParsingException {
+        final RSVPTeObjectParser parser = this.parserHandler.get(classNum, ctype);
         if (parser == null) {
             return null;
         }
index 5ea933ab1b20b3b99dd921c04c00fa2284547df6..658f3b0ac260d2be999735f6605952a5f10ab91c 100644 (file)
@@ -21,7 +21,8 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
 import org.opendaylight.yangtools.yang.binding.DataContainer;
 
 public class SimpleXROSubobjectRegistry implements XROSubobjectRegistry {
-    private final HandlerRegistry<DataContainer, XROSubobjectParser, XROSubobjectSerializer> handlers = new HandlerRegistry<>();
+    private final HandlerRegistry<DataContainer, XROSubobjectParser, XROSubobjectSerializer> handlers =
+        new HandlerRegistry<>();
 
     public AutoCloseable registerSubobjectParser(final int subobjectType, final XROSubobjectParser parser) {
         Preconditions.checkArgument(subobjectType >= 0 && subobjectType <= Values.UNSIGNED_SHORT_MAX_VALUE);
@@ -29,12 +30,13 @@ public class SimpleXROSubobjectRegistry implements XROSubobjectRegistry {
     }
 
     public AutoCloseable registerSubobjectSerializer(final Class<? extends SubobjectType> subobjectClass,
-                                                     final XROSubobjectSerializer serializer) {
+        final XROSubobjectSerializer serializer) {
         return this.handlers.registerSerializer(subobjectClass, serializer);
     }
 
     @Override
-    public SubobjectContainer parseSubobject(final int type, final ByteBuf buffer, final boolean mandatory) throws RSVPParsingException {
+    public SubobjectContainer parseSubobject(final int type, final ByteBuf buffer, final boolean mandatory)
+        throws RSVPParsingException {
         Preconditions.checkArgument(type >= 0 && type <= Values.UNSIGNED_SHORT_MAX_VALUE);
         final XROSubobjectParser parser = this.handlers.getParser(type);
         if (parser == null) {
@@ -45,7 +47,8 @@ public class SimpleXROSubobjectRegistry implements XROSubobjectRegistry {
 
     @Override
     public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
-        final XROSubobjectSerializer serializer = this.handlers.getSerializer(subobject.getSubobjectType().getImplementedInterface());
+        final XROSubobjectSerializer serializer = this.handlers.getSerializer(subobject.getSubobjectType()
+            .getImplementedInterface());
         if (serializer == null) {
             return;
         }
index adffa2af437c02fb2c7dd9cef89871f9a510ba65..39ab88fadba04c7b21d5f3cfb357a3c1f3ad7867 100644 (file)
@@ -27,11 +27,11 @@ public abstract class AbstractRSVPObjectParser implements RSVPTeObjectSerializer
     protected static final int TOKEN_BUCKET_TSPEC = 127;
     protected static final int FLAGS_SIZE = 8;
 
-    protected static void serializeAttributeHeader(final Integer valueLength, final short classNum, final short cType,
-                                                   final ByteBuf byteAggregator) {
+    protected static void serializeAttributeHeader(final Integer valueLength, final short classNum,
+        final short ctype, final ByteBuf byteAggregator) {
         byteAggregator.writeShort(valueLength);
         byteAggregator.writeByte(classNum);
-        byteAggregator.writeByte(cType);
+        byteAggregator.writeByte(ctype);
     }
 
     protected static void writeAttributeFilter(final AttributeFilter attributeFilter, final ByteBuf body) {
@@ -54,7 +54,7 @@ public abstract class AbstractRSVPObjectParser implements RSVPTeObjectSerializer
         localSerializeObject(rsvpTeObject, output);
     }
 
-    protected abstract void localSerializeObject(final RsvpTeObject rsvpTeObject, final ByteBuf output);
+    protected abstract void localSerializeObject(RsvpTeObject rsvpTeObject, ByteBuf output);
 
-    protected abstract RsvpTeObject localParseObject(final ByteBuf byteBuf) throws RSVPParsingException;
+    protected abstract RsvpTeObject localParseObject(ByteBuf byteBuf) throws RSVPParsingException;
 }
index a16429741ac0363575b8b02d538faba90d9362d3..9cf96b08e79f33ddaccb8824c06bdf29c3f3f14a 100644 (file)
@@ -19,7 +19,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.subobjects.subobject.type.path.key._case.PathKeyBuilder;
 
 public class CommonPathKeyParser {
-    public static final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route
+    public static org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route
         .subobjects.subobject.type.path.key._case.PathKey parsePathKey(final int pceIdFLength, final ByteBuf buffer) {
         final int pathKey = buffer.readUnsignedShort();
         final byte[] pceId = ByteArray.readBytes(buffer, pceIdFLength);
@@ -29,8 +29,8 @@ public class CommonPathKeyParser {
         return pBuilder.build();
     }
 
-    public static final ByteBuf serializePathKey(final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
-            .rsvp.rev150820.explicit.route.subobjects.subobject.type.path.key._case.PathKey pk) {
+    public static ByteBuf serializePathKey(final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
+        .rsvp.rev150820.explicit.route.subobjects.subobject.type.path.key._case.PathKey pk) {
         final ByteBuf body = Unpooled.buffer();
         Preconditions.checkArgument(pk.getPathKey() != null, "PathKey is mandatory.");
         writeUnsignedShort(pk.getPathKey().getValue(), body);
index bf8a74a49d926e46e8d50ba3fc7234f5058f17d8..32f00f1373799bfdf36ab7e375f0c501dc2800f4 100644 (file)
@@ -8,28 +8,27 @@
 
 package org.opendaylight.protocol.rsvp.parser.spi.subobjects;
 
-
-import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeUnsignedInt;
-
 import com.google.common.base.Preconditions;
+
 import io.netty.buffer.ByteBuf;
+import org.opendaylight.protocol.util.ByteBufWriteUtil;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.UnnumberedCase;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.UnnumberedCaseBuilder;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.unnumbered._case.Unnumbered;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.unnumbered._case.UnnumberedBuilder;
 
 public class CommonUnnumberedInterfaceSubobjectParser {
-    protected static final UnnumberedCase parseUnnumeredInterface(final ByteBuf buffer) {
+    protected static UnnumberedCase parseUnnumeredInterface(final ByteBuf buffer) {
         final UnnumberedBuilder ubuilder = new UnnumberedBuilder();
         ubuilder.setRouterId(buffer.readUnsignedInt());
         ubuilder.setInterfaceId(buffer.readUnsignedInt());
         return new UnnumberedCaseBuilder().setUnnumbered(ubuilder.build()).build();
     }
 
-    protected static final void serializeUnnumeredInterface(final Unnumbered unnumbered, final ByteBuf body) {
+    protected static void serializeUnnumeredInterface(final Unnumbered unnumbered, final ByteBuf body) {
         Preconditions.checkArgument(unnumbered.getRouterId() != null, "RouterId is mandatory.");
-        writeUnsignedInt(unnumbered.getRouterId(), body);
+        ByteBufWriteUtil.writeUnsignedInt(unnumbered.getRouterId(), body);
         Preconditions.checkArgument(unnumbered.getInterfaceId() != null, "InterfaceId is mandatory.");
-        writeUnsignedInt(unnumbered.getInterfaceId(), body);
+        ByteBufWriteUtil.writeUnsignedInt(unnumbered.getInterfaceId(), body);
     }
 }
index 2651502a1fe86cde811c9bb299765870a40f6185..80d7f92fecce2e5b118fb086e06c04fa4d099d45 100644 (file)
@@ -8,8 +8,8 @@
 
 package org.opendaylight.protocol.rsvp.parser.spi.subobjects;
 
-
 import com.google.common.base.Preconditions;
+
 import io.netty.buffer.ByteBuf;
 import io.netty.buffer.ByteBufUtil;
 import java.util.ArrayList;
@@ -35,8 +35,10 @@ public abstract class EROSubobjectListParser extends AbstractRSVPObjectParser {
         Preconditions.checkArgument(buffer != null, "Array of bytes is mandatory. Can't be null.");
         final List<SubobjectContainer> subs = new ArrayList<>();
         while (buffer.isReadable()) {
-            final boolean loose = ((buffer.getUnsignedByte(buffer.readerIndex()) & (1 << Values.FIRST_BIT_OFFSET)) != 0) ? true : false;
-            final int type = (buffer.readUnsignedByte() & Values.BYTE_MAX_VALUE_BYTES) & ~(1 << Values.FIRST_BIT_OFFSET);
+            final boolean loose = (buffer.getUnsignedByte(buffer.readerIndex()) & (1 << Values.FIRST_BIT_OFFSET))
+                != 0;
+            final int type = (buffer.readUnsignedByte() & Values.BYTE_MAX_VALUE_BYTES) & ~(1 << Values
+                .FIRST_BIT_OFFSET);
             final int length = buffer.readUnsignedByte() - HEADER_LENGTH;
             if (length > buffer.readableBytes()) {
                 throw new RSVPParsingException("Wrong length specified. Passed: " + length + "; Expected: <= "
@@ -55,7 +57,8 @@ public abstract class EROSubobjectListParser extends AbstractRSVPObjectParser {
     }
 
     public final void serializeList(final List<SubobjectContainer> subobjects, final ByteBuf buffer) {
-        Preconditions.checkArgument(subobjects != null && !subobjects.isEmpty(), "RRO must contain at least one subobject.");
+        Preconditions.checkArgument(subobjects != null && !subobjects.isEmpty(),
+            "RRO must contain at least one subobject.");
         for (final SubobjectContainer subobject : subobjects) {
             this.subobjReg.serializeSubobject(subobject, buffer);
         }
index 4ff8fe2c36ad906b6c38a1a2b1a077e29ebc9535..842c6138c4b2a14b7d352b4db4af4f38c1be2949 100644 (file)
@@ -29,7 +29,8 @@ public abstract class RROSubobjectListParser extends AbstractRSVPObjectParser {
     }
 
     public List<SubobjectContainer> parseList(final ByteBuf buffer) throws RSVPParsingException {
-        Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
+        Preconditions.checkArgument(buffer != null && buffer.isReadable(),
+            "Array of bytes is mandatory. Can't be null or empty.");
         final List<SubobjectContainer> subs = new ArrayList<>();
         while (buffer.isReadable()) {
             final int type = buffer.readUnsignedByte();
@@ -51,7 +52,8 @@ public abstract class RROSubobjectListParser extends AbstractRSVPObjectParser {
     }
 
     public final void serializeList(final List<SubobjectContainer> subobjects, final ByteBuf buffer) {
-        Preconditions.checkArgument(subobjects != null && !subobjects.isEmpty(), "RRO must contain at least one subobject.");
+        Preconditions.checkArgument(subobjects != null && !subobjects.isEmpty(),
+            "RRO must contain at least one subobject.");
         for (final SubobjectContainer subobject : subobjects) {
             this.subobjReg.serializeSubobject(subobject, buffer);
         }
index 89a7d9a5f38623c22ec9d9c299ddce829f0cf8c1..da5b254f6e151dee3f90b4e8d8a89e30f9876e87 100644 (file)
@@ -33,11 +33,14 @@ public abstract class XROSubobjectListParser extends AbstractRSVPObjectParser {
     public List<SubobjectContainer> parseList(final ByteBuf byteBuf) throws RSVPParsingException {
         final List<SubobjectContainer> subs = new ArrayList<>();
         while (byteBuf.isReadable()) {
-            final boolean mandatory = ((byteBuf.getUnsignedByte(byteBuf.readerIndex()) & (1 << Values.FIRST_BIT_OFFSET)) != 0) ? true : false;
-            final int type = UnsignedBytes.checkedCast((byteBuf.readUnsignedByte() & Values.BYTE_MAX_VALUE_BYTES) & ~(1 << Values.FIRST_BIT_OFFSET));
+            final boolean mandatory = (byteBuf.getUnsignedByte(byteBuf.readerIndex()) & (1 << Values
+                .FIRST_BIT_OFFSET)) != 0;
+            final int type = UnsignedBytes.checkedCast((byteBuf.readUnsignedByte() & Values.BYTE_MAX_VALUE_BYTES) & ~
+                (1 << Values.FIRST_BIT_OFFSET));
             final int length = byteBuf.readUnsignedByte() - HEADER_LENGHT;
             if (length > byteBuf.readableBytes()) {
-                throw new RSVPParsingException("Wrong length specified. Passed: " + length + "; Expected: <= " + byteBuf.readableBytes());
+                throw new RSVPParsingException("Wrong length specified. Passed: " + length
+                    + "; Expected: <= " + byteBuf.readableBytes());
             }
             LOG.debug("Attempt to parse subobject from bytes: {}", ByteBufUtil.hexDump(byteBuf));
             final SubobjectContainer sub = this.subobjReg.parseSubobject(type, byteBuf.readSlice(length), mandatory);
@@ -53,7 +56,8 @@ public abstract class XROSubobjectListParser extends AbstractRSVPObjectParser {
     }
 
     public void serializeList(final List<SubobjectContainer> subobjects, final ByteBuf buffer) {
-        Preconditions.checkArgument(subobjects != null && !subobjects.isEmpty(), "XRO must contain at least one subobject.");
+        Preconditions.checkArgument(subobjects != null && !subobjects.isEmpty(),
+            "XRO must contain at least one subobject.");
         for (final SubobjectContainer subobject : subobjects) {
             this.subobjReg.serializeSubobject(subobject, buffer);
         }