is redefined virtual;
---Purpose: Write <theDocument> to the binary file <theFileName>
- IsError (me) returns Boolean from Standard;
-
AttributeDrivers (me : mutable; theMsgDriver: MessageDriver from CDM)
returns ADriverTable from BinMDF
is virtual;
myPAtt : Persistent from BinObjMgt;
myDrivers : ADriverTable from BinMDF is protected;
myRelocTable: SRelocationTable from BinObjMgt is protected;
- myIsError : Boolean from Standard is protected;
myMsgDriver : MessageDriver from CDM;
-- labels not having writable attributes on it-self and on children
(const Handle(CDM_Document)& theDocument,
const TCollection_ExtendedString& theFileName)
{
- myIsError = Standard_False;
+ SetIsError(Standard_False);
+ SetStoreStatus(PCDM_SS_OK);
+
myMsgDriver = theDocument -> Application() -> MessageDriver();
myMapUnsupported.Clear();
Handle(TDocStd_Document) aDoc =
Handle(TDocStd_Document)::DownCast(theDocument);
if (aDoc.IsNull()) {
- myIsError = Standard_True;
+ SetIsError(Standard_True);
+ SetStoreStatus(PCDM_SS_Doc_IsNull);
}
else {
// Open the file
// 1. Write info section (including types table)
WriteInfoSection(theDocument, aFileName);
myTypesMap.Clear();
- if (myIsError)
- return;
+ if (IsError())
+ {
+ SetStoreStatus(PCDM_SS_Info_Section_Error);
+ return;
+ }
#if !defined(IRIX) // 10.10.2005
ofstream anOS (aFileName.ToCString(), ios::in | ios::binary | ios::ate);
#ifdef DEB
WriteMessage (aMethStr + "no objects written");
#endif
- myIsError = Standard_True;
+ SetIsError(Standard_True);
+ SetStoreStatus(PCDM_SS_No_Obj);
+
}
myRelocTable.Clear();
}
anErrorStr + aMethStr + "Problem writing the file ";
WriteMessage (aStr + theFileName);
#endif
- myIsError = Standard_True;
+ SetIsError(Standard_True);
+ SetStoreStatus(PCDM_SS_DiskWritingFailure);
}
}
}
-//=======================================================================
-//function : IsError
-//purpose :
-//=======================================================================
-
-Standard_Boolean BinLDrivers_DocumentStorageDriver::IsError () const
-{
- return myIsError;
-}
-
//=======================================================================
//function : AttributeDrivers
//purpose :
WriteMessage (TCollection_ExtendedString("Error: Cannot open file ") +
theFileName);
#endif
- myIsError = Standard_True;
+ SetIsError(Standard_True);
return;
}
WriteMessage(TCollection_ExtendedString("Error: Problem writing header "
"into file ") + theFileName);
#endif
- myIsError = Standard_True;
+ SetIsError(Standard_True);
}
#ifdef DEB
const Standard_Integer aP = (Standard_Integer) aFileDriver.Tell();
deferred class Application;
-
----Category: Store in Database related classes.
---
private class StoreList;
- enumeration StoreStatus is
- SS_OK,
- SS_DriverFailure,
- SS_WriteFailure,
- SS_Failure
- end StoreStatus from CDF;
-
-
----Category: Retrieve from Database related classes.
---
-
---Category: API for Store and retrieve
--
enumeration TryStoreStatus is TS_OK,TS_NoCurrentDocument,TS_NoDriver,TS_NoSubComponentDriver
end TryStoreStatus;
-
- enumeration RetrievableStatus is
- RS_OK,
- RS_AlreadyRetrievedAndModified,
- RS_AlreadyRetrieved,
- RS_UnknownDocument,
- RS_NoDriver,
- RS_UnknownFileDriver,
- RS_WrongResource,
- RS_OpenError,
- RS_NoVersion,
- RS_NoModel,
- RS_NoSchema,
- RS_NoDocument,
- RS_ExtensionFailure,
- RS_WrongStreamMode,
- RS_FormatFailure,
- RS_TypeFailure,
- RS_TypeNotFoundInSchema,
- RS_UnrecognizedFileFormat,
- RS_MakeFailure,
- RS_PermissionDenied,
- RS_DriverFailure
- end RetrievableStatus;
enumeration SubComponentStatus is SCS_Consistent, SCS_Unconsistent,SCS_Stored,SCS_Modified
end SubComponentStatus;
returns Boolean from Standard;
end CDF;
-
Document from CDM,
Manager from Resource,
MetaData from CDM,
- RetrievableStatus from CDF,
+ ReaderStatus from PCDM,
GUID from Standard,
Reader from PCDM,
Writer from PCDM,
CanRetrieve(me: mutable; aFolder, aName: ExtendedString from TCollection)
---Purpose:
- returns RetrievableStatus from CDF;
+ returns ReaderStatus from PCDM;
CanRetrieve(me: mutable; aFolder, aName, aVersion: ExtendedString from TCollection)
---Purpose:
- returns RetrievableStatus from CDF;
+ returns ReaderStatus from PCDM;
Formats(me: mutable; Formats: out SequenceOfExtendedString from TColStd)
is deferred;
---Category: CurrentDocument methods.
--
- GetRetrieveStatus(me) returns RetrievableStatus from CDF;
+ GetRetrieveStatus(me) returns ReaderStatus from PCDM;
---C++: inline
---Purpose: Checks status after Retrieve
is private;
CanRetrieve(me: mutable; aMetaData: MetaData from CDM)
- returns RetrievableStatus from CDF
+ returns ReaderStatus from PCDM
is private;
fields
myDefaultFolder: ExtendedString from TCollection;
- myRetrievableStatus : RetrievableStatus from CDF is protected;
+ myRetrievableStatus : ReaderStatus from PCDM is protected;
friends
class Session from CDF--,
#include <CDF_Session.hxx>
#include <CDF_Directory.hxx>
#include <CDF_MetaDataDriver.hxx>
-#include <CDF_RetrievableStatus.hxx>
+#include <PCDM_ReaderStatus.hxx>
#include <PCDM_ReadWriter.hxx>
#include <PCDM_RetrievalDriver.hxx>
#include <PCDM_StorageDriver.hxx>
-#include <PCDM_ReaderStatus.hxx>
+
#include <Plugin.hxx>
#include <UTL.hxx>
//function :
//purpose :
//=======================================================================
-CDF_Application::CDF_Application():myRetrievableStatus(CDF_RS_OK) {}
+CDF_Application::CDF_Application():myRetrievableStatus(PCDM_RS_OK) {}
//=======================================================================
//function : Load
//function : CanRetrieve
//purpose :
//=======================================================================
-CDF_RetrievableStatus CDF_Application::CanRetrieve(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName) {
+PCDM_ReaderStatus CDF_Application::CanRetrieve(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName) {
TCollection_ExtendedString aVersion;
return CanRetrieve(aFolder,aName,aVersion);
}
//function : CanRetrieve
//purpose :
//=======================================================================
-CDF_RetrievableStatus CDF_Application::CanRetrieve(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const TCollection_ExtendedString& aVersion) {
+PCDM_ReaderStatus CDF_Application::CanRetrieve(const TCollection_ExtendedString& aFolder, const TCollection_ExtendedString& aName, const TCollection_ExtendedString& aVersion) {
#ifdef DEB
CDF_Timer theTimer;
#endif
if (!theMetaDataDriver->Find(aFolder,aName,aVersion))
- return CDF_RS_UnknownDocument;
+ return PCDM_RS_UnknownDocument;
else if (!theMetaDataDriver->HasReadPermission(aFolder,aName,aVersion))
- return CDF_RS_PermissionDenied;
+ return PCDM_RS_PermissionDenied;
else {
#ifdef DEB
theTimer.ShowAndRestart("theMetaDataDriver->Find: ");
if(theMetaData->IsRetrieved()) {
return theMetaData->Document()->IsModified()
- ? CDF_RS_AlreadyRetrievedAndModified : CDF_RS_AlreadyRetrieved;
+ ? PCDM_RS_AlreadyRetrievedAndModified : PCDM_RS_AlreadyRetrieved;
}
else {
TCollection_ExtendedString theFileName=theMetaData->FileName();
theFormat=UTL::Value(Resources(),ResourceName);
}
else
- return CDF_RS_UnrecognizedFileFormat;
+ return PCDM_RS_UnrecognizedFileFormat;
}
- if(!FindReaderFromFormat(theFormat)) return CDF_RS_NoDriver;
+ if(!FindReaderFromFormat(theFormat)) return PCDM_RS_NoDriver;
}
}
- return CDF_RS_OK;
+ return PCDM_RS_OK;
}
return Retrieve(aMetaData,UseStorageConfiguration,Standard_True);
}
-//=======================================================================
-//function : ConvertStatus
-//purpose :
-//=======================================================================
-static CDF_RetrievableStatus ConvertStatus(const PCDM_ReaderStatus theStatus) {
- CDF_RetrievableStatus aStatus;
- switch(theStatus) {
- case PCDM_RS_OK:
- aStatus=CDF_RS_OK;
- break;
- case PCDM_RS_NoDriver:
- aStatus=CDF_RS_NoDriver;
- break;
- case PCDM_RS_UnknownFileDriver:
- aStatus=CDF_RS_UnknownFileDriver;
- break;
- case PCDM_RS_OpenError:
- aStatus=CDF_RS_OpenError;
- break;
- case PCDM_RS_NoVersion:
- aStatus=CDF_RS_NoVersion;
- break;
- case PCDM_RS_NoSchema:
- aStatus=CDF_RS_NoSchema;
- break;
- case PCDM_RS_NoDocument:
- aStatus=CDF_RS_NoDocument;
- break;
- case PCDM_RS_ExtensionFailure:
- aStatus=CDF_RS_ExtensionFailure;
- break;
- case PCDM_RS_WrongStreamMode:
- aStatus=CDF_RS_WrongStreamMode;
- break;
- case PCDM_RS_FormatFailure:
- aStatus=CDF_RS_FormatFailure;
- break;
- case PCDM_RS_TypeFailure:
- aStatus=CDF_RS_TypeFailure;
- break;
- case PCDM_RS_TypeNotFoundInSchema:
- aStatus=CDF_RS_TypeNotFoundInSchema;
- break;
- case PCDM_RS_UnrecognizedFileFormat:
- aStatus=CDF_RS_UnrecognizedFileFormat;
- break;
- case PCDM_RS_MakeFailure:
- aStatus=CDF_RS_MakeFailure;
- break;
- case PCDM_RS_PermissionDenied:
- aStatus=CDF_RS_PermissionDenied;
- break;
- default:
- aStatus=CDF_RS_DriverFailure;
- }
- return aStatus;
-}
-
//=======================================================================
//function : Retrieve
//purpose :
Handle(CDM_Document) CDF_Application::Retrieve(const Handle(CDM_MetaData)& aMetaData,const Standard_Boolean UseStorageConfiguration, const Standard_Boolean IsComponent) {
Handle(CDM_Document) theDocumentToReturn;
- myRetrievableStatus = CDF_RS_DriverFailure;
+ myRetrievableStatus = PCDM_RS_DriverFailure;
if(IsComponent) {
Standard_SStream aMsg;
switch (CanRetrieve(aMetaData)) {
- case CDF_RS_UnknownDocument:
+ case PCDM_RS_UnknownDocument:
aMsg << "could not find the referenced document: " << aMetaData->Path() << "; not found." <<(char)0 << endl;
- myRetrievableStatus = CDF_RS_UnknownDocument;
+ myRetrievableStatus = PCDM_RS_UnknownDocument;
Standard_Failure::Raise(aMsg);
break;
- case CDF_RS_PermissionDenied:
+ case PCDM_RS_PermissionDenied:
aMsg << "Could not find the referenced document: " << aMetaData->Path() << "; permission denied. " <<(char)0 << endl;
- myRetrievableStatus = CDF_RS_PermissionDenied;
+ myRetrievableStatus = PCDM_RS_PermissionDenied;
Standard_Failure::Raise(aMsg);
break;
default:
}
Standard_Boolean AlreadyRetrieved=aMetaData->IsRetrieved();
- if(AlreadyRetrieved) myRetrievableStatus = CDF_RS_AlreadyRetrieved;
+ if(AlreadyRetrieved) myRetrievableStatus = PCDM_RS_AlreadyRetrieved;
Standard_Boolean Modified=AlreadyRetrieved && aMetaData->Document()->IsModified();
- if(Modified) myRetrievableStatus = CDF_RS_AlreadyRetrievedAndModified;
+ if(Modified) myRetrievableStatus = PCDM_RS_AlreadyRetrievedAndModified;
if(!AlreadyRetrieved || Modified) {
Handle(PCDM_Reader) theReader=Reader(aMetaData->FileName());
theReader->Read(aMetaData->FileName(),theDocument,this);
}
catch (Standard_Failure) {
- PCDM_ReaderStatus aStatus = theReader->GetStatus();
- myRetrievableStatus = ConvertStatus(aStatus);
- if(myRetrievableStatus > CDF_RS_AlreadyRetrieved){
+ myRetrievableStatus = theReader->GetStatus();
+ if(myRetrievableStatus > PCDM_RS_AlreadyRetrieved){
Standard_SStream aMsg;
aMsg << Standard_Failure::Caught() << endl;
Standard_Failure::Raise(aMsg);
}
}
- PCDM_ReaderStatus aStatus = theReader->GetStatus();
- myRetrievableStatus = ConvertStatus(aStatus);
-
+ myRetrievableStatus = theReader->GetStatus();
theDocument->SetMetaData(aMetaData);
theDocumentToReturn=theDocument;
if(!FindReaderFromFormat(aFormat,thePluginId,UnfoundResourceName)) {
Standard_SStream aMsg;
aMsg << "Could not found the item:" << UnfoundResourceName <<(char)0;
- myRetrievableStatus = CDF_RS_WrongResource;
+ myRetrievableStatus = PCDM_RS_WrongResource;
Standard_NoSuchObject::Raise(aMsg);
}
Handle(PCDM_Reader) R;
R = Handle(PCDM_Reader)::DownCast(Plugin::Load(thePluginId));
}
catch (Standard_Failure) {
- myRetrievableStatus = CDF_RS_WrongResource;
+ myRetrievableStatus = PCDM_RS_WrongResource;
Standard_SStream aMsg;
aMsg << Standard_Failure::Caught() << endl;
Standard_Failure::Raise(aMsg);
RD->SetFormat(aFormat);
return RD;
} else
- myRetrievableStatus = CDF_RS_WrongResource;
+ myRetrievableStatus = PCDM_RS_WrongResource;
return R;
}
//function : CanRetrieve
//purpose :
//=======================================================================
-CDF_RetrievableStatus CDF_Application::CanRetrieve(const Handle(CDM_MetaData)& aMetaData) {
+PCDM_ReaderStatus CDF_Application::CanRetrieve(const Handle(CDM_MetaData)& aMetaData) {
if(aMetaData->HasVersion())
return CanRetrieve(aMetaData->Folder(),aMetaData->Name(),aMetaData->Version());
else
// ! szy ! Creation !26-06-2003! 5.0-20-%L%!
// +---------------------------------------------------------------------------+
-inline CDF_RetrievableStatus CDF_Application::GetRetrieveStatus() const {
+inline PCDM_ReaderStatus CDF_Application::GetRetrieveStatus() const {
return myRetrievableStatus;
}
// @@SDM: begin
SubComponentStatus from CDF,
ExtendedString from TCollection,
StoreList from CDF,
- StoreStatus from CDF,
+ StoreStatus from PCDM,
ExtendedString from TCollection
is
-- be used just after Realize or Import -- method to know if
-- thes methods worked correctly, and if not why.
- StoreStatus(me) returns StoreStatus from CDF;
+ StoreStatus(me) returns StoreStatus from PCDM;
AssociatedStatusText(me) returns ExtString from Standard;
---Category: Private methods
myPath: ExtendedString from TCollection;
myText: ExtendedString from TCollection;
- myStatus: StoreStatus from CDF;
+ myStatus: StoreStatus from PCDM;
end Store from CDF;
#include <CDF_Store.ixx>
#include <CDF_Session.hxx>
#include <CDF_Application.hxx>
-#include <CDF_StoreStatus.hxx>
+#include <PCDM_StoreStatus.hxx>
#include <CDF_StoreSetNameStatus.hxx>
#include <Standard_ProgramError.hxx>
#include <CDF_MetaDataDriver.hxx>
Handle(CDM_MetaData) m;
myText = "";
myStatus = myList->Store(m,myText);
- if(myStatus==CDF_SS_OK) myPath = m->Path();
+ if(myStatus==PCDM_SS_OK) myPath = m->Path();
}
Standard_ExtString CDF_Store::Path() const {
return myPath.ToExtString();
-CDF_StoreStatus CDF_Store::StoreStatus() const {
+PCDM_StoreStatus CDF_Store::StoreStatus() const {
return myStatus;
}
Standard_ExtString CDF_Store::AssociatedStatusText() const {
private class StoreList from CDF inherits Transient from Standard
-uses Document from CDM, StackOfDocument from CDM, MapOfDocument from CDM, MapIteratorOfMapOfDocument from CDM, StackIteratorOfStackOfDocument from CDM,MetaData from CDM, ExtendedString from TCollection, StoreStatus from CDF
+uses
+ Document from CDM,
+ StackOfDocument from CDM,
+ MapOfDocument from CDM,
+ MapIteratorOfMapOfDocument from CDM,
+ StackIteratorOfStackOfDocument from CDM,
+ MetaData from CDM,
+ ExtendedString from TCollection,
+ StoreStatus from PCDM
raises NoSuchObject from Standard
is
Store(me: mutable; aMetaData: out MetaData from CDM;
aStatusAssociatedText: out ExtendedString from TCollection)
- returns StoreStatus from CDF
+ returns StoreStatus from PCDM
---Purpose: stores each object of the storelist in the reverse
-- order of which they had been added.
raises NoSuchObject from Standard;
Handle(CDM_Document) CDF_StoreList::Value() const {
return myIterator.Key();
}
-CDF_StoreStatus CDF_StoreList::Store (Handle(CDM_MetaData)& aMetaData, TCollection_ExtendedString& aStatusAssociatedText) {
+PCDM_StoreStatus CDF_StoreList::Store (Handle(CDM_MetaData)& aMetaData, TCollection_ExtendedString& aStatusAssociatedText) {
Handle(CDF_MetaDataDriver) theMetaDataDriver = CDF_Session::CurrentSession()->MetaDataDriver();
- static CDF_StoreStatus status ;
- status = CDF_SS_OK;
+ PCDM_StoreStatus status = PCDM_SS_OK;
{
try {
OCC_CATCH_SIGNALS
for (; !myStack.IsEmpty(); myStack.Pop()) {
-
- Handle(CDM_Document) theDocument = myStack.Top();
- if( theDocument == myMainDocument || theDocument->IsModified()) {
-
- if(!PCDM::FindStorageDriver(theDocument)){
- Standard_SStream aMsg;
- aMsg <<"No storage driver does exist for this format: " << theDocument->StorageFormat() << (char)0;
- Standard_Failure::Raise(aMsg);
- }
-
-
- if(!theMetaDataDriver->FindFolder(theDocument->RequestedFolder())) {
- Standard_SStream aMsg; aMsg << "could not find the active dbunit";
- aMsg << TCollection_ExtendedString(theDocument->RequestedFolder())<< (char)0;
- Standard_NoSuchObject::Raise(aMsg);
- }
- TCollection_ExtendedString theName=theMetaDataDriver->BuildFileName(theDocument);
-
- CDF_Timer theTimer;
-
- PCDM::StorageDriver(theDocument)->Write(theDocument,theName);
- theTimer.ShowAndRestart("Driver->Write: ");
-
- aMetaData = theMetaDataDriver->CreateMetaData(theDocument,theName);
- theTimer.ShowAndStop("metadata creating: ");
-
- theDocument->SetMetaData(aMetaData);
-
-
- CDM_ReferenceIterator it(theDocument);
- for(; it.More();it.Next()) {
- theMetaDataDriver->CreateReference(aMetaData,it.Document()->MetaData(),it.ReferenceIdentifier(),it.DocumentVersion());
- }
-
- }
+
+ Handle(CDM_Document) theDocument = myStack.Top();
+ if( theDocument == myMainDocument || theDocument->IsModified()) {
+
+ if(!PCDM::FindStorageDriver(theDocument)){
+ Standard_SStream aMsg;
+ aMsg <<"No storage driver does exist for this format: " << theDocument->StorageFormat() << (char)0;
+ Standard_Failure::Raise(aMsg);
+ }
+
+ if(!theMetaDataDriver->FindFolder(theDocument->RequestedFolder())) {
+ Standard_SStream aMsg; aMsg << "could not find the active dbunit";
+ aMsg << TCollection_ExtendedString(theDocument->RequestedFolder())<< (char)0;
+ Standard_NoSuchObject::Raise(aMsg);
+ }
+ TCollection_ExtendedString theName=theMetaDataDriver->BuildFileName(theDocument);
+
+ CDF_Timer theTimer;
+ Handle(PCDM_StorageDriver) aDocumentStorageDriver = PCDM::StorageDriver(theDocument);
+
+ aDocumentStorageDriver->Write(theDocument,theName);
+ status = aDocumentStorageDriver->GetStoreStatus();
+
+ theTimer.ShowAndRestart("Driver->Write: ");
+
+ aMetaData = theMetaDataDriver->CreateMetaData(theDocument,theName);
+ theTimer.ShowAndStop("metadata creating: ");
+
+ theDocument->SetMetaData(aMetaData);
+
+ CDM_ReferenceIterator it(theDocument);
+ for(; it.More();it.Next()) {
+ theMetaDataDriver->CreateReference(aMetaData,it.Document()->MetaData(),it.ReferenceIdentifier(),it.DocumentVersion());
+ }
+ }
}
}
catch (CDF_MetaDataDriverError) {
CAUGHT(aStatusAssociatedText,TCollection_ExtendedString("metadatadriver failed; reason:"));
- status = CDF_SS_DriverFailure;
+ status = PCDM_SS_DriverFailure;
}
catch (Standard_Failure) {
CAUGHT(aStatusAssociatedText,TCollection_ExtendedString("driver failed; reason:"));
- status = CDF_SS_Failure;
+ status = PCDM_SS_Failure;
}
}
di <<"document " << insession << " is already in session" << "\n";
return 0;
}
- CDF_RetrievableStatus theStatus = A->Open(path,D);
- if (theStatus == CDF_RS_OK && !D.IsNull()) {
+ PCDM_ReaderStatus theStatus = A->Open(path,D);
+ if (theStatus == PCDM_RS_OK && !D.IsNull()) {
Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(D);
TDataStd_Name::Set(D->GetData()->Root(),a[2]);
Draw::Set(a[2],DD);
return 0;
} else {
switch ( theStatus ) {
- case CDF_RS_AlreadyRetrieved:
- case CDF_RS_AlreadyRetrievedAndModified: {
+ case PCDM_RS_AlreadyRetrieved:
+ case PCDM_RS_AlreadyRetrievedAndModified: {
di << " already retrieved " << "\n" ;
break;
}
- case CDF_RS_NoDriver: {
+ case PCDM_RS_NoDriver: {
di << " could not retrieve , no Driver to make it " <<"\n" ;
break ;
}
- case CDF_RS_UnknownDocument:
- case CDF_RS_NoModel: {
+ case PCDM_RS_UnknownDocument:
+ case PCDM_RS_NoModel: {
di << " could not retrieve , Unknown Document or No Model " <<"\n";
break ;
}
- case CDF_RS_TypeNotFoundInSchema:
- case CDF_RS_UnrecognizedFileFormat: {
+ case PCDM_RS_TypeNotFoundInSchema:
+ case PCDM_RS_UnrecognizedFileFormat: {
di << " could not retrieve , Type not found or Unrecognized File Format" <<"\n";
break ;
}
- case CDF_RS_PermissionDenied: {
+ case PCDM_RS_PermissionDenied: {
di << " could not retrieve , permission denied " << "\n" ;
break;
}
-
+ default:
+ di << " could not retrieve " << "\n" ;
+ break;
}
di << "DDocStd_Open : Error" << "\n";
}
TCollection_ExtendedString path (a[2]);
Handle(TDocStd_Application) A;
if (!DDocStd::Find(A)) return 1;
- CDF_StoreStatus theStatus = A->SaveAs(D,path);
- if (theStatus != CDF_SS_OK ) {
+ PCDM_StoreStatus theStatus = A->SaveAs(D,path);
+ if (theStatus != PCDM_SS_OK ) {
switch ( theStatus ) {
- case CDF_SS_DriverFailure: {
+ case PCDM_SS_DriverFailure: {
di << " could not store , no driver found to make it " <<"\n" ;
break ;
}
- case CDF_SS_WriteFailure: {
+ case PCDM_SS_WriteFailure: {
di << " Write access failure " << "\n" ;
break;
}
- case CDF_SS_Failure: {
+ case PCDM_SS_Failure: {
di << " Write failure " << "\n" ;
}
}
RS_UnrecognizedFileFormat,
RS_MakeFailure,
RS_PermissionDenied,
- RS_DriverFailure
+ RS_DriverFailure,
+ RS_AlreadyRetrievedAndModified,
+ RS_AlreadyRetrieved,
+ RS_UnknownDocument,
+ RS_WrongResource,
+ RS_NoModel
end ReaderStatus;
-
+
+ enumeration StoreStatus is
+ SS_OK,
+ SS_DriverFailure,
+ SS_WriteFailure,
+ SS_Failure,
+ SS_DiskWritingFailure,
+ SS_UserRightsFailure,
+ SS_Doc_IsNull,
+ SS_No_Obj,
+ SS_Info_Section_Error
+ end StoreStatus;
deferred class Document;
class SequenceOfDocument instantiates Sequence from TCollection(Document from PCDM);
returns TypeOfFileDriver from PCDM
is private;
end PCDM;
-
--
---Category: persistent implemention of storage.
-uses Document from CDM, Document from PCDM, Data from Storage, ExtendedString from TCollection, Schema from Storage,SequenceOfExtendedString from TColStd, SequenceOfDocument from PCDM
+uses
+ Document from CDM,
+ Document from PCDM,
+ Data from Storage,
+ ExtendedString from TCollection,
+ Schema from Storage,
+ SequenceOfExtendedString from TColStd,
+ SequenceOfDocument from PCDM,
+ StoreStatus from PCDM
raises NoSuchObject from Standard,DriverError from PCDM
is
GetFormat (me)
returns ExtendedString from TCollection;
-
+
+ IsError (me) returns Boolean from Standard;
+ SetIsError(me : mutable; theIsError : Boolean);
+
+ GetStoreStatus (me) returns StoreStatus from PCDM;
+ SetStoreStatus(me : mutable; theStoreStatus : StoreStatus from PCDM);
+
fields
myFormat : ExtendedString from TCollection;
+ myIsError: Boolean from Standard;
+ myStoreStatus: StoreStatus from PCDM;
end StorageDriver from PCDM;
{
return myFormat;
}
+
+//=======================================================================
+//function : IsError
+//purpose :
+//=======================================================================
+
+Standard_Boolean PCDM_StorageDriver::IsError () const
+{
+ return myIsError;
+}
+
+//=======================================================================
+//function : SetIsError
+//purpose :
+//=======================================================================
+void PCDM_StorageDriver::SetIsError(const Standard_Boolean theIsError)
+{
+ myIsError = theIsError;
+}
+
+//=======================================================================
+//function : GetStoreStatus
+//purpose :
+//=======================================================================
+
+PCDM_StoreStatus PCDM_StorageDriver::GetStoreStatus () const
+{
+ return myStoreStatus;
+}
+//=======================================================================
+//function : SetStoreStatus
+//purpose :
+//=======================================================================
+void PCDM_StorageDriver::SetStoreStatus(const PCDM_StoreStatus theStoreStatus)
+{
+ myStoreStatus = theStoreStatus;
+}
di<<2;
return 0;
}
- CDF_RetrievableStatus Result = A->Open(path,D);
- if(Result==CDF_RS_OK){
+ PCDM_ReaderStatus Result = A->Open(path,D);
+ if(Result==PCDM_RS_OK){
di<<0;
return 0;
}
#include <TDocStd_Document.hxx>
#include <DDocStd.hxx>
-#include <CDF_StoreStatus.hxx>
+#include <PCDM_StoreStatus.hxx>
#include <TDocStd_Application.hxx>
static Standard_Integer OCC381_Save (Draw_Interpretor& di, Standard_Integer nb, const char ** a)
di << "this document has never been saved" << "\n";
return 0;
}
- CDF_StoreStatus theStatus = A->Save(D, theStatusMessage);
- if (theStatus != CDF_SS_OK ) {
+ PCDM_StoreStatus theStatus = A->Save(D, theStatusMessage);
+ if (theStatus != PCDM_SS_OK ) {
switch ( theStatus ) {
- case CDF_SS_DriverFailure: {
+ case PCDM_SS_DriverFailure: {
di << " Could not store , no driver found to make it " <<"\n" ;
break ;
}
- case CDF_SS_WriteFailure: {
+ case PCDM_SS_WriteFailure: {
di << " Write access failure " << "\n" ;
break;
}
- case CDF_SS_Failure: {
+ case PCDM_SS_Failure: {
di << " Write failure " << "\n" ;
}
}
if (!DDocStd::Find(A)) return 1;
TCollection_ExtendedString theStatusMessage;
- CDF_StoreStatus theStatus = A->SaveAs(D,path, theStatusMessage);
- if (theStatus != CDF_SS_OK ) {
+ PCDM_StoreStatus theStatus = A->SaveAs(D,path, theStatusMessage);
+ if (theStatus != PCDM_SS_OK ) {
switch ( theStatus ) {
- case CDF_SS_DriverFailure: {
+ case PCDM_SS_DriverFailure: {
di << " Could not store , no driver found to make it " <<"\n" ;
break ;
}
- case CDF_SS_WriteFailure: {
+ case PCDM_SS_WriteFailure: {
di << " Write access failure " << "\n" ;
break;
}
- case CDF_SS_Failure: {
+ case PCDM_SS_Failure: {
di << " Write failure " << "\n" ;
}
}
// 3. Open document
TCollection_ExtendedString name(argv[2]);
Handle(TDocStd_Document) Doc;
- if(App->Open(name, Doc) != CDF_RS_OK) { di << "Error OCC363 : document was not opened successfully\n"; return 1;}
+ if(App->Open(name, Doc) != PCDM_RS_OK) { di << "Error OCC363 : document was not opened successfully\n"; return 1;}
Handle(DDocStd_DrawDocument) DD = new DDocStd_DrawDocument(Doc);
TDataStd_Name::Set(Doc->GetData()->Root(),argv[1]);
Draw::Set(argv[1],DD);
Handle(TDF_Reference) ref = TDF_Reference::Set(doc_std->Main(), Lstd3);
//
// Save
- //if (app->SaveAs(doc_std, "W:\\doc.std") != CDF_SS_OK)
- if (app->SaveAs(doc_std, aFile1) != CDF_SS_OK)
+ //if (app->SaveAs(doc_std, "W:\\doc.std") != PCDM_SS_OK)
+ if (app->SaveAs(doc_std, aFile1) != PCDM_SS_OK)
return 1;
intlist.Nullify();
dbllist.Nullify();
ref.Nullify();
app->Close(doc_std);
doc_std.Nullify();
- //if (app->Open("W:\\doc.std", doc_std_open) != CDF_RS_OK)
- if (app->Open(aFile1, doc_std_open) != CDF_RS_OK)
+ //if (app->Open("W:\\doc.std", doc_std_open) != PCDM_RS_OK)
+ if (app->Open(aFile1, doc_std_open) != PCDM_RS_OK)
return 2;
if (!doc_std_open->Main().IsAttribute(TDataStd_Tick::GetID()))
return 3;
ref = TDF_Reference::Set(doc_xml->Main(), Lstd3);
//
// Save
- //if (app->SaveAs(doc_xml, "W:\\doc.xml") != CDF_SS_OK)
- if (app->SaveAs(doc_xml, aFile2) != CDF_SS_OK)
+ //if (app->SaveAs(doc_xml, "W:\\doc.xml") != PCDM_SS_OK)
+ if (app->SaveAs(doc_xml, aFile2) != PCDM_SS_OK)
return 1;
intlist.Nullify();
ref.Nullify();
app->Close(doc_xml);
doc_xml.Nullify();
- //if (app->Open("W:\\doc.xml", doc_xml_open) != CDF_RS_OK)
- if (app->Open(aFile2, doc_xml_open) != CDF_RS_OK)
+ //if (app->Open("W:\\doc.xml", doc_xml_open) != PCDM_RS_OK)
+ if (app->Open(aFile2, doc_xml_open) != PCDM_RS_OK)
return 2;
if (!doc_xml_open->Main().IsAttribute(TDataStd_Tick::GetID()))
return 3;
ref = TDF_Reference::Set(doc_bin->Main(), Lstd3);
//
// Save
- //if (app->SaveAs(doc_bin, "W:\\doc.cbf") != CDF_SS_OK)
- if (app->SaveAs(doc_bin, aFile3) != CDF_SS_OK)
+ //if (app->SaveAs(doc_bin, "W:\\doc.cbf") != PCDM_SS_OK)
+ if (app->SaveAs(doc_bin, aFile3) != PCDM_SS_OK)
return 1;
intlist.Nullify();
ref.Nullify();
app->Close(doc_bin);
doc_bin.Nullify();
- //if (app->Open("W:\\doc.cbf", doc_bin_open) != CDF_RS_OK)
- if (app->Open(aFile3, doc_bin_open) != CDF_RS_OK)
+ //if (app->Open("W:\\doc.cbf", doc_bin_open) != PCDM_RS_OK)
+ if (app->Open(aFile3, doc_bin_open) != PCDM_RS_OK)
return 2;
if (!doc_bin_open->Main().IsAttribute(TDataStd_Tick::GetID()))
return 3;
Handle(TDocStd_Application) A;
if (!DDocStd::Find(A)) return 1;
- CDF_StoreStatus theStatus = A->SaveAs(D,path);
- if (theStatus == CDF_SS_OK ) {
- di << "OCC267 : CDF_StoreStatus = CDF_SS_OK" << "\n";
+ PCDM_StoreStatus theStatus = A->SaveAs(D,path);
+ if (theStatus == PCDM_SS_OK ) {
+ di << "OCC267 : PCDM_StoreStatus = PCDM_SS_OK" << "\n";
} else {
- di << "OCC267 : CDF_StoreStatus = Bad_Store_Status" << "\n";
+ di << "OCC267 : PCDM_StoreStatus = Bad_Store_Status" << "\n";
}
return 0;
Standard,
CDF,
CDM,
+ PCDM,
MDF,
TDF,
TColStd,
CString from Standard,
ExtendedString from TCollection,
SequenceOfExtendedString from TColStd,
- RetrievableStatus from CDF,
- StoreStatus from CDF
+ ReaderStatus from PCDM,
+ StoreStatus from PCDM
raises NoSuchObject from Standard
-- In order not to override a version of aDoc which
-- is already in memory, this method can be made
-- to depend on the value returned by IsInSession.
- returns RetrievableStatus from CDF;
+ returns ReaderStatus from PCDM;
SaveAs (me : mutable; aDoc : Document from TDocStd;
path : ExtendedString from TCollection)
---Purpose: Save the active document in the file <name> in the
-- path <path> ; o verwrites the file if it already exists.
- returns StoreStatus from CDF;
+ returns StoreStatus from PCDM;
Save (me : mutable; aDoc : Document from TDocStd)
-- Exceptions:
-- Standard_NotImplemented if the document
-- was not retrieved in the applicative session by using Open.
- returns StoreStatus from CDF;
+ returns StoreStatus from PCDM;
SaveAs (me : mutable; aDoc : Document from TDocStd;
path : ExtendedString from TCollection;
---Purpose: Save the active document in the file <name> in the
-- path <path> . overwrite the file if it
-- already exist.
- returns StoreStatus from CDF;
+ returns StoreStatus from PCDM;
Save (me : mutable; aDoc : Document from TDocStd;
theStatusMessage: out ExtendedString from TCollection)
---Purpose: Save the document overwriting the previous file
- returns StoreStatus from CDF;
+ returns StoreStatus from PCDM;
--Exit (me)
-- to quit the application. the applicative documents must be closed before.
class Document from TDocStd
end Application;
-
//purpose :
//=======================================================================
-CDF_RetrievableStatus TDocStd_Application::Open(const TCollection_ExtendedString& path,Handle(TDocStd_Document)& aDoc) {
- CDF_RetrievableStatus status = CDF_RS_DriverFailure;
+PCDM_ReaderStatus TDocStd_Application::Open(const TCollection_ExtendedString& path,Handle(TDocStd_Document)& aDoc) {
+ PCDM_ReaderStatus status = PCDM_RS_DriverFailure;
TDocStd_PathParser tool (path);
TCollection_ExtendedString directory = tool.Trek();
TCollection_ExtendedString file = tool.Name();
file+=tool.Extension();
#ifdef BUC60867
status = CanRetrieve(directory,file);
- if (status != CDF_RS_OK) return status;
+ if (status != PCDM_RS_OK) return status;
#endif
try {
OCC_CATCH_SIGNALS
//purpose :
//=======================================================================
-CDF_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,const TCollection_ExtendedString& path) {
+PCDM_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,const TCollection_ExtendedString& path) {
TDocStd_PathParser tool (path);
TCollection_ExtendedString directory = tool.Trek();
TCollection_ExtendedString file = tool.Name();
MessageDriver()->Write(aString.ToExtString());
}
}
- if(storer.StoreStatus() == CDF_SS_OK)
+ if(storer.StoreStatus() == PCDM_SS_OK)
D->SetSaved();
#ifdef BUC60867
#ifdef DEB
//purpose :
//=======================================================================
-CDF_StoreStatus TDocStd_Application::Save (const Handle(TDocStd_Document)& D) {
+PCDM_StoreStatus TDocStd_Application::Save (const Handle(TDocStd_Document)& D) {
#ifdef BUC60867
- CDF_StoreStatus status = CDF_SS_OK;
+ PCDM_StoreStatus status = PCDM_SS_OK;
#endif
if (D->IsSaved()) {
CDF_Store storer (D);
MessageDriver()->Write(aString.ToExtString());
}
}
- if(storer.StoreStatus() == CDF_SS_OK)
+ if(storer.StoreStatus() == PCDM_SS_OK)
D->SetSaved();
#ifdef BUC60867
status = storer.StoreStatus();
#endif
} else {
-// Standard_DomainError::Raise ("TDocStd_Application::Save document is not already saved");
if(!MessageDriver().IsNull()) {
- TCollection_ExtendedString aMsg("Document is already saved");
+ TCollection_ExtendedString aMsg("Document has not been saved yet");
MessageDriver()->Write(aMsg.ToExtString());
}
- status = CDF_SS_Failure;
+ status = PCDM_SS_Failure;
}
#ifdef BUC60867
#ifdef DEB
//purpose :
//=======================================================================
-CDF_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,
+PCDM_StoreStatus TDocStd_Application::SaveAs(const Handle(TDocStd_Document)& D,
const TCollection_ExtendedString& path,
TCollection_ExtendedString& theStatusMessage)
{
TDocStd_PathParser tool (path);
- CDF_StoreStatus aStatus = CDF_SS_Failure;
+ PCDM_StoreStatus aStatus = PCDM_SS_Failure;
TCollection_ExtendedString directory = tool.Trek();
TCollection_ExtendedString file = tool.Name();
file+=".";
MessageDriver()->Write(aString.ToExtString());
}
}
- if(storer.StoreStatus() == CDF_SS_OK)
+ if(storer.StoreStatus() == PCDM_SS_OK)
D->SetSaved();
theStatusMessage = storer.AssociatedStatusText();
aStatus = storer.StoreStatus();
theStatusMessage =
TCollection_ExtendedString("TDocStd_Application::SaveAs"
": No such directory ") + directory;
- aStatus = CDF_SS_Failure;
+ aStatus = PCDM_SS_Failure;
}
return aStatus;
}
//purpose :
//=======================================================================
-CDF_StoreStatus TDocStd_Application::Save (const Handle(TDocStd_Document)& D,
+PCDM_StoreStatus TDocStd_Application::Save (const Handle(TDocStd_Document)& D,
TCollection_ExtendedString& theStatusMessage)
{
- CDF_StoreStatus status = CDF_SS_OK;
+ PCDM_StoreStatus status = PCDM_SS_OK;
if (D->IsSaved()) {
CDF_Store storer (D);
try {
MessageDriver()->Write(aString.ToExtString());
}
}
- if(storer.StoreStatus() == CDF_SS_OK)
+ if(storer.StoreStatus() == PCDM_SS_OK)
D->SetSaved();
status = storer.StoreStatus();
theStatusMessage = storer.AssociatedStatusText();
} else {
- Standard_DomainError::Raise ("TDocStd_Application::Save"
- " document is not already saved");
- theStatusMessage = "TDocStd_Application::the document is not already saved";
+ theStatusMessage = "TDocStd_Application::the document has not been saved yet";
+ status = PCDM_SS_Failure;
}
return status;
}
.TObj_Appl_SWriteFailure
Error saving document %s : write failure
+
+.TObj_Appl_SFailure
+ Error saving document %s : general failure of persistence driver
+
+.TObj_Appl_SDiskWritingFailure
+ Error saving document %s : possibly the disk is full or other disk write problem occurred
+
+.TObj_Appl_SDocIsNull
+ Error saving document %s : No document to save
+
+.TObj_Appl_SNoObj
+ Error saving document %s : No objects written
+
+.TObj_Appl_SInfoSectionError
+ Error saving document %s : Write info section failure
.TObj_Appl_SUnknownFailure
Error saving document %s : unknown failure
myIsError = Standard_False;
TCollection_ExtendedString aPath ((const Standard_CString)theTargetFile);
- CDF_StoreStatus aStatus = SaveAs (theSourceDoc, aPath);
- myIsError = aStatus != CDF_SS_OK;
+ PCDM_StoreStatus aStatus = SaveAs (theSourceDoc, aPath);
+ myIsError = aStatus != PCDM_SS_OK;
if (myIsError)
{
switch (aStatus)
{
- case CDF_SS_DriverFailure:
+ case PCDM_SS_DriverFailure:
ErrorMessage (Message_Msg("TObj_Appl_SDriverFailure") << aPath);
break;
- case CDF_SS_WriteFailure:
+ case PCDM_SS_WriteFailure:
ErrorMessage (Message_Msg("TObj_Appl_SWriteFailure") << aPath);
break;
- case CDF_SS_Failure:
+ case PCDM_SS_Failure:
+ ErrorMessage (Message_Msg("TObj_Appl_SFailure") << aPath);
+ break;
+ case PCDM_SS_DiskWritingFailure:
+ ErrorMessage (Message_Msg("TObj_Appl_SDiskWritingFailure") << aPath);
+ break;
+ case PCDM_SS_Doc_IsNull:
+ ErrorMessage (Message_Msg("TObj_Appl_SDocIsNull") << aPath);
+ break;
+ case PCDM_SS_No_Obj:
+ ErrorMessage (Message_Msg("TObj_Appl_SNoObj") << aPath);
+ break;
+ case PCDM_SS_Info_Section_Error:
+ ErrorMessage (Message_Msg("TObj_Appl_SInfoSectionError") << aPath);
+ break;
default:
ErrorMessage (Message_Msg("TObj_Appl_SUnknownFailure") << aPath);
break;
myIsError = Standard_False;
TCollection_ExtendedString aPath ((const Standard_CString)theSourceFile);
- CDF_RetrievableStatus aStatus = (CDF_RetrievableStatus) -1;
+ PCDM_ReaderStatus aStatus = (PCDM_ReaderStatus) -1;
{
try
{
#endif
}
}
- myIsError = aStatus != CDF_RS_OK;
+ myIsError = aStatus != PCDM_RS_OK;
if (myIsError)
{
switch (aStatus)
{
- case CDF_RS_UnknownDocument:
+ case PCDM_RS_UnknownDocument:
ErrorMessage (Message_Msg("TObj_Appl_RUnknownDocument") << aPath);
break;
- case CDF_RS_AlreadyRetrieved:
+ case PCDM_RS_AlreadyRetrieved:
ErrorMessage (Message_Msg("TObj_Appl_RAlreadyRetrieved") << aPath);
break;
- case CDF_RS_AlreadyRetrievedAndModified:
+ case PCDM_RS_AlreadyRetrievedAndModified:
ErrorMessage (Message_Msg("TObj_Appl_RAlreadyRetrievedAndModified") << aPath);
break;
- case CDF_RS_NoDriver:
+ case PCDM_RS_NoDriver:
ErrorMessage (Message_Msg("TObj_Appl_RNoDriver") << aPath);
break;
- case CDF_RS_UnknownFileDriver:
+ case PCDM_RS_UnknownFileDriver:
ErrorMessage (Message_Msg("TObj_Appl_RNoDriver") << aPath);
break;
- case CDF_RS_OpenError:
+ case PCDM_RS_OpenError:
ErrorMessage (Message_Msg("TObj_Appl_ROpenError") << aPath);
break;
- case CDF_RS_NoVersion:
+ case PCDM_RS_NoVersion:
ErrorMessage (Message_Msg("TObj_Appl_RNoVersion") << aPath);
break;
- case CDF_RS_NoModel:
+ case PCDM_RS_NoModel:
ErrorMessage (Message_Msg("TObj_Appl_RNoModel") << aPath);
break;
- case CDF_RS_NoDocument:
+ case PCDM_RS_NoDocument:
ErrorMessage (Message_Msg("TObj_Appl_RNoDocument") << aPath);
break;
- case CDF_RS_FormatFailure:
+ case PCDM_RS_FormatFailure:
ErrorMessage (Message_Msg("TObj_Appl_RFormatFailure") << aPath);
break;
- case CDF_RS_TypeNotFoundInSchema:
+ case PCDM_RS_TypeNotFoundInSchema:
ErrorMessage (Message_Msg("TObj_Appl_RTypeNotFound") << aPath);
break;
- case CDF_RS_UnrecognizedFileFormat:
+ case PCDM_RS_UnrecognizedFileFormat:
ErrorMessage (Message_Msg("TObj_Appl_RBadFileFormat") << aPath);
break;
- case CDF_RS_MakeFailure:
+ case PCDM_RS_MakeFailure:
ErrorMessage (Message_Msg("TObj_Appl_RMakeFailure") << aPath);
break;
- case CDF_RS_PermissionDenied:
+ case PCDM_RS_PermissionDenied:
ErrorMessage (Message_Msg("TObj_Appl_RPermissionDenied") << aPath);
break;
- case CDF_RS_DriverFailure:
+ case PCDM_RS_DriverFailure:
ErrorMessage (Message_Msg("TObj_Appl_RDriverFailure") << aPath);
break;
case -1:
AddNamespace (me:mutable; thePrefix, theURI: AsciiString)
is protected;
- IsError (me) returns Boolean from Standard;
-
AttributeDrivers (me : mutable; theMsgDriver: MessageDriver from CDM)
returns ADriverTable from XmlMDF
is virtual;
mySeqOfNS : SequenceOfNamespaceDef from XmlLDrivers;
myCopyright : ExtendedString from TCollection;
myRelocTable: SRelocationTable from XmlObjMgt is protected;
- myIsError : Boolean from Standard is protected;
end DocumentStorageDriver;
::take_time (0, " +++++ Fin formatting to XML : ", aMessageDriver);
}else{
- myIsError = Standard_True;
+ SetIsError (Standard_True);
TCollection_ExtendedString aMsg =
TCollection_ExtendedString("Error: the file ") + aFileName +
" cannot be opened for writing";
XmlObjMgt_Element& theElement,
const TCollection_ExtendedString& theFileName)
{
- myIsError = Standard_False;
+ SetIsError(Standard_False);
Handle(CDM_MessageDriver) aMessageDriver =
theDocument -> Application() -> MessageDriver();
// 1. Write header information
}
catch (Standard_Failure)
{
- myIsError = Standard_True;
+ SetIsError (Standard_True);
TCollection_ExtendedString anErrorString (Standard_Failure::Caught()->GetMessageString());
aMessageDriver -> Write (anErrorString.ToExtString());
}
}
- if (anObjNb <= 0 && myIsError == Standard_False) {
- myIsError = Standard_True;
+ if (anObjNb <= 0 && IsError() == Standard_False) {
+ SetIsError (Standard_True);
TCollection_ExtendedString anErrorString ("error occurred");
aMessageDriver -> Write (anErrorString.ToExtString());
}
// 4. Write Shapes section
if(WriteShapeSection(theElement))
::take_time (0, " +++ Fin DOM data for Shapes : ", aMessageDriver);
- return myIsError;
+ return IsError();
}
//=======================================================================
return -1; // error
}
-//=======================================================================
-//function : IsError
-//purpose :
-//=======================================================================
-
-Standard_Boolean XmlLDrivers_DocumentStorageDriver::IsError () const
-{
- return myIsError;
-}
-
//=======================================================================
//function : AttributeDrivers
//purpose :