com::pcbsys::nirvana::nAdminAPI::nClusterNode Class Reference

Contains the status and configuration of a Nirvana cluster. More...

#include <nClusterNode.h>

Inheritance diagram for com::pcbsys::nirvana::nAdminAPI::nClusterNode:
com::pcbsys::nirvana::nAdminAPI::nContainer com::pcbsys::nirvana::nAdminAPI::nNode

Public Member Functions

void addConnectionListener (nClusterConnectionListener *pListener)
 Adds a nClusterConnectionListener to the cluster to receive callbacks as connections are made or lost to any realms within the cluster. More...
 
void addConnectionListenerToAllLeafNodes (nAPIConnectionListener *pListener)
 Adds a nConnectionListener to each nLeaNode of each nRealmNode in the cluster. More...
 
void addListener (nClusterEventListener *pListener)
 Adds a nClusterEventListener to the cluster to receive callbacks as the state of the cluster changes. More...
 
void addMember (nClusterMemberConfiguration *pNode)
 Adds a new node to an existing cluster. More...
 
bool canBeMaster (nRealmNode *pNode)
 Tests to see if the supplied node can be master of the cluster. More...
 
void close ()
 Closes connections to all realms for the specified Nirvana Realm server.
 
virtual void closed (nRealmNode *pNode)
 Called when a realm node is closed, for internal use only. More...
 
void delConnectionListener (nClusterConnectionListener *pListener)
 Removes a nClusterConnectionListener from the cluster. More...
 
void deleteMember (nRealmNode *pNode, bool deleteStore=false)
 Removes the specified realm from the cluster. More...
 
void deleteSite (nClusterSite *pSite)
 Method that allows you to delete a site. More...
 
void delListener (nClusterEventListener *pListener)
 Deregisters a nClusterEventListener from the cluster for callbacks. More...
 
void deregisterRemoteCluster (nClusterNode *remoteCluster)
 Removes the remote node given by the parameter remoteCluster from this cluster node. More...
 
void destroy (bool deleteStore=false)
 Deletes the cluster and removes all known realms from the cluster. More...
 
std::list< nClusterStatus * > & getClusterConnectionStatus ()
 Returns a list of nClusterStatus which contains the current cluster status. More...
 
nRealmNodegetMaster ()
 Returns the current master of the cluster. More...
 
nRealmNodegetMaster (long timeout)
 Returns the current master of the cluster. More...
 
int getNoOfSites ()
 Returns the number of defined nClusterSite objects. More...
 
nClusterSitegetSite (const std::string &site)
 Returns an iterator of nClusterSite objects. More...
 
fSortedList< std::string,
nClusterSite * > & 
getSites ()
 Returns a list of nClusterSite objects. More...
 
virtual int getType ()
 Returns the type of node that this object represents. More...
 
bool hasMember (nRealmNode *pNode)
 Tests to see if the supplied node is part of the cluster. More...
 
bool hasMember (const std::string &realm)
 Tests to see if the supplied realm name is part of the cluster. More...
 
bool hasquorum ()
 Tests to see if the cluster has quorum and is functioning. More...
 
bool hasSites ()
 Returns true if the cluster uses sites.
 
void joinRemoteClusterStore (nLeafNode *source, nLeafNode *destination, bool isRouted, int hopCount, std::string selector, bool allowPurge)
 Joins the stores between two different clusters together. More...
 
void modifyMember (nClusterMemberConfiguration *pConfig)
 Modifies the specified realm in the cluster as far as the CanBeMaster flag. More...
 
 nClusterNode (void)
 Constructs a new nClusterNode.
 
void registerRemoteCluster (nClusterNode *remoteCluster)
 Adds the realm nodes in the remoteCluster node to this clusterNode, creating a logical connection between them. More...
 
- Public Member Functions inherited from com::pcbsys::nirvana::nAdminAPI::nContainer
void addACLEntries (nACL *pAcl, nNode **ppNodes=NULL, int numNode=0)
 Adds an acl to the list of nodes. More...
 
virtual void addACLEntry (nACLEntry *pEntry, bool bAllChannels=true, bool bAllQueues=true)
 Adds a specific acl entry to all known nodes within the nContainer node. More...
 
virtual nNodefindNode (std::string name)
 Given a name of the form /container/container/name this function will locate the name object and return it, or null if that object can not be found. More...
 
virtual nNodefindNode (nNode *pNode)
 Given a name of the form /container/container/name this function will locate the nNode object and return it, or null if that can not be found. More...
 
virtual nNodefindNode (nNode *pNode, bool searchChildren)
 Given a name of the form /container/container/name this function will locate the name object and return it, or null if that can not be found. More...
 
virtual nNodegetNextSibling (int idx=0)
 In findnode we were calling getNextSibling and occassionally hitting an nDataStreamNode. More...
 
