GME
13
|
00001 #ifndef MGA_COREXMLFILE_H 00002 #define MGA_COREXMLFILE_H 00003 00004 #include "StdAfx.h" 00005 #include "resource.h" 00006 #include <fstream>//fstream.h 00007 #include <list> 00008 #include <map> 00009 #include <hash_map> 00010 #include <set> 00011 #include <xercesc/dom/dom.hpp> 00012 #include "..\Mga\MgaGeneric.h" 00013 #include "CoreDictionaryAttributeValue.h" 00014 #include "XmlBackEnd.h" // for EXTERN_C const CLSID CLSID_CoreXmlFile; 00015 #include "OperOptions.h" 00016 #include "MsgConsole.h" 00017 #include "Transcoder.h" 00018 #include "HiClient.h" 00019 00020 const metaobjidpair_type ROOT_ID_PAIR = {METAID_ROOT, OBJID_ROOT}; 00021 00022 enum OpCode 00023 { 00024 ELEM_DELETED 00025 , ELEM_MOVED 00026 , ELEM_DERIVED 00027 , ELEM_REFERRED 00028 , ELEM_CONNECTED 00029 , ELEM_TAKESPARTINCONN 00030 , ELEM_REF_REDIRECTED 00031 , ELEM_TOTAL 00032 }; 00033 00034 class ParserLiterals 00035 { 00036 public: 00037 class Signer 00038 { 00039 public: 00040 static const XMLCh * users; 00041 static const XMLCh * user; 00042 static const XMLCh * name; 00043 static const XMLCh * since; 00044 static const XMLCh * until; 00045 }; 00046 class Protector 00047 { 00048 public: 00049 static const XMLCh * item; 00050 static const XMLCh * when; 00051 static const XMLCh * oper; 00052 static const XMLCh * gd; 00053 static const XMLCh * objects; 00054 }; 00055 class Main 00056 { 00057 public: 00058 static const XMLCh * deleted; 00059 static const XMLCh * metaId; 00060 static const XMLCh * id; 00061 static const XMLCh * parent; 00062 }; 00063 00064 static const XMLCh * newln; 00065 static const XMLCh * empty; 00066 }; 00067 00068 class HelperFiles 00069 { 00070 public: 00071 static const char * sessionFolderName; 00072 static const char * signFileName; 00073 static const char * protFileName; 00074 static const char * protFileExt; 00075 }; 00076 00077 struct GUID_less 00078 { 00079 bool operator()(const GUID& a, const GUID& b) const 00080 { 00081 if( a.Data1 < b.Data1 ) 00082 return true; 00083 else if( a.Data1 > b.Data1 ) 00084 return false; 00085 else 00086 { 00087 DWORD * adw = (DWORD*)&a; 00088 DWORD * bdw = (DWORD*)&b; 00089 if( *(adw+1) < *(bdw+1) ) 00090 return true; 00091 else if( *(adw+1) > *(bdw+1) ) 00092 return false; 00093 else if( *(adw+2) < *(bdw+2) ) 00094 return true; 00095 else if( *(adw+2) > *(bdw+2) ) 00096 return false; 00097 else if( *(adw+3) < *(bdw+3) ) 00098 return true; 00099 else 00100 return false; 00101 } 00102 } 00103 }; 00104 00105 class XmlObject; 00106 00107 struct XmlObjComp 00108 { 00109 bool operator()( XmlObject * p1, XmlObject * p2) const; 00110 }; 00111 00112 00113 00114 typedef std::set<XmlObject*, XmlObjComp> XmlObjSet; // ordered set, ensures xml files to look similar 00115 typedef XmlObjSet::iterator XmlObjSetIter; 00116 typedef std::vector<XmlObject*> XmlObjVec; 00117 typedef XmlObjVec::iterator XmlObjVecIter; 00118 typedef std::map<metaid_type,attrid_type> ParentMap; 00119 typedef std::map<GUID, XmlObject*,GUID_less> GUIDToXmlObjectMap; 00120 typedef GUIDToXmlObjectMap::iterator GUIDToXmlObjectMapIter; 00121 00122 00124 // XmlAttrBase class 00126 class XmlAttrBase 00127 { 00128 public: 00129 static XmlAttrBase * create (valtype_type type); 00130 00131 XmlAttrBase (); 00132 virtual ~XmlAttrBase (); 00133 00134 00135 virtual valtype_type getType () const = 0; 00136 virtual void fromVariant (VARIANT p) {} 00137 virtual void toVariant (VARIANT *p) const {} 00138 virtual void fromString (const char * str, const wchar_t* strw) {} 00139 virtual void toString (std::string& str) const {} 00140 }; 00141 00142 typedef std::map<attrid_type,XmlAttrBase*> AttribMap; 00143 typedef AttribMap::iterator AttribMapIter; 00144 00146 // XmlAttrLong class 00148 00149 class XmlAttrLong: public XmlAttrBase 00150 { 00151 public: 00152 XmlAttrLong (); 00153 00154 virtual valtype_type getType () const; 00155 virtual void fromVariant (VARIANT p); 00156 virtual void toVariant (VARIANT *p) const; 00157 virtual void fromString (const char * str, const wchar_t* strw); 00158 virtual void toString (std::string& str) const; 00159 protected: 00160 long m_value; 00161 00162 friend class CCoreXmlFile; 00163 }; 00164 00166 // XmlAttrReal class 00168 00169 class XmlAttrReal: public XmlAttrBase 00170 { 00171 public: 00172 XmlAttrReal (); 00173 00174 virtual valtype_type getType () const; 00175 virtual void fromVariant (VARIANT p); 00176 virtual void toVariant (VARIANT *p) const; 00177 virtual void fromString (const char * str, const wchar_t* strw); 00178 virtual void toString (std::string& str) const; 00179 protected: 00180 double m_value; 00181 }; 00182 00184 // XmlAttrDict class 00186 00187 class XmlAttrDict: public XmlAttrBase 00188 { 00189 public: 00190 XmlAttrDict(); 00191 00192 virtual valtype_type getType() const { return VALTYPE_DICT; }; 00193 virtual void fromVariant(VARIANT p); 00194 virtual void toVariant(VARIANT *p) const; 00195 virtual void fromString(const char * str, const wchar_t* strw); 00196 virtual void toString(std::string& str) const; 00197 CComPtr<ICoreDictionaryAttributeValue> m_value; 00198 }; 00199 00201 // XmlAttrString class 00203 00204 class XmlAttrString: public XmlAttrBase 00205 { 00206 public: 00207 virtual valtype_type getType () const; 00208 virtual void fromVariant (VARIANT p); 00209 virtual void toVariant (VARIANT *p) const; 00210 virtual void fromString (const char * str, const wchar_t* strw); 00211 virtual void toString (std::string& str) const; 00212 protected: 00213 std::string m_value; 00214 }; 00215 00217 // XmlAttrBinary class 00219 00220 class XmlAttrBinary: public XmlAttrBase 00221 { 00222 public: 00223 virtual valtype_type getType () const; 00224 virtual void fromVariant (VARIANT p); 00225 virtual void toVariant (VARIANT *p) const; 00226 virtual void fromString (const char * str, const wchar_t* strw); 00227 virtual void toString (std::string& str) const; 00228 protected: 00229 bindata m_value; 00230 }; 00231 00233 // XmlAttrLock class 00235 00236 class XmlAttrLock: public XmlAttrBase 00237 { 00238 public: 00239 XmlAttrLock (); 00240 00241 virtual valtype_type getType () const; 00242 virtual void fromVariant (VARIANT p); 00243 virtual void toVariant (VARIANT *p) const; 00244 virtual void fromString (const char * str, const wchar_t* strw); 00245 virtual void toString (std::string& str) const; 00246 protected: 00247 lockval_type m_value; 00248 }; 00249 00251 // XmlAttrPointer class 00253 00254 class XmlAttrPointer: public XmlAttrBase 00255 { 00256 public: 00257 XmlAttrPointer (); 00258 00259 virtual valtype_type getType () const; 00260 protected: 00261 XmlObject * m_parent; 00262 00263 friend class CCoreXmlFile; 00264 }; 00265 00267 // XmlAttrCollection class 00269 00270 class XmlAttrCollection: public XmlAttrBase 00271 { 00272 public: 00273 virtual valtype_type getType () const; 00274 protected: 00275 XmlObjSet m_children; 00276 00277 friend class CCoreXmlFile; 00278 }; 00279 00280 00282 // XmlObject class 00284 00285 class XmlObject 00286 { 00287 public: 00288 enum AttrSet 00289 { 00290 ATTR_PRIMARY, 00291 ATTR_SECONDARY, 00292 ATTR_ALL 00293 }; 00294 00295 public: 00296 XmlObject (ICoreMetaObject *metaobject, bool createAllAttributes ); 00297 ~XmlObject (); 00298 00299 bool isContainer (); 00300 00301 protected: 00302 void createAttributes (ICoreMetaObject *metaobject, int attrSet ); 00303 void deleteSecondaryAttribs (); 00304 00305 protected: 00306 metaid_type m_metaid; 00307 GUID m_guid; 00308 int m_index; // index in the m_objects array 00309 AttribMap m_attributes; 00310 bool m_loaded; // true if all attributes are loded (otherwise only pointer, collections and locks stored) 00311 bool m_deleted; 00312 bool m_modified; 00313 CTime m_lastWriteTime; 00314 00315 friend class CCoreXmlFile; 00316 friend struct XmlObjComp; 00317 }; 00318 00319 struct UnresolvedPointer 00320 { 00321 XmlObject * m_object; // whose attribute is this 00322 attrid_type m_attrib; 00323 GUID m_pointedObjGuid; 00324 }; 00325 00326 typedef std::vector<UnresolvedPointer> UnresolvedPointerVec; 00327 typedef UnresolvedPointerVec::iterator UnresolvedPointerVecIt; 00328 00329 struct UndoItem 00330 { 00331 UndoItem( XmlObject * object, attrid_type attrId, CComVariant value ) 00332 { 00333 m_object = object; 00334 m_value = value; 00335 m_attrId = attrId; 00336 }; 00337 00338 attrid_type m_attrId; 00339 XmlObject * m_object; 00340 CComVariant m_value; 00341 }; 00342 00343 typedef std::map<XmlAttrBase*, UndoItem> UndoMap; 00344 typedef UndoMap::iterator UndoMapIter; 00345 00346 00347 class SignFileEntry 00348 { 00349 public: 00350 SignFileEntry( const std::string& p_username, const CTime& p_time) : m_username( p_username), m_time( p_time) { } 00351 std::string m_username; 00352 CTime m_time; 00353 }; 00354 00355 class LoggedIn 00356 { 00357 public: 00358 LoggedIn( const std::string& p_nm, char flag) : m_nm( p_nm), m_fl( flag) { } 00359 std::string m_nm; 00360 char m_fl; 00361 bool operator==( const LoggedIn& peer) const { return m_nm == peer.m_nm; } 00362 }; 00363 00364 class SignFileData 00365 { 00366 public: 00367 SignFileData( const std::string& pn, const std::string& ps, const std::string& pu) : m_user( pn), m_since( ps), m_until( pu) { } 00368 std::string m_user; 00369 std::string m_since; 00370 std::string m_until; 00371 bool operator==( const SignFileData& peer) const { return m_user == peer.m_user; } 00372 }; 00373 00374 00375 class ProtectEntry 00376 { 00377 public: 00378 ProtectEntry( GUID p_gd, OpCode p_op, CTime p_time); 00379 GUID m_guid; 00380 OpCode m_op; 00381 CTime m_time; 00382 }; 00383 00384 class PublicStorage 00385 { 00386 protected: 00387 std::string m_fileName; 00388 std::string m_localFileName; 00389 std::vector< ProtectEntry > m_list; 00390 CCoreXmlFile* m_parent; 00391 00392 const char * m_ccsItem; 00393 private: 00394 void acquireSVN ( const char * obj); 00395 void releaseSVN ( const char * obj); 00396 00397 protected: 00398 void acquireFile (); 00399 void releaseFile (); 00400 inline std::string userName (); 00401 inline bool isSV (); 00402 00403 public: 00404 PublicStorage (); 00405 void setParent ( CCoreXmlFile* p_parent); 00406 void init ( const std::string& p_initialContent); 00407 }; 00408 00409 class SignManager : public PublicStorage 00410 { 00411 void in_or_off ( bool in); 00412 bool anybodyElseHolding (); 00413 00414 void update ( bool p_in, const SignFileEntry& p_entry); 00415 00416 public: 00417 typedef std::vector< SignFileData> SignFileDataVec; 00418 00419 void setParent ( CCoreXmlFile* p_parent); // hides parent's setParent 00420 void in () { in_or_off( true); } 00421 void off () { in_or_off( false); } 00422 SignFileDataVec getUserData (); 00423 00424 }; 00425 00426 00427 class ProtectList : public PublicStorage 00428 { 00429 std::vector< ProtectEntry > m_list; 00430 00431 void writeProtList (); 00432 void writeProtLisp (); 00433 void purgeProtList ( CTime& p_lastSyncTime); 00434 void clearProtList (); 00435 bool needed (); 00436 00437 public: 00438 void setParent ( CCoreXmlFile* p_parent); // hides parent's setParent 00439 void addEntry ( const ProtectEntry& p_pe); 00440 00441 static std::string getProtListFileName( const std::string& p_username); 00442 00443 void onCommited (); 00444 void onAborted (); 00445 void onLoad (); 00446 }; 00447 00448 class ProtFileEntry 00449 { 00450 public: 00451 ProtFileEntry( const std::string& p_guid, OpCode p_op, CTime& p_time) : m_guid( p_guid), m_op( p_op), m_time( p_time) { } 00452 std::string m_guid; 00453 OpCode m_op; 00454 CTime m_time; 00455 }; 00456 00457 class ATL_NO_VTABLE CCoreXmlFile : 00458 public CComObjectRootEx<CComSingleThreadModel>, 00459 public IDispatchImpl<ICoreStorage, &IID_ICoreStorage, &LIBID_XMLBACKENDLib>, 00460 public ISupportErrorInfoImpl<&IID_ICoreStorage>, 00461 public CComCoClass<CCoreXmlFile, &CLSID_CoreXmlFile> 00462 { 00463 public: 00464 enum SourceControl 00465 { 00466 SC_NONE, 00467 SC_SUBVERSION 00468 }; 00469 00470 enum CheckOutSate 00471 { 00472 CS_NOT_CHECKEDOUT, 00473 CS_CURRENT_USER, 00474 CS_OTHER_USER 00475 }; 00476 00477 enum FileStatusBitList 00478 { 00479 // FS_UTD = 0x0 00480 FS_LOCAL = 0x1 00481 , FS_OTHER = 0x2 00482 , FS_MODIFIEDBYOTHERS = 0x100 00483 , FS_NOTYETSAVED = 0x200 00484 00485 }; 00486 00487 public: 00488 CCoreXmlFile(); 00489 ~CCoreXmlFile(); 00490 00491 BEGIN_COM_MAP(CCoreXmlFile) 00492 COM_INTERFACE_ENTRY(ICoreStorage) 00493 COM_INTERFACE_ENTRY(IDispatch) 00494 COM_INTERFACE_ENTRY(ISupportErrorInfo) 00495 END_COM_MAP() 00496 00497 DECLARE_REGISTRY_RESOURCEID(IDR_CoreXmlFile) 00498 00499 public: 00500 STDMETHODIMP get_MetaProject (ICoreMetaProject **p); 00501 STDMETHODIMP put_MetaProject (ICoreMetaProject *p); 00502 STDMETHODIMP get_MetaObject (ICoreMetaObject **p); 00503 STDMETHODIMP put_MetaObject (ICoreMetaObject *p); 00504 STDMETHODIMP get_MetaID (metaid_type *p); 00505 STDMETHODIMP put_MetaID (metaid_type p); 00506 STDMETHODIMP get_MetaAttribute (ICoreMetaAttribute **p); 00507 STDMETHODIMP put_MetaAttribute (ICoreMetaAttribute *p); 00508 STDMETHODIMP get_AttrID (attrid_type *p); 00509 STDMETHODIMP put_AttrID (attrid_type p); 00510 STDMETHODIMP get_AttributeValue (VARIANT *p); 00511 STDMETHODIMP put_AttributeValue (VARIANT p); 00512 STDMETHODIMP OpenObject (objid_type objid); 00513 STDMETHODIMP CreateObject (objid_type *objid); 00514 STDMETHODIMP CloseObject (); 00515 STDMETHODIMP DeleteObject (); 00516 STDMETHODIMP LockObject (); 00517 STDMETHODIMP OpenProject (BSTR connection, VARIANT_BOOL *ro_mode); 00518 STDMETHODIMP CreateProject (BSTR connection); 00519 STDMETHODIMP SaveProject (BSTR connection, VARIANT_BOOL keepoldname); 00520 STDMETHODIMP CloseProject (VARIANT_BOOL abort = VARIANT_FALSE); 00521 STDMETHODIMP DeleteProject (); 00522 STDMETHODIMP BeginTransaction (); 00523 STDMETHODIMP CommitTransaction (); 00524 STDMETHODIMP AbortTransaction (); 00525 STDMETHODIMP get_StorageType (long *p); 00526 00527 protected: 00528 void fillParentMap (); 00529 00530 void closeMetaProject () /*throw()*/; 00531 00532 void openMetaObject (); 00533 00534 void closeMetaObject () /*throw()*/; 00535 00536 void openMetaAttribute (); 00537 00538 void closeMetaAttribute () /*throw()*/; 00539 00540 void parseConnectionString ( BSTR connection ); 00541 00542 void svnSshHandling (); 00543 std::string svnSshMangling ( const std::string& p_url); 00544 std::string userNameFromSvnSshUrl (); 00545 bool isUrlSvnSsh (); 00546 00547 void svnOptions (); 00548 00549 void setFileNames ( bool reset = false); 00550 00551 void getContainerFileName (XmlObject * obj, std::string& str, bool fullpath=true); 00552 00553 void getContainerName (XmlObject * obj, std::string& name, std::string& type); 00554 00555 // graph operatrions 00556 void clearAll (); 00557 00558 void addObject (XmlObject * obj); 00559 00560 void deleteObject (XmlObject * obj); 00561 00562 void setPointer (XmlObject * obj, attrid_type attribId, XmlObject * pointed); 00563 00564 XmlObject * setPointer (VARIANT p); 00565 00566 void updateCollections (); 00567 00568 void resolvePointers (UnresolvedPointerVec& pointers); 00569 00570 void resetSourceControlForAll(); 00571 void resetSourceControlInfo (XmlObject * obj); 00572 void resetSourceControlStat (XmlObject * obj, bool freshObj); 00573 00574 void resetSettings (); 00575 00576 // getting connections 00577 void getPointer (XmlAttrPointer * attr, VARIANT * p); 00578 00579 void getCollection (XmlAttrCollection * attr, VARIANT * p); 00580 00581 XmlObject * getContainer (XmlObject * obj); 00582 00583 void getContainedObjects (XmlObject * obj, XmlObjVec& vec); 00584 00585 // check out 00586 void getCheckOutContainers (XmlObjSet& objects, XmlObjSet& containers, bool thorough = false); 00587 00588 void getDependentContainers (XmlObject * obj, XmlObjSet& containers, XmlObjSet& processedObjects, bool thorough = false); 00589 00590 void getMyDepObj ( XmlObject * obj, XmlObjSet& containers, XmlObjSet& processedObjects, bool thorough); 00591 00592 void getMyDepObjConts ( XmlObjSet& objects, XmlObjSet& containers, bool thorough); 00593 00594 void getAllTheWayDown ( XmlObject * obj, XmlObjSet& containers); 00595 00596 void getAllUpAndDown ( XmlObjSet& objects, XmlObjSet& containers); 00597 00598 void getBasesOfObj ( XmlObject * obj, XmlObjSet& containers); 00599 00600 void getBasesOf ( XmlObjSet& objects, XmlObjSet& containers); 00601 00602 void getDeriveds ( XmlObject * obj, XmlObjSet& containers); 00603 00604 void applySmallChange ( XmlObjSet& p_conts); 00605 00606 bool checkOutFiles (XmlObjSet& containers); 00607 00608 // object pointer and id conversion 00609 XmlObject * objectFromObjId (metaobjidpair_type idpair); 00610 00611 void objIdFromObject (XmlObject * obj, metaobjidpair_type& idpair); 00612 00613 // serialization 00614 void writeBinaryCache (); 00615 00616 bool readBinaryCache (); 00617 00618 void timestampOfCache ( FILETIME* p_fTime); 00619 00620 void createProjectFile (); 00621 00622 void readProjectFile (); 00623 00624 void writeAll (); 00625 00626 void writeXMLFile (XmlObject * container); 00627 00628 void writeObject (XmlObject * obj, Transcoder& file, bool container, const char * prefix, CTime lastWriteTime ); 00629 00630 void applyLastWrTime (XmlObject * obj, bool container, CTime lastWriteTime ); 00631 00632 void timeSync (const char * fileName, XmlObject * container); 00633 00634 void fullReadContainer (XmlObject * container); 00635 00636 void readXMLFile (const char * fileName, UnresolvedPointerVec& pointers, bool fullLoad ); 00637 00638 void readObject (XERCES_CPP_NAMESPACE::DOMElement * e, UnresolvedPointerVec& pointers, XmlObject * parent, bool fullLoad, CTime lastWriteTime ); 00639 00640 void readAll ( bool fullLoad ); 00641 void loadFrom ( const std::string& p_dir, UnresolvedPointerVec& p_pointers, bool p_fullLoad); 00642 void loadDirs ( const std::string& p_dir, UnresolvedPointerVec& p_pointers, bool p_fullLoad); 00643 00644 void getLatestAndLoad (); 00645 00646 // source control 00647 bool getUserCredentialInfo ( int p_svnText, bool p_requireLogin); 00648 00649 void createProjectFolder (); 00650 int createHashedFolders (); 00651 void commitHashedFolders (); 00652 void socoAdd ( const std::string& p_path, bool p_recursive); 00653 void socoCommit ( const std::string& p_path, const std::string& p_comment, bool p_initial); 00654 00655 void createNonversioned (); 00656 00657 void getSourceSafePath (XmlObject * obj, std::string& str); 00658 00659 bool isContainerReadOnly (XmlObject * obj); 00660 00661 bool isContinerCheckedOut (XmlObject * obj); 00662 00663 void checkOutContainer (XmlObject * obj); 00664 void rollBackTheCheckOutContainer( XmlObject * obj); 00665 00666 void addToSourceControl (XmlObject * container, bool p_fileExisted); 00667 00668 void getLatestVersion (); 00669 00670 void checkInAll (); 00671 00672 void checkInAll ( bool keepCheckedOut ); 00673 00674 void showUsedFiles ( XmlObjSet& containers, bool p_latentMessage = false ); 00675 00676 void setSourceControlNodes ( XmlObject * container, long lInfo, long lStat); 00677 00678 void updateSourceControlInfo( XmlObject * container ); 00679 void updateSourceControlInfo(); 00680 00681 void whoControlsThis ( XmlObject * container = 0); 00682 00683 void dumpSourceControlInfo (); 00684 00685 bool filesModifiedByOthers (); 00686 00687 bool filesModifiedByOthersV3( XmlObjSet& readOnlyFiles, XmlObjSet& latentFiles ); 00688 00689 bool fileModifiedByOthers ( XmlObject * obj ); 00690 //bool fileModifiedByOthers ( const std::string& p_file, const CTime& p_myTime); 00691 00692 bool makeSureFileExistsInVerSys( const std::string& p_fname, const std::string& p_initialcontent, bool p_needsLock = true); 00693 00694 // SVN section: 00695 void getSVLastCommiter ( XmlObject * obj, std::string& user); 00696 void getSVCurrentOwner ( XmlObject * obj, std::string& user, bool& newfile); 00697 bool isCheckedOutByElseSVN ( const std::string& p_file); 00698 //void checkOutSVN ( const std::string& p_file); 00699 bool isVersionedInSVN ( const std::string& p_file, bool p_isADir = false, bool p_suppressErrorMsg = false); 00700 bool infoSVN ( const std::string& p_url, bool p_recursive, std::string& p_resultMsg, std::string& p_author, std::string& p_owner); 00701 00702 bool lockablePropertySVN ( const std::string& p_file); 00703 bool applyLockSVN ( const std::string& p_file); // throws hresult_exception if failed to lock 00704 bool removeLockSVN ( const std::string& p_file); 00705 bool mkdirSVN ( const std::string& p_url, const std::string& p_newDirName, const std::string& p_localPath); 00706 bool addSVN ( const std::string& p_file, bool p_recursive = false); 00707 void findAllRwObjs ( const std::string& p_folderPath, std::vector< std::string>& p_rw_file_vec); 00708 bool bulkCommitSVN ( const std::string& p_dir, const std::string& p_comment, bool p_noUnlock = false); 00709 bool commitSVN ( const std::string& p_dirOrFile, const std::string& p_comment, bool p_initialCommit = false, bool p_noUnlock = false); 00710 bool updateSVN ( const std::string& p_dirOrFile); 00711 void svnSetup ( bool createOrOpen); 00712 void testSubversion (); 00713 void createSubversionClientImpl(); 00714 void createSubversionedFolder(); 00715 00716 std::string m_svnUrl; 00717 bool m_hashFileNames; 00718 int m_hashVal; 00719 bool m_hashInfoFound; 00720 bool m_svnShowCmdLineWindows; 00721 bool m_svnRedirectOutput; 00722 00723 std::auto_ptr<HiClient> m_svn; 00724 00725 bool m_needsSessionRefresh; 00726 void protect ( XmlObject * obj, OpCode oc); 00727 00728 bool findOnProtectedLists ( GUID p_gd, std::string& p_scapegoatUser); 00729 void refreshSessionFolder (); 00730 00731 /* 00732 std::string refreshProtectionFile ( const std::string& p_username); 00733 bool refreshSignFile (); 00734 bool refreshOneFile ( const std::string& p_filename); 00735 */ 00736 bool findInFile ( const std::string& p_filename, const std::string& p_gd); 00737 00738 00739 void replaceUserName ( const std::string& p_username); 00740 std::string userName (); 00741 inline bool isSV (); 00742 00743 bool userFilter ( CTimeSpan& p_elapsed); 00744 00745 std::vector< LoggedIn> allusers (); 00746 std::vector< LoggedIn> getUsersFromSignFile (); 00747 CTime lastSyncTimeForAllUsers(); 00748 CTime findEarliestLogin ( int p_nbOfDays, int p_nbOfHours, int p_nbOfMinutes); 00749 00750 bool specialUserInquiryHandled( VARIANT p); 00751 public: 00752 // these can be used by other classes too 00753 MsgConsole m_console; 00754 void sendMsg ( const std::string&, int mtype ); 00755 std::string makelink ( XmlObject * ptr); 00756 00757 /* inline bool isFileReadOnly ( const std::string& p_file); 00758 inline bool isFileReadOnly2 ( const std::string& p_file, bool* p_fileExisted); 00759 inline bool isFileReadWrite ( const std::string& p_file); 00760 inline bool isFile ( const std::string& p_file); 00761 inline bool isDir ( const std::string& p_file); 00762 inline bool fileExist ( const std::string& p_file); 00763 */ 00764 protected: // parser opts 00765 00766 XERCES_CPP_NAMESPACE::DOMDocument* 00767 enclosedParse ( const std::string& p_fileName, XERCES_CPP_NAMESPACE::DOMLSParser* p_parser, bool *p_success); 00768 00769 void newDOMObjs( XERCES_CPP_NAMESPACE::DOMImplementationLS** p_domImpl, std::auto_ptr<XERCES_CPP_NAMESPACE::DOMLSParser>& p_domParser, std::auto_ptr<XERCES_CPP_NAMESPACE::DOMErrorHandler>& p_domErrHandler); 00770 00771 public: // parser creation for other tasks than the individual xml file scannning 00772 DOMLSParser* getFreshParser ( const std::string& p_whoIsTheUser, DOMImplementationLS ** p_ptrRetDomImpl = 0); 00773 00774 protected: 00775 // meta project 00776 CComObjPtr<ICoreMetaProject> m_metaProject; 00777 00778 // meta object 00779 CComObjPtr<ICoreMetaObject> m_metaObject; 00780 metaid_type m_metaObjectId; 00781 00782 // meta attribute 00783 CComObjPtr<ICoreMetaAttribute> m_metaAttribute; 00784 attrid_type m_metaAttributeId; 00785 valtype_type m_metaAttributeValType; 00786 00787 ParentMap m_parentMap; 00788 00789 // project 00790 bool m_opened; 00791 bool m_modified; 00792 std::string m_parentFolderPath; // absolute path of the folder contains the project folder 00793 std::string m_folderPath; // absolute path of the folder contains the project files 00794 std::string m_contentPath; 00795 static const char * m_contentConst; 00796 std::string m_cacheFileName; 00797 std::string m_projectFileName; 00798 std::string m_projectName; 00799 bool m_inTransaction; 00800 bool m_savedOnce; 00801 00802 // source control info 00803 int m_sourceControl; 00804 00805 std::string m_vssParentPath; 00806 std::string m_vssPath; 00807 std::string m_vssUser; 00808 std::string m_vssPassword; 00809 // objects 00810 XmlObjVec m_objects; 00811 GUIDToXmlObjectMap m_objectsByGUID; 00812 XmlObject * m_openedObject; 00813 XmlObject * m_root; 00814 bool m_trivialChanges; 00815 bool m_fullLockNeeded; 00816 00817 00818 #ifdef _DEBUG 00819 std::string mylog; 00820 #endif 00821 00822 // transaction handling 00823 UndoMap m_undoMap; 00824 XmlObjSet m_modifiedObjects; 00825 XmlObjVec m_createdObjects; 00826 XmlObjSet m_deletedObjects; 00827 //XmlObjSet m_checkOutContainers; 00828 00829 // protection list 00830 ProtectList m_protectList; 00831 SignManager m_signer; 00832 00833 OperatingOptions m_userOpts; 00834 std::vector< XmlObject*> m_deldObjs; 00835 00836 friend PublicStorage; 00837 friend SignManager; 00838 friend ProtectList; 00839 }; 00840 00841 00842 #endif//MGA_COREXMLFILE_H