/** * create a name from a stringified name */ public Name(String string_name) throws org.omg.CosNaming.NamingContextPackage.InvalidName { this(toName(string_name)); }
/** * @return the string representation of this name */ public String toString() { try { return toString(fullName); } catch (InvalidName in) { return "<invalid>"; } }
throw new CannotProceed(); Name n = new Name(nc); Name ctx = n.ctxName(); NameComponent nb = n.baseNameComponent(); if (isDead(ref)) unbind(n.components()); else throw new AlreadyBound(); if (isDead(ref)) { rebind_context(n.components(), obj); return; throw new CannotProceed(_this(), n.components()); org.omg.CORBA.Object context = this.resolve(ctx.components()); String contextOID = this.getObjectOID(context); CorbaNamingContext jbossContext = (contextOID == null ? null : contextImpls.get(contextOID)); if (jbossContext != null) jbossContext.bind_context(ncx, obj); else NamingContextExtHelper.narrow(context).bind_context(ncx, obj);
throw new InvalidName(); Name n = new Name(nc); Name ctx = n.ctxName(); NameComponent nb = n.baseNameComponent(); ref._release(); String oid = this.getObjectOID(ref); if (oid != null) contextImpls.remove(oid); } else { IIOPLogger.ROOT_LOGGER.failedToUnbindObject(n); throw new NotFound(NotFoundReason.not_context, n.components()); org.omg.CORBA.Object context = this.resolve(ctx.components()); String contextOID = this.getObjectOID(context); CorbaNamingContext jbossContext = (contextOID == null ? null : contextImpls.get(contextOID)); if (jbossContext != null) jbossContext.unbind(ncx); else NamingContextExtHelper.narrow(context).unbind(ncx);
throw new org.omg.CORBA.BAD_PARAM(); Name n = new Name(nc); Name ctx = n.ctxName(); NameComponent nb = n.baseNameComponent(); org.omg.CORBA.Object context = this.resolve(ctx.components()); String contextOID = this.getObjectOID(context); CorbaNamingContext jbossContext = (contextOID == null ? null : contextImpls.get(contextOID)); if (jbossContext != null) jbossContext.rebind(ncx, obj); else NamingContextExtHelper.narrow(context).rebind(ncx, obj);
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; } }
this.cleanup(); int size = how_many(); result[how_many_ctr - 1] = new Binding((names.next()).components(), BindingType.nobject); result[how_many_ctr - 1] = new Binding((contexts.next()).components(), BindingType.ncontext); Binding[] rest = new Binding[size]; for (; names.hasNext() && size > 0; size--) rest[size - 1] = new Binding((names.next()).components(), BindingType.nobject); rest[size - 1] = new Binding((contexts.next()).components(), BindingType.ncontext); byte[] oid = rootPoa.activate_object(new BindingIteratorImpl(rest)); o = rootPoa.id_to_reference(oid); } catch (Exception e) { result = new Binding[size]; for (; names.hasNext() && size > 0; size--) result[size - 1] = new Binding((names.next()).components(), BindingType.nobject); result[size - 1] = new Binding((contexts.next()).components(), BindingType.ncontext);
/** * <p> * Cleanup bindings, i.e. ping every object and remove bindings to non-existent objects. * </p> */ private void cleanup() { // Check if object purging enabled if (!this.doPurge) return; for (Name key : this.names.keySet()) { if (isDead(((org.omg.CORBA.Object) this.names.get(key)))) { this.names.remove(key); } } for (Name key : this.contexts.keySet()) { org.omg.CORBA.Object object = (org.omg.CORBA.Object) this.contexts.get(key); if (isDead(object)) { this.contexts.remove(key); String oid = this.getObjectOID(object); if (oid != null) contextImpls.remove(oid); } } }
public NamingContext bind_new_context(NameComponent[] nc) throws NotFound, CannotProceed, InvalidName, AlreadyBound { if (this.destroyed) throw new CannotProceed(); if (nc == null || nc.length == 0) throw new InvalidName(); NamingContext context = new_context(); if (context == null) throw new CannotProceed(); bind_context(nc, context); return context; }
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; } }
public Name fullName() throws org.omg.CosNaming.NamingContextPackage.InvalidName { return new Name(fullName); }
/** * @return the string representation of this NameComponent array */ public static String toString(org.omg.CosNaming.NameComponent[] n) throws org.omg.CosNaming.NamingContextPackage.InvalidName { if (n == null || n.length == 0) throw new org.omg.CosNaming.NamingContextPackage.InvalidName(); StringBuffer b = new StringBuffer(); for (int i = 0; i < n.length; i++) { if (i > 0) b.append("/"); if (n[i].id.length() > 0) b.append(escape(n[i].id)); if (n[i].kind.length() > 0 || n[i].id.length() == 0) b.append("."); if (n[i].kind.length() > 0) b.append(escape(n[i].kind)); } return b.toString(); }
/** * * @return an a array of NameComponents * @throws org.omg.CosNaming.NamingContextPackage.InvalidName */ public static org.omg.CosNaming.NameComponent[] toName(String sn) throws org.omg.CosNaming.NamingContextPackage.InvalidName { if (sn == null || sn.length() == 0 || sn.startsWith("/")) throw new InvalidName(); Vector v = new Vector(); int start = 0; int i = 0; for (; i < sn.length(); i++) { if (sn.charAt(i) == '/' && sn.charAt(i - 1) != '\\') { if (i - start == 0) throw new InvalidName(); v.addElement(getComponent(sn.substring(start, i))); start = i + 1; } } if (start < i) v.addElement(getComponent(sn.substring(start, i))); org.omg.CosNaming.NameComponent[] result = new org.omg.CosNaming.NameComponent[v.size()]; for (int j = 0; j < result.length; j++) { result[j] = (org.omg.CosNaming.NameComponent) v.elementAt(j); } return result; }
public String to_string(NameComponent[] n) throws InvalidName { return Name.toString(n); }
public NameComponent[] to_name(String sn) throws InvalidName { return Name.toName(sn); }
/** * @return a Name object representing the name of the enclosing context */ public Name ctxName() { // null if no further context if (ctxName != null) { try { return new Name(ctxName); } catch (org.omg.CosNaming.NamingContextPackage.InvalidName e) { throw new INTERNAL(e.toString()); } } return null; }
public int hashCode() { return toString().hashCode(); }
public boolean equals(Object obj) { if (obj == null) return false; if (!(obj instanceof Name)) return false; return (toString().equals(obj.toString())); }