}
+ /**
+ * HELPER: writeConstructorJavaPermission() writes the permission in constructor
+ */
+ private void writeConstructorJavaPermission(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("set" + newObjectId + "Allowed = Arrays.asList(object" + newObjectId +"Permission);");
+ }
+ }
+
+
/**
* HELPER: writeConstructorJavaStub() writes the constructor of the stub class
*/
if (callbackExist) {
Iterator it = callbackClasses.iterator();
String callbackType = (String) it.next();
- 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("set" + newObjectId + "Allowed = Arrays.asList(object" + newObjectId +"Permission);");
- }
+ writeConstructorJavaPermission(intface);
println("listCallbackObj = new ArrayList<" + callbackType + ">();");
println("___initCallBack();");
}
if (callbackExist) {
Iterator it = callbackClasses.iterator();
String callbackType = (String) it.next();
- 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("set" + newObjectId + "Allowed = Arrays.asList(object" + newObjectId +"Permission);");
- }
+ writeConstructorJavaPermission(intface);
println("listCallbackObj = new ArrayList<" + callbackType + ">();");
println("___initCallBack();");
println("// TODO: Add address and port initialization here if we want callback in callback!");
println("mainObj = _mainObj;");
println("rmiObj = new IoTRMIObject(_port);");
// Generate permission control initialization
- 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("set" + newObjectId + "Allowed = Arrays.asList(object" + newObjectId +"Permission);");
- }
+ writeConstructorJavaPermission(intface);
println("___waitRequestInvokeMethod();");
println("}\n");
}