com.pcbsys.nirvana.nAdminAPI.nClusterNode Class Reference

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

Inheritance diagram for com.pcbsys.nirvana.nAdminAPI.nClusterNode:

com.pcbsys.nirvana.nAdminAPI.nContainer com.pcbsys.nirvana.nAdminAPI.nNode

Public Member Functions

void addConnectionListener (final nClusterConnectionListener listener) throws nBaseAdminException
 Adds a nClusterConnectionListener to the cluster to receive callbacks as connections are made or lost to any realms within the cluster.
void addConnectionListenerToAllLeafNodes (final nConnectionListener listener) throws nBaseAdminException
 Adds a nConnectionListener to each nLeaNode of each nRealmNode in the cluster.
void addConnectionListenerToAllServiceNodes (final nConnectionListener listener) throws nBaseAdminException
 Adds a nConnectionListener to each nServiceNode of each nRealmNode in the cluster.
void addListener (final nClusterEventListener listener)
 Adds a nClusterEventListener to the cluster to receive callbacks as the state of the cluster changes.
void addMember (final nClusterMemberConfiguration node) throws nSessionNotConnectedException, nRequestTimedOutException, nSecurityException, nBaseClientException
 Adds a new node to an existing cluster.
boolean canBeMaster (final nRealmNode node) throws nSecurityException, nBaseClientException
 Tests to see if the supplied node can be master of the cluster.
void close ()
 Closes connections to all realms for the specified Nirvana Realm server.
void closed (nRealmNode node)
 Called when the nRealmNode is closed, for internal use only.
nClusterSite createSite (String name, String initialRealm) throws Exception
 Method that allows you to create a site from a cluster node.
void delConnectionListener (final nClusterConnectionListener listener) throws nBaseAdminException
 Removes a nClusterConnectionListener from the cluster.
void deleteMember (nRealmNode node, boolean deleteStore) throws nBaseClientException, nSessionNotConnectedException, nSecurityException
 Removes the specified realm from the cluster.
void deleteMember (nRealmNode node) throws nBaseClientException, nSessionNotConnectedException, nSecurityException
 Removes the specified realm from the cluster.
void deleteSite (nClusterSite site) throws Exception
 Method that allows you to delete a site.
void delListener (final nClusterEventListener listener)
 Deregisters a nClusterEventListener from the cluster for callbacks.
void destroy (boolean deleteStore) throws nBaseClientException, nSessionNotConnectedException, nSecurityException
 Deletes the cluster and removes all known realms from the cluster.
void destroy () throws nBaseClientException, nSessionNotConnectedException, nSecurityException
 Deletes the cluster and removes all known realms from the cluster.
Vector getClusterConnectionStatus ()
 Returns a Vector of nClusterStatus which contains the current cluster status.
nRealmNode getMaster (long timeout) throws Exception
 Returns the current master of the cluster.
nRealmNode getMaster ()
 Returns the current master of the cluster.
int getNoOfSites ()
 Returns the number of defined nClusterSite objects.
Iterator getSites ()
 Returns an iterator of nClusterSite objects.
boolean hasMember (final String realm) throws nBaseClientException
 Tests to see if the supplied realm name is part of the cluster.
boolean hasMember (final nRealmNode node) throws nSecurityException, nBaseClientException
 Tests to see if the supplied node is part of the cluster.
boolean hasquorum ()
 Tests to see if the cluster has quorum and is functioning.
boolean hasSites ()
 Returns true if the cluster uses sites.
void modifyMember (nClusterMemberConfiguration config) throws nBaseClientException
 Modifies the specified realm in the cluster as far as the CanBeMaster flag.

Static Public Member Functions

static nClusterNode create (final String clusterName, final nClusterMemberConfiguration[] realms, boolean convertLocal, nClusterConversionStatus callback) throws nSessionNotConnectedException, nSecurityException, nRequestTimedOutException, nIllegalArgumentException, nSessionPausedException, nUnexpectedResponseException, nRealmUnreachableException, nNameSpaceConflictException, nRealmNotFoundException
 Creates a new cluster with the supplied array of nClusterMemberConfiguration.
static nClusterNode create (final String clusterName, final nClusterMemberConfiguration[] realms, boolean convertLocal) throws nSessionNotConnectedException, nSecurityException, nRequestTimedOutException, nIllegalArgumentException, nSessionPausedException, nUnexpectedResponseException, nRealmUnreachableException, nNameSpaceConflictException, nRealmNotFoundException
 Creates a new cluster with the supplied array of nClusterMemberConfiguration.
static nClusterNode create (final String clusterName, final nClusterMemberConfiguration[] realms) throws nSessionNotConnectedException, nSecurityException, nRequestTimedOutException, nIllegalArgumentException, nSessionPausedException, nUnexpectedResponseException, nRealmUnreachableException, nNameSpaceConflictException, nRealmNotFoundException
 Creates a new cluster with the supplied array of nClusterMemberConfiguration.
static nClusterNode find (final String clusterName)
 Returns the nClusterNode for the specified clusterName.
static nClusterNode getInstance (final nSessionAttributes attr) throws nBaseAdminException
 Creates an instance of a nClusterNode for any cluster found on the realm specified by the nSessionAttributes.
static nClusterNode getInstance (final nSessionAttributes attr, final String username) throws nBaseAdminException
 Creates an instance of a nClusterNode for any cluster found on the realm specified by the nSessionAttributes and the username.
static nClusterNode getInstance (final String rname) throws nBaseAdminException, nIllegalArgumentException
 Creates an instance of a nClusterNode for any cluster found on the realm specified by the rname.
static Vector getKnownClusters ()
 Return a Vector of nCluster nodes.

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 ( final nClusterConnectionListener  listener  )  throws nBaseAdminException

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

Parameters:
listener to register for callbacks.

void com.pcbsys.nirvana.nAdminAPI.nClusterNode.addConnectionListenerToAllLeafNodes ( final nConnectionListener  listener  )  throws nBaseAdminException

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

Parameters:
listener to register for callbacks.

void com.pcbsys.nirvana.nAdminAPI.nClusterNode.addConnectionListenerToAllServiceNodes ( final nConnectionListener  listener  )  throws nBaseAdminException

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

Parameters:
listener to register for callbacks.

void com.pcbsys.nirvana.nAdminAPI.nClusterNode.addListener ( final nClusterEventListener  listener  ) 

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

Parameters:
listener to register for callbacks.

void com.pcbsys.nirvana.nAdminAPI.nClusterNode.addMember ( final nClusterMemberConfiguration  node  )  throws nSessionNotConnectedException, nRequestTimedOutException, nSecurityException, nBaseClientException

Adds a new node to an existing cluster.

Parameters:
node details about the new node to add.
Exceptions:
nSessionNotConnectedException if unable to connect to the new node.
nRequestTimedOutException if the node fails to respond within the timout period.
nSecurityException if the client has no administration priviliges on the node.
nBaseClientException if any unexpected exceptions are raised.

boolean com.pcbsys.nirvana.nAdminAPI.nClusterNode.canBeMaster ( final nRealmNode  node  )  throws nSecurityException, nBaseClientException

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

Parameters:
node to test.
Returns:
true if the node is defined as able to be master.
Exceptions:
nSecurityException if the client is not authorized.
nBaseClientException if the node is not connected.

void com.pcbsys.nirvana.nAdminAPI.nClusterNode.closed ( nRealmNode  node  ) 

Called when the nRealmNode is closed, for internal use only.

Parameters:
node The nRealmNode which has been closed.

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

Creates a new cluster with the supplied array of nClusterMemberConfiguration.

Parameters:
clusterName Name of the new cluster.
realms array of nClusterMemberConfiguration to use to generate the cluster.
convertLocal Flag to indicate that the first master realm in the list should have the local stores converted to cluster wide stores
callback A callback to indicate the status of the cluster formation. Useful when converting an exisiting realm with stores into a cluster
Returns:
nClusterNode of the resulting cluster.
Exceptions:
nSessionNotConnectedException if unable to connect to any of the realms.
nSecurityException if no administration rights on any of the realms.
nRequestTimedOutException if any of the realms fail to respond within the time out period.
nIllegalArgumentException if any of the realms specify the same physical realm.
nSessionPausedException if any of the realms sessions are paused.
nUnexpectedResponseException if any of the realms respond incorrectly.
nRealmUnreachableException if any of the realms are currently unreachable.
nNameSpaceConflictException if any of the realms conflict with anothers namespace.
nRealmNotFoundException if any of the realms are not found.
See also:
nClusterConversionStatus

