From: Gerard F. <ger...@us...> - 2001-07-02 21:26:26
|
Update of /cvsroot/kuml/kuml/libkuml/mof In directory usw-pr-cvs1:/tmp/cvs-serv9084 Modified Files: BUILD ChangeLog Generic.cpp Generic.hh Makefile MofIdlReverseMapper.cpp Reflective_impl.cc RepoManager.cpp RepoManager.hh notes.txt Added Files: MetaModelManager.cpp MetaModelManager.hh Log Message: 2001-7-2 Gerard Flynn <ger...@fr...> * Added MetaModelManager class * Added createMetaModel and fillInMetaModel virtual methods to GenericBaseObject, meta model creation is now driven from the package level on down * Rearranged RepoManager buildImplementation code * Added handling of References to InterfaceReverseMapper (we assume anything with a type of tk_objref is a Reference) * Added meta object creation for Packages VS: Committing in . VS: VS: Modified Files: VS: BUILD ChangeLog Generic.cpp Generic.hh Makefile VS: MofIdlReverseMapper.cpp Reflective_impl.cc RepoManager.cpp VS: RepoManager.hh notes.txt VS: Added Files: VS: MetaModelManager.cpp MetaModelManager.hh VS: ---------------------------------------------------------------------- ***** Error reading new file: [Errno 2] No such file or directory: 'MetaModelManager.cpp' ***** Error reading new file: [Errno 2] No such file or directory: 'MetaModelManager.hh' Index: BUILD =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/mof/BUILD,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** BUILD 2001/06/30 07:31:26 1.2 --- BUILD 2001/07/02 21:26:22 1.3 *************** *** 27,34 **** This will produce a very large number of debugging messages as the MOF IDL ! is parsed and the implementation classes created. ! ! Currently the program will die with an error message which occurs when ! meta objects are created for each of the MOF classes. This is due to a mismatch ! between the Reflective create_instance operation arguments and the way in which ! attributes are stored by the Generic classes. --- 27,29 ---- This will produce a very large number of debugging messages as the MOF IDL ! is parsed and the implementation classes created. \ No newline at end of file Index: ChangeLog =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/mof/ChangeLog,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** ChangeLog 2001/06/30 07:31:26 1.2 --- ChangeLog 2001/07/02 21:26:22 1.3 *************** *** 19,21 **** * Corrected Mico prerequisite in BUILD file, >= 2.3.5 required * Renamed RegularExpression.hh and .cpp to KumlUtilities ! * Began work on mCorba::showTC function for TypeCode display \ No newline at end of file --- 19,31 ---- * Corrected Mico prerequisite in BUILD file, >= 2.3.5 required * Renamed RegularExpression.hh and .cpp to KumlUtilities ! * Began work on mCorba::showTC function for TypeCode display ! ! 2001-7-2 Gerard Flynn <ger...@fr...> ! * Added MetaModelManager class ! * Added createMetaModel and fillInMetaModel virtual methods to ! GenericBaseObject, meta model creation is now driven from the ! package level on down ! * Rearranged RepoManager buildImplementation code ! * Added handling of References to InterfaceReverseMapper (we assume ! anything with a type of tk_objref is a Reference) ! * Added meta object creation for Packages \ No newline at end of file Index: Generic.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/mof/Generic.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Generic.cpp 2001/06/30 07:31:26 1.2 --- Generic.cpp 2001/07/02 21:26:22 1.3 *************** *** 33,36 **** --- 33,37 ---- #include "mCorba.hh" + #include "MetaModelManager.hh" GenericBaseObject::GenericBaseObject( const string& name, *************** *** 49,52 **** --- 50,62 ---- } + void GenericBaseObject::createMetaModel( MetaModelManager* metaModelMgr ) + { + // We create an anonymous instance which will be filled in later. + p_meta_object = metaModelMgr->getClass_ClassProxy()->create_instance( string("") ); + } + + void GenericBaseObject::fillInMetaModel() + {} + void GenericBaseObject::createMetaObject( GenericClassProxy* meta_class ) { *************** *** 108,111 **** --- 118,140 ---- {} + void GenericPackage::createMetaModel( MetaModelManager* metaModelMgr ) + { + createMetaObject( metaModelMgr->getPackage_ClassProxy() ); + for( classVect::iterator p = m_classProxies.begin(); + p != m_classProxies.end(); ++p ) + { + (*p)->createMetaModel( metaModelMgr ); + } + } + + void GenericPackage::fillInMetaModel() + { + for( classVect::iterator p = m_classProxies.begin(); + p != m_classProxies.end(); ++p ) + { + (*p)->fillInMetaModel(); + } + } + void GenericPackage::makeDesignatorMaps() { *************** *** 565,570 **** {} ! void GenericClassProxy::fillInMetaObject() { /* meta_class should be the meta_class object for ModelElement::Class --- 594,609 ---- {} ! void GenericClassProxy::createMetaModel( MetaModelManager* metaModelMgr ) { + createMetaObject( metaModelMgr->getClass_ClassProxy() ); + for( featureVect::const_iterator q = m_instanceLevelFeatures.begin(); + q != m_instanceLevelFeatures.end(); ++q ) + { + (*q)->feature->createMetaModel( metaModelMgr ); + } + } + + void GenericClassProxy::fillInMetaModel() + { /* meta_class should be the meta_class object for ModelElement::Class *************** *** 583,587 **** */ ! cerr << "Start of fillInMetaObject" << endl; Reflective::ValueTypeList args; --- 622,626 ---- */ ! cerr << "Start of GenericClassProxy::fillInMetaModel" << endl; Reflective::ValueTypeList args; *************** *** 689,693 **** cerr << "Before call to fillInInstance" << endl; p_meta_object->fillInInstance( args ); ! cerr << "End of call to fillInMetaObject" << endl; } --- 728,732 ---- cerr << "Before call to fillInInstance" << endl; p_meta_object->fillInInstance( args ); ! cerr << "End of call to GenericClassProxy::fillInMetaModel" << endl; } *************** *** 1133,1136 **** --- 1172,1180 ---- {} + void GenericAttribute::createMetaModel( MetaModelManager* metaModelMgr ) + { + createMetaObject( metaModelMgr->getMofAttribute_ClassProxy() ); + } + GenericValue::GenericValue( GenericStructuralFeature* feature ) :p_feature(feature) *************** *** 1410,1413 **** --- 1454,1463 ---- {} + void GenericReference::createMetaModel( MetaModelManager* metaModelMgr ) + { + createMetaObject( metaModelMgr->getReference_ClassProxy() ); + } + + GenericOperation::GenericOperation( const string& name, scopeKind scope, *************** *** 1415,1416 **** --- 1465,1471 ---- :GenericFeature(name,OPERATION,scope,meta_object) {} + + void GenericOperation::createMetaModel( MetaModelManager* metaModelMgr ) + { + createMetaObject( metaModelMgr->getOperation_ClassProxy() ); + } Index: Generic.hh =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/mof/Generic.hh,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Generic.hh 2001/06/30 07:31:26 1.2 --- Generic.hh 2001/07/02 21:26:22 1.3 *************** *** 70,73 **** --- 70,75 ---- #include "Reflective_impl.h" + class MetaModelManager; + // Generic implementation classes for the five types of MOF meta-objects. class GenericBaseObject; *************** *** 110,113 **** --- 112,119 ---- virtual ~GenericBaseObject() {} + virtual void createMetaModel( MetaModelManager* metaModelMgr ); + + virtual void fillInMetaModel(); + /// Creates an empty instance object with only a mof_id. virtual void createMetaObject( GenericClassProxy* meta_class ); *************** *** 162,166 **** public: // Instanciation. GenericPackage( const string& name, ! GenericInstance* meta_object = 0 ); virtual ~GenericPackage() {} --- 168,172 ---- public: // Instanciation. GenericPackage( const string& name, ! GenericInstance* meta_object = 0 ); virtual ~GenericPackage() {} *************** *** 177,180 **** --- 183,190 ---- void makeDesignatorMaps(); + + virtual void createMetaModel( MetaModelManager* metaModelMgr ); + + virtual void fillInMetaModel(); public: // Non-MOF accessors. GenericClassProxy* classProxy( const string& name ); *************** *** 353,356 **** --- 363,370 ---- virtual ~GenericClassProxy() {} + virtual void createMetaModel( MetaModelManager* metaModelMgr ); + + virtual void fillInMetaModel(); + void createAttributeMetaObjects( GenericClassProxy* meta_class ); *************** *** 708,711 **** --- 722,727 ---- virtual ~GenericAttribute() {} + virtual void createMetaModel( MetaModelManager* metaModelMgr ); + private: bool m_isDerived; *************** *** 723,726 **** --- 739,744 ---- virtual ~GenericReference() {} + + virtual void createMetaModel( MetaModelManager* metaModelMgr ); }; *************** *** 734,737 **** --- 752,757 ---- virtual ~GenericOperation() {} + + virtual void createMetaModel( MetaModelManager* metaModelMgr ); }; Index: Makefile =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/mof/Makefile,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** Makefile 2001/06/30 07:31:26 1.2 --- Makefile 2001/07/02 21:26:22 1.3 *************** *** 12,18 **** Generic.t : Generic.t.o Generic.o Reflective.o Reflective_impl.o GenericTest.o GenericTest.h \ ! mCorba.o g++ -o Generic.t Generic.t.o Generic.o Reflective_impl.o Reflective.o GenericTest.o \ ! mCorba.o ${LIBS} Generic.t.cpp : GenericTest.h Generic.hh Reflective_impl.h --- 12,18 ---- Generic.t : Generic.t.o Generic.o Reflective.o Reflective_impl.o GenericTest.o GenericTest.h \ ! mCorba.o MetaModelManager.o g++ -o Generic.t Generic.t.o Generic.o Reflective_impl.o Reflective.o GenericTest.o \ ! mCorba.o MetaModelManager.o ${LIBS} Generic.t.cpp : GenericTest.h Generic.hh Reflective_impl.h *************** *** 23,31 **** Autotest.t : Autotest.t.o Autogen.o InterfaceGen.o parsenode.o prepro.o scanner.o \ parser.o treewalker.o Reflective.o Reflective_impl.o Generic.o mCorba.o \ ! yacc.o g++ -o $@ $^ ${LIBS} MofIdlMapping_t_OBJECTS = MofIdlInterfaces.o MofIdlReverseMapper.o MofIdlMapping.t.o \ ! Generic.o Reflective_impl.o Reflective.o mCorba.o KumlUtilities.o \ Autogen.o parsenode.o prepro.o scanner.o parser.o treewalker.o yacc.o --- 23,31 ---- Autotest.t : Autotest.t.o Autogen.o InterfaceGen.o parsenode.o prepro.o scanner.o \ parser.o treewalker.o Reflective.o Reflective_impl.o Generic.o mCorba.o \ ! yacc.o MetaModelManager.o g++ -o $@ $^ ${LIBS} MofIdlMapping_t_OBJECTS = MofIdlInterfaces.o MofIdlReverseMapper.o MofIdlMapping.t.o \ ! Generic.o Reflective_impl.o Reflective.o mCorba.o KumlUtilities.o MetaModelManager.o \ Autogen.o parsenode.o prepro.o scanner.o parser.o treewalker.o yacc.o *************** *** 35,40 **** RepoManager_t_OBJECTS = RepoManager.t.o RepoManager.o MofIdlInterfaces.o \ MofIdlReverseMapper.o Generic.o Reflective_impl.o Reflective.o mCorba.o \ ! KumlUtilities.o Autogen.o parsenode.o prepro.o scanner.o \ ! parser.o treewalker.o yacc.o RepoManager.t : ${RepoManager_t_OBJECTS} --- 35,40 ---- RepoManager_t_OBJECTS = RepoManager.t.o RepoManager.o MofIdlInterfaces.o \ MofIdlReverseMapper.o Generic.o Reflective_impl.o Reflective.o mCorba.o \ ! KumlUtilities.o MetaModelManager.o Autogen.o parsenode.o prepro.o scanner.o \ ! parser.o treewalker.o yacc.o RepoManager.t : ${RepoManager_t_OBJECTS} Index: MofIdlReverseMapper.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/mof/MofIdlReverseMapper.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** MofIdlReverseMapper.cpp 2001/06/30 07:31:26 1.2 --- MofIdlReverseMapper.cpp 2001/07/02 21:26:22 1.3 *************** *** 429,437 **** cerr << "Adding attribute : " << attr->name << endl; cerr << "Before call to createTypeCode (base)" << endl; - if( attr->base_type->getKind() == CORBA::tk_objref ) { - // If Type is an interface we assume we're dealing with a Reference - // and not an Attribute. (Temporary hack 2001-6-25). - continue; - } const CORBA::TypeCode* base_tc = attr->base_type->createTypeCode(); cerr << "After call to createTypeCode (base)" << endl; --- 429,432 ---- *************** *** 460,475 **** cerr << "Before Attribute instanciation" << endl; ! GenericAttribute* g_attr = ! new GenericAttribute( attr->name, ! base_tc, ! INSTANCE_LEVEL, ! attr->isChangeable, ! false, // isDerived ! *mult_ptr, ! collection_tc ); ! cerr << "After Attribute instanciation" << endl; ! class_proxy->addAttribute( g_attr ); cerr << "After addAttribute" << endl; --- 455,488 ---- cerr << "Before Attribute instanciation" << endl; ! if( attr->base_type->getKind() == CORBA::tk_objref ) { ! // If Type is an interface we assume we're dealing with a Reference ! // and not an Attribute. This may not always be correct but its ! // about the best we can do with IDL. ! GenericReference* g_ref = ! new GenericReference( attr->name, ! base_tc, ! INSTANCE_LEVEL, ! attr->isChangeable, ! *mult_ptr, ! collection_tc ); ! cerr << "After Attribute instanciation" << endl; ! class_proxy->addReference( g_ref ); ! } ! else { // Attribute. ! GenericAttribute* g_attr = ! new GenericAttribute( attr->name, ! base_tc, ! INSTANCE_LEVEL, ! attr->isChangeable, ! false, // isDerived ! *mult_ptr, ! collection_tc ); ! ! cerr << "After Attribute instanciation" << endl; ! ! class_proxy->addAttribute( g_attr ); ! } cerr << "After addAttribute" << endl; Index: Reflective_impl.cc =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/mof/Reflective_impl.cc,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Reflective_impl.cc 2001/06/22 03:42:03 1.1 --- Reflective_impl.cc 2001/07/02 21:26:22 1.2 *************** *** 24,28 **** /* ****************************************************************************/ ! /* $Header$ */ --- 24,28 ---- /* ****************************************************************************/ ! /* $Header$ */ Index: RepoManager.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/mof/RepoManager.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** RepoManager.cpp 2001/06/30 07:31:26 1.2 --- RepoManager.cpp 2001/07/02 21:26:22 1.3 *************** *** 36,40 **** RepoManager::RepoManager( stageType stage ) :m_stage(stage), ! p_inputFile(0) {} --- 36,41 ---- RepoManager::RepoManager( stageType stage ) :m_stage(stage), ! p_inputFile(0), ! p_metaModelMgr(0) {} *************** *** 55,119 **** exit( -1 ); } ! ! interfaceSet interfs = p_agen->getInterfaces(); ! for( int i = 0; i < interfs.size(); i++ ) { ! cout << "interface name : " << interfs[i]->getName() << endl; ! } ! ! cout << "\n\n"; ! moduleSet modules = p_agen->getModules(); ! GenericPackage* mof_model_package; ! int modelIndex; ! for( int i = 0; i < modules.size(); i++ ) { cout << "module name : " << modules[i]->getName() << endl; ! if( modules[i]->getName() == "Model" ) { // Process the MOF Model module. ! modelIndex = i; ! ModuleReverseMapper mod_mapper( modules[i] ); ! mof_model_package = mod_mapper.createPackage(); ! break; } } ! // Retrieve the GenericClassProxy for Model::Class. ! GenericClassProxy* MofClass = mof_model_package->classProxy( "Class" ); ! GenericClassProxy* MofAttribute = mof_model_package->classProxy( "MofAttribute" ); ! assert( MofClass ); ! assert( MofAttribute ); ! ! cerr << "MofClass attributes : " << endl; ! stringVect class_attr_names = MofClass->instanceLevelAttributeNames(); ! for( stringVect::const_iterator p = class_attr_names.begin(); ! p != class_attr_names.end(); ! ++p ) { ! cerr << " " << *p << endl; } - // exit( 0 ); - classVect classProxies = mof_model_package->allClassProxies(); - // Create meta objects for all class proxy's so that we have valid MOF ID's - for( classVect::iterator p = classProxies.begin(); - p != classProxies.end(); ++p ) - { - (*p)->createMetaObject( MofClass ); - (*p)->createAttributeMetaObjects( MofAttribute ); - } ! cerr << "RepoManager::buildImplementation, before fillIn" << endl; ! // Now fill in all of the meta object attributes (possible because we now have ! // valid MOF ID's). ! try { ! for( classVect::iterator p = classProxies.begin(); ! p != classProxies.end(); ++p ) ! { ! (*p)->fillInMetaObject(); ! } ! } ! catch( GenericException& e ) { ! cerr << "An Exception occurred in RepoManager::buildImplementation" << endl; ! cerr << e.what() << endl; ! exit( -1 ); ! } } --- 56,98 ---- exit( -1 ); } ! moduleSet modules = p_agen->getModules(); ! // Create packages for all modules (except Reflective). ! for( int i = 0; i < modules.size(); i++ ) { cout << "module name : " << modules[i]->getName() << endl; ! if( modules[i]->getName() != "Reflective" ) { ! ModuleReverseMapper mod_mapper( modules[i] ); ! m_packages.push_back( mod_mapper.createPackage() ); ! if( modules[i]->getName() == "Model" ) { ! p_modelPackage = m_packages.back(); ! } } } ! ! buildMetaModel(); ! } ! ! void RepoManager::buildMetaModel() ! { ! cerr << "Start RepoManager::buildMetaModel" << endl; ! ! p_metaModelMgr = new MetaModelManager( p_modelPackage ); ! ! // First call createMetaModel for each Package. ! for( packageVect::iterator p = m_packages.begin(); ! p != m_packages.end(); ++p ) { ! (*p)->createMetaModel( p_metaModelMgr ); } ! // Next call fillInMetaModel for each Package. ! for( packageVect::iterator p = m_packages.begin(); ! p != m_packages.end(); ++p ) ! { ! (*p)->fillInMetaModel(); ! } ! cerr << "End RepoManager::buildMetaModel" << endl; } Index: RepoManager.hh =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/mof/RepoManager.hh,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** RepoManager.hh 2001/06/30 07:31:26 1.2 --- RepoManager.hh 2001/07/02 21:26:22 1.3 *************** *** 29,33 **** --- 29,35 ---- #define RepoManager_H_IS_INCLUDED #include <cstdio> + #include <vector> #include "Autogen.hh" + #include "MetaModelManager.hh" enum stageType { *************** *** 42,45 **** --- 44,49 ---- class RepoManager { + public: // Types. + typedef vector<GenericPackage*> packageVect; public: RepoManager( stageType stage = STAGE_1 ); *************** *** 51,54 **** --- 55,60 ---- void activateRepository(); private: + void buildMetaModel(); + private: stageType m_stage; *************** *** 56,59 **** --- 62,71 ---- MofIdlMapping::Autogen* p_agen; + + MetaModelManager* p_metaModelMgr; + + packageVect m_packages; + + GenericPackage* p_modelPackage; }; Index: notes.txt =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/mof/notes.txt,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -r1.2 -r1.3 *** notes.txt 2001/06/30 07:31:26 1.2 --- notes.txt 2001/07/02 21:26:22 1.3 *************** *** 60,64 **** 6) instanciate Refective servants ! 7) the stage1 imlementation is complete 2001-5-7 --- 60,64 ---- 6) instanciate Refective servants ! 7) the stage1 implementation is complete 2001-5-7 *************** *** 132,133 **** --- 132,181 ---- before annotation in Class). + 2001-7-1 + + The problems in buildImplementation have now been corrected. + + Now we must construct the user visible Corba objects. + + Since our stage 1 repository is a MOF repository we want to + publish objects for the MOF package. The objects that should thus + be instantiated are : + + a RefPackage object for the Model::ModelPackage interface + + Recall that a Package object primarily constitutes a + "directory" of the different class proxies and associations contained + in the package. In the reflective case, this directory may be + interrogated via the the 3 operations : ref_class_ref, + ref_association_ref and ref_package_ref. Each of these operations + takes a DesignatorType value as argument. The designator is the + RefBaseObject which is associated with the partcular entity being + looked up in the M2-level model. + + In order therefore for a client to access a RefPackage, it must + first obtain the meta_object which describes the package. This + meta_object will be a RefObject which is an instance of + Model::Package. This inherits from GeneralizableElement which in turn + inherits from Namespace. Therefore the client can invoke the + contents() operation on this object to obtain a list of all the + ModelElement's which it contains. It could also invoke the + lookupElement operation to search by name or the findElementsByType + operation. + + At this point its clear that some tweaking of the automatic + implementation process will be necessary because there's no way for + the MofIdlReverseMapper to know that the contents reference of Package + is supposed to send back the list of contained ModelElements. We + should probably start thinking about a general framework for extending + the automatic implementation "by hand". + + One question is where to incorporate the creation of base + associations since this information isn't contained in IDL. It would + seem logical to extend the createMetaObject methods of the Generic + objects to handle this since these objects are aware of the principal + relationships and these methods are always MOF specific anyway. In + other words the createMetaObject for a GenericPackage should add + links to the Contains association between itself and the Class Proxies + and Associations it contains. This may require a more general method + for passing in the meta-model than simply passing a GenericClassProxy + object. \ No newline at end of file |