X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;ds=inline;f=iotjava%2Fiotpolicy%2FIoTCompiler.java;h=a5a6781293882ba2fdf854085b8f8b6b87abd466;hb=3ae46e02f3f8acc1e4fd279d9194f1f032452e75;hp=c0e932a7d0a42355ceec45759ef3f6f072e69fae;hpb=b398fced7262712afbb56221552a4030999f142c;p=iot2.git diff --git a/iotjava/iotpolicy/IoTCompiler.java b/iotjava/iotpolicy/IoTCompiler.java index c0e932a..a5a6781 100644 --- a/iotjava/iotpolicy/IoTCompiler.java +++ b/iotjava/iotpolicy/IoTCompiler.java @@ -999,84 +999,6 @@ public class IoTCompiler { } -/* private void writeCallbackMethodBodyJavaStub(InterfaceDecl intDecl, List methParams, - List methPrmTypes, String method, String callbackType) { - - println("try {"); - // Check if this is single object, array, or list of objects - for (int i = 0; i < methParams.size(); i++) { - String paramType = methPrmTypes.get(i); - if (checkCallbackType(paramType, callbackType)) { // Check if this has callback object - String param = methParams.get(i); - if (isArrayOrList(paramType, param)) { // Generate loop - println("for (" + getGenericType(paramType) + " cb : " + getSimpleIdentifier(param) + ") {"); - println(callbackType + "_CallbackSkeleton skel" + i + " = new " + callbackType + "_CallbackSkeleton(cb, objIdCnt++);"); - } else - println(callbackType + "_CallbackSkeleton skel" + i + " = new " + callbackType + "_CallbackSkeleton(" + - getSimpleIdentifier(param) + ", objIdCnt++);"); - println("listCallbackObj.add(skel" + i + ");"); - if (isArrayOrList(paramType, param)) - println("}"); - } - } - print("}"); - println(" catch (Exception ex) {"); - println("ex.printStackTrace();"); - println("throw new Error(\"Exception when generating skeleton objects!\");"); - println("}\n"); - println("int methodId = " + intDecl.getMethodNumId(method) + ";"); - String retType = intDecl.getMethodType(method); - println("Class retType = " + getSimpleType(getEnumType(retType)) + ".class;"); - // Generate array of parameter types - print("Class[] paramCls = new Class[] { "); - for (int i = 0; i < methParams.size(); i++) { - String paramType = methPrmTypes.get(i); - if (checkCallbackType(paramType, callbackType)) { // Check if this has callback object - print("int.class"); - } else { // Generate normal classes if it's not a callback object - String prmType = checkAndGetArray(methPrmTypes.get(i), methParams.get(i)); - print(getSimpleType(prmType) + ".class"); - } - if (i != methParams.size() - 1) // Check if this is the last element - print(", "); - } - println(" };"); - // Generate array of parameter objects - print("Object[] paramObj = new Object[] { "); - for (int i = 0; i < methParams.size(); i++) { - String paramType = methPrmTypes.get(i); - if (checkCallbackType(paramType, callbackType)) { // Check if this has callback object - //if (isArray(methPrmTypes.get(i), methParams.get(i))) - if (isArray(methParams.get(i))) - print(getSimpleIdentifier(methParams.get(i)) + ".length"); - else if (isList(methPrmTypes.get(i))) - print(getSimpleIdentifier(methParams.get(i)) + ".size()"); - else - print("new Integer(1)"); - } else - print(getSimpleIdentifier(methParams.get(i))); - if (i != methParams.size() - 1) - print(", "); - } - println(" };"); - // Check if this is "void" - if (retType.equals("void")) { - println("rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);"); - } else { // We do have a return value - // Check if the return value NONPRIMITIVES - if (getParamCategory(retType) == ParamCategory.NONPRIMITIVES) { - String[] retGenValType = getTypeOfGeneric(retType); - println("Class retGenValType = " + retGenValType[0] + ".class;"); - println("Object retObj = rmiCall.remoteCall(objectId, methodId, retType, retGenValType, paramCls, paramObj);"); - println("return (" + retType + ")retObj;"); - } else { - println("Object retObj = rmiCall.remoteCall(objectId, methodId, retType, null, paramCls, paramObj);"); - println("return (" + retType + ")retObj;"); - } - } - }*/ - - /** * HELPER: writeMethodJavaStub() writes the methods of the stub class */