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 <maciExport.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 maci_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
00444
00445
00446
00450 virtual char * name ();
00451
00456 virtual void disconnect ();
00457
00467 virtual ::maci::AuthenticationData * authenticate (
00468 ::maci::ExecutionId execution_id, const char * question);
00469
00475 virtual void message (CORBA::Short type,
00476 const char * message
00477 );
00478
00485 virtual void taggedmessage (CORBA::Short type,
00486 CORBA::Short tag,
00487 const char * message
00488 );
00489
00494 virtual void components_available (const maci::ComponentInfoSeq & cobs
00495 );
00496
00501 virtual void components_unavailable (const maci::stringSeq & cob_names
00502 );
00503
00504
00513 virtual CORBA::Boolean ping ();
00514
00517 static LoggingProxy * getLoggerProxy()
00518 {
00519 return m_logger;
00520 }
00521
00524 static const char * getProcessName()
00525 {
00526 return m_processName.c_str();
00527 }
00528
00529 private:
00530
00532 maci::Manager_var m_manager;
00533
00535 maci::Handle m_handle;
00536
00538 bool m_initialized;
00539
00541 bool m_loggedin;
00542
00544 PortableServer::POA_var m_poaRoot;
00545
00547 PortableServer::POA_var m_poaPersistent;
00548
00550 PortableServer::POA_var m_poaTransient;
00551
00553 CORBA::ORB_var m_orb;
00554
00556 static LoggingProxy* m_logger;
00557
00559 static ACE_CString m_processName;
00560
00562 maci::SimpleClientThreadHook m_simpleClientThreadHook;
00563
00565 maci::ExecutionId m_executionId;
00566
00568 ACS::Time m_startTime;
00569
00571 ContainerServices* m_ContServ;
00572 };
00573
00574
00575
00576
00577
00578
00579
00580
00581 template<class T>
00582 T* SimpleClient::getComponent(const char *name, const char *domain, bool activate)
00583 {
00584 if(!m_initialized)
00585 {
00586 ACSErrTypeCommon::NotInitializedExImpl notInitEx( __FILE__, __LINE__,
00587 "maci::SimpleClient::getComponent<>");
00588 notInitEx.setName("SimpleClient");
00589 maciErrType::CannotGetComponentExImpl ex( notInitEx, __FILE__, __LINE__,
00590 "maci::SimpleClient::getComponent<>");
00591 name ? ex.setCURL(name) : ex.setCURL("NULL");
00592 throw ex;
00593 }
00594
00595 if(!name)
00596 {
00597 ACSErrTypeCommon::NullPointerExImpl nullEx(__FILE__, __LINE__,
00598 "maci::SimpleClient::getComponent<>");
00599 nullEx.setVariable("(parameter) name");
00600 maciErrType::CannotGetComponentExImpl ex(nullEx, __FILE__, __LINE__,
00601 "maci::SimpleClient::getComponent<>");
00602 ex.setCURL("NULL");
00603 throw ex;
00604 }
00605
00610 const char* curl_str = "curl://";
00611
00612 ACE_CString curl = "";
00613 if(strncmp(name, curl_str, strlen(curl_str)) != 0 )
00614 {
00615 curl += curl_str;
00616 if (domain)
00617 curl += domain;
00618
00619 curl += ACE_CString("/");
00620 }
00621 curl += name;
00622
00623 ACS_SHORT_LOG((LM_DEBUG, "Getting component: '%s'. Creating it...", curl.c_str()));
00624
00625 try
00626 {
00628 CORBA::Object_var obj = manager()->get_service(m_handle, curl.c_str(), activate);
00629 T* tmpRef = T::_narrow(obj);
00630 if (CORBA::is_nil(tmpRef))
00631 {
00632 releaseComponent(name);
00633 ACSErrTypeCORBA::NarrowFailedExImpl ex(__FILE__, __LINE__, "maci::SimpleClient<>::getComponent");
00634 ex.setNarrowType(typeid(T).name());
00635 throw ex;
00636 }
00637 return tmpRef;
00638 }
00639 catch(maciErrType::NoPermissionEx &_ex)
00640 {
00641 maciErrType::CannotGetComponentExImpl ex(_ex, __FILE__, __LINE__,
00642 "maci::SimpleClient::getComponent<>");
00643 ex.setCURL(name);
00644 throw ex;
00645 }
00646 catch(maciErrType::CannotGetComponentEx &_ex)
00647 {
00648 maciErrType::CannotGetComponentExImpl ex(_ex, __FILE__, __LINE__,
00649 "maci::SimpleClient::getComponent<>");
00650 ex.setCURL(name);
00651 throw ex;
00652 }
00653 catch(maciErrType::ComponentNotAlreadyActivatedEx &_ex)
00654 {
00655 maciErrType::CannotGetComponentExImpl ex(_ex, __FILE__, __LINE__,
00656 "maci::SimpleClient::getComponent<>");
00657 ex.setCURL(name);
00658 throw ex;
00659 }
00660 catch(maciErrType::ComponentConfigurationNotFoundEx &_ex)
00661 {
00662 maciErrType::CannotGetComponentExImpl ex(_ex, __FILE__, __LINE__,
00663 "maci::SimpleClient::getComponent<>");
00664 ex.setCURL(name);
00665 throw ex;
00666 }
00667 catch (ACSErr::ACSbaseExImpl &ex)
00668 {
00669 maciErrType::CannotGetComponentExImpl lex(ex, __FILE__, __LINE__,
00670 "maci::SimpleClient<T>::getComponent");
00671 lex.setCURL(name);
00672 throw lex;
00673 }
00674 catch( CORBA::SystemException &_ex )
00675 {
00676 ACSErrTypeCommon::CORBAProblemExImpl corbaProblemEx(__FILE__, __LINE__,
00677 "maci::SimpleClient::getComponent<>");
00678 corbaProblemEx.setMinor(_ex.minor());
00679 corbaProblemEx.setCompletionStatus(_ex.completed());
00680 corbaProblemEx.setInfo(_ex._info().c_str());
00681 maciErrType::CannotGetComponentExImpl ex(corbaProblemEx, __FILE__, __LINE__,
00682 "maci::SimpleClient::getComponent<>");
00683 ex.setCURL(name);
00684 throw ex;
00685 }
00686 catch(...)
00687 {
00688 ACSErrTypeCommon::UnexpectedExceptionExImpl uex(__FILE__, __LINE__,
00689 "maci::SimpleClient::getComponent<>");
00690 maciErrType::CannotGetComponentExImpl ex(uex, __FILE__, __LINE__,
00691 "maci::SimpleClient::getComponent<>");
00692 ex.setCURL(name);
00693 throw ex;
00694 }
00695 }
00696
00697
00698
00699
00700 template<class T>
00701 ComponentSmartPtr<T> SimpleClient::getComponentSmartPtr(const char *name, const char *domain, bool activate)
00702 {
00703 return ComponentSmartPtr<T>(this, true, this->getComponent<T>(name, domain, activate));
00704 }
00705
00706
00707
00708 template<class T>
00709 ComponentSmartPtr<T> SimpleClient::getDynamicComponentSmartPtr(maci::ComponentSpec compSpec, bool markAsDefault)
00710 {
00711 return ComponentSmartPtr<T>(this, true, this->getDynamicComponent<T>(compSpec,markAsDefault));
00712 }
00713
00714
00715
00716
00717
00718
00719 template<class T>
00720 T* SimpleClient::getDynamicComponent(maci::ComponentSpec compSpec, bool markAsDefault)
00721 {
00722
00723
00724
00725
00726
00727
00728 ComponentInfo_var cInfo;
00729 ACS_TRACE("maci::SimpleClient<>::getDynamicComponent");
00730 try
00731 {
00732 cInfo = m_manager->get_dynamic_component(m_handle,
00733 compSpec,
00734 markAsDefault);
00735 CORBA::Object_var obj = cInfo->reference;
00736 if (CORBA::is_nil(obj.in()))
00737 {
00738 ACSErrTypeCORBA::CORBAReferenceNilExImpl ex(__FILE__, __LINE__,
00739 "maci::SimpleClient<>::getDynamicComponent");
00740 ex.setVariable("cInfo->reference");
00741 throw ex;
00742 }
00743
00744
00745 T* tmpRef = T::_narrow(obj);
00746 if(CORBA::is_nil(tmpRef))
00747 { ACSErrTypeCORBA::NarrowFailedExImpl ex(__FILE__, __LINE__, "maci::SimpleClient<>::getDynamicComponent");
00748
00749 throw ex;
00750 }
00751 return tmpRef;
00752
00753 }
00754 catch (maciErrType::NoPermissionEx &ex)
00755 {
00756 maciErrType::NoPermissionExImpl lex(ex, __FILE__, __LINE__,
00757 "maci::SimpleClient<>::getDynamicComponent");
00758 throw lex;
00759 }
00760 catch (maciErrType::IncompleteComponentSpecEx &ex)
00761 {
00762 maciErrType::IncompleteComponentSpecExImpl lex(ex, __FILE__, __LINE__,
00763 "maci::SimpleClient<>::getDynamicComponent");
00764 lex.setCURL(compSpec.component_name.in());
00765 throw lex;
00766 }
00767 catch (maciErrType::InvalidComponentSpecEx &ex)
00768 {
00769 maciErrType::InvalidComponentSpecExImpl lex(ex, __FILE__, __LINE__,
00770 "maci::SimpleClient<>::getDynamicComponent");
00771 throw lex;
00772 }
00773 catch (maciErrType::ComponentSpecIncompatibleWithActiveComponentEx &ex)
00774 {
00775 maciErrType::ComponentSpecIncompatibleWithActiveComponentExImpl lex(ex, __FILE__, __LINE__,
00776 "maci::SimpleClient<>::getDynamicComponent");
00777 lex.setCURL(compSpec.component_name.in());
00778 throw lex;
00779 }
00780 catch (maciErrType::CannotGetComponentEx &ex)
00781 {
00782 maciErrType::CannotGetComponentExImpl lex(ex, __FILE__, __LINE__,
00783 "maci::SimpleClient<>::getDynamicComponent");
00784 lex.setCURL(compSpec.component_name.in());
00785 throw lex;
00786 }
00787 catch(ACSErr::ACSbaseExImpl &ex)
00788 {
00789 maciErrType::CannotGetComponentExImpl lex(ex, __FILE__, __LINE__,
00790 "maci::SimpleClient<>::getDynamicComponent");
00791 lex.setCURL(compSpec.component_name.in());
00792 throw lex;
00793 }
00794 catch( CORBA::SystemException &ex )
00795 {
00796 ACSErrTypeCommon::CORBAProblemExImpl corbaProblemEx(__FILE__, __LINE__,
00797 "maci::SimpleClient<>::getDynamicComponent");
00798 corbaProblemEx.setMinor(ex.minor());
00799 corbaProblemEx.setCompletionStatus(ex.completed());
00800 corbaProblemEx.setInfo(ex._info().c_str());
00801
00802 maciErrType::CannotGetComponentExImpl lex(corbaProblemEx, __FILE__, __LINE__,
00803 "maci::SimpleClient<>::getDynamicComponent");
00804 lex.setCURL(compSpec.component_name.in());
00805 throw lex;
00806 }
00807 catch (...)
00808 {
00809 ACSErrTypeCommon::UnexpectedExceptionExImpl uex(__FILE__, __LINE__,
00810 "maci::SimpleClient<>::getDynamicComponent");
00811 maciErrType::CannotGetComponentExImpl lex(uex, __FILE__, __LINE__,
00812 "maci::SimpleClient<>::getDynamicComponent");
00813 lex.setCURL(compSpec.component_name.in());
00814 throw lex;
00815 }
00816 }
00817
00818
00819
00820
00821
00822 template<class T>
00823 T* SimpleClient::getComponentNonSticky(const char *name)
00824 {
00825 if(!m_initialized)
00826 {
00827 ACSErrTypeCommon::NotInitializedExImpl notInitEx( __FILE__, __LINE__,
00828 "maci::SimpleClient::getComponentNonSticky<>");
00829 notInitEx.setName("SimpleClient");
00830 maciErrType::CannotGetComponentExImpl ex( notInitEx, __FILE__, __LINE__,
00831 "maci::SimpleClient::getComponentNonSticky<>");
00832 name ? ex.setCURL(name) : ex.setCURL("NULL");
00833 throw ex;
00834 }
00835
00836 if(!name)
00837 {
00838 ACSErrTypeCommon::NullPointerExImpl nullEx(__FILE__, __LINE__,
00839 "maci::SimpleClient::getComponentNonSticky<>");
00840 nullEx.setVariable("(parameter) name");
00841 maciErrType::CannotGetComponentExImpl ex(nullEx, __FILE__, __LINE__,
00842 "maci::SimpleClient::getComponentNonSticky<>");
00843 ex.setCURL("NULL");
00844 throw ex;
00845 }
00846
00847 ACS_SHORT_LOG((LM_DEBUG, "Getting component non sticky: '%s'. Creating it...", name));
00848
00849 try
00850 {
00851 CORBA::Object_var obj = manager()->get_component_non_sticky(m_handle, name);
00852 T* tmpRef = T::_narrow(obj);
00853 if (CORBA::is_nil(tmpRef))
00854 {
00855
00856 ACSErrTypeCORBA::NarrowFailedExImpl ex(__FILE__, __LINE__, "maci::SimpleClient<>::getComponentNonSticky");
00857 ex.setNarrowType(typeid(T).name());
00858 throw ex;
00859 }
00860 return tmpRef;
00861 }
00862 catch(maciErrType::NoPermissionEx &_ex)
00863 {
00864 maciErrType::CannotGetComponentExImpl ex(_ex, __FILE__, __LINE__,
00865 "maci::SimpleClient::getComponentNonSticky<>");
00866 ex.setCURL(name);
00867 throw ex;
00868 }
00869 catch(maciErrType::CannotGetComponentEx &_ex)
00870 {
00871 maciErrType::CannotGetComponentExImpl ex(_ex, __FILE__, __LINE__,
00872 "maci::SimpleClient::getComponentNonSticky<>");
00873 ex.setCURL(name);
00874 throw ex;
00875 }
00876 catch(maciErrType::ComponentNotAlreadyActivatedEx &_ex)
00877 {
00878 maciErrType::CannotGetComponentExImpl ex(_ex, __FILE__, __LINE__,
00879 "maci::SimpleClient::getComponentNonSticky<>");
00880 ex.setCURL(name);
00881 throw ex;
00882 }
00883 catch (ACSErr::ACSbaseExImpl &ex)
00884 {
00885 maciErrType::CannotGetComponentExImpl lex(ex, __FILE__, __LINE__,
00886 "maci::SimpleClient<>::getComponentNonSticky");
00887 lex.setCURL(name);
00888 throw lex;
00889 }
00890 catch( CORBA::SystemException &_ex )
00891 {
00892 ACSErrTypeCommon::CORBAProblemExImpl corbaProblemEx(__FILE__, __LINE__,
00893 "maci::SimpleClient::getComponentNonSticky<>");
00894 corbaProblemEx.setMinor(_ex.minor());
00895 corbaProblemEx.setCompletionStatus(_ex.completed());
00896 corbaProblemEx.setInfo(_ex._info().c_str());
00897 maciErrType::CannotGetComponentExImpl ex(corbaProblemEx, __FILE__, __LINE__,
00898 "maci::SimpleClient::getComponent<>");
00899 ex.setCURL(name);
00900 throw ex;
00901 }
00902 catch(...)
00903 {
00904 ACSErrTypeCommon::UnexpectedExceptionExImpl uex(__FILE__, __LINE__,
00905 "maci::SimpleClient::getComponentNonSticky<>");
00906 maciErrType::CannotGetComponentExImpl ex(uex, __FILE__, __LINE__,
00907 "maci::SimpleClient::getComponentNonSticky<>");
00908 ex.setCURL(name);
00909 throw ex;
00910 }
00911 }
00912
00913
00914
00915
00916 template<class T>
00917 ComponentSmartPtr<T> SimpleClient::getComponentNonStickySmartPtr(const char *name)
00918 {
00919 return ComponentSmartPtr<T>(this, false, this->getComponentNonSticky<T>(name));
00920 }
00921
00922 template<class T>
00923 T* SimpleClient::getDefaultComponent(const char* idlType)
00924 {
00925 CORBA::Object* obj =T::_nil();
00926
00927 ACS_TRACE("maci::SimpleClient::getDefaultComponent");
00928
00929 try{
00930 obj = getCORBADefaultComponent(idlType);
00931 T* tmpRef = T::_narrow(obj);
00932 if (tmpRef==T::_nil()){
00933
00934
00935 ACS::ACSComponent* tComp = ACS::ACSComponent::_narrow(obj);
00936 if(tComp!=ACS::ACSComponent::_nil()){
00937 char *cName = tComp->name();
00938 releaseComponent(cName);
00939 CORBA::string_free(cName);
00940 }
00941 ACSErrTypeCORBA::NarrowFailedExImpl ex(__FILE__, __LINE__,
00942 "maci::SimpleClient::getDefaultComponent");
00943 ex.setNarrowType(typeid(T).name());
00944 throw ex;
00945 }
00946 return tmpRef;
00947 }
00948 catch(maciErrType::NoPermissionEx &_ex)
00949 {
00950 throw maciErrType::NoPermissionExImpl(__FILE__, __LINE__,
00951 "maci::SimpleClient::getDefaultComponent");
00952 }
00953 catch (maciErrType::NoDefaultComponentExImpl &ex)
00954 {
00955 maciErrType::NoDefaultComponentExImpl lex(ex,
00956 __FILE__, __LINE__,
00957 "maci::SimpleClient::getDefaultComponent");
00958 throw lex;
00959 }
00960 catch (maciErrType::CannotGetComponentExImpl &ex)
00961 {
00962 maciErrType::CannotGetComponentExImpl lex(ex, __FILE__, __LINE__,
00963 "maci::SimpleClient::getDefaultComponent");
00964 throw lex;
00965 }
00966 catch (ACSErr::ACSbaseExImpl &ex)
00967 {
00968 maciErrType::CannotGetComponentExImpl lex(ex, __FILE__, __LINE__,
00969 "maci::SimpleClient::getDefaultComponent");
00970 throw lex;
00971 }
00972 catch (...)
00973 {
00974 ACSErrTypeCommon::UnexpectedExceptionExImpl uex(__FILE__, __LINE__,
00975 "maci::SimpleClient::getDefaultComponent");
00976 maciErrType::CannotGetComponentExImpl lex(uex, __FILE__, __LINE__,
00977 "maci::SimpleClient::getDefaultComponent");
00978 throw lex;
00979 }
00980 }
00981
00982 template <typename T>
00983 maci::SmartPtr<T> SimpleClient::getDefaultComponentSmartPtr(
00984 const char* idlType)
00985 {
00986 return maci::SmartPtr<T>(this, true, this->getDefaultComponent<T>(idlType));
00987 }
00988
00989 template<class T>
00990 T* SimpleClient::getCollocatedComponent(maci::ComponentSpec compSpec,
00991 bool markAsDefault, const char* targetComponent)
00992 {
00993 CORBA::Object* obj =T::_nil();
00994 ACS_TRACE("maci::SimpleClient::getCollocatedComponent");
00995 try{
00996 obj = getCORBACollocatedComponent(compSpec,markAsDefault,targetComponent);
00997 T* tmpRef = T::_narrow(obj);
00998 if (tmpRef==T::_nil()){
00999 ACS::ACSComponent* tComp = ACS::ACSComponent::_narrow(obj);
01000 if ( tComp!=ACS::ACSComponent::_nil() ){
01001 char *cName = tComp->name();
01002 releaseComponent(cName);
01003 CORBA::string_free(cName);
01004 }
01005 else{
01006
01007 }
01008 ACSErrTypeCORBA::NarrowFailedExImpl ex(__FILE__, __LINE__,
01009 "maci::SimpleClient::getCollocatedComponent");
01010 ex.setNarrowType(typeid(T).name());
01011 throw ex;
01012 }
01013 return tmpRef;
01014 }
01015 catch (maciErrType::NoPermissionExImpl &ex){
01016 maciErrType::NoPermissionExImpl lex(ex, __FILE__, __LINE__,
01017 "maci::SimpleClient::getCollocatedComponent");
01018 throw lex;
01019 }
01020 catch (maciErrType::IncompleteComponentSpecExImpl &ex){
01021 maciErrType::IncompleteComponentSpecExImpl lex(ex, __FILE__, __LINE__,
01022 "maci::SimpleClient::getCollocatedComponent");
01023 lex.setCURL(compSpec.component_name.in());
01024 throw lex;
01025 }
01026 catch (maciErrType::InvalidComponentSpecExImpl &ex){
01027 maciErrType::InvalidComponentSpecExImpl lex(ex, __FILE__, __LINE__,
01028 "maci::SimpleClient::getCollocatedComponent");
01029 throw lex;
01030 }
01031 catch (maciErrType::ComponentSpecIncompatibleWithActiveComponentExImpl &ex){
01032 maciErrType::ComponentSpecIncompatibleWithActiveComponentExImpl lex(ex, __FILE__, __LINE__,
01033 "maci::SimpleClient::getCollocatedComponent");
01034 lex.setCURL(compSpec.component_name.in());
01035 throw lex;
01036 }
01037 catch (maciErrType::CannotGetComponentExImpl &ex){
01038 maciErrType::CannotGetComponentExImpl lex(ex, __FILE__, __LINE__,
01039 "maci::SimpleClient::getCollocatedComponent");
01040 lex.setCURL(compSpec.component_name.in());
01041 throw lex;
01042 }
01043 catch (ACSErr::ACSbaseExImpl &ex){
01044 maciErrType::CannotGetComponentExImpl lex(ex, __FILE__, __LINE__,
01045 "maci::SimpleClient::getCollocatedComponent");
01046 lex.setCURL(compSpec.component_name.in());
01047 throw lex;
01048 }
01049 catch (...){
01050 ACSErrTypeCommon::UnexpectedExceptionExImpl uex(__FILE__, __LINE__,
01051 "maci::SimpleClient::getCollocatedComponent");
01052 maciErrType::CannotGetComponentExImpl lex(uex, __FILE__, __LINE__,
01053 "maci::SimpleClient::getCollocatedComponent");
01054 lex.setCURL(compSpec.component_name.in());
01055 throw lex;
01056 }
01057 }
01058
01059 template <typename T>
01060 maci::SmartPtr<T> SimpleClient::getCollocatedComponentSmartPtr(
01061 maci::ComponentSpec compSpec, bool markAsDefault,
01062 const char* targetComponent)
01063 {
01064 return maci::SmartPtr<T>(this, true,
01065 this->getCollocatedComponent<T>(compSpec, markAsDefault,
01066 targetComponent));
01067 }
01068
01069 };
01070 #endif