#include <maciSimpleClient.h>
Public Member Functions | |
SimpleClient () | |
virtual | ~SimpleClient () |
int | destroy () |
int | initCORBA (int argc, char *argv[]) |
CORBA::ORB_ptr | getORB () |
int | doneCORBA () |
int | login () |
int | logout () |
int | init (int argc, char *argv[]) |
int | run (ACE_Time_Value &tv) |
int | run () |
maci::Manager_ptr | manager () |
maci::Handle | handle () |
CORBA::Object_ptr | getComponent (const char *name, const char *domain, bool activate) |
CORBA::Object_ptr | get_object (const char *name, const char *domain, bool activate) |
template<class T > | |
T * | getComponent (const char *name, const char *domain, bool activate) |
CORBA::Object * | getDynamicComponent (maci::ComponentSpec compSpec, bool markAsDefault) |
template<class T > | |
T * | getDynamicComponent (maci::ComponentSpec compSpec, bool markAsDefault) |
template<class T > | |
ComponentSmartPtr< T > | getComponentSmartPtr (const char *name, const char *domain, bool activate) |
template<class T > | |
ComponentSmartPtr< T > | getDynamicComponentSmartPtr (maci::ComponentSpec compSpec, bool markAsDefault) |
template<class T > | |
T * | get_object (const char *name, const char *domain, bool activate) |
CORBA::Object * | getComponentNonSticky (const char *name) |
template<class T > | |
T * | getComponentNonSticky (const char *name) |
template<class T > | |
ComponentSmartPtr< T > | getComponentNonStickySmartPtr (const char *name) |
long | releaseComponent (const char *name) |
template<class T > | |
T * | getDefaultComponent (const char *idlType) |
template<typename T > | |
SmartPtr< T > | getDefaultComponentSmartPtr (const char *idlType) |
CORBA::Object * | getCORBADefaultComponent (const char *idlType) |
template<class T > | |
T * | getCollocatedComponent (maci::ComponentSpec compSpec, bool markAsDefault, const char *targetComponent) |
template<typename T > | |
SmartPtr< T > | getCollocatedComponentSmartPtr (maci::ComponentSpec compSpec, bool markAsDefault, const char *targetComponent) |
CORBA::Object * | getCORBACollocatedComponent (maci::ComponentSpec compSpec, bool markAsDefault, const char *targetComponent) |
ACE_CString_Vector | findComponents (const char *nameWilcard, const char *typeWildcard) |
maci::ComponentInfo | getComponentDescriptor (const char *componentName) |
ContainerServices * | getContainerServices () |
virtual char * | name () |
virtual void | disconnect () |
virtual ::maci::AuthenticationData * | authenticate (::maci::ExecutionId execution_id, const char *question) |
virtual void | message (CORBA::Short type, const char *message) |
virtual void | taggedmessage (CORBA::Short type, CORBA::Short tag, const char *message) |
virtual void | components_available (const maci::ComponentInfoSeq &cobs) |
virtual void | components_unavailable (const maci::stringSeq &cob_names) |
virtual CORBA::Boolean | ping () |
Static Public Member Functions | |
static void | initThread (const char *threadName) |
static void | doneThread () |
static LoggingProxy * | getLoggerProxy () |
static const char * | getProcessName () |
Private Attributes | |
maci::Manager_var | m_manager |
Reference to the Manager. | |
maci::Handle | m_handle |
Handle. | |
bool | m_initialized |
Initialization status. | |
bool | m_loggedin |
Manager Logging status. | |
PortableServer::POA_var | m_poaRoot |
Root POA. | |
PortableServer::POA_var | m_poaPersistent |
Persistent POA. | |
PortableServer::POA_var | m_poaTransient |
Persistent POA. | |
CORBA::ORB_var | m_orb |
The CORBA ORB. | |
maci::SimpleClientThreadHook | m_simpleClientThreadHook |
threads' standard start-up hook | |
maci::ExecutionId | m_executionId |
execution id | |
ACS::Time | m_startTime |
client start time | |
ContainerServices * | m_ContServ |
Container Services Reference. | |
Static Private Attributes | |
static LoggingProxy * | m_logger |
Logger. | |
static ACE_CString | m_processName |
The name of the process. |
The class SimpleClient is the base class for a ACS C++ client. It hides most of the CORBA interface to the implementation of the real client.
maci::SimpleClient::SimpleClient | ( | ) |
Constructor.
virtual maci::SimpleClient::~SimpleClient | ( | ) | [virtual] |
Destructor.
virtual ::maci::AuthenticationData* maci::SimpleClient::authenticate | ( | ::maci::ExecutionId | execution_id, | |
const char * | question | |||
) |
Authentication method. Method authenticate is the challenge issued to the client after it tries to login. The login will be successful if the client's authenticate() produces the expected result. Only in this case will the Manager's login method return a valid handle, which the client will later use as the id parameter with all calls to the Manager.
The | question posed by the Manager. |
A
An container (implements the Container interface) C
A client (implements the Client interface) S
A supervisor (implements the Administrator interface) virtual void maci::SimpleClient::components_available | ( | const maci::ComponentInfoSeq & | cobs | ) | [virtual] |
Notify client about the change (availability) of the components currently in use by this client. For administrative clients, notification is issued for the change of availability of any component in the domain.
cobs | A sequence of ComponentInfo structures identifying the affected components. Regular clients receive the name, the type, the handle and the reference of the newly activated component. Administrative clients also receive the handle of the Container where the component was activated. |
virtual void maci::SimpleClient::components_unavailable | ( | const maci::stringSeq & | cob_names | ) | [virtual] |
Notify client that some of the components currently in use by client have become unavailable.
cob_names | CURLs of the unavailable components |
int maci::SimpleClient::destroy | ( | ) |
Destroys Client.
virtual void maci::SimpleClient::disconnect | ( | ) | [virtual] |
Disconnect notification. The disconnect method is called by the Manager to notify the client that it will be unavailable and that the client should log off.
int maci::SimpleClient::doneCORBA | ( | ) |
Finalizes CORBA.
static void maci::SimpleClient::doneThread | ( | ) | [static] |
ACE_CString_Vector maci::SimpleClient::findComponents | ( | const char * | nameWilcard, | |
const char * | typeWildcard | |||
) |
Finds components by their instance name (curl) and/or by their type. Wildcards can be used for the curl and type. This method returns a possibly empty array of component curls; for each curl, you may use getComponent to obtain the reference.
nameWildcard | (null is understood as "*") | |
typeWildcard | (null is understood as "*") |
T* maci::SimpleClient::get_object | ( | const char * | name, | |
const char * | domain, | |||
bool | activate | |||
) | [inline] |
It just redirected call to getComponent (template version)
maciErrType::CannotGetComponentExImpl |
CORBA::Object_ptr maci::SimpleClient::get_object | ( | const char * | name, | |
const char * | domain, | |||
bool | activate | |||
) | [inline] |
It just redirect call to the getComponent
maciErrType::CannotGetComponentExImpl |
T * maci::SimpleClient::getCollocatedComponent | ( | maci::ComponentSpec | compSpec, | |
bool | markAsDefault, | |||
const char * | targetComponent | |||
) |
Gets a collocated component This method uses templates, so no cast to the request object is required
compSpec | The description of the component to activate | |
markAsDefault | If true, the component becomes the default component for that IDL type | |
targetComponent | name of the target component (where to activate component) |
maciErrType::NoPermissionExImpl | ||
maciErrType::IncompleteComponentSpecExImpl | ||
maciErrType::InvalidComponentSpecExImpl | ||
maciErrType::ComponentSpecIncompatibleWithActiveComponentExImpl | ||
maciErrType::CannotGetComponentExImpl |
maci::SmartPtr< T > maci::SimpleClient::getCollocatedComponentSmartPtr | ( | maci::ComponentSpec | compSpec, | |
bool | markAsDefault, | |||
const char * | targetComponent | |||
) |
Gets a smart ponter to a collocated component This method uses templates, so no cast to the request object is required
compSpec | The description of the component to activate | |
markAsDefault | If true, the component becomes the default component for that IDL type | |
targetComponent | name of the target component (where to activate component) |
maciErrType::NoPermissionExImpl | ||
maciErrType::IncompleteComponentSpecExImpl | ||
maciErrType::InvalidComponentSpecExImpl | ||
maciErrType::ComponentSpecIncompatibleWithActiveComponentExImpl | ||
maciErrType::CannotGetComponentExImpl |
T* maci::SimpleClient::getComponent | ( | const char * | name, | |
const char * | domain, | |||
bool | activate | |||
) |
Get a component, activating it if necessary and directly narrows it to the type declared in the template definition. The client must have adequate access rights to access the component. This is untrue of components: NameService, Log, LogFactory, NotifyEventChannelFactory, ArchivingChannel, LoggingChannel, InterfaceRepository, CDB and PDB.
name | name of the component (e.g. MOUNT1) | |
domain | domain name, 0 for default domain | |
activate | true to activate component, false to leave it in the current state |
maciErrType::CannotGetComponentExImpl | If the component could not be activated For example:
MACI_TEST::MaciTestClass_var maciTestDO = client.getComponent<MACI_TEST::MaciTestClass>(argv[1], 0, true);
|
T * maci::SimpleClient::getComponent | ( | const char * | name, | |
const char * | domain, | |||
bool | activate | |||
) |
Get a component, activating it if necessary. The client must have adequate access rights to access the component. This is untrue of components: NameService, Log, LogFactory, NotifyEventChannelFactory, ArchivingChannel, LoggingChannel, InterfaceRepository, CDB and PDB.
name | name of the component (e.g. MOUTN1) | |
domain | domain name, 0 for default domain | |
activate | true to activate component, false to leave it in the current state |
maciErrType::CannotGetComponentExImpl | If the component could not be activated |
First creates the CURL, if not already a CURL, and query the Manager for the component
References ACS_SHORT_LOG, m_handle, m_initialized, manager(), name(), and releaseComponent().
maci::ComponentInfo maci::SimpleClient::getComponentDescriptor | ( | const char * | componentName | ) |
Gets the component info for the component
componentName | The name of the component |
acsErrTypeContainerServices::GettingCompInfoExImpl |
T * maci::SimpleClient::getComponentNonSticky | ( | const char * | name | ) |
Returns a non-sticky reference to a component
name | name (CURL) of the component |
maciErrType::CannotGetComponentExImpl |
T* maci::SimpleClient::getComponentNonSticky | ( | const char * | name | ) |
template version of getComponentNonSticky Returns a non-sticky reference to a component
name | name (CURL) of the component |
maciErrType::CannotGetComponentExImpl |
ComponentSmartPtr< T > maci::SimpleClient::getComponentNonStickySmartPtr | ( | const char * | name | ) |
template version of getComponentNonSticky Returns a SmartPointer to a component
name | name (CURL) of the component |
maciErrType::CannotGetComponentExImpl |
ComponentSmartPtr< T > maci::SimpleClient::getComponentSmartPtr | ( | const char * | name, | |
const char * | domain, | |||
bool | activate | |||
) |
Get a SmartPointer to a component, activating it if necessary and directly narrows it to the type declared in the template definition. The client must have adequate access rights to access the component. This is untrue of components: NameService, Log, LogFactory, NotifyEventChannelFactory, ArchivingChannel, LoggingChannel, InterfaceRepository, CDB and PDB.
name | name of the component (e.g. MOUNT1) | |
domain | domain name, 0 for default domain | |
activate | true to activate component, false to leave it in the current state |
maciErrType::CannotGetComponentExImpl | If the component could not be activated For example:
ComponentSmartPtr<MACI_TEST::MaciTestClass> maciTestDO = client.getComponentSmartPtr<MACI_TEST::MaciTestClass>(argv[1], 0, true);
|
ContainerServices* maci::SimpleClient::getContainerServices | ( | ) |
Gets the Container Services reference
CORBA::Object* maci::SimpleClient::getCORBACollocatedComponent | ( | maci::ComponentSpec | compSpec, | |
bool | markAsDefault, | |||
const char * | targetComponent | |||
) |
Gets a collocated component as a Corba object.
compSpec | The description of the component to activate | |
markAsDefault | If true, the component becomes the default component for that IDL type | |
targetComponent | name of the target component (where to activate component) |
maciErrType::NoPermissionExImpl | ||
maciErrType::IncompleteComponentSpecExImpl | ||
maciErrType::InvalidComponentSpecExImpl | ||
maciErrType::ComponentSpecIncompatibleWithActiveComponentExImpl | ||
maciErrType::CannotGetComponentExImpl |
CORBA::Object* maci::SimpleClient::getCORBADefaultComponent | ( | const char * | idlType | ) |
Gets the default component specified by the IDL component type as a CORBA object.
idlType,: | the idl type of the component to activate For example IDL:alma/PS/PowerSupply:1.0 |
maciErrType::NoPermissionExImpl | ||
maciErrType::NoDefaultComponentExImpl | ||
maciErrType::CannotGetComponentExImpl |
T * maci::SimpleClient::getDefaultComponent | ( | const char * | idlType | ) |
Gets the default component specified by the IDL component type
idlType,: | the idl type of the component to activate For example IDL:alma/PS/PowerSupply:1.0 |
T,: | The type of the object to be returned |
maciErrType::NoPermissionExImpl | ||
maciErrType::NoDefaultComponentExImpl | ||
maciErrType::CannotGetComponentExImpl |
maci::SmartPtr< T > maci::SimpleClient::getDefaultComponentSmartPtr | ( | const char * | idlType | ) |
Gets a smart pointer to the default component specified by the IDL component type. This method uses templates, so no cast to the request object is required
idlType,: | the idl type of the component to activate For example IDL:alma/PS/PowerSupply:1.0 |
maciErrType::NoPermissionExImpl | ||
maciErrType::NoDefaultComponentExImpl | ||
maciErrType::CannotGetComponentExImpl |
T * maci::SimpleClient::getDynamicComponent | ( | maci::ComponentSpec | compSpec, | |
bool | markAsDefault | |||
) |
maciErrType::NoPermissionExImpl | ||
maciErrType::IncompleteComponentSpecExImpl | ||
maciErrType::InvalidComponentSpecExImpl | ||
maciErrType::ComponentSpecIncompatibleWithActiveComponentExImpl | ||
maciErrType::CannotGetComponentExImpl |
T* maci::SimpleClient::getDynamicComponent | ( | maci::ComponentSpec | compSpec, | |
bool | markAsDefault | |||
) |
maciErrType::NoPermissionExImpl | ||
maciErrType::IncompleteComponentSpecExImpl | ||
maciErrType::InvalidComponentSpecExImpl | ||
maciErrType::ComponentSpecIncompatibleWithActiveComponentExImpl | ||
maciErrType::CannotGetComponentExImpl |
ComponentSmartPtr< T > maci::SimpleClient::getDynamicComponentSmartPtr | ( | maci::ComponentSpec | compSpec, | |
bool | markAsDefault | |||
) |
maciErrType::NoPermissionExImpl | ||
maciErrType::IncompleteComponentSpecExImpl | ||
maciErrType::InvalidComponentSpecExImpl | ||
maciErrType::ComponentSpecIncompatibleWithActiveComponentExImpl | ||
maciErrType::CannotGetComponentExImpl |
static LoggingProxy* maci::SimpleClient::getLoggerProxy | ( | ) | [inline, static] |
Get logging proxy instance
CORBA::ORB_ptr maci::SimpleClient::getORB | ( | ) |
Get ORB
static const char* maci::SimpleClient::getProcessName | ( | ) | [inline, static] |
Get SimpleClient's proces name
maci::Handle maci::SimpleClient::handle | ( | ) |
Get handle of the client.
int maci::SimpleClient::init | ( | int | argc, | |
char * | argv[] | |||
) |
The init method logs in to the requested manager. Default is the local manager (if no arguments are given). To specify a remote manager give the parameter -m corbaloc::<host name>="">:<port number>="">/<manager>
example: -m corbaloc::te1.hq.eso.org:xxxx/Manager
int maci::SimpleClient::initCORBA | ( | int | argc, | |
char * | argv[] | |||
) |
Initializes CORBA.
static void maci::SimpleClient::initThread | ( | const char * | threadName | ) | [static] |
int maci::SimpleClient::login | ( | ) |
Login method Logins client to the manager.
int maci::SimpleClient::logout | ( | ) |
Logout method.
maci::Manager_ptr maci::SimpleClient::manager | ( | ) |
virtual void maci::SimpleClient::message | ( | CORBA::Short | type, | |
const char * | message | |||
) | [virtual] |
The Manager and administrators use this method for sending textual messages to the client.
type | Can be either MSG_ERROR or MSG_INFORMATION. | |
message | Contents of the message. The contents are human readable. |
virtual char* maci::SimpleClient::name | ( | ) | [virtual] |
Client name
Referenced by getComponent().
virtual CORBA::Boolean maci::SimpleClient::ping | ( | ) | [virtual] |
Manager pings its clients (both GUI clients, as well as Containers) repeatedly to verify that they still exist. The return value can be either true
, indicating that everything is OK with the client, of false
, indicating that client is malfunctioning. If CORBA::TRANSIENT exception is thrown, the Manager should retry the ping several times, and only then shall the client be assumed to be malfunctioning. If another exception is thrown, the client may be immediately assumed to be malfunctioning. Once the client is found to be malfunctioning, the Manager makes an implicit logout of the client.
true
, indicating that everything is OK with the client, of false
, indicating that client is malfunctioning. long maci::SimpleClient::releaseComponent | ( | const char * | name | ) |
Releases the componet.
name | component name |
maciErrType::CannotReleaseComponentExImpl | when there is a problem |
Referenced by getComponent().
int maci::SimpleClient::run | ( | ACE_Time_Value & | tv | ) |
Run the ORB event loop with the specified <tv> time value.
tv | time to run |
int maci::SimpleClient::run | ( | ) |
Run the ORB event loop until terminated or shutdown.
virtual void maci::SimpleClient::taggedmessage | ( | CORBA::Short | type, | |
CORBA::Short | tag, | |||
const char * | message | |||
) | [virtual] |
The Manager and administrators use this method for sending tagged textual messages to the client.
type | Can be either MSG_ERROR or MSG_INFORMATION. | |
tag | Additional information about the message | |
message | Contents of the message. The contents are human readable. |
ContainerServices* maci::SimpleClient::m_ContServ [private] |
Container Services Reference.
maci::ExecutionId maci::SimpleClient::m_executionId [private] |
execution id
maci::Handle maci::SimpleClient::m_handle [private] |
Handle.
Referenced by getComponent().
bool maci::SimpleClient::m_initialized [private] |
Initialization status.
Referenced by getComponent().
bool maci::SimpleClient::m_loggedin [private] |
Manager Logging status.
LoggingProxy* maci::SimpleClient::m_logger [static, private] |
Logger.
maci::Manager_var maci::SimpleClient::m_manager [private] |
Reference to the Manager.
CORBA::ORB_var maci::SimpleClient::m_orb [private] |
The CORBA ORB.
PortableServer::POA_var maci::SimpleClient::m_poaPersistent [private] |
Persistent POA.
PortableServer::POA_var maci::SimpleClient::m_poaRoot [private] |
Root POA.
PortableServer::POA_var maci::SimpleClient::m_poaTransient [private] |
Persistent POA.
ACE_CString maci::SimpleClient::m_processName [static, private] |
The name of the process.
threads' standard start-up hook
ACS::Time maci::SimpleClient::m_startTime [private] |
client start time