}
+ /**
+ * HELPER: writePropertiesJavaPermission() writes the permission in properties
+ */
+ private void writePropertiesJavaPermission(String intface, InterfaceDecl intDecl) {
+
+ Map<String,Set<String>> mapNewIntMethods = mapInt2NewInts.get(intface);
+ for (Map.Entry<String,Set<String>> intMeth : mapNewIntMethods.entrySet()) {
+ String newIntface = intMeth.getKey();
+ int newObjectId = mapNewIntfaceObjId.get(newIntface);
+ println("private final static int object" + newObjectId + "Id = " +
+ newObjectId + ";\t//" + newIntface);
+ Set<String> methodIds = intMeth.getValue();
+ print("private static Integer[] object" + newObjectId + "Permission = { ");
+ int i = 0;
+ for (String methodId : methodIds) {
+ int methodNumId = intDecl.getMethodNumId(methodId);
+ print(Integer.toString(methodNumId));
+ // Check if this is the last element (don't print a comma)
+ if (i != methodIds.size() - 1) {
+ print(", ");
+ }
+ i++;
+ }
+ println(" };");
+ println("private List<Integer> set" + newObjectId + "Allowed;");
+ }
+ }
+
+
/**
* HELPER: writePropertiesJavaStub() writes the properties of the stub class
*/
// Generate permission stuff for callback stubs
DeclarationHandler decHandler = mapIntDeclHand.get(callbackType);
InterfaceDecl intDecl = (InterfaceDecl) decHandler.getInterfaceDecl(callbackType);
- Map<String,Set<String>> mapNewIntMethods = mapInt2NewInts.get(callbackType);
- for (Map.Entry<String,Set<String>> intMeth : mapNewIntMethods.entrySet()) {
- String newCallbackIntface = intMeth.getKey();
- int newObjectId = mapNewIntfaceObjId.get(newCallbackIntface);
- println("private final static int object" + newObjectId + "Id = " +
- newObjectId + ";\t//" + newCallbackIntface);
- Set<String> methodIds = intMeth.getValue();
- print("private static Integer[] object" + newObjectId + "Permission = { ");
- int i = 0;
- for (String methodId : methodIds) {
- int methodNumId = intDecl.getMethodNumId(methodId);
- print(Integer.toString(methodNumId));
- // Check if this is the last element (don't print a comma)
- if (i != methodIds.size() - 1) {
- print(", ");
- }
- i++;
- }
- println(" };");
- println("private List<Integer> set" + newObjectId + "Allowed;");
- }
+ writePropertiesJavaPermission(callbackType, intDecl);
}
println("\n");
}
// Generate permission stuff for callback stubs
DeclarationHandler decHandler = mapIntDeclHand.get(callbackType);
InterfaceDecl intDecl = (InterfaceDecl) decHandler.getInterfaceDecl(callbackType);
- Map<String,Set<String>> mapNewIntMethods = mapInt2NewInts.get(callbackType);
- for (Map.Entry<String,Set<String>> intMeth : mapNewIntMethods.entrySet()) {
- String newCallbackIntface = intMeth.getKey();
- int newObjectId = mapNewIntfaceObjId.get(newCallbackIntface);
- println("private final static int object" + newObjectId + "Id = " +
- newObjectId + ";\t//" + newCallbackIntface);
- Set<String> methodIds = intMeth.getValue();
- print("private static Integer[] object" + newObjectId + "Permission = { ");
- int i = 0;
- for (String methodId : methodIds) {
- int methodNumId = intDecl.getMethodNumId(methodId);
- print(Integer.toString(methodNumId));
- // Check if this is the last element (don't print a comma)
- if (i != methodIds.size() - 1) {
- print(", ");
- }
- i++;
- }
- println(" };");
- println("private List<Integer> set" + newObjectId + "Allowed;");
- }
+ writePropertiesJavaPermission(callbackType, intDecl);
}
println("\n");
}
println("private static int objIdCnt = 0;");
println("private IoTRMICall rmiCall;");
}
- // Keep track of object Ids of all stubs registered to this interface
- Map<String,Set<String>> mapNewIntMethods = mapInt2NewInts.get(intface);
- for (Map.Entry<String,Set<String>> intMeth : mapNewIntMethods.entrySet()) {
- String newIntface = intMeth.getKey();
- int newObjectId = mapNewIntfaceObjId.get(newIntface);
- println("private final static int object" + newObjectId + "Id = " +
- newObjectId + ";\t//" + newIntface);
- Set<String> methodIds = intMeth.getValue();
- print("private static Integer[] object" + newObjectId + "Permission = { ");
- int i = 0;
- for (String methodId : methodIds) {
- int methodNumId = intDecl.getMethodNumId(methodId);
- print(Integer.toString(methodNumId));
- // Check if this is the last element (don't print a comma)
- if (i != methodIds.size() - 1) {
- print(", ");
- }
- i++;
- }
- println(" };");
- println("private List<Integer> set" + newObjectId + "Allowed;");
- }
+ writePropertiesJavaPermission(intface, intDecl);
println("\n");
}
}
+ /**
+ * HELPER: writePropertiesCplusStub() writes the properties of the stub class
+ */
+ private void writePropertiesCplusPermission(String intface) {
+
+ Map<String,Set<String>> mapNewIntMethods = mapInt2NewInts.get(intface);
+ for (Map.Entry<String,Set<String>> intMeth : mapNewIntMethods.entrySet()) {
+ String newIntface = intMeth.getKey();
+ int newObjectId = mapNewIntfaceObjId.get(newIntface);
+ println("const static int object" + newObjectId + "Id = " + newObjectId + ";");
+ println("const static set<int> set" + newObjectId + "Allowed;");
+ }
+ }
+
/**
* HELPER: writePropertiesCplusStub() writes the properties of the stub class
*/
println("vector<" + callbackType + "*> vecCallbackObj;");
println("static int objIdCnt;");
// Generate permission stuff for callback stubs
- Map<String,Set<String>> mapNewIntMethods = mapInt2NewInts.get(callbackType);
- for (Map.Entry<String,Set<String>> intMeth : mapNewIntMethods.entrySet()) {
- String newCallbackIntface = intMeth.getKey();
- int newObjectId = mapNewIntfaceObjId.get(newCallbackIntface);
- println("const static int object" + newObjectId + "Id = " + newObjectId + ";");
- println("const static set<int> set" + newObjectId + "Allowed;");
- }
+ writePropertiesCplusPermission(callbackType);
}
println("\n");
}
// TODO: Need to initialize address and ports if we want to have callback-in-callback
println("string address;");
println("vector<int> ports;\n");
- Map<String,Set<String>> mapNewIntMethods = mapInt2NewInts.get(callbackType);
- for (Map.Entry<String,Set<String>> intMeth : mapNewIntMethods.entrySet()) {
- String newCallbackIntface = intMeth.getKey();
- int newObjectId = mapNewIntfaceObjId.get(newCallbackIntface);
- println("const static int object" + newObjectId + "Id = " + newObjectId + ";");
- println("const static set<int> set" + newObjectId + "Allowed;");
- }
+ writePropertiesCplusPermission(callbackType);
}
println("\n");
}
}
println("IoTRMIObject *rmiObj;\n");
// Keep track of object Ids of all stubs registered to this interface
- Map<String,Set<String>> mapNewIntMethods = mapInt2NewInts.get(intface);
- for (Map.Entry<String,Set<String>> intMeth : mapNewIntMethods.entrySet()) {
- String newIntface = intMeth.getKey();
- int newObjectId = mapNewIntfaceObjId.get(newIntface);
- println("const static int object" + newObjectId + "Id = " + newObjectId + ";");
- println("const static set<int> set" + newObjectId + "Allowed;");
- }
+ writePropertiesCplusPermission(intface);
println("\n");
}