Commit 9260798b authored by Pavel Vainerman's avatar Pavel Vainerman

Тестовая сборка с включённым REST API

parent 1caef6f9
...@@ -10,13 +10,13 @@ ...@@ -10,13 +10,13 @@
%def_disable tests %def_disable tests
%def_disable mqtt %def_disable mqtt
%def_disable netdata %def_disable netdata
%def_disable api %def_enable api
%define oname uniset2 %define oname uniset2
Name: libuniset2 Name: libuniset2
Version: 2.6 Version: 2.6
Release: alt3.1 Release: alt3.2
Summary: UniSet - library for building distributed industrial control systems Summary: UniSet - library for building distributed industrial control systems
License: LGPL License: LGPL
...@@ -505,10 +505,18 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname ...@@ -505,10 +505,18 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
%exclude %_pkgconfigdir/libUniSet2.pc %exclude %_pkgconfigdir/libUniSet2.pc
# history of current unpublished changes # history of current unpublished changes
# - getChangedTime --> getTimeChange
# - getInfo( long param ) --> getInfo( string param )
# - IDL Interface: added new function: string apiRequest( string query )
# - getInfo() deprecated..
%changelog
* Sat Dec 03 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt3.2
- getChangedTime --> getTimeChange - getChangedTime --> getTimeChange
- getInfo( long param ) --> getInfo( string param ) - getInfo( long param ) --> getInfo( string param )
- IDL Interface: added new function: string apiRequest( string query )
/ ..getInfo() deprecated now.. /
%changelog
* Tue Nov 22 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt3.1 * Tue Nov 22 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt3.1
- CommonEventLoop: refactoring prepare process (part. 2) - CommonEventLoop: refactoring prepare process (part. 2)
...@@ -534,7 +542,6 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname ...@@ -534,7 +542,6 @@ mv -f %buildroot%python_sitelibdir_noarch/* %buildroot%python_sitelibdir/%oname
* Fri Nov 18 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt1.1 * Fri Nov 18 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt1.1
- add try/catch for run log server - add try/catch for run log server
>>>>>>> (codegen): Сделал activate-timeout по умолчанию 30 сек (было 10),
* Fri Nov 11 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt1 * Fri Nov 11 2016 Pavel Vainerman <pv@altlinux.ru> 2.6-alt1
- build new version - build new version
......
/*
* Copyright (c) 2015 Pavel Vainerman.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 2.1.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Lesser Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// --------------------------------------------------------------------------
#ifndef jsonHelpers_H_
#define jsonHelpers_H_
// --------------------------------------------------------------------------
#include <Poco/JSON/Object.h>
// --------------------------------------------------------------------------
namespace uniset
{
namespace json
{
Poco::JSON::Object::Ptr make_object( const std::string& key, const Poco::Dynamic::Var& val );
Poco::JSON::Object::Ptr make_object( const std::string& key, const Poco::Dynamic::Var&& val );
Poco::JSON::Object::Ptr make_child( Poco::JSON::Object::Ptr& root, const std::string& key );
Poco::JSON::Array::Ptr make_child_array( Poco::JSON::Object::Ptr& root, const std::string& key );
namespace help
{
class item
{
public:
item( Poco::JSON::Object::Ptr& ptr );
item( const std::string& description );
void param(const std::string& name, const std::string& description );
Poco::JSON::Object::Ptr get();
operator Poco::JSON::Object::Ptr();
operator Poco::Dynamic::Var();
private:
Poco::JSON::Object::Ptr root;
Poco::JSON::Array::Ptr params;
};
class object
{
public:
object( const std::string& name );
object( const std::string& name, Poco::JSON::Object::Ptr ptr );
void add( item& i );
Poco::JSON::Object::Ptr get();
operator Poco::JSON::Object::Ptr();
operator Poco::Dynamic::Var();
private:
Poco::JSON::Object::Ptr root;
Poco::JSON::Array::Ptr cmdlist;
};
} // end of namespace help
} // end of namespace json
// --------------------------------------------------------------------------
} // end of namespace uniset
// --------------------------------------------------------------------------
#endif // end of _jsonHelpers_H_
...@@ -805,7 +805,7 @@ uniset::SimpleInfo* UniSetObject::getInfo( const char* userparam ) ...@@ -805,7 +805,7 @@ uniset::SimpleInfo* UniSetObject::getInfo( const char* userparam )
SimpleInfo* UniSetObject::apiRequest( const char* request ) SimpleInfo* UniSetObject::apiRequest( const char* request )
{ {
#ifdef DISABLE_REST_API #ifdef DISABLE_REST_API
return getInfo(query); return getInfo(request);
#else #else
SimpleInfo* ret = new SimpleInfo(); SimpleInfo* ret = new SimpleInfo();
ostringstream err; ostringstream err;
......
/*
* Copyright (c) 2015 Pavel Vainerman.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, version 2.1.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Lesser Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// --------------------------------------------------------------------------
#include "ujson.h"
// --------------------------------------------------------------------------
namespace uniset
{
// --------------------------------------------------------------------------
Poco::JSON::Object::Ptr json::make_object( const std::string& key, const Poco::Dynamic::Var& val )
{
Poco::JSON::Object::Ptr j = new Poco::JSON::Object();
j->set(key, val);
return j;
}
// --------------------------------------------------------------------------
Poco::JSON::Object::Ptr json::make_object( const std::string& key, const Poco::Dynamic::Var&& val )
{
Poco::JSON::Object::Ptr j = new Poco::JSON::Object();
j->set(key, std::move(val));
return j;
}
// --------------------------------------------------------------------------
json::help::item::item( Poco::JSON::Object::Ptr& ptr )
{
root = ptr;
params = ptr->getArray("parameters");
}
// --------------------------------------------------------------------------
json::help::item::item(const std::__cxx11::string& description)
{
root = new Poco::JSON::Object();
root->set("description", description);
}
// --------------------------------------------------------------------------
void json::help::item::param(const std::__cxx11::string& name, const std::__cxx11::string& description)
{
if( !params )
{
params = new Poco::JSON::Array();
root->set("parameters", params);
}
params->add( uniset::json::make_object(name, description) );
}
// --------------------------------------------------------------------------
Poco::JSON::Object::Ptr json::help::item::get()
{
return root;
}
// --------------------------------------------------------------------------
uniset::json::help::item::operator Poco::Dynamic::Var()
{
return root;
}
// --------------------------------------------------------------------------
uniset::json::help::item::operator Poco::JSON::Object::Ptr()
{
return root;
}
// --------------------------------------------------------------------------
json::help::object::object( const std::string& name )
{
root = new Poco::JSON::Object();
cmdlist = new Poco::JSON::Array();
root->set(name, cmdlist);
}
// --------------------------------------------------------------------------
json::help::object::object(const std::string& name, Poco::JSON::Object::Ptr ptr )
{
root = ptr;
cmdlist = root->getArray(name);
if( !cmdlist )
{
cmdlist = new Poco::JSON::Array();
root->set(name, cmdlist);
}
}
// --------------------------------------------------------------------------
void json::help::object::add(json::help::item& i)
{
cmdlist->add(i);
}
// --------------------------------------------------------------------------
Poco::JSON::Object::Ptr json::help::object::get()
{
return root;
}
// --------------------------------------------------------------------------
uniset::json::help::object::operator Poco::Dynamic::Var()
{
return root;
}
// --------------------------------------------------------------------------
uniset::json::help::object::operator Poco::JSON::Object::Ptr()
{
return root;
}
// --------------------------------------------------------------------------
Poco::JSON::Object::Ptr json::make_child( Poco::JSON::Object::Ptr& root, const std::__cxx11::string& key )
{
Poco::JSON::Object::Ptr child = new Poco::JSON::Object();
root->set(key, child);
return child;
}
// --------------------------------------------------------------------------
Poco::JSON::Array::Ptr json::make_child_array(Poco::JSON::Object::Ptr& root, const std::__cxx11::string& key)
{
Poco::JSON::Array::Ptr child = new Poco::JSON::Array();
root->set(key, child);
return child;
}
// --------------------------------------------------------------------------
// --------------------------------------------------------------------------
} // end of namespace uniset
// --------------------------------------------------------------------------
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