virtual fSortedList
< std::string, nNode * > & 
getNodes ()
 Returns an fSortedList of all the nodes under this container. More...
 
virtual nRealmNodegetRealmAt (std::string name)
 Given a mount point this function will return a realm if one exists at the specified mount point. More...
 
virtual int getTotalNodes ()
 Returns the total number of nodes within this container and all subsequent children by traversing the entire structure beneath this container node. More...
 
virtual bool hasRealmAt (std::string name)
 Given a mount point this function will determine if this container contains a mounted realm at the specified mount point. More...
 
void modACLEntries (nACL *pAcl, nNode **ppNodes=NULL, int numNode=0)
 Modifies an existing acl for the list of nodes. More...
 
virtual void modACLEntry (nACLEntry *pEntry, bool bAllChannels=true, bool bAllQueues=true)
 modifies a specific acl entry's permissions for all known nodes within the nContainer node. More...
 
void removeACLEntries (nACL *pAcl, nNode **ppNodes=NULL, int numNode=0)
 Removes the contents of an acl list from the list of nodes. More...
 
virtual void removeACLEntry (nACLEntry *pEntry, bool bAllChannels=true, bool bAllQueues=true)
 removes a specific acl entry from all known nodes within the nContainer node. More...
 
virtual void setACL (nACL *pAcl, bool allChannels=true, bool allQueues=true, bool allServices=true)
 Changes the entire ACL entries for the selected nodes with the new ACL passed in. More...
 
- Public Member Functions inherited from com::pcbsys::nirvana::nAdminAPI::nNode
virtual BitArray * convertLong (longlong priv)
 Converts from a long to a bitArray used to specify ACL properties. More...
 
virtual nACLEntrycreateACLEntry (const std::string &subject, BitArray *pBs)
 Adds a specific acl entry to the leaf node acl. More...
 
virtual nACLEntrycreateACLEntry (nSecurityGroup *grp, BitArray *pBs)
 Adds a specific security group to the leaf node acl. More...
 
virtual bool Equals (nNode *pItem)
 Check if this nNode is the same as the nNode passed in. More...
 
virtual bool Equals (const std::string &item)
 Check if the string passed in matches the name of this nNode. More...
 
virtual const std::string & getAbsolutePath ()
 This function walks the tree to the root to generate a fully qualified name for this node. More...
 
const std::string & getInternalName ()
 Returns the name of this nNode. More...
 
const std::string & getName ()
 Returns the name of the node. More...
 
virtual nNodegetParent ()
 Returns this nodes parent node. More...
 
virtual std::string getRelativePath (nNode *pTop)
 This method returns the relative path from this node to the nNode passed. More...
 
virtual bool IsRemovable ()
 Returns true if this nNode can be removed. More...
 

Static Public Member Functions

static nClusterNodefind (const std::string &clusterName)
 Returns the nClusterNode for the specified clusterName. More...
 
static nClusterNodegetInstance (nSessionAttributes *pAttr)
 Creates an instance of a nClusterNode for any cluster found on the realm specified by the nSessionAttributes. More...
 
static nClusterNodegetInstance (nSessionAttributes *pAttr, const std::string &username)
 Creates an instance of a nClusterNode for any cluster found on the realm specified by the nSessionAttributes and the username. More...
 
static nClusterNodegetInstance (std::string &rname)
 Creates an instance of a nClusterNode for any cluster found on the realm specified by the rname. More...
 
static std::list< nClusterNode * > * getKnownClusters ()
 Return a list of nCluster nodes. More...
 

Detailed Description

Contains the status and configuration of a Nirvana cluster.

Each Nirvana cluster is made up of multiple Nirvana Realm servers and this group is given a name, the Cluster Name. The class supplies helper functions to query, create and delete clusters.

Member Function Documentation

void com::pcbsys::nirvana::nAdminAPI::nClusterNode::addConnectionListener ( nClusterConnectionListener pListener)

Adds a nClusterConnectionListener to the cluster to receive callbacks as connections are made or lost to any realms within the cluster.

Parameters
pListenerto register for callbacks.
void com::pcbsys::nirvana::nAdminAPI::nClusterNode::addConnectionListenerToAllLeafNodes ( nAPIConnectionListener pListener)

Adds a nConnectionListener to each nLeaNode of each nRealmNode in the cluster.

Parameters
pListenerto register for callbacks.
void com::pcbsys::nirvana::nAdminAPI::nClusterNode::addListener ( nClusterEventListener pListener)

Adds a nClusterEventListener to the cluster to receive callbacks as the state of the cluster changes.

Parameters
pListenerto register for callbacks.
void com::pcbsys::nirvana::nAdminAPI::nClusterNode::addMember ( nClusterMemberConfiguration pNode)

Adds a new node to an existing cluster.

