Package org.jacorb.orb

Examples of org.jacorb.orb.ParsedIOR


         components.addComponent (TAG_GROUP.value, out.getBufferCopy ());
         out.close ();

         if (sub != -1)
         {
            groupIIOPProfile = (IIOPProfile)new ParsedIOR (orb, "corbaloc:" +
                     corbalocStr.substring (sub + 1)).getEffectiveProfile ();

            objectKey = groupIIOPProfile.get_object_key ();
            TaggedProfile taggedProfile = groupIIOPProfile.asTaggedProfile ();
            components.addComponent (taggedProfile.tag, taggedProfile.profile_data);
         }

         uipmc.components = components.asArray ();
      }

      if (tagGroup == null)
      {
         if (logger.isDebugEnabled ())
         {
            logger.debug ("MIOPProfile inspecting uipmc components.");
         }

         components = new TaggedComponentList ();
         for (int i = 0; i < uipmc.components.length; i++)
         {
            TaggedComponent component = uipmc.components[i];
            components.addComponent (component);
            switch (component.tag)
            {
               case TAG_GROUP.value:
               {
                  if (logger.isDebugEnabled ())
                  {
                     logger.debug ("MIOPProfile inspecting tagGroup.");
                  }

                  CDRInputStream in2 = new CDRInputStream (orb, component.component_data);
                  in2.openEncapsulatedArray();
                  tagGroup = TagGroupTaggedComponentHelper.read (in2);
                  in2.close();
                  break;
               }
               case TAG_INTERNET_IOP.value:
               {
                  if (logger.isDebugEnabled ())
                  {
                     logger.debug ("MIOPProfile inspecting group iiop profile.");
                  }
                  IOR ior = new IOR ("IDL:omg.org/CORBA/Object:1.0",
                           new TaggedProfile[] { new TaggedProfile (component.tag,
                                    component.component_data) });

                  groupIIOPProfile = (IIOPProfile)new ParsedIOR (orb, ior).getEffectiveProfile ();
               }
            }
         }
      }
View Full Code Here


            }


           if( iorString.startsWith( "IOR:" ))
           {
              final ParsedIOR pior = new ParsedIOR(jorb, iorString );
              if (urlForm)
              {
                 out.println(CorbaLoc.parseKey(pior.get_object_key()));
              }
              else if (corbalocForm)
              {
                  out.println (printFullCorbalocIOR (orb, iorString));
              }
View Full Code Here

        return buffer.toString();
    }

    public static String generateCorbaloc (org.omg.CORBA.ORB orb, org.omg.CORBA.Object ref)
    {
        ParsedIOR pior = new ParsedIOR((org.jacorb.orb.ORB)orb, orb.object_to_string (ref));

        Profile profile = pior.getEffectiveProfile();

        if (profile instanceof IIOPProfile)
        {
            return createCorbalocForIIOPProfile ((IIOPProfile)profile);
        }
View Full Code Here

        return generateCorbalocForMultiIIOPProfiles (orb, orb.object_to_string (ref));
    }

    public static String generateCorbalocForMultiIIOPProfiles (org.omg.CORBA.ORB orb, String ref)
    {
        ParsedIOR pior = new ParsedIOR((org.jacorb.orb.ORB)orb, ref);

        String result = null;
        String object_key = null;
        Iterator<Profile> iterator;
        for (iterator = pior.getProfiles().iterator(); iterator.hasNext();)
        {
            Profile profile = iterator.next();

            if (profile instanceof IIOPProfile)
            {
View Full Code Here

        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 = (CDROutputStream) orb.create_output_stream();

                try
                {
                    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 ();
                }
                finally
                {
                    os.close();
                }
            }
        }

        pior = new ParsedIOR ((org.jacorb.orb.ORB)orb, ior);

        // Write out new IOR to file

        bw = new BufferedWriter (new OutputStreamWriter (new FileOutputStream (iorFile)));
        bw.write (pior.getIORString ());
        bw.close ();
    }
View Full Code Here

        server = BasicServerHelper.narrow( setup.getServerObject() );

        server.ping ();

        ParsedIOR p = new ParsedIOR (setup.getORB(), setup.getServerIOR());
        List<Profile> profiles = p.getProfiles();
        String host = ((IIOPAddress)((IIOPProfile)profiles.get(0)).getAddress()).getOriginalHost();
        assertTrue ("Host must not be blank", host.length () > 0);
    }
View Full Code Here

        server = BasicServerHelper.narrow( setup.getServerObject() );

        server.ping ();

        ParsedIOR p = new ParsedIOR (setup.getORB(), setup.getServerIOR());
        List<Profile> profiles = p.getProfiles();
        String host = ((IIOPAddress)((IIOPProfile)profiles.get(0)).getAddress()).getOriginalHost();
        assertTrue ("Host must not be blank", host.length () > 0);
    }
View Full Code Here

     * support negotiation.
     */
    @Test
    public void testDefaultCodeSets() throws Exception
    {
        ParsedIOR ior = new ParsedIOR( (ORB) orb, new IOR( "", new TaggedProfile[0] ) );
        ClientConnection connection = createClientConnection( 1, 0, ior );

        assertEquals( "Default codeSet", getORB().getTCSDefault().getId(), connection.getTCS().getId() );
        assertEquals( "Default wide codeset", UTF16_ID, connection.getTCSW().getId() );
    }
View Full Code Here

     * fails to offer any code sets.
     */
    @Test
    public void testNoCodeSetSpecified() throws Exception
    {
        ParsedIOR ior = new ParsedIOR( (ORB) orb, new IOR( "", new TaggedProfile[0] ) );

        ClientConnection connection = createClientConnection( 1, 1, ior );

        assertEquals( "Default codeSet", getORB().getTCSDefault().getId(), connection.getTCS().getId() );
        assertEquals( "Default wide codeset", UTF16_ID, connection.getTCSW().getId() );
View Full Code Here

     * Verifies that the connection can select the supported codesets in GIOP 1.1.
     */
    @Test
    public void testSelectingStandardCodeSetsFor1_1() throws Exception
    {
        ParsedIOR ior = createParsedIOR( ISO8859_1_ID, UTF16_ID );
        ClientConnection connection = createClientConnection( 1, 1, ior );

        assertEquals( "Selected codeSet", ISO8859_1_ID, connection.getTCS().getId() );
        assertEquals( "Selected wide codeset", UTF16_ID, connection.getTCSW().getId() );
    }
View Full Code Here

TOP

Related Classes of org.jacorb.orb.ParsedIOR

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.