Server
API Reference Guide
Product Documentation:

Rogue Wave Server
Documentation Home
List of all members | Public Member Functions | Static Public Member Functions

The class IlsMvProcess implements a set of functions needed by any Rogue Wave Server component or server process. More...

#include <ilserver/mvproc.h>

Inheritance diagram for IlsMvProcess:
IlsTcpMvProcess IlsIlvTcpMvProcess

Public Member Functions

 IlsMvProcess ()
 Constructor. More...
 
virtual ~IlsMvProcess ()
 The instance of IlsMvProcess is automatically destroyed by Rogue Wave Server when the process ends.
 

Static Public Member Functions

static IlsMvProcessGetSingletonPtr ()
 Returns the single instance of IlsMvProcess that has been initialized or 0 if none has been initialized. More...
 
Process Name
static IlsBoolean SetName (const IlsString &name)
 Assigns a name to the current process to enable distributed applications to connect to the process. More...
 
static IlsString GetName ()
 Returns the name assigned to the process or by default the null string.
 

Initialization

static IlsBoolean Initialize (int &argc, char **argv)
 Initializes a linked Server process – that is, a process including both server and component(s). More...
 
static IlsBoolean IsInitialized ()
 Returns IlsTrue if the process has already been initialized or IlsFalse otherwise.
 
virtual IlsBoolean initialize (int &argc, char **argv)
 Initializes an instance of IlsMvProcess. More...
 
virtual IlsBoolean localInitialize (int &argc, char **argv)
 Invoked by the member function initialize. More...
 

Connection/Disconnection

IlsMvEndPoint *const * getEndPoints (int &dim)
 Returns an array of all the end points created in the process. More...
 
static IlsMvEndPointGetEndPoint (const IlsString &procName, const IlsString &hostName, IlsBoolean isComp)
 Returns a pointer to the local end point of the connection established with the process procName on host hostName. More...
 
static IlsMvComponentGetComponent (const IlsString &serverName, const IlsString &hostName)
 Similar to the function GetEndPoint(), except that it explicitly looks for a component connected to the server named serverName on host hostName.
 
static IlsMvEndPointConnect (const IlsString &actorName, const IlsString &hostName, const IlsString &myIPAddr=IlsString::Null, IlsBoolean toServer=IlsTrue)
 Enables connection to the process procName running on the host hostName. More...
 
static int DoConnect ()
 Executes the connection to the server(s) specified in the command line using one of the -ilsc or -ilsconnect options. More...
 
static IlsBoolean DisconnectOnComError ()
 Returns the value of the disconnectOnError property. More...
 
static void SetDisconnectOnComError (IlsBoolean b)
 Sets the value of the disconnectOnError property.
 

Execution

virtual void beforeRequest ()
 Called by the subclass of IlsMvProcess before it a request received on the communication layer is processed. More...
 
virtual IlsBoolean processRequest (IlsTime *t)
 Called by IlsMvServer::Run() to execute a request issued by a component. More...
 
virtual void afterRequest ()
 Called by the subclass of IlsMvProcess after a request received on the communication layer has been processed. More...
 
static IlsBoolean Run (int nb=0, IlsTime *t=0)
 Iimplements the default event loop for dynamic-view based processes. More...
 
static IlsBoolean ProcessRequest (IlsTime *t)
 Calls the virtual function processRequest() on the IlsMvProcess singleton.
 
static void Stop ()
 Stops the Run() event loop.
 

Detailed Description

The class IlsMvProcess implements a set of functions needed by any Rogue Wave Server component or server process.

Library: mvserver
and mvcomp

This class lets you define a linked Rogue Wave Server application – that is, an application in which server and component(s) are implemented within the same process. It is also used as the base class for the implementation of distributed server process classes. These derived classes are specific to the communication layer and event loop used:

The class IlsMvProcess defines a set of virtual functions whose purpose is to initialize and execute a Server process and which are overridden in the derived subclasses.

See also
IlsMvServer.

Constructor & Destructor Documentation

◆ IlsMvProcess()

IlsMvProcess::IlsMvProcess ( )

Constructor.

This default constructor is invoked by the Initialize() static member function or by the constructor of a derived class. Only one instance of IlsMvProcess can be created within a process.