Creates a new cluster with the supplied array of nClusterMemberConfiguration.

Parameters:
clusterName Name of the new cluster.
realms array of nClusterMemberConfiguration to use to generate the cluster.
convertLocal Flag to indicate that the first master realm in the list should have the local stores converted to cluster wide stores
Returns:
nClusterNode of the resulting cluster.
Exceptions:
nSessionNotConnectedException if unable to connect to any of the realms.
nSecurityException if no administration rights on any of the realms.
nRequestTimedOutException if any of the realms fail to respond within the time out period.
nIllegalArgumentException if any of the realms specify the same physical realm.
nSessionPausedException if any of the realms sessions are paused.
nUnexpectedResponseException if any of the realms respond incorrectly.
nRealmUnreachableException if any of the realms are currently unreachable.
nNameSpaceConflictException if any of the realms conflict with anothers namespace.
nRealmNotFoundException if any of the realms are not found.

Creates a new cluster with the supplied array of nClusterMemberConfiguration.

Parameters:
clusterName Name of the new cluster.
realms array of nClusterMemberConfiguration to use to generate the cluster.
Returns:
nClusterNode of the resulting cluster.
Exceptions:
nSessionNotConnectedException if unable to connect to any of the realms.
nSecurityException if no administration rights on any of the realms.
nRequestTimedOutException if any of the realms fail to respond within the time out period.
nIllegalArgumentException if any of the realms specify the same physical realm.
nSessionPausedException if any of the realms sessions are paused.
nUnexpectedResponseException if any of the realms respond incorrectly.
nRealmUnreachableException if any of the realms are currently unreachable.
nNameSpaceConflictException if any of the realms conflict with anothers namespace.
nRealmNotFoundException if any of the realms are not found.

nClusterSite com.pcbsys.nirvana.nAdminAPI.nClusterNode.createSite ( String  name,
String  initialRealm 
) throws Exception

Method that allows you to create a site from a cluster node.

Parameters:
name the name of the site to create
initialRealm the initial realm that will be added to the site
Returns:
a new cluster site object
Exceptions:
Exception if the site was not able to be created

void com.pcbsys.nirvana.nAdminAPI.nClusterNode.delConnectionListener ( final nClusterConnectionListener  listener  )  throws nBaseAdminException

Removes a nClusterConnectionListener from the cluster.

Parameters:
listener to register for callbacks.

void com.pcbsys.nirvana.nAdminAPI.nClusterNode.deleteMember ( nRealmNode  node,
boolean  deleteStore 
) throws nBaseClientException, nSessionNotConnectedException, nSecurityException

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:
node to remove from the cluster.
deleteStore flag to indicate that the call should also delete ALL cluster stores
Exceptions:
nBaseClientException if any nodes fail during the process.
nSessionNotConnectedException if any of the nodes are not connected.
nSecurityException if the client is not authorised.

void com.pcbsys.nirvana.nAdminAPI.nClusterNode.deleteMember ( nRealmNode  node  )  throws nBaseClientException, nSessionNotConnectedException, nSecurityException

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:
node to remove from the cluster.
Exceptions:
nBaseClientException if any nodes fail during the process.
nSessionNotConnectedException if any of the nodes are not connected.
nSecurityException if the client is not authorised.

void com.pcbsys.nirvana.nAdminAPI.nClusterNode.deleteSite ( nClusterSite  site  )  throws Exception

Method that allows you to delete a site.

Parameters:
site the cluster site to delete
Exceptions:
Exception if the site was not able to be created

void com.pcbsys.nirvana.nAdminAPI.nClusterNode.delListener ( final nClusterEventListener  listener  ) 

Deregisters a nClusterEventListener from the cluster for callbacks.

Parameters:
listener to be removed.

void com.pcbsys.nirvana.nAdminAPI.nClusterNode.destroy ( boolean  deleteStore  )  throws nBaseClientException, nSessionNotConnectedException, nSecurityException

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

