Specification of package Corba.Portableserver.Poa.Impl







 ========================================================================= --
 ===                                                                   === --
 ===                 Top Graph'X CORBA Implementation                  === --
 ===                                                                   === --
 ===                 Copyright (c) 2000, Top Graph'X.                  === --
 ===                                                                   === --
 ===                     --- Copyright Notice ---                      === --
 ===                                                                   === --
 ===    This software is protected as an unpublished work under the    === --
 ===     Copyright Act of 1976.  All rights reserved.  Top Graph'X.    === --
 ===                                                                   === --
 ========================================================================= --

with System ;

with Tgx.Ios ;
with Tgx.Atomic.Queues ;

with Ada.Exceptions ;

with Corba_Ios ;
with Corba.Iop ;
with Corba.Impl ;
with Corba.Policy ;
with Corba.PortableServer.PoaManager.Impl ;
package Corba.PortableServer.Poa.Impl is

   type Object ;
   type Object_Ptr is access all Object'class ;

   protected type Serializer is
      To serialize calls to incarnate, etherealize and other protected operations
      entry Lock ;
      procedure Unlock ;

      entry Own_Poa ;
      procedure Disown_Poa ;

       For deactivation or destruction to work properly
      procedure Add_Request (Oa : in Object_Ptr) ;
      procedure Sub_Request (Oa : in Object_Ptr) ;
      entry Wait_For_No_Request ;

      procedure Set_Destroyed ;
      entry Wait_For_Destruction ;

      procedure Change_State (Status : in Corba.PortableServer.PoaManager.State) ;
      entry Wait_For_End_Holding ;
      entry Wait_For_No_Request_Or_No_Hold ;
      entry Wait_For_No_Request_Or_No_Discard ;
   private
       Guards for entries
      Idle        : Boolean := True ;
      Free        : Boolean := True ;
      Hold        : Boolean := True ;
      Hold_No_Req : Boolean := True ;
      Disc_No_Req : Boolean := True ;
      Destroyed   : Boolean := False ;
      No_Requests : Boolean := True ;
   end Serializer ;

   type Oa_Serializer is access all Serializer ;

   Poa_Priority     : constant := -1 ;
   Context_Priority : constant := -2 ;

   type Object_Map_Data is
   record
      Obj_Id   : Object_Identity;  ObjectId signature
      Reqs     : Unsigned_Long := 0 ;  Number of pending requests
      Obj      : Servant ;
      Id       : ObjectId ;
      Active   : Boolean := False ;  Activity state
      Priority : Short := Poa_Priority ;  RT priority
   end record ;

   package Object_Map_Queues is new Tgx.Atomic.Queues (Object_Map_Data) ;

   subtype Object_Map_Entry is Object_Map_Queues.Queue_Data;
   subtype Object_Map_Node is Object_Map_Queues.Queue_Ptr ;

   type Object_Map_Nodes is array (Object_Identity range <>) of Object_Map_Node ;

   type Object_Map is access all Object_Map_Nodes ;

   type Tag_Array is array (1 .. 4) of Corba.Iop.Profile_Id ;
   type Protocol_Array is array (1 .. 4) of Corba_Ios.Controlled_Stream ;

   type Object is new Corba.Impl.Object with
   record
      Name              : Corba.String;
      Full_Name         : Corba_Ios.Controlled_Stream ;  To be put in IORs
      Parent            : Object_Ptr ;
      Children          : Object_Ptr ;  Chain of children
      Prev_Sibling      : Object_Ptr ;  Link in sibling chain
      Next_Sibling      : Object_Ptr ;  Link in sibling chain
      Manager           : Corba.PortableServer.PoaManager.Impl.Object_Ptr ;
      Activator         : Corba.Impl.Object_Ptr ;
      Servant_Manager   : Corba.Impl.Object_Ptr ;
      Default_Servant   : Servant ;
      Next_Object       : Object_Identity := 1 ;  ObjectId of next to create
      Num_Children      : Natural := 0 ;  Number of child POA
      Requests          : Corba.Unsigned_Long := 0 ;  Number of pending requests
      Mask              : Corba.Octet := 0 ;  Key extra info
      Level             : Corba.Octet := 1 ;  Level in POA tree
      Inactive          : Boolean := False ;  Inactivation began
      Being_Destroyed   : Boolean := False ;  Destruction began
      Etherealize       : Boolean := False ;  Need to etherealize
      Do_Destroy        : Boolean := False ;  A task handles the destruction
      Do_Inactive       : Boolean := False ;  A task handles the inactivation
      Destroyed         : Boolean := False ;  Destruction done

      Active_Map        : Object_Map ;

       Shortcut for finding this POA
      Signature         : Poa_Signature := 0 ;
      Date              : Long := 0 ;
      Unique_Mask       : Unicity_Mask ;

       Policies
      Thread_Model  : ThreadPolicyValue := Orb_Ctrl_Model ;
      Lifespan      : LifespanPolicyValue := Transient ;
      Uniqueness    : IdUniquenessPolicyValue := Unique_Id ;
      IdAssignment  : IdAssignmentPolicyValue := System_Id ;
      Activation    : ImplicitActivationPolicyValue := No_Implicit_Activation ;
      Retention     : ServantRetentionPolicyValue := Retain ;
      Processing    : RequestProcessingPolicyValue := Use_Active_Object_Map_Only ;
       OrbAda additional policies
      Thread_Count  : Thread_Counter := 1 ;
      Priority_Mode : Priority_Mode_Policy_Value := Unchanged ;
      Priority      : System.Priority := System.Default_Priority ;
      TCP_Mode      : TCP_Mode_Policy_Value := Root_Port ;
      TCP_Port      : Corba.Unsigned_Short := 0 ;

       Profile components to be put in IORs
      Components    : Corba_Ios.Controlled_Stream ;
      RTPrio_Offset : Corba_Ios.Stream_Element_Count := 0 ;

       Protocols supported
      Num_Protocols : Natural := 0 ;
      Protocol_Tags : Tag_Array ;
      Protocols     : Protocol_Array ;
      TCP_Server    : Tgx.Ios.Io_Server_Access ;
      Tr1_Server    : Tgx.Ios.Io_Server_Access ;  Additionnal transport
      Tr2_Server    : Tgx.Ios.Io_Server_Access ;  Additionnal transport
      Tr3_Server    : Tgx.Ios.Io_Server_Access ;  Additionnal transport

       Access Protection
      Guard        : Oa_Serializer := new Serializer ;
   end record ;

   procedure Finalize (Self : access Object) ;

   procedure Create_POA
      ( Self : access Object;
        Adapter_Name : in Corba.String;
        A_POAManager : in Corba.PortableServer.POAManager.Ref;
        Policies : in Corba.Policy.PolicyList ;
        Result : in out Ref) ;

   procedure Find_POA
      ( Self : access Object;
        Adapter_Name : in Corba.String;
        Activate_It : in Corba.Boolean ;
        Result : in out Ref) ;

   procedure Destroy
      ( Self : in out Object_Ptr;
        Etherealize_Objects : in Corba.Boolean;
        Wait_For_Completion : in Corba.Boolean) ;

   procedure Create_Thread_Policy
      ( Self : access Object;
        Value : in Corba.PortableServer.ThreadPolicyValue ;
        Result : in out Corba.PortableServer.ThreadPolicy.Ref) ;

   procedure Create_Lifespan_Policy
      ( Self : access Object;
        Value : in Corba.PortableServer.LifespanPolicyValue ;
        Result : in out Corba.PortableServer.LifespanPolicy.Ref) ;

   procedure Create_Id_Uniqueness_Policy
      ( Self : access Object;
        Value : in Corba.PortableServer.IdUniquenessPolicyValue ;
        Result : in out Corba.PortableServer.IdUniquenessPolicy.Ref) ;

   procedure Create_Id_Assignment_Policy
      ( Self : access Object;
        Value : in Corba.PortableServer.IdAssignmentPolicyValue ;
        Result : in out Corba.PortableServer.IdAssignmentPolicy.Ref) ;

   procedure Create_Implicit_Activation_Policy
      ( Self : access Object;
        Value : in Corba.PortableServer.ImplicitActivationPolicyValue ;
        Result : in out Corba.PortableServer.ImplicitActivationPolicy.Ref) ;

   procedure Create_Servant_Retention_Policy
      ( Self : access Object;
        Value : in Corba.PortableServer.ServantRetentionPolicyValue ;
        Result : in out Corba.PortableServer.ServantRetentionPolicy.Ref) ;

   procedure Create_Request_Processing_Policy
      ( Self : access Object;
        Value : in Corba.PortableServer.RequestProcessingPolicyValue ;
        Result : in out Corba.PortableServer.RequestProcessingPolicy.Ref) ;

   procedure Create_Priority_Mode_Policy
      ( Self : access Object;
        Value : in Corba.PortableServer.Priority_Mode_Policy_Value ;
        Result : in out Corba.PortableServer.Priority_Mode_Policy.Ref) ;

   procedure Create_Thread_Count_Policy
      ( Self : access Object;
        Value : in Corba.PortableServer.Thread_Counter ;
        Result : in out Corba.PortableServer.Thread_Count_Policy.Ref) ;

   procedure Create_Tcp_Mode_Policy
      ( Self : access Object;
        Value : in Corba.PortableServer.Tcp_Mode_Policy_Value ;
        Result : in out Corba.PortableServer.Tcp_Mode_Policy.Ref) ;

   procedure Create_Tcp_Port_Policy
      ( Self : access Object;
        Value : in Corba.Unsigned_Short ;
        Result : in out Corba.PortableServer.Tcp_Port_Policy.Ref) ;

   procedure Create_Protocol_Policy
      ( Self : access Object;
        Value : in Corba.String ;
        Result : in out Corba.PortableServer.Protocol_Policy.Ref) ;

   procedure Get_The_Name
      ( Self : access Object ;
        Result : in out Corba.String);

   procedure Get_The_Parent
      ( Self : access Object ;
        Result : in out Ref);

   procedure Get_The_Children
      (Self : access Object ;
        Result : in out Corba.PortableServer.POAList);

   procedure Get_The_POAManager
      (Self : access Object ;
        Result : in out Corba.PortableServer.POAManager.Ref);

   procedure Get_The_Activator
      (Self : access Object ;
        Result : in out Corba.PortableServer.AdapterActivator.Ref);

   procedure Set_The_Activator
      ( Self : access Object ;
        To : in Corba.PortableServer.AdapterActivator.Ref);

   procedure Get_Servant_Manager
      ( Self : access Object ;
        Imgr : in out Corba.PortableServer.ServantManager.Ref'class) ;

   procedure Set_Servant_Manager
      ( Self : access Object;
        Imgr : in Corba.PortableServer.ServantManager.Ref'class) ;

   function Get_Servant
      ( Self : access Object) return Servant ;

   procedure Set_Servant
      ( Self : access Object;
        P_Servant : in Servant) ;

   procedure Activate_Object
      ( Self : access Object;
        P_Servant : in Servant ;
        Result : in out ObjectId ;
        Priority : in Short := Poa_Priority) ;

   procedure Activate_Object_With_Id
      ( Self : access Object;
        Id : in ObjectId;
        P_Servant : in Servant ;
        Priority : in Short := Poa_Priority) ;

   procedure Deactivate_Object
      ( Self : access Object;
        Oid : in ObjectId) ;

   procedure Create_Reference
      ( Self : access Object;
        Intf : in RepositoryId ;
        Result : in out Corba.Object.Ref'class ;
        Priority : in Short := Poa_Priority) ;

   procedure Create_Reference_With_Id
      ( Self : access Object;
        Oid : in ObjectId;
        Intf : in RepositoryId ;
        Result : in out Corba.Object.Ref'class ;
        Priority : in Short := Poa_Priority) ;

   procedure Servant_To_Id
      ( Self : access Object;
        P_Servant : in Servant ;
        Result : in out ObjectId ;
        Priority : out Short) ;

   procedure Servant_To_Reference
      ( Self : access Object;
        P_Servant : in Servant ;
        Result : in out Corba.Object.Ref'class) ;

   function Reference_To_Servant
      ( Self : access Object;
        Reference : in Corba.Object.Ref'class) return Servant ;

   procedure Reference_To_Id
      ( Self : access Object;
        reference : in Corba.Object.Ref'class ;
        Result : in out ObjectId) ;

   function Id_To_Servant
      ( Self : access Object;
        Oid : in ObjectId) return Servant ;

   procedure Id_To_Reference
      ( Self : access Object;
        Oid : in ObjectId ;
        Result : in out Corba.Object.Ref'class) ;

   function Get_Priority
      ( Self : access Object) return System.Priority ;

   procedure Set_Priority
      ( Self     : access Object;
        Priority : in System.Priority) ;

   --------------------
    Methods for MIOP --
   --------------------

   function create_id_for_reference
      ( Self : access Object;
        the_ref : in Corba.Object.Ref)
      return PortableServer.ObjectId ;

   function reference_to_ids
      ( Self : access Object;
        the_ref : in Corba.Object.Ref)
      return PortableServer.IDs ;

   procedure associate_reference_with_id
      ( Self : access Object;
        ref : in Corba.Object.Ref;
        oid : in PortableServer.ObjectId) ;

   procedure disassociate_reference_with_id
      ( Self : access Object;
        ref : in Corba.Object.Ref;
        oid : in PortableServer.ObjectId) ;

    For collocated calls
   procedure Pre_Invoke ( Self : in Object_Ptr ;  Deprecated
                          Obj  : access Servant_Base'class ) ;

   function Pre_Invoke (Obj  : in Corba.Object.Ref'class ) return Object_Ptr ;

   procedure Post_Invoke ( Self : in out Object_Ptr ;
                           Obj  : access Servant_Base'class) ;

    Deactivation on manager request
   procedure Deactivate ( Self                : access Object;
                          Etherealize_Objects : in Corba.Boolean;
                          Wait_For_Completion : in Corba.Boolean) ;


   -----------------------------
    OrbRiver specific methods --
   -----------------------------

   function Add_Id ( Self : access Object;
                     Obj  : in Servant ;
                     Oid  : in ObjectId ;
                     Sig  : in Object_Identity ;
                     Prio : in Short := Poa_Priority) return Boolean ;

   procedure Create_Ior ( Self     : access Object ;
                          Obj      : in Servant ;
                          Type_Id  : in RepositoryId ;
                          Local    : in out Corba.Iop.Local_Ref ;
                          Oid      : in ObjectId ;
                          Remote   : in out Corba.Iop.Remote_Info ;
                          Data     : out Corba_Ios.Stream_Data ;
                          Priority : in Short := Poa_Priority ) ;

   function Get_RT_Priority
      ( Self : access Object) return Short ;

   procedure Handle_Policy_List
      ( Self : access Object;
        Policies : in out Corba.Policy.PolicyList ) ;

   procedure Send_Exception_Reply
      ( Info   : in Positive ;
        Id     : in Corba.Iop.Request_Id ;
        X      : in Ada.Exceptions.Exception_Occurrence ;
        Stream : access Corba_Ios.Iop_Stream_Type) ;

   procedure Service_Send ( Info    : in Positive ;
                            Stream  : access Corba_Ios.Iop_Stream_Type) ;

   procedure Get_And_Dispatch_Message
      (Stream : access Corba_Ios.Iop_Stream_Type) ;

   procedure Get_Message
      ( Channel  : in Tgx.Ios.Io_Connection_Access ;
        Msg_Type : out Corba.Iop.Msg_Type ;
        Stream   : access Corba_Ios.Iop_Stream_Type) ;

   procedure Stop ( Wait_For_Completion : in Boolean) ;

    To get ObjectId from a reference (internal use only)
   function To_OId (Ref : in Corba.Object.Ref'class) return ObjectId ;

    To get ObjectId from a its signature (internal use only)
   function To_OId (Id : in Corba.Object_Identity) return ObjectId ;

    Current needs
   type Current_Data is
   record
      Oa      : Object_Ptr ;
      Obj     : Servant ;
      ObjId   : Corba.Object_Identity ;
      Data    : Corba_Ios.Stream_Data ;
      Index   : Corba_Ios.Stream_Element_Offset ;
      Channel : Tgx.Ios.Io_Connection_Access ;
      Level   : Octet ;
      Mask    : Octet ;
      Prio    : Short ;
   end record ;

   package Current_Info_Queues is new Tgx.Atomic.Queues (Current_Data) ;

   subtype Current_Info is Current_Info_Queues.Queue_Data;
   subtype Current_Info_Ptr is Current_Info_Queues.Queue_Ptr ;

   function Get_Current return Current_Info_Ptr ;
   procedure Set_Current (Val : in Current_Info_Ptr);

   Root_Poa : Object_Ptr ;

    To set the initial bound of agents
    It has only an effect before Orb_Init or between Orb_Init and shutdown
   procedure Set_Initial_Max_Agents (Max : in Natural) ;

end Corba.PortableServer.Poa.Impl ;



List of definition uses










This page was generated by PrismTech's ada2html on Friday Mai 12 2006 16:18