From: Gerard F. <ger...@us...> - 2001-08-03 02:03:08
|
Update of /cvsroot/kuml/kuml/libkuml/mof In directory usw-pr-cvs1:/tmp/cvs-serv22886 Modified Files: BUILD ChangeLog Generic.cpp Generic.hh Makefile Reflective_impl.h RepoManager.cpp RepoManager.hh RepoManager.t.cpp mCorba.cpp mCorba.hh mCorba.i Log Message: 2001-8-3 Gerard Flynn <ger...@fr...> * Added test_client * Updated running instructions in BUILD file * Added startns.sh script to start CORBA Naming Service * Created scripts directory * Completed CORBA server * Added RepoManager::publishObjects * Fixed problem with management of p_ref_object in GenericBaseObject * Added activateRepository method to RepoManager VS: Committing in . VS: VS: Modified Files: VS: BUILD ChangeLog Generic.cpp Generic.hh Makefile VS: Reflective_impl.h RepoManager.cpp RepoManager.hh VS: RepoManager.t.cpp mCorba.cpp mCorba.hh mCorba.i VS: Added Files: VS: scripts/startns.sh VS: ---------------------------------------------------------------------- Index: BUILD =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/mof/BUILD,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** BUILD 2001/07/02 21:26:22 1.3 --- BUILD 2001/08/03 02:03:05 1.4 *************** *** 24,29 **** Running ------------ ! cpp mof.idl | RepoManager.t 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 --- 24,35 ---- Running ------------ ! In order to run the test server, the CORBA Naming Service demon must be running. ! This can be started with the script startns.sh. + You must then tell the server how to find the Naming Service. For example : + + cpp mof.idl | RepoManager.t -ORBNamingAddr inet:localhost:12456 + This will produce a very large number of debugging messages as the MOF IDL ! is parsed and the implementation classes created. The server will then ! enter the ORB run loop and will be waiting to answer queries. \ No newline at end of file Index: ChangeLog =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/mof/ChangeLog,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** ChangeLog 2001/07/15 11:14:31 1.4 --- ChangeLog 2001/08/03 02:03:05 1.5 *************** *** 1,4 **** --- 1,14 ---- $Header$ + 2001-8-3 Gerard Flynn <ger...@fr...> + * Added test_client + * Updated running instructions in BUILD file + * Added startns.sh script to start CORBA Naming Service + * Created scripts directory + * Completed CORBA server + * Added RepoManager::publishObjects + * Fixed problem with management of p_ref_object in GenericBaseObject + * Added activateRepository method to RepoManager + 2001-7-15 Gerard Flynn <ger...@fr...> * Hacked GenericStructuralFeature::checkType to always return true for Index: Generic.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/mof/Generic.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** Generic.cpp 2001/07/15 11:14:31 1.4 --- Generic.cpp 2001/08/03 02:03:05 1.5 *************** *** 64,67 **** --- 64,68 ---- } + GenericBaseObject::baseObjVect GenericBaseObject::s_allBaseObjects; GenericBaseObject::GenericBaseObject( const string& name, *************** *** 69,72 **** --- 70,74 ---- :m_name(name), p_meta_object(meta_object), + p_servant(0), m_closed(false) { *************** *** 77,80 **** --- 79,83 ---- assert( !CORBA::is_nil( poa.in() ) ); cerr << "After assert" << endl; + cerr << "Creating reference : repoId = " << repoId << endl; CORBA::Object_var obj = poa->create_reference( repoId.c_str() ); *************** *** 88,91 **** --- 91,95 ---- Reflective::RefBaseObject::_duplicate( refobj.in() ); cerr << "After duplicate" << endl; + s_allBaseObjects.push_back( this ); } *************** *** 147,151 **** Reflective::RefBaseObject_ptr GenericBaseObject::ref_object() { ! return p_ref_object.out(); } --- 151,155 ---- Reflective::RefBaseObject_ptr GenericBaseObject::ref_object() { ! return Reflective::RefBaseObject::_duplicate( p_ref_object ); } *************** *** 155,158 **** --- 159,175 ---- } + RefBaseObject_impl* GenericBaseObject::getServant() + { + if( ! p_servant ) { + createServant(); + } + return p_servant; + } + + void GenericBaseObject::createServant() + { + p_servant = new RefBaseObject_impl( this ); + } + packageMap GenericPackage::s_topLevelPackages; *************** *** 540,543 **** --- 557,565 ---- } + void GenericPackage::createServant() + { + p_servant = new RefPackage_impl( this ); + } + GenericValueCollector::GenericValueCollector() {} *************** *** 1108,1111 **** --- 1130,1139 ---- } + void GenericClassProxy::createServant() + { + p_servant = new RefObject_impl( this ); + } + + GenericInstance::GenericInstance( const string& name, GenericClassProxy* proxy, *************** *** 1191,1194 **** --- 1219,1228 ---- } + void GenericInstance::createServant() + { + p_servant = new RefObject_impl( this ); + } + + GenericFeature::GenericFeature( const string& name, featureKind kind, *************** *** 1210,1213 **** --- 1244,1253 ---- } + void GenericFeature::createServant() + { + p_servant = 0; + } + + GenericStructuralFeature::GenericStructuralFeature( const string& name, const CORBA::TypeCode* base_type, *************** *** 1687,1689 **** --- 1727,1734 ---- { createMetaObject( metaModelMgr->getOperation_ClassProxy() ); + } + + void GenericAssociation::createServant() + { + p_servant = 0; } Index: Generic.hh =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/mof/Generic.hh,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** Generic.hh 2001/07/15 11:14:31 1.4 --- Generic.hh 2001/08/03 02:03:05 1.5 *************** *** 129,132 **** --- 129,136 ---- class GenericBaseObject { + public: + typedef vector<GenericBaseObject*> baseObjVect; + + static baseObjVect s_allBaseObjects; public: // Construction GenericBaseObject( const string& name, *************** *** 160,165 **** --- 164,175 ---- bool isClosed() const; + RefBaseObject_impl* getServant(); + protected: + virtual void createServant(); + GenericInstance* p_meta_object; + + RefBaseObject_impl* p_servant; private: *************** *** 168,172 **** string m_name; ! Reflective::RefBaseObject_var p_ref_object; bool m_closed; --- 178,182 ---- string m_name; ! Reflective::RefBaseObject_ptr p_ref_object; bool m_closed; *************** *** 244,247 **** --- 254,260 ---- GenericPackage* ref_package( const string& mof_id_string ); + protected: + virtual void createServant(); + private: string m_name; *************** *** 462,465 **** --- 475,481 ---- GenericInstance* create_instance( const Reflective::ValueTypeList& args ); + protected: + virtual void createServant(); + private: bool m_designatorsValid; *************** *** 518,521 **** --- 534,540 ---- void fillInInstance( const Reflective::ValueTypeList& args ); + protected: + virtual void createServant(); + private: GenericClassProxy* p_proxy; *************** *** 529,532 **** --- 548,554 ---- virtual ~GenericAssociation() {} + + protected: + virtual void createServant(); }; *************** *** 722,725 **** --- 744,751 ---- featureKind kind() const; + + protected: + virtual void createServant(); + private: featureKind m_kind; Index: Makefile =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/mof/Makefile,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** Makefile 2001/07/15 11:14:31 1.4 --- Makefile 2001/08/03 02:03:05 1.5 *************** *** 1,4 **** INCLUDES = -I/usr/include -I/usr/local/include/mico ! LIBS = -luuid -ldl -L/usr/local/lib -lmico2.3.5 IDLCOMPILER = /usr/local/bin/idl --- 1,4 ---- INCLUDES = -I/usr/include -I/usr/local/include/mico ! LIBS = -luuid -ldl -L/usr/local/lib -lmico2.3.5 -lmicocoss2.3.5 IDLCOMPILER = /usr/local/bin/idl *************** *** 9,13 **** CPPFLAGS = ${CXXFLAGS} ! all : RegularExpression.t RepoManager.t #Generic.t : Generic.t.o Generic.o Reflective.o Reflective_impl.o GenericTest.o GenericTest.h \ --- 9,13 ---- CPPFLAGS = ${CXXFLAGS} ! all : RegularExpression.t RepoManager.t test_client #Generic.t : Generic.t.o Generic.o Reflective.o Reflective_impl.o GenericTest.o GenericTest.h \ *************** *** 38,42 **** --- 38,47 ---- parser.o treewalker.o yacc.o + test_client_OBJECTS = test_client.o Reflective.o mCorba.o + RepoManager.t : ${RepoManager_t_OBJECTS} + g++ -o $@ $^ ${LIBS} + + test_client : ${test_client_OBJECTS} g++ -o $@ $^ ${LIBS} Index: Reflective_impl.h =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/mof/Reflective_impl.h,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** Reflective_impl.h 2001/06/22 03:42:04 1.1 --- Reflective_impl.h 2001/08/03 02:03:05 1.2 *************** *** 24,28 **** /* ****************************************************************************/ ! /* $Header$ */ --- 24,30 ---- /* ****************************************************************************/ ! /* ! $Header$ ! */ Index: RepoManager.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/mof/RepoManager.cpp,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** RepoManager.cpp 2001/07/15 11:14:31 1.4 --- RepoManager.cpp 2001/08/03 02:03:05 1.5 *************** *** 135,139 **** void RepoManager::activateRepository() ! {} --- 135,202 ---- void RepoManager::activateRepository() ! { ! cerr << "Call to RepoManager::activateRepository()" << endl; ! GenericBaseObject::baseObjVect::iterator p; ! for( p = GenericBaseObject::s_allBaseObjects.begin(); ! p != GenericBaseObject::s_allBaseObjects.end(); ! ++p ) ! { ! if( (*p)->getServant() ) { ! cerr << "Activating : " << (*p)->name() << endl; ! PortableServer::ObjectId_var oid = ! GenericPOAManager::thePOAManager()->getPOA()->reference_to_id( (*p)->ref_object() ); ! cerr << "After reference_to_id" << endl; ! GenericPOAManager::thePOAManager()->getPOA()->activate_object_with_id( oid.in(), ! (*p)->getServant() ); ! cerr << "After activate_object_with_id" << endl; ! } ! } ! ! mCorba::activerPOA(); ! publishObjects(); + cerr << "End RepoManager::activateRepository()" << endl; + } + + void RepoManager::publishObjects() + { + cerr << "Call to RepoManager::publishObjects()" << endl; + try { + // Publish the Model package. + GenericPackage* model = GenericPackage::findTopLevelPackage( "Model" ); + assert( model ); + Reflective::RefBaseObject_var model_var = model->ref_object(); + + // Create the kuml context. + CosNaming::Name n; + n.length( 1 ); + n[0].id = CORBA::string_dup( "KUML" ); + try { + CosNaming::NamingContext_var nc = + mCorba::inc->bind_new_context( n ); + } + catch( const CosNaming::NamingContext::AlreadyBound & ) { + // No problem, context already exists. + } + + n.length( 2 ); + n[1].id = CORBA::string_dup( "MOF" ); + try { + CosNaming::NamingContext_var nc = + mCorba::inc->bind_new_context( n ); + } + catch( const CosNaming::NamingContext::AlreadyBound & ) { + // No problem, context already exists. + } + + n.length( 3 ); + n[2].id = CORBA::string_dup( "MODEL" ); + mCorba::inc->rebind( n, model_var.in() ); + } + catch( ... ) { + cerr << "An exception occured in RepoManager::publishObjects" << endl; + exit( -1 ); + } + cerr << "End RepoManager::publishObjects()" << endl; + } Index: RepoManager.hh =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/mof/RepoManager.hh,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -r1.4 -r1.5 *** RepoManager.hh 2001/07/15 11:14:31 1.4 --- RepoManager.hh 2001/08/03 02:03:06 1.5 *************** *** 24,28 **** /* ****************************************************************************/ ! /* $Header$ */ #ifndef RepoManager_H_IS_INCLUDED --- 24,30 ---- /* ****************************************************************************/ ! /* ! $Header$ ! */ #ifndef RepoManager_H_IS_INCLUDED *************** *** 59,62 **** --- 61,66 ---- void buildMetaModel(); + + void publishObjects(); private: stageType m_stage; Index: RepoManager.t.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/mof/RepoManager.t.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** RepoManager.t.cpp 2001/07/15 11:14:31 1.3 --- RepoManager.t.cpp 2001/08/03 02:03:06 1.4 *************** *** 31,43 **** --- 31,55 ---- #include <iostream> #include <cstdio> + #include <cstdlib> #include "mCorba.hh" int main( int argc, char* argv[] ) { + cerr << "In main" << endl; mCorba::init( argc, argv ); + cerr << "After call to mCorba::init" << endl; + try { + mCorba::initServices(); + } + catch( ... ) { + cerr << "An exception occurred while attempting to initialize services" << endl; + exit( -1 ); + } RepoManager rman; rman.setIDLInputFile( stdin ); rman.buildImplementation(); + rman.activateRepository(); + mCorba::orb->run(); return 0; } Index: mCorba.cpp =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/mof/mCorba.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** mCorba.cpp 2001/07/15 11:14:31 1.3 --- mCorba.cpp 2001/08/03 02:03:06 1.4 *************** *** 35,39 **** #include <cstring> ! #include "Generic.hh" bool mCorba::orb_initialise = false; --- 35,40 ---- #include <cstring> ! //#include "Generic.hh" ! #include "KumlUtilities.hh" bool mCorba::orb_initialise = false; *************** *** 52,56 **** { initOrb( argc, argv ); ! initServices(); } --- 53,57 ---- { initOrb( argc, argv ); ! // initServices(); } *************** *** 60,64 **** orb = CORBA::ORB_init( argc, argv ); if( CORBA::is_nil( orb.in() ) ) ! throw GenericException("Erreur d'initialisation de l'orb." ); // resolve_init lance une exception s'il doit retourner une referennce nil. // CORBA::Object_var obj = resolve_init<CORBA::Object>( orb.in(), "RootPOA" ); --- 61,65 ---- orb = CORBA::ORB_init( argc, argv ); if( CORBA::is_nil( orb.in() ) ) ! throw KumlUtilities::KumlException("Erreur d'initialisation de l'orb." ); // resolve_init lance une exception s'il doit retourner une referennce nil. // CORBA::Object_var obj = resolve_init<CORBA::Object>( orb.in(), "RootPOA" ); *************** *** 79,83 **** { if( !orb_initialise ) { ! throw GenericException("Erreur: ORB non-initialise"); } poa_mgr->activate(); --- 80,84 ---- { if( !orb_initialise ) { ! throw KumlUtilities::KumlException("Erreur: ORB non-initialise"); } poa_mgr->activate(); *************** *** 87,93 **** { if( !orb_initialise ) { ! throw GenericException("Erreur: ORB non-initialise"); } ! PortableServer::LifespanPolicy_var policy = poa_racine->create_lifespan_policy( PortableServer:: PERSISTENT ); return policy._retn(); } --- 88,95 ---- { if( !orb_initialise ) { ! throw KumlUtilities::KumlException("Erreur: ORB non-initialise"); } ! PortableServer::LifespanPolicy_var policy = ! poa_racine->create_lifespan_policy( PortableServer:: PERSISTENT ); return policy._retn(); } *************** *** 96,102 **** { if( !orb_initialise ) { ! throw GenericException("Erreur: ORB non-initialise"); } ! PortableServer::LifespanPolicy_var policy = poa_racine->create_lifespan_policy( PortableServer:: TRANSIENT ); return policy._retn(); } --- 98,105 ---- { if( !orb_initialise ) { ! throw KumlUtilities::KumlException("Erreur: ORB non-initialise"); } ! PortableServer::LifespanPolicy_var policy = ! poa_racine->create_lifespan_policy( PortableServer:: TRANSIENT ); return policy._retn(); } *************** *** 105,109 **** { if( !orb_initialise ) { ! throw GenericException("Erreur: ORB non-initialise"); } PortableServer::IdAssignmentPolicy_var policy = --- 108,112 ---- { if( !orb_initialise ) { ! throw KumlUtilities::KumlException("Erreur: ORB non-initialise"); } PortableServer::IdAssignmentPolicy_var policy = *************** *** 115,119 **** { if( !orb_initialise ) { ! throw GenericException("Erreur: ORB non-initialise"); } PortableServer::IdAssignmentPolicy_var policy = --- 118,122 ---- { if( !orb_initialise ) { ! throw KumlUtilities::KumlException("Erreur: ORB non-initialise"); } PortableServer::IdAssignmentPolicy_var policy = *************** *** 125,129 **** { if( !orb_initialise ) { ! throw GenericException("Erreur: ORB non-initialise"); } PortableServer::IdUniquenessPolicy_var policy = --- 128,132 ---- { if( !orb_initialise ) { ! throw KumlUtilities::KumlException("Erreur: ORB non-initialise"); } PortableServer::IdUniquenessPolicy_var policy = *************** *** 135,139 **** { if( !orb_initialise ) { ! throw GenericException("Erreur: ORB non-initialise"); } PortableServer::IdUniquenessPolicy_var policy = --- 138,142 ---- { if( !orb_initialise ) { ! throw KumlUtilities::KumlException("Erreur: ORB non-initialise"); } PortableServer::IdUniquenessPolicy_var policy = *************** *** 145,149 **** { if( !orb_initialise ) { ! throw GenericException("Erreur: ORB non-initialise"); } PortableServer::ImplicitActivationPolicy_var policy = --- 148,152 ---- { if( !orb_initialise ) { ! throw KumlUtilities::KumlException("Erreur: ORB non-initialise"); } PortableServer::ImplicitActivationPolicy_var policy = *************** *** 155,159 **** { if( !orb_initialise ) { ! throw GenericException("Erreur: ORB non-initialise"); } PortableServer::ImplicitActivationPolicy_var policy = --- 158,162 ---- { if( !orb_initialise ) { ! throw KumlUtilities::KumlException("Erreur: ORB non-initialise"); } PortableServer::ImplicitActivationPolicy_var policy = *************** *** 165,169 **** { if( !orb_initialise ) { ! throw GenericException("Erreur: ORB non-initialise"); } PortableServer::RequestProcessingPolicy_var policy = --- 168,172 ---- { if( !orb_initialise ) { ! throw KumlUtilities::KumlException("Erreur: ORB non-initialise"); } PortableServer::RequestProcessingPolicy_var policy = *************** *** 176,180 **** { if( !orb_initialise ) { ! throw GenericException("Erreur: ORB non-initialise"); } PortableServer::RequestProcessingPolicy_var policy = --- 179,183 ---- { if( !orb_initialise ) { ! throw KumlUtilities::KumlException("Erreur: ORB non-initialise"); } PortableServer::RequestProcessingPolicy_var policy = *************** *** 187,191 **** { if( !orb_initialise ) { ! throw GenericException("Erreur: ORB non-initialise"); } PortableServer::RequestProcessingPolicy_var policy = --- 190,194 ---- { if( !orb_initialise ) { ! throw KumlUtilities::KumlException("Erreur: ORB non-initialise"); } PortableServer::RequestProcessingPolicy_var policy = *************** *** 198,202 **** { if( !orb_initialise ) { ! throw GenericException("Erreur: ORB non-initialise"); } PortableServer::ServantRetentionPolicy_var policy = --- 201,205 ---- { if( !orb_initialise ) { ! throw KumlUtilities::KumlException("Erreur: ORB non-initialise"); } PortableServer::ServantRetentionPolicy_var policy = *************** *** 209,213 **** { if( !orb_initialise ) { ! throw GenericException("Erreur: ORB non-initialise"); } PortableServer::ServantRetentionPolicy_var policy = --- 212,216 ---- { if( !orb_initialise ) { ! throw KumlUtilities::KumlException("Erreur: ORB non-initialise"); } PortableServer::ServantRetentionPolicy_var policy = *************** *** 220,224 **** { if( !orb_initialise ) { ! throw GenericException("Erreur: ORB non-initialise"); } PortableServer::ThreadPolicy_var policy = --- 223,227 ---- { if( !orb_initialise ) { ! throw KumlUtilities::KumlException("Erreur: ORB non-initialise"); } PortableServer::ThreadPolicy_var policy = *************** *** 231,235 **** { if( !orb_initialise ) { ! throw GenericException("Erreur: ORB non-initialise"); } PortableServer::ThreadPolicy_var policy = --- 234,238 ---- { if( !orb_initialise ) { ! throw KumlUtilities::KumlException("Erreur: ORB non-initialise"); } PortableServer::ThreadPolicy_var policy = *************** *** 241,245 **** void mCorba::initServices() { ! // inc = resolve_init<CosNaming::NamingContext>( orb.in(), "NameService" ); } --- 244,248 ---- void mCorba::initServices() { ! inc = resolve_init<CosNaming::NamingContext>( orb.in(), "NameService" ); } Index: mCorba.hh =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/mof/mCorba.hh,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -r1.3 -r1.4 *** mCorba.hh 2001/07/15 11:14:31 1.3 --- mCorba.hh 2001/08/03 02:03:06 1.4 *************** *** 46,50 **** template<class T> ! static typename T::_ptr_type resolve_name( CosNaming::NamingContext_ptr nc, const CosNaming::Name& name ); --- 46,51 ---- template<class T> ! // static typename T::_ptr_type ! static T* resolve_name( CosNaming::NamingContext_ptr nc, const CosNaming::Name& name ); Index: mCorba.i =================================================================== RCS file: /cvsroot/kuml/kuml/libkuml/mof/mCorba.i,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -r1.1 -r1.2 *** mCorba.i 2001/06/22 03:42:04 1.1 --- mCorba.i 2001/08/03 02:03:06 1.2 *************** *** 24,28 **** /* ****************************************************************************/ ! /* $Header$ */ /* -*- C++ -*- */ --- 24,30 ---- /* ****************************************************************************/ ! /* ! $Header$ ! */ /* -*- C++ -*- */ *************** *** 66,70 **** template<class T> ! inline typename T::_ptr_type mCorba::resolve_name( CosNaming::NamingContext_ptr nc, const CosNaming::Name& name ) --- 68,73 ---- template<class T> ! //inline typename T::_ptr_type ! inline T* mCorba::resolve_name( CosNaming::NamingContext_ptr nc, const CosNaming::Name& name ) |