Parameters
pNodedetails about the new node to add.
Exceptions
nSessionNotConnectedExceptionif unable to connect to the new node.
nRequestTimedOutExceptionif the node fails to respond within the timout period.
nSecurityExceptionif the client has no administration priviliges on the node.
nBaseClientExceptionif any unexpected exceptions are raised.
bool com::pcbsys::nirvana::nAdminAPI::nClusterNode::canBeMaster ( nRealmNode pNode)

Tests to see if the supplied node can be master of the cluster.

Parameters
pNodeto test.
Returns
true if the node is defined as able to be master.
Exceptions
nSecurityExceptionif the client is not authorized.
nBaseClientExceptionif the node is not connected.
virtual void com::pcbsys::nirvana::nAdminAPI::nClusterNode::closed ( nRealmNode pNode)
virtual

Called when a realm node is closed, for internal use only.

Parameters
*pNodethe node which has been closed

Reimplemented from com::pcbsys::nirvana::nAdminAPI::nContainer.

void com::pcbsys::nirvana::nAdminAPI::nClusterNode::delConnectionListener ( nClusterConnectionListener pListener)

Removes a nClusterConnectionListener from the cluster.

Parameters
pListenerto register for callbacks.
void com::pcbsys::nirvana::nAdminAPI::nClusterNode::deleteMember ( nRealmNode pNode,
bool  deleteStore = false 
)

Removes the specified realm from the cluster.

The cluster must be running and all members of the cluster online for this to work correctly.

Parameters
pNodeto remove from the cluster.
deleteStoreflag to indicate that the call should also delete ALL cluster stores
Exceptions
nBaseClientExceptionif any nodes fail during the process.
nSessionNotConnectedExceptionif any of the nodes are not connected.
nSecurityExceptionif the client is not authorised.
void com::pcbsys::nirvana::nAdminAPI::nClusterNode::deleteSite ( nClusterSite pSite)

Method that allows you to delete a site.

Parameters
pSitethe cluster site to delete
Exceptions
Exceptionif the site was not able to be created
void com::pcbsys::nirvana::nAdminAPI::nClusterNode::delListener ( nClusterEventListener pListener)

Deregisters a nClusterEventListener from the cluster for callbacks.

Parameters
pListenerto be removed.
void com::pcbsys::nirvana::nAdminAPI::nClusterNode::deregisterRemoteCluster ( nClusterNode remoteCluster)

Removes the remote node given by the parameter remoteCluster from this cluster node.

If the remoteCluster is null, or remoteCluster is the same as this cluster node, this method will throw an Exception.

Parameters
remoteClusterThe remoteCluster to remove from this cluster nodes realm list.
Exceptions
ExceptionIf remoteCluster is null, or is the same as this cluster node.
void com::pcbsys::nirvana::nAdminAPI::nClusterNode::destroy ( bool  deleteStore = false)

Deletes the cluster and removes all known realms from the cluster.

Parameters
deleteStoreflag to indicate that the call should also delete ALL cluster stores
Exceptions
nBaseClientExceptionif any nodes fail during the process.
nSessionNotConnectedExceptionif any of the nodes are not connected.
nSecurityExceptionif the client is not authorised.
static nClusterNode* com::pcbsys::nirvana::nAdminAPI::nClusterNode::find ( const std::string &  clusterName)
static

Returns the nClusterNode for the specified clusterName.

Parameters
clusterNamename of the cluster to lookup as a string.
Returns
nClusterNode or null if no such cluster is found.
std::list<nClusterStatus*>& com::pcbsys::nirvana::nAdminAPI::nClusterNode::getClusterConnectionStatus ( )

Returns a list of nClusterStatus which contains the current cluster status.

Returns
list of nClusterStatus.
static nClusterNode* com::pcbsys::nirvana::nAdminAPI::nClusterNode::getInstance ( nSessionAttributes pAttr)
static

Creates an instance of a nClusterNode for any cluster found on the realm specified by the nSessionAttributes.

Parameters
pAttrSession attributes to connect to the remote Nirvana Realm
Returns
If any cluster has been defined on the specified realm, will return the nClusterNode relevant.
Exceptions
nBaseAdminExceptionif unable to connect to the remote realm
static nClusterNode* com::pcbsys::nirvana::nAdminAPI::nClusterNode::getInstance ( nSessionAttributes pAttr,
const std::string &  username 
)
static

Creates an instance of a nClusterNode for any cluster found on the realm specified by the nSessionAttributes and the username.

Parameters
pAttrSession attributes to connect to the remote Nirvana Realm
usernameto use to authenticate
Returns
If any cluster has been defined on the specified realm, will return the nClusterNode relevant.
Exceptions
nBaseAdminExceptionif unable to connect to the remote realm
static nClusterNode* com::pcbsys::nirvana::nAdminAPI::nClusterNode::getInstance ( std::string &  rname)
static

