java_loxi: big refactoring and clean-up
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFAbstractMessage.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFAbstractMessage.java
deleted file mode 100644
index bc2218f..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFAbstractMessage.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Copyright 2013, Big Switch Networks, Inc.
- *
- * LoxiGen is licensed under the Eclipse Public License, version 1.0 (EPL), with
- * the following special exception:
- *
- * LOXI Exception
- *
- * As a special exception to the terms of the EPL, you may distribute libraries
- * generated by LoxiGen (LoxiGen Libraries) under the terms of your choice, provided
- * that copyright and licensing notices generated by LoxiGen are not altered or removed
- * from the LoxiGen Libraries and the notice provided below is (i) included in
- * the LoxiGen Libraries, if distributed in source code form and (ii) included in any
- * documentation for the LoxiGen Libraries, if distributed in binary form.
- *
- * Notice: "Copyright 2013, Big Switch Networks, Inc. This library was generated by the LoxiGen Compiler."
- *
- * You may not use this file except in compliance with the EPL or LOXI Exception. You may obtain
- * a copy of the EPL at:
- *
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
- * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
- * EPL for the specific language governing permissions and limitations
- * under the EPL.
- */
-package org.openflow.protocol;
-
-/**
- * The base interface for all OpenFlow message objects
- */
-
-import org.openflow.types.OFType;
-
-abstract public class OFAbstractMessage implements OFObject {
-    private final OFVersion version;
-    private final OFType type;
-    private int xid;
-
-    public static int MINIMUM_SIZE = 8;
-
-    public OFAbstractMessage(final OFVersion version, final OFType type) {
-        this.version = version;
-        this.type = type;
-    }
-
-    /**
-     * Return the wire format version of this message, e.g., 0x01
-     */
-    OFVersion getVersion() {
-        return version;
-    }
-
-    /**
-     * @return the transction ID for this message
-     */
-    int getXid() {
-        return xid;
-    }
-
-    /**
-     * @param newXid
-     *            Set this transaction ID for this message
-     */
-    void setXid(final int xid) {
-        this.xid = xid;
-    }
-
-    /**
-     * The type that is returned here is agnostic to the underlying wire format
-     *
-     * @return the type of OpenFlow message.
-     */
-    OFType getType() {
-        return type;
-    }
-
-    @Override
-    public int getLength() {
-        return MINIMUM_SIZE;
-    }
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFBsnVportQInQT.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFBsnVportQInQT.java
new file mode 100644
index 0000000..c5b884e
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFBsnVportQInQT.java
@@ -0,0 +1,5 @@
+package org.openflow.protocol;
+
+public class OFBsnVportQInQT {
+
+}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFMatchBmap.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFMatchBmap.java
new file mode 100644
index 0000000..6e4dc5b
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFMatchBmap.java
@@ -0,0 +1,5 @@
+package org.openflow.protocol;
+
+public class OFMatchBmap {
+
+}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFMessage.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFMessage.java
index 4f31741..c1e4456 100644
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFMessage.java
+++ b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFMessage.java
@@ -1,13 +1,13 @@
 package org.openflow.protocol;
 
-import org.openflow.types.OFType;
-
 public interface OFMessage {
     int getXid();
 
-    boolean isXidSet();
-
     OFType getType();
 
     OFVersion getVersion();
+
+    interface Builder {
+
+    }
 }
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFMessageReader.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFMessageReader.java
index 24c3314..3f34d9b 100644
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFMessageReader.java
+++ b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFMessageReader.java
@@ -3,6 +3,6 @@
 import org.jboss.netty.buffer.ChannelBuffer;
 import org.openflow.exceptions.OFParseError;
 
-public interface OFMessageReader<T extends OFMessage> {
+public interface OFMessageReader<T> {
     T readFrom(ChannelBuffer bb) throws OFParseError;
 }
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFMessageWriter.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFMessageWriter.java
new file mode 100644
index 0000000..84e5507
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFMessageWriter.java
@@ -0,0 +1,8 @@
+package org.openflow.protocol;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.openflow.exceptions.OFParseError;
+
+public interface OFMessageWriter<T> {
+    public int write(ChannelBuffer bb, T message) throws OFParseError;
+}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFObject.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFObject.java
index 21a4607..4a7557f 100644
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFObject.java
+++ b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFObject.java
@@ -1,5 +1,7 @@
 package org.openflow.protocol;
 
+import org.jboss.netty.buffer.ChannelBuffer;
+
 /**
  *  Base interface of all OpenFlow objects (e.g., messages, actions, stats, etc.)
  *
@@ -10,26 +12,8 @@
  *  malformed packets, for example, for negative testing.
  */
 
-import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.exceptions.OFParseError;
-import org.openflow.exceptions.OFShortWrite;
 
 public interface OFObject {
-    /**
-     * Return a number equal or greater than zero (and currently in OF less than
-     * 65536)
-     *
-     * @return the number of bytes this object will represent on the wire
-     */
-    public int getLength();
-
-    /**
-     * Automatically calculate any lengths and write an openflow object into the
-     * byte buffer.
-     *
-     * @param bb
-     *            A valid byte buffer with sufficient capacity to hold this
-     *            object/
-     */
-    public void writeTo(ChannelBuffer bb) throws OFParseError, OFShortWrite;
+    void writeTo(ChannelBuffer bb);
+    int getLength();
 }
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFTableFeature.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFTableFeature.java
new file mode 100644
index 0000000..114f638
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFTableFeature.java
@@ -0,0 +1,5 @@
+package org.openflow.protocol;
+
+public class OFTableFeature {
+    // FIXME implement
+}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFVersion.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFVersion.java
index afc0393..7241647 100644
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/OFVersion.java
+++ b/java_gen/pre-written/src/main/java/org/openflow/protocol/OFVersion.java
@@ -3,7 +3,7 @@
 public enum OFVersion {
     OF_10(1), OF_11(2), OF_12(3), OF_13(4);
 
-    private final int wireVersion;
+    public final int wireVersion;
 
     OFVersion(final int wireVersion) {
         this.wireVersion = wireVersion;
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/Wildcards.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/Wildcards.java
new file mode 100644
index 0000000..25b2c21
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/openflow/protocol/Wildcards.java
@@ -0,0 +1,5 @@
+package org.openflow.protocol;
+
+public class Wildcards {
+
+}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/XidGenerator.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/XidGenerator.java
new file mode 100644
index 0000000..0819ac2
--- /dev/null
+++ b/java_gen/pre-written/src/main/java/org/openflow/protocol/XidGenerator.java
@@ -0,0 +1,5 @@
+package org.openflow.protocol;
+
+public interface XidGenerator {
+    int nextXid();
+}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/actions/OFAction.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/actions/OFAction.java
deleted file mode 100644
index f01f8fe..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/actions/OFAction.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.openflow.protocol.actions;
-
-import org.openflow.protocol.OFObject;
-
-public interface OFAction extends OFObject {
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/instructions/OFInstruction.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/instructions/OFInstruction.java
deleted file mode 100644
index 8af305c..0000000
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/instructions/OFInstruction.java
+++ /dev/null
@@ -1,7 +0,0 @@
-package org.openflow.protocol.instructions;
-
-import org.openflow.protocol.OFObject;
-
-public interface OFInstruction extends OFObject {
-
-}
diff --git a/java_gen/pre-written/src/main/java/org/openflow/protocol/match/MatchBuilderVer10.java b/java_gen/pre-written/src/main/java/org/openflow/protocol/match/MatchBuilderVer10.java
index 19ced8f..f00e1b4 100644
--- a/java_gen/pre-written/src/main/java/org/openflow/protocol/match/MatchBuilderVer10.java
+++ b/java_gen/pre-written/src/main/java/org/openflow/protocol/match/MatchBuilderVer10.java
@@ -1,8 +1,6 @@
 package org.openflow.protocol.match;
 
 import org.jboss.netty.buffer.ChannelBuffer;
-import org.openflow.exceptions.OFParseError;
-import org.openflow.exceptions.OFShortWrite;
 import org.openflow.protocol.types.IpDscp;
 import org.openflow.types.EthType;
 import org.openflow.types.IPv4;
@@ -157,7 +155,7 @@
     }
 
     @Override
-    public void writeTo(final ChannelBuffer bb) throws OFParseError, OFShortWrite {
+    public void writeTo(final ChannelBuffer bb) {
         // TODO Auto-generated method stub
 
     }