X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?p=controller.git;a=blobdiff_plain;f=third-party%2Fopenflowj%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenflow%2Fprotocol%2Fqueue%2FOFQueuePropertyType.java;fp=third-party%2Fopenflowj%2Fsrc%2Fmain%2Fjava%2Forg%2Fopenflow%2Fprotocol%2Fqueue%2FOFQueuePropertyType.java;h=0000000000000000000000000000000000000000;hp=3174033a61ebd975198d88071ecc428eec8d7e67;hb=e1c04c5af263a9604a765f1ab98be51dfc51d8cb;hpb=a935ffda7f26be29de879a47b426d0db7a28d588 diff --git a/third-party/openflowj/src/main/java/org/openflow/protocol/queue/OFQueuePropertyType.java b/third-party/openflowj/src/main/java/org/openflow/protocol/queue/OFQueuePropertyType.java deleted file mode 100644 index 3174033a61..0000000000 --- a/third-party/openflowj/src/main/java/org/openflow/protocol/queue/OFQueuePropertyType.java +++ /dev/null @@ -1,143 +0,0 @@ -/** - * - */ -package org.openflow.protocol.queue; - -import java.lang.reflect.Constructor; - -import org.openflow.protocol.Instantiable; - -/** - * List of OpenFlow Queue Property types and mappings to wire protocol value and - * derived classes - * - * @author David Erickson (daviderickson@cs.stanford.edu) - */ -public class OFQueuePropertyType { - public static OFQueuePropertyType NONE = new OFQueuePropertyType(0, "NONE", - OFQueueProperty.class, new Instantiable() { - @Override - public OFQueueProperty instantiate() { - return new OFQueueProperty(); - } - }); - - public static OFQueuePropertyType MIN_RATE = new OFQueuePropertyType(1, "MIN_RATE", - OFQueuePropertyMinRate.class, new Instantiable() { - @Override - public OFQueueProperty instantiate() { - return new OFQueuePropertyMinRate(); - } - }); - - protected static OFQueuePropertyType[] 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 OFQueuePropertyType - * @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 OFQueueProperty this type represents - */ - OFQueuePropertyType(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); - } - OFQueuePropertyType.addMapping(this.type, this); - } - - /** - * Adds a mapping from type value to OFQueuePropertyType enum - * - * @param i OpenFlow wire protocol Action type value - * @param t type - */ - static public void addMapping(short i, OFQueuePropertyType t) { - if (mapping == null) - mapping = new OFQueuePropertyType[16]; - OFQueuePropertyType.mapping[i] = t; - } - - /** - * Given a wire protocol OpenFlow type number, return the OFType associated - * with it - * - * @param i wire protocol number - * @return OFType enum type - */ - - static public OFQueuePropertyType valueOf(short i) { - return OFQueuePropertyType.mapping[i]; - } - - /** - * @return Returns the wire protocol value corresponding to this - * OFQueuePropertyType - */ - public short getTypeValue() { - return this.type; - } - - /** - * @return return the OFQueueProperty subclass corresponding to this OFQueuePropertyType - */ - public Class toClass() { - return clazz; - } - - /** - * Returns the no-argument Constructor of the implementation class for - * this OFQueuePropertyType - * @return the constructor - */ - public Constructor getConstructor() { - return constructor; - } - - /** - * Returns a new instance of the OFQueueProperty represented by this OFQueuePropertyType - * @return the new object - */ - public OFQueueProperty 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; - } -}