/** * create a name from a singleNameComponent */ public Name(org.omg.CosNaming.NameComponent n) throws org.omg.CosNaming.NamingContextPackage.InvalidName { if (n == null) throw new org.omg.CosNaming.NamingContextPackage.InvalidName(); baseName = n; fullName = new org.omg.CosNaming.NameComponent[1]; fullName[0] = n; ctxName = null; }
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 void destroy() throws NotEmpty { if (this.destroyed) return; if (!this.names.isEmpty() || !this.contexts.isEmpty()) throw new NotEmpty(); else { this.names = null; this.contexts = null; this.destroyed = true; } }
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 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());
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());
private boolean leafNotFound(NotFound e, NameComponent leaf) { // This test is not foolproof because some name servers // always just return one component in rest_of_name // so you might not be able to tell whether that is // the leaf (e.g. aa/aa/aa, which one is missing?) NameComponent rest; return e.why.value() == NotFoundReason._missing_node && e.rest_of_name.length == 1 && (rest = e.rest_of_name[0]).id.equals(leaf.id) && (rest.kind == leaf.kind || (rest.kind != null && rest.kind.equals(leaf.kind))); }
public NotFound (String $reason, org.omg.CosNaming.NamingContextPackage.NotFoundReason _why, org.omg.CosNaming.NameComponent[] _rest_of_name) { super(NotFoundHelper.id() + " " + $reason); why = _why; rest_of_name = _rest_of_name; } // ctor
public void _write(final org.omg.CORBA.portable.OutputStream _out) { org.omg.CosNaming.NamingContextPackage.InvalidNameHelper.write(_out, value); } }
public org.omg.CORBA.TypeCode _type () { return org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.type (); } public void _read(final org.omg.CORBA.portable.InputStream _in)
public void _write(final org.omg.CORBA.portable.OutputStream _out) { org.omg.CosNaming.NamingContextPackage.CannotProceedHelper.write(_out, value); } }
/** * @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 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});
/** * create a name from an array of NameComponents */ public Name(NameComponent[] n) throws InvalidName { if (n == null || n.length == 0) throw new InvalidName(); fullName = n; baseName = n[n.length - 1]; if (n.length > 1) { ctxName = new NameComponent[n.length - 1]; for (int i = 0; i < n.length - 1; i++) ctxName[i] = n[i]; } else ctxName = null; }
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());
/** * @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(); }
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});
/** * * @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; }
throw new InvalidName(); throw new InvalidName();
/** * create a name from a singleNameComponent */ public Name(org.omg.CosNaming.NameComponent n) throws org.omg.CosNaming.NamingContextPackage.InvalidName { if (n == null) throw new org.omg.CosNaming.NamingContextPackage.InvalidName(); baseName = n; fullName = new org.omg.CosNaming.NameComponent[1]; fullName[0] = n; ctxName = null; }