00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037 #ifndef _TWEEK_BEAN_DELIVERY_SUBJECT_IMPL_H_
00038 #define _TWEEK_BEAN_DELIVERY_SUBJECT_IMPL_H_
00039
00040 #include <tweek/tweekConfig.h>
00041
00042 #include <map>
00043 #include <vector>
00044 #include <string>
00045
00046 #include <vpr/vpr.h>
00047 #include <vpr/Sync/Mutex.h>
00048 #include <vpr/Sync/Guard.h>
00049
00050 #include <tweek/CORBA/SubjectImpl.h>
00051 #include <tweek/CORBA/BeanDeliverySubject.h>
00052
00053
00054 namespace tweek
00055 {
00056
00066 class BeanDeliverySubjectImpl : public POA_tweek::BeanDeliverySubject,
00067 public tweek::SubjectImpl
00068 {
00069 public:
00075 struct BeanData
00076 {
00078 std::string filename;
00079
00084 std::string introspectorClassName;
00085
00087 std::vector<CORBA::Octet> fileContents;
00088 };
00089
00093 BeanDeliverySubjectImpl() : mHasActiveBean(false)
00094 {
00095 ;
00096 }
00097
00101 virtual ~BeanDeliverySubjectImpl()
00102 {
00103 ;
00104 }
00105
00112 virtual BeanNameList* getAllBeanNames();
00113
00128 virtual BeanInfo* getBean(const char* beanName);
00129
00135 virtual CORBA::Boolean hasActiveBean()
00136 {
00137 vpr::Guard<vpr::Mutex> lock(mActiveBeanLock);
00138 return mHasActiveBean;
00139 }
00140
00148 virtual BeanInfo* getActiveBeanInfo();
00149
00163 void addBean(const std::string& beanName, const BeanData& beanData);
00164
00173 void setActiveBean(const std::string& beanName);
00174
00186 void removeActiveBean();
00187
00188 tweek::BeanDeliverySubject_ptr _this()
00189 {
00190 return POA_tweek::BeanDeliverySubject::_this();
00191 }
00192
00193 private:
00194
00195
00196
00197 BeanDeliverySubjectImpl(const BeanDeliverySubjectImpl& subj);
00198
00199 BeanDeliverySubjectImpl& operator=(const BeanDeliverySubjectImpl& subj)
00200 {
00201 return *this;
00202 }
00203
00205 std::map<std::string, BeanData> mBeanCollection;
00206 vpr::Mutex mBeanCollectionLock;
00207
00208 CORBA::Boolean mHasActiveBean;
00209 std::string mActiveBean;
00210 vpr::Mutex mActiveBeanLock;
00211 };
00212
00213 }
00214
00215
00216 #endif