home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / opendc12.zip / od124os2.exe / od12osr1.exe / src / ILNKSRVC.idl < prev    next >
Text File  |  1997-03-21  |  14KB  |  319 lines

  1. /* @(#)Z 1.3 os2/src/storage/idl/ILNKSRVC.idl, oddataxfer, od96os2, odos29712d 97/03/21 17:21:40 (96/08/23 01:43:28) */
  2. //#====START_GENERATED_PROLOG======================================
  3. //#
  4. //#
  5. //#   COMPONENT_NAME: oddataxfer
  6. //#
  7. //#   CLASSES: none
  8. //#
  9. //#   ORIGINS: 82,27
  10. //#
  11. //#
  12. //#   (C) COPYRIGHT International Business Machines Corp. 1995,1996
  13. //#   All Rights Reserved
  14. //#   Licensed Materials - Property of IBM
  15. //#   US Government Users Restricted Rights - Use, duplication or
  16. //#   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  17. //#       
  18. //#   IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  19. //#   ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
  20. //#   PURPOSE. IN NO EVENT SHALL IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  21. //#   CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  22. //#   USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  23. //#   OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE
  24. //#   OR PERFORMANCE OF THIS SOFTWARE.
  25. //#
  26. //#====END_GENERATED_PROLOG========================================
  27. //#
  28.  
  29. /********************************************************************/
  30. /*                                                                  */
  31. /* Copyright (C) Apple Computer, Inc., 1994                         */
  32. /*                                                                  */
  33. /********************************************************************/
  34.  
  35. #ifndef _ILNKSRVC_
  36. #define _ILNKSRVC_
  37.  
  38. #include <somobj.idl>
  39. #include <odtypesb.idl>
  40. #include <ODObject.idl>
  41. #include <IODDefs.idl>
  42. #include <ILSv2AS.idl>
  43. #include <IAS2Lsv.idl>
  44. #include <cmlksitr.idl>
  45.  
  46. #ifdef __PRIVATE__
  47.   #ifndef _OpenHashTable_
  48.     #define _OpenHashTable_
  49.     typedef somToken OpenHashTable;
  50.   #endif
  51. #endif //__PRIVATE__
  52.  
  53. interface IODLinkTarget;
  54. interface IODAvailServer;
  55. interface IODLinkTargetToLinkSource;
  56. interface ODDraft;
  57. interface ODLinkSource;
  58. interface ODPart;
  59. interface CMLinkSourceIterator;
  60. interface CMLinkIterator;
  61. interface IODMutex;
  62.  
  63.  
  64. /*
  65.  * The LinkService is analogous to the LinkManager in the Apple Design.
  66.  * There is one LinkService instance per ODSession.
  67.  * The LinkService keeps track of all the LinkSource
  68.  * objects in each writable draft.
  69.  * For each such writable draft (which we call an "opened" draft)
  70.  * it knows which Availability Server is responsible for
  71.  * serving as surrogate when the draft closes and for
  72.  * saving the auxiliary state.
  73.  * The LinkService is called by the doc-shell at open time,
  74.  * at close time, and at save time.It is called by the
  75.  * Draft at LinkSource creation time.
  76.  * The LinkService also is called from a LinkSpec when
  77.  * a target document tries to issue GetLink on that LinkSpec.
  78.  * (***note*** in the current implementation, we assume
  79.  * that link-service is in 1-1 correspondence with drafts.
  80.  * When we change the implementation so that this is no
  81.  * longer the case, LinkSpecs will either have to have
  82.  * draft parameters, or they will need to locate the
  83.  * draft via the part object.)
  84.  * Eventually , we want the linksrvc to have a table of link targets,
  85.  * so that there can be a centralized place to query all links owned
  86.  * by Document and show them(Note only loaded links, known to the
  87.  * Draft).
  88.  */
  89.  
  90.  
  91.  
  92. interface IODLinkService : SOMObject
  93. {
  94.   #ifdef __PRIVATE__
  95.  
  96.     void CleanupLinkServiceProperties ();
  97.  
  98.     void EstablishLinkFromTSpec (in ODULong pid,
  99.                                  in ODStorageUnitID srcPartSUID,
  100.                                  in ODByteArray data,
  101.                                  in ODLinkConnectionData* trgtPartDesc,
  102.                                  in IODLinkTarget linkTrgt,
  103.                                  out ODLinkID linkid,
  104.                                  out IODLinkTargetToLinkSource linkSrc,
  105.                                  out ODLinkConnectionID trgtID,
  106.                                  out ODBoolean isLocal,
  107.                                  out ODBoolean trackTrgt,
  108.                                  out ODISOStr  ASName  /* name of availability server  */
  109.                                  );
  110.       // EstablishLinkFromTSpec:
  111.       // Called in LinkSpec::EstablishLink to establish a new link
  112.       // to the Part with sourcePartSUID.
  113.  
  114.     void DraftOpened(in ODDraft draft,   /* draft owning linksources      */
  115.                      in ODBoolean isNew, /* True means use default AS and */
  116.                                          /* start empty LinkSrc Table     */
  117.                                          /* False means use AS saved in   */
  118.                                          /* draft props and get the       */
  119.                                          /* LinkSrc Table from draft props*/
  120.                      in IODFileName pathName /* name from which doc was read */
  121.                      );
  122.       // Called by the Docshell after new writeable draft of
  123.       // a read-write document is opened (internalized)
  124.       // Reads persistent information about an existing document
  125.       // and calls "Open" on the AS; else calls "Register" on
  126.       // the AS.  Initializes table of link sources for this draft.
  127.       // (In this implementation, only one table per LinkService supported
  128.  
  129.  
  130.     void DraftMoved(in ODDraft draft,   /* draft owning linksources */
  131.                     in IODFileName oldPathName, /* name of old path of doc file*/
  132.                     in IODFileName newPathName /* name of new path of doc file*/
  133.                    );
  134.       // Called by the Docshell when a draft is moved.
  135.       // The draft must be in open state.
  136.       // Gets the old pathname from draft properties, and passes
  137.       // both the new and the old pathnames to availability server's DocMoved.
  138.       // Saves the new pathname to storage.
  139.  
  140.     void DraftClosing(in ODDraft draft);
  141.       // DraftClosing:
  142.       // Called by the Docshell when a draft opened with DraftOpened
  143.       // is closed.
  144.       // Goes over LinkSrcInfos table and:
  145.       // -For each unsaved LinkSrc notifies the AS to remove it.
  146.       // -For each open LinkSrc notifies the AS that it is closing.
  147.  
  148.     void DraftSaving(in ODDraft draft);
  149.       // Called by the Docshell/Draft BEFORE a draft is saved.
  150.       // The LinkService will externalize its properties as
  151.       // well as the LinkSrcInfos hash table into the draft properties.
  152.       // The LinkService will go over LinkSrcInfos hash table
  153.       // and set the saved bit on each entry to true (in order
  154.       // to keep track of which linksources have never been saved).
  155.  
  156.     ODBoolean UnsavedExportedLinks (in ODDraft draft);
  157.       // UnsavedExportedLinks: Currently unused.
  158.       // Allows LinkSource to discover whether there are cross-document
  159.       // links which would be lost if the user fails to save now.
  160.  
  161.     ODLinkID RegisterLinkSource(in ODDraft draft,
  162.                                 in ODStorageUnitID suid,
  163.                                 in ODLinkSource linkSource,
  164.                                 in ODPart part,
  165.                                 out ODISOStr ASName);
  166.      // RegisterLinkSource:
  167.      // Called by draft when a new link source is being
  168.      // created.  The DocShell must have previously issued DraftOpened.
  169.      // The LinkService will remember the linkSource and
  170.      // suid; it will register the linkSource with the AS.
  171.      // What is returned is the linkid and ASname
  172.  
  173.     void RegisterLinkTarget(in ODStorageUnitID trgtPartSUID,
  174.                                 in IODLinkTarget linkTrgt);
  175.  
  176.      // RegisterLinkTarget:
  177.      // Called by linkspec when a new link is being
  178.      // created.  Will add new target to target table.
  179.  
  180.     ODLinkID OpenLinkSource(in ODDraft draft,
  181.                         in ODStorageUnitID suid, /* for checking only */
  182.                         in ODLinkSource linkSource,
  183.                         in ODLinkID linkid,
  184.                         out IODAuxiliaryState *auxState,
  185.                         out ODBoolean isLocked,
  186.                         out ODISOStr ASName);
  187.  
  188.      // OpenLinkSource:
  189.      // Called by the draft when an existing link source is being
  190.      // internalized and the draft is read/write.  The draft must
  191.      // have previously issued DraftOpened.
  192.      // The LinkService will retrieve auxState and isLocked
  193.      // by calling the Availability server's OpenLinkSource;
  194.      // it will remember the location of the linkSource.
  195.      // If the linksource is detected as being a copy,
  196.      // the linkservice will register the linksource with
  197.      // the availability server.
  198.      // What is returned is the ASName and an ODLinkID
  199.      // which is 0 if the linksource is an original,
  200.      // and a new linkid if the linksource was a copy and
  201.      // re-registered.
  202.  
  203.     ODLinkSource  InternalizeLinkSource( in ODLinkID linkid,
  204.                                            in IODAuxiliaryState auxState);
  205.  
  206.      // InternalizeLinkSource:
  207.      // Called by the Availability Server to internalize a Link
  208.      // Source from storage.
  209.      // If the LS is already opened - will return a pointer to it.
  210.      // Otherwise, queries the LinkSrcInfos Hashtable for this
  211.      // Link Source's storage unit reference using the LinkId as key,
  212.      // Gets the storage unit ID from the storage unit reference,
  213.      // Calls draft to get back a linksource pointer, updates the
  214.      // table and returns the pointer to the Link Source.
  215.  
  216.     ODStorageUnitID  GetLinkSrcInDraft(in ODDraft draft,   /* draft owning linksources */
  217.                                        in ODLinkID linkid  /* linkid of LinkSrc whose  */
  218.                                                            /* storage unit is needed   */
  219.                                       );
  220.       // Called by the AS Shell when a target requests a LinkSrc whose
  221.       // draft is closed and its surrogate has not yet been constructed.
  222.       // The AS Shell passes in a read-only draft and a linkid
  223.       // and needs to get back the storage unit id for this linkid
  224.       // in order to clone it.
  225.       // The LinkService will browse the draft properties under
  226.       // the LinkSourceInfos prop till it finds a match to the
  227.       // requested linkid. It will map the corresponding storage unit
  228.       // reference to a storage unit id and return it.
  229.  
  230.     IODFileName       GetDocName();  /* returns the name from which doc was read */
  231.  
  232.     void GetLinkSourcesForPart(in ODPart part,
  233.                                in CMLinkSourceIterator linkSourceIter);
  234.  
  235.     void GetLinkTargetsForPart(in ODPart part,
  236.                                in CMLinkIterator linkTargetIter);
  237.  
  238.     void GetPersistentLinkInfoFromTSpec(in ODStorageUnitID partSUID,
  239.                                in ODByteArray partData,
  240.                                out ODLinkID linkID,
  241.                                out ODISOStr ASName);
  242.  
  243.  
  244.   #endif //__PRIVATE__
  245.  
  246.   #ifdef __SOMIDL__
  247.     implementation {
  248.       override:
  249.         somInit,
  250.         somUninit;
  251.  
  252.       releaseorder:
  253.         #ifdef __PRIVATE__
  254.           CleanupLinkServiceProperties,
  255.           EstablishLinkFromTSpec,
  256.           InitLinkService,
  257.           DraftOpened,
  258.           DraftMoved,
  259.           DraftClosing,
  260.           DraftSaving,
  261.           UnsavedExportedLinks,
  262.           RegisterLinkSource,
  263.           OpenLinkSource,
  264.           InternalizeLinkSource,
  265.           GetLinkSrcInDraft,
  266.           GetDocName,
  267.           GetLinkSourcesForPart,
  268.           GetLinkTargetsForPart,
  269.           GetPersistentLinkInfoFromTSpec,
  270.           RegisterLinkTarget;
  271.         #else
  272.           reserved1,
  273.           reserved2,
  274.           reserved3,
  275.           reserved4,
  276.           reserved5,
  277.           reserved6,
  278.           reserved7,
  279.           reserved8,
  280.           reserved9,
  281.           reserved10,
  282.           reserved11,
  283.           reserved12,
  284.           reserved13,
  285.           reserved14,
  286.           reserved15,
  287.           reserved16;
  288.         #endif //__PRIVATE__
  289.  
  290.       #ifdef __PRIVATE__
  291.         ODBoolean         fDraftOpened;  /* true if a docshell called DraftOpened*/
  292.         ODDraft           fDraft;        /* initialized if DraftOpened   */
  293.         ODDocumentID      fDocumentID;   /* initialized if fAvlSvr exists   */
  294.                                          /* or if !fIsNew                   */
  295.         IODAvailServer    fAvlSvr;       /* initialized the first time   */
  296.                                          /* a linksource is created/opened */
  297.                                          /* via OpenLinkSource or        */
  298.                                          /* RegisterLinkSource           */
  299.         OpenHashTable*      fLinkSrcInfos; /* a table of LinkSrcInfos
  300.                                              keyed by LinkId             */
  301.         OpenHashTable*      fLinkTrgtInfos; /* a table of LinkTrgtInfos
  302.                                              keyed by connection ids     */
  303.         IODFileName       fDocPathName;  /* name from which doc was read */
  304.         ODISOStr          fASName;       /* name of availability server  */
  305.         ODBoolean         fExistsUnsavedLink;  /* true if there is one or more */
  306.                                                /* registered link which has    */
  307.                                                /* not been saved yet.          */
  308.         ODBoolean         fIsNew;        /* initialized if DraftOpened   */
  309.                                          /* remembers DraftOpened parameter */
  310.  
  311.         IODMutex           fMutex;
  312.         ODID              fTargetIDCounter;
  313.       #endif //__PRIVATE__
  314.     };
  315.   #endif //__SOMIDL__
  316. };
  317.  
  318. #endif //_ILNKSRVC_
  319.