Skip to content
Snippets Groups Projects
Commit 7755ce2b authored by Sebastian Kahl's avatar Sebastian Kahl
Browse files

Added ipaaca channel possibilities based on rsb scope. Also, deprecated...

Added ipaaca channel possibilities based on rsb scope. Also, deprecated incompatible InputBuffer constrcutors for non-container parameters for multiple categories, from cpp version
parent 98c73a9d
No related branches found
No related tags found
No related merge requests found
/* /*
* This file is part of IPAACA, the * This file is part of IPAACA, the
* "Incremental Processing Architecture * "Incremental Processing Architecture
* for Artificial Conversational Agents". * for Artificial Conversational Agents".
* *
* Copyright (c) 2009-2013 Sociable Agents Group * Copyright (c) 2009-2013 Sociable Agents Group
* CITEC, Bielefeld University * CITEC, Bielefeld University
* *
* http://opensource.cit-ec.de/projects/ipaaca/ * http://opensource.cit-ec.de/projects/ipaaca/
* http://purl.org/net/ipaaca * http://purl.org/net/ipaaca
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
* You should have received a copy of the LGPL along with this * You should have received a copy of the LGPL along with this
* program. If not, go to http://www.gnu.org/licenses/lgpl.html * program. If not, go to http://www.gnu.org/licenses/lgpl.html
* or write to the Free Software Foundation, Inc., * or write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* The development of this software was supported by the * The development of this software was supported by the
* Excellence Cluster EXC 277 Cognitive Interaction Technology. * Excellence Cluster EXC 277 Cognitive Interaction Technology.
...@@ -330,7 +330,7 @@ IPAACA_HEADER_EXPORT class SmartLinkMap { ...@@ -330,7 +330,7 @@ IPAACA_HEADER_EXPORT class SmartLinkMap {
public: public:
IPAACA_HEADER_EXPORT const LinkSet& get_links(const std::string& key); IPAACA_HEADER_EXPORT const LinkSet& get_links(const std::string& key);
IPAACA_HEADER_EXPORT const LinkMap& get_all_links(); IPAACA_HEADER_EXPORT const LinkMap& get_all_links();
protected: protected:
IPAACA_MEMBER_VAR_EXPORT LinkMap _links; IPAACA_MEMBER_VAR_EXPORT LinkMap _links;
IPAACA_MEMBER_VAR_EXPORT static LinkSet empty_link_set; IPAACA_MEMBER_VAR_EXPORT static LinkSet empty_link_set;
...@@ -409,6 +409,7 @@ IPAACA_HEADER_EXPORT class OutputBuffer: public Buffer { //, public boost::enabl ...@@ -409,6 +409,7 @@ IPAACA_HEADER_EXPORT class OutputBuffer: public Buffer { //, public boost::enabl
protected: protected:
IPAACA_MEMBER_VAR_EXPORT std::map<std::string, rsb::Informer<rsb::AnyType>::Ptr> _informer_store; IPAACA_MEMBER_VAR_EXPORT std::map<std::string, rsb::Informer<rsb::AnyType>::Ptr> _informer_store;
IPAACA_MEMBER_VAR_EXPORT rsb::patterns::ServerPtr _server; IPAACA_MEMBER_VAR_EXPORT rsb::patterns::ServerPtr _server;
IPAACA_MEMBER_VAR_EXPORT std::string _channel;
IPAACA_HEADER_EXPORT rsb::Informer<rsb::AnyType>::Ptr _get_informer(const std::string& category); IPAACA_HEADER_EXPORT rsb::Informer<rsb::AnyType>::Ptr _get_informer(const std::string& category);
#endif #endif
protected: protected:
...@@ -423,7 +424,7 @@ IPAACA_HEADER_EXPORT class OutputBuffer: public Buffer { //, public boost::enabl ...@@ -423,7 +424,7 @@ IPAACA_HEADER_EXPORT class OutputBuffer: public Buffer { //, public boost::enabl
IPAACA_HEADER_EXPORT void _publish_iu(boost::shared_ptr<IU> iu); IPAACA_HEADER_EXPORT void _publish_iu(boost::shared_ptr<IU> iu);
IPAACA_HEADER_EXPORT void _retract_iu(boost::shared_ptr<IU> iu); IPAACA_HEADER_EXPORT void _retract_iu(boost::shared_ptr<IU> iu);
protected: protected:
IPAACA_HEADER_EXPORT OutputBuffer(const std::string& basename); IPAACA_HEADER_EXPORT OutputBuffer(const std::string& basename, const std::string& channel="default");
IPAACA_HEADER_EXPORT void _initialize_server(); IPAACA_HEADER_EXPORT void _initialize_server();
public: public:
IPAACA_HEADER_EXPORT static boost::shared_ptr<OutputBuffer> create(const std::string& basename); IPAACA_HEADER_EXPORT static boost::shared_ptr<OutputBuffer> create(const std::string& basename);
...@@ -449,6 +450,7 @@ IPAACA_HEADER_EXPORT class InputBuffer: public Buffer { //, public boost::enable ...@@ -449,6 +450,7 @@ IPAACA_HEADER_EXPORT class InputBuffer: public Buffer { //, public boost::enable
IPAACA_MEMBER_VAR_EXPORT std::map<std::string, rsb::ListenerPtr> _listener_store; IPAACA_MEMBER_VAR_EXPORT std::map<std::string, rsb::ListenerPtr> _listener_store;
IPAACA_MEMBER_VAR_EXPORT std::map<std::string, rsb::patterns::RemoteServerPtr> _remote_server_store; IPAACA_MEMBER_VAR_EXPORT std::map<std::string, rsb::patterns::RemoteServerPtr> _remote_server_store;
IPAACA_MEMBER_VAR_EXPORT RemotePushIUStore _iu_store; // TODO genericize IPAACA_MEMBER_VAR_EXPORT RemotePushIUStore _iu_store; // TODO genericize
IPAACA_MEMBER_VAR_EXPORT std::string _channel;
IPAACA_HEADER_EXPORT rsb::patterns::RemoteServerPtr _get_remote_server(const std::string& unique_server_name); IPAACA_HEADER_EXPORT rsb::patterns::RemoteServerPtr _get_remote_server(const std::string& unique_server_name);
IPAACA_HEADER_EXPORT rsb::ListenerPtr _create_category_listener_if_needed(const std::string& category); IPAACA_HEADER_EXPORT rsb::ListenerPtr _create_category_listener_if_needed(const std::string& category);
IPAACA_HEADER_EXPORT void _handle_iu_events(rsb::EventPtr event); IPAACA_HEADER_EXPORT void _handle_iu_events(rsb::EventPtr event);
...@@ -467,19 +469,19 @@ IPAACA_HEADER_EXPORT class InputBuffer: public Buffer { //, public boost::enable ...@@ -467,19 +469,19 @@ IPAACA_HEADER_EXPORT class InputBuffer: public Buffer { //, public boost::enable
IPAACA_WARNING("(ERROR) InputBuffer::_send_iu_commission() should never be invoked") IPAACA_WARNING("(ERROR) InputBuffer::_send_iu_commission() should never be invoked")
} }
protected: protected:
IPAACA_HEADER_EXPORT InputBuffer(const std::string& basename, const std::set<std::string>& category_interests); IPAACA_HEADER_EXPORT InputBuffer(const std::string& basename, const std::set<std::string>& category_interests, const std::string& channel="default");
IPAACA_HEADER_EXPORT InputBuffer(const std::string& basename, const std::vector<std::string>& category_interests); IPAACA_HEADER_EXPORT InputBuffer(const std::string& basename, const std::vector<std::string>& category_interests, const std::string& channel="default");
IPAACA_HEADER_EXPORT InputBuffer(const std::string& basename, const std::string& category_interest1); IPAACA_HEADER_EXPORT InputBuffer(const std::string& basename, const std::string& category_interest1, const std::string& channel="default");
IPAACA_HEADER_EXPORT InputBuffer(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2); // IPAACA_HEADER_EXPORT InputBuffer(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2);
IPAACA_HEADER_EXPORT InputBuffer(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2, const std::string& category_interest3); // IPAACA_HEADER_EXPORT InputBuffer(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2, const std::string& category_interest3);
IPAACA_HEADER_EXPORT InputBuffer(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2, const std::string& category_interest3, const std::string& category_interest4); // IPAACA_HEADER_EXPORT InputBuffer(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2, const std::string& category_interest3, const std::string& category_interest4);
public: public:
IPAACA_HEADER_EXPORT static boost::shared_ptr<InputBuffer> create(const std::string& basename, const std::set<std::string>& category_interests); IPAACA_HEADER_EXPORT static boost::shared_ptr<InputBuffer> create(const std::string& basename, const std::set<std::string>& category_interests, const std::string& channel="default");
IPAACA_HEADER_EXPORT static boost::shared_ptr<InputBuffer> create(const std::string& basename, const std::vector<std::string>& category_interests); IPAACA_HEADER_EXPORT static boost::shared_ptr<InputBuffer> create(const std::string& basename, const std::vector<std::string>& category_interests, const std::string& channel="default");
IPAACA_HEADER_EXPORT static boost::shared_ptr<InputBuffer> create(const std::string& basename, const std::string& category_interest1); IPAACA_HEADER_EXPORT static boost::shared_ptr<InputBuffer> create(const std::string& basename, const std::string& category_interest1, const std::string& channel="default");
IPAACA_HEADER_EXPORT static boost::shared_ptr<InputBuffer> create(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2); // IPAACA_HEADER_EXPORT static boost::shared_ptr<InputBuffer> create(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2);
IPAACA_HEADER_EXPORT static boost::shared_ptr<InputBuffer> create(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2, const std::string& category_interest3); // IPAACA_HEADER_EXPORT static boost::shared_ptr<InputBuffer> create(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2, const std::string& category_interest3);
IPAACA_HEADER_EXPORT static boost::shared_ptr<InputBuffer> create(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2, const std::string& category_interest3, const std::string& category_interest4); // IPAACA_HEADER_EXPORT static boost::shared_ptr<InputBuffer> create(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2, const std::string& category_interest3, const std::string& category_interest4);
IPAACA_HEADER_EXPORT ~InputBuffer() { IPAACA_HEADER_EXPORT ~InputBuffer() {
IPAACA_IMPLEMENT_ME IPAACA_IMPLEMENT_ME
} }
......
/* /*
* This file is part of IPAACA, the * This file is part of IPAACA, the
* "Incremental Processing Architecture * "Incremental Processing Architecture
* for Artificial Conversational Agents". * for Artificial Conversational Agents".
* *
* Copyright (c) 2009-2013 Sociable Agents Group * Copyright (c) 2009-2013 Sociable Agents Group
* CITEC, Bielefeld University * CITEC, Bielefeld University
* *
* http://opensource.cit-ec.de/projects/ipaaca/ * http://opensource.cit-ec.de/projects/ipaaca/
* http://purl.org/net/ipaaca * http://purl.org/net/ipaaca
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
* You should have received a copy of the LGPL along with this * You should have received a copy of the LGPL along with this
* program. If not, go to http://www.gnu.org/licenses/lgpl.html * program. If not, go to http://www.gnu.org/licenses/lgpl.html
* or write to the Free Software Foundation, Inc., * or write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* The development of this software was supported by the * The development of this software was supported by the
* Excellence Cluster EXC 277 Cognitive Interaction Technology. * Excellence Cluster EXC 277 Cognitive Interaction Technology.
...@@ -64,36 +64,36 @@ IPAACA_EXPORT bool Initializer::initialized() { return _initialized; } ...@@ -64,36 +64,36 @@ IPAACA_EXPORT bool Initializer::initialized() { return _initialized; }
IPAACA_EXPORT void Initializer::initialize_ipaaca_rsb_if_needed() IPAACA_EXPORT void Initializer::initialize_ipaaca_rsb_if_needed()
{ {
if (_initialized) return; if (_initialized) return;
//IPAACA_INFO("Calling initialize_updated_default_config()") //IPAACA_INFO("Calling initialize_updated_default_config()")
initialize_updated_default_config(); initialize_updated_default_config();
// RYT FIXME This configuration stuff has been simply removed in rsb! // RYT FIXME This configuration stuff has been simply removed in rsb!
//ParticipantConfig config = ParticipantConfig::fromConfiguration(); //ParticipantConfig config = ParticipantConfig::fromConfiguration();
//getFactory().setDefaultParticipantConfig(config); //getFactory().setDefaultParticipantConfig(config);
//IPAACA_INFO("Creating and registering Converters") //IPAACA_INFO("Creating and registering Converters")
boost::shared_ptr<IUConverter> iu_converter(new IUConverter()); boost::shared_ptr<IUConverter> iu_converter(new IUConverter());
converterRepository<std::string>()->registerConverter(iu_converter); converterRepository<std::string>()->registerConverter(iu_converter);
boost::shared_ptr<MessageConverter> message_converter(new MessageConverter()); boost::shared_ptr<MessageConverter> message_converter(new MessageConverter());
converterRepository<std::string>()->registerConverter(message_converter); converterRepository<std::string>()->registerConverter(message_converter);
boost::shared_ptr<IUPayloadUpdateConverter> payload_update_converter(new IUPayloadUpdateConverter()); boost::shared_ptr<IUPayloadUpdateConverter> payload_update_converter(new IUPayloadUpdateConverter());
converterRepository<std::string>()->registerConverter(payload_update_converter); converterRepository<std::string>()->registerConverter(payload_update_converter);
boost::shared_ptr<IULinkUpdateConverter> link_update_converter(new IULinkUpdateConverter()); boost::shared_ptr<IULinkUpdateConverter> link_update_converter(new IULinkUpdateConverter());
converterRepository<std::string>()->registerConverter(link_update_converter); converterRepository<std::string>()->registerConverter(link_update_converter);
boost::shared_ptr<ProtocolBufferConverter<protobuf::IUCommission> > iu_commission_converter(new ProtocolBufferConverter<protobuf::IUCommission> ()); boost::shared_ptr<ProtocolBufferConverter<protobuf::IUCommission> > iu_commission_converter(new ProtocolBufferConverter<protobuf::IUCommission> ());
converterRepository<std::string>()->registerConverter(iu_commission_converter); converterRepository<std::string>()->registerConverter(iu_commission_converter);
boost::shared_ptr<ProtocolBufferConverter<protobuf::IURetraction> > iu_retraction_converter(new ProtocolBufferConverter<protobuf::IURetraction> ()); boost::shared_ptr<ProtocolBufferConverter<protobuf::IURetraction> > iu_retraction_converter(new ProtocolBufferConverter<protobuf::IURetraction> ());
converterRepository<std::string>()->registerConverter(iu_retraction_converter); converterRepository<std::string>()->registerConverter(iu_retraction_converter);
boost::shared_ptr<IntConverter> int_converter(new IntConverter()); boost::shared_ptr<IntConverter> int_converter(new IntConverter());
converterRepository<std::string>()->registerConverter(int_converter); converterRepository<std::string>()->registerConverter(int_converter);
//IPAACA_INFO("Initialization complete.") //IPAACA_INFO("Initialization complete.")
_initialized = true; _initialized = true;
//IPAACA_TODO("initialize all converters") //IPAACA_TODO("initialize all converters")
...@@ -489,11 +489,12 @@ IPAACA_EXPORT boost::shared_ptr<int> CallbackIUCommission::call(const std::strin ...@@ -489,11 +489,12 @@ IPAACA_EXPORT boost::shared_ptr<int> CallbackIUCommission::call(const std::strin
// OutputBuffer//{{{ // OutputBuffer//{{{
IPAACA_EXPORT OutputBuffer::OutputBuffer(const std::string& basename) IPAACA_EXPORT OutputBuffer::OutputBuffer(const std::string& basename, const std::string& channel)
:Buffer(basename, "OB") :Buffer(basename, "OB")
{ {
//IPAACA_INFO("Entering ...") //IPAACA_INFO("Entering ...")
_id_prefix = _basename + "-" + _uuid + "-IU-"; _id_prefix = _basename + "-" + _uuid + "-IU-";
_channel = channel;
_initialize_server(); _initialize_server();
//IPAACA_INFO("... exiting.") //IPAACA_INFO("... exiting.")
} }
...@@ -564,7 +565,7 @@ IPAACA_EXPORT void OutputBuffer::_send_iu_commission(IUInterface* iu, revision_t ...@@ -564,7 +565,7 @@ IPAACA_EXPORT void OutputBuffer::_send_iu_commission(IUInterface* iu, revision_t
data->set_revision(revision); data->set_revision(revision);
if (writer_name=="") data->set_writer_name(_unique_name); if (writer_name=="") data->set_writer_name(_unique_name);
else data->set_writer_name(writer_name); else data->set_writer_name(writer_name);
Informer<AnyType>::Ptr informer = _get_informer(iu->category()); Informer<AnyType>::Ptr informer = _get_informer(iu->category());
informer->publish(data); informer->publish(data);
} }
...@@ -598,7 +599,7 @@ IPAACA_EXPORT Informer<AnyType>::Ptr OutputBuffer::_get_informer(const std::stri ...@@ -598,7 +599,7 @@ IPAACA_EXPORT Informer<AnyType>::Ptr OutputBuffer::_get_informer(const std::stri
return _informer_store[category]; return _informer_store[category];
} else { } else {
//IPAACA_INFO("Making new informer for category " << category) //IPAACA_INFO("Making new informer for category " << category)
std::string scope_string = "/ipaaca/category/" + category; std::string scope_string = "/ipaaca/channel/" + _channel + "/category/" + category;
Informer<AnyType>::Ptr informer = getFactory().createInformer<AnyType> ( Scope(scope_string)); Informer<AnyType>::Ptr informer = getFactory().createInformer<AnyType> ( Scope(scope_string));
_informer_store[category] = informer; _informer_store[category] = informer;
return informer; return informer;
...@@ -634,78 +635,90 @@ IPAACA_EXPORT void OutputBuffer::_retract_iu(IU::ptr iu) ...@@ -634,78 +635,90 @@ IPAACA_EXPORT void OutputBuffer::_retract_iu(IU::ptr iu)
//}}} //}}}
// InputBuffer//{{{ // InputBuffer//{{{
IPAACA_EXPORT InputBuffer::InputBuffer(const std::string& basename, const std::set<std::string>& category_interests) IPAACA_EXPORT InputBuffer::InputBuffer(const std::string& basename, const std::set<std::string>& category_interests, const std::string& channel)
:Buffer(basename, "IB") :Buffer(basename, "IB")
{ {
_channel = channel;
for (std::set<std::string>::const_iterator it=category_interests.begin(); it!=category_interests.end(); ++it) { for (std::set<std::string>::const_iterator it=category_interests.begin(); it!=category_interests.end(); ++it) {
_create_category_listener_if_needed(*it); _create_category_listener_if_needed(*it);
} }
} }
IPAACA_EXPORT InputBuffer::InputBuffer(const std::string& basename, const std::vector<std::string>& category_interests) IPAACA_EXPORT InputBuffer::InputBuffer(const std::string& basename, const std::vector<std::string>& category_interests, const std::string& channel)
:Buffer(basename, "IB") :Buffer(basename, "IB")
{ {
_channel = channel;
for (std::vector<std::string>::const_iterator it=category_interests.begin(); it!=category_interests.end(); ++it) { for (std::vector<std::string>::const_iterator it=category_interests.begin(); it!=category_interests.end(); ++it) {
_create_category_listener_if_needed(*it); _create_category_listener_if_needed(*it);
} }
} }
IPAACA_EXPORT InputBuffer::InputBuffer(const std::string& basename, const std::string& category_interest1) IPAACA_EXPORT InputBuffer::InputBuffer(const std::string& basename, const std::string& category_interest1, const std::string& channel)
:Buffer(basename, "IB")
{
_create_category_listener_if_needed(category_interest1);
}
IPAACA_EXPORT InputBuffer::InputBuffer(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2)
:Buffer(basename, "IB")
{
_create_category_listener_if_needed(category_interest1);
_create_category_listener_if_needed(category_interest2);
}
IPAACA_EXPORT InputBuffer::InputBuffer(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2, const std::string& category_interest3)
:Buffer(basename, "IB") :Buffer(basename, "IB")
{ {
_create_category_listener_if_needed(category_interest1); _channel = channel;
_create_category_listener_if_needed(category_interest2);
_create_category_listener_if_needed(category_interest3);
}
IPAACA_EXPORT InputBuffer::InputBuffer(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2, const std::string& category_interest3, const std::string& category_interest4)
:Buffer(basename, "IB")
{
_create_category_listener_if_needed(category_interest1);
_create_category_listener_if_needed(category_interest2);
_create_category_listener_if_needed(category_interest3);
_create_category_listener_if_needed(category_interest4);
}
IPAACA_EXPORT InputBuffer::ptr InputBuffer::create(const std::string& basename, const std::set<std::string>& category_interests) _create_category_listener_if_needed(category_interest1);
{
Initializer::initialize_ipaaca_rsb_if_needed();
return InputBuffer::ptr(new InputBuffer(basename, category_interests));
}
IPAACA_EXPORT InputBuffer::ptr InputBuffer::create(const std::string& basename, const std::vector<std::string>& category_interests)
{
Initializer::initialize_ipaaca_rsb_if_needed();
return InputBuffer::ptr(new InputBuffer(basename, category_interests));
}
IPAACA_EXPORT InputBuffer::ptr InputBuffer::create(const std::string& basename, const std::string& category_interest1)
{
Initializer::initialize_ipaaca_rsb_if_needed();
return InputBuffer::ptr(new InputBuffer(basename, category_interest1));
} }
IPAACA_EXPORT InputBuffer::ptr InputBuffer::create(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2) // IPAACA_EXPORT InputBuffer::InputBuffer(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2)
// :Buffer(basename, "IB")
// {
// _channel = "default";
// _create_category_listener_if_needed(category_interest1);
// _create_category_listener_if_needed(category_interest2);
// }
// IPAACA_EXPORT InputBuffer::InputBuffer(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2, const std::string& category_interest3)
// :Buffer(basename, "IB")
// {
// _channel = "default";
// _create_category_listener_if_needed(category_interest1);
// _create_category_listener_if_needed(category_interest2);
// _create_category_listener_if_needed(category_interest3);
// }
// IPAACA_EXPORT InputBuffer::InputBuffer(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2, const std::string& category_interest3, const std::string& category_interest4)
// :Buffer(basename, "IB")
// {
// _channel = "default";
// _create_category_listener_if_needed(category_interest1);
// _create_category_listener_if_needed(category_interest2);
// _create_category_listener_if_needed(category_interest3);
// _create_category_listener_if_needed(category_interest4);
// }
IPAACA_EXPORT InputBuffer::ptr InputBuffer::create(const std::string& basename, const std::set<std::string>& category_interests, const std::string& channel)
{ {
Initializer::initialize_ipaaca_rsb_if_needed(); Initializer::initialize_ipaaca_rsb_if_needed();
return InputBuffer::ptr(new InputBuffer(basename, category_interest1, category_interest2)); return InputBuffer::ptr(new InputBuffer(basename, category_interests, channel));
} }
IPAACA_EXPORT InputBuffer::ptr InputBuffer::create(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2, const std::string& category_interest3) IPAACA_EXPORT InputBuffer::ptr InputBuffer::create(const std::string& basename, const std::vector<std::string>& category_interests, const std::string& channel)
{ {
Initializer::initialize_ipaaca_rsb_if_needed(); Initializer::initialize_ipaaca_rsb_if_needed();
return InputBuffer::ptr(new InputBuffer(basename, category_interest1, category_interest2, category_interest3)); return InputBuffer::ptr(new InputBuffer(basename, category_interests, channel));
} }
IPAACA_EXPORT InputBuffer::ptr InputBuffer::create(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2, const std::string& category_interest3, const std::string& category_interest4) IPAACA_EXPORT InputBuffer::ptr InputBuffer::create(const std::string& basename, const std::string& category_interest1, const std::string& channel)
{ {
Initializer::initialize_ipaaca_rsb_if_needed(); Initializer::initialize_ipaaca_rsb_if_needed();
return InputBuffer::ptr(new InputBuffer(basename, category_interest1, category_interest2, category_interest3, category_interest4)); return InputBuffer::ptr(new InputBuffer(basename, category_interest1, channel));
} }
// IPAACA_EXPORT InputBuffer::ptr InputBuffer::create(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2, const std::string& channel)
// {
// Initializer::initialize_ipaaca_rsb_if_needed();
// return InputBuffer::ptr(new InputBuffer(basename, category_interest1, category_interest2, channel));
// }
// IPAACA_EXPORT InputBuffer::ptr InputBuffer::create(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2, const std::string& category_interest3, const std::string& channel)
// {
// Initializer::initialize_ipaaca_rsb_if_needed();
// return InputBuffer::ptr(new InputBuffer(basename, category_interest1, category_interest2, category_interest3, channel));
// }
// IPAACA_EXPORT InputBuffer::ptr InputBuffer::create(const std::string& basename, const std::string& category_interest1, const std::string& category_interest2, const std::string& category_interest3, const std::string& category_interest4, const std::string& channel)
// {
// Initializer::initialize_ipaaca_rsb_if_needed();
// return InputBuffer::ptr(new InputBuffer(basename, category_interest1, category_interest2, category_interest3, category_interest4, channel));
// }
IPAACA_EXPORT IUInterface::ptr InputBuffer::get(const std::string& iu_uid) IPAACA_EXPORT IUInterface::ptr InputBuffer::get(const std::string& iu_uid)
{ {
...@@ -739,7 +752,7 @@ IPAACA_EXPORT ListenerPtr InputBuffer::_create_category_listener_if_needed(const ...@@ -739,7 +752,7 @@ IPAACA_EXPORT ListenerPtr InputBuffer::_create_category_listener_if_needed(const
return it->second; return it->second;
} }
//IPAACA_INFO("Creating a new listener for category " << category) //IPAACA_INFO("Creating a new listener for category " << category)
std::string scope_string = "/ipaaca/category/" + category; std::string scope_string = "/ipaaca/channel/" + _channel + "/category/" + category;
ListenerPtr listener = getFactory().createListener( Scope(scope_string) ); ListenerPtr listener = getFactory().createListener( Scope(scope_string) );
//IPAACA_INFO("Adding handler") //IPAACA_INFO("Adding handler")
HandlerPtr event_handler = HandlerPtr( HandlerPtr event_handler = HandlerPtr(
...@@ -867,7 +880,7 @@ IPAACA_EXPORT void IUInterface::_set_buffer(Buffer* buffer) { //boost::shared_pt ...@@ -867,7 +880,7 @@ IPAACA_EXPORT void IUInterface::_set_buffer(Buffer* buffer) { //boost::shared_pt
throw IUAlreadyInABufferError(); throw IUAlreadyInABufferError();
} }
_buffer = buffer; _buffer = buffer;
} }
IPAACA_EXPORT void IUInterface::_set_owner_name(const std::string& owner_name) { IPAACA_EXPORT void IUInterface::_set_owner_name(const std::string& owner_name) {
...@@ -1035,7 +1048,7 @@ void Message::_internal_commit(const std::string& writer_name) ...@@ -1035,7 +1048,7 @@ void Message::_internal_commit(const std::string& writer_name)
if (is_published()) { if (is_published()) {
IPAACA_INFO("Info: committing to a Message after sending has no global effects") IPAACA_INFO("Info: committing to a Message after sending has no global effects")
} }
} }
//}}} //}}}
...@@ -1468,7 +1481,7 @@ IPAACA_EXPORT AnnotatedData IUConverter::deserialize(const std::string& wireSche ...@@ -1468,7 +1481,7 @@ IPAACA_EXPORT AnnotatedData IUConverter::deserialize(const std::string& wireSche
//return std::make_pair(getDataType(), obj); //return std::make_pair(getDataType(), obj);
return std::make_pair("ipaaca::RemoteMessage", obj); return std::make_pair("ipaaca::RemoteMessage", obj);
break; break;
} }
default: default:
// other cases not handled yet! ( TODO ) // other cases not handled yet! ( TODO )
throw NotImplementedError(); throw NotImplementedError();
......
/* /*
* This file is part of IPAACA, the * This file is part of IPAACA, the
* "Incremental Processing Architecture * "Incremental Processing Architecture
* for Artificial Conversational Agents". * for Artificial Conversational Agents".
* *
* Copyright (c) 2009-2013 Sociable Agents Group * Copyright (c) 2009-2013 Sociable Agents Group
* CITEC, Bielefeld University * CITEC, Bielefeld University
* *
* http://opensource.cit-ec.de/projects/ipaaca/ * http://opensource.cit-ec.de/projects/ipaaca/
* http://purl.org/net/ipaaca * http://purl.org/net/ipaaca
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
* You should have received a copy of the LGPL along with this * You should have received a copy of the LGPL along with this
* program. If not, go to http://www.gnu.org/licenses/lgpl.html * program. If not, go to http://www.gnu.org/licenses/lgpl.html
* or write to the Free Software Foundation, Inc., * or write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* The development of this software was supported by the * The development of this software was supported by the
* Excellence Cluster EXC 277 Cognitive Interaction Technology. * Excellence Cluster EXC 277 Cognitive Interaction Technology.
...@@ -69,6 +69,7 @@ public class InputBuffer extends Buffer ...@@ -69,6 +69,7 @@ public class InputBuffer extends Buffer
private final static Logger logger = LoggerFactory.getLogger(InputBuffer.class.getName()); private final static Logger logger = LoggerFactory.getLogger(InputBuffer.class.getName());
private IUStore<RemotePushIU> iuStore = new IUStore<RemotePushIU>(); private IUStore<RemotePushIU> iuStore = new IUStore<RemotePushIU>();
private IUStore<RemoteMessageIU> messageStore = new IUStore<RemoteMessageIU>(); private IUStore<RemoteMessageIU> messageStore = new IUStore<RemoteMessageIU>();
private String channel;
public void close() public void close()
{ {
...@@ -121,6 +122,12 @@ public class InputBuffer extends Buffer ...@@ -121,6 +122,12 @@ public class InputBuffer extends Buffer
// for cat in category_interests: // for cat in category_interests:
// self._create_category_listener_if_needed(cat) // self._create_category_listener_if_needed(cat)
public InputBuffer(String owningComponentName, Set<String> categoryInterests) public InputBuffer(String owningComponentName, Set<String> categoryInterests)
{
this(owningComponentName, categoryInterests, "default");
}
public InputBuffer(String owningComponentName, Set<String> categoryInterests, String ipaaca_channel)
{ {
super(owningComponentName); super(owningComponentName);
uniqueName = "/ipaaca/component/" + getUniqueShortName() + "/IB"; uniqueName = "/ipaaca/component/" + getUniqueShortName() + "/IB";
...@@ -129,6 +136,8 @@ public class InputBuffer extends Buffer ...@@ -129,6 +136,8 @@ public class InputBuffer extends Buffer
{ {
createCategoryListenerIfNeeded(cat); createCategoryListenerIfNeeded(cat);
} }
this.channel = ipaaca_channel;
} }
// def _get_remote_server(self, iu): // def _get_remote_server(self, iu):
...@@ -180,7 +189,7 @@ public class InputBuffer extends Buffer ...@@ -180,7 +189,7 @@ public class InputBuffer extends Buffer
Listener listener; Listener listener;
try try
{ {
listener = Factory.getInstance().createListener(new Scope("/ipaaca/category/" + category)); listener = Factory.getInstance().createListener(new Scope("/ipaaca/channel/" + this.channel + "/category/" + category));
} }
catch (InitializeException e1) catch (InitializeException e1)
{ {
...@@ -273,7 +282,7 @@ public class InputBuffer extends Buffer ...@@ -273,7 +282,7 @@ public class InputBuffer extends Buffer
logger.warn("Spurious RemoteMessage event: already got this UID: "+rm.getUid()); logger.warn("Spurious RemoteMessage event: already got this UID: "+rm.getUid());
return; return;
} }
//logger.info("Adding Message "+rm.getUid()); //logger.info("Adding Message "+rm.getUid());
messageStore.put(rm.getUid(), rm); messageStore.put(rm.getUid(), rm);
//logger.info("Calling handlers for Message "+rm.getUid()); //logger.info("Calling handlers for Message "+rm.getUid());
......
/* /*
* This file is part of IPAACA, the * This file is part of IPAACA, the
* "Incremental Processing Architecture * "Incremental Processing Architecture
* for Artificial Conversational Agents". * for Artificial Conversational Agents".
* *
* Copyright (c) 2009-2013 Sociable Agents Group * Copyright (c) 2009-2013 Sociable Agents Group
* CITEC, Bielefeld University * CITEC, Bielefeld University
* *
* http://opensource.cit-ec.de/projects/ipaaca/ * http://opensource.cit-ec.de/projects/ipaaca/
* http://purl.org/net/ipaaca * http://purl.org/net/ipaaca
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
* You should have received a copy of the LGPL along with this * You should have received a copy of the LGPL along with this
* program. If not, go to http://www.gnu.org/licenses/lgpl.html * program. If not, go to http://www.gnu.org/licenses/lgpl.html
* or write to the Free Software Foundation, Inc., * or write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* *
* The development of this software was supported by the * The development of this software was supported by the
* Excellence Cluster EXC 277 Cognitive Interaction Technology. * Excellence Cluster EXC 277 Cognitive Interaction Technology.
...@@ -69,6 +69,7 @@ public class OutputBuffer extends Buffer ...@@ -69,6 +69,7 @@ public class OutputBuffer extends Buffer
private Map<String, Informer<Object>> informerStore = new HashMap<String, Informer<Object>>(); // category -> informer map private Map<String, Informer<Object>> informerStore = new HashMap<String, Informer<Object>>(); // category -> informer map
private final static Logger logger = LoggerFactory.getLogger(OutputBuffer.class.getName()); private final static Logger logger = LoggerFactory.getLogger(OutputBuffer.class.getName());
private IUStore<LocalIU> iuStore = new IUStore<LocalIU>(); private IUStore<LocalIU> iuStore = new IUStore<LocalIU>();
private String channel;
// def __init__(self, owning_component_name, participant_config=None): // def __init__(self, owning_component_name, participant_config=None):
// '''Create an Output Buffer. // '''Create an Output Buffer.
...@@ -90,6 +91,16 @@ public class OutputBuffer extends Buffer ...@@ -90,6 +91,16 @@ public class OutputBuffer extends Buffer
* @param owningComponentName name of the entity that own this buffer * @param owningComponentName name of the entity that own this buffer
*/ */
public OutputBuffer(String owningComponentName) public OutputBuffer(String owningComponentName)
{
this(owningComponentName, "default");
}
/**
* @param owningComponentName name of the entity that own this buffer
* @param channel name of the ipaaca channel this buffer is using
*/
public OutputBuffer(String owningComponentName, String ipaaca_channel)
{ {
super(owningComponentName); super(owningComponentName);
...@@ -112,6 +123,7 @@ public class OutputBuffer extends Buffer ...@@ -112,6 +123,7 @@ public class OutputBuffer extends Buffer
throw new RuntimeException(e); throw new RuntimeException(e);
} }
this.channel = ipaaca_channel;
} }
private final class RemoteUpdatePayload extends DataCallback<Integer, IUPayloadUpdate> private final class RemoteUpdatePayload extends DataCallback<Integer, IUPayloadUpdate>
...@@ -192,7 +204,7 @@ public class OutputBuffer extends Buffer ...@@ -192,7 +204,7 @@ public class OutputBuffer extends Buffer
{ {
iu.getPayload().remove(k, update.getWriterName()); iu.getPayload().remove(k, update.getWriterName());
} }
if (update.getNewItemsList().size() > 0) if (update.getNewItemsList().size() > 0)
{ {
HashMap<String, String> payloadUpdate = new HashMap<String, String>(); HashMap<String, String> payloadUpdate = new HashMap<String, String>();
...@@ -329,7 +341,7 @@ public class OutputBuffer extends Buffer ...@@ -329,7 +341,7 @@ public class OutputBuffer extends Buffer
Informer<Object> informer; Informer<Object> informer;
try try
{ {
informer = Factory.getInstance().createInformer("/ipaaca/category/" + category); informer = Factory.getInstance().createInformer("/ipaaca/channel/" + this.channel + "/category/" + category);
} }
catch (InitializeException e1) catch (InitializeException e1)
{ {
...@@ -337,7 +349,7 @@ public class OutputBuffer extends Buffer ...@@ -337,7 +349,7 @@ public class OutputBuffer extends Buffer
} }
informerStore.put(category, informer); informerStore.put(category, informer);
logger.info("Added informer on " + category); logger.info("Added informer on channel " + this.channel + " and category " + category);
try try
{ {
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment