home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / opendc12.zip / od124os2.exe / od12osr1.exe / src / CMCtr.cpp < prev    next >
C/C++ Source or Header  |  1997-03-21  |  25KB  |  745 lines

  1. /* @(#)Z 1.17 com/src/bento/CMCtr.cpp, odstorage, od96os2, odos29712d 97/03/21 17:19:02 (96/10/29 09:10:55) */
  2. //====START_GENERATED_PROLOG======================================
  3. //
  4. //
  5. //   COMPONENT_NAME: odstorage
  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.     File:        CMCtr.cpp
  31.  
  32.     Contains:    Implementation of ODBentoContainer class.
  33.  
  34.     Owned by:    Vincent Lo
  35.  
  36.     Copyright:    ⌐ 1993 - 1995 by Apple Computer, Inc., all rights reserved.
  37.  
  38.     Change History (most recent first):
  39.  
  40.         <26>    10/24/95    jpa        1293441: DM/VL: Bento memory reserve &
  41.                                     fatal container err & don't throw in
  42.                                     Release.
  43.         <25>     10/8/95    TJ        Fixes Recomended by Refball
  44.         <24>     9/29/95    TJ        Made Changes for MAC SOM
  45.         <23>     8/21/95    VL        1278330, 1278315: Error code cleanup.
  46.         <22>      8/3/95    RR        #1257260: Collapse B classes. Remove
  47.                                     somInit methods. Don't call IsInitialized
  48.                                     or SubclassResponsibility
  49.         <21>     7/21/95    VL        1270320: Dispose _fID. Return a copy of the
  50.                                     ID in GetID.
  51.         <20>     5/26/95    VL        1251403: Multithreading naming support.
  52.         <19>     5/25/95    jpa        Fixed usage of ODDebug. [1253321]
  53.         <18>     5/11/95    DM        #1246524, #1246529:
  54.                                     ValueNameSpaceGetEntry() must pass through
  55.                                     the value allocated.
  56.         <17>     5/11/95    VL        1238421: Implemented Purge.
  57.         <16>      4/7/95    EL        1225905: Add GetModDate and SetModDate.
  58.         <15>     3/23/95    VL        1230357: Implemented Purge.
  59.         <14>      3/9/95    VL        1225504: Fixed Document ref-counting
  60.                                     problem.
  61.         <13>     2/10/95    VL        1205627: Added GetTargetContainer.
  62.         <12>      2/2/95    CG        #1195019:  ValueNameSpace entries are now
  63.                                     copied in and out instead of pointers being
  64.                                     passed around.
  65.         <11>     1/31/95    EL        1195846: allow clearing of the dirty flag.
  66.         <10>     1/23/95    CG        #1195019: ValueNameSpace methods now take
  67.                                     ODByteArray parameter instead of ODPtr.
  68.          <9>    11/14/94    VL        1188257: Use Bento errors in BenotDef.h.
  69.          <8>    10/12/94    VL        Fixed problem introduced in the last
  70.                                     checkin.
  71.          <7>     9/29/94    RA        1189812: Mods for 68K build.
  72.          <6>     9/23/94    VL        1184272: ContainerID is now a sequence of
  73.                                     octets. 1184166: ContainerName is ODIText
  74.                                     now.
  75.          <5>      9/5/94    VL        1184871: Used Renew to remove dependency on
  76.                                     default heap.
  77.          <4>      8/5/94    VL        1171603: Added GetCMSession.
  78.          <3>      8/3/94    VL        1153123: Storage to ODStor.
  79.          <2>      7/7/94    VL        Commented out use of ODRecoverHeapID.
  80.          <1>     6/30/94    CC        first checked in
  81.          <0>     6/27/94    SV        SOMverted
  82.          <2>     4/13/94    VL        1157028: StorageM.h does not include
  83.                                     CMAPI.h anymore, so GetCMSession returns
  84.                                     ODULong.
  85.          <1>     3/25/94    VL        first checked in
  86.          <3>     3/24/94    VL        #1147173, #1144732: Created Bento-specific
  87.                                     Container Suite classes (uses CMDocument).
  88.          <2>     3/15/94    MB        Changes to support SCpp/ASLM builds,
  89.                                     #1150864.
  90.         <15>      2/8/94    VL        Correct capitalization and <> for includes.
  91.         <14>      2/8/94    VL        Use new exception macros.
  92.         <13>      2/4/94    VL        Moved to PPC Header and code cleanup.
  93.         <12>     1/12/94    VL        Init changes.
  94.         <11>     12/3/93    Té        Stop including ODError.h, it is included
  95.                                     as ErrorDef.h inside Except.h
  96.         <10>    11/23/93    VL        Made Bento Container Pool-aware.
  97.          <8>     8/20/93    VL        Implemented GetName and SetName.
  98.          <7>      8/6/93    VL        fContainer should be fCMContainer.
  99.          <6>     7/30/93    VL        ODContainerName* should be
  100.                                     ODContainerName.
  101.          <5>     7/29/93    VL        AcquireDocument should check whether a
  102.                                     ODDocument is created already.
  103.          <4>      7/6/93    VL        ODContainerName should be
  104.                                     ODContainerName*.
  105.          <3>     6/30/93    VL        Used fDocument.
  106.          <2>     6/22/93    VL        Used RefCount from ODRefCntObject.
  107.          <1>     6/15/93    VL        first checked in
  108.  
  109.     To Do:
  110.     To Do:
  111.     In Progress:
  112.         
  113. */
  114.  
  115. #define ODBentoContainer_Class_Source
  116.  
  117. #define VARIABLE_MACROS
  118.  
  119. #include <CMCtr.xih>
  120.  
  121. #ifndef _PLFMDEF_
  122. #include "PlfmDef.h"
  123. #endif
  124.  
  125. #ifndef _ODTYPES_
  126. #include "ODTypes.h"
  127. #endif
  128.  
  129. #ifndef SOM_ODStorageSystem_xh
  130. #include <ODStor.xh>
  131. #endif
  132.  
  133. #ifndef SOM_ODDocument_xh
  134. #include <Document.xh>
  135. #endif
  136.  
  137. #ifndef SOM_CMDocument_xh
  138. #include <CMDoc.xh>
  139. #endif
  140.  
  141. #ifndef SOM_ODSession_xh
  142. #include <ODSessn.xh>
  143. #endif
  144.  
  145. #ifndef _SESSHDR_
  146. #include "SessHdr.h"        // for sessionRoutinesMetahandler
  147. #endif
  148.  
  149. #ifndef __CM_API__
  150. #include "CMAPI.h"
  151. #endif
  152.  
  153. #ifndef _BENTOHDR_
  154. #include "BentoHdr.h"
  155. #endif
  156.  
  157. #ifndef _EXCEPT_
  158. #include "Except.h"
  159. #endif
  160.  
  161. #ifndef SOM_Module_OpenDoc_Errors_defined 
  162. #include <ErrorDef.xh>
  163. #endif
  164.  
  165. #ifndef _ODNEW_
  166. #include <ODNew.h>
  167. #endif
  168.  
  169. #ifndef SOM_ODNameSpaceManager_xh
  170. #include <NmSpcMg.xh>
  171. #endif
  172.  
  173. #ifndef SOM_ODValueNameSpace_xh
  174. #include <ValueNS.xh>
  175. #endif
  176.  
  177. #ifdef DebugRefCount
  178. #include <stdio.h>
  179. #endif
  180.  
  181. #ifndef _ITEXT_
  182. #include <IText.h>
  183. #endif
  184.  
  185. #ifndef _BARRAY_
  186. #include <BArray.h>
  187. #endif
  188.  
  189. #ifndef _BENTODEF_
  190. #include "BentoDef.h"
  191. #endif
  192.  
  193. #ifndef _ODMEMORY_
  194. #include "ODMemory.h"    // Adkins -- added
  195. #endif
  196.  
  197. #ifndef _ODDEBUG_
  198. #include "ODDebug.h"    // Adkins -- added
  199. #endif
  200.  
  201. #ifndef _NMSPCUTL_
  202. #include <NmSpcUtl.h>
  203. #endif
  204.  
  205. #if defined(_PLATFORM_WIN32_) || defined (_PLATFORM_OS2_) || defined (_PLATFORM_AIX_)
  206. #ifndef _ODUTILS_
  207. #include "ODUtils.h"
  208. #endif
  209. #endif
  210.  
  211. #pragma segment BentoCtr
  212.  
  213. //==============================================================================
  214. // Constants
  215. //==============================================================================
  216.  
  217. const ODISOStr    kODContainerSuitesNameSpace = "OpenDoc:Apple:Macintosh:Container Suites";
  218. const ODISOStr    kODBentoContainerSuite = "OpenDoc:Apple:Macintosh:Container Suite:Bento";
  219. #define kODExpectedNumOfContainerSuites 10
  220.  
  221. //==============================================================================
  222. // ODBentoContainer
  223. //==============================================================================
  224.  
  225. //------------------------------------------------------------------------------
  226. // ODBentoContainer: GetStorageSystem
  227. //------------------------------------------------------------------------------
  228.  
  229. SOM_Scope ODStorageSystem*  SOMLINK ODBentoContainerGetStorageSystem(ODBentoContainer *somSelf, Environment *ev)
  230. {
  231.     ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  232.     ODBentoContainerMethodDebug("ODBentoContainer","GetStorageSystem");
  233.  
  234.     return _fStorageSystem;
  235. }
  236.  
  237. //------------------------------------------------------------------------------
  238. // ODBentoContainer: GetID
  239. //------------------------------------------------------------------------------
  240.  
  241. SOM_Scope ODContainerID  SOMLINK ODBentoContainerGetID(ODBentoContainer *somSelf, Environment *ev)
  242. {
  243.     ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  244.     ODBentoContainerMethodDebug("ODBentoContainer","GetID");
  245.  
  246.     ODContainerID id;
  247.     
  248.     try
  249.     {
  250.     
  251.     id = CopyByteArrayStruct(_fID);
  252.     
  253.     }
  254.     catch (ODException _exception)
  255.     {
  256.         ODSetSOMException(ev, _exception);
  257.     }
  258.     return id;
  259. }
  260.  
  261. //------------------------------------------------------------------------------
  262. // ODBentoContainer: GetName
  263. //------------------------------------------------------------------------------
  264.  
  265. SOM_Scope ODContainerName  SOMLINK ODBentoContainerGetName(ODBentoContainer *somSelf, Environment *ev)
  266. {
  267.     ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  268.     ODBentoContainerMethodDebug("ODBentoContainer","GetName");
  269.  
  270.     WARNMSG(WARN_INDEX(AMSG_630),"A subclass should have overridden this method!");
  271.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  272.     ODContainerName dummy;
  273.     return dummy;
  274. }
  275.  
  276. //------------------------------------------------------------------------------
  277. // ODBentoContainer: SetName
  278. //------------------------------------------------------------------------------
  279.  
  280. SOM_Scope void  SOMLINK ODBentoContainerSetName(ODBentoContainer *somSelf, Environment *ev,
  281.         ODContainerName* name)
  282. {
  283.     ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  284.     ODBentoContainerMethodDebug("ODBentoContainer","SetName");
  285.     
  286.     WARNMSG(WARN_INDEX(AMSG_630),"A subclass should have overridden this method!");
  287.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  288. }
  289.  
  290. //------------------------------------------------------------------------------
  291. // ODBentoContainer: AcquireDocument
  292. //------------------------------------------------------------------------------
  293.  
  294. SOM_Scope ODDocument*  SOMLINK ODBentoContainerAcquireDocument(ODBentoContainer *somSelf, Environment *ev,
  295.         ODDocumentID id)
  296. {
  297.     ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  298.     ODBentoContainerMethodDebug("ODBentoContainer","AcquireDocument");
  299.  
  300.     ODDocument *retDoc = kODNULL;
  301.    try
  302.    {
  303.     if (_fDocument == kODNULL) {
  304.     
  305. #ifdef _PLATFORM_MACINTOSH_
  306.         SOMClass*    cmDocClass = somNewClassReference(CMDocument);
  307.     
  308.         ODULong        size = cmDocClass->somGetInstanceSize();
  309.         ODPtr        buffer = ODNewPtr(size, somSelf->GetHeap(ev));
  310.         ODDocument*    document = (ODDocument*) cmDocClass->somRenew(buffer);
  311.         somReleaseClassReference ( cmDocClass );
  312. #endif
  313. #if defined(_PLATFORM_WIN32_) || defined (_PLATFORM_OS2_) || defined (_PLATFORM_AIX_)
  314. //        The use of heap is not implemented in Windows platform
  315.         ODDocument*    document = (ODDocument*)new CMDocument;
  316. #endif
  317.         
  318.         if (document != kODNULL) 
  319.         {
  320.             document->InitDocument(ev, somSelf, id);
  321.             _fDocument = document;
  322.         }
  323.     }
  324.     else {
  325.         if (_fDocument->GetID(ev) != id)
  326.             THROW(kODErrDocumentDoesNotExist);
  327.         _fDocument->Acquire(ev);
  328.     }            
  329.  
  330.         retDoc = _fDocument;
  331.     }
  332.     catch (ODException _exception)
  333.     {
  334.         ODSetSOMException(ev, _exception);
  335.     }
  336.     return retDoc;
  337. }
  338.  
  339. //------------------------------------------------------------------------------
  340. // ODBentoContainer: Acquire
  341. //------------------------------------------------------------------------------
  342.  
  343. SOM_Scope void  SOMLINK ODBentoContainerAcquire(ODBentoContainer *somSelf, Environment *ev)
  344. {
  345.     ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  346.     ODBentoContainerMethodDebug("ODBentoContainer","Acquire");
  347.  
  348.    try
  349.    {
  350.     ODBentoContainer_parent_ODContainer_Acquire(somSelf, ev);
  351.    }
  352.    catch (ODException _exception)
  353.    { 
  354.        ODSetSOMException(ev, _exception);
  355.    }
  356.  
  357. }
  358.  
  359. //------------------------------------------------------------------------------
  360. // ODBentoContainer: Release
  361. //------------------------------------------------------------------------------
  362.  
  363. SOM_Scope void  SOMLINK ODBentoContainerRelease(ODBentoContainer *somSelf, Environment *ev)
  364. {
  365.     ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  366.     ODBentoContainerMethodDebug("ODBentoContainer","Release");
  367.     
  368.    try
  369.    {
  370.  
  371.     ODBentoContainer_parent_ODContainer_Release(somSelf, ev);
  372.  
  373.     if (somSelf->GetRefCount(ev) == 0) {
  374.         somSelf->GetStorageSystem(ev)->ReleaseContainer(ev, somSelf);
  375.     }
  376.     
  377.    }
  378.    catch (ODException _exception)
  379.    {
  380.     
  381.         ODError err = ErrorCode();
  382.  
  383.         WARNMSG(WARN_INDEX(AMSG_640),"Error occurred in ODContainer::Release: %d %s", err, ErrorMessage() ?ErrorMessage() :"");
  384.  
  385. //        if (err == kODErrBentoErr)
  386. //            SetErrorCode(kODErrFatalContainerError);
  387. //        else if (err != kODErrFatalContainerError)
  388.             SetErrorCode(kODNoError);
  389.    }
  390. }
  391.  
  392. //------------------------------------------------------------------------------
  393. // ODBentoContainer: ~ODBentoContainer
  394. //------------------------------------------------------------------------------
  395.  
  396. SOM_Scope void  SOMLINK ODBentoContainersomUninit(ODBentoContainer *somSelf)
  397. {
  398.     ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  399.     ODBentoContainerMethodDebug("ODBentoContainer","somUninit");
  400.  
  401. #ifdef DebugRefCount
  402.     printf("~ODBentoContainer %x RefCount %d\n", this, somSelf->GetRefCount(ev));
  403.     fflush(stdout);
  404. #endif
  405.  
  406.     Environment*    ev = somGetGlobalEnvironment();
  407.    try
  408.   {
  409.     
  410.     if (_fDocument != kODNULL) {
  411.         if (_fDocument->GetRefCount(ev) != 0)
  412.            somPrintf("BentoContainer::somUninit - Document not ref-counted properly.\n");
  413.                 else
  414.              delete _fDocument;
  415.         _fDocument = kODNULL;
  416.     }
  417.  
  418.     if (_fID)
  419.     {
  420.         ODDisposePtr(_fID->_buffer);
  421.         ODDisposePtr(_fID);
  422.     }
  423.     
  424.     ODBentoContainer_parent_ODContainer_somUninit(somSelf);
  425.   }
  426.   catch (ODException _exception)
  427.   {
  428.      ODSetSOMException(ev, _exception);
  429.   }
  430. }
  431.  
  432. //------------------------------------------------------------------------------
  433. // ODBentoContainer: InitContainer
  434. //------------------------------------------------------------------------------
  435.  
  436. #define kODcmAllocReserveSize (16 * 1204)
  437.  
  438. SOM_Scope void  SOMLINK ODBentoContainerInitContainer(ODBentoContainer *somSelf, Environment *ev,
  439.         ODStorageSystem* storage, ODContainerID* id)
  440. {
  441.     ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  442.     ODBentoContainerMethodDebug("ODBentoContainer","InitContainer");
  443.  
  444.     ODSessionRefCon* sessionRefCon = kODNULL;
  445.         ODBoolean CreateNameSpace = kODFalse;
  446.  
  447.     try
  448.     {
  449.     /* Moved from somInit. SOM itself sets fields to zero
  450.     _fStorageSystem = kODNULL;
  451.     _fID = 0;
  452.     _fDocument = kODNULL;
  453.     _fDirty = kODFalse;
  454.     _fHeap = kDefaultHeapID;
  455.     */
  456.     
  457.     _fStorageSystem = storage;
  458.     if (_fStorageSystem == kODNULL)
  459.         THROW(kODErrIllegalNullStorageSystemInput);
  460.  
  461.     ODBentoContainer_parent_ODContainer_InitContainer(somSelf, ev, storage, id);
  462.  
  463.     _fID = CopyByteArray(id);
  464.     _fHeap = ODRecoverHeapID(somSelf);
  465.     
  466.     ODSession*    session = _fStorageSystem->GetSession(ev);
  467.     ODNameSpaceManager* nameSpaceManager = session->GetNameSpaceManager(ev);
  468.     WASSERTMSG(nameSpaceManager!=kODNULL, "No Name Space Manager", 0);
  469.         
  470.     ODValueNameSpace* nameSpace = (ODValueNameSpace*) nameSpaceManager->HasNameSpace(ev, kODContainerSuitesNameSpace);
  471.     if (nameSpace == kODNULL) {
  472.         nameSpace = (ODValueNameSpace*) nameSpaceManager->CreateNameSpace(ev,
  473.                                             kODContainerSuitesNameSpace,
  474.                                             kODNULL,
  475.                                             kODExpectedNumOfContainerSuites,
  476.                                             kODNSDataTypeODValue);
  477.     }
  478.     
  479.     CMSession  cmSession = kODNULL;
  480.     if (nameSpace->Exists(ev, kODBentoContainerSuite) == kODFalse) {
  481. #ifdef _PLATFORM_MACINTOSH_
  482.         ODSessionRefCon* sessionRefCon = new(somSelf->GetHeap(ev)) ODSessionRefCon;
  483. #endif
  484. #if defined(_PLATFORM_WIN32_) || defined (_PLATFORM_OS2_) || defined (_PLATFORM_AIX_)
  485. //        The use of heap is not implemented in Windows platform
  486.         ODSessionRefCon* sessionRefCon = new ODSessionRefCon;
  487. #endif
  488.         
  489. #ifdef ODDebugBentoSize
  490.         {
  491.             memset(sessionRefCon, 0, sizeof(ODSessionRefCon));
  492.             SOM_TraceLevel = kODTrue;
  493.         }
  494. #endif        
  495.                 CreateNameSpace = kODTrue;
  496.  
  497.         sessionRefCon->container = kODNULL;
  498.         sessionRefCon->heap = somSelf->GetHeap(ev);
  499.         sessionRefCon->cmAllocReserveBlock = kODNULL; // init to null in case alloc fails
  500.         sessionRefCon->cmAllocReserveSize = kODcmAllocReserveSize;
  501.         sessionRefCon->cmAllocReserveBlock = ODNewPtr(kODcmAllocReserveSize, sessionRefCon->heap);
  502.         
  503.         cmSession = CMStartSession(sessionRoutinesMetahandler, sessionRefCon);
  504.         ValueNameSpaceRegister( nameSpace, ev,
  505.                                 kODBentoContainerSuite,
  506.                                 (ODPtr)&cmSession,
  507.                                 sizeof(CMSession));
  508.     }
  509.     else {
  510.         CMSession* cmSessionPtr;
  511.         ODULong length = 0;
  512.         if (ValueNameSpaceGetEntry(nameSpace, ev, kODBentoContainerSuite, 
  513.                               (ODPtr*) &cmSessionPtr, &length))
  514.         {
  515.             cmSession = *cmSessionPtr;
  516.             ODDeleteObject( cmSessionPtr );
  517.         }
  518.         
  519.         WASSERTMSG(length==sizeof(CMSession), "No CMSession", 0);
  520.     }
  521.     _fCMSession = cmSession;
  522.    }
  523.    catch (ODException _exception)
  524.    {
  525.         if(CreateNameSpace)
  526.            ODDeleteObject(sessionRefCon);
  527.         ODSetSOMException(ev, _exception);
  528.    }
  529. }
  530.  
  531. //------------------------------------------------------------------------------
  532. // ODBentoContainer: Create
  533. //------------------------------------------------------------------------------
  534.  
  535. SOM_Scope ODContainer*  SOMLINK ODBentoContainerCreate(ODBentoContainer *somSelf, Environment *ev)
  536. {
  537.     ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  538.     ODBentoContainerMethodDebug("ODBentoContainer","Create");
  539.  
  540.     WARNMSG(WARN_INDEX(AMSG_630),"A subclass should have overridden this method!");
  541.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  542.     
  543.     return somSelf;
  544. }
  545.  
  546. //------------------------------------------------------------------------------
  547. // ODBentoContainer: Open
  548. //------------------------------------------------------------------------------
  549.  
  550. SOM_Scope ODContainer*  SOMLINK ODBentoContainerOpen(ODBentoContainer *somSelf, Environment *ev)
  551. {
  552.     ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  553.     ODBentoContainerMethodDebug("ODBentoContainer","Open");
  554.  
  555.     WARNMSG(WARN_INDEX(AMSG_630),"A subclass should have overridden this method!");
  556.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  557.  
  558.     return somSelf;
  559. }
  560.  
  561. //------------------------------------------------------------------------------
  562. // ODBentoContainer: Close
  563. //------------------------------------------------------------------------------
  564.  
  565. SOM_Scope ODContainer*  SOMLINK ODBentoContainerClose(ODBentoContainer *somSelf, Environment *ev)
  566. {
  567.     ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  568.     ODBentoContainerMethodDebug("ODBentoContainer","Close");
  569.  
  570.  
  571.     return somSelf;
  572. }
  573.  
  574. //------------------------------------------------------------------------------
  575. // ODBentoContainer: Purge
  576. //------------------------------------------------------------------------------
  577.  
  578. SOM_Scope ODSize  SOMLINK ODBentoContainerPurge(ODBentoContainer *somSelf, Environment *ev,
  579.         ODSize size)
  580. {
  581.     ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  582.     ODBentoContainerMethodDebug("ODBentoContainer","Purge");
  583.     
  584.     ODSize    purgedSize = 0;
  585.     
  586.     try
  587.     {
  588.     purgedSize = parent_Purge(somSelf, ev, size);
  589.     if (_fDocument != kODNULL)
  590.         purgedSize = _fDocument->Purge(ev, size-purgedSize);
  591.     
  592.     }
  593.     catch (ODException _exception)
  594.     {
  595.     purgedSize = size;
  596.      ODSetSOMException(ev, _exception);
  597.     }
  598.     
  599.     return (size - purgedSize);
  600. }
  601.  
  602. //------------------------------------------------------------------------------
  603. // ODBentoContainer: ReleaseDocument
  604. //------------------------------------------------------------------------------
  605.  
  606. SOM_Scope ODContainer*  SOMLINK ODBentoContainerReleaseDocument(ODBentoContainer *somSelf, Environment *ev,
  607.         ODDocument* document)
  608. {
  609.     ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  610.     ODBentoContainerMethodDebug("ODBentoContainer","ReleaseDocument");
  611.  
  612.     return somSelf;
  613. }
  614.  
  615. //------------------------------------------------------------------------------
  616. // ODBentoContainer: GetCMContainer
  617. //------------------------------------------------------------------------------
  618.  
  619. SOM_Scope CMContainer  SOMLINK ODBentoContainerGetCMContainer(ODBentoContainer *somSelf, Environment *ev)
  620. {
  621.     ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  622.     ODBentoContainerMethodDebug("ODBentoContainer","ODBentoContainerGetCMContainer");
  623.  
  624.     WARNMSG(WARN_INDEX(AMSG_630),"A subclass should have overridden this method!");
  625.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  626.  
  627.     return (CMContainer) kODNULL;
  628. }
  629.  
  630. //------------------------------------------------------------------------------
  631. // ODBentoContainer: GetHandlers
  632. //------------------------------------------------------------------------------
  633.  
  634. SOM_Scope ODBentoHandlers*  SOMLINK ODBentoContainerGetHandlers(ODBentoContainer *somSelf, Environment *ev)
  635. {
  636.     ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  637.     ODBentoContainerMethodDebug("ODBentoContainer","ODBentoContainerGetHandlers");
  638.  
  639.     WARNMSG(WARN_INDEX(AMSG_630),"A subclass should have overridden this method!");
  640.     ODSetSOMException(ev,kODErrSubClassResponsibility, "SubClass Responsibility");
  641.  
  642.     return (ODBentoHandlers*) kODNULL;
  643. }
  644.  
  645. //------------------------------------------------------------------------------
  646. // ODBentoContainer: GetDirtyFlag
  647. //------------------------------------------------------------------------------
  648.  
  649. SOM_Scope ODBoolean  SOMLINK ODBentoContainerGetDirtyFlag(ODBentoContainer *somSelf, Environment *ev)
  650. {
  651.     ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  652.     ODBentoContainerMethodDebug("ODBentoContainer","GetDirtyFlag");
  653.  
  654.     return _fDirty;
  655. }
  656.  
  657. //------------------------------------------------------------------------------
  658. // ODBentoContainer: SetDirtyFlag
  659. //------------------------------------------------------------------------------
  660.  
  661. SOM_Scope void  SOMLINK ODBentoContainerSetDirtyFlag(ODBentoContainer *somSelf, Environment *ev, ODBoolean flag)
  662. {
  663.     ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  664.     ODBentoContainerMethodDebug("ODBentoContainer","SetDirtyFlag");
  665.  
  666.     _fDirty = flag;
  667. }
  668.  
  669.  
  670. //------------------------------------------------------------------------------
  671. // ODBentoContainer: GetHeap
  672. //------------------------------------------------------------------------------
  673.  
  674. SOM_Scope ODMemoryHeapID  SOMLINK ODBentoContainerGetHeap(ODBentoContainer *somSelf, Environment *ev)
  675. {
  676.     ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  677.     ODBentoContainerMethodDebug("ODBentoContainer","GetHeap");
  678.  
  679.     return _fHeap;
  680. }
  681.  
  682. //------------------------------------------------------------------------------
  683. // ODBentoContainer: GetCMSession
  684. //------------------------------------------------------------------------------
  685.  
  686. SOM_Scope CMSession  SOMLINK ODBentoContainerGetCMSession(ODBentoContainer *somSelf, Environment *ev)
  687. {
  688.     ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  689.     ODBentoContainerMethodDebug("ODBentoContainer","GetHeap");
  690.  
  691.     if (_fCMSession == kODNULL)
  692.         ODSetSOMException(ev,kODErrBentoNoSession);
  693.         
  694.     return _fCMSession;
  695. }
  696.  
  697. //------------------------------------------------------------------------------
  698. // ODBentoContainer: GetTargetContainer
  699. //------------------------------------------------------------------------------
  700.  
  701. SOM_Scope ODBentoContainer*  SOMLINK ODBentoContainerGetTargetContainer(ODBentoContainer *somSelf, Environment *ev)
  702. {
  703. //   ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  704.     ODBentoContainerMethodDebug("ODBentoContainer","GetTargetContainer");
  705.  
  706.     return kODNULL;
  707. }
  708.  
  709. //------------------------------------------------------------------------------
  710. // ODBentoContainer: GetTargetDocument
  711. //------------------------------------------------------------------------------
  712.  
  713. SOM_Scope CMDocument*  SOMLINK ODBentoContainerGetTargetDocument(ODBentoContainer *somSelf, Environment *ev)
  714. {
  715. //   ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  716.     ODBentoContainerMethodDebug("ODBentoContainer","GetTargetDocument");
  717.  
  718.     return kODNULL;
  719. }
  720.  
  721. //------------------------------------------------------------------------------
  722. // ODBentoContainer: GetModDate
  723. //------------------------------------------------------------------------------
  724.  
  725. SOM_Scope ODTime SOMLINK ODBentoContainerGetModDate(ODBentoContainer *somSelf, Environment *ev)
  726. {
  727.     ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  728.     ODBentoContainerMethodDebug("ODBentoContainer","GetModDate");
  729.  
  730.     return _fModDate;
  731. }
  732.  
  733. //------------------------------------------------------------------------------
  734. // ODBentoContainer: SetModDate
  735. //------------------------------------------------------------------------------
  736.  
  737. SOM_Scope void SOMLINK ODBentoContainerSetModDate(ODBentoContainer *somSelf, Environment *ev, ODTime timer)
  738. {
  739.     ODBentoContainerData *somThis = ODBentoContainerGetData(somSelf);
  740.     ODBentoContainerMethodDebug("ODBentoContainer","SetModDate");
  741.  
  742.     _fModDate = timer;
  743. }
  744.  
  745.