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

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


  /**
   *
   **/
  protected void setupForSetMethod ()
  {
    ParameterEntry parm = Compile.compiler.factory.parameterEntry ();
    parm.type (m.type ());
    parm.name ("new" + Util.capitalize (m.name ()));
    m.parameters ().addElement (parm);
    realType = m.type ();
    m.type (null);
  } // setupForSetMethod
View Full Code Here


        // Look through parameters
        Enumeration parms = m.parameters ().elements ();
        while (parms.hasMoreElements ())
        {
          ParameterEntry parm = (ParameterEntry)parms.nextElement ();
          SymtabEntry parmType = typeOf (parm.type ());
          if (importTypes.contains (parmType))
          {
            // <d59771> Helper needed in stubs.
            if (type == StubFile)
              addTo (importList, parmType.name () + "Helper");
            if (parm.passType () == ParameterEntry.In)
              addTo (importList, parmType.name ());
            else
              addTo (importList, parmType.name () + "Holder");
          }
          checkForArrays (parmType, importTypes, importList);
View Full Code Here

    {
      if (firstTime)
        firstTime = false;
      else
        stream.print (", ");
      ParameterEntry parm = (ParameterEntry)e.nextElement ();
      if (listTypes) {
        writeParmType (parm.type (), parm.passType ());
        stream.print (' ');
      }
      // Print parm name
      stream.print (parm.name ());
      // end of parameter list
    }
  }
