/** * Calls the bind_new_context COS naming api to create a new subcontext. * * @param path NameComponent[] object * @return the new context object. * @throws NotFound No objects under the name. * @throws org.omg.CosNaming.NamingContextPackage.CannotProceed Unable to obtain a continuation context * @throws org.omg.CosNaming.NamingContextPackage.InvalidName Name not understood. * @throws org.omg.CosNaming.NamingContextPackage.AlreadyBound An object is already bound to this name. */ private javax.naming.Context callBindNewContext(NameComponent[] path) throws NamingException { if (_nc == null) throw IIOPLogger.ROOT_LOGGER.notANamingContext(path.toString()); try { NamingContext nctx = _nc.bind_new_context(path); return new CNCtx(_orb, nctx, _env, makeFullName(path)); } catch (Exception e) { throw org.wildfly.iiop.openjdk.naming.jndi.ExceptionMapper.mapException(e, this, path); } }
/** * (Re)binds an object to a name in a given CORBA naming context, creating * any non-existent intermediate contexts along the way. * <p/> * This method is synchronized on the class object, if multiple services attempt to bind the * same context name at once it will fail * * @param ctx a reference to the COSNaming service. * @param strName the name under which the CORBA object is to be bound. * @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); }
/** * Calls the bind_new_context COS naming api to create a new subcontext. * * @param path NameComponent[] object * @return the new context object. * @throws NotFound No objects under the name. * @throws org.omg.CosNaming.NamingContextPackage.CannotProceed Unable to obtain a continuation context * @throws org.omg.CosNaming.NamingContextPackage.InvalidName Name not understood. * @throws org.omg.CosNaming.NamingContextPackage.AlreadyBound An object is already bound to this name. */ private javax.naming.Context callBindNewContext(NameComponent[] path) throws NamingException { if (_nc == null) throw IIOPLogger.ROOT_LOGGER.notANamingContext(path.toString()); try { NamingContext nctx = _nc.bind_new_context(path); return new CNCtx(_orb, nctx, _env, makeFullName(path)); } catch (Exception e) { throw org.wildfly.iiop.openjdk.naming.jndi.ExceptionMapper.mapException(e, this, path); } }
/** * Calls the bind_new_context COS naming api to create a new subcontext. * * @param path NameComponent[] object * @return the new context object. * @throws NotFound No objects under the name. * @throws org.omg.CosNaming.NamingContextPackage.CannotProceed Unable to obtain a continuation context * @throws org.omg.CosNaming.NamingContextPackage.InvalidName Name not understood. * @throws org.omg.CosNaming.NamingContextPackage.AlreadyBound An object is already bound to this name. */ private javax.naming.Context callBindNewContext(NameComponent[] path) throws NamingException { if (_nc == null) throw IIOPLogger.ROOT_LOGGER.notANamingContext(path.toString()); try { NamingContext nctx = _nc.bind_new_context(path); return new CNCtx(_orb, nctx, _env, makeFullName(path)); } catch (Exception e) { throw org.wildfly.iiop.openjdk.naming.jndi.ExceptionMapper.mapException(e, this, path); } }
/** * Calls the bind_new_context COS naming api to create a new subcontext. * @param path NameComponent[] object * @exception NotFound No objects under the name. * @exception CannotProceed Unable to obtain a continuation context * @exception InvalidName Name not understood. * @exception AlreadyBound An object is already bound to this name. * @return the new context object. */ private javax.naming.Context callBindNewContext(NameComponent[] path) throws NamingException { if (_nc == null) throw new ConfigurationException( "Context does not have a corresponding NamingContext"); try { NamingContext nctx = _nc.bind_new_context(path); return new CNCtx(_orb, orbTracker, nctx, _env, makeFullName(path)); } catch (Exception e) { throw ExceptionMapper.mapException(e, this, path); } }
System.err.println ("name is null "); context.bind_new_context (bindname.components ()); update ();
/** * (Re)binds an object to a name in a given CORBA naming context, creating * any non-existent intermediate contexts along the way. * <p/> * This method is synchronized on the class object, if multiple services attempt to bind the * same context name at once it will fail * * @param ctx a reference to the COSNaming service. * @param strName the name under which the CORBA object is to be bound. * @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); }
public void registerServant(String uri, Object servantObject) throws CorbaHostException { CorbanameURL details = CorbaHostUtils.getServiceDetails(uri); ORB orb = createORB(details.getHost(), details.getPort(), false); try { NamingContext namingCtx = getNamingContext(orb, details.getNameService()); for (int i = 0; i < details.getNamePath().size() - 1; i++) { NameComponent nc = new NameComponent(details.getNamePath().get(i), ""); NameComponent[] path = new NameComponent[] {nc}; try { namingCtx = NamingContextHelper.narrow(namingCtx.resolve(path)); } catch (Exception e) { namingCtx = namingCtx.bind_new_context(path); } } NameComponent finalName = new NameComponent(details.getNamePath().get(details.getNamePath().size() - 1), ""); try { namingCtx.resolve(new NameComponent[] {finalName}); // no exception means that some object is already registered // under this name, we need to crash here throw new CorbaHostException(CorbaHostException.BINDING_IN_USE); } catch (NotFound e) { namingCtx.bind(new NameComponent[] {finalName}, servantObject); } } catch (CorbaHostException e) { throw e; } catch (Exception e) { handleException(e); } }