Commit 7ac260e4 authored by Pavel Vainerman's avatar Pavel Vainerman

Сделал имя NameService уникальным для Configure

parent 2675d22f
#!/bin/sh
./uniset-start.sh -f "./uniset-admin --confile test.xml --`basename $0 .sh` $1 $2 $3 $4"
./uniset-start.sh -f "./uniset-admin --confile conf21300.xml --`basename $0 .sh` $1 $2 $3 $4"
exit $?
......@@ -38,7 +38,7 @@
<item type="int" from="3" to="4" toInput="1" />
<item type="int" from="4" to="5" toInput="2" />
<item type="int" from="5" to="6" toInput="1" />
<item type="out" from="6" to="Output1_C"/>
<item type="out" from="6" to="TestMode_S"/>
</connections>
</Schema>
#!/bin/sh
uniset-start.sh -g ./uniset-plogicproc --schema schema.xml \
uniset-start.sh -f ./uniset-plogicproc --schema schema.xml \
--smemory-id SharedMemory --name LProcessor \
--confile test.xml --unideb-add-levels info,crit,warn,level9,system
......@@ -200,7 +200,7 @@ namespace UniSetTypes
CORBA::ORB_var orb;
CORBA::PolicyList policyList;
const std::string NSName; /*!< имя сервиса именования на ланной машине (обычно "NameService") */
std::string NSName; /*!< имя сервиса именования на ланной машине (обычно "NameService") */
unsigned int countOfNet; /*!< количество резервных каналов */
unsigned int repeatCount; /*!< количество попыток получить доступ к удаленному объекту
прежде чем будет выработано исключение TimeOut. */
......
......@@ -103,7 +103,7 @@
protected:
ObjectRepository();
const std::string nsName;
std::string nsName;
UniSetTypes::Configuration* uconf;
bool list(const std::string& section, UniSetTypes::ListObjectName *ls, unsigned int how_many, ObjectType type);
......
......@@ -79,13 +79,16 @@ void UniversalInterface::init()
localctx=CosNaming::NamingContext::_nil();
try
{
ostringstream s;
s << uconf << oind->getRealNodeName(uconf->getLocalNode());
if( CORBA::is_nil(orb) )
{
CORBA::ORB_var _orb = uconf->getORB();
localctx = ORepHelpers::getRootNamingContext( _orb, oind->getRealNodeName(uconf->getLocalNode()) );
localctx = ORepHelpers::getRootNamingContext( _orb, s.str() );
}
else
localctx = ORepHelpers::getRootNamingContext( orb, oind->getRealNodeName(uconf->getLocalNode()) );
localctx = ORepHelpers::getRootNamingContext( orb, s.str() );
}
catch( Exception& ex )
{
......@@ -1714,12 +1717,14 @@ ObjectPtr UniversalInterface::resolve( ObjectId rid , ObjectId node, int timeout
}
}
if( node!=uconf->getLocalNode() )
{
cout << "******** Resolve REMOTE NODE ***" << endl;
// Получаем доступ к NameService на данном узле
string nodeName( oind->getRealNodeName(node) );
ostringstream s;
s << uconf << oind->getRealNodeName(node);
string nodeName(s.str());
string bname(nodeName); // сохраняем базовое название
for(unsigned int curNet=1; curNet<=uconf->getCountOfNet(); curNet++)
{
......@@ -1753,20 +1758,26 @@ ObjectPtr UniversalInterface::resolve( ObjectId rid , ObjectId node, int timeout
}
else
{
cout << "******** Resolve LOCAL NODE ***" << endl;
if( CORBA::is_nil(localctx) )
{
ostringstream s;
s << uconf << oind->getRealNodeName(node);
string nodeName(s.str());
if( CORBA::is_nil(orb) )
{
CORBA::ORB_var _orb = uconf->getORB();
localctx = ORepHelpers::getRootNamingContext( _orb, oind->getRealNodeName(uconf->getLocalNode()) );
localctx = ORepHelpers::getRootNamingContext( _orb, nodeName);
}
else
localctx = ORepHelpers::getRootNamingContext( orb, oind->getRealNodeName(uconf->getLocalNode()) );
localctx = ORepHelpers::getRootNamingContext( orb, nodeName );
}
else
ctx = localctx;
}
ctx = localctx;
cout << "***resolve oname=" << oind->getNameById(rid,node).c_str() << endl;
CosNaming::Name_var oname = omniURI::stringToName( oind->getNameById(rid,node).c_str() );
for (unsigned int i=0; i<uconf->getRepeatCount(); i++)
{
......
......@@ -67,6 +67,11 @@ bool ObjectRepository::init()
try
{
CORBA::ORB_var orb = uconf->getORB();
{
ostringstream s;
s << uconf << "NameService";
nsName = s.str();
}
localctx = ORepHelpers::getRootNamingContext(orb, nsName );
if( CORBA::is_nil(localctx) )
localctx=0;
......
......@@ -200,6 +200,12 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
rootDir = string(curdir) + "/";
UniSetTypes::conf = this;
{
ostringstream s;
s << this << "NameService";
NSName = s.str();
}
try
{
......@@ -329,7 +335,7 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
string name(oind->getRealNodeName(it->id));
ostringstream param;
param << name << "=corbaname::" << it->host << ":" << it->port;
param << this << name << "=corbaname::" << it->host << ":" << it->port;
new_argv[i+1] = strdup(param.str().c_str());
if( unideb.debugging(Debug::INFO) )
......@@ -359,7 +365,7 @@ void Configuration::initConfiguration( int argc, const char* const* argv )
string defPort( getPort( getProp(nsnode,"port") ) ); // здесь вызывается getArgParam! проходящий по _argv
ostringstream param;
param <<"NameService=corbaname::" << getProp(nsnode,"host") << ":" << defPort;
param << this << "NameService=corbaname::" << getProp(nsnode,"host") << ":" << defPort;
new_argv[i+1] = strdup(param.str().c_str());
if( unideb.debugging(Debug::INFO) )
unideb[Debug::INFO] << "(Configuration): внесли параметр " << param.str() << endl;
......
......@@ -4,7 +4,8 @@
SUBDIRS=JrnTests
noinst_PROGRAMS = passivetimer unixml ui umutex conftest iterator_test sscanf_hex calibration
noinst_PROGRAMS = ui
#passivetimer unixml ui umutex conftest iterator_test sscanf_hex calibration
passivetimer_SOURCES = passivetimer.cc
passivetimer_LDADD = $(top_builddir)/lib/libUniSet.la
......
......@@ -9,17 +9,15 @@ int main( int argc, const char **argv )
{
try
{
//UniSetTypes::Configuration* myconf = new UniSetTypes::Configuration(argc,argv,"test.xml");
UniSetTypes::Configuration* myconf = new UniSetTypes::Configuration(argc,argv,"test.xml");
// UniversalInterface* ui = new UniversalInterface(myconf);
//cout << "************************ myconf=" << myconf << " conf=" << UniSetTypes::conf << endl;
UniSetTypes::Configuration* myconf2 = new UniSetTypes::Configuration(argc,argv,"conf21300.xml");
UniversalInterface* ui2 = new UniversalInterface(myconf2);
cout << "************************ myconf2=" << myconf2 << " conf=" << UniSetTypes::conf << endl;
cout << "************************ " << ui2->getValue(200033) << endl;
// cout << "Conf1: get=" << ui1->getValue(12) << endl;
cout << "Conf2: get=" << ui2->getValue(200033) << endl;
#if 0
uniset_init(argc,argv,"test.xml");
UniversalInterface ui;
......
......@@ -4,6 +4,5 @@ SID=$1
[ -z "$SID" ] && SID=1
uniset-start.sh -f ./ui --confile test.xml --sid $SID -ORBtraceLevel 20
#--unideb-add-levels system,info,level9
uniset-start.sh -f ./ui --confile test.xml --sid $SID --unideb-add-levels any -ORBtraceLevel 20
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment