Package org.omg.CosNaming

Examples of org.omg.CosNaming.NamingContext


     * @param obj     the CORBA object to be bound.
     * @throws Exception if an error occurs while binding the object.
     */
    public static synchronized void rebind(final NamingContextExt ctx, final String strName, final org.omg.CORBA.Object obj) throws Exception {
        final NameComponent[] name = ctx.to_name(strName);
        NamingContext intermediateCtx = ctx;

        for (int i = 0; i < name.length - 1; i++) {
            final NameComponent[] relativeName = new NameComponent[]{name[i]};
            try {
                intermediateCtx = NamingContextHelper.narrow(
                        intermediateCtx.resolve(relativeName));
            } catch (NotFound e) {
                intermediateCtx = intermediateCtx.bind_new_context(relativeName);
            }
        }
        intermediateCtx.rebind(new NameComponent[]{name[name.length - 1]}, obj);
    }
View Full Code Here


     * common code that is called from getProvider()
     */
    private SerialContextProvider narrowProvider(org.omg.CORBA.Object ref)
                       throws Exception {

        NamingContext nctx = NamingContextHelper.narrow(ref);
  NameComponent[] path = { new NameComponent("SerialContextProvider", "") };
  return (SerialContextProvider)
        PortableRemoteObject.narrow(nctx.resolve(path),
            SerialContextProvider.class);
    }
View Full Code Here

              (Servant)servantsTie);
           
            // put object in NameService
            org.omg.CORBA.Object objRef =
                ORBManager.getORB().resolve_initial_references("NameService");
            NamingContext ncRef = NamingContextHelper.narrow(objRef);
            NameComponent nc =
                new NameComponent(SERIAL_CONTEXT_PROVIDER_NAME, "");
            NameComponent path[] = {nc};
            ncRef.rebind(path, provider);

        } catch (Exception ex) {

            _logger.log(Level.SEVERE,
                 "enterprise_naming.excep_in_insertserialcontextprovider",ex);
View Full Code Here

      // get WebLogic Server IOR from command line argument
      String ior = args[0];
      org.omg.CORBA.Object obj = orb.string_to_object(ior);

      // obtain naming context for WebLogic Server
      NamingContext nc = NamingContextHelper.narrow(obj);

      NameComponent nComp = new NameComponent(rmiObj, "");
      NameComponent path[] = {nComp};
      try {
        // resolve and narrow to RMI object
        obj = nc.resolve(path);
        HelloWorld hi = HelloWorldHelper.narrow(obj);

        // call method on RMI object
        hi.sayHello();
        System.out.println("Method call completed successfully!");
View Full Code Here

                objref = orb.resolve_initial_references( "NameService");
            } else {
                objref = orb.string_to_object(endpoints) ;
            }

            final NamingContext nctx = NamingContextHelper.narrow(objref);
            final NameComponent[] path =
                { new NameComponent("SerialContextProvider", "") };
            final org.omg.CORBA.Object obj = nctx.resolve(path) ;

            SerialContextProvider result =
                (SerialContextProvider)PortableRemoteObject.narrow( obj,
                    SerialContextProvider.class );
View Full Code Here

    public void run( )
    {
        try {
            // start Name Service
            NameService nameService = new NameService(orb, dbDir );
            NamingContext rootContext = nameService.initialNamingContext();
            orb.register_initial_reference(
                ORBConstants.PERSISTENT_NAME_SERVICE_NAME, rootContext );
        } catch( Exception e ) {
            System.err.println(
                "NameService did not start successfully" );
View Full Code Here

    {
        // Create actually creates a new naming context
        lifecycleLogger.fine( "Creating New Naming Context " );
        NamingContextDataStore impl = (NamingContextDataStore)this;
        synchronized (impl) {
            NamingContext nctx = impl.NewContext();
            if( nctx != null ) {
                lifecycleLogger.fine( LogKeywords.LIFECYCLE_CREATE_SUCCESS );
            } else {
                // If naming context is null, then that must be a serious
                // error.
View Full Code Here

        throws org.omg.CosNaming.NamingContextPackage.NotFound,
               org.omg.CosNaming.NamingContextPackage.AlreadyBound,
               org.omg.CosNaming.NamingContextPackage.CannotProceed,
               org.omg.CosNaming.NamingContextPackage.InvalidName
    {
        NamingContext nc = null;
        NamingContext rnc = null;
        try {
            if (debug)
                dprint("bind_new_context " + nameToString(n));
            // The obvious solution:
            nc = this.new_context();
View Full Code Here

                // Now there are no other bindings under this name
                impl.Bind(n[0],obj,bt);
            }
        } else {
            // No: bind in a different context
            NamingContext context = resolveFirstAsContext(impl,n);

            // Compute tail
            NameComponent[] tail = new NameComponent[n.length - 1];
            System.arraycopy(n,1,tail,0,n.length-1);

      // How should we propagate the bind
            switch (bt.value()) {
            case BindingType._nobject:
                {
                    // Bind as object
                    if (rebind)
                        context.rebind(tail,obj);
                    else
                        context.bind(tail,obj);
                }
                break;
            case BindingType._ncontext:
                {
                    // Narrow to a naming context using Java casts. It must
                    // work.
                    NamingContext objContext = (NamingContext)obj;
                    // Bind as context
                    if (rebind)
                        context.rebind_context(tail,objContext);
                    else
                        context.bind_context(tail,objContext);
View Full Code Here

            // n.length > 1
            if ( (n[1].id.length() == 0) && (n[1].kind.length() == 0) ) {
                throw new InvalidName();
            }

            NamingContext context = resolveFirstAsContext(impl,n);

            // Compute restOfName = name[1..length]
            NameComponent[] tail = new NameComponent[n.length -1];
            System.arraycopy(n,1,tail,0,n.length-1);

            // Resolve rest of name in context
            try {
                // First try to resolve using the local call, this should work
                // most of the time unless there are federated naming contexts.
                Servant servant = impl.getNSPOA().reference_to_servant(
                    context );
                return doResolve(((NamingContextDataStore)servant), tail) ;
            } catch( Exception e ) {
                return context.resolve(tail);
            }
        }
    }
View Full Code Here

TOP

Related Classes of org.omg.CosNaming.NamingContext

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.