00001
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 #ifndef _PRODUCT_I_H_
00032 #define _PRODUCT_I_H_
00033
00034
00035
00036
00037
00038
00039 #include "utf8string.h"
00040
00041 #include "productS.h"
00042 #include "servantlocators.h"
00043 #include "productcatalogue_i.h"
00044 #include "productpart_i.h"
00045
00046
00047
00048
00049 namespace OSB_LIB {
00050 class ProductCatalogue;
00051 class Product;
00052 class ProductNode;
00053 class ProductItem;
00054
00055 class DescriptionItem;
00056 class CallingCardItem;
00057 class ServiceItem;
00058 class CreditItem;
00059 class TariffSystemItem;
00060 class ResourceItem;
00061 }
00062
00063 namespace OSB_CORBA {
00064
00065 using namespace corba::common;
00066 using namespace corba::pcat;
00067 using namespace corba::pcat::pd;
00068 using namespace corba::pcat::pp;
00069
00077 class Product_i : public virtual POA_corba::pcat::pd::Product
00078 {
00079 public:
00080
00082 static const std::string IFC;
00083
00085 Product_i (
00086 ProductCatalogue_i& pcati,
00087 const OSB_LIB::Product::Oid& pdId,
00088 PortableServer::POA_ptr ppPoa
00089 );
00090
00097 virtual ~Product_i();
00098
00100
00101 const OSB_LIB::Product::Oid& pdId() const;
00102
00110
00117 virtual ProductId id()
00118 throw (CORBA::SystemException, OsbCorbaException);
00119
00127 virtual Utf8String* name()
00128 throw (CORBA::SystemException, OsbCorbaException);
00129
00138 virtual Utf8String* desc()
00139 throw (CORBA::SystemException, OsbCorbaException);
00140
00148 virtual CfgStatus status()
00149 throw (CORBA::SystemException, OsbCorbaException);
00150
00159 virtual Date startDate()
00160 throw (CORBA::SystemException, OsbCorbaException);
00161
00170 virtual Date endDate()
00171 throw (CORBA::SystemException, OsbCorbaException);
00172
00174
00176
00177
00186 virtual ProductPart_ptr getPart(
00187 const ProductPartId& id
00188 ) throw (CORBA::SystemException, OsbCorbaException);
00189
00195 virtual ProductPartSeq* getParts()
00196 throw (CORBA::SystemException);
00198
00209 virtual ProductWriter_ptr getWriter()
00210 throw (CORBA::SystemException);
00211
00212 protected:
00213 struct ServantListElement;
00214 friend struct ServantListElement;
00215 typedef OSB_LIB::Guard Guard;
00216 typedef Locators::Key ServantKey;
00217
00218 struct ServantListElement {
00219 ServantKey key;
00220 ProductPartBase_i* servant;
00221 ServantListElement(
00222 ServantKey k,
00223 ProductPartBase_i* s
00224 );
00225 };
00226 typedef std::list<ServantListElement> ServantList;
00227
00234 virtual Guard lock();
00235
00245 virtual ServantList::iterator retrieveServant (
00246 const OSB_LIB::ProductNode::Oid& nodeId
00247 );
00248
00249 private:
00268 virtual OSB_LIB::PcatLockMgr::ProductRg lockProduct()
00269 throw (OsbCorbaException);
00270 public:
00277 void deleteServants();
00278
00296 virtual ProductPart_ptr getPartServant(
00297 const OSB_LIB::Product::Oid& pId,
00298 const OSB_LIB::ProductNode& node
00299 ) throw (OsbCorbaException);
00300
00301 protected:
00303 ProductCatalogue_i& pcati_;
00305 ServantList servantList_;
00307 PortableServer::POA_ptr ppPoa_;
00308
00309 private:
00311 const OSB_LIB::Product::Oid pdId_;
00313 OSB_LIB::Mutex mutex_;
00315 OSB_LIB::MutexUnlock unlock_;
00316 };
00317
00318
00319
00325 class ProductWriter_i :
00326 public virtual POA_corba::pcat::pd::ProductWriter,
00327 public virtual Product_i
00328 {
00329 public:
00330
00332 static const std::string IFC;
00333
00335 ProductWriter_i (
00336 Product_i* prodi,
00337 const OSB_LIB::Product* prod,
00338 ProductCatalogue_i& pcati,
00339 PortableServer::POA_ptr ppPoa
00340 );
00341
00349 virtual ~ProductWriter_i ();
00350
00352
00353
00359 virtual void setName (const Utf8String& name)
00360 throw (CORBA::SystemException);
00361
00367 virtual void setDesc (const Utf8String& desc)
00368 throw (CORBA::SystemException);
00369
00375 virtual void setStartDate(const Date& start)
00376 throw (CORBA::SystemException, OsbCorbaException);
00377
00383 virtual void setEndDate(const Date& end)
00384 throw (CORBA::SystemException, OsbCorbaException);
00385
00387
00389
00390
00399 virtual ProductPartWriter_ptr getWritablePart(
00400 const ProductPartId& id
00401 ) throw (CORBA::SystemException, OsbCorbaException);
00402
00413 virtual ProductPartWriter_ptr addPart(
00414 const PpTypeId& pptypeid,
00415 const OSB_LIB::ProductNode::Oid& parentId
00416 ) throw (CORBA::SystemException, OsbCorbaException);
00417
00426 virtual ProductPartWriter_ptr addPart(
00427 const PpTypeId& pptypeid
00428 ) throw (CORBA::SystemException, OsbCorbaException);
00429
00438 virtual void removePart(const ProductPartId& id)
00439 throw (CORBA::SystemException, OsbCorbaException);
00440
00447 virtual void commitChanges()
00448 throw (CORBA::SystemException, OsbCorbaException);
00449
00451
00452 private:
00462 ProductPartWriter_ptr getPartWriter(
00463 const ProductPartId& id
00464 ) throw (OsbCorbaException);
00465
00475 ProductPartWriter_ptr createPartWriter(
00476 OSB_LIB::ProductNode& node
00477 ) throw (OsbCorbaException);
00478
00490 virtual void checkDowncast(
00491 OSB_LIB::ProductItem* item,
00492 const std::string& module
00493 ) throw (OsbCorbaException);
00494
00502 virtual OSB_LIB::PcatLockMgr::ProductRg lockProduct()
00503 throw(OSB_CORBA::OsbCorbaException);
00504
00505 private:
00507 Product_i* prodi_;
00509 OSB_LIB::Product* prod_;
00511 PortableServer::POA_ptr writerPoa_;
00512 };
00513
00514 }
00515
00516 #endif