< prev index next >

src/java.corba/share/classes/com/sun/corba/se/impl/naming/cosnaming/NamingContextImpl.java

Print this page




 164         // doBind implements all four flavors of binding
 165         NamingContextDataStore impl = (NamingContextDataStore)this;
 166         doBind(impl,n,obj,false,BindingType.nobject);
 167         if( updateLogger.isLoggable( Level.FINE  ) ) {
 168             // isLoggable call to make sure that we save some precious
 169             // processor cycles, if there is no need to log.
 170             updateLogger.fine( LogKeywords.NAMING_BIND_SUCCESS + " Name = " +
 171                 NamingUtils.getDirectoryStructuredName( n ) );
 172         }
 173     }
 174 
 175 
 176     /**
 177      * Bind a NamingContext under a name in this NamingContext. If the name
 178      * contains multiple (n) components, n-1 will be resolved in this
 179      * NamingContext and the object bound in resulting NamingContext.
 180      * An exception is thrown if a binding with the supplied name already
 181      * exists. The NamingContext will participate in recursive resolving.
 182      * @param n a sequence of NameComponents which is the name under which
 183      * the object will be bound.
 184      * @param obj the NamingContect object reference to be bound.
 185      * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
 186      * multiple components was supplied, but the first component could not be
 187      * resolved.
 188      * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could
 189      * not proceed in resolving the n-1 components of the supplied name.
 190      * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
 191      * supplied name is invalid (i.e., has length less than 1).
 192      * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object
 193      * is already bound under the supplied name.
 194      * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 195      * system exceptions.
 196      * @see doBind
 197      */
 198     public void bind_context(NameComponent[] n, NamingContext nc)
 199         throws org.omg.CosNaming.NamingContextPackage.NotFound,
 200                org.omg.CosNaming.NamingContextPackage.CannotProceed,
 201                org.omg.CosNaming.NamingContextPackage.InvalidName,
 202                org.omg.CosNaming.NamingContextPackage.AlreadyBound
 203     {
 204         if( nc == null ) {


 261             // This should not happen
 262             throw wrapper.namingCtxRebindAlreadyBound( ex ) ;
 263         }
 264         if( updateLogger.isLoggable( Level.FINE  ) ) {
 265             // isLoggable call to make sure that we save some precious
 266             // processor cycles, if there is no need to log.
 267             updateLogger.fine( LogKeywords.NAMING_REBIND_SUCCESS + " Name = " +
 268                 NamingUtils.getDirectoryStructuredName( n ) );
 269         }
 270     }
 271 
 272     /**
 273      * Bind a NamingContext under a name in this NamingContext. If the name
 274      * contains multiple (n) components, the first n-1 components will be
 275      * resolved in this NamingContext and the object bound in resulting
 276      * NamingContext. If a binding under the supplied name already exists it
 277      * will be unbound first. The NamingContext will participate in recursive
 278      * resolving.
 279      * @param n a sequence of NameComponents which is the name under which
 280      * the object will be bound.
 281      * @param obj the object reference to be bound.
 282      * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
 283      * multiple components was supplied, but the first component could not be
 284      * resolved.
 285      * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
 286      * proceed in resolving the n-1 components of the supplied name.
 287      * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
 288      * supplied name is invalid (i.e., has length less than 1).
 289      * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 290      * system exceptions.
 291      * @see doBind
 292      */
 293     public  void rebind_context(NameComponent[] n, NamingContext nc)
 294         throws org.omg.CosNaming.NamingContextPackage.NotFound,
 295                org.omg.CosNaming.NamingContextPackage.CannotProceed,
 296                org.omg.CosNaming.NamingContextPackage.InvalidName
 297     {
 298         if( nc == null )
 299         {
 300             updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
 301                 " NULL Context cannot be Bound " );


 836             // It was not a context
 837             throw new NotFound(NotFoundReason.not_context,n);
 838         }
 839 
 840         // Narrow to a naming context
 841         try {
 842             context = NamingContextHelper.narrow(topRef);
 843         } catch (org.omg.CORBA.BAD_PARAM ex) {
 844             // It was not a context
 845             throw new NotFound(NotFoundReason.not_context,n);
 846         }
 847 
 848         // Hmm. must be ok
 849         return context;
 850     }
 851 
 852 
 853    /**
 854     * This operation creates a stringified name from the array of Name
 855     * components.
 856     * @param n Name of the object <p>
 857     * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
 858     * Indicates the name does not identify a binding.<p>
 859     *
 860     */
 861     public String to_string(org.omg.CosNaming.NameComponent[] n)
 862          throws org.omg.CosNaming.NamingContextPackage.InvalidName
 863     {
 864         // Name valid?
 865         if ( (n == null ) || (n.length == 0) )
 866         {
 867                 throw new InvalidName();
 868         }
 869         NamingContextDataStore impl = (NamingContextDataStore)this;
 870 
 871         String theStringifiedName = insImpl.convertToString( n );
 872 
 873         if( theStringifiedName == null )
 874         {
 875                 throw new InvalidName();
 876         }
 877 
 878         return theStringifiedName;
 879     }
 880 
 881 
 882    /**
 883     * This operation  converts a Stringified Name into an  equivalent array
 884     * of Name Components.
 885     * @param sn Stringified Name of the object <p>
 886     * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
 887     * Indicates the name does not identify a binding.<p>
 888     *
 889     */
 890     public org.omg.CosNaming.NameComponent[] to_name(String sn)
 891          throws org.omg.CosNaming.NamingContextPackage.InvalidName
 892     {
 893         // Name valid?
 894         if  ( (sn == null ) || (sn.length() == 0) )
 895         {
 896                 throw new InvalidName();
 897         }
 898         NamingContextDataStore impl = (NamingContextDataStore)this;
 899         org.omg.CosNaming.NameComponent[] theNameComponents =
 900                 insImpl.convertToNameComponent( sn );
 901         if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
 902         {
 903                 throw new InvalidName();
 904         }
 905         for( int i = 0; i < theNameComponents.length; i++ ) {
 906             // If there is a name component whose id and kind null or
 907             // zero length string, then an invalid name exception needs to be
 908             // raised.
 909             if ( ( ( theNameComponents[i].id  == null )
 910                  ||( theNameComponents[i].id.length() == 0 ) )
 911                &&( ( theNameComponents[i].kind == null )
 912                  ||( theNameComponents[i].kind.length() == 0 ) ) ) {
 913                 throw new InvalidName();
 914             }
 915         }
 916         return theNameComponents;
 917     }
 918 
 919    /**
 920     * This operation creates a URL based "iiopname://" format name
 921     * from the Stringified Name of the object.
 922     * @param addr internet based address of the host machine where
 923     * Name Service is running <p>
 924     * @param sn Stringified Name of the object <p>
 925     * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
 926     * Indicates the name does not identify a binding.<p>
 927     * @exception org.omg.CosNaming.NamingContextPackage.InvalidAddress
 928     * Indicates the internet based address of the host machine is
 929     * incorrect <p>
 930     *
 931     */
 932 
 933     public String to_url(String addr, String sn)
 934         throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress,
 935                org.omg.CosNaming.NamingContextPackage.InvalidName
 936     {
 937         // Name valid?
 938         if  ( (sn == null ) || (sn.length() == 0) )
 939         {
 940             throw new InvalidName();
 941         }
 942         if( addr == null )
 943         {
 944             throw new
 945                 org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
 946         }
 947         NamingContextDataStore impl = (NamingContextDataStore)this;
 948         String urlBasedAddress = null;
 949         urlBasedAddress = insImpl.createURLBasedAddress( addr, sn );
 950         // Extra check to see that corba name url created is valid as per
 951         // INS spec grammer.
 952         try {
 953             INSURLHandler.getINSURLHandler( ).parseURL( urlBasedAddress );
 954         } catch( BAD_PARAM e ) {
 955             throw new
 956                 org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
 957         }
 958         return urlBasedAddress;
 959     }
 960 
 961     /**
 962      * This operation resolves the Stringified name into the object
 963      * reference.
 964      * @param sn Stringified Name of the object <p>
 965      * @exception org.omg.CosNaming.NamingContextPackage.NotFound
 966      * Indicates there is no object reference for the given name. <p>
 967      * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
 968      * Indicates that the given compound name is incorrect <p>
 969      * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
 970      * Indicates the name does not identify a binding.<p>
 971      * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound
 972      * Indicates the name is already bound.<p>
 973      *
 974      */
 975     public org.omg.CORBA.Object resolve_str(String sn)
 976         throws org.omg.CosNaming.NamingContextPackage.NotFound,
 977                org.omg.CosNaming.NamingContextPackage.CannotProceed,
 978                org.omg.CosNaming.NamingContextPackage.InvalidName
 979     {
 980         org.omg.CORBA.Object theObject = null;
 981         // Name valid?
 982         if  ( (sn == null ) || (sn.length() == 0) )
 983         {
 984                 throw new InvalidName();
 985         }
 986         NamingContextDataStore impl = (NamingContextDataStore)this;
 987         org.omg.CosNaming.NameComponent[] theNameComponents =
 988                 insImpl.convertToNameComponent( sn );
 989 
 990         if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
 991         {
 992                 throw new InvalidName();




 164         // doBind implements all four flavors of binding
 165         NamingContextDataStore impl = (NamingContextDataStore)this;
 166         doBind(impl,n,obj,false,BindingType.nobject);
 167         if( updateLogger.isLoggable( Level.FINE  ) ) {
 168             // isLoggable call to make sure that we save some precious
 169             // processor cycles, if there is no need to log.
 170             updateLogger.fine( LogKeywords.NAMING_BIND_SUCCESS + " Name = " +
 171                 NamingUtils.getDirectoryStructuredName( n ) );
 172         }
 173     }
 174 
 175 
 176     /**
 177      * Bind a NamingContext under a name in this NamingContext. If the name
 178      * contains multiple (n) components, n-1 will be resolved in this
 179      * NamingContext and the object bound in resulting NamingContext.
 180      * An exception is thrown if a binding with the supplied name already
 181      * exists. The NamingContext will participate in recursive resolving.
 182      * @param n a sequence of NameComponents which is the name under which
 183      * the object will be bound.
 184      * @param nc the NamingContext object reference to be bound.
 185      * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
 186      * multiple components was supplied, but the first component could not be
 187      * resolved.
 188      * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could
 189      * not proceed in resolving the n-1 components of the supplied name.
 190      * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
 191      * supplied name is invalid (i.e., has length less than 1).
 192      * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound An object
 193      * is already bound under the supplied name.
 194      * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 195      * system exceptions.
 196      * @see doBind
 197      */
 198     public void bind_context(NameComponent[] n, NamingContext nc)
 199         throws org.omg.CosNaming.NamingContextPackage.NotFound,
 200                org.omg.CosNaming.NamingContextPackage.CannotProceed,
 201                org.omg.CosNaming.NamingContextPackage.InvalidName,
 202                org.omg.CosNaming.NamingContextPackage.AlreadyBound
 203     {
 204         if( nc == null ) {


 261             // This should not happen
 262             throw wrapper.namingCtxRebindAlreadyBound( ex ) ;
 263         }
 264         if( updateLogger.isLoggable( Level.FINE  ) ) {
 265             // isLoggable call to make sure that we save some precious
 266             // processor cycles, if there is no need to log.
 267             updateLogger.fine( LogKeywords.NAMING_REBIND_SUCCESS + " Name = " +
 268                 NamingUtils.getDirectoryStructuredName( n ) );
 269         }
 270     }
 271 
 272     /**
 273      * Bind a NamingContext under a name in this NamingContext. If the name
 274      * contains multiple (n) components, the first n-1 components will be
 275      * resolved in this NamingContext and the object bound in resulting
 276      * NamingContext. If a binding under the supplied name already exists it
 277      * will be unbound first. The NamingContext will participate in recursive
 278      * resolving.
 279      * @param n a sequence of NameComponents which is the name under which
 280      * the object will be bound.
 281      * @param nc the object reference to be bound.
 282      * @exception org.omg.CosNaming.NamingContextPackage.NotFound A name with
 283      * multiple components was supplied, but the first component could not be
 284      * resolved.
 285      * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed Could not
 286      * proceed in resolving the n-1 components of the supplied name.
 287      * @exception org.omg.CosNaming.NamingContextPackage.InvalidName The
 288      * supplied name is invalid (i.e., has length less than 1).
 289      * @exception org.omg.CORBA.SystemException One of a fixed set of CORBA
 290      * system exceptions.
 291      * @see doBind
 292      */
 293     public  void rebind_context(NameComponent[] n, NamingContext nc)
 294         throws org.omg.CosNaming.NamingContextPackage.NotFound,
 295                org.omg.CosNaming.NamingContextPackage.CannotProceed,
 296                org.omg.CosNaming.NamingContextPackage.InvalidName
 297     {
 298         if( nc == null )
 299         {
 300             updateLogger.warning( LogKeywords.NAMING_REBIND_FAILURE +
 301                 " NULL Context cannot be Bound " );


 836             // It was not a context
 837             throw new NotFound(NotFoundReason.not_context,n);
 838         }
 839 
 840         // Narrow to a naming context
 841         try {
 842             context = NamingContextHelper.narrow(topRef);
 843         } catch (org.omg.CORBA.BAD_PARAM ex) {
 844             // It was not a context
 845             throw new NotFound(NotFoundReason.not_context,n);
 846         }
 847 
 848         // Hmm. must be ok
 849         return context;
 850     }
 851 
 852 
 853    /**
 854     * This operation creates a stringified name from the array of Name
 855     * components.
 856     * @param n Name of the object
 857     * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
 858     * Indicates the name does not identify a binding.

 859     */
 860     public String to_string(org.omg.CosNaming.NameComponent[] n)
 861          throws org.omg.CosNaming.NamingContextPackage.InvalidName
 862     {
 863         // Name valid?
 864         if ( (n == null ) || (n.length == 0) )
 865         {
 866                 throw new InvalidName();
 867         }
 868         NamingContextDataStore impl = (NamingContextDataStore)this;
 869 
 870         String theStringifiedName = insImpl.convertToString( n );
 871 
 872         if( theStringifiedName == null )
 873         {
 874                 throw new InvalidName();
 875         }
 876 
 877         return theStringifiedName;
 878     }
 879 
 880 
 881    /**
 882     * This operation  converts a Stringified Name into an  equivalent array
 883     * of Name Components.
 884     * @param sn Stringified Name of the object
 885     * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
 886     * Indicates the name does not identify a binding.

 887     */
 888     public org.omg.CosNaming.NameComponent[] to_name(String sn)
 889          throws org.omg.CosNaming.NamingContextPackage.InvalidName
 890     {
 891         // Name valid?
 892         if  ( (sn == null ) || (sn.length() == 0) )
 893         {
 894                 throw new InvalidName();
 895         }
 896         NamingContextDataStore impl = (NamingContextDataStore)this;
 897         org.omg.CosNaming.NameComponent[] theNameComponents =
 898                 insImpl.convertToNameComponent( sn );
 899         if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
 900         {
 901                 throw new InvalidName();
 902         }
 903         for( int i = 0; i < theNameComponents.length; i++ ) {
 904             // If there is a name component whose id and kind null or
 905             // zero length string, then an invalid name exception needs to be
 906             // raised.
 907             if ( ( ( theNameComponents[i].id  == null )
 908                  ||( theNameComponents[i].id.length() == 0 ) )
 909                &&( ( theNameComponents[i].kind == null )
 910                  ||( theNameComponents[i].kind.length() == 0 ) ) ) {
 911                 throw new InvalidName();
 912             }
 913         }
 914         return theNameComponents;
 915     }
 916 
 917    /**
 918     * This operation creates a URL based "iiopname://" format name
 919     * from the Stringified Name of the object.
 920     * @param addr internet based address of the host machine where
 921     * Name Service is running
 922     * @param sn Stringified Name of the object
 923     * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
 924     * Indicates the name does not identify a binding.
 925     * @exception org.omg.CosNaming.NamingContextPackage.InvalidAddress
 926     * Indicates the internet based address of the host machine is
 927     * incorrect

 928     */
 929 
 930     public String to_url(String addr, String sn)
 931         throws org.omg.CosNaming.NamingContextExtPackage.InvalidAddress,
 932                org.omg.CosNaming.NamingContextPackage.InvalidName
 933     {
 934         // Name valid?
 935         if  ( (sn == null ) || (sn.length() == 0) )
 936         {
 937             throw new InvalidName();
 938         }
 939         if( addr == null )
 940         {
 941             throw new
 942                 org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
 943         }
 944         NamingContextDataStore impl = (NamingContextDataStore)this;
 945         String urlBasedAddress = null;
 946         urlBasedAddress = insImpl.createURLBasedAddress( addr, sn );
 947         // Extra check to see that corba name url created is valid as per
 948         // INS spec grammer.
 949         try {
 950             INSURLHandler.getINSURLHandler( ).parseURL( urlBasedAddress );
 951         } catch( BAD_PARAM e ) {
 952             throw new
 953                 org.omg.CosNaming.NamingContextExtPackage.InvalidAddress();
 954         }
 955         return urlBasedAddress;
 956     }
 957 
 958     /**
 959      * This operation resolves the Stringified name into the object
 960      * reference.
 961      * @param sn Stringified Name of the object
 962      * @exception org.omg.CosNaming.NamingContextPackage.NotFound
 963      * Indicates there is no object reference for the given name.
 964      * @exception org.omg.CosNaming.NamingContextPackage.CannotProceed
 965      * Indicates that the given compound name is incorrect
 966      * @exception org.omg.CosNaming.NamingContextExtPackage.InvalidName
 967      * Indicates the name does not identify a binding.
 968      * @exception org.omg.CosNaming.NamingContextPackage.AlreadyBound
 969      * Indicates the name is already bound.
 970      *
 971      */
 972     public org.omg.CORBA.Object resolve_str(String sn)
 973         throws org.omg.CosNaming.NamingContextPackage.NotFound,
 974                org.omg.CosNaming.NamingContextPackage.CannotProceed,
 975                org.omg.CosNaming.NamingContextPackage.InvalidName
 976     {
 977         org.omg.CORBA.Object theObject = null;
 978         // Name valid?
 979         if  ( (sn == null ) || (sn.length() == 0) )
 980         {
 981                 throw new InvalidName();
 982         }
 983         NamingContextDataStore impl = (NamingContextDataStore)this;
 984         org.omg.CosNaming.NameComponent[] theNameComponents =
 985                 insImpl.convertToNameComponent( sn );
 986 
 987         if( ( theNameComponents == null ) || (theNameComponents.length == 0 ) )
 988         {
 989                 throw new InvalidName();


< prev index next >