Click or drag to resize
OSIsoft, LLC

AFCollectiveMember Class

The AFCollectiveMember object is used to provide the information about the member server defined within the AFCollective.

Inheritance Hierarchy
SystemObject
  OSIsoft.AFAFObject
    OSIsoft.AF.CollectiveAFCollectiveMember

Namespace:  OSIsoft.AF.Collective
Assembly:  OSIsoft.AFSDK (in OSIsoft.AFSDK.dll) Version: 2.10.8.440
Syntax
[SerializableAttribute]
public sealed class AFCollectiveMember : AFObject, 
	IComparable<AFCollectiveMember>, IEquatable<AFCollectiveMember>

The AFCollectiveMember type exposes the following members.

Properties
  NameDescription
Public propertyAccountName
This property is the account name that the PI AF Server for this AFCollectiveMember is executing under.
Public propertyCollective
The AFCollective that owns the collective member.
Public propertyCommunicationsGracePeriod
The communication grace period before the CommunicationStatus is set to TimedOutOnPrimary when there has not been any communication with the primary server.
Public propertyCommunicationsPeriod
The communication period that the collective members use to determine each others status.
Public propertyCommunicationStatus
The status of the communication between the members of the collective.
Public propertyCredentialsAccountName Obsolete.
The account name used by the collective member to access primary server.
Public propertyDatabaseVersion
Read-only property that contains a string that uniquely identifies the current database version.
Public propertyDescription
Read/write property that provides a more detailed description of the object.
Public propertyHost
This property is the name of the host machine where the PI AF Server for this AFCollectiveMember is executing.
Public propertyID
Read-only property that provides a unique identifier for the object to be used for quick access that is not dependent upon the index.
(Inherited from AFObject.)
Public propertyIdentity
This read-only property contains identity of the object.
(Inherited from AFObject.)
Public propertyIsAvailable
Indicates if the collective member is available.
Public propertyIsConnected
Indicates if the collective member is being used as the connection to the PI AF Server.
Public propertyIsConnectedToPrimary
Indicates if the client is connected to the primary server within the collective.
Public propertyIsDeleted
This read-only property indicates whether the object has been deleted.
(Inherited from AFObject.)
Public propertyLastCommunicationTime
The last communication time to the primary server within the collective.
Public propertyLastSyncTime
The last synchronization time to the primary server within the collective.
Public propertyName
Read/write property that identifies the name of the object.
Public propertyPISystem
This read-only property allows access to the PISystem associated with this object.
(Inherited from AFObject.)
Public propertyPort
Read/write property that is the port number used to connect to the PI AF Server for this AFCollectiveMember on the remote host.
Public propertyPriority
Indicates the priority order in which to select a collective member.
Public propertyProtocol
Read/write property that is the protocol used to connect to the PI AF Server for this AFCollectiveMember on the remote host.
Public propertyServerRole
The role of the collective member server within the AFCollective.
Public propertyServerVersion
Read-only property that contains a string that uniquely identifies the current server version.
Public propertyStreamedPort
Read-only property that is the port number used to connect to the streamed interface of the PI AF Server for this AFCollectiveMember on the remote host.
Public propertySyncStatus
The status of the synchronization between the members of the collective.
Public propertyTimeOut
Read/write property that is the connection timeout used to connect to the PI AF Server for this AFCollectiveMember on the remote host.
Public propertyUniqueID
Read-only property that provides the object's ID as a String.
(Inherited from AFObject.)
Top
Methods
  NameDescription
