1 // SALOME ParallelContainerProxyDummy : Proxy of a PaCO++ object using Dummy
3 // Copyright (C) 2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SALOME_ParallelContainerProxyDummy.cxx
25 // Author : André Ribes, EDF
26 // Module : SALOME PARALLEL
39 //#include "SALOME_ComponentPaCO_Engines_Container_server.h"
40 #include "SALOME_ParallelContainerProxy_i.hxx"
41 #include <paco_omni.h>
42 #include <paco_dummy.h>
44 #include "SALOME_NamingService.hxx"
46 #include "utilities.h"
47 #include "Utils_ORB_INIT.hxx"
48 #include "Utils_SINGLETON.hxx"
49 #include "SALOMETraceCollector.hxx"
57 cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
58 cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
59 cerr << "SIGSEGV in :" << getpid() << endl;
60 cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
61 cerr << "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!" << endl;
66 int main(int argc, char* argv[])
68 INFOS("Launching a parallel proxy container");
71 signal(SIGSEGV, handler);
73 // Initialise the ORB.
74 CORBA::ORB_var orb = CORBA::ORB_init(argc, argv);
76 std::string containerName("");
78 containerName = argv[1];
82 CORBA::Object_var obj = orb->resolve_initial_references("RootPOA");
83 ASSERT(!CORBA::is_nil(obj));
84 PortableServer::POA_var root_poa = PortableServer::POA::_narrow(obj);
85 PortableServer::POAManager_var pman = root_poa->the_POAManager();
88 // add this container to the kill list
90 sprintf(aCommand, "addToKillList.py %d SALOME_ParallelContainerProxyDummy", getpid());
94 SALOME_NamingService * ns = new SALOME_NamingService(CORBA::ORB::_duplicate(orb));
95 // Engines::Container_proxy_impl * proxy =
96 // new Engines::Container_proxy_impl(orb,
97 // new paco_omni_fabrique());
99 Container_proxy_impl_final * proxy =
100 new Container_proxy_impl_final(orb,
101 new paco_omni_fabrique());
103 paco_fabrique_manager* pfm = paco_getFabriqueManager();
104 pfm->register_com("dummy", new paco_dummy_fabrique());
105 proxy->setLibCom("dummy", proxy);
106 pfm->register_thread("omnithread", new paco_omni_fabrique());
107 proxy->setLibThread("omnithread");
108 // Topo of the parallel object
109 PaCO::PacoTopology_t serveur_topo;
110 serveur_topo.total = 1;
111 proxy->setTopology(serveur_topo);
113 PortableServer::ObjectId_var _id = root_poa->activate_object(proxy);
114 obj = root_poa->id_to_reference(_id);
116 // In the NamingService
117 string hostname = GetHostname();
118 Engines::Container_var pCont = Engines::Container::_narrow(obj);
119 string _containerName = ns->BuildContainerNameForNS(containerName.c_str(),
121 cerr << "---------" << _containerName << "----------" << endl;
122 ns->Register(pCont, _containerName.c_str());
126 catch (PaCO::PACO_Exception& e)
128 INFOS("Caught PaCO::PACO_Exception");
129 std::cerr << e << std::endl;
131 catch(CORBA::SystemException&)
133 INFOS("Caught CORBA::SystemException.");
135 catch(PortableServer::POA::ServantAlreadyActive&)
137 INFOS("Caught CORBA::ServantAlreadyActiveException");
139 catch(CORBA::Exception&)
141 INFOS("Caught CORBA::Exception.");
143 catch(std::exception& exc)
145 INFOS("Caught std::exception - "<<exc.what());
149 INFOS("Caught unknown exception.");