Examples of CDROutputStream


Examples of org.jacorb.orb.CDROutputStream

    {
        checkDestroyed ();
        org.omg.CORBA.Any out_any = orb.create_any();
        out_any.type( type());

        final CDROutputStream out = new CDROutputStream(orb);

        try
        {
            if( type().kind().value() == org.omg.CORBA.TCKind._tk_except )
            {
                out.write_string( exceptionMsg );
            }

            for( int i = 0; i < members.length; i++)
            {
                out.write_value( members[i].value.type(),
                        members[i].value.create_input_stream());
            }

            final CDRInputStream in = new CDRInputStream(orb, out.getBufferCopy());
            try
            {
                out_any.read_value( in, type());
                return out_any;
            }
            finally
            {
                in.close();
            }
        }
        finally
        {
            out.close();
        }
    }
View Full Code Here

Examples of org.jacorb.orb.CDROutputStream

   {
      checkDestroyed();
      org.omg.CORBA.Any out_any = orb.create_any();
      out_any.type(type());

      final CDROutputStream out = new CDROutputStream(orb);
      try
      {
          out.write_long( length );

          for( int i = 0; i < length; i++)
          {
              out.write_value( elementType,
                      ((Any)members.get(i)).create_input_stream());
          }

          final CDRInputStream in = new CDRInputStream( orb, out.getBufferCopy());
          try
          {
              out_any.read_value(in, type());
              return out_any;
          }
          finally
          {
              in.close();
          }
      }
      finally
      {
          out.close();
      }
   }
View Full Code Here

Examples of org.jacorb.orb.CDROutputStream

     */
    public static byte[] toCDR(UtcT time)
    {
        // TODO: make this more efficient with mere bit shifting
        byte[] buffer = new byte[25];
        CDROutputStream out = new CDROutputStream(buffer);
        out.beginEncapsulatedArray();
        UtcTHelper.write(out, time);
        return out.getBufferCopy();
    }
View Full Code Here

Examples of org.jacorb.orb.CDROutputStream

    public abstract void write (CDROutputStream s);

    public byte [] toCDR ()
    {
        CDROutputStream out = new CDROutputStream();
        try
        {
            out.beginEncapsulatedArray();
            this.write(out);
            return out.getBufferCopy();
        }
        finally
        {
            out.close();
        }
    }
View Full Code Here

Examples of org.jacorb.orb.CDROutputStream

            // The CDROutputStream only does big endian currently.
            throw new BAD_PARAM("We can only marshal big endian stylee profiles !!");
        }

        // Start a CDR encapsulation for the profile_data
        CDROutputStream profileDataStream = new CDROutputStream();
        try
        {
            profileDataStream.beginEncapsulatedArray();

            // Write the opaque AddressProfile bytes for this profile...
            writeAddressProfile(profileDataStream);

            // ... then the object key
            profileDataStream.write_long(objectKey.length);
            profileDataStream.write_octet_array(objectKey,0,objectKey.length);

            switch( version.minor )
            {
                case 0 :
                    // For GIOP 1.0 there were no tagged components
                    break;
                default :
                    // Assume minor != 0 means 1.1 onwards and encode the TaggedComponents
                    if (compSeq == null)
                    {
                        compSeq = new TaggedComponentSeqHolder (new TaggedComponent[0]);
                    }
                // Write the length of the TaggedProfile sequence.
                profileDataStream.write_long(this.components.size() + compSeq.value.length);

                // Write the TaggedProfiles (ours first, then the ORB's)
                for (int i = 0; i < this.components.asArray().length; i++)
                {
                    TaggedComponentHelper.write(profileDataStream, this.components.asArray()[i]);
                }
                for (int i = 0; i < compSeq.value.length; i++)
                {
                    TaggedComponentHelper.write(profileDataStream, compSeq.value[i]);
                }
            }

            // Populate the TaggedProfile for return.
            tagged_profile.value = new TaggedProfile
            (
                    this.tag(),
                    profileDataStream.getBufferCopy()
            );
        }
        finally
        {
            profileDataStream.close();
        }
    }
View Full Code Here

