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