------------------------------------------------------------------------------
--                                                                          --
--                           POLYORB COMPONENTS                             --
--                                                                          --
--            P O R T A B L E S E R V E R . P O A . H E L P E R             --
--                                                                          --
--                                 B o d y                                  --
--                                                                          --
--         Copyright (C) 2004-2012, Free Software Foundation, Inc.          --
--                                                                          --
-- This is free software;  you can redistribute it  and/or modify it  under --
-- terms of the  GNU General Public License as published  by the Free Soft- --
-- ware  Foundation;  either version 3,  or (at your option) any later ver- --
-- sion.  This software 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.                                               --
--                                                                          --
-- As a special exception under Section 7 of GPL version 3, you are granted --
-- additional permissions described in the GCC Runtime Library Exception,   --
-- version 3.1, as published by the Free Software Foundation.               --
--                                                                          --
-- You should have received a copy of the GNU General Public License and    --
-- a copy of the GCC Runtime Library Exception along with this program;     --
-- see the files COPYING3 and COPYING.RUNTIME respectively.  If not, see    --
-- <http://www.gnu.org/licenses/>.                                          --
--                                                                          --
--                  PolyORB is maintained by AdaCore                        --
--                     (email: sales@adacore.com)                           --
--                                                                          --
------------------------------------------------------------------------------

-------------------------------------------------
--  This file has been generated automatically
--  by IDLAC version 2.3.0w.
--
--  Do NOT hand-modify this file, as your
--  changes will be lost when you re-run the
--  IDL to Ada compiler.
-------------------------------------------------
pragma Style_Checks ("NM32766");

with PolyORB.Utils.Strings;
with PolyORB.Initialization;
pragma Elaborate_All (PolyORB.Initialization);
with PolyORB.Exceptions;
with PolyORB.Std;
with PolyORB.Any;

