/** * (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); }
/** * Does the job of calling the COS Naming API, * resolve, and performs the exception mapping. If the resolved * object is a COS Naming Context (sub-context), then this function * returns a new JNDI naming context object. * * @param path the NameComponent[] object. * @return Resolved object returned by the COS Name Server. * @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. */ java.lang.Object callResolve(NameComponent[] path) throws NamingException { try { org.omg.CORBA.Object obj = _nc.resolve(path); try { NamingContext nc = NamingContextHelper.narrow(obj); if (nc != null) { return new CNCtx(_orb, nc, _env, makeFullName(path)); } else { return obj; } } catch (org.omg.CORBA.SystemException e) { return obj; } } catch (Exception e) { throw org.wildfly.iiop.openjdk.naming.jndi.ExceptionMapper.mapException(e, this, path); } }
_name = parser.nameToCosName(parser.parse(insName)); try { org.omg.CORBA.Object obj = _nc.resolve(_name); _nc = NamingContextHelper.narrow(obj); if (_nc == null) {
public SerialContextProvider getNameService() throws InvalidName, NotFound, CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName { org.omg.CORBA.Object objref = null; if (endpoints == null) { 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 ); return result ; }
/** * (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); }
return context.resolve(tail);
/** * Does the job of calling the COS Naming API, * resolve, and performs the exception mapping. If the resolved * object is a COS Naming Context (sub-context), then this function * returns a new JNDI naming context object. * * @param path the NameComponent[] object. * @return Resolved object returned by the COS Name Server. * @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. */ java.lang.Object callResolve(NameComponent[] path) throws NamingException { try { org.omg.CORBA.Object obj = _nc.resolve(path); try { NamingContext nc = NamingContextHelper.narrow(obj); if (nc != null) { return new CNCtx(_orb, nc, _env, makeFullName(path)); } else { return obj; } } catch (org.omg.CORBA.SystemException e) { return obj; } } catch (Exception e) { throw org.wildfly.iiop.openjdk.naming.jndi.ExceptionMapper.mapException(e, this, path); } }
public SerialContextProvider getNameService() throws InvalidName, NotFound, CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName { org.omg.CORBA.Object objref = null; if (endpoints == null) { 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 ); return result ; }
/** * Does the job of calling the COS Naming API, * resolve, and performs the exception mapping. If the resolved * object is a COS Naming Context (sub-context), then this function * returns a new JNDI naming context object. * * @param path the NameComponent[] object. * @return Resolved object returned by the COS Name Server. * @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. */ java.lang.Object callResolve(NameComponent[] path) throws NamingException { try { org.omg.CORBA.Object obj = _nc.resolve(path); try { NamingContext nc = NamingContextHelper.narrow(obj); if (nc != null) { return new CNCtx(_orb, nc, _env, makeFullName(path)); } else { return obj; } } catch (org.omg.CORBA.SystemException e) { return obj; } } catch (Exception e) { throw org.wildfly.iiop.openjdk.naming.jndi.ExceptionMapper.mapException(e, this, path); } }
throws NamingException { try { org.omg.CORBA.Object obj = _nc.resolve(path); try { NamingContext nc =
NamingContextHelper.narrow( n.resolve(name) ); list( sub_context, _indent, ps );
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); } }
context = NamingContextHelper.narrow (context.resolve (bind.getName ())); if (context == null)
context = NamingContextHelper.narrow (context.resolve (bind.getName ()));
return doResolve(((NamingContextDataStore)servant), tail) ; } catch( Exception e ) { return context.resolve(tail);
NameComponent nc = new NameComponent(nameId, nameKind); NameComponent[] ncs = {nc}; org.omg.CORBA.Object corbaObject = root.resolve(ncs);
NameComponent nc = new NameComponent(nameId, nameKind); NameComponent[] ncs = {nc}; org.omg.CORBA.Object corbaObject = root.resolve(ncs);
NameComponent nc = new NameComponent(nameId, nameKind); NameComponent[] ncs = {nc}; org.omg.CORBA.Object corbaObject = root.resolve(ncs);
return context.resolve(subName); } else { NameComponent name = n[0];
return context.resolve(subName);