public boolean next_one(org.omg.CosNaming.BindingHolder b) { if (iterator_pos < bindings.length) { b.value = bindings[iterator_pos++]; return true; } else { b.value = new Binding(new org.omg.CosNaming.NameComponent[0], org.omg.CosNaming.BindingType.nobject); return false; } } }
/** * (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); }
this.isLookedUpCtx = isLookedUpCtx; _env = env; _bindingList = new BindingListHolder(); BindingIteratorHolder _bindingIterH = new BindingIteratorHolder(); _ctx._nc.list(0, _bindingList, _bindingIterH); more = _bindingIter.next_n(batchsize, _bindingList); } else { more = false;
NamingContext nobj = NamingContextHelper.narrow((org.omg.CORBA.Object) obj); if (rebind) _nc.rebind_context(pth, nobj); else _nc.bind_context(pth, nobj); _nc.rebind(pth, (org.omg.CORBA.Object) obj); else _nc.bind(pth, (org.omg.CORBA.Object) obj); } else throw IIOPLogger.ROOT_LOGGER.notACorbaObject();
/** * 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 void unbind(NameComponent[] nc) throws NotFound, CannotProceed, InvalidName { if (this.destroyed) throw new CannotProceed(); throw new InvalidName(); } else { IIOPLogger.ROOT_LOGGER.failedToUnbindObject(n); throw new NotFound(NotFoundReason.not_context, n.components()); jbossContext.unbind(ncx); else NamingContextExtHelper.narrow(context).unbind(ncx);
public org.omg.CORBA.Object resolve(NameComponent[] nc) throws NotFound, CannotProceed, InvalidName { if (this.destroyed) throw new CannotProceed(); if (nc == null || nc.length == 0) throw new InvalidName(); Name n = new Name(nc[0]); if (nc.length > 1) { org.omg.CORBA.Object next_context = (org.omg.CORBA.Object) this.contexts.get(n); if ((next_context == null) || (isDead(next_context))) throw new NotFound(NotFoundReason.missing_node, nc); NameComponent[] nc_prime = new NameComponent[nc.length - 1]; System.arraycopy(nc, 1, nc_prime, 0, nc_prime.length); // try first to call the context implementation object directly. String contextOID = this.getObjectOID(next_context); CorbaNamingContext jbossContext = (contextOID == null ? null : contextImpls.get(contextOID)); if (jbossContext != null) return jbossContext.resolve(nc_prime); else return NamingContextExtHelper.narrow(next_context).resolve(nc_prime); } else { org.omg.CORBA.Object result = (org.omg.CORBA.Object) this.contexts.get(n); if (result == null) result = (org.omg.CORBA.Object) this.names.get(n); if (result == null) throw new NotFound(NotFoundReason.missing_node, n.components()); if (!noPing && isDead(result)) throw new NotFound(NotFoundReason.missing_node, n.components()); return result; } }
public void rebind(NameComponent[] nc, org.omg.CORBA.Object obj) throws NotFound, CannotProceed, InvalidName { if (this.destroyed) throw new CannotProceed(); throw new InvalidName(); throw new NotFound(NotFoundReason.not_object, new NameComponent[]{nb}); jbossContext.rebind(ncx, obj); else NamingContextExtHelper.narrow(context).rebind(ncx, obj);
public void bind(NameComponent[] nc, org.omg.CORBA.Object obj) throws NotFound, CannotProceed, InvalidName, AlreadyBound { if (this.destroyed) throw new CannotProceed(); throw new InvalidName(); return; throw new AlreadyBound(); } else if (this.contexts.containsKey(n)) { if (isDead(ref)) unbind(n.components()); throw new AlreadyBound(); throw new CannotProceed(_this(), n.components()); jbossContext.bind(ncx, obj); else NamingContextExtHelper.narrow(context).bind(ncx, obj);
public void rebind_context(NameComponent[] nc, NamingContext obj) throws NotFound, CannotProceed, InvalidName { if (this.destroyed) throw new CannotProceed(); throw new InvalidName(); throw new NotFound(NotFoundReason.not_context, new NameComponent[]{nb}); jbossContext.rebind_context(ncx, obj); else NamingContextExtHelper.narrow(context).rebind_context(ncx, obj);
throw new InvalidName(); throw new InvalidName(); return (new org.omg.CosNaming.NameComponent(id.toString(), kind.toString()));
private void setOrbAndRootContext(ORB orb, org.omg.CORBA.Object ncRef) throws NamingException { _orb = orb; try { _nc = NamingContextHelper.narrow(ncRef); if (_nc == null) { throw IIOPLogger.ROOT_LOGGER.errorConvertingIORToNamingCtx(ncRef.toString()); } } catch (org.omg.CORBA.COMM_FAILURE e) { NamingException ne = IIOPLogger.ROOT_LOGGER.errorConnectingToORB(); ne.setRootCause(e); throw ne; } }
public void bind_context(NameComponent[] nc, NamingContext obj) throws NotFound, CannotProceed, InvalidName, AlreadyBound { if (this.destroyed) throw new CannotProceed(); unbind(n.components()); else throw new AlreadyBound(); } else if (this.contexts.containsKey(n)) { return; throw new AlreadyBound(); throw new CannotProceed(_this(), n.components()); jbossContext.bind_context(ncx, obj); else NamingContextExtHelper.narrow(context).bind_context(ncx, obj);
public NamingContext new_context() { try { // create and initialize a new context. CorbaNamingContext newContextImpl = new CorbaNamingContext(); newContextImpl.init(this.poa, this.doPurge, this.noPing); // create the oid for the new context and activate it with the naming service POA. String oid = new String(this.poa.servant_to_id(this), StandardCharsets.UTF_8) + "/ctx" + (++this.childCount); this.poa.activate_object_with_id(oid.getBytes(StandardCharsets.UTF_8), newContextImpl); // add the newly-created context to the cache. contextImpls.put(oid, newContextImpl); return NamingContextExtHelper.narrow(this.poa.create_reference_with_id(oid.getBytes(StandardCharsets.UTF_8), "IDL:omg.org/CosNaming/NamingContextExt:1.0")); } catch (Exception e) { IIOPLogger.ROOT_LOGGER.failedToCreateNamingContext(e); return null; } }
/** * Calls the unbind api of COS Naming and uses the exception mapper * class to map the exceptions * * @param path NameComponent[] object * @throws NotFound No objects under the name. If leaf * is not found, that's OK according to the JNDI spec * @throws org.omg.CosNaming.NamingContextPackage.CannotProceed Unable to obtain a continuation context * @throws org.omg.CosNaming.NamingContextPackage.InvalidName Name not understood. */ private void callUnbind(NameComponent[] path) throws NamingException { if (_nc == null) throw IIOPLogger.ROOT_LOGGER.notANamingContext(path.toString()); try { _nc.unbind(path); } catch (NotFound e) { // If leaf is the one missing, return success // as per JNDI spec if (leafNotFound(e, path[path.length - 1])) { // do nothing } else { throw org.wildfly.iiop.openjdk.naming.jndi.ExceptionMapper.mapException(e, this, 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 destroy on the COS Naming Server * * @param nc The NamingContext object to use. * @throws org.omg.CosNaming.NamingContextPackage.NotEmpty when the context is not empty and cannot be destroyed. */ private void callDestroy(NamingContext nc) throws NamingException { if (_nc == null) throw IIOPLogger.ROOT_LOGGER.notANamingContext(nc.toString()); try { nc.destroy(); } catch (Exception e) { throw org.wildfly.iiop.openjdk.naming.jndi.ExceptionMapper.mapException(e, this, null); } }
public void close() throws NamingException { more = false; if (_bindingIter != null) { _bindingIter.destroy(); _bindingIter = null; } if (_ctx != null) { /** * context was obtained by CNCtx, the user doesn't have a handle to * it, close it as we are done enumerating through the context */ if (isLookedUpCtx) { _ctx.close(); } _ctx = null; } }
/** * Get the next batch using _bindingIter. Update the 'more' field. */ private boolean getMore() throws NamingException { try { more = _bindingIter.next_n(batchsize, _bindingList); counter = 0; // reset } catch (Exception e) { more = false; NamingException ne = IIOPLogger.ROOT_LOGGER.errorGettingBindingList(); ne.setRootCause(e); throw ne; } return more; }
ncRef = _orb.resolve_initial_references("NameService"); _nc = NamingContextHelper.narrow(ncRef); if (_nc == null) { if (ncIor != null) {