package body PortableServer.POA.Helper is

   function Unchecked_To_Local_Ref
     (The_Ref : CORBA.Object.Ref'Class)
     return PortableServer.POA.Local_Ref
   is
      Result : PortableServer.POA.Local_Ref;
   begin
      Set (Result,
           CORBA.Object.Object_Of (The_Ref));
      return Result;
   end Unchecked_To_Local_Ref;

   function To_Local_Ref
     (The_Ref : CORBA.Object.Ref'Class)
     return PortableServer.POA.Local_Ref
   is
   begin
      --  XXX This implementation should use the canonical code, as
      --  generated by idlac. This would require CORBA.Object.Is_A to be
      --  modified to recognize the designated built-in entity type as valid
      --  for this logical type.

      --        if CORBA.Object.Is_Nil (The_Ref)
      --        or else CORBA.Object.Is_A (The_Ref, Repository_Id)
      --        then
      --         return Unchecked_To_Ref (The_Ref);
      --        end if;
      --
      --        CORBA.Raise_Bad_Param (CORBA.Default_Sys_Member);

      if CORBA.Object.Entity_Of (The_Ref).all
        not in PolyORB.POA.Obj_Adapter'Class then
         CORBA.Raise_Bad_Param (CORBA.Default_Sys_Member);
      end if;

      return Unchecked_To_Local_Ref (The_Ref);
   end To_Local_Ref;

   function From_Any (Item : CORBA.Any) return PortableServer.POA.AdapterAlreadyExists_Members is
      Result : AdapterAlreadyExists_Members;
      pragma Warnings (Off);
      pragma Unreferenced (Item);
      pragma Warnings (On);
   begin
      return Result;
   end From_Any;

   function To_Any
     (Item : PortableServer.POA.AdapterAlreadyExists_Members) return CORBA.Any is
      Result : constant CORBA.Any :=
        CORBA.Internals.Get_Empty_Any_Aggregate (TC_AdapterAlreadyExists);
      pragma Warnings (Off);
      pragma Unreferenced (Item);
      pragma Warnings (On);
   begin
      return Result;
   end To_Any;

   procedure Raise_AdapterAlreadyExists_From_Any
     (Item    : PolyORB.Any.Any;
      Message : PolyORB.Std.String);
   pragma No_Return (Raise_AdapterAlreadyExists_From_Any);

   procedure Raise_AdapterAlreadyExists_From_Any
     (Item    : PolyORB.Any.Any;
      Message : PolyORB.Std.String)
   is
      Members : constant AdapterAlreadyExists_Members := From_Any (CORBA.Any (Item));
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (AdapterAlreadyExists'Identity,
         Members,
         Message);
   end Raise_AdapterAlreadyExists_From_Any;

   procedure Raise_AdapterAlreadyExists
     (Members : AdapterAlreadyExists_Members)
   is
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (AdapterAlreadyExists'Identity,
         Members);
   end Raise_AdapterAlreadyExists;

   function From_Any (Item : CORBA.Any) return PortableServer.POA.AdapterNonExistent_Members is
      Result : AdapterNonExistent_Members;
      pragma Warnings (Off);
      pragma Unreferenced (Item);
      pragma Warnings (On);
   begin
      return Result;
   end From_Any;

   function To_Any
     (Item : PortableServer.POA.AdapterNonExistent_Members) return CORBA.Any is
      Result : constant CORBA.Any :=
        CORBA.Internals.Get_Empty_Any_Aggregate (TC_AdapterNonExistent);
      pragma Warnings (Off);
      pragma Unreferenced (Item);
      pragma Warnings (On);
   begin
      return Result;
   end To_Any;

   procedure Raise_AdapterNonExistent_From_Any
     (Item    : PolyORB.Any.Any;
      Message : PolyORB.Std.String);
   pragma No_Return (Raise_AdapterNonExistent_From_Any);

   procedure Raise_AdapterNonExistent_From_Any
     (Item    : PolyORB.Any.Any;
      Message : PolyORB.Std.String)
   is
      Members : constant AdapterNonExistent_Members := From_Any (CORBA.Any (Item));
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (AdapterNonExistent'Identity,
         Members,
         Message);
   end Raise_AdapterNonExistent_From_Any;

   procedure Raise_AdapterNonExistent
     (Members : AdapterNonExistent_Members)
   is
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (AdapterNonExistent'Identity,
         Members);
   end Raise_AdapterNonExistent;

   function From_Any (Item : CORBA.Any) return PortableServer.POA.InvalidPolicy_Members is
      Index : CORBA.Any;
      Result_index : CORBA.Unsigned_Short;
   begin
      Index := CORBA.Internals.Get_Aggregate_Element (Item,
                                            CORBA.TC_Unsigned_Short,
                                            CORBA.Unsigned_Long ( 0));
      Result_index := CORBA.From_Any (Index);
      return
         (index => Result_index);
   end From_Any;

   function To_Any
     (Item : PortableServer.POA.InvalidPolicy_Members) return CORBA.Any is
      Result : CORBA.Any :=
        CORBA.Internals.Get_Empty_Any_Aggregate (TC_InvalidPolicy);
   begin
      CORBA.Internals.Add_Aggregate_Element
         (Result, CORBA.To_Any (Item.index));
      return Result;
   end To_Any;

   procedure Raise_InvalidPolicy_From_Any
     (Item    : PolyORB.Any.Any;
      Message : PolyORB.Std.String);
   pragma No_Return (Raise_InvalidPolicy_From_Any);

   procedure Raise_InvalidPolicy_From_Any
     (Item    : PolyORB.Any.Any;
      Message : PolyORB.Std.String)
   is
      Members : constant InvalidPolicy_Members := From_Any (CORBA.Any (Item));
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (InvalidPolicy'Identity,
         Members,
         Message);
   end Raise_InvalidPolicy_From_Any;

   procedure Raise_InvalidPolicy
     (Members : InvalidPolicy_Members)
   is
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (InvalidPolicy'Identity,
         Members);
   end Raise_InvalidPolicy;

   function From_Any (Item : CORBA.Any) return PortableServer.POA.NoServant_Members is
      Result : NoServant_Members;
      pragma Warnings (Off);
      pragma Unreferenced (Item);
      pragma Warnings (On);
   begin
      return Result;
   end From_Any;

   function To_Any
     (Item : PortableServer.POA.NoServant_Members) return CORBA.Any is
      Result : constant CORBA.Any :=
        CORBA.Internals.Get_Empty_Any_Aggregate (TC_NoServant);
      pragma Warnings (Off);
      pragma Unreferenced (Item);
      pragma Warnings (On);
   begin
      return Result;
   end To_Any;

   procedure Raise_NoServant_From_Any
     (Item    : PolyORB.Any.Any;
      Message : PolyORB.Std.String);
   pragma No_Return (Raise_NoServant_From_Any);

   procedure Raise_NoServant_From_Any
     (Item    : PolyORB.Any.Any;
      Message : PolyORB.Std.String)
   is
      Members : constant NoServant_Members := From_Any (CORBA.Any (Item));
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (NoServant'Identity,
         Members,
         Message);
   end Raise_NoServant_From_Any;

   procedure Raise_NoServant
     (Members : NoServant_Members)
   is
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (NoServant'Identity,
         Members);
   end Raise_NoServant;

   function From_Any (Item : CORBA.Any) return PortableServer.POA.ObjectAlreadyActive_Members is
      Result : ObjectAlreadyActive_Members;
      pragma Warnings (Off);
      pragma Unreferenced (Item);
      pragma Warnings (On);
   begin
      return Result;
   end From_Any;

   function To_Any
     (Item : PortableServer.POA.ObjectAlreadyActive_Members) return CORBA.Any is
      Result : constant CORBA.Any :=
        CORBA.Internals.Get_Empty_Any_Aggregate (TC_ObjectAlreadyActive);
      pragma Warnings (Off);
      pragma Unreferenced (Item);
      pragma Warnings (On);
   begin
      return Result;
   end To_Any;

   procedure Raise_ObjectAlreadyActive_From_Any
     (Item    : PolyORB.Any.Any;
      Message : PolyORB.Std.String);
   pragma No_Return (Raise_ObjectAlreadyActive_From_Any);

   procedure Raise_ObjectAlreadyActive_From_Any
     (Item    : PolyORB.Any.Any;
      Message : PolyORB.Std.String)
   is
      Members : constant ObjectAlreadyActive_Members := From_Any (CORBA.Any (Item));
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (ObjectAlreadyActive'Identity,
         Members,
         Message);
   end Raise_ObjectAlreadyActive_From_Any;

   procedure Raise_ObjectAlreadyActive
     (Members : in ObjectAlreadyActive_Members)
   is
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (ObjectAlreadyActive'Identity,
         Members);
   end Raise_ObjectAlreadyActive;

   function From_Any (Item : CORBA.Any) return PortableServer.POA.ObjectNotActive_Members is
      Result : ObjectNotActive_Members;
      pragma Warnings (Off);
      pragma Unreferenced (Item);
      pragma Warnings (On);
   begin
      return Result;
   end From_Any;

   function To_Any
     (Item : PortableServer.POA.ObjectNotActive_Members) return CORBA.Any is
      Result : constant CORBA.Any :=
        CORBA.Internals.Get_Empty_Any_Aggregate (TC_ObjectNotActive);
      pragma Warnings (Off);
      pragma Unreferenced (Item);
      pragma Warnings (On);
   begin
      return Result;
   end To_Any;

   procedure Raise_ObjectNotActive_From_Any
     (Item    : PolyORB.Any.Any;
      Message : PolyORB.Std.String);
   pragma No_Return (Raise_ObjectNotActive_From_Any);

   procedure Raise_ObjectNotActive_From_Any
     (Item    : PolyORB.Any.Any;
      Message : PolyORB.Std.String)
   is
      Members : constant ObjectNotActive_Members := From_Any (CORBA.Any (Item));
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (ObjectNotActive'Identity,
         Members,
         Message);
   end Raise_ObjectNotActive_From_Any;

   procedure Raise_ObjectNotActive
     (Members : in ObjectNotActive_Members)
   is
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (ObjectNotActive'Identity,
         Members);
   end Raise_ObjectNotActive;

   function From_Any (Item : CORBA.Any) return PortableServer.POA.ServantAlreadyActive_Members is
      Result : ServantAlreadyActive_Members;
      pragma Warnings (Off);
      pragma Unreferenced (Item);
      pragma Warnings (On);
   begin
      return Result;
   end From_Any;

   function To_Any
     (Item : PortableServer.POA.ServantAlreadyActive_Members) return CORBA.Any is
      Result : constant CORBA.Any :=
        CORBA.Internals.Get_Empty_Any_Aggregate (TC_ServantAlreadyActive);
      pragma Warnings (Off);
      pragma Unreferenced (Item);
      pragma Warnings (On);
   begin
      return Result;
   end To_Any;

   procedure Raise_ServantAlreadyActive_From_Any
     (Item    : PolyORB.Any.Any;
      Message : PolyORB.Std.String);
   pragma No_Return (Raise_ServantAlreadyActive_From_Any);

   procedure Raise_ServantAlreadyActive_From_Any
     (Item    : PolyORB.Any.Any;
      Message : PolyORB.Std.String)
   is
      Members : constant ServantAlreadyActive_Members := From_Any (CORBA.Any (Item));
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (ServantAlreadyActive'Identity,
         Members,
         Message);
   end Raise_ServantAlreadyActive_From_Any;

   procedure Raise_ServantAlreadyActive
     (Members : ServantAlreadyActive_Members)
   is
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (ServantAlreadyActive'Identity,
         Members);
   end Raise_ServantAlreadyActive;

   function From_Any (Item : CORBA.Any) return PortableServer.POA.ServantNotActive_Members is
      Result : ServantNotActive_Members;
      pragma Warnings (Off);
      pragma Unreferenced (Item);
      pragma Warnings (On);
   begin
      return Result;
   end From_Any;

   function To_Any
     (Item : PortableServer.POA.ServantNotActive_Members) return CORBA.Any is
      Result : constant CORBA.Any :=
        CORBA.Internals.Get_Empty_Any_Aggregate (TC_ServantNotActive);
      pragma Warnings (Off);
      pragma Unreferenced (Item);
      pragma Warnings (On);
   begin
      return Result;
   end To_Any;

   procedure Raise_ServantNotActive_From_Any
     (Item    : PolyORB.Any.Any;
      Message : PolyORB.Std.String);
   pragma No_Return (Raise_ServantNotActive_From_Any);

   procedure Raise_ServantNotActive_From_Any
     (Item    : PolyORB.Any.Any;
      Message : PolyORB.Std.String)
   is
      Members : constant ServantNotActive_Members := From_Any (CORBA.Any (Item));
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (ServantNotActive'Identity,
         Members,
         Message);
   end Raise_ServantNotActive_From_Any;

   procedure Raise_ServantNotActive
     (Members : ServantNotActive_Members)
   is
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (ServantNotActive'Identity,
         Members);
   end Raise_ServantNotActive;

   function From_Any (Item : CORBA.Any) return PortableServer.POA.WrongAdapter_Members is
      Result : WrongAdapter_Members;
      pragma Warnings (Off);
      pragma Unreferenced (Item);
      pragma Warnings (On);
   begin
      return Result;
   end From_Any;

   function To_Any
     (Item : PortableServer.POA.WrongAdapter_Members) return CORBA.Any is
      Result : constant CORBA.Any :=
        CORBA.Internals.Get_Empty_Any_Aggregate (TC_WrongAdapter);
      pragma Warnings (Off);
      pragma Unreferenced (Item);
      pragma Warnings (On);
   begin
      return Result;
   end To_Any;

   procedure Raise_WrongAdapter_From_Any
     (Item    : PolyORB.Any.Any;
      Message : PolyORB.Std.String);
   pragma No_Return (Raise_WrongAdapter_From_Any);

   procedure Raise_WrongAdapter_From_Any
     (Item    : PolyORB.Any.Any;
      Message : PolyORB.Std.String)
   is
      Members : constant WrongAdapter_Members := From_Any (CORBA.Any (Item));
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (WrongAdapter'Identity,
         Members,
         Message);
   end Raise_WrongAdapter_From_Any;

   procedure Raise_WrongAdapter
     (Members : WrongAdapter_Members)
   is
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (WrongAdapter'Identity,
         Members);
   end Raise_WrongAdapter;

   function From_Any (Item : CORBA.Any) return PortableServer.POA.WrongPolicy_Members is
      Result : WrongPolicy_Members;
      pragma Warnings (Off);
      pragma Unreferenced (Item);
      pragma Warnings (On);
   begin
      return Result;
   end From_Any;

   function To_Any
     (Item : PortableServer.POA.WrongPolicy_Members) return CORBA.Any is
      Result : constant CORBA.Any :=
        CORBA.Internals.Get_Empty_Any_Aggregate (TC_WrongPolicy);
      pragma Warnings (Off);
      pragma Unreferenced (Item);
      pragma Warnings (On);
   begin
      return Result;
   end To_Any;

   procedure Raise_WrongPolicy_From_Any
     (Item    : PolyORB.Any.Any;
      Message : PolyORB.Std.String);
   pragma No_Return (Raise_WrongPolicy_From_Any);

   procedure Raise_WrongPolicy_From_Any
     (Item    : PolyORB.Any.Any;
      Message : PolyORB.Std.String)
   is
      Members : constant WrongPolicy_Members := From_Any (CORBA.Any (Item));
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (WrongPolicy'Identity,
         Members,
         Message);
   end Raise_WrongPolicy_From_Any;

   procedure Raise_WrongPolicy
     (Members : WrongPolicy_Members)
   is
   begin
      PolyORB.Exceptions.User_Raise_Exception
        (WrongPolicy'Identity,
         Members);
   end Raise_WrongPolicy;

   procedure Deferred_Initialization is
   begin

      declare
         Name : constant CORBA.String := CORBA.To_CORBA_String ("POA");
         Id : constant CORBA.String := CORBA.To_CORBA_String ("IDL:omg.org/PortableServer/POA:1.0");
      begin
         TC_POA :=
           CORBA.TypeCode.Internals.To_CORBA_Object (PolyORB.Any.TypeCode.TCF_Object);
         CORBA.Internals.Add_Parameter (TC_POA, CORBA.To_Any (Name));
         CORBA.Internals.Add_Parameter (TC_POA, CORBA.To_Any (Id));
      end;

      declare
         Name : constant CORBA.String := CORBA.To_CORBA_String ("AdapterAlreadyExists");
         Id : constant CORBA.String := CORBA.To_CORBA_String ("IDL:omg.org/PortableServer/POA/AdapterAlreadyExists:1.0");
      begin
         TC_AdapterAlreadyExists :=
           CORBA.TypeCode.Internals.To_CORBA_Object (PolyORB.Any.TypeCode.TCF_Except);
         CORBA.Internals.Add_Parameter (TC_AdapterAlreadyExists, CORBA.To_Any (Name));
         CORBA.Internals.Add_Parameter (TC_AdapterAlreadyExists, CORBA.To_Any (Id));
      end;
      PolyORB.Exceptions.Register_Exception
        (CORBA.TypeCode.Internals.To_PolyORB_Object (TC_AdapterAlreadyExists),
         Raise_AdapterAlreadyExists_From_Any'Access);

      declare
         Name : constant CORBA.String := CORBA.To_CORBA_String ("AdapterNonExistent");
         Id : constant CORBA.String := CORBA.To_CORBA_String ("IDL:omg.org/PortableServer/POA/AdapterNonExistent:1.0");
      begin
         TC_AdapterNonExistent :=
           CORBA.TypeCode.Internals.To_CORBA_Object (PolyORB.Any.TypeCode.TCF_Except);
         CORBA.Internals.Add_Parameter (TC_AdapterNonExistent, CORBA.To_Any (Name));
         CORBA.Internals.Add_Parameter (TC_AdapterNonExistent, CORBA.To_Any (Id));
      end;
      PolyORB.Exceptions.Register_Exception
        (CORBA.TypeCode.Internals.To_PolyORB_Object (TC_AdapterNonExistent),
         Raise_AdapterNonExistent_From_Any'Access);

      declare
         Name : constant CORBA.String := CORBA.To_CORBA_String ("InvalidPolicy");
         Id : constant CORBA.String := CORBA.To_CORBA_String ("IDL:omg.org/PortableServer/POA/InvalidPolicy:1.0");
         Arg_Name_index : constant CORBA.String := CORBA.To_CORBA_String ("index");
      begin
         TC_InvalidPolicy :=
           CORBA.TypeCode.Internals.To_CORBA_Object (PolyORB.Any.TypeCode.TCF_Except);
         CORBA.Internals.Add_Parameter (TC_InvalidPolicy, CORBA.To_Any (Name));
         CORBA.Internals.Add_Parameter (TC_InvalidPolicy, CORBA.To_Any (Id));
         CORBA.Internals.Add_Parameter (TC_InvalidPolicy, CORBA.To_Any (CORBA.TC_Unsigned_Short));
         CORBA.Internals.Add_Parameter (TC_InvalidPolicy, CORBA.To_Any (Arg_Name_index));
      end;
      PolyORB.Exceptions.Register_Exception
        (CORBA.TypeCode.Internals.To_PolyORB_Object (TC_InvalidPolicy),
         Raise_InvalidPolicy_From_Any'Access);

      declare
         Name : constant CORBA.String := CORBA.To_CORBA_String ("NoServant");
         Id : constant CORBA.String := CORBA.To_CORBA_String ("IDL:omg.org/PortableServer/POA/NoServant:1.0");
      begin
         TC_NoServant :=
           CORBA.TypeCode.Internals.To_CORBA_Object (PolyORB.Any.TypeCode.TCF_Except);
         CORBA.Internals.Add_Parameter (TC_NoServant, CORBA.To_Any (Name));
         CORBA.Internals.Add_Parameter (TC_NoServant, CORBA.To_Any (Id));
      end;
      PolyORB.Exceptions.Register_Exception
        (CORBA.TypeCode.Internals.To_PolyORB_Object (TC_NoServant),
         Raise_NoServant_From_Any'Access);

      declare
         Name : constant CORBA.String := CORBA.To_CORBA_String ("ObjectAlreadyActive");
         Id : constant CORBA.String := CORBA.To_CORBA_String ("IDL:omg.org/PortableServer/POA/ObjectAlreadyActive:1.0");
      begin
         TC_ObjectAlreadyActive :=
           CORBA.TypeCode.Internals.To_CORBA_Object (PolyORB.Any.TypeCode.TCF_Except);
         CORBA.Internals.Add_Parameter (TC_ObjectAlreadyActive, CORBA.To_Any (Name));
         CORBA.Internals.Add_Parameter (TC_ObjectAlreadyActive, CORBA.To_Any (Id));
      end;
      PolyORB.Exceptions.Register_Exception
        (CORBA.TypeCode.Internals.To_PolyORB_Object (TC_ObjectAlreadyActive),
         Raise_ObjectAlreadyActive_From_Any'Access);

      declare
         Name : constant CORBA.String := CORBA.To_CORBA_String ("ObjectNotActive");
         Id : constant CORBA.String := CORBA.To_CORBA_String ("IDL:omg.org/PortableServer/POA/ObjectNotActive:1.0");
      begin
         TC_ObjectNotActive :=
           CORBA.TypeCode.Internals.To_CORBA_Object (PolyORB.Any.TypeCode.TCF_Except);
         CORBA.Internals.Add_Parameter (TC_ObjectNotActive, CORBA.To_Any (Name));
         CORBA.Internals.Add_Parameter (TC_ObjectNotActive, CORBA.To_Any (Id));
      end;
      PolyORB.Exceptions.Register_Exception
        (CORBA.TypeCode.Internals.To_PolyORB_Object (TC_ObjectNotActive),
         Raise_ObjectNotActive_From_Any'Access);

      declare
         Name : constant CORBA.String := CORBA.To_CORBA_String ("ServantAlreadyActive");
         Id : constant CORBA.String := CORBA.To_CORBA_String ("IDL:omg.org/PortableServer/POA/ServantAlreadyActive:1.0");
      begin
         TC_ServantAlreadyActive :=
           CORBA.TypeCode.Internals.To_CORBA_Object (PolyORB.Any.TypeCode.TCF_Except);
         CORBA.Internals.Add_Parameter (TC_ServantAlreadyActive, CORBA.To_Any (Name));
         CORBA.Internals.Add_Parameter (TC_ServantAlreadyActive, CORBA.To_Any (Id));
      end;
      PolyORB.Exceptions.Register_Exception
        (CORBA.TypeCode.Internals.To_PolyORB_Object (TC_ServantAlreadyActive),
         Raise_ServantAlreadyActive_From_Any'Access);

      declare
         Name : constant CORBA.String := CORBA.To_CORBA_String ("ServantNotActive");
         Id : constant CORBA.String := CORBA.To_CORBA_String ("IDL:omg.org/PortableServer/POA/ServantNotActive:1.0");
      begin
         TC_ServantNotActive :=
           CORBA.TypeCode.Internals.To_CORBA_Object (PolyORB.Any.TypeCode.TCF_Except);
         CORBA.Internals.Add_Parameter (TC_ServantNotActive, CORBA.To_Any (Name));
         CORBA.Internals.Add_Parameter (TC_ServantNotActive, CORBA.To_Any (Id));
      end;
      PolyORB.Exceptions.Register_Exception
        (CORBA.TypeCode.Internals.To_PolyORB_Object (TC_ServantNotActive),
         Raise_ServantNotActive_From_Any'Access);

      declare
         Name : constant CORBA.String := CORBA.To_CORBA_String ("WrongAdapter");
         Id : constant CORBA.String := CORBA.To_CORBA_String ("IDL:omg.org/PortableServer/POA/WrongAdapter:1.0");
      begin
         TC_WrongAdapter :=
           CORBA.TypeCode.Internals.To_CORBA_Object (PolyORB.Any.TypeCode.TCF_Except);
         CORBA.Internals.Add_Parameter (TC_WrongAdapter, CORBA.To_Any (Name));
         CORBA.Internals.Add_Parameter (TC_WrongAdapter, CORBA.To_Any (Id));
      end;
      PolyORB.Exceptions.Register_Exception
        (CORBA.TypeCode.Internals.To_PolyORB_Object (TC_WrongAdapter),
         Raise_WrongAdapter_From_Any'Access);

      declare
         Name : constant CORBA.String := CORBA.To_CORBA_String ("WrongPolicy");
         Id : constant CORBA.String := CORBA.To_CORBA_String ("IDL:omg.org/PortableServer/POA/WrongPolicy:1.0");
      begin
         TC_WrongPolicy :=
           CORBA.TypeCode.Internals.To_CORBA_Object (PolyORB.Any.TypeCode.TCF_Except);
         CORBA.Internals.Add_Parameter (TC_WrongPolicy, CORBA.To_Any (Name));
         CORBA.Internals.Add_Parameter (TC_WrongPolicy, CORBA.To_Any (Id));
      end;
      PolyORB.Exceptions.Register_Exception
        (CORBA.TypeCode.Internals.To_PolyORB_Object (TC_WrongPolicy),
         Raise_WrongPolicy_From_Any'Access);

   end Deferred_Initialization;

begin
   declare
      use PolyORB.Initialization;
      use PolyORB.Initialization.String_Lists;
      use PolyORB.Utils.Strings;
   begin
      Register_Module
        (Module_Info'
         (Name      => +"PortableServer.POA.Helper",
          Conflicts => PolyORB.Initialization.String_Lists.Empty,
          Depends   =>
                  +"any"
                  & "exceptions"
                  & "exceptions"
                  & "exceptions"
                  & "exceptions"
                  & "exceptions"
                  & "exceptions"
                  & "exceptions"
                  & "exceptions"
                  & "exceptions"
                  & "exceptions"
          ,
          Provides  => PolyORB.Initialization.String_Lists.Empty,
          Implicit  => False,
          Init      => Deferred_Initialization'Access,
          Shutdown  => null));
   end;

end PortableServer.POA.Helper;
