Examples of NamingContextExt


Examples of org.omg.CosNaming.NamingContextExt

        // create and init the ORB
        ORB orb = ORB.init(args, null);

        // get the root naming context
        org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
        NamingContextExt namingCtx = NamingContextExtHelper.narrow(objRef);
  
        // resolve the object reference
        String accNum = "0234.234432.50L";
        Account account = AccountHelper.narrow(namingCtx.resolve_str(accNum));
        System.out.println("Obtained a handle on server object: " + account);
       
        account.deposit(100);
        System.out.println("yeeeee: " + account.balance());
  }
View Full Code Here

Examples of org.omg.CosNaming.NamingContextExt

    Bank bankRef = BankHelper.narrow(ref);
    LOG.info("Bank reference created");

    // get the NameService
    org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
    NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);
    LOG.info("NamingContext created");

    // bind the Object Reference in Naming
    NameComponent path[] = ncRef.to_name(BANKNAME);
    ncRef.rebind(path, bankRef);
    LOG.info("Bank reference bound");

    // wait for invocations from clients
    LOG.info("BankServer ready and waiting ...");
    orb.run();
View Full Code Here

Examples of org.omg.CosNaming.NamingContextExt

            final EjbObjectCorbaServant beanServant = new EjbObjectCorbaServant(poaCurrent, beanMethodMap, beanRepositoryIds, beanInterfaceDef, orb, remoteView.getValue(), factory, configuration, component.getTransactionManager());

            beanReferenceFactory = beanServantRegistry.bind(beanServantName(name), beanServant, policies);

            final NamingContextExt corbaContext = corbaNamingContext.getValue();

            // Register bean home in local CORBA naming context
            rebind(corbaContext, name, corbaRef);
            logger.debug("Home IOR for " + component.getComponentName() + " bound to " + name + " in CORBA naming service");
        } catch (Exception e) {
View Full Code Here

Examples of org.omg.CosNaming.NamingContextExt

    }

    @Override
    public synchronized void stop(final StopContext context) {
        // Get local (in-VM) CORBA naming context
        final NamingContextExt corbaContext = corbaNamingContext.getValue();

        // Unregister bean home from local CORBA naming context
        try {
            NameComponent[] name = corbaContext.to_name(this.name);
            corbaContext.unbind(name);
        } catch (InvalidName invalidName) {
            logger.error("Cannot unregister EJBHome from CORBA naming service", invalidName);
        } catch (NotFound notFound) {
            logger.error("Cannot unregister EJBHome from CORBA naming service", notFound);
        } catch (CannotProceed cannotProceed) {
View Full Code Here

Examples of org.omg.CosNaming.NamingContextExt

     */
    private org.omg.CORBA.Object resolveCorbaname( CorbanameURL theCorbaName ) {
        org.omg.CORBA.Object result = null;

        try {
            NamingContextExt theNamingContext = null;

            if( theCorbaName.getRIRFlag( ) ) {
                // Case 1 of corbaname: rir#
                theNamingContext = getDefaultRootNamingContext( );
            } else {
                // Case 2 of corbaname: ::hostname#
                org.omg.CORBA.Object corbalocResult =
                    getIORUsingCorbaloc( theCorbaName );
                if( corbalocResult == null ) {
                    return null;
                }

                theNamingContext =
                    NamingContextExtHelper.narrow( corbalocResult );
            }

            String StringifiedName = theCorbaName.getStringifiedName( );

            if( StringifiedName == null ) {
                // This means return the Root Naming context
                return theNamingContext;
            } else {
                return theNamingContext.resolve_str( StringifiedName );
            }
        } catch( Exception e ) {
            clearRootNamingContextCache( );
            return null;
        }
View Full Code Here

Examples of org.omg.CosNaming.NamingContextExt

            System.out.println("Publishing SMS Gateway Service as a CORBA service: SMSGatewayCORBAService (port=5080)");

            String[] orbArgs = {"-ORBInitialPort", "5080"};
            ORB orb = ORB.init(orbArgs, null);

            NamingContextExt namingCtx;
            try {
                Object objRef = orb.resolve_initial_references("NameService");
                namingCtx = NamingContextExtHelper.narrow(objRef);
            } catch (Exception ex) {
                System.err.println("ERROR: Failed to resolve Name Service.");
                //System.err.println("Don't forget to run it with:");
                //System.err.println("  tnameserv -ORBInitialPort 5080");
                return;
            }

            Object rootPoaRef = orb.resolve_initial_references("RootPOA");
            POA rootPoa = POAHelper.narrow(rootPoaRef);
            rootPoa.the_POAManager().activate();

            SMSGatewayServant smsGateway = new SMSGatewayServant();
            Object smsGatewayRef = rootPoa.servant_to_reference(smsGateway);

            String corbaServerName = "SMSGatewayCORBAService";
            NameComponent[] name = {new NameComponent(corbaServerName, "")};
            namingCtx.rebind(name, smsGatewayRef);

            System.out.println("CORBA server running - press Enter to shutdown");
            System.in.read();

            orb.shutdown(true);
View Full Code Here

Examples of org.omg.CosNaming.NamingContextExt

            nc = new NameComponent("ArraysUnions", "");
            path = new NameComponent[] {nc};
            namingContext.rebind(path, arraysUnions);

            NamingContextExt nce = NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService"));

            refArraysSetter = nce.resolve(nce.to_name("ArraysSetter"));
            refPrimitivesSetter = nce.resolve(nce.to_name("PrimitivesSetter"));
            refTestObject = nce.resolve(nce.to_name("TestObject"));
            refCalcObject = nce.resolve(nce.to_name("CalcObject"));
            refObjectManager = nce.resolve(nce.to_name("ObjectManager"));
            refEnumManager = nce.resolve(nce.to_name("EnumManager"));
            refArraysUnions = nce.resolve(nce.to_name("ArraysUnions"));

        } catch (Exception e) {
            e.printStackTrace();
        }
    }
View Full Code Here

Examples of org.omg.CosNaming.NamingContextExt

    public void unregisterServant(String uri) throws CorbaHostException {
        CorbanameURL details = CorbaHostUtils.getServiceDetails(uri);
        ORB orb = createORB(details.getHost(), details.getPort(), false);
        try {
            NamingContextExt namingCtx = getNamingContext(orb, details.getNameService());
            namingCtx.unbind(namingCtx.to_name(details.getName()));
        } catch (Exception e) {
            handleException(e);
        }
    }
View Full Code Here

Examples of org.omg.CosNaming.NamingContextExt

    public Object lookup(String uri) throws CorbaHostException {
        Object result = null;
        try {
            CorbanameURL url = new CorbanameURL(uri);
            ORB orb = createORB(url.getHost(), url.getPort(), false);
            NamingContextExt context = getNamingContext(orb, url.getNameService());
            result = context.resolve_str(url.getName());
        } catch (Exception e) {
            handleException(e);
        }
        if (result == null) {
            throw new CorbaHostException(CorbaHostException.NO_SUCH_OBJECT);
View Full Code Here

Examples of org.omg.CosNaming.NamingContextExt

    }

    public void unregisterServant(String uri) throws CorbaHostException {
        CorbanameURL details = CorbaHostUtils.getServiceDetails(uri);
        try {
            NamingContextExt namingCtx = getNamingContext(details.getNameService());
            namingCtx.unbind(namingCtx.to_name(details.getName()));
            removeURI(uri);
        } catch (Exception e) {
            handleException(e);
        }
    }
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.