public void printInvocation(PrintWriter ps) { if (!raisesExpr.empty()) { ps.println("\t\t\ttry"); ps.println("\t\t\t{"); } /* read args */ int argc = 0; if (parser.hasObjectCachePlugin()) { parser.getObjectCachePlugin().printPreParamRead(ps, paramDecls); } for (Enumeration e = paramDecls.elements(); e.hasMoreElements(); ) { ParamDecl p = (ParamDecl) e.nextElement(); TypeSpec ts = p.paramTypeSpec.typeSpec(); boolean is_wstring = ((ts instanceof StringType) && (((StringType) ts).isWide())); boolean is_wchar = ((ts instanceof CharType) && (((CharType) ts).isWide())); if (p.paramAttribute == ParamDecl.MODE_IN) { ps.println( "\t\t\t\t" + ts.toString() + " _arg" + (argc++) + "=" + ts.printReadExpression("_input") + ";"); } else { ps.println( "\t\t\t\t" + ts.holderName() + " _arg" + (argc++) + "= new " + ts.holderName() + "();"); if (p.paramAttribute == ParamDecl.MODE_INOUT) { // wchars and wstrings are contained in CharHolder and // StringHolder and so cannot be inserted via _read operation // on holder. Instead value of holder needs to be set directly // from correct type explicitly read from stream. if (is_wchar) { ps.println("\t\t\t\t_arg" + (argc - 1) + ".value = _input.read_wchar ();"); } else if (is_wstring) { ps.println("\t\t\t\t_arg" + (argc - 1) + ".value = _input.read_wstring ();"); } else { ps.println("\t\t\t\t_arg" + (argc - 1) + "._read (_input);"); } } } } if (parser.hasObjectCachePlugin()) { parser.getObjectCachePlugin().printPostParamRead(ps, paramDecls); } boolean complex = (opTypeSpec.typeSpec() instanceof ArrayTypeSpec) || (opTypeSpec.typeSpec() instanceof FixedPointType); String write_str = null, write_str_prefix = null, write_str_suffix = null; // if( (!(opTypeSpec.typeSpec() instanceof VoidTypeSpec )) || holders ) // { ps.println("\t\t\t\t_out = handler.createReply();"); if (!(opTypeSpec.typeSpec() instanceof VoidTypeSpec) && !complex) { write_str = opTypeSpec.typeSpec().printWriteStatement("**", "_out"); int index = write_str.indexOf("**"); write_str_prefix = write_str.substring(0, index); write_str_suffix = write_str.substring(index + 2); ps.print("\t\t\t\t" + write_str_prefix); } else ps.print("\t\t\t\t"); // } if (complex) ps.print(opTypeSpec.typeSpec().typeName() + " _result = "); ps.print(name + "("); for (int i = 0; i < argc; i++) { ps.print("_arg" + i); if (i < argc - 1) ps.print(","); } /* Enumeration e = paramDecls.elements(); if(e.hasMoreElements()) { TypeSpec ts = ((ParamDecl)e.nextElement()).paramTypeSpec; ps.print(ts.printReadExpression("input")); } for(; e.hasMoreElements();) { TypeSpec ts = ((ParamDecl)e.nextElement()).paramTypeSpec; ps.print("," + ts.printReadExpression("input")); } */ if (!(opTypeSpec.typeSpec() instanceof VoidTypeSpec)) ps.print(")"); if (!complex) { if (opTypeSpec.typeSpec() instanceof VoidTypeSpec) ps.println(");"); else ps.println(write_str_suffix); } else { ps.println(";"); ps.println(opTypeSpec.typeSpec().printWriteStatement("_result", "_out")); } /* write holder values */ argc = 0; for (Enumeration e = paramDecls.elements(); e.hasMoreElements(); ) { ParamDecl p = (ParamDecl) e.nextElement(); if (p.paramAttribute != ParamDecl.MODE_IN) { ps.println("\t\t\t\t" + p.printWriteStatement(("_arg" + (argc)), "_out")); } argc++; } if (parser.hasObjectCachePlugin()) { parser.getObjectCachePlugin().printSkeletonCheckin(ps, paramDecls, "_arg"); } if (!raisesExpr.empty()) { ps.println("\t\t\t}"); String[] excepts = raisesExpr.getExceptionNames(); String[] classNames = raisesExpr.getExceptionClassNames(); for (int i = 0; i < excepts.length; i++) { ps.println("\t\t\tcatch(" + excepts[i] + " _ex" + i + ")"); ps.println("\t\t\t{"); ps.println("\t\t\t\t_out = handler.createExceptionReply();"); ps.println("\t\t\t\t" + classNames[i] + "Helper.write(_out, _ex" + i + ");"); if (parser.generatedHelperPortability == parser.HELPER_JACORB) { ps.println( "\t\t\t\tif (handler instanceof org.jacorb.orb.dsi.ServerRequest && !" + classNames[i] + "Helper.id().equals(_ex" + i + ".getMessage()))"); ps.println("\t\t\t\t{"); ps.println( "\t\t\t\t\t((org.jacorb.orb.giop.ReplyOutputStream)_out).addServiceContext (org.jacorb.orb.dsi.ServerRequest.createExceptionDetailMessage (_ex" + i + ".getMessage()));"); ps.println("\t\t\t\t}"); } ps.println("\t\t\t}"); } } }