Package org.jacorb.orb

Examples of org.jacorb.orb.ParsedIOR


        PrintWriter out = new PrintWriter(System.out, true);

        if( iorString.startsWith( "IOR:" ))
        {
            ParsedIOR pior = new ParsedIOR(jorb, iorString );
            printIOR(pior, out);
        }
        else
        {
            out.println("Sorry, we only unparse IORs in the standard IOR URL scheme");
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 = 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);

        // Write out new IOR to file

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

     * this we create a ParsedIOR with the known IOR and test that the number
     * of profile bodies is greater than zero.
     */
    public void testDecode1 ()
    {
        ParsedIOR pior = new ParsedIOR( ior, orb, loggerMock);

        List bodies = pior.getProfiles();

        assertNotNull("did not get bodies", bodies);
        assertTrue("did not get bodies", bodies.size() > 0);
    }
View Full Code Here

       // try to get ORB delegate to object
       org.jacorb.orb.Delegate jacOrbDelegate = null;
       Delegate localObj = ((org.omg.CORBA.portable.ObjectImpl)obj)._get_delegate();
       jacOrbDelegate = (org.jacorb.orb.Delegate)localObj;

       ParsedIOR pior = jacOrbDelegate.getParsedIOR();
       org.omg.IOP.IOR ior = jacOrbDelegate.getIOR();

       TaggedProfile[] profiles = ior.profiles;
       int nrOfIOPProf = 0;
       for (int i = 0; i < profiles.length; i++)
View Full Code Here

        // create the object reference
        poa.activate_object_with_id("Object".getBytes(), new BasicServerImpl());
        org.omg.CORBA.Object obj = poa.id_to_reference( "Object".getBytes() );

        ParsedIOR pior = new ParsedIOR( orb.object_to_string(obj), orb, loggerMock);

        assertTrue
        (
                CorbaLoc.parseKey( pior.get_object_key()).indexOf
                (props.getProperty("jacorb.implname")) == -1
        );
    }
View Full Code Here

        // create the object reference
        poa.activate_object_with_id("Object".getBytes(), new BasicServerImpl());
        org.omg.CORBA.Object obj = poa.id_to_reference( "Object".getBytes() );

        ParsedIOR pior = new ParsedIOR( orb.object_to_string(obj), orb, loggerMock);

        assertTrue
        (
                CorbaLoc.parseKey( pior.get_object_key()).indexOf
                (props.getProperty("jacorb.implname")) != -1
        );
    }
View Full Code Here

        // create the object reference
        poa.activate_object_with_id("Object".getBytes(), new BasicServerImpl());
        org.omg.CORBA.Object obj = poa.id_to_reference( "Object".getBytes() );

        ParsedIOR pior = new ParsedIOR( orb1.object_to_string(obj), orb1, loggerMock);


        // Now create number two.

        orb2 = newORB(props);

        rootPoa = (POAHelper.narrow( orb2.resolve_initial_references( "RootPOA" )));

        // Create a child POA
        poa = rootPoa.create_POA
        (
                "TestServerPOA",
                rootPoa.the_POAManager(),
                new Policy[]
                           {
                    rootPoa.create_lifespan_policy( LifespanPolicyValue.TRANSIENT),
                    rootPoa.create_id_assignment_policy( IdAssignmentPolicyValue.USER_ID)
                           }
        );

        poa.the_POAManager().activate();

        // create the object reference
        poa.activate_object_with_id("Object".getBytes(), new BasicServerImpl());
        obj = poa.id_to_reference( "Object".getBytes() );

        ParsedIOR pior2 = new ParsedIOR( orb2.object_to_string(obj), orb1, loggerMock);

        assertTrue
        (
                ! (CorbaLoc.parseKey( pior.get_object_key()).equals
                        (CorbaLoc.parseKey( pior2.get_object_key())))
        );
    }
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.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);

        Logger logger =
            ((org.jacorb.orb.ORB)orb).getConfiguration().getNamedLogger("jacorb.fixior");

        // Parse IOR

        pior = new ParsedIOR(iorString, orb, logger);
        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 ();
            }
        }

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

        // Write out new IOR to file

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

            );
        }

        if( iorString.startsWith( "IOR:" ))
        {
            ParsedIOR pior = new ParsedIOR( iorString, orb, logger );
            printIOR(pior, orb);
        }
        else
        {
            System.out.println("Sorry, we only unparse IORs in the standard IOR URL scheme");
View Full Code Here

                // OBJECT_NOT_EXIST exceptions which they might get
                // when trying to contact the server too early.

                org.omg.CORBA.Object _object =
                    orb.string_to_object(
                        (new ParsedIOR( (org.jacorb.orb.ORB) orb, _ior)).getIORString());

                // Sort of busy waiting here, no other way possible
                for( int _i = 0; _i < object_activation_retries; _i++ )
                {
                    try
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.