#include "base/serializer.hpp"
#include "base/json.hpp"
#include "base/exception.hpp"
+#include "base/scriptfunction.hpp"
#include <sstream>
#include <fstream>
#include <boost/foreach.hpp>
ConfigItem::ItemList ConfigItem::m_UnnamedItems;
ConfigItem::ItemList ConfigItem::m_CommittedItems;
+REGISTER_SCRIPTFUNCTION(__commit, &ConfigItem::ScriptCommit);
+
/**
* Constructor for the ConfigItem class.
*
return true;
}
+bool ConfigItem::ScriptCommit(void)
+{
+ WorkQueue upq(25000, Application::GetConcurrency());
+
+ if (!CommitNewItems(upq))
+ return false;
+
+ BOOST_FOREACH(const DynamicType::Ptr& type, DynamicType::GetTypes()) {
+ BOOST_FOREACH(const DynamicObject::Ptr& object, type->GetObjects()) {
+ if (object->IsActive())
+ continue;
+
+#ifdef I2_DEBUG
+ Log(LogDebug, "ConfigItem")
+ << "Activating object '" << object->GetName() << "' of type '" << object->GetType()->GetName() << "'";
+#endif /* I2_DEBUG */
+ upq.Enqueue(boost::bind(&DynamicObject::Activate, object));
+ }
+ }
+
+ return true;
+}
+
std::vector<ConfigItem::Ptr> ConfigItem::GetItems(const String& type)
{
std::vector<ConfigItem::Ptr> items;
static bool CommitItems(void);
static bool ActivateItems(void);
+ static bool ScriptCommit(void);
+
static std::vector<ConfigItem::Ptr> GetItems(const String& type);
private: