Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

maci::SimpleClient Class Reference

#include <maciSimpleClient.h>

Collaboration diagram for maci::SimpleClient:

Collaboration graph
[legend]
List of all members.

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

void initThread (const char *threadName)
void doneThread ()
LoggingProxygetLoggerProxy ()
const char * getProcessName ()

Private Attributes

maci::Manager_var m_manager
 Reference to the Manager.
maci::Handle m_handle
 Handle.
bool m_initialized
 Initialization 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

Static Private Attributes

LoggingProxym_logger
 Logger.
ACE_CString m_processName
 The name of the process.

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

void maci::SimpleClient::doneThread  )  [static]
 

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::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.

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, LoggingChannel, InterfaceRepository, CDB and PDB.

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

Todo:
why here is using get_service and not get_component ?

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

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>
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, LoggingChannel, InterfaceRepository, CDB and PDB.

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

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

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

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 

LoggingProxy* maci::SimpleClient::getLoggerProxy  )  [inline, static]
 

Get logging proxy instance

Returns:
logging proxy instance

CORBA::ORB_ptr maci::SimpleClient::getORB  ) 
 

Get ORB

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

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

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

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

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

maci::ExecutionId maci::SimpleClient::m_executionId [private]
 

execution id

maci::Handle maci::SimpleClient::m_handle [private]
 

Handle.

bool maci::SimpleClient::m_initialized [private]
 

Initialization 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::SimpleClientThreadHook maci::SimpleClient::m_simpleClientThreadHook [private]
 

threads' standard start-up hook

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

client start time


The documentation for this class was generated from the following file:
Generated on Thu Apr 30 02:37:32 2009 for ACS C++ API by doxygen 1.3.8