home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / som / include / replicbl.idl < prev    next >
Text File  |  1999-02-22  |  8KB  |  180 lines

  1. //
  2. //   COMPONENT_NAME: somr
  3. //
  4. //   ORIGINS: 27
  5. //
  6. //
  7. //   10H9767, 10H9769  (C) COPYRIGHT International Business Machines Corp. 1992,1994
  8. //   All Rights Reserved
  9. //   Licensed Materials - Property of IBM
  10. //   US Government Users Restricted Rights - Use, duplication or
  11. //   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  12. //
  13. //#  @(#) 2.10 src/somr/replicbl.idl, somr, som2.1 9/1/94 15:52:08 [7/30/96 14:49:30]
  14.  
  15.  
  16.  
  17. #ifndef replicbl_idl
  18. #define replicbl_idl
  19.  
  20. #include "nameable.idl"
  21. #include "linear.idl"
  22. #include <somrerrd.idl>
  23.  
  24. interface SOFTRepmgrAB;
  25. interface Set;
  26.  
  27.  
  28. interface SOMRReplicbl : SOMRNameable , SOMRLinearizable
  29.  
  30. // This class provides a link to the Replication Framework. Any class derived
  31. // from this class can have instances that are replicated in other address
  32. // spaces.  To get the ability to replicate, the derived
  33. // class has to abide by the following rules (these rules are binding on
  34. // further derivations and contained (constituent) subobjects as well):
  35. //
  36. //    1. It must obtain a replica lock before updating its data and must
  37. //       release the same after the update. (i.e., The update methods
  38. //       must bracket their code in a (somrLock, somrReleaseNPropagateUpdate)
  39. //       pair or a (somrLockNLogOp, somrReleaseNPropagateOperation) pair.)
  40. //    2. If after obtaining the replica lock, if the object decides to abort
  41. //       an update operation, it must call the appropriate abort method.
  42. //       (somrReleaseLockNAbortOp or somrReleaseLockNAbortUpdate)
  43. //    3. In case value logging is used, it must have an update language in which
  44. //       changes in the state of the object can be described.
  45. //    4. In case value logging is used, it must provide a method to receive and
  46. //       interpret update messages propagated by other replicas. (i.e., Must implement
  47. //       somrApplyUpdates method. When there are subobjects, this implementation
  48. //       should call them to interpret the updates appropriate to them.)
  49. //    5. It must have methods to get and set the complete state of the object (including
  50. //       any subobjects). (i.e., Must provide implementations for somrGetState
  51. //       and somrSetState.)
  52. //    6. It should be able to receive and interpret data replication
  53. //       directives (e.g., "LOST_CONNECTION", "BECOME_STAND_ALONE", etc. )
  54.  
  55. {
  56.  
  57.   void somrLock() raises(SOMRErrorDefinition::somrException);
  58.   // Get a lock on this replica of the object. An exception is raised if the
  59.   // lock is not obtained.
  60.  
  61.   void somrLockNlogOp( in string ClassName, in string MthdName,
  62.                        in va_list ap) raises (SOMRErrorDefinition::somrException);
  63.   // Similar to somrLock, but it also logs the method (i.e., MthdName) that is
  64.   // requesting the lock.
  65.   // The va_list parameter is for specifying the actual arguments with which "MthdName" is
  66.   // being called.
  67.  
  68.   void somrReleaseNPropagateUpdate( in string clsname, in string buf,
  69.                                      in long len, in long intOid);
  70.   // Release the lock locally and propagate the local updates to master and or
  71.   // other shadows by calling the local replica manager. This propagates
  72.   // "value log" of state changes. The parameter intOid is used to indicate
  73.   // a subobject id to which this update is to be applied. If there are no
  74.   // subobjects, this argument is to be set to 0.
  75.  
  76.   void somrReleaseLockNAbortUpdate();
  77.   // Lets the data replication framework know that the user decided to abort
  78.   // the operation he/she began by calling somrLock. Once a lock is
  79.   // obtained, either this method or somrReleaseNPropagateUpdate must
  80.   // be called.
  81.  
  82.   void somrReleaseNPropagateOperation();
  83.   // Similar to Propagate update, except now propagate the "operation log"
  84.   // instead of the value log  prepared by the subclass implementation.
  85.  
  86.   void somrReleaseLockNAbortOp();
  87.   // Lets the data replication framework know that the user decided to abort
  88.   // the operation that he/she began by calling somrLockNLogOp. Once a lock
  89.   // is obtained, either this method or somrReleaseNPropagateOperation must
  90.   // be called
  91.  
  92.  
  93.   long somrRepInit(in char lType, in char mode) raises (SOMRErrorDefinition::somrException);
  94.   // Makes the object ready for replication. A derived object
  95.   // MUST call this method for activating replica control.  The parameter
  96.   // lType indicates the type of logging used: 'v' for value logging and 'o'
  97.   // for operation logging.  The parameter mode indicates whether the
  98.   // object is opened for reading("r") or writing ("w").
  99.   //
  100.   // If no errors occur, a return value of 1 indicates that this is the first
  101.   // replica to be activated (i.e., the Master), and 0 indicates it is a shadow.
  102.   //
  103.   // If an error occurs, an exception is raised, and the return value is
  104.   // indeterminate (and should be ignored).
  105.   //
  106.   // If the object is already initialized, no action is taken, and a return
  107.   // code of 0 is returned.
  108.  
  109.   void somrRepUninit();
  110.   // Destroys the set up for replication.
  111.   // If the object is not initialized for replication, no action is taken.
  112.  
  113.   void somrApplyUpdates(in string buf, in long len, in long ObjIntId);
  114.   // This method interprets the buffer received as an update to its state.
  115.   // The format of this update is exactly the same as the one used by the
  116.   // subclass implementor for the update buffer passed to ReleaseNPropagateUpdate
  117.   // method. The ObjIntId parameter indicates the internal subobject id to which
  118.   // this update should be applied. If it is 0, then the update is to be applied
  119.   // to self.
  120.  
  121.   void somrDoDirective(in string str);
  122.   // The string gives a directive to the object to implement. The directive usually
  123.   // indications a condition that warrants user intervention/awareness.
  124.  
  125.   void somrPin() raises(SOMRErrorDefinition::somrException);
  126.   // Makes the replica lock obtained by this replica stay with it until a call
  127.   // to UnPin is made.  That is, it makes the replica lock un-preemptible.
  128.   // Raises an Exception if the lock is denied (SOMR_DENIED).
  129.  
  130.   void somrUnPin();
  131.   // Declares the replica lock preemptible. That is, other shadows can grab the
  132.   // replica lock from this shadow.
  133.  
  134.   long somrGetSecurityPolicy();
  135.   //  Returns the security policy for replicated objects that are either
  136.   //  non-persistent or persistent but haven't been created yet.
  137.   //  Caveat: Meaningful only on AIX. Ignored for OS/2.
  138.  
  139.  
  140.  
  141.   #ifdef __SOMIDL__
  142.  
  143.   implementation
  144.   {
  145.     callstyle=idl;
  146.     /* Be careful about adding methods here. There are eight private methods at the end of the
  147.        release order below. If you need to add a new public method at the end, then declare eight
  148.        dummy names to account for these private methods and then add the new one (in the public idl file).
  149.     */
  150.  
  151.     releaseorder: somrLock, somrLockNlogOp,
  152.                   somrReleaseNPropagateUpdate, somrReleaseLockNAbortUpdate,
  153.                   somrReleaseNPropagateOperation, somrReleaseLockNAbortOp,
  154.                   somrSendDirective, somrGetSavePermit,
  155.                   somrRepInit, somrRepUninit,
  156.                   somrApplyUpdates, somrDoDirective,
  157.                   somrPin, somrUnPin, somrGetSecurityPolicy
  158.                   ;
  159.  
  160.     // Class Modifiers
  161.     majorversion = 2; 
  162.     minorversion = 1; 
  163.     filestem = replicbl;
  164.  
  165.     passthru C_h_before =  "#include <somrerrd.h>";
  166.     passthru C_xh_before = "#include <somrerrd.xh>";
  167.  
  168.     // Internal Instance Variables
  169.  
  170.     // Method Modifiers
  171.     somInit: override;
  172.     somUninit: override;
  173.     somrSetObjName: override;
  174.  
  175.   };
  176.   #endif /* __SOMIDL__ */
  177. };
  178.  
  179. #endif  /* replicbl_idl */
  180.