View Full Code Here

    {
      if (firstTime)
        firstTime = false;
      else
        stream.print (", ");
      ParameterEntry parm = (ParameterEntry)e.nextElement ();

      writeParmType (parm.type (), parm.passType ());

      // Print parm name
      stream.print (' ' + parm.name ());
    }

    // Step 2.  Add the context parameter if necessary.
    if (m.contexts ().size () > 0)
    {
View Full Code Here

        } else {
            stream.print(FOUR_INDENT + "$result = _self." +
                     methodName + "( " );
        }
        while (parms.hasMoreElements ()) {
            ParameterEntry param = (ParameterEntry)parms.nextElement ();
            if( parms.hasMoreElements( ) ) {
                stream.print( " " + param.name() "," );
            } else  {
                stream.print( " " + param.name() );
            }
        }
        stream.print( ");" );
        stream.println( " " );
        if( voidReturnType ) {
View Full Code Here

        {
          if (firstTime)
            firstTime = false;
          else
            stream.print (", ");
          ParameterEntry parm = (ParameterEntry)e.nextElement ();
          stream.print (parm.name ());
        }
        // Step 2.  Add the context parameter if necessary. <d59297>
        if (m.contexts ().size () > 0)
        {
          if (!firstTime)
View Full Code Here

    // Load the parameters
    Enumeration parms = m.parameters ().elements ();
    boolean first = true;
    while (parms.hasMoreElements ())
    {
      ParameterEntry parm = (ParameterEntry)parms.nextElement ();
      if (first)
        first = false;
      else
        stream.print (", ");
      stream.print (parm.name ());
    }
    if (m.contexts ().size () != 0)
    {
      if (!first)
        stream.print (", ");
View Full Code Here

    {
      if (firstTime)
        firstTime = false;
      else
        stream.print (", ");
      ParameterEntry parm = (ParameterEntry)e.nextElement ();

      writeParmType (parm.type (), parm.passType ());

      // Print parm name
      stream.print (' ' + parm.name ());
    }

    // Step 2.  Add the context parameter if necessary.
    if (m.contexts ().size () > 0)
    {
View Full Code Here

    SymtabEntry mtype = Util.typeOf (m.type ());
    Enumeration parms = m.parameters ().elements ();
    parms = m.parameters ().elements ();
    while (parms.hasMoreElements ())
    {
      ParameterEntry parm     = (ParameterEntry) parms.nextElement ();
      String         name     = parm.name ();
      String         anyName  = '_' + name;
      SymtabEntry    type     = parm.type ();
      int            passType = parm.passType ();

      if (passType == ParameterEntry.In)
        Util.writeInitializer (indent, name, "", type, writeInputStreamRead ("in", type), stream);

      else // the parm is a holder
      {
        String holderName = Util.holderName (type);
        stream.println (indent + holderName + ' ' + name + " = new " + holderName + " ();");
        if (passType == ParameterEntry.Inout)
        {
          if (type instanceof ValueBoxEntry)
          {
            ValueBoxEntry v = (ValueBoxEntry) type;
            TypedefEntry member = ((InterfaceState) v.state ().elementAt (0)).entry;
            SymtabEntry mType = member.type ();
            if (mType instanceof PrimitiveEntry)
              stream.println (indent + name + ".value = (" + writeInputStreamRead ("in", parm.type ()) + ").value;");
            else
              stream.println (indent + name + ".value = " + writeInputStreamRead ("in", parm.type ()) + ";");
          }
          else
            stream.println (indent +  name  + ".value = " + writeInputStreamRead ("in", parm.type ()) + ";");
        }
      }
    }

    // Step 1a.  Read the context parameter if necessary. <d59560>
    if (m.contexts ().size () > 0)
    {
      stream.println (indent + "org.omg.CORBA.Context $context = in.read_Context ();");
    }

    // Step 2 Load return if necessary
    if (mtype != null)
      Util.writeInitializer (indent, "$result", "", mtype, stream);

    // Step 3 Call the method with the list of parameters
    writeMethodCall (indent);

    parms = m.parameters ().elements ();
    boolean firstTime = true;
    while (parms.hasMoreElements ())
    {
      ParameterEntry parm = (ParameterEntry)parms.nextElement ();
      if (firstTime)
        firstTime = false;
      else
        stream.print (", ");
      stream.print (parm.name ());
    }

    // Step 3a.  Add the context parameter if necessary. <d59560>
    if (m.contexts ().size () > 0)
    {
      if (!firstTime)
        stream.print (", ");
      stream.print ("$context");
    }

    stream.println (");");

    //Step 3b. Create reply;
    writeCreateReply (indent);

    // Step 4 Write method's result to the output stream
    if (mtype != null)
    {
      writeOutputStreamWrite (indent, "out", "$result", mtype, stream);
    }

    // Step 5 Write inout/out value to the output stream
    parms = m.parameters ().elements ();
    while (parms.hasMoreElements ())
    {
      ParameterEntry parm = (ParameterEntry)parms.nextElement ();
      int passType = parm.passType ();
      if (passType != ParameterEntry.In)
      {
        writeOutputStreamWrite (indent, "out", parm.name () + ".value", parm.type (), stream);
      }
    }

    // Step 6 Handle exception
    if (m.exceptions ().size () > 0)
View Full Code Here

    // Step 1.b.  Check string bounds <d56554 - klr>
    // begin <d56554> in/inout string bounds check
    Enumeration 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.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

    // Step 5  Handle return if necessary
    if (mtype != null) {
      stream.println(FOUR_INDENT + "return $result;");
    } else {
      stream.println(FOUR_INDENT + "return;");
    }

    // Step 6  Handle exceptions
    stream.println(THREE_INDENT +
        "} catch (org.omg.CORBA.portable.ApplicationException " + "$ex) {");
    stream.println(FOUR_INDENT + "$in = $ex.getInputStream ();");
    stream.println(FOUR_INDENT + "String _id = $ex.getId ();");

    if (m.exceptions ().size () > 0)
    {
      Enumeration exceptions = m.exceptions ().elements ();
      boolean firstExc = true;
      while (exceptions.hasMoreElements ())
      {
        ExceptionEntry exc = (ExceptionEntry)exceptions.nextElement ();
        if (firstExc)
        {
          stream.print(FOUR_INDENT + "if ");
          firstExc = false;
        }
        else
          stream.print(FOUR_INDENT + "else if ");

        stream.println( "(_id.equals (\"" + exc.repositoryID ().ID () + "\"))");
        stream.println (FIVE_INDENT + "throw " +
            Util.helperName ((SymtabEntry)exc, false) + ".read ($in);");
      }
      stream.println(FOUR_INDENT + "else");
      stream.println(FIVE_INDENT + "throw new org.omg.CORBA.MARSHAL (_id);");
    }
    else
      stream.println(FOUR_INDENT + "throw new org.omg.CORBA.MARSHAL (_id);");

    stream.println(THREE_INDENT +
        "} catch (org.omg.CORBA.portable.RemarshalException $rm) {");
    stream.print( FOUR_INDENT );
    if (m.type () != null) // not a void method
      stream.print ("return ");
    stream.print (m.name () + " (");
    {
      // write parm names
      boolean firstTime = true;
      Enumeration e = m.parameters ().elements ();
      while (e.hasMoreElements ())
      {
        if (firstTime)
          firstTime = false;
        else
          stream.print (", ");
        ParameterEntry parm = (ParameterEntry)e.nextElement ();
        stream.print (parm.name ());
      }
      // Step 2.  Add the context parameter if necessary. <d59297>
      if (m.contexts ().size () > 0)
      {
        if (!firstTime)
View Full Code Here

TOP

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

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.