Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
U
uniset2
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
1
Issues
1
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
UniSet project repositories
uniset2
Commits
cd99adbe
Commit
cd99adbe
authored
Aug 02, 2009
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restore comments and strings (was broken since initial commit in git)
parent
8fa15ce5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
58 deletions
+57
-58
Configuration.cc
src/Various/Configuration.cc
+57
-58
No files found.
src/Various/Configuration.cc
View file @
cd99adbe
...
...
@@ -18,7 +18,7 @@
*/
// --------------------------------------------------------------------------
/*! \file
* \brief
????? ?????? ? ?????????????
* \brief
* \author Vitaly Lipatov, Pavel Vainerman
* \date $Date: 2008/09/16 19:02:46 $
* \version $Id: Configuration.cc,v 1.41 2008/09/16 19:02:46 vpashka Exp $
...
...
@@ -51,8 +51,8 @@ static const string UniSetDefaultPort = "2809";
static
ostream
&
print_help
(
ostream
&
os
,
int
width
,
const
string
cmd
,
const
string
help
,
const
string
tab
=
""
)
{
//
????? ?? ??????? ????????? ????????? ??????
//
??????? ????
stream...
//
//
stream...
ostringstream
info
;
info
.
setf
(
ios
::
left
,
ios
::
adjustfield
);
info
<<
tab
<<
setw
(
width
)
<<
cmd
<<
" - "
<<
help
;
...
...
@@ -62,18 +62,18 @@ static ostream& print_help( ostream& os, int width, const string cmd,
ostream
&
UniSetTypes
::
Configuration
::
help
(
ostream
&
os
)
{
os
<<
"
\n
UniSet Configure command: "
<<
endl
;
print_help
(
os
,
20
,
"--confile"
,
"
?????? ???? ?? ????? ????????????
\n
"
);
print_help
(
os
,
20
,
"--confile"
,
"
\n
"
);
os
<<
"
\n
Debug command:
\n
"
;
print_help
(
os
,
25
,
" [debname]"
,
"
??? DebugStream ????????? ? ???????????????? ?????
\n
"
);
print_help
(
os
,
25
,
"--[debname]-no-debug"
,
"
?????????? ?????
\n
"
);
print_help
(
os
,
25
,
"--[debname]-log-in-file"
,
"
??????????????? ???? ? ????
\n
"
);
print_help
(
os
,
25
,
"--[debname]-add-levels"
,
"
???????? ??????? ?????? ?????
\n
"
);
print_help
(
os
,
25
,
"--[debname]-del-levels"
,
"
??????? ??????? ?????? ?????
\n
"
);
print_help
(
os
,
25
,
"--uniport num"
,
"
???????????? ???????? ???? (??????????????? 'defaultport' ???????? ? ????. ????? ? ???????
<nodes>)
\n
"
);
print_help
(
os
,
25
,
"--localIOR {1,0}"
,
"
???????????? ????????? ????? ??? ????????? IOR (?.?. ?? ???????????? omniNames). ?????????????? ???????? ? ???????????????? ?????
.
\n
"
);
print_help
(
os
,
25
,
"--transientIOR {1,0}"
,
"
???????????? ???????????? IOR(?? ??????????). ?????????????? ???????? ? ???????????????? ?????
. Default=1
\n
"
);
print_help
(
os
,
25
,
" [debname]"
,
"
DebugStream
\n
"
);
print_help
(
os
,
25
,
"--[debname]-no-debug"
,
"
\n
"
);
print_help
(
os
,
25
,
"--[debname]-log-in-file"
,
"
\n
"
);
print_help
(
os
,
25
,
"--[debname]-add-levels"
,
"
\n
"
);
print_help
(
os
,
25
,
"--[debname]-del-levels"
,
"
\n
"
);
print_help
(
os
,
25
,
"--uniport num"
,
"
( 'defaultport' .
<nodes>)
\n
"
);
print_help
(
os
,
25
,
"--localIOR {1,0}"
,
"
IOR (.. omniNames).
.
\n
"
);
print_help
(
os
,
25
,
"--transientIOR {1,0}"
,
"
IOR( ).
. Default=1
\n
"
);
return
os
<<
"
\n
?????? ?????????????
:
\t
myUniSetProgram "
return
os
<<
"
\n
:
\t
myUniSetProgram "
<<
"--unideb-add-levels level1,info,system,warn --unideb-log-in-file myprogrpam.log
\n\n
"
;
}
// -------------------------------------------------------------------------
...
...
@@ -254,7 +254,7 @@ void Configuration::initConfiguration( int argc, char** argv )
}
}
//
??????????? ?????????? ????
//
initDebug
(
unideb
,
"UniSetDebug"
);
// cerr << "*************** initConfiguration: oind: " << pt.getCurrent() << " msec " << endl;
...
...
@@ -295,19 +295,19 @@ void Configuration::initConfiguration( int argc, char** argv )
// cerr << "*************** initConfiguration: parameters...: " << pt.getCurrent() << " msec " << endl;
// pt.reset();
//
????????? ?????? ?????
//
createNodesList
();
// ---------------------------------------------------------------------------------
//
????????? ????? ????????? ?
argv
//
??? ???????? ?????????? orb ?? ?????? ?????
//
??????? ??
configure.xml
//
argv
//
orb
//
configure.xml
// +N --> -ORBIniRef NodeName=
// +2 --> -ORBIniRef NameService=
_argc
=
argc
+
2
*
lnodes
.
size
()
+
2
;
_argv
=
new
char
*
[
_argc
];
//
?????????? ?????? ?????????
//
int
i
=
0
;
for
(
;
i
<
argc
;
i
++
)
{
...
...
@@ -315,7 +315,7 @@ void Configuration::initConfiguration( int argc, char** argv )
strcpy
(
_argv
[
i
],
argv
[
i
]);
}
//
????????? ?????
//
for
(
UniSetTypes
::
ListOfNode
::
iterator
it
=
lnodes
.
begin
();
it
!=
lnodes
.
end
();
++
it
)
{
_argv
[
i
]
=
"-ORBInitRef"
;
...
...
@@ -327,7 +327,7 @@ void Configuration::initConfiguration( int argc, char** argv )
strcpy
(
_argv
[
i
+
1
],
param
.
str
().
c_str
());
if
(
unideb
.
debugging
(
Debug
::
INFO
)
)
unideb
[
Debug
::
INFO
]
<<
"(Configuration):
?????? ????????
"
<<
param
.
str
()
<<
endl
;
unideb
[
Debug
::
INFO
]
<<
"(Configuration):
"
<<
param
.
str
()
<<
endl
;
i
+=
2
;
assert
(
i
<
_argc
);
}
...
...
@@ -336,7 +336,7 @@ void Configuration::initConfiguration( int argc, char** argv )
xmlNode
*
nsnode
=
getNode
(
"NameService"
);
if
(
!
nsnode
)
{
unideb
[
Debug
::
WARN
]
<<
"(Configuration):
?? ????? ???????
'NameService'
\n
"
;
unideb
[
Debug
::
WARN
]
<<
"(Configuration):
'NameService'
\n
"
;
_argv
[
i
]
=
""
;
_argv
[
i
+
1
]
=
""
;
}
...
...
@@ -344,8 +344,8 @@ void Configuration::initConfiguration( int argc, char** argv )
{
_argv
[
i
]
=
"-ORBInitRef"
;
_argv
[
i
+
1
]
=
""
;
//
?????? ????????????? ?????? ??????? (?.?. ????? ??????????
getArgParam)
string
defPort
(
getPort
()
);
//
????? ?????????? getArgParam! ?????????? ??
_argv
_argv
[
i
+
1
]
=
""
;
//
(..
getArgParam)
string
defPort
(
getPort
()
);
//
getArgParam!
_argv
if
(
defPort
==
UniSetDefaultPort
)
defPort
=
getProp
(
nsnode
,
"port"
);
...
...
@@ -355,12 +355,12 @@ void Configuration::initConfiguration( int argc, char** argv )
ostringstream
param
;
param
<<
"NameService=corbaname::"
<<
getProp
(
nsnode
,
"host"
)
<<
":"
<<
defPort
;
//
?????? ???? ???????? ????? ??? ??????
//
_argv
[
i
+
1
]
=
new
char
[
param
.
str
().
size
()
+
1
];
// +1 - \0
//
?????? ???????????
//
strcpy
(
_argv
[
i
+
1
],
param
.
str
().
c_str
());
if
(
unideb
.
debugging
(
Debug
::
INFO
)
)
unideb
[
Debug
::
INFO
]
<<
"(Configuration):
?????? ????????
"
<<
param
.
str
()
<<
endl
;
unideb
[
Debug
::
INFO
]
<<
"(Configuration):
"
<<
param
.
str
()
<<
endl
;
}
// ------------- CORBA INIT -------------
...
...
@@ -596,28 +596,28 @@ void Configuration::createNodesList()
xmlNode
*
omapnode
=
unixml
.
findNode
(
unixml
.
getFirstNode
(),
"ObjectsMap"
);
if
(
!
omapnode
)
{
unideb
[
Debug
::
CRIT
]
<<
"(Configuration):
?? ????? ???????
ObjectsMap..."
<<
endl
;
throw
Exception
(
"configiuration:
?? ????? ???????
ObjectsMap"
);
unideb
[
Debug
::
CRIT
]
<<
"(Configuration):
ObjectsMap..."
<<
endl
;
throw
Exception
(
"configiuration:
ObjectsMap"
);
}
xmlNode
*
node
=
unixml
.
findNode
(
omapnode
,
"nodes"
);
if
(
!
node
)
{
unideb
[
Debug
::
CRIT
]
<<
"(Configuration):
?? ????? ???????
ObjectsMap/nodes..."
<<
endl
;
throw
Exception
(
"configiuration:
?? ????? ???????
ObjectsMap/nodes"
);
unideb
[
Debug
::
CRIT
]
<<
"(Configuration):
ObjectsMap/nodes..."
<<
endl
;
throw
Exception
(
"configiuration:
ObjectsMap/nodes"
);
}
UniXML_iterator
it
(
node
);
it
.
goChildren
();
//
?????????? ????
//
string
defPort
(
getPort
());
if
(
defPort
==
UniSetDefaultPort
)
defPort
=
unixml
.
getProp
(
node
,
"port"
);
//
????? ?????
.
//
.
if
(
defPort
.
empty
()
)
defPort
=
UniSetDefaultPort
;
...
...
@@ -627,8 +627,8 @@ void Configuration::createNodesList()
string
sname
(
getProp
(
it
,
"name"
));
if
(
sname
.
empty
())
{
unideb
[
Debug
::
CRIT
]
<<
"Configuration(createNodesList):
?? ?????? ??? ????
"
<<
endl
;
throw
Exception
(
"Configuration(createNodesList:
? ?????? ????? ?? ?????? ???
!"
);
unideb
[
Debug
::
CRIT
]
<<
"Configuration(createNodesList):
"
<<
endl
;
throw
Exception
(
"Configuration(createNodesList:
!"
);
// continue;
}
...
...
@@ -638,12 +638,12 @@ void Configuration::createNodesList()
nodename
=
oind
->
mkFullNodeName
(
nodename
,
nodename
);
NodeInfo
ninf
;
// unideb[Debug::INFO] << "Configuration(createNodesList):
?????? ????
" << nodename << endl;
// unideb[Debug::INFO] << "Configuration(createNodesList):
" << nodename << endl;
ninf
.
id
=
oind
->
getIdByName
(
nodename
);
if
(
ninf
.
id
==
DefaultObjectId
)
{
unideb
[
Debug
::
CRIT
]
<<
"Configuration(createNodesList): node '"
<<
nodename
<<
"'
?? ?????? ?????????????
ObjectsMap!!!"
<<
endl
;
throw
Exception
(
"Configuration(createNodesList): node "
+
nodename
+
"
?? ?????? ?????????????
ObjectsMap!!!"
);
unideb
[
Debug
::
CRIT
]
<<
"Configuration(createNodesList): node '"
<<
nodename
<<
"'
ObjectsMap!!!"
<<
endl
;
throw
Exception
(
"Configuration(createNodesList): node "
+
nodename
+
"
ObjectsMap!!!"
);
// continue;
}
...
...
@@ -663,8 +663,8 @@ void Configuration::createNodesList()
ninf
.
infserver
=
oind
->
getIdByName
(
iname
);
if
(
ninf
.
infserver
==
DefaultObjectId
)
{
unideb
[
Debug
::
CRIT
]
<<
"Configuration(createNodesList): InfoServre '"
<<
iname
<<
"'
?? ?????? ?????????????
ObjectsMap!!!"
<<
endl
;
throw
Exception
(
"Configuration(createNodesList: InfoServer "
+
iname
+
"
?? ?????? ?????????????
ObjectsMap!!!"
);
unideb
[
Debug
::
CRIT
]
<<
"Configuration(createNodesList): InfoServre '"
<<
iname
<<
"'
ObjectsMap!!!"
<<
endl
;
throw
Exception
(
"Configuration(createNodesList: InfoServer "
+
iname
+
"
ObjectsMap!!!"
);
}
}
...
...
@@ -694,12 +694,12 @@ void Configuration::createNodesList()
initNode
(
ninf
,
it
);
if
(
unideb
.
debugging
(
Debug
::
INFO
)
)
unideb
[
Debug
::
INFO
]
<<
"Configuration(createNodesList):
????????? ? ?????? ????
name: "
<<
nodename
<<
" id="
<<
ninf
.
id
<<
endl
;
unideb
[
Debug
::
INFO
]
<<
"Configuration(createNodesList):
name: "
<<
nodename
<<
" id="
<<
ninf
.
id
<<
endl
;
lnodes
.
push_back
(
ninf
);
}
if
(
unideb
.
debugging
(
Debug
::
INFO
)
)
unideb
[
Debug
::
INFO
]
<<
"Configuration(createNodesList):
???? ???? ??????
"
<<
lnodes
.
size
()
<<
endl
;
unideb
[
Debug
::
INFO
]
<<
"Configuration(createNodesList):
"
<<
lnodes
.
size
()
<<
endl
;
}
// -------------------------------------------------------------------------
void
Configuration
::
initNode
(
UniSetTypes
::
NodeInfo
&
ninfo
,
UniXML_iterator
&
it
)
...
...
@@ -723,7 +723,7 @@ xmlNode* Configuration::initDebug( DebugStream& deb, const string& _debname )
{
if
(
_debname
.
empty
()
)
{
deb
<<
"(Configuration)(initDebug): INIT DEBUG FAILED!!!
?? ?????? ??????? ????
\n
"
;
deb
<<
"(Configuration)(initDebug): INIT DEBUG FAILED!!!
\n
"
;
return
0
;
}
...
...
@@ -732,8 +732,8 @@ xmlNode* Configuration::initDebug( DebugStream& deb, const string& _debname )
xmlNode
*
dnode
=
conf
->
getNode
(
_debname
);
if
(
!
dnode
)
{
deb
<<
"(Configuration)(initDebug): WARNING!
?? ????? ???????
"
<<
_debname
<<
endl
;
//
????? ???????, ??? ?????? ???????? ??????
DebugStream
deb
<<
"(Configuration)(initDebug): WARNING!
"
<<
_debname
<<
endl
;
//
,
DebugStream
}
else
{
...
...
@@ -751,7 +751,7 @@ xmlNode* Configuration::initDebug( DebugStream& deb, const string& _debname )
}
}
//
??????? ????????? ?????
//
if
(
dnode
)
{
string
conf_debug_levels
(
getProp
(
dnode
,
"levels"
));
...
...
@@ -765,12 +765,12 @@ xmlNode* Configuration::initDebug( DebugStream& deb, const string& _debname )
deb
.
logFile
(
debug_file
.
c_str
());
}
//
?????? ??????? ????????? ??????
//
string
log_in
(
"--"
+
debname
+
"-log-in-file"
);
string
add_level
(
"--"
+
debname
+
"-add-levels"
);
string
del_level
(
"--"
+
debname
+
"-del-levels"
);
//
??????? ????????? ??????
//
for
(
int
i
=
1
;
i
<
_argc
;
i
++
)
{
if
(
!
strcmp
(
_argv
[
i
],
log_in
.
c_str
())
)
// "--debug-log_in_file"
...
...
@@ -801,12 +801,12 @@ xmlNode* Configuration::initDebug( DebugStream& deb, const string& _debname )
// -------------------------------------------------------------------------
void
Configuration
::
initRepSections
()
{
//
?????????? ??? ??????? ????????? ???????????
//
֣
xmlNode
*
node
(
unixml
.
findNode
(
unixml
.
getFirstNode
(),
"RootSection"
)
);
if
(
node
==
0
)
{
ostringstream
msg
;
msg
<<
"Configuration(initRepSections):
?? ????? ???????? RootSection ? ????. ?????
"
<<
fileConfName
;
msg
<<
"Configuration(initRepSections):
RootSection .
"
<<
fileConfName
;
unideb
[
Debug
::
CRIT
]
<<
msg
.
str
()
<<
endl
;
throw
SystemError
(
msg
.
str
());
}
...
...
@@ -824,12 +824,11 @@ string Configuration::getRepSectionName( const string sec, xmlNode* secnode )
if
(
node
==
0
)
{
ostringstream
msg
;
msg
<<
"Configuration(initRepSections):
?? ????? ?????? "
<<
sec
<<
" ? ????. ?????
"
<<
fileConfName
;
msg
<<
"Configuration(initRepSections):
"
<<
sec
<<
" .
"
<<
fileConfName
;
unideb
[
Debug
::
CRIT
]
<<
msg
.
str
()
<<
endl
;
throw
SystemError
(
msg
.
str
());
}
// ?????? ?????????????? ?????????? ??????????
secnode
=
node
;
string
ret
(
unixml
.
getProp
(
node
,
"section"
));
...
...
@@ -847,8 +846,8 @@ void Configuration::setConfFileName( const string fn )
return
;
}
//
??????????? ????????????????? ?????
//
? ??????? ???????? ??????????
//
//
string
tmp
(
getArgParam
(
"--confile"
)
);
if
(
!
tmp
.
empty
()
)
...
...
@@ -863,10 +862,10 @@ void Configuration::setConfFileName( const string fn )
if
(
fileConfName
.
empty
()
)
{
ostringstream
msg
;
msg
<<
"
\n\n
***** CRIT:
?? ????? ???????????????? ????
.
\n
"
<<
"
??????? ????
--confile
\n
"
<<
"
??? ?????????? ?????????? ?????????
UNISET_CONFILE
\n\n
"
;
// << "
??? ?????????? ???? ?
/etc/uniset-configure.xml \n\n";
msg
<<
"
\n\n
***** CRIT:
.
\n
"
<<
"
--confile
\n
"
<<
"
UNISET_CONFILE
\n\n
"
;
// << "
/etc/uniset-configure.xml \n\n";
unideb
[
Debug
::
CRIT
]
<<
msg
.
str
();
throw
SystemError
(
msg
.
str
());
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment