1 // Created on: 1997-11-17
2 // Created by: Jean-Louis Frenkel
3 // Copyright (c) 1997-1999 Matra Datavision
4 // Copyright (c) 1999-2014 OPEN CASCADE SAS
6 // This file is part of Open CASCADE Technology software library.
8 // This library is free software; you can redistribute it and/or modify it under
9 // the terms of the GNU Lesser General Public License version 2.1 as published
10 // by the Free Software Foundation, with special exception defined in the file
11 // OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
12 // distribution for complete text of the license and disclaimer of any warranty.
14 // Alternatively, this file may be used under the terms of Open CASCADE
15 // commercial license or contractual agreement.
17 #ifndef _CDF_MetaDataDriver_HeaderFile
18 #define _CDF_MetaDataDriver_HeaderFile
20 #include <Standard.hxx>
21 #include <Standard_Type.hxx>
23 #include <Standard_Transient.hxx>
24 #include <Standard_Boolean.hxx>
25 #include <Standard_Integer.hxx>
26 class Standard_NotImplemented;
28 class TCollection_ExtendedString;
30 class PCDM_ReferenceIterator;
33 class CDF_MetaDataDriver;
34 DEFINE_STANDARD_HANDLE(CDF_MetaDataDriver, Standard_Transient)
36 //! this class list the method that must be available for
38 class CDF_MetaDataDriver : public Standard_Transient
44 //! returns true if the MetaDataDriver can manage different
45 //! versions of a Data.
46 //! By default, returns Standard_False.
47 Standard_EXPORT virtual Standard_Boolean HasVersionCapability();
49 //! Creates a "Depends On" relation between two Datas.
50 //! By default does nothing
51 Standard_EXPORT virtual void CreateDependsOn (const Handle(CDM_MetaData)& aFirstData, const Handle(CDM_MetaData)& aSecondData);
53 Standard_EXPORT virtual void CreateReference (const Handle(CDM_MetaData)& aFrom, const Handle(CDM_MetaData)& aTo, const Standard_Integer aReferenceIdentifier, const Standard_Integer aToDocumentVersion);
55 //! by default return Standard_True.
56 Standard_EXPORT virtual Standard_Boolean HasVersion (const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName);
58 Standard_EXPORT virtual TCollection_ExtendedString BuildFileName (const Handle(CDM_Document)& aDocument) = 0;
60 //! this methods is usefull if the name of an object --
61 //! depends on the metadatadriver. For example a Driver
62 //! -- based on the operating system can choose to add
63 //! the extension of file to create to the object.
64 Standard_EXPORT virtual TCollection_ExtendedString SetName (const Handle(CDM_Document)& aDocument, const TCollection_ExtendedString& aName);
66 //! should indicate whether meta-data exist in the DBMS corresponding
68 //! aVersion may be NULL;
69 Standard_EXPORT virtual Standard_Boolean Find (const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const TCollection_ExtendedString& aVersion) = 0;
71 Standard_EXPORT virtual Standard_Boolean HasReadPermission (const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const TCollection_ExtendedString& aVersion) = 0;
73 //! should return the MetaData stored in the DBMS with the meta-data
74 //! corresponding to the Data. If the MetaDataDriver has version management capabilities
75 //! the version has to be set in the returned MetaData.
76 //! aVersion may be NULL
77 //! MetaData is called by GetMetaData
78 //! If the version is set to NULL, MetaData should return
79 //! the last version of the metadata
80 Standard_EXPORT virtual Handle(CDM_MetaData) MetaData (const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const TCollection_ExtendedString& aVersion) = 0;
82 //! by default returns aMetaDATA
83 //! should return the MetaData stored in the DBMS with the meta-data
84 //! corresponding to the path. If the MetaDataDriver has version management capabilities
85 //! the version has to be set in the returned MetaData.
86 //! MetaData is called by GetMetaData
87 //! If the version is not included in the path , MetaData should return
88 //! the last version of the metadata
90 Standard_EXPORT virtual Handle(CDM_MetaData) LastVersion (const Handle(CDM_MetaData)& aMetaData);
92 //! should create meta-data corresponding to aData and maintaining a meta-link
93 //! between these meta-data and aFileName
94 //! CreateMetaData is called by CreateData
95 //! If the metadata-driver
96 //! has version capabilities, version must be set in the returned Data.
97 Standard_EXPORT virtual Handle(CDM_MetaData) CreateMetaData (const Handle(CDM_Document)& aDocument, const TCollection_ExtendedString& aFileName) = 0;
99 Standard_EXPORT virtual Standard_Boolean FindFolder (const TCollection_ExtendedString& aFolder) = 0;
101 Standard_EXPORT virtual TCollection_ExtendedString DefaultFolder() = 0;
103 Standard_EXPORT virtual Handle(PCDM_ReferenceIterator) ReferenceIterator();
105 //! calls Find with an empty version
106 Standard_EXPORT Standard_Boolean Find (const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName);
108 //! calls MetaData with an empty version
109 Standard_EXPORT Handle(CDM_MetaData) MetaData (const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName);
114 DEFINE_STANDARD_RTTIEXT(CDF_MetaDataDriver,Standard_Transient)
119 Standard_EXPORT CDF_MetaDataDriver();
136 #endif // _CDF_MetaDataDriver_HeaderFile