for (Map.Entry<String,Set<String>> intMeth : mapNewIntMethods.entrySet()) {
String newIntface = intMeth.getKey();
int newObjectId = getNewIntfaceObjectId(newIntface);
- println("set" + newObjectId + "Allowed = Arrays.asList(object" + newObjectId +"Permission);");
+ println("set" + newObjectId + "Allowed = new ArrayList<Integer>(Arrays.asList(object" + newObjectId +"Permission));");
}
}
/**
* HELPER: writeCplusInitCallbackPermission() writes the permission for callback
*/
- private void writeCplusInitCallbackPermission(String intface, InterfaceDecl intDecl) {
+ private void writeCplusInitCallbackPermission(String intface, InterfaceDecl intDecl, boolean callbackExist) {
- String method = "___initCallBack()";
- int methodNumId = intDecl.getHelperMethodNumId(method);
- Map<String,Set<String>> mapNewIntMethods = mapInt2NewInts.get(intface);
- for (Map.Entry<String,Set<String>> intMeth : mapNewIntMethods.entrySet()) {
- String newIntface = intMeth.getKey();
- int newObjectId = getNewIntfaceObjectId(newIntface);
- println("set" + newObjectId + "Allowed.insert(" + methodNumId + ");");
+ if (callbackExist) {
+ String method = "___initCallBack()";
+ int methodNumId = intDecl.getHelperMethodNumId(method);
+ Map<String,Set<String>> mapNewIntMethods = mapInt2NewInts.get(intface);
+ for (Map.Entry<String,Set<String>> intMeth : mapNewIntMethods.entrySet()) {
+ String newIntface = intMeth.getKey();
+ int newObjectId = getNewIntfaceObjectId(newIntface);
+ println("set" + newObjectId + "Allowed.insert(" + methodNumId + ");");
+ }
}
}
println("bool _bResult = false;");
println("mainObj = _mainObj;");
println("rmiObj = new IoTRMIObject(_port, &_bResult);");
- writeCplusInitCallbackPermission(intface, intDecl);
+ writeCplusInitCallbackPermission(intface, intDecl, callbackExist);
writeStructPermissionCplusSkeleton(methods, intDecl, intface);
println("___waitRequestInvokeMethod();");
println("}\n");