2012-05-10 12:06:41 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* Icinga 2 *
|
2014-03-19 01:02:29 +01:00
|
|
|
* Copyright (C) 2012-2014 Icinga Development Team (http://www.icinga.org) *
|
2012-05-10 12:06:41 +02:00
|
|
|
* *
|
|
|
|
* This program is free software; you can redistribute it and/or *
|
|
|
|
* modify it under the terms of the GNU General Public License *
|
|
|
|
* as published by the Free Software Foundation; either version 2 *
|
|
|
|
* of the License, or (at your option) any later version. *
|
|
|
|
* *
|
|
|
|
* 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 General Public License for more details. *
|
|
|
|
* *
|
|
|
|
* You should have received a copy of the GNU General Public License *
|
|
|
|
* along with this program; if not, write to the Free Software Foundation *
|
2012-05-11 13:33:57 +02:00
|
|
|
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. *
|
2012-05-10 12:06:41 +02:00
|
|
|
******************************************************************************/
|
|
|
|
|
2014-05-25 16:23:35 +02:00
|
|
|
#include "base/dynamicobject.hpp"
|
|
|
|
#include "base/dynamictype.hpp"
|
|
|
|
#include "base/serializer.hpp"
|
|
|
|
#include "base/netstring.hpp"
|
2014-10-26 19:59:49 +01:00
|
|
|
#include "base/json.hpp"
|
2014-05-25 16:23:35 +02:00
|
|
|
#include "base/stdiostream.hpp"
|
|
|
|
#include "base/debug.hpp"
|
|
|
|
#include "base/objectlock.hpp"
|
2014-10-19 14:21:12 +02:00
|
|
|
#include "base/logger.hpp"
|
2014-05-25 16:23:35 +02:00
|
|
|
#include "base/exception.hpp"
|
|
|
|
#include "base/scriptfunction.hpp"
|
|
|
|
#include "base/initialize.hpp"
|
|
|
|
#include "base/scriptvariable.hpp"
|
|
|
|
#include "base/workqueue.hpp"
|
2014-10-30 13:04:00 +01:00
|
|
|
#include "base/context.hpp"
|
2013-03-16 21:18:53 +01:00
|
|
|
#include <fstream>
|
|
|
|
#include <boost/foreach.hpp>
|
2013-03-18 17:04:22 +01:00
|
|
|
#include <boost/exception/errinfo_api_function.hpp>
|
|
|
|
#include <boost/exception/errinfo_errno.hpp>
|
|
|
|
#include <boost/exception/errinfo_file_name.hpp>
|
2012-03-31 15:18:09 +02:00
|
|
|
|
|
|
|
using namespace icinga;
|
|
|
|
|
2013-11-08 16:07:21 +01:00
|
|
|
REGISTER_TYPE(DynamicObject);
|
2013-11-08 11:17:46 +01:00
|
|
|
|
2013-08-20 11:06:04 +02:00
|
|
|
boost::signals2::signal<void (const DynamicObject::Ptr&)> DynamicObject::OnStarted;
|
|
|
|
boost::signals2::signal<void (const DynamicObject::Ptr&)> DynamicObject::OnStopped;
|
2014-05-09 11:32:24 +02:00
|
|
|
boost::signals2::signal<void (const DynamicObject::Ptr&)> DynamicObject::OnPaused;
|
|
|
|
boost::signals2::signal<void (const DynamicObject::Ptr&)> DynamicObject::OnResumed;
|
2014-05-03 20:02:22 +02:00
|
|
|
boost::signals2::signal<void (const DynamicObject::Ptr&)> DynamicObject::OnStateChanged;
|
2012-08-02 09:38:08 +02:00
|
|
|
|
2013-08-20 11:06:04 +02:00
|
|
|
DynamicObject::DynamicObject(void)
|
2013-10-26 09:41:45 +02:00
|
|
|
{ }
|
2012-04-20 14:20:25 +02:00
|
|
|
|
2012-12-04 08:42:24 +01:00
|
|
|
DynamicType::Ptr DynamicObject::GetType(void) const
|
2012-08-02 09:38:08 +02:00
|
|
|
{
|
2013-10-26 09:41:45 +02:00
|
|
|
return DynamicType::GetByName(GetTypeName());
|
2012-08-02 09:38:08 +02:00
|
|
|
}
|
|
|
|
|
2014-09-09 14:49:21 +02:00
|
|
|
DebugInfo DynamicObject::GetDebugInfo(void) const
|
|
|
|
{
|
|
|
|
return m_DebugInfo;
|
|
|
|
}
|
|
|
|
|
|
|
|
void DynamicObject::SetDebugInfo(const DebugInfo& di)
|
|
|
|
{
|
|
|
|
m_DebugInfo = di;
|
|
|
|
}
|
|
|
|
|
2013-08-20 11:06:04 +02:00
|
|
|
bool DynamicObject::IsActive(void) const
|
2012-08-02 09:38:08 +02:00
|
|
|
{
|
2013-10-26 09:41:45 +02:00
|
|
|
return GetActive();
|
2013-09-12 10:03:48 +02:00
|
|
|
}
|
|
|
|
|
2014-05-09 11:32:24 +02:00
|
|
|
bool DynamicObject::IsPaused(void) const
|
|
|
|
{
|
|
|
|
return GetPaused();
|
|
|
|
}
|
|
|
|
|
2014-11-13 11:23:57 +01:00
|
|
|
void DynamicObject::SetExtension(const String& key, const Value& value)
|
2013-07-05 09:37:04 +02:00
|
|
|
{
|
2013-10-26 09:41:45 +02:00
|
|
|
Dictionary::Ptr extensions = GetExtensions();
|
2013-07-05 09:37:04 +02:00
|
|
|
|
|
|
|
if (!extensions) {
|
2014-11-08 21:17:16 +01:00
|
|
|
extensions = new Dictionary();
|
2013-10-26 09:41:45 +02:00
|
|
|
SetExtensions(extensions);
|
2013-07-05 09:37:04 +02:00
|
|
|
}
|
|
|
|
|
2014-11-13 11:23:57 +01:00
|
|
|
extensions->Set(key, value);
|
2013-07-05 09:37:04 +02:00
|
|
|
}
|
|
|
|
|
2014-11-13 11:23:57 +01:00
|
|
|
Value DynamicObject::GetExtension(const String& key)
|
2013-07-05 09:37:04 +02:00
|
|
|
{
|
2013-10-26 09:41:45 +02:00
|
|
|
Dictionary::Ptr extensions = GetExtensions();
|
2013-07-05 09:37:04 +02:00
|
|
|
|
|
|
|
if (!extensions)
|
2014-11-13 11:23:57 +01:00
|
|
|
return Empty;
|
2013-07-05 09:37:04 +02:00
|
|
|
|
|
|
|
return extensions->Get(key);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DynamicObject::ClearExtension(const String& key)
|
|
|
|
{
|
2013-10-26 09:41:45 +02:00
|
|
|
Dictionary::Ptr extensions = GetExtensions();
|
2013-07-05 09:37:04 +02:00
|
|
|
|
|
|
|
if (!extensions)
|
|
|
|
return;
|
|
|
|
|
|
|
|
extensions->Remove(key);
|
|
|
|
}
|
|
|
|
|
2012-08-02 09:38:08 +02:00
|
|
|
void DynamicObject::Register(void)
|
2012-03-31 15:18:09 +02:00
|
|
|
{
|
2013-03-07 16:00:10 +01:00
|
|
|
ASSERT(!OwnsLock());
|
2013-03-01 12:07:52 +01:00
|
|
|
|
2013-03-04 15:52:42 +01:00
|
|
|
DynamicType::Ptr dtype = GetType();
|
2014-11-08 21:17:16 +01:00
|
|
|
dtype->RegisterObject(this);
|
2013-02-27 12:44:51 +01:00
|
|
|
}
|
|
|
|
|
2012-09-28 10:39:28 +02:00
|
|
|
void DynamicObject::Start(void)
|
|
|
|
{
|
2013-03-07 16:00:10 +01:00
|
|
|
ASSERT(!OwnsLock());
|
2013-12-14 07:36:49 +01:00
|
|
|
ObjectLock olock(this);
|
2013-03-01 12:07:52 +01:00
|
|
|
|
2013-12-14 07:36:49 +01:00
|
|
|
SetStartCalled(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DynamicObject::Activate(void)
|
|
|
|
{
|
2014-10-30 13:04:00 +01:00
|
|
|
CONTEXT("Activating object '" + GetName() + "' of type '" + GetType()->GetName() + "'");
|
|
|
|
|
2013-12-14 07:36:49 +01:00
|
|
|
ASSERT(!OwnsLock());
|
|
|
|
|
|
|
|
Start();
|
|
|
|
|
|
|
|
ASSERT(GetStartCalled());
|
|
|
|
|
|
|
|
{
|
|
|
|
ObjectLock olock(this);
|
|
|
|
ASSERT(!IsActive());
|
|
|
|
SetActive(true);
|
|
|
|
}
|
2013-03-12 14:01:11 +01:00
|
|
|
|
2014-11-08 21:17:16 +01:00
|
|
|
OnStarted(this);
|
2014-05-09 13:02:30 +02:00
|
|
|
|
|
|
|
SetAuthority(true);
|
2013-03-12 14:01:11 +01:00
|
|
|
}
|
|
|
|
|
2013-08-20 11:06:04 +02:00
|
|
|
void DynamicObject::Stop(void)
|
2012-06-12 09:36:18 +02:00
|
|
|
{
|
2013-03-07 16:00:10 +01:00
|
|
|
ASSERT(!OwnsLock());
|
2013-12-14 07:36:49 +01:00
|
|
|
ObjectLock olock(this);
|
|
|
|
|
|
|
|
SetStopCalled(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DynamicObject::Deactivate(void)
|
|
|
|
{
|
2014-10-30 13:04:00 +01:00
|
|
|
CONTEXT("Deactivating object '" + GetName() + "' of type '" + GetType()->GetName() + "'");
|
|
|
|
|
2013-12-14 07:36:49 +01:00
|
|
|
ASSERT(!OwnsLock());
|
|
|
|
|
2014-05-09 13:02:30 +02:00
|
|
|
SetAuthority(false);
|
|
|
|
|
2013-12-14 07:36:49 +01:00
|
|
|
{
|
|
|
|
ObjectLock olock(this);
|
|
|
|
|
|
|
|
if (!IsActive())
|
|
|
|
return;
|
|
|
|
|
|
|
|
SetActive(false);
|
|
|
|
}
|
|
|
|
|
|
|
|
Stop();
|
2013-03-02 09:07:47 +01:00
|
|
|
|
2013-12-14 07:36:49 +01:00
|
|
|
ASSERT(GetStopCalled());
|
2012-06-12 09:36:18 +02:00
|
|
|
|
2014-11-08 21:17:16 +01:00
|
|
|
OnStopped(this);
|
2012-06-12 09:36:18 +02:00
|
|
|
}
|
|
|
|
|
2013-08-29 16:53:57 +02:00
|
|
|
void DynamicObject::OnConfigLoaded(void)
|
|
|
|
{
|
|
|
|
/* Nothing to do here. */
|
|
|
|
}
|
|
|
|
|
2014-11-21 18:31:37 +01:00
|
|
|
void DynamicObject::OnAllConfigLoaded(void)
|
|
|
|
{
|
|
|
|
/* Nothing to do here. */
|
|
|
|
}
|
|
|
|
|
2013-08-29 16:53:57 +02:00
|
|
|
void DynamicObject::OnStateLoaded(void)
|
|
|
|
{
|
|
|
|
/* Nothing to do here. */
|
|
|
|
}
|
|
|
|
|
2014-05-09 11:32:24 +02:00
|
|
|
void DynamicObject::Pause(void)
|
|
|
|
{
|
|
|
|
SetPauseCalled(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DynamicObject::Resume(void)
|
|
|
|
{
|
|
|
|
SetResumeCalled(true);
|
|
|
|
}
|
|
|
|
|
|
|
|
void DynamicObject::SetAuthority(bool authority)
|
|
|
|
{
|
|
|
|
if (authority && GetPaused()) {
|
|
|
|
SetResumeCalled(false);
|
|
|
|
Resume();
|
|
|
|
ASSERT(GetResumeCalled());
|
|
|
|
SetPaused(false);
|
2014-11-08 21:17:16 +01:00
|
|
|
OnResumed(this);
|
2014-05-09 11:32:24 +02:00
|
|
|
} else if (!authority && !GetPaused()) {
|
|
|
|
SetPauseCalled(false);
|
2014-05-09 13:02:30 +02:00
|
|
|
Pause();
|
2014-05-09 11:32:24 +02:00
|
|
|
ASSERT(GetPauseCalled());
|
|
|
|
SetPaused(true);
|
2014-11-08 21:17:16 +01:00
|
|
|
OnPaused(this);
|
2014-05-09 11:32:24 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-03-25 18:36:15 +01:00
|
|
|
Value DynamicObject::InvokeMethod(const String& method,
|
2013-03-16 21:18:53 +01:00
|
|
|
const std::vector<Value>& arguments)
|
2012-07-14 15:59:59 +02:00
|
|
|
{
|
2013-03-02 09:07:47 +01:00
|
|
|
Dictionary::Ptr methods;
|
2013-02-26 10:13:54 +01:00
|
|
|
|
2013-10-26 09:41:45 +02:00
|
|
|
methods = GetMethods();
|
2012-07-14 15:59:59 +02:00
|
|
|
|
2013-03-08 16:02:33 +01:00
|
|
|
if (!methods)
|
2013-03-25 18:36:15 +01:00
|
|
|
BOOST_THROW_EXCEPTION(std::invalid_argument("Method '" + method + "' does not exist."));
|
2013-03-08 16:02:33 +01:00
|
|
|
|
2014-04-02 09:04:17 +02:00
|
|
|
Value funcName = methods->Get(method);
|
2013-02-18 14:40:24 +01:00
|
|
|
|
2013-03-01 12:07:52 +01:00
|
|
|
if (funcName.IsEmpty())
|
2013-03-25 18:36:15 +01:00
|
|
|
BOOST_THROW_EXCEPTION(std::invalid_argument("Method '" + method + "' does not exist."));
|
2012-08-02 09:38:08 +02:00
|
|
|
|
2014-04-02 09:04:17 +02:00
|
|
|
ScriptFunction::Ptr func;
|
2012-07-14 15:59:59 +02:00
|
|
|
|
2014-04-02 09:04:17 +02:00
|
|
|
if (funcName.IsObjectType<ScriptFunction>()) {
|
|
|
|
func = funcName;
|
|
|
|
} else {
|
|
|
|
func = ScriptFunction::GetByName(funcName);
|
|
|
|
|
|
|
|
if (!func)
|
|
|
|
BOOST_THROW_EXCEPTION(std::invalid_argument("Function '" + String(funcName) + "' does not exist."));
|
|
|
|
}
|
2012-07-14 15:59:59 +02:00
|
|
|
|
2013-03-25 18:36:15 +01:00
|
|
|
return func->Invoke(arguments);
|
2012-07-14 15:59:59 +02:00
|
|
|
}
|
2012-07-24 13:13:02 +02:00
|
|
|
|
2013-08-20 11:06:04 +02:00
|
|
|
void DynamicObject::DumpObjects(const String& filename, int attributeTypes)
|
2012-07-24 13:13:02 +02:00
|
|
|
{
|
2014-10-19 17:52:17 +02:00
|
|
|
Log(LogInformation, "DynamicObject")
|
|
|
|
<< "Dumping program state to file '" << filename << "'";
|
2012-07-24 13:13:02 +02:00
|
|
|
|
2012-08-07 14:17:36 +02:00
|
|
|
String tempFilename = filename + ".tmp";
|
|
|
|
|
2013-03-16 21:18:53 +01:00
|
|
|
std::fstream fp;
|
2012-11-23 11:02:34 +01:00
|
|
|
fp.open(tempFilename.CStr(), std::ios_base::out);
|
2012-07-24 13:13:02 +02:00
|
|
|
|
|
|
|
if (!fp)
|
2014-06-26 14:16:37 +02:00
|
|
|
BOOST_THROW_EXCEPTION(std::runtime_error("Could not open '" + tempFilename + "' file"));
|
2012-07-24 13:13:02 +02:00
|
|
|
|
2014-11-08 21:17:16 +01:00
|
|
|
StdioStream::Ptr sfp = new StdioStream(&fp, false);
|
2012-07-24 13:13:02 +02:00
|
|
|
|
2013-02-18 23:44:24 +01:00
|
|
|
BOOST_FOREACH(const DynamicType::Ptr& type, DynamicType::GetTypes()) {
|
|
|
|
BOOST_FOREACH(const DynamicObject::Ptr& object, type->GetObjects()) {
|
2014-11-08 21:17:16 +01:00
|
|
|
Dictionary::Ptr persistentObject = new Dictionary();
|
2012-07-24 13:13:02 +02:00
|
|
|
|
2013-03-02 09:07:47 +01:00
|
|
|
persistentObject->Set("type", type->GetName());
|
2012-07-27 16:05:02 +02:00
|
|
|
persistentObject->Set("name", object->GetName());
|
2012-07-24 14:18:33 +02:00
|
|
|
|
2013-11-08 11:17:46 +01:00
|
|
|
Dictionary::Ptr update = Serialize(object, attributeTypes);
|
2012-08-02 09:38:08 +02:00
|
|
|
|
|
|
|
if (!update)
|
|
|
|
continue;
|
2012-07-24 14:18:33 +02:00
|
|
|
|
2012-08-02 09:38:08 +02:00
|
|
|
persistentObject->Set("update", update);
|
2012-07-24 13:13:02 +02:00
|
|
|
|
2014-10-26 19:59:49 +01:00
|
|
|
String json = JsonEncode(persistentObject);
|
2012-07-24 13:13:02 +02:00
|
|
|
|
2012-11-23 11:02:34 +01:00
|
|
|
NetString::WriteStringToStream(sfp, json);
|
2012-07-24 13:13:02 +02:00
|
|
|
}
|
|
|
|
}
|
2012-08-07 14:17:36 +02:00
|
|
|
|
2012-11-23 11:02:34 +01:00
|
|
|
sfp->Close();
|
2012-11-22 12:04:32 +01:00
|
|
|
|
2012-10-17 11:35:06 +02:00
|
|
|
fp.close();
|
|
|
|
|
|
|
|
#ifdef _WIN32
|
|
|
|
_unlink(filename.CStr());
|
|
|
|
#endif /* _WIN32 */
|
|
|
|
|
2013-03-11 13:45:08 +01:00
|
|
|
if (rename(tempFilename.CStr(), filename.CStr()) < 0) {
|
|
|
|
BOOST_THROW_EXCEPTION(posix_error()
|
2013-03-18 17:04:22 +01:00
|
|
|
<< boost::errinfo_api_function("rename")
|
|
|
|
<< boost::errinfo_errno(errno)
|
|
|
|
<< boost::errinfo_file_name(tempFilename));
|
2013-03-11 13:45:08 +01:00
|
|
|
}
|
2012-07-24 13:13:02 +02:00
|
|
|
}
|
|
|
|
|
2014-05-18 09:15:27 +02:00
|
|
|
void DynamicObject::RestoreObject(const String& message, int attributeTypes)
|
|
|
|
{
|
2014-10-26 19:59:49 +01:00
|
|
|
Dictionary::Ptr persistentObject = JsonDecode(message);
|
2014-05-18 09:15:27 +02:00
|
|
|
|
|
|
|
String type = persistentObject->Get("type");
|
|
|
|
|
|
|
|
DynamicType::Ptr dt = DynamicType::GetByName(type);
|
|
|
|
|
|
|
|
if (!dt)
|
|
|
|
return;
|
|
|
|
|
|
|
|
String name = persistentObject->Get("name");
|
|
|
|
|
|
|
|
DynamicObject::Ptr object = dt->GetObject(name);
|
|
|
|
|
|
|
|
if (!object)
|
|
|
|
return;
|
|
|
|
|
|
|
|
ASSERT(!object->IsActive());
|
|
|
|
#ifdef _DEBUG
|
2014-10-19 17:52:17 +02:00
|
|
|
Log(LogDebug, "DynamicObject")
|
|
|
|
<< "Restoring object '" << name << "' of type '" << type << "'.";
|
2014-05-18 09:15:27 +02:00
|
|
|
#endif /* _DEBUG */
|
|
|
|
Dictionary::Ptr update = persistentObject->Get("update");
|
|
|
|
Deserialize(object, update, false, attributeTypes);
|
|
|
|
object->OnStateLoaded();
|
2014-10-29 11:14:04 +01:00
|
|
|
object->SetStateLoaded(true);
|
2014-05-18 09:15:27 +02:00
|
|
|
}
|
|
|
|
|
2013-08-20 11:06:04 +02:00
|
|
|
void DynamicObject::RestoreObjects(const String& filename, int attributeTypes)
|
2012-07-24 13:13:02 +02:00
|
|
|
{
|
2014-10-19 17:52:17 +02:00
|
|
|
Log(LogInformation, "DynamicObject")
|
|
|
|
<< "Restoring program state from file '" << filename << "'";
|
2012-07-24 13:13:02 +02:00
|
|
|
|
2012-11-23 11:02:34 +01:00
|
|
|
std::fstream fp;
|
|
|
|
fp.open(filename.CStr(), std::ios_base::in);
|
2012-07-24 13:13:02 +02:00
|
|
|
|
2014-11-08 21:17:16 +01:00
|
|
|
StdioStream::Ptr sfp = new StdioStream (&fp, false);
|
2012-07-24 13:13:02 +02:00
|
|
|
|
2013-01-30 10:52:52 +01:00
|
|
|
unsigned long restored = 0;
|
|
|
|
|
2014-05-18 09:15:27 +02:00
|
|
|
ParallelWorkQueue upq;
|
|
|
|
|
2012-08-02 09:38:08 +02:00
|
|
|
String message;
|
2012-11-23 11:02:34 +01:00
|
|
|
while (NetString::ReadStringFromStream(sfp, &message)) {
|
2014-05-18 09:15:27 +02:00
|
|
|
upq.Enqueue(boost::bind(&DynamicObject::RestoreObject, message, attributeTypes));
|
2013-01-30 10:52:52 +01:00
|
|
|
restored++;
|
2012-07-24 13:13:02 +02:00
|
|
|
}
|
2012-11-22 12:04:32 +01:00
|
|
|
|
2012-11-23 11:02:34 +01:00
|
|
|
sfp->Close();
|
2013-01-30 10:52:52 +01:00
|
|
|
|
2014-05-18 09:15:27 +02:00
|
|
|
upq.Join();
|
|
|
|
|
2014-10-29 11:14:04 +01:00
|
|
|
unsigned long no_state = 0;
|
|
|
|
|
|
|
|
BOOST_FOREACH(const DynamicType::Ptr& type, DynamicType::GetTypes()) {
|
|
|
|
BOOST_FOREACH(const DynamicObject::Ptr& object, type->GetObjects()) {
|
|
|
|
if (!object->GetStateLoaded()) {
|
|
|
|
object->OnStateLoaded();
|
|
|
|
object->SetStateLoaded(true);
|
|
|
|
|
|
|
|
no_state++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-10-19 17:52:17 +02:00
|
|
|
Log(LogInformation, "DynamicObject")
|
2014-10-29 11:14:04 +01:00
|
|
|
<< "Restored " << restored << " objects. Loaded " << no_state << " new objects without state.";
|
2012-07-24 13:13:02 +02:00
|
|
|
}
|
2012-07-27 16:05:02 +02:00
|
|
|
|
2013-08-20 11:06:04 +02:00
|
|
|
void DynamicObject::StopObjects(void)
|
2012-08-07 13:08:14 +02:00
|
|
|
{
|
2013-02-18 23:44:24 +01:00
|
|
|
BOOST_FOREACH(const DynamicType::Ptr& dt, DynamicType::GetTypes()) {
|
2013-03-01 12:07:52 +01:00
|
|
|
BOOST_FOREACH(const DynamicObject::Ptr& object, dt->GetObjects()) {
|
2013-12-14 07:36:49 +01:00
|
|
|
object->Deactivate();
|
2012-08-07 13:08:14 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-12-04 08:42:24 +01:00
|
|
|
DynamicObject::Ptr DynamicObject::GetObject(const String& type, const String& name)
|
|
|
|
{
|
|
|
|
DynamicType::Ptr dtype = DynamicType::GetByName(type);
|
2013-03-01 12:07:52 +01:00
|
|
|
return dtype->GetObject(name);
|
2012-12-04 08:42:24 +01:00
|
|
|
}
|