summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2009-05-28 23:11:21 +0000
committerDavid Robillard <d@drobilla.net>2009-05-28 23:11:21 +0000
commitb3c31c94eb572063ec97f24a89e5f7f98d5eae41 (patch)
tree1b8096a810fb56798c69e43e85938f059da18622
parenta1b651326087ffce165635af4fba1c70c16b5b31 (diff)
downloadingen-b3c31c94eb572063ec97f24a89e5f7f98d5eae41.tar.gz
ingen-b3c31c94eb572063ec97f24a89e5f7f98d5eae41.tar.bz2
ingen-b3c31c94eb572063ec97f24a89e5f7f98d5eae41.zip
Working engine->client plugin information communication via HTTP.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@2044 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/client/ClientStore.cpp18
-rw-r--r--src/client/HTTPClientReceiver.cpp8
-rw-r--r--src/serialisation/Parser.cpp24
-rw-r--r--src/serialisation/Parser.hpp2
4 files changed, 29 insertions, 23 deletions
diff --git a/src/client/ClientStore.cpp b/src/client/ClientStore.cpp
index cdfeb276..bb501079 100644
--- a/src/client/ClientStore.cpp
+++ b/src/client/ClientStore.cpp
@@ -365,24 +365,26 @@ ClientStore::clear_patch(const Path& path)
void
-ClientStore::set_property(const URI& subject_path, const URI& predicate, const Atom& value)
+ClientStore::set_property(const URI& subject_uri, const URI& predicate, const Atom& value)
{
- SharedPtr<Resource> subject = resource(subject_path);
+ SharedPtr<Resource> subject = resource(subject_uri);
- size_t hash = subject_path.find("#");
+ size_t hash = subject_uri.find("#");
if (!value.is_valid()) {
cerr << "ERROR: property '" << predicate << "' is invalid" << endl;
} else if (subject) {
subject->set_property(predicate, value);
- } else if (hash != string::npos) {
- cerr << "META OBJECT " << subject_path << " PROPERTY " << predicate << endl;
- Path instance_path = string("/") + subject_path.chop_start("#");
+ } else if (subject_uri.substr(0, 6) == "meta:#") {
+ Path instance_path = string("/") + subject_uri.substr(hash + 1);
SharedPtr<ObjectModel> om = PtrCast<ObjectModel>(subject);
if (om)
om->meta().set_property(predicate, value);
} else {
- //add_property_orphan(subject_path, predicate, value);
- cerr << "WARNING: property '" << predicate << "' for unknown object " << subject_path << endl;
+ SharedPtr<PluginModel> plugin = this->plugin(subject_uri);
+ if (plugin)
+ plugin->set_property(predicate, value);
+ else
+ cerr << "WARNING: property '" << predicate << "' for unknown object " << subject_uri << endl;
}
}
diff --git a/src/client/HTTPClientReceiver.cpp b/src/client/HTTPClientReceiver.cpp
index 9d603c2d..6d0dbb1b 100644
--- a/src/client/HTTPClientReceiver.cpp
+++ b/src/client/HTTPClientReceiver.cpp
@@ -99,7 +99,7 @@ HTTPClientReceiver::Listener::Listener(HTTPClientReceiver* receiver, const std::
void
HTTPClientReceiver::update(const std::string& str)
{
- cout << _parser->parse_update(_world, _target.get(), str, "/");
+ cout << _parser->parse_update(_world, _target.get(), str, ".");
}
void
@@ -136,6 +136,10 @@ HTTPClientReceiver::message_callback(SoupSession* session, SoupMessage* msg, voi
{
HTTPClientReceiver* me = (HTTPClientReceiver*)ptr;
const string path = soup_message_get_uri(msg)->path;
+
+ /*cerr << "HTTP MESSAGE " << path << endl;
+ cerr << msg->response_body->data << endl;*/
+
if (path == Path::root_uri) {
me->_target->response_ok(0);
@@ -147,7 +151,7 @@ HTTPClientReceiver::message_callback(SoupSession* session, SoupMessage* msg, voi
me->_target->response_ok(0);
me->_parser->parse_string(me->_world, me->_target.get(),
Glib::ustring(msg->response_body->data),
- Glib::ustring("."));
+ Glib::ustring(""));
}
} else if (path == "/patch") {
diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp
index 07c077e0..e01adc1f 100644
--- a/src/serialisation/Parser.cpp
+++ b/src/serialisation/Parser.cpp
@@ -251,13 +251,6 @@ Parser::parse(
if (!data_path)
path_str = relative_uri(document_uri, subject.to_c_string(), true);
- else if (path_str == "" || path_str[0] != '/')
- path_str = "/" + path_str;
-
- if (!Path::is_valid(path_str)) {
- cerr << "WARNING: Invalid path '" << path_str << "', object skipped" << endl;
- continue;
- }
const bool is_plugin = (rdf_class == ladspa_class)
|| (rdf_class == lv2_class)
@@ -271,6 +264,13 @@ Parser::parse(
const Glib::ustring subject_uri_tok = Glib::ustring("<").append(subject).append(">");
if (is_object) {
+ if (path_str == "" || path_str[0] != '/')
+ path_str = "/" + path_str;
+
+ if (!Path::is_valid(path_str)) {
+ cerr << "WARNING: Invalid path '" << path_str << "', object skipped" << endl;
+ continue;
+ }
string path = (parent && symbol)
? parent->base() + *symbol
@@ -298,8 +298,8 @@ Parser::parse(
root_path = ret;
} else if (is_plugin) {
- if (URI::is_valid(path_str))
- target->set_property(path_str, "rdf:type", Atom(Atom::URI, rdf_class.to_c_string()));
+ if (URI::is_valid(subject.to_string()))
+ parse_properties(world, target, model, subject, subject.to_string());
}
}
@@ -690,7 +690,7 @@ Parser::parse_properties(
Ingen::Shared::CommonInterface* target,
Redland::Model& model,
const Redland::Node& subject_node,
- const Raul::Path& path,
+ const Raul::URI& uri,
boost::optional<GraphObject::Properties> data)
{
const Glib::ustring& subject = subject_node.to_turtle_token();
@@ -710,11 +710,11 @@ Parser::parse_properties(
properties.insert(make_pair(key, AtomRDF::node_to_atom(val)));
}
- target->put(path, properties);
+ target->put(uri, properties);
// Set passed properties last to override any loaded values
if (data)
- target->put(path, data.get());
+ target->put(uri, data.get());
return true;
}
diff --git a/src/serialisation/Parser.hpp b/src/serialisation/Parser.hpp
index 4235f197..07855826 100644
--- a/src/serialisation/Parser.hpp
+++ b/src/serialisation/Parser.hpp
@@ -100,7 +100,7 @@ private:
Ingen::Shared::CommonInterface* target,
Redland::Model& model,
const Redland::Node& subject,
- const Raul::Path& path,
+ const Raul::URI& uri,
boost::optional<Properties> data=boost::optional<Properties>());
bool parse_connections(