Member Function Documentation

◆ afterRequest()

virtual void IlsMvProcess::afterRequest ( )
virtual

Called by the subclass of IlsMvProcess after a request received on the communication layer has been processed.

If you override this method, you must call the base class method.

◆ beforeRequest()

virtual void IlsMvProcess::beforeRequest ( )
virtual

Called by the subclass of IlsMvProcess before it a request received on the communication layer is processed.

If you override this method, you must call the base class method.

◆ Connect()

static IlsMvEndPoint* IlsMvProcess::Connect ( const IlsString actorName,
const IlsString hostName,
const IlsString myIPAddr = IlsString::Null,
IlsBoolean  toServer = IlsTrue 
)
static

Enables connection to the process procName running on the host hostName.

When hostName is an empty string, the local host is selected.

The parameter procName can identify either a distributed server or a distributed component.

If the connection is successful, the function returns a pointer to the connection end point created. You can narrow the result to the derived type IlsMvComponent in case of a connection to a server or to the derived type IlsMvComponentItf in case of a connection to a component. See the member functions IlsMvComponent::Narrow() and IlsMvComponentItf::Narrow() for details.

If the connection fails, the function returns the null pointer.

Note
For a connection to a server, you can use the function IlsMvComponent::Connect() instead of IlsMvProcess::Connect().

◆ DisconnectOnComError()

static IlsBoolean IlsMvProcess::DisconnectOnComError ( )
static

Returns the value of the disconnectOnError property.

When this property is set, a connection to a peer process will be broken if a low-level error occurs while data is being sent. If the server-to-component connection is broken but the disconnect event has not been received from the communication layer, an error is raised when the process tries to send data. By default, this property is IlsTrue and, in this case, the connection is closed.

◆ DoConnect()

static int IlsMvProcess::DoConnect ( )
static

Executes the connection to the server(s) specified in the command line using one of the -ilsc or -ilsconnect options.

Returns
It returns 0 if all connections succeed. Otherwise, it returns the number of unsuccessful connections.

◆ GetEndPoint()

static IlsMvEndPoint* IlsMvProcess::GetEndPoint ( const IlsString procName,
const IlsString hostName,
IlsBoolean  isComp 
)
static

Returns a pointer to the local end point of the connection established with the process procName on host hostName.

Parameters
procNameprocess name
hostNamehost name. When hostName is an empty string, the local host is selected.
isCompindicates whether the connected process has to be a component (if it is set to IlsFalse) or a server (if it is set to IlsTrue).
Returns
The functions returns the null pointer if no connection is found.

◆ getEndPoints()

IlsMvEndPoint* const* IlsMvProcess::getEndPoints ( int &  dim)

Returns an array of all the end points created in the process.

You can use the function IlsMvEndPoint::isComponent() to check that an end point is an instance of IlsMvComponent or of a derived class.

Parameters
dimnumber of end points in the array.
Returns
an array of all the end points created in the process.

◆ GetSingletonPtr()

ILSIMPORT_MVSVR IlsMvProcess * IlsMvProcess::GetSingletonPtr ( )
static

Returns the single instance of IlsMvProcess that has been initialized or 0 if none has been initialized.

Returns
The return value points to an instance of IlsTcpMvProcess or of another actual type of process depending on the initialization done.

◆ Initialize()

static IlsBoolean IlsMvProcess::Initialize ( int &  argc,
char **  argv 
)
static

Initializes a linked Server process – that is, a process including both server and component(s).

This function – or one of the Initialize() member functions of a derived class – must be called once at the beginning of the process before any other server or component is initialized. The arguments argc and argv are those of the main function. See the initialize() member function below for more information about the options supported.

◆ initialize()

virtual IlsBoolean IlsMvProcess::initialize ( int &  argc,
char **  argv 
)
protectedvirtual

Initializes an instance of IlsMvProcess.

