001//
002// Name
003//  $RCSfile: ReplicaNode.java,v $
004// 
005// Copyright
006//  Confidential Property of Kabira Technologies, Inc.
007//  Copyright 2010 by Kabira Technologies, Inc.
008//  All rights reserved.
009//
010// History
011//  $Revision: 1.1.2.2 $ $Date: 2011/09/13 22:00:52 $
012//
013package com.kabira.platform.highavailability;
014
015/**
016 * Replica node entry
017 */
018public class ReplicaNode
019{
020    /**
021     * An enumeration of how objects are sent to replica nodes.
022     */
023    public enum ReplicationType
024    {
025        /**
026         * All creates, updates, and deletes to a partitioned object are
027         * sent synchronously within the same transaction.
028         */
029        SYNCHRONOUS,
030        /**
031         * All creates, updates, and deletes to a partitioned object are
032         * are sent asynchronously in a separate transaction after the
033         * calling transaction commits.
034         */
035        ASYNCHRONOUS
036    }
037
038    /**
039     * Construct a ReplicaNode entry
040     *
041     * @param nodeName Replica node name.
042     * @param replicationType How objects are replicated to the remote node.
043     */
044    public ReplicaNode(String nodeName, ReplicationType replicationType)
045    {
046        this.nodeName = nodeName;
047        this.replicationType = replicationType;
048    }
049
050    /**
051     * Get the Replica node name.
052     * @return Replica node name.
053     */
054    public final String getNodeName()
055    {
056        return nodeName;
057    }
058
059    /**
060     * Get the ReplicationType value for the replica.
061     * @return ReplicationType value.
062     */
063    public final ReplicationType getReplicationType()
064    {
065        return replicationType;
066    }
067
068    /**
069     * Replica node name.
070     */
071    final String           nodeName;
072
073    /**
074     * How objects are replicated to this node. 
075     */
076    final ReplicationType  replicationType;
077
078    //
079    // Never should be called
080    //
081    private ReplicaNode()
082    {
083        this.nodeName = null;
084        this.replicationType = null;
085    }
086}