Making classes final to make inheritance impossible
[iot2.git] / iotjava / iotrmi / Java / IoTRMIUtil.java
index f593a7ad4d277335c0e4c5c4ec093aa200750c4c..cdeb608aa8a7d2a614648db68442ee2363c78647 100644 (file)
@@ -25,7 +25,7 @@ import java.util.Set;
  * @version     1.0
  * @since       2016-10-04
  */
-public class IoTRMIUtil {
+public final class IoTRMIUtil {
 
        /**
         * Class Properties
@@ -37,10 +37,13 @@ public class IoTRMIUtil {
        /**
         * Class Constants
         */
-       public final static int OBJECT_ID_LEN = 4;      // 4 bytes = 32 bits
-       public final static int METHOD_ID_LEN = 4;      // 4 bytes = 32 bits
-       public final static int PARAM_LEN = 4;          // 4 bytes = 32 bits (4-byte field that stores the length of the param)
-       public final static int RETURN_LEN = 4;         // 4 bytes = 32 bits (4-byte field that stores the length of the return object)
+       public final static int OBJECT_ID_LEN = 4;              // 4 bytes = 32 bits
+       public final static int METHOD_ID_LEN = 4;              // 4 bytes = 32 bits
+       public final static int PACKET_TYPE_LEN = 4;    // 4 bytes = 32 bits
+       public final static int PARAM_LEN = 4;                  // 4 bytes = 32 bits (4-byte field that stores the length of the param)
+       public final static int RETURN_LEN = 4;                 // 4 bytes = 32 bits (4-byte field that stores the length of the return object)
+       public final static int RET_VAL_TYPE = -1;              // Packet type of return value
+       public final static int METHOD_TYPE = 1;                // Packet type of method
 
        public final static int SHT_LEN = 2;
        public final static int INT_LEN = 4;
@@ -51,6 +54,14 @@ public class IoTRMIUtil {
        public final static int BYT_LEN = 1;
        public final static int BOL_LEN = 1;
 
+       /**
+        * Public static data structure to keep track of multiple skeletons and stubs
+        */
+       public static Map<Integer,Object> mapStub = new HashMap<Integer,Object>();              // Map object to its stub ID
+       public static Map<Object,Object> mapSkel = new HashMap<Object,Object>();                // Map object to its skeleton
+       public static Map<Object,Integer> mapSkelId = new HashMap<Object,Integer>();    // Map object to its skeleton ID
+
+
        /**
         * Constructors
         */
@@ -67,6 +78,20 @@ public class IoTRMIUtil {
                                IoTRMITypes.nonPrimitivesJava, IoTRMITypes.nonPrimitivesCplus);
        }
 
+       
+       /*public static void initRMICall(int port, String address, int rev) throws IOException {
+               rmiCall = new IoTRMICall(port, address, rev);
+       }
+       
+       public static void initRMICall(int localPort, int port, String address, int rev) throws IOException {
+               rmiCall = new IoTRMICall(localPort, port, address, rev);
+       }
+       
+       public static void initRMIObject(int port) throws IOException, ClassNotFoundException, 
+                       InstantiationException, IllegalAccessException {
+               rmiObj = new IoTRMIObject(port);
+       }*/
+       
 
        /**
         * getHashCodeBytes() gets hash value (in bytes) from method name