#### 6.9.2 `PolyORB.CORBA_P.Naming_Tools`

         ------------------------------------------------------------------------------
         --                                                                          --
         --                           POLYORB COMPONENTS                             --
         --                                                                          --
         --         P O L Y O R B . C O R B A _ P . N A M I N G _ T O O L S          --
         --                                                                          --
         --                                 S p e c                                  --
         --                                                                          --
         --         Copyright (C) 2001-2008, Free Software Foundation, Inc.          --
         --                                                                          --
         -- PolyORB is free software; you  can  redistribute  it and/or modify it    --
         -- under terms of the  GNU General Public License as published by the  Free --
         -- Software Foundation;  either version 2,  or (at your option)  any  later --
         -- version. PolyORB is distributed  in the hope that it will be  useful,    --
         -- but WITHOUT ANY WARRANTY;  without even the implied warranty of MERCHAN- --
         -- TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public --
         -- License  for more details.  You should have received  a copy of the GNU  --
         -- General Public License distributed with PolyORB; see file COPYING. If    --
         -- not, write to the Free Software Foundation, 51 Franklin Street, Fifth    --
         -- Floor, Boston, MA 02111-1301, USA.                                       --
         --                                                                          --
         --                                                                          --
         --                  PolyORB is maintained by AdaCore                        --
         --                     (email: sales@adacore.com)                           --
         --                                                                          --
         ------------------------------------------------------------------------------

         --  Wrappers for the COS Naming service to facilitate retrievel of object
         --  references by IOR or by name.

         with Ada.Finalization;

         with CORBA.Object;
         with CosNaming.NamingContext;

         package PolyORB.CORBA_P.Naming_Tools is

            function Locate (Name : CosNaming.Name) return CORBA.Object.Ref;

            function Locate
              (Context : CosNaming.NamingContext.Ref;
               Name    : CosNaming.Name) return CORBA.Object.Ref;
            --  Locate an object given its name, given as an array of name components.

            function Locate
              (IOR_Or_Name : String; Sep : Character := '/') return CORBA.Object.Ref;

            function Locate
              (Context     : CosNaming.NamingContext.Ref;
               IOR_Or_Name : String;
               Sep         : Character := '/') return CORBA.Object.Ref;
            --  Locate an object by IOR or name. If the string does not start with
            --  "IOR:", the name will be parsed before it is looked up, using
            --  Parse_Name below.

            procedure Register
              (Name   : String;
               Ref    : CORBA.Object.Ref;
               Rebind : Boolean := False;
               Sep    : Character := '/');
            --  Register an object by its name by binding or rebinding.
            --  The name will be parsed by Parse_Name below; any necessary contexts
            --  will be created on the name server.
            --  If Rebind is True, then a rebind will be performed if the name
            --  is already bound.

            procedure Unregister (Name : String);
            --  Unregister an object by its name by unbinding it

            type Server_Guard is limited private;
            procedure Register
              (Guard  : in out Server_Guard;
               Name   : String;
               Ref    : CORBA.Object.Ref;
               Rebind : Boolean := False;
               Sep    : Character := '/');
            --  A Server_Guard object is an object which is able to register a server
            --  reference in a naming service (see Register above), and destroy this
            --  name using Unregister when the object disappears (the program terminates
            --  or the Server_Guard object lifetime has expired).

            function Parse_Name
              (Name : String;
               Sep : Character := '/') return CosNaming.Name;
            --  Split a sequence of name component specifications separated with Sep
            --  characters into a name component array. Any leading Sep is ignored.

         private
            --  implementation removed
         end PolyORB.CORBA_P.Naming_Tools;