00001 /* -*- Mode: C++ -*- 00002 * Worldvisions Weaver Software: 00003 * Copyright (C) 2002 Net Integration Technologies, Inc. 00004 * 00005 * A UniConfGen that reconnects to an inner generator whenever the inner 00006 * generator is no longer OK. 00007 */ 00008 #ifndef __UNIRETRYGEN_H 00009 #define __UNIRETRYGEN_H 00010 00011 #include "unifiltergen.h" 00012 #include "wvtimeutils.h" 00013 #include "wvlog.h" 00014 00019 class UniRetryGen : public UniFilterGen 00020 { 00021 private: 00022 00023 WvLog log; 00024 00025 WvString moniker; 00026 time_t retry_interval_ms; 00027 00028 WvTime next_reconnect_attempt; 00029 00030 void maybe_disconnect(); 00031 void maybe_reconnect(); 00032 00033 public: 00034 00035 UniRetryGen(WvStringParm _moniker, time_t _retry_internal_ms = 5000); 00036 00037 /***** Overridden methods *****/ 00038 00039 virtual void commit(); 00040 virtual bool refresh(); 00041 virtual void prefetch(const UniConfKey &key, bool recursive); 00042 virtual void flush_buffers() { } 00043 virtual WvString get(const UniConfKey &key); 00044 virtual void set(const UniConfKey &key, WvStringParm value); 00045 virtual bool exists(const UniConfKey &key); 00046 virtual bool haschildren(const UniConfKey &key); 00047 virtual bool isok(); 00048 virtual Iter *iterator(const UniConfKey &key); 00049 virtual Iter *recursiveiterator(const UniConfKey &key); 00050 }; 00051 00052 #endif //__UNIRETRYGEN_H