1/*-
2 * See the file LICENSE for redistribution information.
3 *
4 * Copyright (c) 1997,2008 Oracle.  All rights reserved.
5 *
6 * $Id: ReplicationManagerSiteInfo.java,v 12.4 2008/04/02 13:43:38 bschmeck Exp $
7 */
8
9package com.sleepycat.db;
10
11import com.sleepycat.db.internal.DbConstants;
12
13/**
14A simple wrapper class to hold information needed to define a replication site.
15<p>
16ReplicationManagerSiteInfo objects are returned by
17{@link com.sleepycat.db.Environment#getReplicationManagerSiteList
18Environment.getReplicationManagerSiteList}
19*/
20public class ReplicationManagerSiteInfo
21{
22    /** The replication site's address */
23    public ReplicationHostAddress addr;
24    /** The replication site's identifier */
25    public int eid;
26    private int status;
27
28    /**
29    Create a ReplicationManagerSiteInfo with the given information, isConnected defaults to false.
30    */
31    public ReplicationManagerSiteInfo(ReplicationHostAddress hostAddr, int eid)
32    {
33	this(hostAddr, eid, false);
34    }
35
36    /**
37    Create a ReplicationManagerSiteInfo with the given information.
38    */
39    public ReplicationManagerSiteInfo(ReplicationHostAddress hostAddr, int eid, boolean isConnected)
40    {
41        this.addr = hostAddr;
42	this.eid = eid;
43	this.status = isConnected ? DbConstants.DB_REPMGR_CONNECTED : 0;
44    }
45
46    /**
47    The replication site is connected.
48    */
49    public boolean isConnected() {
50        return ((this.status & DbConstants.DB_REPMGR_CONNECTED) != 0);
51    }
52}
53