Package org.omg.PortableServer

Examples of org.omg.PortableServer.POAManager


        //init POA
        POA poa =
        POAHelper.narrow( orb.resolve_initial_references( "RootPOA" ));

        POAManager poa_manager = poa.the_POAManager();

        // Create a PERSISTENT POA named 'simple_persistent', beneath the root
        //
        org.omg.CORBA.Policy[] policies=new org.omg.CORBA.Policy[4];

        policies[0]=poa.create_lifespan_policy(org.omg.PortableServer.LifespanPolicyValue.PERSISTENT);
        policies[1]=poa.create_id_assignment_policy(org.omg.PortableServer.IdAssignmentPolicyValue.USER_ID);
        policies[2]=poa.create_servant_retention_policy(org.omg.PortableServer.ServantRetentionPolicyValue.NON_RETAIN);
        policies[3]=poa.create_request_processing_policy(
            org.omg.PortableServer.RequestProcessingPolicyValue.USE_SERVANT_MANAGER);

        org.omg.PortableServer.POA persistent_poa=
        poa.create_POA("simple_persistent",
                       poa_manager,
                       policies);

        // ServantLocator
        ServantLocatorImpl servantLocatorImpl = new ServantLocatorImpl(orb, persistent_poa);

        // Set servant manager
        persistent_poa.set_servant_manager(servantLocatorImpl);

        // create a GoodDayImpl
        GoodDayImpl goodDayImpl = new GoodDayImpl();
        org.omg.CORBA.Object obj = servantLocatorImpl.registerObject(GoodDayHelper.id(), GoodDayHelper.id(), goodDayImpl);

        // create a DayFactoryImpl
        DayFactoryImpl dayFactoryImpl = new DayFactoryImpl(persistent_poa);
        obj = servantLocatorImpl.registerObject(DayFactoryHelper.id(), DayFactoryHelper.id(), dayFactoryImpl);

        poa_manager.activate();

        System.out.println ("SERVER IOR: " + orb.object_to_string(obj));
        System.out.flush();

        // wait for requests
View Full Code Here


        try
        {
            org.omg.CORBA.Object poa_obj =
                myorb.resolve_initial_references("RootPOA");
            POA root_poa = POAHelper.narrow(poa_obj);
            POAManager pm = root_poa.the_POAManager();
            SampleImpl servant = new SampleImpl();
            root_poa.activate_object(servant);
            pm.activate();
            myorb.destroy();
        }
        catch(INITIALIZE e)
        {
            // this exception is thrown if IPv6 is not available on the machine
View Full Code Here

        POA poa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));

        //
        // Get a reference to the POA manager
        //
        POAManager manager = poa.the_POAManager();

        //
        // Create implementation object
        //
        BankImpl bankImpl = new BankImpl(poa);

        byte[] oid = "Bank".getBytes();
        poa.activate_object_with_id(oid, bankImpl);

        org.omg.CORBA.Object ref = poa.create_reference_with_id(oid, BankHelper.id());

        // Register in NameService
        org.omg.CORBA.Object nsObj = orb.resolve_initial_references("NameService");
        NamingContextExt rootContext = NamingContextExtHelper.narrow(nsObj);
        NameComponent[] nc = rootContext.to_name("Bank");
        rootContext.rebind(nc, ref);

        //
        // Run implementation
        //
        manager.activate();
        System.out.println("Server ready...");
        orb.run();

        return 0;
    }
View Full Code Here

TOP

Related Classes of org.omg.PortableServer.POAManager

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.