It is invoked by the static member functions IlsTcpMvProcess::Initialize(). It must be invoked by any initialization member function belonging to a subtype of IlsMvProcess. It takes the arguments of the command line as its parameters. It first initializes the process by calling the virtual member function localInitialize(). If that member function returns IlsTrue, it then parses and interprets the command line arguments:

  • -ilsname serverName or -ilsn serverName: This option is used by a distributed server to register the process with the name serverName in the communication layer. This name will be used by the component to connect to this server.
  • -ilsconnect serverName[@hostName] or -ilsc serverName[@hostName]: This option requests the connection of a component process to the server process serverName running on the machine hostName, or on the local host if no host name is specified.
  • -ilsview objLabel.viewName or -ilsv objLabel.viewName: This option requests the opening of the dynamic view viewName for the Server object objLabel in asynchronous mode. The request is sent to the server that is specified in the option -ilsconnect or is executed locally when there is no such previous option.
  • -ilspath directory or -ilsp directory: This option adds the directory at the beginning of the ILSPATH environment variable. This ILSPATH variable is used to find the dynamic-view specification or resource files. You may want to refer to the member functions IlsMvServer::Initialize(), IlsMvServer::LoadViewSpec(), and IlsMvServer::LoadResources().
  • -ilshome directory or -ilsh directory: This option sets the environment variable ILSHOME to the directory path. This environment variable is used by Server/Views components to find general data files.
  • -ilstimeout nbSec or -ilst nbSec: This option sets nbSec as the timeout to be passed to the processRequest member function.
  • -ilstrace: This option sets the trace mode for dynamic views either on the server side or on the component side. It is equivalent to setting the environment variable ILS_TRACE.
  • -ilsprotocol_version <version>: This option sets the protocol version in order to allow communication with peers using older versions (server or client). If this is not set, the more recent version is used. You can also set the protocol version using the environment variable ILS_PROTOCOL_VERSION. However, keep in mind the version number set in the command line overrides the one set in the environment variable.

This member function returns IlsFalse if localInitialize() returns IlsFalse or if one of the -ilsconnect options fails. Otherwise, it returns IlsTrue.

◆ localInitialize()

ILSIMPORT_MVSVR IlsBoolean IlsMvProcess::localInitialize ( int &  argc,
char **  argv 
)
protectedvirtual

Invoked by the member function initialize.

It takes the arguments of the command line as its parameters. It has an empty body but is overridden in subclasses of IlsMvProcess.

Reimplemented in IlsIlvTcpMvProcess, and IlsTcpMvProcess.

◆ processRequest()

ILSIMPORT_MVSVR IlsBoolean IlsMvProcess::processRequest ( IlsTime t)
virtual

Called by IlsMvServer::Run() to execute a request issued by a component.

To be effective, it must be overridden in a subtype of IlsMvProcess, as in the classes IlsTcpMvProcess.

As implemented by an IlsMvProcess object, this function does nothing except return IlsFalse.

Parameters
tmaximum time during which the function must wait for an incoming component request.
Returns
If no request is input after the t lapse, the function should return IlsFalse, thus causing the view-server execution loop to stop. Otherwise, it returns IlsTrue.

Reimplemented in IlsTcpMvProcess.

◆ Run()

ILSIMPORT_MVSVR IlsBoolean IlsMvProcess::Run ( int  nb = 0,
IlsTime t = 0 
)
static

Iimplements the default event loop for dynamic-view based processes.

Its main purpose is to provide an abstract interface to execute a distributed component that does not run any other event loop. This function requires that the virtual function processRequest() be overridden in the actual type of the IlsMvProcess singleton, as is the case for IlsTcpMvProcess.

The Run() function stops when it has finished processing the number of requests set by nb (if this number is greater than 0), or if the timeout has been reached during processRequest(), or if the function Stop() has been called.

Parameters
nbnumber of requests to execute. A negative or null value means an infinite number.
ttimeout to be passed to the function processRequest(). If it is 0, no timeout is considered.
Returns
IlsTrue if the number of processed requests is equal to nb or IlsFalse if a timeout occurred.

◆ SetName()

static IlsBoolean IlsMvProcess::SetName ( const IlsString name)
static

Assigns a name to the current process to enable distributed applications to connect to the process.

See the function IlsMvProcess::Connect() and IlsMvComponent::Connect().

This function is implicitly used by Rogue Wave Server when the command line option -ilsname (or -ilsn) is used.