Package com.sun.tools.corba.se.idl

Examples of com.sun.tools.corba.se.idl.StringEntry


      SymtabEntry parmType = Util.typeOf (parm.type ());
      if (parmType instanceof StringEntry)
        if ((parm.passType () == ParameterEntry.In) ||
            (parm.passType () == ParameterEntry.Inout))
        {
          StringEntry string = (StringEntry)parmType;
          if (string.maxSize () != null)
          {
            stream.print (THREE_INDENT + "if (" + parm.name ());
            if (parm.passType () == ParameterEntry.Inout)
              stream.print (".value"); // get from holder
            stream.print (" == null || " + parm.name ());
            if (parm.passType () == ParameterEntry.Inout)
              stream.print (".value"); // get from holder
            stream.println (".length () > (" +
                Util.parseExpression (string.maxSize ()) + "))");
            stream.println (THREE_INDENT +
                "throw new org.omg.CORBA.BAD_PARAM (0," +
                " org.omg.CORBA.CompletionStatus.COMPLETED_NO);");
          }
        }
    }
    // end <d56554> in/inout string bounds check

    // Step 2  Load the parameters into the outputStream
    parms = m.parameters ().elements ();
    while (parms.hasMoreElements ())
    {
      ParameterEntry parm = (ParameterEntry)parms.nextElement ();
      if (parm.passType () == ParameterEntry.In)
        writeOutputStreamWrite(FOUR_INDENT, "$out", parm.name (), parm.type (),
            stream);
      else if (parm.passType () == ParameterEntry.Inout)
        writeOutputStreamWrite(FOUR_INDENT, "$out", parm.name () + ".value",
            parm.type (), stream);
    }

    // Step 2a.  Write the context parameter if necessary. <d59560>
    if (m.contexts ().size () > 0)
    {
      stream.println(FOUR_INDENT + "org.omg.CORBA.ContextList $contextList =" +
         "_orb ().create_context_list ();");

      for (int cnt = 0; cnt < m.contexts ().size (); cnt++)
      {
          stream.println(FOUR_INDENT +
             "$contextList.add (\"" + m.contexts (). elementAt (cnt) + "\");");
      }
      stream.println(FOUR_INDENT +
          "$out.write_Context ($context, $contextList);");
    }

    // Step 3 Invoke the method with the output stream
    stream.println (FOUR_INDENT + "$in = _invoke ($out);");

    SymtabEntry mtype = m.type ();
    if (mtype != null)
      Util.writeInitializer (FOUR_INDENT, "$result", "", mtype,
          writeInputStreamRead ("$in", mtype), stream);

    // Step 4  Read the inout/out values
    parms = m.parameters ().elements ();
    while (parms.hasMoreElements ())
    {
      ParameterEntry parm = (ParameterEntry)parms.nextElement ();
      if (parm.passType () != ParameterEntry.In)
      {
        if (parm.type () instanceof ValueBoxEntry)
        {
          ValueBoxEntry v = (ValueBoxEntry) parm.type ();
          TypedefEntry member =
              ((InterfaceState) v.state ().elementAt (0)).entry;
          SymtabEntry mType = member.type ();
          if (mType instanceof PrimitiveEntry)
            stream.println(FOUR_INDENT +  parm.name () +
                ".value = (" + writeInputStreamRead ("$in", parm.type ()) +
                ").value;");
          else
            stream.println(FOUR_INDENT +  parm.name () +
                ".value = " + writeInputStreamRead ("$in", parm.type ()) +";");
        }
        else
          stream.println (FOUR_INDENT +  parm.name () + ".value = " +
              writeInputStreamRead ("$in", parm.type ()) + ";");
      }
    }
    // Step 4.b.  Check string bounds <d56554 - klr>
    // begin <d56554> out/inout/return string bounds check
    parms = m.parameters ().elements ();
    while (parms.hasMoreElements ())
    {
      ParameterEntry parm = (ParameterEntry)parms.nextElement ();
      SymtabEntry parmType = Util.typeOf (parm.type ());
      if (parmType instanceof StringEntry)
        if ((parm.passType () == ParameterEntry.Out) ||
            (parm.passType () == ParameterEntry.Inout))
        {
          StringEntry string = (StringEntry)parmType;
          if (string.maxSize () != null)
          {
            stream.print (FOUR_INDENT + "if (" + parm.name () +
                ".value.length ()");
            stream.println ("         > (" +
                Util.parseExpression (string.maxSize ()) + "))");
            stream.println (FIVE_INDENT + "throw new org.omg.CORBA.MARSHAL(0,"+
                "org.omg.CORBA.CompletionStatus.COMPLETED_NO);");
          }
        }
    }
    if (mtype instanceof StringEntry)
    {
      StringEntry string = (StringEntry)mtype;
      if (string.maxSize () != null)
      {
        stream.println(FOUR_INDENT + "if ($result.length () > (" +
            Util.parseExpression (string.maxSize ()) + "))");
        stream.println (FIVE_INDENT + "throw new org.omg.CORBA.MARSHAL (0," +
            " org.omg.CORBA.CompletionStatus.COMPLETED_NO);");
      }
    }
    // end <d56554> out/inout/return string bounds check