Public methodCompareTo(Object)
Compares this instance with a specified Object.
(Inherited from AFObject.)
Public methodCompareTo(AFObject)
Compares this instance with a specified AFObject.
(Inherited from AFObject.)
Public methodCode exampleConnect
Connects to the specific server within the AFCollective using default credentials to allow sending and retrieving data.
Public methodCode exampleConnect(NetworkCredential)
Connects to the specific server within the AFCollective using the specified credentials to allow sending and retrieving data.
Public methodCode exampleConnect(Boolean, IWin32Window)
Connects to the specific server within the AFCollective with a credential prompt if necessary to allow sending and retrieving data.
Public methodEquals(Object)
Determines whether the specified Object is equal to the current object.
(Inherited from AFObject.)
Public methodEquals(AFCollectiveMember)
Indicates whether the current object is equal to another object of the same type.
Public methodEquals(AFObject)
Indicates whether the current object is equal to another object of the same type.
(Inherited from AFObject.)
Public methodGetHashCode
Gets the hash code for this instance of the object which is suitable for use in hashing algorithms and data structures like a hash table.
(Inherited from AFObject.)
Public methodGetPath
Returns the full path to the object, using just the names.
(Inherited from AFObject.)
Public methodGetPath(AFObject)
Returns the path to the object relative from another object.
(Inherited from AFObject.)
Public methodGetPath(AFEncodeType, AFObject)
Returns the path to the object relative from another object, using the name and/or id as specified by encodeType.
(Inherited from AFObject.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Public methodPersist
This method returns the persistence string for the object.
(Inherited from AFObject.)
Public methodReinitializeReplication
Reinitialize the collective member to replicate data between members.
Public methodSetCredentialsAccount Obsolete.
Set the account used to by the collective member to access primary server.
Public methodStartReplication
Initialize the collective member to start replication of data between members.
Public methodStopReplication
Stop the collective member from replicating data between members.
Public methodToString
Returns a String that represents the current object.
(Inherited from AFObject.)
Top
Remarks

This class provides information about the member server defined with the AFCollective. This object is used to check status and change configuration options, but it is not a replacement for a PISystem object used to communicate with an PI AF Server. A PISystem representing the AFCollective and connected to one of the collective members can be obtained from the PISystems collection.

Changes to the collective server information can be saved to the server using one of the AFCollective.ApplyChanges Overload methods. If a new member is added to the collective, then the StartReplication method should be called to enable replication between the servers.

Examples
// This example demonstrates how to create and remove a collective.

// Add the PISystem to be used as the primary
PISystems myPISystems = new PISystems();
PISystem primary = myPISystems.Add(primaryName);
primary.Connect();

// Check if primary is already a collective
if (primary.Collective != null)
    throw new InvalidOperationException(string.Format("Primary '{0}' is already a collective.", primary.Name));

// Add the PISystem to be used as the secondary
PISystem secondary = myPISystems.Add(secondaryName);
secondary.Connect();

// Check if secondary is already a collective
if (secondary.Collective != null)
    throw new InvalidOperationException(string.Format("Secondary '{0}' is already a collective.", secondary.Name));

// Create the collective
AFCollective collective = primary.CreateCollective();
primary.Name = "Test-Collective";           // Change the collective name
primary.Description = "The Collective";     // Change the collective description

// Add members to the collective
AFCollectiveMember primaryMember = collective.FindPrimary();
if (primaryMember == null)
    throw new InvalidOperationException("Could not find primary.");
primaryMember.Description = "The Primary Member";
AFCollectiveMember secondaryMember = collective.Members.Add(secondary);
secondaryMember.Description = "The Secondary Member";
collective.ApplyChanges();

// Initialize replication of the database on the primary
primaryMember.StartReplication();

// Wait until the primary is ready before starting replication
//  on the secondaries.
collective.Refresh();
while (primaryMember.SyncStatus != AFSyncStatus.NoConfiguredSubscriptions)
{
    System.Threading.Thread.Sleep(TimeSpan.FromSeconds(30));
    collective.Refresh();
}

// Initialize replication of the database on the secondaries
foreach (AFCollectiveMember member in collective.Members)
{
    if (member.ServerRole != AFServerRole.Primary)
        member.StartReplication();
}

// Display Collective Information
Console.WriteLine("Name of Collective = {0}", primary.Name);
Console.WriteLine("Description = {0}", primary.Description);
foreach (AFCollectiveMember CurMember in primary.Collective.Members)
{
    Console.WriteLine("  Name of Member = {0}", CurMember.Name);
    Console.WriteLine("  Description = {0}", CurMember.Description);
    Console.WriteLine("  IsAvailable = {0}", CurMember.IsAvailable);
    Console.WriteLine();
}
Version Information

AFSDK

Supported in: 2.10.5, 2.10, 2.9.5, 2.9, 2.8.5, 2.8, 2.7.5, 2.7, 2.6, 2.5, 2.4
See Also
Enabling Operational Intelligence