42cf5bc1 |
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 |
5 | // |
6 | // This file is part of Open CASCADE Technology software library. |
7 | // |
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. |
13 | // |
14 | // Alternatively, this file may be used under the terms of Open CASCADE |
15 | // commercial license or contractual agreement. |
16 | |
17 | #ifndef _CDF_MetaDataDriver_HeaderFile |
18 | #define _CDF_MetaDataDriver_HeaderFile |
19 | |
20 | #include <Standard.hxx> |
21 | #include <Standard_Type.hxx> |
22 | |
23 | #include <Standard_Transient.hxx> |
24 | #include <Standard_Boolean.hxx> |
25 | #include <Standard_Integer.hxx> |
26 | class Standard_NotImplemented; |
27 | class CDM_MetaData; |
28 | class TCollection_ExtendedString; |
29 | class CDM_Document; |
30 | class PCDM_ReferenceIterator; |
31 | |
32 | |
33 | class CDF_MetaDataDriver; |
34 | DEFINE_STANDARD_HANDLE(CDF_MetaDataDriver, Standard_Transient) |
35 | |
36 | //! this class list the method that must be available for |
37 | //! a specific DBMS |
38 | class CDF_MetaDataDriver : public Standard_Transient |
39 | { |
40 | |
41 | public: |
42 | |
43 | |
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(); |
48 | |
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); |
52 | |
53 | Standard_EXPORT virtual void CreateReference (const Handle(CDM_MetaData)& aFrom, const Handle(CDM_MetaData)& aTo, const Standard_Integer aReferenceIdentifier, const Standard_Integer aToDocumentVersion); |
54 | |
55 | //! by default return Standard_True. |
56 | Standard_EXPORT virtual Standard_Boolean HasVersion (const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName); |
57 | |
58 | Standard_EXPORT virtual TCollection_ExtendedString BuildFileName (const Handle(CDM_Document)& aDocument) = 0; |
59 | |
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); |
65 | |
66 | //! should indicate whether meta-data exist in the DBMS corresponding |
67 | //! to the Data. |
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; |
70 | |
71 | Standard_EXPORT virtual Standard_Boolean HasReadPermission (const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const TCollection_ExtendedString& aVersion) = 0; |
72 | |
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; |
81 | |
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 |
89 | //! is deferred; |
90 | Standard_EXPORT virtual Handle(CDM_MetaData) LastVersion (const Handle(CDM_MetaData)& aMetaData); |
91 | |
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; |
98 | |
99 | Standard_EXPORT virtual Standard_Boolean FindFolder (const TCollection_ExtendedString& aFolder) = 0; |
100 | |
101 | Standard_EXPORT virtual TCollection_ExtendedString DefaultFolder() = 0; |
102 | |
103 | Standard_EXPORT virtual Handle(PCDM_ReferenceIterator) ReferenceIterator(); |
104 | |
105 | //! calls Find with an empty version |
106 | Standard_EXPORT Standard_Boolean Find (const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName); |
107 | |
108 | //! calls MetaData with an empty version |
109 | Standard_EXPORT Handle(CDM_MetaData) MetaData (const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName); |
110 | |
111 | |
112 | |
113 | |
92efcf78 |
114 | DEFINE_STANDARD_RTTIEXT(CDF_MetaDataDriver,Standard_Transient) |
42cf5bc1 |
115 | |
116 | protected: |
117 | |
118 | |
119 | Standard_EXPORT CDF_MetaDataDriver(); |
120 | |
121 | |
122 | |
123 | private: |
124 | |
125 | |
126 | |
127 | |
128 | }; |
129 | |
130 | |
131 | |
132 | |
133 | |
134 | |
135 | |
136 | #endif // _CDF_MetaDataDriver_HeaderFile |