Main Page   Namespace List   Class Hierarchy   Compound List   File List   Namespace Members   Compound Members   File Members  

XMLBaseDOMCreator.h

Go to the documentation of this file.
00001 
00038 #ifndef _AMIRE_PERSISTENCE_XML_BASE_DOM_CREATOR_H
00039 #define _AMIRE_PERSISTENCE_XML_BASE_DOM_CREATOR_H
00040 
00041 #define COMPONENT_CONTEXT_TEMPLATE_FILE "ComponentContextTemplate.xml"
00042 #define BASE_COMPONENT_LIBRARY_TEMPLATE_FILE "BaseComponentLibraryTemplate.xml"
00043 #define COMPOSED_COMPONENT_LIBRARY__TEMPLATE_FILE "ComposedComponentLibraryTemplate.xml"
00044 
00045 #include <xercesc/util/PlatformUtils.hpp>
00046 
00047 #include <xercesc/dom/DOM.hpp>
00048 #include <xercesc/dom/DOMImplementation.hpp>
00049 #include <xercesc/dom/DOMImplementationLS.hpp>
00050 #include <xercesc/dom/DOMWriter.hpp>
00051 
00052 #include <xercesc/framework/StdOutFormatTarget.hpp>
00053 #include <xercesc/parsers/XercesDOMParser.hpp>
00054 #include <xercesc/validators/common/Grammar.hpp>
00055 #include <xercesc/util/XMLUni.hpp>
00056 
00057 #include <math.h>
00058 #include <string.h>
00059 #include <string>
00060 #include <stdlib.h>
00061 #include <stdio.h>
00062 
00063 #include <amire/property/Property.h>
00064 #include <amire/property/PropertyType.h>
00065 #include <amire/component/ComponentManager.h>
00066 
00067 #include <amire/persistence/XMLBaseDictionary.h>
00068 #include <amire/persistence/XMLComposedComponentPrototypeDOMCreator.h>
00069 
00070 #include <stack>
00071  
00072 namespace amire {
00073   namespace persistence {            
00074     class AMIRE_EXPORT_API XMLBaseDOMCreator : public XMLBaseDictionary {
00075       private:
00076        enum FileType {
00077           complete,
00078           compoundComponentLibrary,
00079           baseComponentLibrary,
00080           application
00081         };
00082         enum EncodingType {
00083           utf8,
00084           utf16
00085         } encodingType;
00086         
00087         std::string componentContextTemplate;
00088         std::string baseComponentLibraryTemplate;
00089         std::string composedComponentLibraryTemplate;        
00090         XercesDOMParser * parser;
00091         std::string fileName;
00092         std::string schemaURI;
00093         std::string templateFileDirectory;
00094         
00095         
00096         const amire::component::ComponentManager * componentManager;
00097           
00098         DOMDocument * document;
00099         DOMElement * propertyTypeSequence;
00100         DOMElement * dependencySequence;
00101                     DOMElement * composedComponentPrototypeSequence;
00102                     DOMElement * propertyValueSequence;
00103                     DOMElement * componentInstanceSequence;
00104                     DOMElement * connectionSequence;
00105                   
00106       public:           
00107         XMLBaseDOMCreator(const amire::component::ComponentManager * aComponentManager,XercesDOMParser * aParser,  std::string aFileName, std::string aSchemaURI, std::string aTemplateFileDirectory);
00108         XMLBaseDOMCreator(const amire::component::ComponentManager * aComponentManager,XercesDOMParser * aParser,  std::string aFileName, std::string aTemplateFileDirectory);        
00109         XMLBaseDOMCreator(const amire::persistence::XMLBaseDOMCreator& creator);             
00110         virtual ~XMLBaseDOMCreator();
00111         void encodeUTF8() {
00112           encodingType = utf8;
00113         }
00114         void encodeUTF16() {
00115           encodingType = utf16;        
00116         }
00117         
00118         void write();
00119         void writeApplication();
00120         void writeCompoundComponentLibrary();      
00121         void writeBaseComponentLibrary();
00122 
00123       protected:
00124         void createDOMSkeleton(FileType aFileType);
00125         void findDOMBranches();
00126         void createPropertyTypeDOMElements(DOMDocument * document, DOMElement * propertyTypeSequence, const amire::component::ComponentManager * manager);
00127         void createComponentInstanceDOMElements(DOMDocument * document, DOMElement * componentInstanceSequence, const amire::component::ComponentManager * manager);
00128         void createConnectionDOMElements(DOMDocument * document, DOMElement * connectionSequence,const amire::component::ComponentManager * componentManager);
00129         void createDependencyDOMElements(DOMDocument * document, DOMElement * connectionSequence, const amire::component::ComponentManager * componentManager);
00130         void createComposedComponentPrototypeDOMElements(DOMDocument * document, DOMElement * composedComponentPrototypeSequence,const amire::component::ComponentManager * componentManager);        
00131         void writeDocument(DOMDocument * document) const;                
00132     };    
00133   }
00134 }
00135 #endif

Generated on Tue May 20 17:23:54 2003 for AMIRE-Framework by doxygen1.3