product_i.h

Go to the documentation of this file.
00001 // OSB library ********************************************* -*- C++ -*-
00006 /*
00007   AUTHOR(S): Rene Schneider (rsn)
00008              Stephan Broennimann (vb)
00009 
00010   RCS information
00011    $Name: OSB_060808 $
00012    $Revision: 1.63 $
00013 
00014   License
00015    OSB rating and billing library for communication networks
00016    Copyright (C) 2004, 2005, 2006  OSB systems
00017 
00018    This file may be distributed and/or modify under the terms of the
00019    GNU General Public License (GPL) as published by the Free Software
00020    Foundation which is provided in the file LICENSE.GPL included in the
00021    packaging of this file.
00022 
00023    The file is distributed in the hope that it will be useful, but WITHOUT
00024    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00025    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
00026    for more details.
00027 
00028    Holders of a OSB Commercial License may use this file under the terms
00029    and conditions of this commercial license.
00030  */
00031 #ifndef _PRODUCT_I_H_
00032 #define _PRODUCT_I_H_
00033 
00034 // *********************************************************************
00035 // included header files
00036 // + standard includes
00037 
00038 // + local headers
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 // class declarations
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         // Hint: needed by ProductPart
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     // class ProductWriter_i
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 } //namespace OSB_CORBA
00515 
00516 #endif

Generated on Sat Sep 2 14:25:52 2006 for OSB Library by  doxygen 1.4.7