MoleQueue  0.8.0
 All Classes Functions Variables Enumerations Enumerator Pages
Public Slots | Signals | Public Member Functions | Protected Slots | Protected Member Functions | Protected Attributes | List of all members
Server Class Reference

#include <server.h>

Inheritance diagram for Server:

Public Slots

void start ()
 
void forceStart ()
 
void stop (bool force)
 
void stop ()
 
void dispatchJobStateChange (const MoleQueue::Job &job, MoleQueue::JobState oldState, MoleQueue::JobState newState)
 

Signals

void connectionError (MoleQueue::ConnectionListener::Error error, const QString &message)
 

Public Member Functions

 Server (QObject *parentObject=0, QString serverName_="MoleQueue")
 
 ~Server ()
 
JobManagerjobManager ()
 
const JobManagerjobManager () const
 
QueueManagerqueueManager ()
 
const QueueManagerqueueManager () const
 
void readSettings (QSettings &settings)
 
void writeSettings (QSettings &settings) const
 
QString workingDirectoryBase () const
 
QString serverName () const
 

Protected Slots

void jobAboutToBeAdded (MoleQueue::Job job)
 
void newConnectionAvailable (MoleQueue::Connection *connection)
 
void clientDisconnected ()
 
void handleMessage (const MoleQueue::Message &message)
 

Protected Member Functions

void timerEvent (QTimerEvent *)
 

Protected Attributes

QList< Connection * > m_connections
 
JobManagerm_jobManager
 
QueueManagerm_queueManager
 
JsonRpcm_jsonrpc
 
QString m_workingDirectoryBase
 
IdType m_moleQueueIdCounter
 
QMap< IdType, Connection * > m_connectionLUT
 
QMap< IdType, EndpointIdType > m_endpointLUT
 

Detailed Description

The Server class handles incoming JSON-RPC messages.

Author
David C. Lonie

The Server class is the root of the server-side heirarchy. It owns the JobManager, QueueManager, and JsonRpc listener.

Constructor & Destructor Documentation

Server ( QObject *  parentObject = 0,
QString  serverName_ = "MoleQueue" 
)
explicit

Constructor.

Parameters
parentObjectThe parent.
~Server ( )

Destructor.

Member Function Documentation

JobManager* jobManager ( )
Returns
A pointer to the Server JobManager.
const JobManager* jobManager ( ) const
Returns
A pointer to the Server JobManager.
QueueManager* queueManager ( )
Returns
A pointer to the Server QueueManager.
const QueueManager* queueManager ( ) const
Returns
A pointer to the Server QueueManager.
void readSettings ( QSettings &  settings)
Parameters
settingsQSettings object to write state to.
void writeSettings ( QSettings &  settings) const
Parameters
settingsQSettings object to read state from.
QString workingDirectoryBase ( ) const

The working directory where running job file are kept.

QString serverName ( ) const

The string the server uses to listen for connections.

void connectionError ( MoleQueue::ConnectionListener::Error  error,
const QString &  message 
)
signal

Emitted when a connection listener fails to start.

void start ( )
slot

Start listening for incoming connections.

If an error occurs, connectionError will be emitted. If an AddressInUseError occurs on Unix due to a crashed Server that failed to clean up, call forceStart to remove any existing sockets.

void forceStart ( )
slot

Start listening for incoming connections, removing any existing socket handles first.

void stop ( bool  force)
slot

Terminate the socket server.

Parameters
Serverwill pass the value of force when stop it connections.
void stop ( )
slot

Terminate the socket server.

Same as stop(false)

void dispatchJobStateChange ( const MoleQueue::Job job,
MoleQueue::JobState  oldState,
MoleQueue::JobState  newState 
)
slot

Find the client that owns job and send a notification to the client that the JobState has changed.

Parameters
jobJob of interest.
oldStatePrevious state of job.
newStateNew state of job.
void jobAboutToBeAdded ( MoleQueue::Job  job)
protectedslot

Set the MoleQueue Id of a job before it is added to the manager.

Parameters
jobThe new Job.
void newConnectionAvailable ( MoleQueue::Connection connection)
protectedslot

Called when the internal socket server has a new connection ready.

void clientDisconnected ( )
protectedslot

Called when a client disconnects from the server. This function expects sender() to return a ServerConnection.

void handleMessage ( const MoleQueue::Message message)
protectedslot

handleMessage Called when the JsonRpc listener receives a message.

void timerEvent ( QTimerEvent *  )
protected

timerEvent Reimplemented from QObject.

Member Data Documentation

QList<Connection*> m_connections
protected

List of active connections.

JobManager* m_jobManager
protected

The JobManager for this Server.

QueueManager* m_queueManager
protected

The QueueManager for this Server.

JsonRpc* m_jsonrpc
protected

The JsonRpc listener for this Server.

QString m_workingDirectoryBase
protected

Local directory for running jobs.

IdType m_moleQueueIdCounter
protected

Counter for MoleQueue job ids.


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