X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=third-party%2Fopenflow-codec%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenflow%2Fcodec%2Fprotocol%2Fqueue%2FOFPQueuePropertyType.java;fp=third-party%2Fopenflow-codec%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenflow%2Fcodec%2Fprotocol%2Fqueue%2FOFPQueuePropertyType.java;h=0000000000000000000000000000000000000000;hb=64fe0fbca1a6c2b77ad25f568d73a7eb64236d16;hp=b72752542a12506b5dbd115a687ab2afa3ae5e56;hpb=8b9a3ff2bbc83941254b46b818cbbae5cc1a3a5b;p=openflowjava.git diff --git a/third-party/openflow-codec/src/main/java/org/openflow/codec/protocol/queue/OFPQueuePropertyType.java b/third-party/openflow-codec/src/main/java/org/openflow/codec/protocol/queue/OFPQueuePropertyType.java deleted file mode 100644 index b7275254..00000000 --- a/third-party/openflow-codec/src/main/java/org/openflow/codec/protocol/queue/OFPQueuePropertyType.java +++ /dev/null @@ -1,166 +0,0 @@ -/** - * - */ -package org.openflow.codec.protocol.queue; - -import java.lang.reflect.Constructor; -import java.util.HashMap; -import java.util.Map; - -import org.openflow.codec.protocol.Instantiable; -import org.openflow.codec.util.U16; - -/** - * List of OpenFlow Queue Property types and mappings to wire protocol value and - * derived classes - * - * @author David Erickson (daviderickson@cs.stanford.edu) - */ -public class OFPQueuePropertyType { - - public static OFPQueuePropertyType MIN_RATE = new OFPQueuePropertyType(1, "MIN_RATE", - OFPQueuePropertyMinRate.class, new Instantiable() { - @Override - public OFPQueueProperty instantiate() { - return new OFPQueuePropertyMinRate(); - } - }); - public static OFPQueuePropertyType MAX_RATE = new OFPQueuePropertyType(2, "MAX_RATE", - OFPQueuePropertyMaxRate.class, new Instantiable() { - @Override - public OFPQueueProperty instantiate() { - return new OFPQueuePropertyMaxRate(); - } - }); - public static OFPQueuePropertyType EXPERIMENTER = new OFPQueuePropertyType(0xffff, "EXPERIMENTER", - OFPQueuePropertyExperimenter.class, new Instantiable() { - @Override - public OFPQueueProperty instantiate() { - return new OFPQueuePropertyExperimenter(); - } - }); - - protected static Map mapping; - - protected Class clazz; - protected Constructor constructor; - protected Instantiable instantiable; - protected int minLen; - protected String name; - protected short type; - - /** - * Store some information about the OpenFlow Queue Property type, including - * wire protocol type number, length, and derived class - * - * @param type - * Wire protocol number associated with this OFPQueuePropertyType - * @param name - * The name of this type - * @param clazz - * The Java class corresponding to this type of OpenFlow Queue - * Property - * @param instantiable - * the instantiable for the OFPQueueProperty this type represents - */ - OFPQueuePropertyType(int type, String name, Class clazz, - Instantiable instantiable) { - this.type = (short) type; - this.name = name; - this.clazz = clazz; - this.instantiable = instantiable; - try { - this.constructor = clazz.getConstructor(new Class[] {}); - } catch (Exception e) { - throw new RuntimeException("Failure getting constructor for class: " + clazz, e); - } - OFPQueuePropertyType.addMapping(type, this); - } - - /** - * Adds a mapping from type value to OFPQueuePropertyType enum - * - * @param i - * OpenFlow wire protocol Action type value - * @param t - * type - */ - static public void addMapping(int i, OFPQueuePropertyType t) { - if (mapping == null) - mapping = new HashMap(); - OFPQueuePropertyType.mapping.put(i, t); - } - - /** - * Given a wire protocol OpenFlow type number, return the OFPType associated - * with it - * - * @param i - * wire protocol number - * @return OFPType enum type - */ - - static public OFPQueuePropertyType valueOf(short i) { - return OFPQueuePropertyType.mapping.get(U16.f(i)); - } - - /** - * @return Returns the wire protocol value corresponding to this - * OFPQueuePropertyType - */ - public short getTypeValue() { - return this.type; - } - - /** - * @return return the OFPQueueProperty subclass corresponding to this - * OFPQueuePropertyType - */ - public Class toClass() { - return clazz; - } - - /** - * Returns the no-argument Constructor of the implementation class for this - * OFPQueuePropertyType - * - * @return the constructor - */ - public Constructor getConstructor() { - return constructor; - } - - /** - * Returns a new instance of the OFPQueueProperty represented by this - * OFPQueuePropertyType - * - * @return the new object - */ - public OFPQueueProperty newInstance() { - return instantiable.instantiate(); - } - - /** - * @return the instantiable - */ - public Instantiable getInstantiable() { - return instantiable; - } - - /** - * @param instantiable - * the instantiable to set - */ - public void setInstantiable(Instantiable instantiable) { - this.instantiable = instantiable; - } - - public String getName() { - return this.name; - } - - @Override - public String toString() { - return this.name; - } -}