maci::SimpleClient

NAME
SYNOPSIS
Detailed Description
Constructor & Destructor Documentation
Member Function Documentation
Member Data Documentation
Author

NAME

maci::SimpleClient −

SYNOPSIS

#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 SimpleClient * getInstance ()

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.

static maci::SimpleClient * m_simpleClientInstance

Detailed Description

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.

Constructor & Destructor Documentation

maci::SimpleClient::SimpleClient () Constructor.

virtual maci::SimpleClient::~SimpleClient () [virtual] Destructor.

Member Function Documentation

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.

Parameters:

The question posed by the Manager.

Returns:

Answer to the question. The first character of the answer identifies the type of the client: 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.

Parameters:

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.

Parameters:

cob_names CURLs of the unavailable components

int maci::SimpleClient::destroy () Destroys Client.

Returns:

0 on failure

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.

Returns:

0 on failure

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.

Parameters:

nameWildcard (null is understood as ’*’)
typeWildcard
(null is understood as ’*’)

Returns:

A vector of ACE_CString that contains the name of the component(s) that match the search.

template<class T > T* maci::SimpleClient::get_object (const char * name, const char * domain, bool activate) [inline] It just redirected call to getComponent (template version)

Deprecated

the method is deprecated and will be removed in future version of ACS

Exceptions:

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

Deprecated

get_object is deprecated and will be removed in future version of ACS

Exceptions:

maciErrType::CannotGetComponentExImpl

template<class T > 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

Parameters:

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)

Exceptions:

maciErrType::NoPermissionExImpl
maciErrType::IncompleteComponentSpecExImpl
maciErrType::InvalidComponentSpecExImpl
maciErrType::ComponentSpecIncompatibleWithActiveComponentExImpl
maciErrType::CannotGetComponentExImpl

Returns:

The reference to the component

template<typename T > 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

Parameters:

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)

Exceptions:

maciErrType::NoPermissionExImpl
maciErrType::IncompleteComponentSpecExImpl
maciErrType::InvalidComponentSpecExImpl
maciErrType::ComponentSpecIncompatibleWithActiveComponentExImpl
maciErrType::CannotGetComponentExImpl

Returns:

A smart pointer containing the reference to the component

template<class T > 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@ARCHIVING.channels, LoggingChannel@LOGGING.channels, InterfaceRepository, CDB.

Parameters:

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

Returns:

reference to the component.

Exceptions:

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);

See also:

getComponent()

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@ARCHIVING.channels, LoggingChannel@LOGGING.channels, InterfaceRepository, CDB.

Parameters:

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

Returns:

reference to the component.

Exceptions:

maciErrType::CannotGetComponentExImpl If the component could not be activated

See also:

template<class T> T* getComponent

First creates the CURL, if not already a CURL, and query the Manager for the component

Todo

why here is using get_service and not get_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

Parameters:

componentName The name of the component

Exceptions:

acsErrTypeContainerServices::GettingCompInfoExImpl

Returns:

The ComponentInfo struct of the component

T * maci::SimpleClient::getComponentNonSticky (const char * name) Returns a non-sticky reference to a component

Parameters:

name name (CURL) of the component

Exceptions:

maciErrType::CannotGetComponentExImpl

Returns:

reference to the component for details see get_component_non_sticky

template<class T > T* maci::SimpleClient::getComponentNonSticky (const char * name) template version of getComponentNonSticky Returns a non-sticky reference to a component

Parameters:

name name (CURL) of the component

Exceptions:

maciErrType::CannotGetComponentExImpl

Returns:

reference to the component for details see get_component_non_sticky

template<class T > ComponentSmartPtr< T > maci::SimpleClient::getComponentNonStickySmartPtr (const char * name) template version of getComponentNonSticky Returns a SmartPointer to a component

Parameters:

name name (CURL) of the component

Exceptions:

maciErrType::CannotGetComponentExImpl

Returns:

reference to the component for details see get_component_non_sticky

template<class T > 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@ARCHIVING.channels, LoggingChannel@LOGGING.channels, InterfaceRepository, CDB.

Parameters:

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

Returns:

Smart Pointer to the component.

Exceptions:

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);

See also:

getComponent()

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.

Parameters:

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)

Exceptions:

maciErrType::NoPermissionExImpl
maciErrType::IncompleteComponentSpecExImpl
maciErrType::InvalidComponentSpecExImpl
maciErrType::ComponentSpecIncompatibleWithActiveComponentExImpl
maciErrType::CannotGetComponentExImpl

Returns:

The reference to the component

CORBA::Object* maci::SimpleClient::getCORBADefaultComponent (const char * idlType) Gets the default component specified by the IDL component type as a CORBA object.

Parameters:

idlType,: the idl type of the component to activate For example IDL:alma/PS/PowerSupply:1.0

