// License along with this library; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
//
//
// File : SALOME_ModuleCatalog_Server.cxx
// Module : SALOME
-
/* $Header$ */
+
#include <iostream>
#include "SALOME_NamingService.hxx"
#include "SALOME_ModuleCatalog_impl.hxx"
int main(int argc,char **argv)
{
+ // initialize the ORB
+ CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv);
+ // LocalTraceCollector *myThreadTrace = SALOMETraceCollector::instance(orb);
try
{
CosNaming::NamingContext_var _rootContext, catalogContext;
- // initialize the ORB
-
- CORBA::ORB_ptr orb = CORBA::ORB_init (argc, argv);
-
// initialize POA
//
- long TIMESleep = 250000000;
+ long TIMESleep = 500000000;
int NumberOfTries = 40;
int a;
timespec ts_req;
for (int i = 1; i<=NumberOfTries; i++)
{
if (i!=1)
+#ifndef WNT
a=nanosleep(&ts_req,&ts_rem);
+#else
+ Sleep(TIMESleep/1000000);
+#endif
try
{
obj = orb->resolve_initial_references("RootPOA");
if(!CORBA::is_nil(orb))
theObj = orb->resolve_initial_references("NameService");
}
- catch( CORBA::COMM_FAILURE& )
+ catch( CORBA::SystemException& )
{
- MESSAGE( "Module Catalog Server: CORBA::COMM_FAILURE: Unable to contact the Naming Service" );
+ INFOS( "Module Catalog Server: CORBA::SystemException: Unable to contact the Naming Service" );
}
if (!CORBA::is_nil(theObj))
{
inc = CosNaming::NamingContext::_narrow(theObj);
if(!CORBA::is_nil(inc))
{
- MESSAGE( "Module Catalog Server: Naming Service was found" );
+ INFOS( "Module Catalog Server: Naming Service was found" );
if(EnvL==1)
{
CORBA::ORB_var orb1 = CORBA::ORB_init(argc,argv) ;
for(int j=1; j<=NumberOfTries; j++)
{
if (j!=1)
+#ifndef WNT
a=nanosleep(&ts_req, &ts_rem);
+#else
+ Sleep(TIMESleep/1000000);
+#endif
try{
object = inc->resolve(name);}
catch(CosNaming::NamingContext::NotFound)
{
- MESSAGE( "Logger Server wasn't found" );
+ INFOS( "Logger Server wasn't found" );
}
catch(...)
{
- MESSAGE( "Module Catalog Server: Unknown exception" ) ;
+ INFOS( "Module Catalog Server: Unknown exception" ) ;
}
if (!CORBA::is_nil(object))
{
- MESSAGE( "Module Catalog Server: Logger Server was found" );
+ INFOS( "Module Catalog Server: Logger Server was found" );
MODULE_CATALOG=1;
break;
}
// Active catalog
- SALOME_ModuleCatalogImpl* Catalogue_i = new SALOME_ModuleCatalogImpl(argc, argv);
- poa->activate_object (Catalogue_i);
+ SALOME_ModuleCatalogImpl Catalogue_i(argc, argv, orb);
+ poa->activate_object (&Catalogue_i);
mgr->activate();
- CORBA::Object_ptr myCata = Catalogue_i->_this();
+ CORBA::Object_ptr myCata = Catalogue_i._this();
// initialise Naming Service
SALOME_NamingService *_NS;
#endif
orb->run();
+ mgr->deactivate(true,true);
poa->destroy(1,1);
-
+
}
catch(CORBA::SystemException&) {
INFOS("Caught CORBA::SystemException.")
INFOS("Caught CORBA::Exception.")
}
+ // delete myThreadTrace;
return 0;
}