Parameters:
deleteStore flag to indicate that the call should also delete ALL cluster stores
Exceptions:
nBaseClientException if any nodes fail during the process.
nSessionNotConnectedException if any of the nodes are not connected.
nSecurityException if the client is not authorised.

void com.pcbsys.nirvana.nAdminAPI.nClusterNode.destroy (  )  throws nBaseClientException, nSessionNotConnectedException, nSecurityException

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

Exceptions:
nBaseClientException if any nodes fail during the process.
nSessionNotConnectedException if any of the nodes are not connected.
nSecurityException if the client is not authorised.

static nClusterNode com.pcbsys.nirvana.nAdminAPI.nClusterNode.find ( final String  clusterName  )  [static]

Returns the nClusterNode for the specified clusterName.

Parameters:
clusterName name of the cluster to lookup.
Returns:
nClusterNode or null if no such cluster is found.

Vector com.pcbsys.nirvana.nAdminAPI.nClusterNode.getClusterConnectionStatus (  ) 

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

Returns:
Vector of nClusterStatus.

static nClusterNode com.pcbsys.nirvana.nAdminAPI.nClusterNode.getInstance ( final nSessionAttributes  attr  )  throws nBaseAdminException [static]

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

Parameters:
attr Session 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:
nBaseAdminException if unable to connect to the remote realm

static nClusterNode com.pcbsys.nirvana.nAdminAPI.nClusterNode.getInstance ( final nSessionAttributes  attr,
final String  username 
) throws nBaseAdminException [static]

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

Parameters:
attr Session attributes to connect to the remote Nirvana Realm
username to use to authenticate
Returns:
If any cluster has been defined on the specified realm, will return the nClusterNode relevant.
Exceptions:
nBaseAdminException if unable to connect to the remote realm

static nClusterNode com.pcbsys.nirvana.nAdminAPI.nClusterNode.getInstance ( final String  rname  )  throws nBaseAdminException, nIllegalArgumentException [static]

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

Parameters:
rname Nirvana Realm server URL
Returns:
If any cluster has been defined on the specified realm, will return the nClusterNode relevant.
Exceptions:
nBaseAdminException if the user has no administration priviliges
nIllegalArgumentException if the rname is not valid

static Vector com.pcbsys.nirvana.nAdminAPI.nClusterNode.getKnownClusters (  )  [static]

Return a Vector of nCluster nodes.

Returns:
Vector of nodes.

nRealmNode com.pcbsys.nirvana.nAdminAPI.nClusterNode.getMaster ( long  timeout  )  throws Exception

Returns the current master of the cluster.

Parameters:
timeout the amount of time in milliseconds to wait for the connection to the master
Returns:
String name of the master.

nRealmNode com.pcbsys.nirvana.nAdminAPI.nClusterNode.getMaster (  ) 

Returns the current master of the cluster.

If the master is not currently connected it will return null

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

Iterator com.pcbsys.nirvana.nAdminAPI.nClusterNode.getSites (  ) 

Returns an iterator of nClusterSite objects.

Returns:
an iterator of nClusterSite objects
See also:
nClusterSite

boolean com.pcbsys.nirvana.nAdminAPI.nClusterNode.hasMember ( final String  realm  )  throws nBaseClientException

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

Parameters:
realm name to test.
Returns:
true if the realm is defined in the cluster else false.
Exceptions:
nBaseClientException if the node is not connected.
Since:
4.0

boolean com.pcbsys.nirvana.nAdminAPI.nClusterNode.hasMember ( final nRealmNode  node  )  throws nSecurityException, nBaseClientException

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

Parameters:
node to test.
Returns:
true if the node is defined in the cluster else false.
Exceptions:
nSecurityException if the client is not authorized.
nBaseClientException if the node is not connected.

boolean 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.modifyMember ( nClusterMemberConfiguration  config  )  throws nBaseClientException

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:
config The ClusterMemberConfiguration object refering to the node and configuration
Exceptions:
nBaseClientException if any nodes fail during the process.
nSessionNotConnectedException if any of the nodes are not connected.
nSecurityException if the client is not authorised.