------------------------------------------------------------------------------
--                                                                          --
--                           POLYORB COMPONENTS                             --
--                                                                          --
--                  PORTABLEINTERCEPTOR.SERVERREQUESTINFO                   --
--                                                                          --
--                                 B o d y                                  --
--                                                                          --
--         Copyright (C) 2004-2006, 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)                           --
--                                                                          --
------------------------------------------------------------------------------

with CORBA.Object;
with PortableInterceptor.ServerRequestInfo.Impl;

package body PortableInterceptor.ServerRequestInfo is

   -------------------------------
   -- Add_Reply_Service_Context --
   -------------------------------

   procedure Add_Reply_Service_Context
     (Self            : Local_Ref;
      Service_Context : IOP.ServiceContext;
      Replace         : CORBA.Boolean)
   is
      Self_Ref : constant CORBA.Object.Ref := CORBA.Object.Ref (Self);
   begin

      if CORBA.Object.Is_Nil (Self_Ref) then
         CORBA.Raise_Inv_Objref (CORBA.Default_Sys_Member);
      end if;

      PortableInterceptor.ServerRequestInfo.Impl.Add_Reply_Service_Context
       (PortableInterceptor.ServerRequestInfo.Impl.Object_Ptr
         (Entity_Of (Self)),
        Service_Context,
        Replace);
   end Add_Reply_Service_Context;

   --------------------
   -- Get_Adapter_Id --
   --------------------

   function Get_Adapter_Id (Self : Local_Ref) return AdapterId is
      Self_Ref : constant CORBA.Object.Ref := CORBA.Object.Ref (Self);
   begin

      if CORBA.Object.Is_Nil (Self_Ref) then
         CORBA.Raise_Inv_Objref (CORBA.Default_Sys_Member);
      end if;

      return
        PortableInterceptor.ServerRequestInfo.Impl.Get_Adapter_Id
         (PortableInterceptor.ServerRequestInfo.Impl.Object_Ptr
           (Entity_Of (Self)));
   end Get_Adapter_Id;

   ----------------------
   -- Get_Adapter_Name --
   ----------------------

   function Get_Adapter_Name (Self : Local_Ref) return AdapterName is
      Self_Ref : constant CORBA.Object.Ref := CORBA.Object.Ref (Self);
   begin

      if CORBA.Object.Is_Nil (Self_Ref) then
         CORBA.Raise_Inv_Objref (CORBA.Default_Sys_Member);
      end if;

      return
        PortableInterceptor.ServerRequestInfo.Impl.Get_Adapter_Name
         (PortableInterceptor.ServerRequestInfo.Impl.Object_Ptr
           (Entity_Of (Self)));
   end Get_Adapter_Name;

   -------------------
   -- Get_Object_Id --
   -------------------

   function Get_Object_Id (Self : Local_Ref) return ObjectId is
      Self_Ref : constant CORBA.Object.Ref := CORBA.Object.Ref (Self);
   begin

      if CORBA.Object.Is_Nil (Self_Ref) then
         CORBA.Raise_Inv_Objref (CORBA.Default_Sys_Member);
      end if;

      return
        PortableInterceptor.ServerRequestInfo.Impl.Get_Object_Id
         (PortableInterceptor.ServerRequestInfo.Impl.Object_Ptr
           (Entity_Of (Self)));
   end Get_Object_Id;

   ----------------
   -- Get_ORB_Id --
   ----------------

   function Get_ORB_Id (Self : Local_Ref) return ORBId is
      Self_Ref : constant CORBA.Object.Ref := CORBA.Object.Ref (Self);
   begin

      if CORBA.Object.Is_Nil (Self_Ref) then
         CORBA.Raise_Inv_Objref (CORBA.Default_Sys_Member);
      end if;

      return
        PortableInterceptor.ServerRequestInfo.Impl.Get_ORB_Id
         (PortableInterceptor.ServerRequestInfo.Impl.Object_Ptr
           (Entity_Of (Self)));
   end Get_ORB_Id;

   ---------------------------
   -- Get_Sending_Exception --
   ---------------------------

   function Get_Sending_Exception (Self : Local_Ref) return CORBA.Any is
      Self_Ref : constant CORBA.Object.Ref := CORBA.Object.Ref (Self);
   begin

      if CORBA.Object.Is_Nil (Self_Ref) then
         CORBA.Raise_Inv_Objref (CORBA.Default_Sys_Member);
      end if;

      return
        PortableInterceptor.ServerRequestInfo.Impl.Get_Sending_Exception
         (PortableInterceptor.ServerRequestInfo.Impl.Object_Ptr
           (Entity_Of (Self)));
   end Get_Sending_Exception;

   -------------------
   -- Get_Server_Id --
   -------------------

   function Get_Server_Id (Self : Local_Ref) return ServerId is
      Self_Ref : constant CORBA.Object.Ref := CORBA.Object.Ref (Self);
   begin

      if CORBA.Object.Is_Nil (Self_Ref) then
         CORBA.Raise_Inv_Objref (CORBA.Default_Sys_Member);
      end if;

      return
        PortableInterceptor.ServerRequestInfo.Impl.Get_Server_Id
         (PortableInterceptor.ServerRequestInfo.Impl.Object_Ptr
           (Entity_Of (Self)));
   end Get_Server_Id;

   -----------------------
   -- Get_Server_Policy --
   -----------------------

   function Get_Server_Policy
     (Self   : Local_Ref;
      A_Type : CORBA.PolicyType)
      return CORBA.Policy.Ref
   is
      Self_Ref : constant CORBA.Object.Ref := CORBA.Object.Ref (Self);
   begin

      if CORBA.Object.Is_Nil (Self_Ref) then
         CORBA.Raise_Inv_Objref (CORBA.Default_Sys_Member);
      end if;

      return
        PortableInterceptor.ServerRequestInfo.Impl.Get_Server_Policy
         (PortableInterceptor.ServerRequestInfo.Impl.Object_Ptr
           (Entity_Of (Self)),
          A_Type);
   end Get_Server_Policy;

   ---------------------------------------
   -- Get_Target_Most_Derived_Interface --
   ---------------------------------------

   function Get_Target_Most_Derived_Interface
     (Self : Local_Ref)
      return CORBA.RepositoryId
   is
      Self_Ref : constant CORBA.Object.Ref := CORBA.Object.Ref (Self);
   begin

      if CORBA.Object.Is_Nil (Self_Ref) then
         CORBA.Raise_Inv_Objref (CORBA.Default_Sys_Member);
      end if;

      return
        Impl.Get_Target_Most_Derived_Interface
         (PortableInterceptor.ServerRequestInfo.Impl.Object_Ptr
           (Entity_Of (Self)));
   end Get_Target_Most_Derived_Interface;

   --------------
   -- Set_Slot --
   --------------

   procedure Set_Slot
     (Self : Local_Ref;
      Id   : PortableInterceptor.SlotId;
      Data : CORBA.Any)
   is
      Self_Ref : constant CORBA.Object.Ref := CORBA.Object.Ref (Self);
   begin

      if CORBA.Object.Is_Nil (Self_Ref) then
         CORBA.Raise_Inv_Objref (CORBA.Default_Sys_Member);
      end if;

      PortableInterceptor.ServerRequestInfo.Impl.Set_Slot
       (PortableInterceptor.ServerRequestInfo.Impl.Object_Ptr
         (Entity_Of (Self)),
        Id,
        Data);
   end Set_Slot;

   -----------------
   -- Target_Is_A --
   -----------------

   function Target_Is_A
     (Self : Local_Ref;
      Id   : CORBA.RepositoryId)
      return CORBA.Boolean
   is
      Self_Ref : constant CORBA.Object.Ref := CORBA.Object.Ref (Self);
   begin

      if CORBA.Object.Is_Nil (Self_Ref) then
         CORBA.Raise_Inv_Objref (CORBA.Default_Sys_Member);
      end if;

      return
        PortableInterceptor.ServerRequestInfo.Impl.Target_Is_A
         (PortableInterceptor.ServerRequestInfo.Impl.Object_Ptr
           (Entity_Of (Self)),
          Id);
   end Target_Is_A;

end PortableInterceptor.ServerRequestInfo;
