diff --git a/ipaacalib/cpp/build.xml b/ipaacalib/cpp/build.xml index 75ed860ffc377c3c0c073305221ea7b58bf32d79..f205ed3674f49dd18e475bf98c64235bd6ff622a 100644 --- a/ipaacalib/cpp/build.xml +++ b/ipaacalib/cpp/build.xml @@ -3,7 +3,7 @@ <import file="../../../hmibuild/build.xml" /> <target name="check-proto-files"> <echo message="Checking whether compiled protobuf files are already present..." /> - <available file="build/ipaaca.pb.h" property="pb.present"/> + <available file="build/ipaaca/ipaaca.pb.h" property="pb.present"/> </target> <target name="-proto-yes" depends="check-proto-files" if="pb.present"> <echo message="Built protobuf files found, skipping compilation" /> diff --git a/ipaacalib/cpp/include/ipaaca/ipaaca.h b/ipaacalib/cpp/include/ipaaca/ipaaca.h index 541ec59b5d89b765c5bb75d52da025b256b0fef6..89e8a32224c663c57d6a2df8d19e9934ff423939 100644 --- a/ipaacalib/cpp/include/ipaaca/ipaaca.h +++ b/ipaacalib/cpp/include/ipaaca/ipaaca.h @@ -241,6 +241,14 @@ class CallbackIUCommission: public rsb::patterns::Server::Callback<protobuf::IUC public: boost::shared_ptr<int> call(const std::string& methodName, boost::shared_ptr<protobuf::IUCommission> update); }; +class CallbackIURetraction: public rsb::patterns::Server::Callback<protobuf::IURetraction, int> { + protected: + Buffer* _buffer; + public: + CallbackIURetraction(Buffer* buffer); + public: + boost::shared_ptr<int> call(const std::string& methodName, boost::shared_ptr<protobuf::IURetraction> update); +}; class OutputBuffer: public Buffer { //, public boost::enable_shared_from_this<OutputBuffer> {//{{{ friend class IU; @@ -451,6 +459,7 @@ class IUInterface {//{{{ std::string _payload_type; // default is "MAP" std::string _owner_name; bool _committed; + bool _retracted; IUAccessMode _access_mode; bool _read_only; //boost::shared_ptr<Buffer> _buffer; @@ -556,6 +565,7 @@ class RemotePushIU: public IUInterface {//{{{ void _apply_update(IUPayloadUpdate::ptr update); void _apply_link_update(IULinkUpdate::ptr update); void _apply_commission(); + void _apply_retraction(); typedef boost::shared_ptr<RemotePushIU> ptr; };//}}} diff --git a/ipaacalib/cpp/src/ipaaca.cc b/ipaacalib/cpp/src/ipaaca.cc index 855acd3722d0e8eeb57d081666de1d87b8c98711..f73a81adc4269b5d8005405a13df7284646a9c89 100644 --- a/ipaacalib/cpp/src/ipaaca.cc +++ b/ipaacalib/cpp/src/ipaaca.cc @@ -22,19 +22,22 @@ void Initializer::initialize_ipaaca_rsb_if_needed() Factory::getInstance().setDefaultParticipantConfig(config); boost::shared_ptr<IUConverter> iu_converter(new IUConverter()); - stringConverterRepository()->registerConverter(iu_converter); + converterRepository<std::string>()->registerConverter(iu_converter); boost::shared_ptr<IUPayloadUpdateConverter> payload_update_converter(new IUPayloadUpdateConverter()); - stringConverterRepository()->registerConverter(payload_update_converter); + converterRepository<std::string>()->registerConverter(payload_update_converter); boost::shared_ptr<IULinkUpdateConverter> link_update_converter(new IULinkUpdateConverter()); - stringConverterRepository()->registerConverter(link_update_converter); + converterRepository<std::string>()->registerConverter(link_update_converter); boost::shared_ptr<ProtocolBufferConverter<protobuf::IUCommission> > iu_commission_converter(new ProtocolBufferConverter<protobuf::IUCommission> ()); - stringConverterRepository()->registerConverter(iu_commission_converter); - + converterRepository<std::string>()->registerConverter(iu_commission_converter); + + boost::shared_ptr<ProtocolBufferConverter<protobuf::IURetraction> > iu_retraction_converter(new ProtocolBufferConverter<protobuf::IURetraction> ()); + converterRepository<std::string>()->registerConverter(iu_retraction_converter); + boost::shared_ptr<IntConverter> int_converter(new IntConverter()); - stringConverterRepository()->registerConverter(int_converter); + converterRepository<std::string>()->registerConverter(int_converter); _initialized = true; //IPAACA_TODO("initialize all converters") @@ -666,6 +669,21 @@ void InputBuffer::_handle_iu_events(EventPtr event) call_iu_event_handlers(it->second, false, IU_COMMITTED, it->second->category() ); // // + } else if (type == "ipaaca::protobuf::IURetraction") { + boost::shared_ptr<protobuf::IURetraction> update = boost::static_pointer_cast<protobuf::IURetraction>(event->getData()); + it = _iu_store.find(update->uid()); + if (it == _iu_store.end()) { + IPAACA_INFO("Ignoring RETRACTED message for an IU that we did not fully receive before") + return; + } + // + it->second->_revision = update->revision(); + it->second->_apply_retraction(); + // remove from InputBuffer FIXME: this is a crossover between retracted and deleted behavior + _iu_store.erase(it->first); + // and call the handler. IU reference is still valid for this call, although removed from buffer. + call_iu_event_handlers(it->second, false, IU_COMMITTED, it->second->category() ); + // } else { std::cout << "(Unhandled Event type " << type << " !)" << std::endl; return; @@ -681,7 +699,7 @@ void InputBuffer::_handle_iu_events(EventPtr event) // IUInterface//{{{ IUInterface::IUInterface() -: _buffer(NULL), _committed(false) +: _buffer(NULL), _committed(false), _retracted(false) { } @@ -945,6 +963,10 @@ void RemotePushIU::_apply_commission() { _committed = true; } +void RemotePushIU::_apply_retraction() +{ + _retracted = true; +} void Payload::_remotely_enforced_wipe() { _store.clear(); diff --git a/ipaacalib/java/manifest.mf b/ipaacalib/java/manifest.mf index bd2397be05ff81088ca51c679d46422d18327d47..486cc6ac6bb80b46a7956566c10f34e81b83cfd1 100644 --- a/ipaacalib/java/manifest.mf +++ b/ipaacalib/java/manifest.mf @@ -6,5 +6,5 @@ Specification-Title: IpaacaJava Specification-Version: 0.1 Specification-Vendor: ipaaca Implementation-Title: IpaacaJava -Implementation-Version: August 02 2012 01:27 PM +Implementation-Version: August 08 2012 11:03 AM Implementation-Vendor: ipaaca \ No newline at end of file diff --git a/ipaacalib/python/ivy.xml b/ipaacalib/python/ivy.xml index 9eb98898c4d5a552bd530ee05c39b90c9d942350..954ee17eb9d693a9506c885b298ca63a35d0fa3b 100644 --- a/ipaacalib/python/ivy.xml +++ b/ipaacalib/python/ivy.xml @@ -1,11 +1,11 @@ <ivy-module version="2.0"> <info organisation="ipaaca" module="IpaacaPython" /> <publications> - <artifact type="zip" ext="zip"/> + <artifact type="zip" ext="zip"/> </publications> <dependencies> - <dependency org="google" name="protobuf" rev="latest.release"/> - <dependency org="rsb" name="rsb" rev="latest.release"/> + <!-- dependency org="google" name="protobuf" rev="latest.release"/ --> + <!-- dependency org="rsb" name="rsb" rev="latest.release"/ --> </dependencies> - + </ivy-module> diff --git a/resolve.sh b/resolve.sh index 4802315eda0aaa7bd53d8e91bc25cd8df96b488d..9fc09833d849b26e0fd3c38d06df2c33ae8ad101 100755 --- a/resolve.sh +++ b/resolve.sh @@ -6,10 +6,12 @@ mkdir -p deps/bin mkdir -p deps/lib mkdir -p deps/include mkdir -p deps/scripts +mkdir -p deps/python for P in $PACKAGES; do cp -a ../$P/dist/bin/* deps/bin/ cp -a ../$P/dist/lib/* deps/lib/ cp -a ../$P/dist/include/* deps/include/ cp -a ../$P/dist/scripts/* deps/scripts/ + cp -a ../$P/dist/python/* deps/python/ done