Creates an instance of a nClusterNode for any cluster found on the realm specified by the rname.

Parameters
rnameNirvana Realm server URL
Returns
If any cluster has been defined on the specified realm, will return the nClusterNode relevant.
Exceptions
nBaseAdminExceptionif the user has no administration priviliges
nIllegalArgumentExceptionif the rname is not valid
static std::list<nClusterNode*>* com::pcbsys::nirvana::nAdminAPI::nClusterNode::getKnownClusters ( )
static

Return a list of nCluster nodes.

Returns
list of nodes.
nRealmNode* com::pcbsys::nirvana::nAdminAPI::nClusterNode::getMaster ( )

Returns the current master of the cluster.

Parameters
timeoutthe amount of time in milliseconds to wait for the connection to the master
Returns
nRealmNode of the master.
nRealmNode* com::pcbsys::nirvana::nAdminAPI::nClusterNode::getMaster ( long  timeout)

Returns the current master of the cluster.

Parameters
timeoutthe amount of time in milliseconds to wait for the connection to the master
Returns
String name of the master.
int com::pcbsys::nirvana::nAdminAPI::nClusterNode::getNoOfSites ( )

Returns the number of defined nClusterSite objects.

Returns
a count of nClusterSite objects
See Also
nClusterSite
nClusterSite* com::pcbsys::nirvana::nAdminAPI::nClusterNode::getSite ( const std::string &  site)

Returns an iterator of nClusterSite objects.

Parameters
sitesite name.
Returns
nClusterSite object for specified site.
fSortedList<std::string, nClusterSite*>& com::pcbsys::nirvana::nAdminAPI::nClusterNode::getSites ( )

Returns a list of nClusterSite objects.

Returns
a list of nClusterSite objects
See Also
nClusterSite
virtual int com::pcbsys::nirvana::nAdminAPI::nClusterNode::getType ( )
virtual

Returns the type of node that this object represents.

Returns
the type of this node

Reimplemented from com::pcbsys::nirvana::nAdminAPI::nContainer.

bool com::pcbsys::nirvana::nAdminAPI::nClusterNode::hasMember ( nRealmNode pNode)

Tests to see if the supplied node is part of the cluster.

Parameters
pNodeto test.
Returns
true if the node is defined in the cluster else false.
Exceptions
nSecurityExceptionif the client is not authorized.
nBaseClientExceptionif the node is not connected.
bool com::pcbsys::nirvana::nAdminAPI::nClusterNode::hasMember ( const std::string &  realm)

Tests to see if the supplied realm name is part of the cluster.

Parameters
realmname to test.
Returns
true if the realm is defined in the cluster else false.
Exceptions
nBaseClientExceptionif the node is not connected.
bool com::pcbsys::nirvana::nAdminAPI::nClusterNode::hasquorum ( )

Tests to see if the cluster has quorum and is functioning.

Quorin is defined as the cluster having the ( number of realms ) / 2 +1 being online.

Returns
boolean indicating the current state.
void com::pcbsys::nirvana::nAdminAPI::nClusterNode::joinRemoteClusterStore ( nLeafNode source,
nLeafNode destination,
bool  isRouted,
int  hopCount,
std::string  selector,
bool  allowPurge 
)

Joins the stores between two different clusters together.

Additional parameters specify whether events will be routed, the maximum number of hop counts for events to pass through this join, a selector, and whether or not to allow purging.

Parameters
sourceThe source leaf node for this join
destinationThe destination leaf node for this join
isRoutedboolean which determines if events will be routed
hopCountinteger specifying the maximum hop count that events may have to pass through this join
selectora selector which filters events over this join
allowPurgeboolean to allow purging of events over this join
Exceptions
ExceptionIf source or destination are null, an exception will be thrown. If source or destination are not cluster wide channels/queues, an exception will be thrown. If source and destination reside on the same cluster, an exception will be thrown.
void com::pcbsys::nirvana::nAdminAPI::nClusterNode::modifyMember ( nClusterMemberConfiguration pConfig)

Modifies the specified realm in the cluster as far as the CanBeMaster flag.

The cluster must be running and all members of the cluster online for this to work correctly.

Parameters
pConfigThe ClusterMemberConfiguration object refering to the node and configuration
Exceptions
nBaseClientExceptionif any nodes fail during the process.
nSessionNotConnectedExceptionif any of the nodes are not connected.
nSecurityExceptionif the client is not authorised.
void com::pcbsys::nirvana::nAdminAPI::nClusterNode::registerRemoteCluster ( nClusterNode remoteCluster)

Adds the realm nodes in the remoteCluster node to this clusterNode, creating a logical connection between them.

Parameters
remoteClusternClusterNode containing the remote cluster node to add to this cluster node
Exceptions
ExceptionIf the remoteCluster is null, or if this cluster is the same as remoteCluster.