00001 #ifndef maciSimpleClient_H
00002 #define maciSimpleClient_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __cplusplus
00018 #error This is a C++ include file and cannot be used from plain C
00019 #endif
00020
00021 #include <acsutil.h>
00022 #include <maciClientExport.h>
00023
00024 #include <logging.h>
00025
00026 #include <maciS.h>
00027 #include <ace/SString.h>
00028
00029 #include "maciSimpleClientThreadHook.h"
00030 #include <ACSErrTypeCommon.h>
00031 #include <maciErrType.h>
00032 #include <ACSErrTypeCORBA.h>
00033
00034 #include <acsComponentSmartPtr.h>
00035 #include <maciContainerServices.h>
00036 #include <acscomponentC.h>
00037
00038 namespace maci {
00039
00040 class SimpleClient;
00041
00042
00043 template<typename T, class H = SimpleClient>
00044 class ComponentSmartPtr : public SmartPtr<T, H, Loki::RefCountedMTAdj<Loki::ObjectLevelLockable>::RefCountedMT,
00045 Loki::DisallowConversion, Loki::NoCheck, ComponentStorage, Loki::LOKI_DEFAULT_CONSTNESS> {
00046 public:
00047
00051 ComponentSmartPtr()
00052 {}
00053
00063 ComponentSmartPtr(H* h, bool s, T* p)
00064 {
00065 setValues(h, s, p);
00066 }
00067
00068
00069 };
00070
00071
00079 class maciClient_EXPORT SimpleClient :
00080 public virtual POA_maci::Client,
00081 public virtual PortableServer::RefCountServantBase
00082 {
00083
00084 public:
00085
00089 SimpleClient ();
00090
00094 virtual ~SimpleClient ();
00095
00100 int destroy();
00101
00106 int initCORBA(int argc, char * argv[]);
00107
00111 CORBA::ORB_ptr getORB();
00112
00117 int doneCORBA();
00118
00124 int login();
00125
00130 int logout();
00131
00143 int init(int argc, char *argv[]);
00144
00150 int run (ACE_Time_Value &tv
00151 );
00152
00157 int run ();
00158
00159 static void initThread(const char * threadName);
00160 static void doneThread();
00161
00166 maci::Manager_ptr manager();
00167
00172 maci::Handle handle();
00173
00185 CORBA::Object_ptr getComponent(const char *name, const char *domain, bool activate);
00186
00192 CORBA::Object_ptr get_object(const char *name, const char *domain, bool activate)
00193 {
00194 return getComponent(name, domain, activate);
00195 }
00196
00197
00214 template<class T>
00215 T* getComponent(const char *name, const char *domain, bool activate);
00216
00224 CORBA::Object* getDynamicComponent(maci::ComponentSpec compSpec, bool markAsDefault);
00225
00233 template<class T>
00234 T* getDynamicComponent(maci::ComponentSpec compSpec, bool markAsDefault);
00251 template<class T>
00252 ComponentSmartPtr<T> getComponentSmartPtr(const char *name, const char *domain, bool activate);
00253
00261 template<class T>
00262 ComponentSmartPtr<T> getDynamicComponentSmartPtr(maci::ComponentSpec compSpec, bool markAsDefault);
00268 template<class T>
00269 T* get_object(const char *name, const char *domain, bool activate)
00270 {
00271 return getComponent<T>(name, domain, activate);
00272 }
00273
00281 CORBA::Object* getComponentNonSticky(const char *name);
00282
00291 template <class T>
00292 T* getComponentNonSticky(const char *name);
00293
00302 template <class T>
00303 ComponentSmartPtr<T> getComponentNonStickySmartPtr(const char *name);
00304
00312 long releaseComponent(const char* name);
00313
00325 template<class T>
00326 T* getDefaultComponent(const char* idlType);
00327
00339 template <typename T>
00340 SmartPtr<T> getDefaultComponentSmartPtr(const char* idlType);
00341
00353 CORBA::Object* getCORBADefaultComponent(const char* idlType);
00354
00355
00371 template<class T>
00372 T* getCollocatedComponent(maci::ComponentSpec compSpec,
00373 bool markAsDefault, const char* targetComponent);
00374
00390 template <typename T>
00391 SmartPtr<T> getCollocatedComponentSmartPtr(maci::ComponentSpec compSpec, bool markAsDefault, const char* targetComponent);
00392
00393
00408 CORBA::Object* getCORBACollocatedComponent(maci::ComponentSpec compSpec,
00409 bool markAsDefault, const char* targetComponent);
00410
00425 ACE_CString_Vector findComponents(const char *nameWilcard,
00426 const char *typeWildcard);
00427
00435 maci::ComponentInfo getComponentDescriptor(
00436 const char* componentName);
00437
00441 ContainerServices* getContainerServices();
00442
00443
00452 static SimpleClient * getInstance()
00453 {
00454 return m_simpleClientInstance;
00455 }
00456
00457
00458
00459
00460
00464 virtual char * name ();
00465
00470 virtual void disconnect ();
00471
00481 virtual ::maci::AuthenticationData * authenticate (
00482 ::maci::ExecutionId execution_id, const char * question);
00483
00489 virtual void message (CORBA::Short type,
00490 const char * message
00491 );
00492
00499 virtual void taggedmessage (CORBA::Short type,
00500 CORBA::Short tag,
00501 const char * message
00502 );
00503
00508 virtual void components_available (const maci::ComponentInfoSeq & cobs
00509 );
00510
00515 virtual void components_unavailable (const maci::stringSeq & cob_names
00516 );
00517
00518
00527 virtual CORBA::Boolean ping ();
00528
00531 static LoggingProxy * getLoggerProxy()
00532 {
00533 return m_logger;
00534 }
00535
00538 static const char * getProcessName()
00539 {
00540 return m_processName.c_str();
00541 }
00542
00543 private:
00544
00546 maci::Manager_var m_manager;
00547
00549 maci::Handle m_handle;
00550
00552 bool m_initialized;
00553
00555 bool m_loggedin;
00556
00558 PortableServer::POA_var m_poaRoot;
00559
00561 PortableServer::POA_var m_poaPersistent;
00562
00564 PortableServer::POA_var m_poaTransient;
00565
00567 CORBA::ORB_var m_orb;
00568
00570 static LoggingProxy* m_logger;
00571
00573 static ACE_CString m_processName;
00574
00577 static maci::SimpleClient * m_simpleClientInstance;
00578
00580 static int32_t m_simpleClientCreatedCounter;
00581
00583 maci::SimpleClientThreadHook m_simpleClientThreadHook;
00584
00586 maci::ExecutionId m_executionId;
00587
00589 ACS::Time m_startTime;
00590
00592 ContainerServices* m_ContServ;
00593 };
00594
00595
00596
00597
00598
00599
00600
00601
00602 template<class T>
00603 T* SimpleClient::getComponent(const char *name, const char *domain, bool activate)
00604 {
00605 if(!m_initialized)
00606 {
00607 ACSErrTypeCommon::NotInitializedExImpl notInitEx( __FILE__, __LINE__,
00608 "maci::SimpleClient::getComponent<>");
00609 notInitEx.setName("SimpleClient");
00610 maciErrType::CannotGetComponentExImpl ex( notInitEx, __FILE__, __LINE__,
00611 "maci::SimpleClient::getComponent<>");
00612 name ? ex.setCURL(name) : ex.setCURL("NULL");
00613 throw ex;
00614 }
00615
00616 if(!name)
00617 {
00618 ACSErrTypeCommon::NullPointerExImpl nullEx(__FILE__, __LINE__,
00619 "maci::SimpleClient::getComponent<>");
00620 nullEx.setVariable("(parameter) name");
00621 maciErrType::CannotGetComponentExImpl ex(nullEx, __FILE__, __LINE__,
00622 "maci::SimpleClient::getComponent<>");
00623 ex.setCURL("NULL");
00624 throw ex;
00625 }
00626
00631 const char* curl_str = "curl://";
00632
00633 ACE_CString curl = "";
00634 if(strncmp(name, curl_str, strlen(curl_str)) != 0 )
00635 {
00636 curl += curl_str;
00637 if (domain)
00638 curl += domain;
00639
00640 curl += ACE_CString("/");
00641 }
00642 curl += name;
00643
00644 ACS_SHORT_LOG((LM_DEBUG, "Getting component: '%s'. Creating it...", curl.c_str()));
00645
00646 try
00647 {
00649 CORBA::Object_var obj = manager()->get_service(m_handle, curl.c_str(), activate);
00650 T* tmpRef = T::_narrow(obj);
00651 if (CORBA::is_nil(tmpRef))
00652 {
00653 releaseComponent(name);
00654 ACSErrTypeCORBA::NarrowFailedExImpl ex(__FILE__, __LINE__, "maci::SimpleClient<>::getComponent");
00655 ex.setNarrowType(typeid(T).name());
00656 throw ex;
00657 }
00658 return tmpRef;
00659 }
00660 catch(maciErrType::NoPermissionEx &_ex)
00661 {
00662 maciErrType::CannotGetComponentExImpl ex(_ex, __FILE__, __LINE__,
00663 "maci::SimpleClient::getComponent<>");
00664 ex.setCURL(name);
00665 throw ex;
00666 }
00667 catch(maciErrType::CannotGetComponentEx &_ex)
00668 {
00669 maciErrType::CannotGetComponentExImpl ex(_ex, __FILE__, __LINE__,
00670 "maci::SimpleClient::getComponent<>");
00671 ex.setCURL(name);
00672 throw ex;
00673 }
00674 catch(maciErrType::ComponentNotAlreadyActivatedEx &_ex)
00675 {
00676 maciErrType::CannotGetComponentExImpl ex(_ex, __FILE__, __LINE__,
00677 "maci::SimpleClient::getComponent<>");
00678 ex.setCURL(name);
00679 throw ex;
00680 }
00681 catch(maciErrType::ComponentConfigurationNotFoundEx &_ex)
00682 {
00683 maciErrType::CannotGetComponentExImpl ex(_ex, __FILE__, __LINE__,
00684 "maci::SimpleClient::getComponent<>");
00685 ex.setCURL(name);
00686 throw ex;
00687 }
00688 catch (ACSErr::ACSbaseExImpl &ex)
00689 {
00690 maciErrType::CannotGetComponentExImpl lex(ex, __FILE__, __LINE__,
00691 "maci::SimpleClient<T>::getComponent");
00692 lex.setCURL(name);
00693 throw lex;
00694 }
00695 catch( CORBA::SystemException &_ex )
00696 {
00697 ACSErrTypeCommon::CORBAProblemExImpl corbaProblemEx(__FILE__, __LINE__,
00698 "maci::SimpleClient::getComponent<>");
00699 corbaProblemEx.setMinor(_ex.minor());
00700 corbaProblemEx.setCompletionStatus(_ex.completed());
00701 corbaProblemEx.setInfo(_ex._info().c_str());
00702 maciErrType::CannotGetComponentExImpl ex(corbaProblemEx, __FILE__, __LINE__,
00703 "maci::SimpleClient::getComponent<>");
00704 ex.setCURL(name);
00705 throw ex;
00706 }
00707 catch(...)
00708 {
00709 ACSErrTypeCommon::UnexpectedExceptionExImpl uex(__FILE__, __LINE__,
00710 "maci::SimpleClient::getComponent<>");
00711 maciErrType::CannotGetComponentExImpl ex(uex, __FILE__, __LINE__,
00712 "maci::SimpleClient::getComponent<>");
00713 ex.setCURL(name);
00714 throw ex;
00715 }
00716 }
00717
00718
00719
00720
00721 template<class T>
00722 ComponentSmartPtr<T> SimpleClient::getComponentSmartPtr(const char *name, const char *domain, bool activate)
00723 {
00724 return ComponentSmartPtr<T>(this, true, this->getComponent<T>(name, domain, activate));
00725 }
00726
00727
00728
00729 template<class T>
00730 ComponentSmartPtr<T> SimpleClient::getDynamicComponentSmartPtr(maci::ComponentSpec compSpec, bool markAsDefault)
00731 {
00732 return ComponentSmartPtr<T>(this, true, this->getDynamicComponent<T>(compSpec,markAsDefault));
00733 }
00734
00735
00736
00737
00738
00739
00740 template<class T>
00741 T* SimpleClient::getDynamicComponent(maci::ComponentSpec compSpec, bool markAsDefault)
00742 {
00743
00744
00745
00746
00747
00748
00749 ComponentInfo_var cInfo;
00750 ACS_TRACE("maci::SimpleClient<>::getDynamicComponent");
00751 try
00752 {
00753 cInfo = m_manager->get_dynamic_component(m_handle,
00754 compSpec,
00755 markAsDefault);
00756 CORBA::Object_var obj = cInfo->reference;
00757 if (CORBA::is_nil(obj.in()))
00758 {
00759 ACSErrTypeCORBA::CORBAReferenceNilExImpl ex(__FILE__, __LINE__,
00760 "maci::SimpleClient<>::getDynamicComponent");
00761 ex.setVariable("cInfo->reference");
00762 throw ex;
00763 }
00764
00765
00766 T* tmpRef = T::_narrow(obj);
00767 if(CORBA::is_nil(tmpRef))
00768 { ACSErrTypeCORBA::NarrowFailedExImpl ex(__FILE__, __LINE__, "maci::SimpleClient<>::getDynamicComponent");
00769
00770 throw ex;
00771 }
00772 return tmpRef;
00773
00774 }
00775 catch (maciErrType::NoPermissionEx &ex)
00776 {
00777 maciErrType::NoPermissionExImpl lex(ex, __FILE__, __LINE__,
00778 "maci::SimpleClient<>::getDynamicComponent");
00779 throw lex;
00780 }
00781 catch (maciErrType::IncompleteComponentSpecEx &ex)
00782 {
00783 maciErrType::IncompleteComponentSpecExImpl lex(ex, __FILE__, __LINE__,
00784 "maci::SimpleClient<>::getDynamicComponent");
00785 lex.setCURL(compSpec.component_name.in());
00786 throw lex;
00787 }
00788 catch (maciErrType::InvalidComponentSpecEx &ex)
00789 {
00790 maciErrType::InvalidComponentSpecExImpl lex(ex, __FILE__, __LINE__,
00791 "maci::SimpleClient<>::getDynamicComponent");
00792 throw lex;
00793 }
00794 catch (maciErrType::ComponentSpecIncompatibleWithActiveComponentEx &ex)
00795 {
00796 maciErrType::ComponentSpecIncompatibleWithActiveComponentExImpl lex(ex, __FILE__, __LINE__,
00797 "maci::SimpleClient<>::getDynamicComponent");
00798 lex.setCURL(compSpec.component_name.in());
00799 throw lex;
00800 }
00801 catch (maciErrType::CannotGetComponentEx &ex)
00802 {
00803 maciErrType::CannotGetComponentExImpl lex(ex, __FILE__, __LINE__,
00804 "maci::SimpleClient<>::getDynamicComponent");
00805 lex.setCURL(compSpec.component_name.in());
00806 throw lex;
00807 }
00808 catch(ACSErr::ACSbaseExImpl &ex)
00809 {
00810 maciErrType::CannotGetComponentExImpl lex(ex, __FILE__, __LINE__,
00811 "maci::SimpleClient<>::getDynamicComponent");
00812 lex.setCURL(compSpec.component_name.in());
00813 throw lex;
00814 }
00815 catch( CORBA::SystemException &ex )
00816 {
00817 ACSErrTypeCommon::CORBAProblemExImpl corbaProblemEx(__FILE__, __LINE__,
00818 "maci::SimpleClient<>::getDynamicComponent");
00819 corbaProblemEx.setMinor(ex.minor());
00820 corbaProblemEx.setCompletionStatus(ex.completed());
00821 corbaProblemEx.setInfo(ex._info().c_str());
00822
00823 maciErrType::CannotGetComponentExImpl lex(corbaProblemEx, __FILE__, __LINE__,
00824 "maci::SimpleClient<>::getDynamicComponent");
00825 lex.setCURL(compSpec.component_name.in());
00826 throw lex;
00827 }
00828 catch (...)
00829 {
00830 ACSErrTypeCommon::UnexpectedExceptionExImpl uex(__FILE__, __LINE__,
00831 "maci::SimpleClient<>::getDynamicComponent");
00832 maciErrType::CannotGetComponentExImpl lex(uex, __FILE__, __LINE__,
00833 "maci::SimpleClient<>::getDynamicComponent");
00834 lex.setCURL(compSpec.component_name.in());
00835 throw lex;
00836 }
00837 }
00838
00839
00840
00841
00842
00843 template<class T>
00844 T* SimpleClient::getComponentNonSticky(const char *name)
00845 {
00846 if(!m_initialized)
00847 {
00848 ACSErrTypeCommon::NotInitializedExImpl notInitEx( __FILE__, __LINE__,
00849 "maci::SimpleClient::getComponentNonSticky<>");
00850 notInitEx.setName("SimpleClient");
00851 maciErrType::CannotGetComponentExImpl ex( notInitEx, __FILE__, __LINE__,
00852 "maci::SimpleClient::getComponentNonSticky<>");
00853 name ? ex.setCURL(name) : ex.setCURL("NULL");
00854 throw ex;
00855 }
00856
00857 if(!name)
00858 {
00859 ACSErrTypeCommon::NullPointerExImpl nullEx(__FILE__, __LINE__,
00860 "maci::SimpleClient::getComponentNonSticky<>");
00861 nullEx.setVariable("(parameter) name");
00862 maciErrType::CannotGetComponentExImpl ex(nullEx, __FILE__, __LINE__,
00863 "maci::SimpleClient::getComponentNonSticky<>");
00864 ex.setCURL("NULL");
00865 throw ex;
00866 }
00867
00868 ACS_SHORT_LOG((LM_DEBUG, "Getting component non sticky: '%s'. Creating it...", name));
00869
00870 try
00871 {
00872 CORBA::Object_var obj = manager()->get_component_non_sticky(m_handle, name);
00873 T* tmpRef = T::_narrow(obj);
00874 if (CORBA::is_nil(tmpRef))
00875 {
00876
00877 ACSErrTypeCORBA::NarrowFailedExImpl ex(__FILE__, __LINE__, "maci::SimpleClient<>::getComponentNonSticky");
00878 ex.setNarrowType(typeid(T).name());
00879 throw ex;
00880 }
00881 return tmpRef;
00882 }
00883 catch(maciErrType::NoPermissionEx &_ex)
00884 {
00885 maciErrType::CannotGetComponentExImpl ex(_ex, __FILE__, __LINE__,
00886 "maci::SimpleClient::getComponentNonSticky<>");
00887 ex.setCURL(name);
00888 throw ex;
00889 }
00890 catch(maciErrType::CannotGetComponentEx &_ex)
00891 {
00892 maciErrType::CannotGetComponentExImpl ex(_ex, __FILE__, __LINE__,
00893 "maci::SimpleClient::getComponentNonSticky<>");
00894 ex.setCURL(name);
00895 throw ex;
00896 }
00897 catch(maciErrType::ComponentNotAlreadyActivatedEx &_ex)
00898 {
00899 maciErrType::CannotGetComponentExImpl ex(_ex, __FILE__, __LINE__,
00900 "maci::SimpleClient::getComponentNonSticky<>");
00901 ex.setCURL(name);
00902 throw ex;
00903 }
00904 catch (ACSErr::ACSbaseExImpl &ex)
00905 {
00906 maciErrType::CannotGetComponentExImpl lex(ex, __FILE__, __LINE__,
00907 "maci::SimpleClient<>::getComponentNonSticky");
00908 lex.setCURL(name);
00909 throw lex;
00910 }
00911 catch( CORBA::SystemException &_ex )
00912 {
00913 ACSErrTypeCommon::CORBAProblemExImpl corbaProblemEx(__FILE__, __LINE__,
00914 "maci::SimpleClient::getComponentNonSticky<>");
00915 corbaProblemEx.setMinor(_ex.minor());
00916 corbaProblemEx.setCompletionStatus(_ex.completed());
00917 corbaProblemEx.setInfo(_ex._info().c_str());
00918 maciErrType::CannotGetComponentExImpl ex(corbaProblemEx, __FILE__, __LINE__,
00919 "maci::SimpleClient::getComponent<>");
00920 ex.setCURL(name);
00921 throw ex;
00922 }
00923 catch(...)
00924 {
00925 ACSErrTypeCommon::UnexpectedExceptionExImpl uex(__FILE__, __LINE__,
00926 "maci::SimpleClient::getComponentNonSticky<>");
00927 maciErrType::CannotGetComponentExImpl ex(uex, __FILE__, __LINE__,
00928 "maci::SimpleClient::getComponentNonSticky<>");
00929 ex.setCURL(name);
00930 throw ex;
00931 }
00932 }
00933
00934
00935
00936
00937 template<class T>
00938 ComponentSmartPtr<T> SimpleClient::getComponentNonStickySmartPtr(const char *name)
00939 {
00940 return ComponentSmartPtr<T>(this, false, this->getComponentNonSticky<T>(name));
00941 }
00942
00943 template<class T>
00944 T* SimpleClient::getDefaultComponent(const char* idlType)
00945 {
00946 CORBA::Object* obj =T::_nil();
00947
00948 ACS_TRACE("maci::SimpleClient::getDefaultComponent");
00949
00950 try{
00951 obj = getCORBADefaultComponent(idlType);
00952 T* tmpRef = T::_narrow(obj);
00953 if (tmpRef==T::_nil()){
00954
00955
00956 ACS::ACSComponent* tComp = ACS::ACSComponent::_narrow(obj);
00957 if(tComp!=ACS::ACSComponent::_nil()){
00958 char *cName = tComp->name();
00959 releaseComponent(cName);
00960 CORBA::string_free(cName);
00961 }
00962 ACSErrTypeCORBA::NarrowFailedExImpl ex(__FILE__, __LINE__,
00963 "maci::SimpleClient::getDefaultComponent");
00964 ex.setNarrowType(typeid(T).name());
00965 throw ex;
00966 }
00967 return tmpRef;
00968 }
00969 catch(maciErrType::NoPermissionEx &_ex)
00970 {
00971 throw maciErrType::NoPermissionExImpl(__FILE__, __LINE__,
00972 "maci::SimpleClient::getDefaultComponent");
00973 }
00974 catch (maciErrType::NoDefaultComponentExImpl &ex)
00975 {
00976 maciErrType::NoDefaultComponentExImpl lex(ex,
00977 __FILE__, __LINE__,
00978 "maci::SimpleClient::getDefaultComponent");
00979 throw lex;
00980 }
00981 catch (maciErrType::CannotGetComponentExImpl &ex)
00982 {
00983 maciErrType::CannotGetComponentExImpl lex(ex, __FILE__, __LINE__,
00984 "maci::SimpleClient::getDefaultComponent");
00985 throw lex;
00986 }
00987 catch (ACSErr::ACSbaseExImpl &ex)
00988 {
00989 maciErrType::CannotGetComponentExImpl lex(ex, __FILE__, __LINE__,
00990 "maci::SimpleClient::getDefaultComponent");
00991 throw lex;
00992 }
00993 catch (...)
00994 {
00995 ACSErrTypeCommon::UnexpectedExceptionExImpl uex(__FILE__, __LINE__,
00996 "maci::SimpleClient::getDefaultComponent");
00997 maciErrType::CannotGetComponentExImpl lex(uex, __FILE__, __LINE__,
00998 "maci::SimpleClient::getDefaultComponent");
00999 throw lex;
01000 }
01001 }
01002
01003 template <typename T>
01004 maci::SmartPtr<T> SimpleClient::getDefaultComponentSmartPtr(
01005 const char* idlType)
01006 {
01007 return maci::SmartPtr<T>(this, true, this->getDefaultComponent<T>(idlType));
01008 }
01009
01010 template<class T>
01011 T* SimpleClient::getCollocatedComponent(maci::ComponentSpec compSpec,
01012 bool markAsDefault, const char* targetComponent)
01013 {
01014 CORBA::Object* obj =T::_nil();
01015 ACS_TRACE("maci::SimpleClient::getCollocatedComponent");
01016 try{
01017 obj = getCORBACollocatedComponent(compSpec,markAsDefault,targetComponent);
01018 T* tmpRef = T::_narrow(obj);
01019 if (tmpRef==T::_nil()){
01020 ACS::ACSComponent* tComp = ACS::ACSComponent::_narrow(obj);
01021 if ( tComp!=ACS::ACSComponent::_nil() ){
01022 char *cName = tComp->name();
01023 releaseComponent(cName);
01024 CORBA::string_free(cName);
01025 }
01026 else{
01027
01028 }
01029 ACSErrTypeCORBA::NarrowFailedExImpl ex(__FILE__, __LINE__,
01030 "maci::SimpleClient::getCollocatedComponent");
01031 ex.setNarrowType(typeid(T).name());
01032 throw ex;
01033 }
01034 return tmpRef;
01035 }
01036 catch (maciErrType::NoPermissionExImpl &ex){
01037 maciErrType::NoPermissionExImpl lex(ex, __FILE__, __LINE__,
01038 "maci::SimpleClient::getCollocatedComponent");
01039 throw lex;
01040 }
01041 catch (maciErrType::IncompleteComponentSpecExImpl &ex){
01042 maciErrType::IncompleteComponentSpecExImpl lex(ex, __FILE__, __LINE__,
01043 "maci::SimpleClient::getCollocatedComponent");
01044 lex.setCURL(compSpec.component_name.in());
01045 throw lex;
01046 }
01047 catch (maciErrType::InvalidComponentSpecExImpl &ex){
01048 maciErrType::InvalidComponentSpecExImpl lex(ex, __FILE__, __LINE__,
01049 "maci::SimpleClient::getCollocatedComponent");
01050 throw lex;
01051 }
01052 catch (maciErrType::ComponentSpecIncompatibleWithActiveComponentExImpl &ex){
01053 maciErrType::ComponentSpecIncompatibleWithActiveComponentExImpl lex(ex, __FILE__, __LINE__,
01054 "maci::SimpleClient::getCollocatedComponent");
01055 lex.setCURL(compSpec.component_name.in());
01056 throw lex;
01057 }
01058 catch (maciErrType::CannotGetComponentExImpl &ex){
01059 maciErrType::CannotGetComponentExImpl lex(ex, __FILE__, __LINE__,
01060 "maci::SimpleClient::getCollocatedComponent");
01061 lex.setCURL(compSpec.component_name.in());
01062 throw lex;
01063 }
01064 catch (ACSErr::ACSbaseExImpl &ex){
01065 maciErrType::CannotGetComponentExImpl lex(ex, __FILE__, __LINE__,
01066 "maci::SimpleClient::getCollocatedComponent");
01067 lex.setCURL(compSpec.component_name.in());
01068 throw lex;
01069 }
01070 catch (...){
01071 ACSErrTypeCommon::UnexpectedExceptionExImpl uex(__FILE__, __LINE__,
01072 "maci::SimpleClient::getCollocatedComponent");
01073 maciErrType::CannotGetComponentExImpl lex(uex, __FILE__, __LINE__,
01074 "maci::SimpleClient::getCollocatedComponent");
01075 lex.setCURL(compSpec.component_name.in());
01076 throw lex;
01077 }
01078 }
01079
01080 template <typename T>
01081 maci::SmartPtr<T> SimpleClient::getCollocatedComponentSmartPtr(
01082 maci::ComponentSpec compSpec, bool markAsDefault,
01083 const char* targetComponent)
01084 {
01085 return maci::SmartPtr<T>(this, true,
01086 this->getCollocatedComponent<T>(compSpec, markAsDefault,
01087 targetComponent));
01088 }
01089
01090 };
01091 #endif