commore  1.0.6-SNAPSHOT
 All Classes Namespaces Functions Variables Typedefs Enumerations Pages
commore::Service Class Reference

A commore::Service is an object that mimics an object in an object oriented system : it has a class name (its type) and a name (instance name). It provides callable methods (with call and #send), and has an internal state. A commore::Service is designed for being used via an AutoRef (it inherits from RefObject). However, Service doesn't use RefFactory, but ServiceFactory. This is because RefFactory interface is not suitable for the kind of arguments that is required in create methods. An service has a list of Interfaces (interface_list_ defined in Interface). These interfaces are the one that the object implements. More...

#include <Service.h>

+ Inheritance diagram for commore::Service:

Classes

class  CallMethod
 

Public Member Functions

ListAStringget_addresses (ListAString &addresses) const
 
AString get_address () const
 
PService get_service ()
 
const AStringget_name () const
 
void set_name (const AChar *name)
 
const AStringget_class_name () const
 
virtual long connect (const AChar *user_name, const AChar *password)
 
AString get_session_id () const
 
void set_session_id (const AChar *session_id)
 
Tupleget_session_context_ptr (bool createIfNeeded=false)
 
virtual bool get_session_context (Tuple &t)
 
virtual void set_session_context (const Tuple &sessionContext)
 
virtual bool get_self_session_context (Tuple &t) const
 
virtual void set_self_session_context ()
 
long publish (PServiceManager &manager)
 
long unpublish (PServiceManager &manager)
 
long unpublish ()
 
long get_managers (List< PServiceManager > &managers) const
 
virtual long call (const Tuple &inArgs, Tuple &outArgs)
 
virtual long call (const AChar *interface_name, const Tuple &inArgs, Tuple &outArgs)
 
virtual long call (const AChar *interface_name, const Tuple &inArgs, Tuple &outArgs, const Tuple *param)
 
long call (Tuple &sessionContext, const AChar *interface_name, const Tuple &inArgs, Tuple &outArgs)
 
long get_interface (const AChar *name, PInterface &inter)
 
bool add_interface (const PInterface &inter)
 
- Public Member Functions inherited from commore::Interface
 Interface (const AChar *name)
 
virtual bool is_proxy () const
 
virtual long call (const Tuple &in_args, Tuple &out_args, const Tuple *param)
 
const AStringget_name () const
 
virtual PService get_service () const
 
CriticalSectionget_cs () const
 
- Public Member Functions inherited from commore::RefObject
 RefObject ()
 
virtual void attach ()
 
virtual void release ()
 
virtual void nested_attach ()
 
virtual void nested_release ()
 
virtual void interface_release ()
 
virtual void Run ()
 
virtual CriticalSectionget_cs ()
 

Static Public Member Functions

static AutoRefBase create (const AChar *)
 
static AutoRefBase create (const AChar *, ServiceFactory &factory)
 
static AutoRefBase bind (const AChar *spec)
 
- Static Public Member Functions inherited from commore::RefObject
static AutoRefBase auto_create ()
 
static AutoRefBase auto_create (const AChar *s)
 
static AutoRefBase create ()
 
static AutoRefBase create (const AChar *s)
 
static AutoRefBase bind ()
 
static AutoRefBase bind (const AChar *s)
 
static const AChar * factory_name ()
 

Protected Member Functions

 Service (const AChar *class_name)
 
 Service (const AChar *class_name, const AChar *name, const AChar *address)
 
 Service (const AChar *class_name, const Tuple &init)
 
- Protected Member Functions inherited from commore::Interface
bool set_service (const PService &service)
 
 Interface (const Interface &)
 

Friends

class PServiceManager
 
class Interface
 

Additional Inherited Members

- Protected Attributes inherited from commore::Interface
Internals_ * internals_
 

Detailed Description

A commore::Service is an object that mimics an object in an object oriented system : it has a class name (its type) and a name (instance name). It provides callable methods (with call and #send), and has an internal state. A commore::Service is designed for being used via an AutoRef (it inherits from RefObject). However, Service doesn't use RefFactory, but ServiceFactory. This is because RefFactory interface is not suitable for the kind of arguments that is required in create methods. An service has a list of Interfaces (interface_list_ defined in Interface). These interfaces are the one that the object implements.

Constructor & Destructor Documentation

commore::Service::Service ( const AChar *  class_name)
protected
Parameters
class_name
commore::Service::Service ( const AChar *  class_name,
const AChar *  name,
const AChar *  address 
)
protected
Parameters
class_name
name
address
commore::Service::Service ( const AChar *  class_name,
const Tuple init 
)
protected
Parameters
class_name
init

Member Function Documentation

bool commore::Service::add_interface ( const PInterface inter)

Add interface implementation to service

Remarks
not implemented
static AutoRefBase commore::Service::bind ( const AChar *  spec)
static

Create a proxy service or bind to an existig published service This is the bind method used by AutoRef::bind

Parameters
specdirect service specification or remote service specification
Returns
return a proxy service if spec match <CLASS name>="">:<INSTANCE name>=""><ADDRESS> an existing published service if spec match <CLASS name>="">:<INSTANCE name>="">
virtual long commore::Service::call ( const Tuple inArgs,
Tuple outArgs 
)
virtual

Basic call method

Reimplemented from commore::Interface.

Reimplemented in commore::ProxyService.

virtual long commore::Service::call ( const AChar *  interface_name,
const Tuple inArgs,
Tuple outArgs 
)
virtual

Call method with interface name

Reimplemented in commore::ProxyService.

virtual long commore::Service::call ( const AChar *  interface_name,
const Tuple inArgs,
Tuple outArgs,
const Tuple param 
)
virtual

Call method with interface name and param

Reimplemented in commore::ProxyService.

long commore::Service::call ( Tuple sessionContext,
const AChar *  interface_name,
const Tuple inArgs,
Tuple outArgs 
)

Call entry method called by listener callback

Note
not a virtual function !
virtual long commore::Service::connect ( const AChar *  user_name,
const AChar *  password 
)
virtual

Default Authentication Method (to be implemented)

static AutoRefBase commore::Service::create ( const AChar *  )
static

Create a service using a registered factory This is the create method used by AutoRef::create

static AutoRefBase commore::Service::create ( const AChar *  ,
ServiceFactory factory 
)
static

Create a service using an explicit factory

AString commore::Service::get_address ( ) const

Recover addresses on which the services of service manager can be contacted

Returns
a string address list
Remarks
provided for backward compatibility
Deprecated:
ListAString& commore::Service::get_addresses ( ListAString addresses) const

Get the addresses on which the services can be contacted

const AString& commore::Service::get_class_name ( ) const
Returns
service class name
long commore::Service::get_interface ( const AChar *  name,
PInterface inter 
)

Get interface Using default InterfaceFactory

Parameters
nameinterface name
interreference to retrieved interface
Returns
CMR_OK if succeed
long commore::Service::get_managers ( List< PServiceManager > &  managers) const

Get associated ServiceManager (if service has been published)

Returns
number of ServiceManager where service is published,
const AString& commore::Service::get_name ( ) const
Returns
service name
virtual bool commore::Service::get_self_session_context ( Tuple t) const
virtual

Specific for use on the server side, when using direct call inside a call get the session context directly attached to service

Reimplemented from commore::Interface.

PService commore::Service::get_service ( )
inline
Returns
a service reference
virtual bool commore::Service::get_session_context ( Tuple t)
virtual

Get a copy of tuple session context

Returns
true if tuple sesion context exist
Remarks
thread safe

Reimplemented from commore::Interface.

Tuple* commore::Service::get_session_context_ptr ( bool  createIfNeeded = false)
Returns
pointer to tuple session context
Warning
pointer not thread safe
AString commore::Service::get_session_id ( ) const
Returns
current session id
Remarks
session id is shared between service proxy and service server
long commore::Service::publish ( PServiceManager manager)

Publish service in a service manager

void commore::Service::set_name ( const AChar *  name)

Set service name

virtual void commore::Service::set_session_context ( const Tuple sessionContext)
virtual

Set tuple session context

Reimplemented from commore::Interface.

void commore::Service::set_session_id ( const AChar *  session_id)

Set session id

long commore::Service::unpublish ( PServiceManager manager)

Unpublish from a service manager

long commore::Service::unpublish ( )

Unpublish from all service manager


The documentation for this class was generated from the following file: