/** * This operation resolves the Stringified name into the object reference. * * @param sn Stringified Name of the object * <p> * @exception org.omg.CosNaming.NamingContextPackage.NotFound Indicates there is no object * reference for the given name. * <p> * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Indicates that the given * compound name is incorrect * <p> * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName Indicates the name does not * identify a binding. * <p> * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound Indicates the name is already * bound. * <p> */ public org.omg.CORBA.Object resolve_str(String sn) throws org.omg.CosNaming.NamingContextPackage.NotFound, org.omg.CosNaming.NamingContextPackage.CannotProceed, org.omg.CosNaming.NamingContextPackage.InvalidName { org.omg.CORBA.Object theObject = null; // Name valid? if ((sn == null) || (sn.length() == 0)) { throw new InvalidName(); } NamingContextDataStore impl = (NamingContextDataStore) this; org.omg.CosNaming.NameComponent[] theNameComponents = insImpl.convertToNameComponent(sn); if ((theNameComponents == null) || (theNameComponents.length == 0)) { throw new InvalidName(); } theObject = resolve(theNameComponents); return theObject; }
/** * This operation converts a Stringified Name into an equivalent array of Name Components. * * @param sn Stringified Name of the object * <p> * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName Indicates the name does not * identify a binding. * <p> */ public org.omg.CosNaming.NameComponent[] to_name(String sn) throws org.omg.CosNaming.NamingContextPackage.InvalidName { // Name valid? if ((sn == null) || (sn.length() == 0)) { throw new InvalidName(); } NamingContextDataStore impl = (NamingContextDataStore) this; org.omg.CosNaming.NameComponent[] theNameComponents = insImpl.convertToNameComponent(sn); if ((theNameComponents == null) || (theNameComponents.length == 0)) { throw new InvalidName(); } for (int i = 0; i < theNameComponents.length; i++) { // If there is a name component whose id and kind null or // zero length string, then an invalid name exception needs to be // raised. if (((theNameComponents[i].id == null) || (theNameComponents[i].id.length() == 0)) && ((theNameComponents[i].kind == null) || (theNameComponents[i].kind.length() == 0))) { throw new InvalidName(); } } return theNameComponents; }