Exceptions:

maciErrType::NoPermissionExImpl
maciErrType::NoDefaultComponentExImpl
maciErrType::CannotGetComponentExImpl

Returns:

The reference to the component

template<class T > T * maci::SimpleClient::getDefaultComponent (const char * idlType) Gets the default component specified by the IDL component type

Parameters:

idlType,: the idl type of the component to activate For example IDL:alma/PS/PowerSupply:1.0

Template Parameters:

T,: The type of the object to be returned

Exceptions:

maciErrType::NoPermissionExImpl
maciErrType::NoDefaultComponentExImpl
maciErrType::CannotGetComponentExImpl

Returns:

The reference to the component

template<typename T > 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

Parameters:

idlType,: the idl type of the component to activate For example IDL:alma/PS/PowerSupply:1.0

Exceptions:

maciErrType::NoPermissionExImpl
maciErrType::NoDefaultComponentExImpl
maciErrType::CannotGetComponentExImpl

Returns:

A smart pointer containing the reference to the component

T * maci::SimpleClient::getDynamicComponent (maci::ComponentSpec compSpec, bool markAsDefault) Exceptions:

maciErrType::NoPermissionExImpl
maciErrType::IncompleteComponentSpecExImpl
maciErrType::InvalidComponentSpecExImpl
maciErrType::ComponentSpecIncompatibleWithActiveComponentExImpl
maciErrType::CannotGetComponentExImpl

template<class T > T* maci::SimpleClient::getDynamicComponent (maci::ComponentSpec compSpec, bool markAsDefault) Exceptions:

maciErrType::NoPermissionExImpl
maciErrType::IncompleteComponentSpecExImpl
maciErrType::InvalidComponentSpecExImpl
maciErrType::ComponentSpecIncompatibleWithActiveComponentExImpl
maciErrType::CannotGetComponentExImpl

template<class T > ComponentSmartPtr< T > maci::SimpleClient::getDynamicComponentSmartPtr (maci::ComponentSpec compSpec, bool markAsDefault) Exceptions:

maciErrType::NoPermissionExImpl
maciErrType::IncompleteComponentSpecExImpl
maciErrType::InvalidComponentSpecExImpl
maciErrType::ComponentSpecIncompatibleWithActiveComponentExImpl
maciErrType::CannotGetComponentExImpl

static SimpleClient* maci::SimpleClient::getInstance (void) [inline, static] Get SimpleClient instance pointer Please note that the SimpleClient is not yet implemented as a singleton. You’ll still get troubles if you instantiate several SimpleClient instances in the same process and you shall not do that. In that case, the getInstance function will return the first created instance, unless it was destroyed in the mean time.

Returns:

SimpleClient instance pointer or 0 if there is no SimpleClient instance

static LoggingProxy* maci::SimpleClient::getLoggerProxy () [inline, static] Get logging proxy instance

Returns:

logging proxy instance

CORBA::ORB_ptr maci::SimpleClient::getORB () Get ORB

static const char* maci::SimpleClient::getProcessName () [inline, static] Get SimpleClient’s proces name

Returns:

SimpleClient’s proces name

maci::Handle maci::SimpleClient::handle () Get handle of the client.

Returns:

handle

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

Returns:

0 on failure

int maci::SimpleClient::initCORBA (int argc, char * argv[]) Initializes CORBA.

Returns:

0 on failure

static void maci::SimpleClient::initThread (const char * threadName) [static]

int maci::SimpleClient::login () Login method Logins client to the manager.

Returns:

0 on failure

int maci::SimpleClient::logout () Logout method.

Returns:

0 on failure

maci::Manager_ptr maci::SimpleClient::manager () Get manager CORBA reference.

Returns:

manager CORBA reference

Referenced by getComponent().

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.

Parameters:

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.

Returns:

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.

Parameters:

name component name

Returns:

Number of clients that are still using the component after the operation completed.

Exceptions:

maciErrType::CannotReleaseComponentExImpl when there is a problem

Referenced by getComponent().

int maci::SimpleClient::run () Run the ORB event loop until terminated or shutdown.

Returns:

0 on failure

int maci::SimpleClient::run (ACE_Time_Value & tv) Run the ORB event loop with the specified <tv> time value.

Parameters:

tv time to run

Returns:

0 on failure

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.

Parameters:

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.

Member Data Documentation

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.

maci::SimpleClient* maci::SimpleClient::m_simpleClientInstance [static, private] The Simple Client pointer This is the pointer to the first simple client instance created by the process

maci::SimpleClientThreadHook maci::SimpleClient::m_simpleClientThreadHook [private]

threads’ standard start-up hook

ACS::Time maci::SimpleClient::m_startTime [private]

client start time

Author

Generated automatically by Doxygen for ACS-2015.2 C++ API from the source code.