Commit 527661d2 authored by Pavel Vainerman's avatar Pavel Vainerman

(netdata-plugin): Исправил ошибку в работе с argc,argv (сделал копирование).

(uniset): рефакторинг
parent 77b6dc12
......@@ -183,7 +183,7 @@ namespace UniSetTypes
std::shared_ptr<UniXML> unixml;
int _argc = { 0 };
const char* const* _argv;
const char** _argv = { nullptr };
CORBA::ORB_var orb;
CORBA::PolicyList policyList;
......
......@@ -53,7 +53,7 @@ class UniSetActivator:
{
public:
static UniSetActivatorPtr Instance( const UniSetTypes::ObjectId id = UniSetTypes::DefaultObjectId );
static UniSetActivatorPtr Instance();
void Destroy();
std::shared_ptr<UniSetActivator> get_aptr();
......@@ -92,7 +92,6 @@ class UniSetActivator:
// уносим в protected, т.к. Activator должен быть только один..
UniSetActivator();
UniSetActivator( const UniSetTypes::ObjectId id );
static std::shared_ptr<UniSetActivator> inst;
......
......@@ -241,7 +241,7 @@ namespace UniSetTypes
inline int getArgInt( const std::string& name,
int _argc, const char* const* _argv,
const std::string defval = "" ) noexcept
const std::string& defval = "" ) noexcept
{
return uni_atoi(getArgParam(name, _argc, _argv, defval));
}
......
......@@ -35,6 +35,9 @@ void pyUInterface::uniset_init_params( UTypes::Params* p, const std::string& xml
void pyUInterface::uniset_init( int argc, char* argv[], const std::string& xmlfile )throw(UException)
{
if( uInterface )
return;
try
{
UniSetTypes::uniset_init(argc, argv, xmlfile);
......
......@@ -20,8 +20,6 @@
using namespace std;
// --------------------------------------------------------------------------
UConnector::UConnector( UTypes::Params* p, const std::string& xfile )throw(UException):
conf(0),
ui(0),
xmlfile(xfile)
{
try
......@@ -29,19 +27,17 @@ UConnector::UConnector( UTypes::Params* p, const std::string& xfile )throw(UExce
conf = UniSetTypes::uniset_init(p->argc, p->argv, xmlfile);
ui = make_shared<UInterface>(conf);
}
catch( UniSetTypes::Exception& ex )
catch( std::exception& ex )
{
throw UException(ex.what());
}
catch( ... )
{
throw UException();
throw UException("(UConnector): Unknown exception");
}
}
//---------------------------------------------------------------------------
UConnector::UConnector(int argc, char** argv, const string& xfile )throw(UException):
conf(0),
ui(0),
xmlfile(xfile)
{
try
......@@ -49,13 +45,13 @@ UConnector::UConnector(int argc, char** argv, const string& xfile )throw(UExcept
conf = UniSetTypes::uniset_init(argc, argv, xmlfile);
ui = make_shared<UInterface>(conf);
}
catch( UniSetTypes::Exception& ex )
catch( std::exception& ex )
{
throw UException(ex.what());
}
catch( ... )
{
throw UException();
throw UException("(UConnector): Unknown exception");
}
}
// --------------------------------------------------------------------------
......@@ -158,6 +154,19 @@ string UConnector::getTextName( long id )
return "";
}
//---------------------------------------------------------------------------
void UConnector::activate_objects() throw(UException)
{
try
{
auto act = UniSetActivator::Instance();
act->run(true);
}
catch( const std::exception& ex )
{
throw UException("(activate_objects): catch " + std::string(ex.what()) );
}
}
//---------------------------------------------------------------------------
long UConnector::getObjectID(const string& name )
{
if( conf )
......
......@@ -23,6 +23,7 @@
#include "UInterface.h"
#include "UTypes.h"
#include "UExceptions.h"
#include "UniSetActivator.h"
// --------------------------------------------------------------------------
class UConnector
{
......@@ -48,6 +49,8 @@ class UConnector
std::string getName( long id );
std::string getTextName( long id );
void activate_objects() throw(UException);
private:
std::shared_ptr<UniSetTypes::Configuration> conf;
std::shared_ptr<UInterface> ui;
......
......@@ -3567,7 +3567,7 @@ SWIGINTERN PyObject *_wrap_Params_add_str(PyObject *SWIGUNUSEDPARM(self), PyObje
std::string *ptr = (std::string *)0;
int res = SWIG_AsPtr_std_string(obj1, &ptr);
if (!SWIG_IsOK(res) || !ptr) {
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "Params_add_str" "', argument " "2"" of type '" "std::string""'");
SWIG_exception_fail(SWIG_ArgError((ptr ? res : SWIG_TypeError)), "in method '" "Params_add_str" "', argument " "2"" of type '" "std::string const""'");
}
arg2 = *ptr;
if (SWIG_IsNewObj(res)) delete ptr;
......@@ -4400,6 +4400,33 @@ fail:
}
SWIGINTERN PyObject *_wrap_UConnector_activate_objects(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *resultobj = 0;
UConnector *arg1 = (UConnector *) 0 ;
void *argp1 = 0 ;
int res1 = 0 ;
PyObject * obj0 = 0 ;
if (!PyArg_ParseTuple(args,(char *)"O:UConnector_activate_objects",&obj0)) SWIG_fail;
res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_UConnector, 0 | 0 );
if (!SWIG_IsOK(res1)) {
SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "UConnector_activate_objects" "', argument " "1"" of type '" "UConnector *""'");
}
arg1 = reinterpret_cast< UConnector * >(argp1);
try {
(arg1)->activate_objects();
}
catch(UException &_e) {
SWIG_Python_Raise(SWIG_NewPointerObj((new UException(static_cast< const UException& >(_e))),SWIGTYPE_p_UException,SWIG_POINTER_OWN), "UException", SWIGTYPE_p_UException); SWIG_fail;
}
resultobj = SWIG_Py_Void();
return resultobj;
fail:
return NULL;
}
SWIGINTERN PyObject *UConnector_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
PyObject *obj;
if (!PyArg_ParseTuple(args,(char*)"O:swigregister", &obj)) return NULL;
......@@ -4431,6 +4458,7 @@ static PyMethodDef SwigMethods[] = {
{ (char *)"UConnector_getShortName", _wrap_UConnector_getShortName, METH_VARARGS, NULL},
{ (char *)"UConnector_getName", _wrap_UConnector_getName, METH_VARARGS, NULL},
{ (char *)"UConnector_getTextName", _wrap_UConnector_getTextName, METH_VARARGS, NULL},
{ (char *)"UConnector_activate_objects", _wrap_UConnector_activate_objects, METH_VARARGS, NULL},
{ (char *)"UConnector_swigregister", UConnector_swigregister, METH_VARARGS, NULL},
{ NULL, NULL, 0, NULL }
};
......
......@@ -69,13 +69,28 @@ UProxyObject::UProxyObject() throw(UException)
throw UException("(UProxyObject): Unknown 'name'' or 'ID'");
}
// --------------------------------------------------------------------------
UProxyObject::UProxyObject( const std::string& name ) throw( UException ):
UProxyObject::UProxyObject(uniset_conf()->getObjectID(name))
UProxyObject::UProxyObject( const std::string& name ) throw( UException )
{
auto conf = uniset_conf();
if ( !conf )
{
std::ostringstream err;
err << "(UProxyObject:init): Create '" << name << "' failed. Unknown configuration";
std::cerr << err.str() << std::endl;
throw UException(err.str());
}
long id = conf->getObjectID(name);
init(id);
}
// --------------------------------------------------------------------------
UProxyObject::UProxyObject( long id ) throw( UException )
{
init(id);
}
// --------------------------------------------------------------------------
void UProxyObject::init( long id ) throw( UException )
{
try
{
uobj = std::make_shared<UProxyObject_impl>(id);
......@@ -86,6 +101,7 @@ UProxyObject::UProxyObject( long id ) throw( UException )
{
std::ostringstream err;
err << "(UProxyObject): id='" << id << "' error: " << std::string(ex.what());
std::cerr << err.str() << std::endl;
throw UException(err.str());
}
}
......@@ -144,7 +160,7 @@ void UProxyObject::addToAsk( long id ) throw(UException)
}
// --------------------------------------------------------------------------
UProxyObject_impl::UProxyObject_impl( ObjectId id ):
UObject_SK(id)
UObject_SK(id,nullptr)
{
}
......
......@@ -18,7 +18,9 @@
#define UProxyObject_H_
// --------------------------------------------------------------------------
#include <memory>
#include "Configuration.h"
#include "UExceptions.h"
#include "UTypes.h"
// --------------------------------------------------------------------------
class UProxyObject_impl; // PIMPL
// --------------------------------------------------------------------------
......@@ -67,6 +69,7 @@ class UProxyObject
bool smIsOK();
protected:
void init( long id ) throw( UException );
private:
UProxyObject()throw(UException);
......
......@@ -18,6 +18,7 @@
#define UTypes_H_
// --------------------------------------------------------------------------
#include <string>
#include "Configuration.h"
#include "UniSetTypes.h"
// --------------------------------------------------------------------------
namespace UTypes
......@@ -38,7 +39,7 @@ namespace UTypes
{
if( argc < Params::max )
{
argv[argc++] = s;
argv[argc++] = UniSetTypes::uni_strdup(s);
return true;
}
......
......@@ -155,6 +155,9 @@ class UConnector:
def getTextName(self, id):
return _pyUConnector.UConnector_getTextName(self, id)
def activate_objects(self):
return _pyUConnector.UConnector_activate_objects(self)
UConnector_swigregister = _pyUConnector.UConnector_swigregister
UConnector_swigregister(UConnector)
......
......@@ -9,6 +9,7 @@ import random
import uniset2
from uniset2 import UniXML
from uniset2 import UProxyObject
from uniset2 import UConnector
sys.path.append("./python_modules")
from base import SimpleService
......@@ -24,6 +25,7 @@ class Service(SimpleService):
sensors = []
uproxy = None
uconnector = None
smOK = False
def __init__(self, configuration=None, name=None):
......@@ -41,8 +43,8 @@ class Service(SimpleService):
self.error("uniset plugin: Not found confile '%s'"%confile)
raise RuntimeError
self.name = self.get_conf_param('name', name)
self.info("%s: uniset plugin: read from %s"%(name,confile))
#self.name = self.get_conf_param('name', name)
self.info("%s: read from %s"%(name,confile))
self.create_charts(confile)
self.init_uniset(confile)
# добавляем датчики в опрос..
......@@ -51,24 +53,22 @@ class Service(SimpleService):
def init_uniset(self, confile):
lst = uniset2.Params_inst()
arglist= uniset2.Params_inst()
for i in range(0, len(sys.argv)):
if i >= uniset2.Params.max:
break;
lst.add(sys.argv[i])
arglist.add(sys.argv[i])
port = self.get_conf_param('port', '')
if port != '':
self.info("%s: uniset plugin: --uniset-port %s" % (self.name,port))
p = '--uniset-port'
lst.add_str(p)
lst.add_str( str(port) )
arglist.add_str(p)
arglist.add_str( str(port) )
uname = self.get_conf_param('uname', 'TestProc')
self.info("%s: uniset plugin: init ObjectID '%s'" % (self.name,uname))
try:
uniset2.uniset_init_params(lst, confile);
self.uconnector = UConnector(arglist,confile)
self.uproxy = UProxyObject(uname)
except uniset2.UException, e:
self.error("uniset plugin: error: %s"% e.getError())
......@@ -86,7 +86,7 @@ class Service(SimpleService):
def find_section(self, xml, secname):
node = xml.findNode(xml.getDoc(), secname)[0]
if node == None:
self.error("uniset plugin: not found %s section" % secname)
self.error("not found '%s' section in %s" % (secname,xml.getFileName()))
raise RuntimeError
return node.children
......@@ -107,7 +107,7 @@ class Service(SimpleService):
# CHART type.id name title units [family [context [charttype [priority [update_every]]]]]
id = node.prop('id')
if id == '' or id == None:
self.error("uniset plugin: IGNORE CHART.. Unknown id=''.")
self.error("IGNORE CHART.. Unknown id=''.")
node = xml.nextNode(node)
continue
......@@ -138,7 +138,7 @@ class Service(SimpleService):
self.order = myOrder
except uniset2.UniXMLException, e:
self.error("uniset plugin: FAILED load xmlfile=%s err='%s'" % (confile, e.getError()))
self.error("FAILED load xmlfile=%s err='%s'" % (confile, e.getError()))
raise RuntimeError
def build_lines(self, chart, lnode, xml, snode):
......@@ -151,7 +151,7 @@ class Service(SimpleService):
fv = node.prop('filter_value')
if ff == '' or ff == None:
self.error("uniset plugin: Unknown filter_fileld for chart id='%s'" % node.parent.prop('id'))
self.error("Unknown filter_fileld for chart id='%s'" % node.parent.prop('id'))
raise RuntimeError
self.read_sensors(snode,ff,fv,xml, chart)
......@@ -174,7 +174,7 @@ class Service(SimpleService):
params = []
id = self.get_param(node, 'netdata_id', node.prop('name'))
if id == '' or id == None:
self.error("uniset plugin: Unknown 'id' for sensor %s" % node.prop('name'))
self.error("Unknown 'id' for sensor %s" % node.prop('name'))
raise RuntimeError
params.append(id)
......@@ -216,9 +216,10 @@ class Service(SimpleService):
def check(self):
self.info("**** uniset_activate_objects")
# ret = super(self.__class__, self).check()
try:
uniset2.uniset_activate_objects()
self.uconnector.activate_objects()
except uniset2.UException, e:
self.error("%s"% e.getError())
raise False
......@@ -262,3 +263,13 @@ if __name__ == "__main__":
config['retries'] = retries
serv = Service(config,"test")
config2 = {}
config2['confile'] = './test.xml'
config2['port'] = 2809
config2['uname'] = 'TestProc1'
config2['update_every'] = update_every
config2['priority'] = priority
config2['retries'] = retries
serv2 = Service(config2,"test")
......@@ -12,18 +12,34 @@ from lib import *
if __name__ == "__main__":
lst = Params_inst()
lst2 = Params_inst()
for i in range(0, len(sys.argv)):
if i >= Params.max:
break;
lst.add( sys.argv[i] )
lst2.add( sys.argv[i] )
pstr = "--uniset-port"
pstr2= "12"
lst.add_str(pstr)
lst.add_str(pstr2)
lst2.add_str(pstr)
lst2.add_str(pstr2)
p = []
print "lst: class: " + str(p.__class__.__name__)
try:
uc1 = UConnector( lst, "test.xml" )
uc2 = UConnector( lst2, "test.xml" )
obj1 = UProxyObject("TestProc",uc1.getConfID())
obj2 = UProxyObject("TestProc1",uc2.getConfID())
# print "(0)UIType: %s" % uc1.getUIType()
......
......@@ -28,7 +28,14 @@ if __name__ == "__main__":
uniset_init_params( lst, "test.xml");
obj1 = UProxyObject("TestProc")
obj2 = UProxyObject("TestProc1")
uniset_activate_objects()
while True:
print "sleep..."
print "getValue: %d=%d" % ( 1, getValue(1) )
time.sleep(2)
print "getShortName: id=%d name=%s" % (1, getShortName(1))
print " getName: id=%d name=%s" % (1, getName(1))
......
......@@ -483,11 +483,11 @@ void terminate_thread()
// ---------------------------------------------------------------------------
UniSetActivatorPtr UniSetActivator::inst;
// ---------------------------------------------------------------------------
UniSetActivatorPtr UniSetActivator::Instance( const UniSetTypes::ObjectId id )
UniSetActivatorPtr UniSetActivator::Instance()
{
if( inst == nullptr )
{
inst = shared_ptr<UniSetActivator>( new UniSetActivator(id) );
inst = shared_ptr<UniSetActivator>( new UniSetActivator() );
g_act = inst;
}
......@@ -505,13 +505,6 @@ std::shared_ptr<UniSetActivator> UniSetActivator::get_aptr()
return std::dynamic_pointer_cast<UniSetActivator>(get_ptr());
}
// ---------------------------------------------------------------------------
UniSetActivator::UniSetActivator( const ObjectId id ):
UniSetManager(id),
omDestroy(false)
{
UniSetActivator::init();
}
// ------------------------------------------------------------------------------------------
UniSetActivator::UniSetActivator():
UniSetManager(UniSetTypes::DefaultObjectId),
omDestroy(false)
......
......@@ -134,13 +134,19 @@ void UniSetObject::initObject()
auto conf = uniset_conf();
if( !conf )
{
ostringstream err;
err << myname << "(initObject): Unknown configuration!!";
throw SystemError(err.str());
}
int sz = conf->getArgPInt("--uniset-object-size-message-queue", conf->getField("SizeOfMessageQueue"), 1000);
if( sz > 0 )
setMaxSizeOfMessageQueue(sz);
uinfo << myname << "(init): SizeOfMessageQueue=" << getMaxSizeOfMessageQueue()
<< endl;
uinfo << myname << "(init): SizeOfMessageQueue=" << getMaxSizeOfMessageQueue() << endl;
}
// ------------------------------------------------------------------------------------------
......
......@@ -511,10 +511,10 @@ int UniSetTypes::uni_atoi( const char* str ) noexcept
//--------------------------------------------------------------------------------------------
char* UniSetTypes::uni_strdup( const string& src )
{
const char* s = src.c_str();
size_t len = strlen(s);
size_t len = src.size();
char* d = new char[len + 1];
memcpy(d, s, len + 1);
memcpy(d, src.data(), len);
d[len] = '\0';
return d;
}
// -------------------------------------------------------------------------
......
......@@ -98,7 +98,8 @@ namespace UniSetTypes
Configuration::Configuration():
oind(NULL),
_argv(nullptr),
// _argc(0),
// _argv(nullptr),
NSName("NameService"),
repeatCount(2), repeatTimeout(100),
localDBServer(UniSetTypes::DefaultObjectId),
......@@ -118,14 +119,19 @@ namespace UniSetTypes
if( unixml )
unixml.reset();
for( int i=0; i<_argc; i++ )
delete[] _argv[i];
delete[] _argv;
}
// ---------------------------------------------------------------------------------
Configuration::Configuration( int argc, const char* const* argv, const string& xmlfile ):
oind(nullptr),
unixml(nullptr),
_argc(argc),
_argv(argv),
// _argc(argc),
// _argv(argv),
NSName("NameService"),
repeatCount(2), repeatTimeout(100),
localDBServer(UniSetTypes::DefaultObjectId),
......@@ -143,8 +149,8 @@ namespace UniSetTypes
const string& fileConf ):
oind(nullptr),
unixml(nullptr),
_argc(argc),
_argv(argv),
// _argc(argc),
// _argv(argv),
NSName("NameService"),
repeatCount(2), repeatTimeout(100),
localDBServer(UniSetTypes::DefaultObjectId),
......@@ -162,8 +168,8 @@ namespace UniSetTypes
Configuration::Configuration( int argc, const char* const* argv, const string& fileConf,
UniSetTypes::ObjectInfo* omap ):
oind(NULL),
_argc(argc),
_argv(argv),
// _argc(argc),
// _argv(argv),
NSName("NameService"),
repeatCount(2), repeatTimeout(100),
localDBServer(UniSetTypes::DefaultObjectId),
......@@ -185,6 +191,13 @@ namespace UniSetTypes
// PassiveTimer pt(UniSetTimer::WaitUpTime);
ulogsys << "*** configure from file: " << fileConfName << endl;
// т.к. мы не знаем откуда эти argc и argv и может они будут удалены сразу после завершения функции
// то надёжнее скопировать себе всё..
_argc = argc;
_argv = new const char*[argc];
for( int i=0; i<argc; i++ )
_argv[i] = UniSetTypes::uni_strdup(argv[i]);
iorfile = make_shared<IORFile>();
// -------------------------------------------------------------------------
......@@ -223,8 +236,10 @@ namespace UniSetTypes
}
catch(...)
{
ulogany << "(Configuration): FAILED open configuration from " << fileConfName << endl;
throw;
ostringstream err;
err << "(Configuration): FAILED open configuration from " << fileConfName;
ulogany << err.str() << endl;
throw UniSetTypes::SystemError(err.str());
}
......@@ -240,7 +255,7 @@ namespace UniSetTypes
if( !it )
{
ucrit << "(Configuration:init): not found <ObjectsMap> node in " << fileConfName << endl;
throw SystemError("(Configuration:init): not found <ObjectsMap> node in " + fileConfName );
throw UniSetTypes::SystemError("(Configuration:init): not found <ObjectsMap> node in " + fileConfName );
}
try
......@@ -258,7 +273,7 @@ namespace UniSetTypes
}
catch( const UniSetTypes::Exception& ex )
{
ucrit << "(Configuration:init): INIT FAILED! from " << fileConfName << endl;
ucrit << ex << endl;
throw;
}
}
......@@ -516,7 +531,7 @@ namespace UniSetTypes
if( !root )
{
ucrit << "Configuration: INIT PARAM`s FAILED! <UniSet>...</UniSet> not found" << endl;
throw Exception("Configuration: INIT PARAM`s FAILED! <UniSet>...</UniSet> not found!");
throw UniSetTypes::SystemError("Configuration: INIT PARAM`s FAILED! <UniSet>...</UniSet> not found!");
}
UniXML::iterator it(root);
......@@ -524,7 +539,7 @@ namespace UniSetTypes
if( !it.goChildren() )
{
ucrit << "Configuration: INIT PARAM`s FAILED!!!!" << endl;
throw Exception("Configuration: INIT PARAM`s FAILED!!!!");
throw UniSetTypes::SystemError("Configuration: INIT PARAM`s FAILED!!!!");
}
for( ; it.getCurrent(); it.goNext() )
......@@ -551,7 +566,7 @@ namespace UniSetTypes
ostringstream msg;
msg << "Configuration: DBServer '" << secDB << "' not found ServiceID in <services>!";
ucrit << msg.str() << endl;
throw Exception(msg.str());
throw UniSetTypes::SystemError(msg.str());
}
}
else if( name == "CountOfNet" )
......@@ -637,7 +652,7 @@ namespace UniSetTypes
stringstream err;
err << "(Configuration::setLocalNode): Not found node '" << nodename << "'";
ucrit << err.str() << endl;
throw Exception(err.str());
throw UniSetTypes::SystemError(err.str());
}
localNodeName = nodename;
......@@ -762,7 +777,7 @@ namespace UniSetTypes
if( !omapnode )
{
ucrit << "(Configuration): <ObjectsMap> not found!!!" << endl;
throw Exception("(Configuration): <ObjectsMap> not found!");
throw UniSetTypes::SystemError("(Configuration): <ObjectsMap> not found!");
}
......@@ -771,7 +786,7 @@ namespace UniSetTypes
if(!node)
{
ucrit << "(Configuration): <nodes> section not found!" << endl;
throw Exception("(Configiuration): <nodes> section not found");
throw UniSetTypes::SystemError("(Configiuration): <nodes> section not found");
}
UniXML::iterator it(node);
......@@ -789,7 +804,7 @@ namespace UniSetTypes
if(sname.empty())
{
ucrit << "Configuration(createNodesList): unknown name='' in <nodes> " << endl;
throw Exception("Configuration(createNodesList: unknown name='' in <nodes>");
throw UniSetTypes::SystemError("Configuration(createNodesList: unknown name='' in <nodes>");
}
string nodename(sname);
......@@ -803,7 +818,7 @@ namespace UniSetTypes
if( ninf.id == DefaultObjectId )
{
ucrit << "Configuration(createNodesList): Not found ID for node '" << nodename << "'" << endl;
throw Exception("Configuration(createNodesList): Not found ID for node '" + nodename + "'");
throw UniSetTypes::SystemError("Configuration(createNodesList): Not found ID for node '" + nodename + "'");
}
ninf.host = getProp(it, "ip").c_str();
......@@ -826,7 +841,7 @@ namespace UniSetTypes
if( ninf.dbserver == DefaultObjectId )
{
ucrit << "Configuration(createNodesList): Not found ID for DBServer name='" << dname << "'" << endl;
throw Exception("Configuration(createNodesList: Not found ID for DBServer name='" + dname + "'");
throw UniSetTypes::SystemError("Configuration(createNodesList: Not found ID for DBServer name='" + dname + "'");
}
}
......@@ -1007,7 +1022,7 @@ namespace UniSetTypes
ostringstream msg;
msg << "Configuration(initRepSections): Not found section <RootSection> in " << fileConfName;
ucrit << msg.str() << endl;
throw SystemError(msg.str());
throw UniSetTypes::SystemError(msg.str());
}
secRoot = unixml->getProp(node, "name");
......@@ -1028,7 +1043,7 @@ namespace UniSetTypes
ostringstream msg;
msg << "Configuration(initRepSections): Not found section '" << sec << "' in " << fileConfName;
ucrit << msg.str() << endl;
throw SystemError(msg.str());
throw UniSetTypes::SystemError(msg.str());
}
string ret(unixml->getProp(secnode, "section"));
......@@ -1068,7 +1083,7 @@ namespace UniSetTypes
<< " Use --confile filename " << endl
<< " OR define enviropment variable UNISET_CONFILE" << endl;
ucrit << msg.str();
throw SystemError(msg.str());
throw UniSetTypes::SystemError(msg.str());
}
}
// -------------------------------------------------------------------------
......@@ -1306,15 +1321,16 @@ namespace UniSetTypes
return UniSetTypes::uconf;
}
// инициализация исключений для libcommoncpp
// ost::Thread::setException(ost::Thread::throwException);
atexit( UniSetActivator::normalexit );
set_terminate( UniSetActivator::normalterminate ); // ловушка для неизвестных исключений
string confile = UniSetTypes::getArgParam( "--confile", argc, argv, xmlfile );
UniSetTypes::uconf = make_shared<Configuration>(argc, argv, confile);
return UniSetTypes::uconf;
}
// -------------------------------------------------------------------------
// -------------------------------------------------------------------------
} // end of UniSetTypes namespace
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