View Full Code Here


      else
        stream.println (indent + name + " (org.omg.CORBA.ORB.init ().get_primitive_tc (org.omg.CORBA.TCKind.tk_" + type.name () + "));");
    }
    else if (type instanceof StringEntry)
    {
      StringEntry s = (StringEntry)type;
      Expression e  = s.maxSize ();
      if (e == null)
        stream.println (indent + name + " (org.omg.CORBA.ORB.init ().create_" + type.name () + "_tc (" + Util.parseExpression (e) + "));");
     else
        stream.println (indent + name + " (org.omg.CORBA.ORB.init ().create_" + type.name () + "_tc (0));");
    }
View Full Code Here

    return type(index, indent, tcoffsets, name, entry, stream);
  } // helperType

  public int type (int index, String indent, TCOffsets tcoffsets, String name, SymtabEntry entry, PrintWriter stream) {
    tcoffsets.set (entry);
    StringEntry stringEntry = (StringEntry)entry;
    String bound;
    if (stringEntry.maxSize () == null)
      bound = "0";
    else
      bound = Util.parseExpression (stringEntry.maxSize ());

    // entry.name() is necessary to determine whether it is a
    // string or wstring

    stream.println (indent
View Full Code Here

  {
  } // helperWrite

  public int read (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
  {
    StringEntry string = (StringEntry)entry;
    String entryName = entry.name ();
    if (entryName.equals ("string"))
      stream.println (indent + name + " = istream.read_string ();");
    else if (entryName.equals ("wstring"))
      stream.println (indent + name + " = istream.read_wstring ();");
    if (string.maxSize () != null)
    {
      stream.println (indent + "if (" + name + ".length () > (" + Util.parseExpression (string.maxSize ()) + "))");
      stream.println (indent + "  throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);");
    }
    return index;
  } // read
View Full Code Here

    return index;
  } // read

  public int write (int index, String indent, String name, SymtabEntry entry, PrintWriter stream)
  {
    StringEntry string = (StringEntry)entry;
    if (string.maxSize () != null)
    {
      stream.print (indent + "if (" + name + ".length () > (" + Util.parseExpression (string.maxSize ()) + "))");
      stream.println (indent + "  throw new org.omg.CORBA.MARSHAL (0, org.omg.CORBA.CompletionStatus.COMPLETED_MAYBE);");
    }
    String entryName = entry.name ();
    if (entryName.equals ("string"))
      stream.println (indent + "ostream.write_string (" + name + ");");
View Full Code Here

TOP

Related Classes of com.sun.tools.corba.se.idl.StringEntry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.