Examples of org.jacorb.orb.CDROutputStream

            propname =
                "jacorb.security.ssl.corbaloc_ssliop.required_options";
            ssl.target_requires = get_ssl_options(propname);

            //create the tagged component containing the ssl struct
            final CDROutputStream out = new CDROutputStream();
            try
            {
                out.beginEncapsulatedArray();
                SSLHelper.write( out, ssl );

                // TAG_SSL_SEC_TRANS must be disambiguated in case OpenORB-generated
                // OMG classes are in the classpath.
                components.addComponent
                (new TaggedComponent( org.omg.SSLIOP.TAG_SSL_SEC_TRANS.value,
                        out.getBufferCopy() )
                );
            }
            finally
            {
                out.close();
            }
        }
    }
View Full Code Here

Examples of org.jacorb.orb.CDROutputStream

        String iorFile;
        String host;
        BufferedReader br;
        BufferedWriter bw;
        CDRInputStream is;
        CDROutputStream os;
        ParsedIOR pior;
        IOR ior;
        TaggedProfile[] profiles;
        ProfileBody_1_0 body10;
        ProfileBody_1_1 body11;
        short port;
        int iport;


        if (args.length != 3)
        {
            System.err.println ("Usage: fixior host port ior_file");
            System.exit( 1 );
        }
        host = args[0];

        // Read in IOR from file

        iorFile = args[2];
        br = new BufferedReader (new FileReader (iorFile));
        iorString = br.readLine();
        br.close ();

        if (iorString == null)
        {
            System.err.println("cannot read IOR from " + iorFile);
            System.exit(1);
        }

        if (!iorString.startsWith("IOR:"))
        {
            System.err.println ("IOR must be in the standard IOR URL format");
            System.exit (1);
        }

        iport = Integer.parseInt (args[1]);
        if (iport > 32767)
        {
           iport = iport - 65536;
        }
        port = (short) iport;

        orb = org.omg.CORBA.ORB.init (args, null);

        // Parse IOR

        pior = new ParsedIOR((ORB) orb, iorString);
        ior = pior.getIOR ();

        // Iterate through IIOP profiles setting host and port

        profiles = ior.profiles;
        for (int i = 0; i < profiles.length; i++)
        {
            if (profiles[i].tag == TAG_INTERNET_IOP.value)
            {
                is = new CDRInputStream (orb, profiles[i].profile_data);
                is.openEncapsulatedArray ();
                body10 = ProfileBody_1_0Helper.read (is);
                is.close ();

                os = new CDROutputStream ();
                os.beginEncapsulatedArray ();

                if (body10.iiop_version.minor > 0)
                {
                    is = new CDRInputStream (orb, profiles[i].profile_data);
                    is.openEncapsulatedArray ();
                    body11 = ProfileBody_1_1Helper.read (is);
                    is.close ();

                    body11.host = host;
                    body11.port = port;

                    ProfileBody_1_1Helper.write (os, body11);
                }
                else
                {
                    body10.host = host;
                    body10.port = port;

                    ProfileBody_1_0Helper.write (os, body10);
                }
                profiles[i].profile_data = os.getBufferCopy ();
                os.close();
            }
        }

        pior = new ParsedIOR ((org.jacorb.orb.ORB)orb, ior);
View Full Code Here

Examples of org.jacorb.orb.CDROutputStream

{
    private CDROutputStream objectUnderTest;

    protected void doSetUp() throws Exception
    {
        objectUnderTest = new CDROutputStream(orb);
    }
View Full Code Here

Examples of org.jacorb.orb.CDROutputStream

    }

    public static ServiceContext createCodesetContext( CodeSet tcs, CodeSet tcsw )
    {
        // encapsulate context
        final CDROutputStream os = new CDROutputStream();
        try
        {
            os.beginEncapsulatedArray();
            CodeSetContextHelper.write( os, new CodeSetContext( tcs.getId(), tcsw.getId() ));

            return new ServiceContext( TAG_CODE_SETS.value, os.getBufferCopy() );
        }
        finally
        {
            os.close();
        }
    }
View Full Code Here

Examples of org.jacorb.orb.CDROutputStream

    public void write_to(GIOPConnection conn) throws IOException
    {
        if (!conn.isTCSNegotiated())
        {
            // encapsulate context
            CDROutputStream os = new CDROutputStream();
            os.beginEncapsulatedArray();
            CodeSetContextHelper.write
            (
                os,
                new CodeSetContext(conn.getTCS(), conn.getTCSW())
            );
            addServiceContext(new ServiceContext
            (
                org.omg.IOP.CodeSets.value,
                os.getBufferCopy()
            ));
            conn.markTCSNegotiated();
        }
        super.write_to(conn);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.