Separate static cluster properties from runtime state

This change includes the following:
- Remove cluster static properties from AsterixClusterProperties.
- Add new ClusterProperties class for static cluster properties.
- Rename AsterixClusterProperties to ClusterStateManager.
- Refactor cluster static properties.

Change-Id: I3da72f639476f081ba8a0ef21ec176d32ff8bdec
Reviewed-on: https://asterix-gerrit.ics.uci.edu/1183
Sonar-Qube: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Integration-Tests: Jenkins <jenk...@fulliautomatix.ics.uci.edu>
Reviewed-by: abdullah alamoudi <bamou...@gmail.com>


Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo
Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/1d5412dc
Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/1d5412dc
Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/1d5412dc

Branch: refs/heads/master
Commit: 1d5412dc5cec19012ba588166a6d1c35c823858a
Parents: f5efea5
Author: Murtadha Hubail <mhub...@uci.edu>
Authored: Sat Sep 17 19:13:39 2016 +0300
Committer: Murtadha Hubail <hubail...@gmail.com>
Committed: Sun Sep 18 02:36:16 2016 -0700

----------------------------------------------------------------------
 .../translator/AbstractLangTranslator.java      |  18 +-
 .../api/http/servlet/ClusterAPIServlet.java     |   4 +-
 .../api/http/servlet/ShutdownAPIServlet.java    |   4 +-
 .../app/cc/AsterixResourceIdManager.java        |   6 +-
 .../asterix/app/external/FeedOperations.java    |   4 +-
 .../app/nc/AsterixNCAppRuntimeContext.java      |   7 +-
 .../asterix/app/translator/QueryTranslator.java |   5 +-
 .../bootstrap/CCApplicationEntryPoint.java      |   4 +-
 .../bootstrap/ClusterLifecycleListener.java     |  15 +-
 .../hyracks/bootstrap/ClusterWorkExecutor.java  |   4 +-
 .../bootstrap/GlobalRecoveryManager.java        |  10 +-
 .../bootstrap/NCApplicationEntryPoint.java      |  16 +-
 .../aql/translator/QueryTranslatorTest.java     |   6 +-
 .../config/AsterixReplicationProperties.java    |  16 +-
 .../common/config/ClusterProperties.java        |  75 ++
 .../api/IExternalDataSourceFactory.java         |   4 +-
 .../factory/TwitterFirehoseStreamFactory.java   |   4 +-
 .../apache/asterix/external/util/FeedUtils.java |   7 +-
 .../apache/asterix/external/util/HDFSUtils.java |   4 +-
 .../record/reader/kv/KVTestReaderFactory.java   |   4 +-
 .../metadata/bootstrap/MetadataBootstrap.java   |   4 +-
 .../metadata/cluster/ClusterManager.java        |  11 +-
 .../metadata/declared/AqlMetadataProvider.java  |   6 +-
 .../metadata/declared/FeedDataSource.java       |   4 +-
 .../metadata/declared/MetadataManagerUtil.java  |   4 +-
 .../utils/SplitsAndConstraintsUtil.java         |  21 +-
 .../management/ReplicationManager.java          |   5 +-
 .../recovery/RemoteRecoveryManager.java         |   6 +-
 .../storage/ReplicaResourcesManager.java        |   6 +-
 .../CompleteFailbackResponseMessage.java        |   4 +-
 ...reparePartitionsFailbackResponseMessage.java |   4 +-
 .../message/ResourceIdRequestMessage.java       |   6 +-
 .../TakeoverMetadataNodeResponseMessage.java    |   4 +-
 .../TakeoverPartitionsResponseMessage.java      |   4 +-
 .../runtime/util/AsterixAppContextInfo.java     |   3 +-
 .../runtime/util/AsterixClusterProperties.java  | 685 -------------------
 .../runtime/util/ClusterStateManager.java       | 641 +++++++++++++++++
 .../service/recovery/RecoveryManager.java       |   5 +-
 .../transaction/TransactionSubsystem.java       |   3 +-
 39 files changed, 832 insertions(+), 811 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractLangTranslator.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractLangTranslator.java
 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractLangTranslator.java
index 10b601b..db33184 100644
--- 
a/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractLangTranslator.java
+++ 
b/asterixdb/asterix-algebra/src/main/java/org/apache/asterix/translator/AbstractLangTranslator.java
@@ -38,7 +38,7 @@ import org.apache.asterix.metadata.entities.Dataverse;
 import org.apache.asterix.metadata.utils.MetadataConstants;
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.runtime.util.AsterixAppContextInfo;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import org.apache.asterix.runtime.util.ClusterStateManager;
 import org.apache.hyracks.algebricks.common.utils.Pair;
 
 /**
@@ -53,12 +53,12 @@ public abstract class AbstractLangTranslator {
 
     public void validateOperation(Dataverse defaultDataverse, Statement stmt) 
throws AsterixException {
 
-        if 
(!(AsterixClusterProperties.INSTANCE.getState().equals(ClusterState.ACTIVE)
-                && 
AsterixClusterProperties.INSTANCE.isGlobalRecoveryCompleted())) {
+        if 
(!(ClusterStateManager.INSTANCE.getState().equals(ClusterState.ACTIVE)
+                && ClusterStateManager.INSTANCE.isGlobalRecoveryCompleted())) {
             int maxWaitCycles = 
AsterixAppContextInfo.INSTANCE.getExternalProperties().getMaxWaitClusterActive();
             int waitCycleCount = 0;
             try {
-                while 
(!AsterixClusterProperties.INSTANCE.getState().equals(ClusterState.ACTIVE)
+                while 
(!ClusterStateManager.INSTANCE.getState().equals(ClusterState.ACTIVE)
                         && waitCycleCount < maxWaitCycles) {
                     Thread.sleep(1000);
                     waitCycleCount++;
@@ -68,7 +68,7 @@ public abstract class AbstractLangTranslator {
                     LOGGER.warning("Thread interrupted while waiting for 
cluster to be " + ClusterState.ACTIVE);
                 }
             }
-            if 
(!AsterixClusterProperties.INSTANCE.getState().equals(ClusterState.ACTIVE)) {
+            if 
(!ClusterStateManager.INSTANCE.getState().equals(ClusterState.ACTIVE)) {
                 throw new AsterixException(" Asterix Cluster is in " + 
ClusterState.UNUSABLE + " state."
                         + "\n One or more Node Controllers have left or 
haven't joined yet.\n");
             } else {
@@ -78,16 +78,16 @@ public abstract class AbstractLangTranslator {
             }
         }
 
-        if 
(AsterixClusterProperties.INSTANCE.getState().equals(ClusterState.UNUSABLE)) {
+        if 
(ClusterStateManager.INSTANCE.getState().equals(ClusterState.UNUSABLE)) {
             throw new AsterixException(" Asterix Cluster is in " + 
ClusterState.UNUSABLE + " state."
                     + "\n One or more Node Controllers have left.\n");
         }
 
-        if (!AsterixClusterProperties.INSTANCE.isGlobalRecoveryCompleted()) {
+        if (!ClusterStateManager.INSTANCE.isGlobalRecoveryCompleted()) {
             int maxWaitCycles = 
AsterixAppContextInfo.INSTANCE.getExternalProperties().getMaxWaitClusterActive();
             int waitCycleCount = 0;
             try {
-                while 
(!AsterixClusterProperties.INSTANCE.isGlobalRecoveryCompleted()
+                while 
(!ClusterStateManager.INSTANCE.isGlobalRecoveryCompleted()
                         && waitCycleCount < maxWaitCycles) {
                     Thread.sleep(1000);
                     waitCycleCount++;
@@ -97,7 +97,7 @@ public abstract class AbstractLangTranslator {
                     LOGGER.warning("Thread interrupted while waiting for 
cluster to complete global recovery ");
                 }
             }
-            if 
(!AsterixClusterProperties.INSTANCE.isGlobalRecoveryCompleted()) {
+            if (!ClusterStateManager.INSTANCE.isGlobalRecoveryCompleted()) {
                 throw new AsterixException(" Asterix Cluster Global recovery 
is not yet complete and The system is in "
                         + ClusterState.ACTIVE + " state");
             }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ClusterAPIServlet.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ClusterAPIServlet.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ClusterAPIServlet.java
index 86b6602..64cde54 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ClusterAPIServlet.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ClusterAPIServlet.java
@@ -32,7 +32,7 @@ import javax.servlet.http.HttpServletResponse;
 
 import org.apache.asterix.app.result.ResultUtil;
 import org.apache.asterix.common.config.AbstractAsterixProperties;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import org.apache.asterix.runtime.util.ClusterStateManager;
 import org.json.JSONArray;
 import org.json.JSONException;
 import org.json.JSONObject;
@@ -90,7 +90,7 @@ public class ClusterAPIServlet extends HttpServlet {
     protected JSONObject getClusterStateJSON(HttpServletRequest request, 
String pathToNode)
             throws JSONException {
         JSONObject json;
-        json = AsterixClusterProperties.INSTANCE.getClusterStateDescription();
+        json = ClusterStateManager.INSTANCE.getClusterStateDescription();
         Map<String, Object> allProperties = getAllClusterProperties();
         json.put("config", allProperties);
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ShutdownAPIServlet.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ShutdownAPIServlet.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ShutdownAPIServlet.java
index 7d2a272..d8cb553 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ShutdownAPIServlet.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/api/http/servlet/ShutdownAPIServlet.java
@@ -32,7 +32,7 @@ import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
 import org.apache.asterix.common.config.GlobalConfig;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import org.apache.asterix.runtime.util.ClusterStateManager;
 import org.apache.hyracks.api.client.IHyracksClientConnection;
 import org.json.JSONObject;
 
@@ -61,7 +61,7 @@ public class ShutdownAPIServlet extends HttpServlet {
         try {
             jsonObject.put("status", "SHUTTING_DOWN");
             jsonObject.put("date", new Date());
-            jsonObject.put("cluster", 
AsterixClusterProperties.INSTANCE.getClusterStateDescription());
+            jsonObject.put("cluster", 
ClusterStateManager.INSTANCE.getClusterStateDescription());
 
             final PrintWriter writer = response.getWriter();
             writer.print(jsonObject.toString(4));

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/cc/AsterixResourceIdManager.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/cc/AsterixResourceIdManager.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/cc/AsterixResourceIdManager.java
index a773bab..99db723 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/cc/AsterixResourceIdManager.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/cc/AsterixResourceIdManager.java
@@ -23,7 +23,7 @@ import java.util.Set;
 import java.util.concurrent.atomic.AtomicLong;
 
 import org.apache.asterix.common.transactions.IAsterixResourceIdManager;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import org.apache.asterix.runtime.util.ClusterStateManager;
 
 public class AsterixResourceIdManager implements IAsterixResourceIdManager {
 
@@ -36,7 +36,7 @@ public class AsterixResourceIdManager implements 
IAsterixResourceIdManager {
         if (!allReported) {
             synchronized (this) {
                 if (!allReported) {
-                    if (reportedNodes.size() < 
AsterixClusterProperties.getNumberOfNodes()) {
+                    if (reportedNodes.size() < 
ClusterStateManager.getNumberOfNodes()) {
                         return -1;
                     } else {
                         reportedNodes = null;
@@ -58,7 +58,7 @@ public class AsterixResourceIdManager implements 
IAsterixResourceIdManager {
         if (!allReported) {
             globalResourceId.set(Math.max(maxResourceId, 
globalResourceId.get()));
             reportedNodes.add(nodeId);
-            if (reportedNodes.size() == 
AsterixClusterProperties.getNumberOfNodes()) {
+            if (reportedNodes.size() == 
ClusterStateManager.getNumberOfNodes()) {
                 reportedNodes = null;
                 allReported = true;
             }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/external/FeedOperations.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/external/FeedOperations.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/external/FeedOperations.java
index 110ace6..1d98aac 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/external/FeedOperations.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/external/FeedOperations.java
@@ -42,7 +42,7 @@ import 
org.apache.asterix.external.util.FeedUtils.FeedRuntimeType;
 import org.apache.asterix.file.JobSpecificationUtils;
 import org.apache.asterix.metadata.declared.AqlMetadataProvider;
 import org.apache.asterix.metadata.entities.Feed;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import org.apache.asterix.runtime.util.ClusterStateManager;
 import 
org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint;
 import 
org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
 import 
org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraintHelper;
@@ -160,7 +160,7 @@ public class FeedOperations {
 
     public static JobSpecification buildRemoveFeedStorageJob(Feed feed) throws 
Exception {
         JobSpecification spec = JobSpecificationUtils.createJobSpecification();
-        AlgebricksAbsolutePartitionConstraint allCluster = 
AsterixClusterProperties.INSTANCE.getClusterLocations();
+        AlgebricksAbsolutePartitionConstraint allCluster = 
ClusterStateManager.INSTANCE.getClusterLocations();
         Set<String> nodes = new TreeSet<>();
         for (String node : allCluster.getLocations()) {
             nodes.add(node);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/AsterixNCAppRuntimeContext.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/AsterixNCAppRuntimeContext.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/AsterixNCAppRuntimeContext.java
index ce20c9c..343fdb3 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/AsterixNCAppRuntimeContext.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/nc/AsterixNCAppRuntimeContext.java
@@ -44,6 +44,7 @@ import 
org.apache.asterix.common.config.AsterixPropertiesAccessor;
 import org.apache.asterix.common.config.AsterixReplicationProperties;
 import org.apache.asterix.common.config.AsterixStorageProperties;
 import org.apache.asterix.common.config.AsterixTransactionProperties;
+import org.apache.asterix.common.config.ClusterProperties;
 import org.apache.asterix.common.config.IAsterixPropertiesProvider;
 import org.apache.asterix.common.config.MessagingProperties;
 import org.apache.asterix.common.context.AsterixFileMapManager;
@@ -71,7 +72,6 @@ import 
org.apache.asterix.replication.management.ReplicationManager;
 import org.apache.asterix.replication.recovery.RemoteRecoveryManager;
 import org.apache.asterix.replication.storage.ReplicaResourcesManager;
 import org.apache.asterix.runtime.transaction.GlobalResourceIdFactoryProvider;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
 import 
org.apache.asterix.transaction.management.resource.PersistentLocalResourceRepository;
 import 
org.apache.asterix.transaction.management.resource.PersistentLocalResourceRepositoryFactory;
 import 
org.apache.asterix.transaction.management.service.transaction.TransactionSubsystem;
@@ -161,8 +161,7 @@ public class AsterixNCAppRuntimeContext implements 
IAsterixAppRuntimeContext, IA
         txnProperties = new AsterixTransactionProperties(propertiesAccessor);
         feedProperties = new AsterixFeedProperties(propertiesAccessor);
         buildProperties = new AsterixBuildProperties(propertiesAccessor);
-        replicationProperties = new 
AsterixReplicationProperties(propertiesAccessor,
-                AsterixClusterProperties.INSTANCE.getCluster());
+        replicationProperties = new 
AsterixReplicationProperties(propertiesAccessor);
         messagingProperties = new MessagingProperties(propertiesAccessor);
         this.metadataRmiPort = metadataRmiPort;
         libraryManager = new ExternalLibraryManager();
@@ -220,7 +219,7 @@ public class AsterixNCAppRuntimeContext implements 
IAsterixAppRuntimeContext, IA
         activeManager = new ActiveManager(ncApplicationContext.getNodeId(),
                 feedProperties.getMemoryComponentGlobalBudget(), 
compilerProperties.getFrameSize());
 
-        if (replicationProperties.isReplicationEnabled()) {
+        if (ClusterProperties.INSTANCE.isReplicationEnabled()) {
             String nodeId = ncApplicationContext.getNodeId();
 
             replicaResourcesManager = new 
ReplicaResourcesManager(localResourceRepository, metadataProperties);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
index 90bf6f6..27f7ca6 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/app/translator/QueryTranslator.java
@@ -55,6 +55,7 @@ import org.apache.asterix.app.result.ResultReader;
 import org.apache.asterix.app.result.ResultUtil;
 import org.apache.asterix.common.app.SessionConfig;
 import org.apache.asterix.common.config.AsterixExternalProperties;
+import org.apache.asterix.common.config.ClusterProperties;
 import org.apache.asterix.common.config.DatasetConfig.DatasetType;
 import 
org.apache.asterix.common.config.DatasetConfig.ExternalDatasetTransactionState;
 import org.apache.asterix.common.config.DatasetConfig.ExternalFilePendingOp;
@@ -160,7 +161,6 @@ import org.apache.asterix.om.types.IAType;
 import org.apache.asterix.om.types.TypeSignature;
 import org.apache.asterix.om.types.hierachy.ATypeHierarchy;
 import org.apache.asterix.runtime.util.AsterixAppContextInfo;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
 import 
org.apache.asterix.transaction.management.service.transaction.DatasetIdFactory;
 import org.apache.asterix.translator.AbstractLangTranslator;
 import 
org.apache.asterix.translator.CompiledStatements.CompiledConnectFeedStatement;
@@ -3030,8 +3030,7 @@ public class QueryTranslator extends 
AbstractLangTranslator implements IStatemen
             String fromDatasetName, String toDataverseName, String 
toDatasetName) {
         // Constructs AsterixDB parameters, e.g., URL, source dataset and sink 
dataset.
         AsterixExternalProperties externalProperties = 
AsterixAppContextInfo.INSTANCE.getExternalProperties();
-        AsterixClusterProperties clusterProperties = 
AsterixClusterProperties.INSTANCE;
-        String clientIP = 
clusterProperties.getCluster().getMasterNode().getClientIp();
+        String clientIP = 
ClusterProperties.INSTANCE.getCluster().getMasterNode().getClientIp();
         StringBuilder asterixdbParameterBuilder = new StringBuilder();
         asterixdbParameterBuilder.append(
                 "pregelix.asterixdb.url=" + "http://"; + clientIP + ":" + 
externalProperties.getAPIServerPort() + ",");

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
index bd910a5..f6dfe4a 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/CCApplicationEntryPoint.java
@@ -53,6 +53,7 @@ import 
org.apache.asterix.common.api.IClusterManagementWork.ClusterState;
 import org.apache.asterix.common.config.AsterixExtension;
 import org.apache.asterix.common.config.AsterixExternalProperties;
 import org.apache.asterix.common.config.AsterixMetadataProperties;
+import org.apache.asterix.common.config.ClusterProperties;
 import org.apache.asterix.common.library.ILibraryManager;
 import org.apache.asterix.common.utils.ServletUtil.Servlets;
 import org.apache.asterix.event.service.ILookupService;
@@ -63,7 +64,6 @@ import org.apache.asterix.metadata.api.IAsterixStateProxy;
 import org.apache.asterix.metadata.bootstrap.AsterixStateProxy;
 import org.apache.asterix.metadata.cluster.ClusterManager;
 import org.apache.asterix.runtime.util.AsterixAppContextInfo;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
 import org.apache.hyracks.api.application.ICCApplicationContext;
 import org.apache.hyracks.api.application.ICCApplicationEntryPoint;
 import org.apache.hyracks.api.client.HyracksConnection;
@@ -324,7 +324,7 @@ public class CCApplicationEntryPoint implements 
ICCApplicationEntryPoint {
         ILookupService zookeeperService = ClusterManager.getLookupService();
         if (zookeeperService != null) {
             // Our asterix app runtimes tests don't use zookeeper
-            
zookeeperService.reportClusterState(AsterixClusterProperties.INSTANCE.getCluster().getInstanceName(),
+            
zookeeperService.reportClusterState(ClusterProperties.INSTANCE.getCluster().getInstanceName(),
                     ClusterState.ACTIVE);
         }
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ClusterLifecycleListener.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ClusterLifecycleListener.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ClusterLifecycleListener.java
index 5fc91a4..4eaab2d 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ClusterLifecycleListener.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ClusterLifecycleListener.java
@@ -31,6 +31,7 @@ import org.apache.asterix.common.api.IClusterEventsSubscriber;
 import org.apache.asterix.common.api.IClusterManagementWork;
 import org.apache.asterix.common.api.IClusterManagementWorkResponse;
 import org.apache.asterix.common.api.IClusterManagementWorkResponse.Status;
+import org.apache.asterix.common.config.ClusterProperties;
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.event.schema.cluster.Node;
 import org.apache.asterix.metadata.MetadataManager;
@@ -39,7 +40,7 @@ import 
org.apache.asterix.metadata.cluster.AddNodeWorkResponse;
 import org.apache.asterix.metadata.cluster.ClusterManager;
 import org.apache.asterix.metadata.cluster.RemoveNodeWork;
 import org.apache.asterix.metadata.cluster.RemoveNodeWorkResponse;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import org.apache.asterix.runtime.util.ClusterStateManager;
 import org.apache.hyracks.api.application.IClusterLifecycleListener;
 
 public class ClusterLifecycleListener implements IClusterLifecycleListener {
@@ -67,9 +68,9 @@ public class ClusterLifecycleListener implements 
IClusterLifecycleListener {
         if (LOGGER.isLoggable(Level.INFO)) {
             LOGGER.info("NC: " + nodeId + " joined");
         }
-        AsterixClusterProperties.INSTANCE.addNCConfiguration(nodeId, 
ncConfiguration);
+        ClusterStateManager.INSTANCE.addNCConfiguration(nodeId, 
ncConfiguration);
         //if metadata node rejoining, we need to rebind the proxy connection 
when it is active again.
-        MetadataManager.INSTANCE.rebindMetadataNode = 
!AsterixClusterProperties.INSTANCE.isMetadataNodeActive();
+        MetadataManager.INSTANCE.rebindMetadataNode = 
!ClusterStateManager.INSTANCE.isMetadataNodeActive();
 
         Set<String> nodeAddition = new HashSet<String>();
         nodeAddition.add(nodeId);
@@ -92,10 +93,10 @@ public class ClusterLifecycleListener implements 
IClusterLifecycleListener {
             if (LOGGER.isLoggable(Level.INFO)) {
                 LOGGER.info("NC: " + deadNode + " left");
             }
-            AsterixClusterProperties.INSTANCE.removeNCConfiguration(deadNode);
+            ClusterStateManager.INSTANCE.removeNCConfiguration(deadNode);
 
             //if metadata node failed, we need to rebind the proxy connection 
when it is active again
-            MetadataManager.INSTANCE.rebindMetadataNode = 
!AsterixClusterProperties.INSTANCE.isMetadataNodeActive();
+            MetadataManager.INSTANCE.rebindMetadataNode = 
!ClusterStateManager.INSTANCE.isMetadataNodeActive();
         }
         updateProgress(ClusterEventType.NODE_FAILURE, deadNodeIds);
         Set<IClusterEventsSubscriber> subscribers = 
ClusterManager.INSTANCE.getRegisteredClusterEventSubscribers();
@@ -160,9 +161,9 @@ public class ClusterLifecycleListener implements 
IClusterLifecycleListener {
         }
 
         List<String> addedNodes = new ArrayList<String>();
-        String asterixInstanceName = 
AsterixClusterProperties.INSTANCE.getCluster().getInstanceName();
+        String asterixInstanceName = 
ClusterProperties.INSTANCE.getCluster().getInstanceName();
         for (int i = 0; i < nodesToAdd; i++) {
-            Node node = 
AsterixClusterProperties.INSTANCE.getAvailableSubstitutionNode();
+            Node node = 
ClusterStateManager.INSTANCE.getAvailableSubstitutionNode();
             if (node != null) {
                 try {
                     ClusterManager.INSTANCE.addNode(node);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ClusterWorkExecutor.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ClusterWorkExecutor.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ClusterWorkExecutor.java
index 0e3bb3b..f41c4f6 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ClusterWorkExecutor.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/ClusterWorkExecutor.java
@@ -30,7 +30,7 @@ import org.apache.asterix.event.schema.cluster.Node;
 import org.apache.asterix.metadata.cluster.AddNodeWork;
 import org.apache.asterix.metadata.cluster.ClusterManager;
 import org.apache.asterix.metadata.cluster.RemoveNodeWork;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import org.apache.asterix.runtime.util.ClusterStateManager;
 
 public class ClusterWorkExecutor implements Runnable {
 
@@ -68,7 +68,7 @@ public class ClusterWorkExecutor implements Runnable {
 
                 Set<Node> addedNodes = new HashSet<Node>();
                 for (int i = 0; i < nodesToAdd; i++) {
-                    Node node = 
AsterixClusterProperties.INSTANCE.getAvailableSubstitutionNode();
+                    Node node = 
ClusterStateManager.INSTANCE.getAvailableSubstitutionNode();
                     if (node != null) {
                         try {
                             ClusterManager.INSTANCE.addNode(node);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/GlobalRecoveryManager.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/GlobalRecoveryManager.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/GlobalRecoveryManager.java
index 7dde284..77374bf 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/GlobalRecoveryManager.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/GlobalRecoveryManager.java
@@ -41,7 +41,7 @@ import org.apache.asterix.metadata.entities.Dataverse;
 import org.apache.asterix.metadata.entities.ExternalDatasetDetails;
 import org.apache.asterix.metadata.entities.Index;
 import org.apache.asterix.metadata.utils.MetadataConstants;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import org.apache.asterix.runtime.util.ClusterStateManager;
 import org.apache.hyracks.api.client.HyracksConnection;
 import org.apache.hyracks.api.job.JobId;
 import org.apache.hyracks.api.job.JobSpecification;
@@ -60,8 +60,8 @@ public class GlobalRecoveryManager implements 
IGlobalRecoveryMaanger {
 
     @Override
     public Set<IClusterManagementWork> notifyNodeFailure(Set<String> 
deadNodeIds) {
-        setState(AsterixClusterProperties.INSTANCE.getState());
-        AsterixClusterProperties.INSTANCE.setGlobalRecoveryCompleted(false);
+        setState(ClusterStateManager.INSTANCE.getState());
+        ClusterStateManager.INSTANCE.setGlobalRecoveryCompleted(false);
         return Collections.emptySet();
     }
 
@@ -90,7 +90,7 @@ public class GlobalRecoveryManager implements 
IGlobalRecoveryMaanger {
     @Override
     public void startGlobalRecovery() {
         // perform global recovery if state changed to active
-        final ClusterState newState = 
AsterixClusterProperties.INSTANCE.getState();
+        final ClusterState newState = ClusterStateManager.INSTANCE.getState();
         boolean needToRecover = !newState.equals(state) && (newState == 
ClusterState.ACTIVE);
         if (needToRecover) {
             Thread recoveryThread = new Thread(new Runnable() {
@@ -211,7 +211,7 @@ public class GlobalRecoveryManager implements 
IGlobalRecoveryMaanger {
                             throw new IllegalStateException(e1);
                         }
                     }
-                    
AsterixClusterProperties.INSTANCE.setGlobalRecoveryCompleted(true);
+                    
ClusterStateManager.INSTANCE.setGlobalRecoveryCompleted(true);
                     LOGGER.info("Global Recovery Completed");
                 }
             }, "RecoveryThread");

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
index c11b875..0a12bf2 100644
--- 
a/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
+++ 
b/asterixdb/asterix-app/src/main/java/org/apache/asterix/hyracks/bootstrap/NCApplicationEntryPoint.java
@@ -33,11 +33,11 @@ import 
org.apache.asterix.common.api.IAsterixAppRuntimeContext;
 import org.apache.asterix.common.config.AsterixExtension;
 import org.apache.asterix.common.config.AsterixMetadataProperties;
 import org.apache.asterix.common.config.AsterixTransactionProperties;
+import org.apache.asterix.common.config.ClusterProperties;
 import org.apache.asterix.common.config.IAsterixPropertiesProvider;
 import org.apache.asterix.common.config.MessagingProperties;
 import org.apache.asterix.common.replication.IRemoteRecoveryManager;
 import org.apache.asterix.common.transactions.IRecoveryManager;
-import 
org.apache.asterix.transaction.management.resource.PersistentLocalResourceRepository;
 import org.apache.asterix.common.transactions.IRecoveryManager.SystemState;
 import org.apache.asterix.common.utils.StoragePathUtil;
 import org.apache.asterix.event.schema.cluster.Cluster;
@@ -46,7 +46,7 @@ import 
org.apache.asterix.messaging.MessagingChannelInterfaceFactory;
 import org.apache.asterix.messaging.NCMessageBroker;
 import org.apache.asterix.metadata.bootstrap.MetadataBootstrap;
 import org.apache.asterix.runtime.message.ReportMaxResourceIdMessage;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import 
org.apache.asterix.transaction.management.resource.PersistentLocalResourceRepository;
 import 
org.apache.asterix.transaction.management.service.recovery.RecoveryManager;
 import org.apache.commons.io.FileUtils;
 import org.apache.hyracks.api.application.INCApplicationContext;
@@ -127,8 +127,8 @@ public class NCApplicationEntryPoint implements 
INCApplicationEntryPoint {
                 (NCMessageBroker) messageBroker, messagingProperties);
         
ncApplicationContext.setMessagingChannelInterfaceFactory(interfaceFactory);
 
-        boolean replicationEnabled = 
AsterixClusterProperties.INSTANCE.isReplicationEnabled();
-        boolean autoFailover = 
AsterixClusterProperties.INSTANCE.isAutoFailoverEnabled();
+        boolean replicationEnabled = 
ClusterProperties.INSTANCE.isReplicationEnabled();
+        boolean autoFailover = 
ClusterProperties.INSTANCE.isAutoFailoverEnabled();
         if (initialRun) {
             LOGGER.info("System is being initialized. (first run)");
         } else {
@@ -225,7 +225,7 @@ public class NCApplicationEntryPoint implements 
INCApplicationEntryPoint {
             PersistentLocalResourceRepository localResourceRepository =
                     (PersistentLocalResourceRepository) runtimeContext
                             .getLocalResourceRepository();
-            
localResourceRepository.initializeNewUniverse(AsterixClusterProperties.INSTANCE.getStorageDirectoryName());
+            
localResourceRepository.initializeNewUniverse(ClusterProperties.INSTANCE.getStorageDirectoryName());
         }
 
         isMetadataNode = 
nodeId.equals(metadataProperties.getMetadataNodeName());
@@ -274,7 +274,7 @@ public class NCApplicationEntryPoint implements 
INCApplicationEntryPoint {
         runtimeContext.getIOManager().deleteWorkspaceFiles();
 
         //Reclaim storage for temporary datasets.
-        String storageDirName = 
AsterixClusterProperties.INSTANCE.getStorageDirectoryName();
+        String storageDirName = 
ClusterProperties.INSTANCE.getStorageDirectoryName();
         String[] ioDevices = ((PersistentLocalResourceRepository) 
runtimeContext.getLocalResourceRepository())
                 .getStorageMountingPoints();
         for (String ioDevice : ioDevices) {
@@ -293,7 +293,7 @@ public class NCApplicationEntryPoint implements 
INCApplicationEntryPoint {
                 .getMetadataProperties();
         if (!metadataProperties.getNodeNames().contains(nodeId)) {
             metadataProperties.getNodeNames().add(nodeId);
-            Cluster cluster = AsterixClusterProperties.INSTANCE.getCluster();
+            Cluster cluster = ClusterProperties.INSTANCE.getCluster();
             if (cluster == null) {
                 throw new IllegalStateException("No cluster configuration 
found for this instance");
             }
@@ -310,7 +310,7 @@ public class NCApplicationEntryPoint implements 
INCApplicationEntryPoint {
             for (Node node : nodes) {
                 String ncId = asterixInstanceName + "_" + node.getId();
                 if (ncId.equalsIgnoreCase(nodeId)) {
-                    String storeDir = 
AsterixClusterProperties.INSTANCE.getStorageDirectoryName();
+                    String storeDir = 
ClusterProperties.INSTANCE.getStorageDirectoryName();
                     String nodeIoDevices = node.getIodevices() == null ? 
cluster.getIodevices() : node.getIodevices();
                     String[] ioDevicePaths = nodeIoDevices.trim().split(",");
                     for (int i = 0; i < ioDevicePaths.length; i++) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-app/src/test/java/org/apache/asterix/aql/translator/QueryTranslatorTest.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/aql/translator/QueryTranslatorTest.java
 
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/aql/translator/QueryTranslatorTest.java
index 4e8875b..f3fd080 100644
--- 
a/asterixdb/asterix-app/src/test/java/org/apache/asterix/aql/translator/QueryTranslatorTest.java
+++ 
b/asterixdb/asterix-app/src/test/java/org/apache/asterix/aql/translator/QueryTranslatorTest.java
@@ -31,13 +31,13 @@ import java.util.List;
 import org.apache.asterix.app.translator.DefaultStatementExecutorFactory;
 import org.apache.asterix.common.app.SessionConfig;
 import org.apache.asterix.common.config.AsterixExternalProperties;
+import org.apache.asterix.common.config.ClusterProperties;
 import org.apache.asterix.compiler.provider.AqlCompilationProvider;
 import org.apache.asterix.event.schema.cluster.Cluster;
 import org.apache.asterix.event.schema.cluster.MasterNode;
 import org.apache.asterix.lang.common.base.Statement;
 import org.apache.asterix.lang.common.statement.RunStatement;
 import org.apache.asterix.runtime.util.AsterixAppContextInfo;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
 import org.apache.asterix.translator.IStatementExecutor;
 import org.junit.Assert;
 import org.junit.Test;
@@ -63,8 +63,8 @@ public class QueryTranslatorTest {
         // Mocks AsterixClusterProperties.
         Cluster mockCluster = mock(Cluster.class);
         MasterNode mockMasterNode = mock(MasterNode.class);
-        AsterixClusterProperties mockClusterProperties = 
mock(AsterixClusterProperties.class);
-        
setFinalStaticField(AsterixClusterProperties.class.getDeclaredField("INSTANCE"),
 mockClusterProperties);
+        ClusterProperties mockClusterProperties = 
mock(ClusterProperties.class);
+        
setFinalStaticField(ClusterProperties.class.getDeclaredField("INSTANCE"), 
mockClusterProperties);
         when(mockClusterProperties.getCluster()).thenReturn(mockCluster);
         when(mockCluster.getMasterNode()).thenReturn(mockMasterNode);
         when(mockMasterNode.getClientIp()).thenReturn("127.0.0.1");

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixReplicationProperties.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixReplicationProperties.java
 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixReplicationProperties.java
index 86ace28..0638091 100644
--- 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixReplicationProperties.java
+++ 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/AsterixReplicationProperties.java
@@ -63,9 +63,9 @@ public class AsterixReplicationProperties extends 
AbstractAsterixProperties {
     private final String nodeNamePrefix;
     private final Cluster cluster;
 
-    public AsterixReplicationProperties(AsterixPropertiesAccessor accessor, 
Cluster cluster) {
+    public AsterixReplicationProperties(AsterixPropertiesAccessor accessor) {
         super(accessor);
-        this.cluster = cluster;
+        this.cluster = ClusterProperties.INSTANCE.getCluster();
 
         if (cluster != null) {
             nodeNamePrefix = cluster.getInstanceName() + "_";
@@ -76,21 +76,11 @@ public class AsterixReplicationProperties extends 
AbstractAsterixProperties {
 
     @PropertyKey(REPLICATION_ENABLED_KEY)
     public boolean isReplicationEnabled() {
-        if (cluster != null && cluster.getDataReplication() != null) {
-            if (getReplicationFactor() == 1) {
-                return false;
-            }
-
-            return cluster.getDataReplication().isEnabled();
-
-        } else {
-            return false;
-        }
+        return ClusterProperties.INSTANCE.isReplicationEnabled();
     }
 
     public String getReplicaIPAddress(String nodeId) {
         if (cluster != null) {
-
             for (int i = 0; i < cluster.getNode().size(); i++) {
                 Node node = cluster.getNode().get(i);
                 if (getRealCluserNodeID(node.getId()).equals(nodeId)) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ClusterProperties.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ClusterProperties.java
 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ClusterProperties.java
new file mode 100644
index 0000000..81c5a6d
--- /dev/null
+++ 
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/config/ClusterProperties.java
@@ -0,0 +1,75 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.asterix.common.config;
+
+import java.io.InputStream;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Unmarshaller;
+
+import org.apache.asterix.event.schema.cluster.Cluster;
+
+public class ClusterProperties {
+
+    public static final ClusterProperties INSTANCE = new ClusterProperties();
+
+    private static final String CLUSTER_CONFIGURATION_FILE = "cluster.xml";
+    private static final String DEFAULT_STORAGE_DIR_NAME = "storage";
+
+    private final Cluster cluster;
+
+    private ClusterProperties() {
+        InputStream is = 
this.getClass().getClassLoader().getResourceAsStream(CLUSTER_CONFIGURATION_FILE);
+        if (is != null) {
+            try {
+                JAXBContext ctx = JAXBContext.newInstance(Cluster.class);
+                Unmarshaller unmarshaller = ctx.createUnmarshaller();
+                cluster = (Cluster) unmarshaller.unmarshal(is);
+            } catch (JAXBException e) {
+                throw new IllegalStateException("Failed to read configuration 
file " + CLUSTER_CONFIGURATION_FILE, e);
+            }
+        } else {
+            cluster = null;
+        }
+    }
+
+    public Cluster getCluster() {
+        return cluster;
+    }
+
+    public String getStorageDirectoryName() {
+        if (cluster != null) {
+            return cluster.getStore();
+        }
+        // virtual cluster without cluster config file
+        return DEFAULT_STORAGE_DIR_NAME;
+    }
+
+    public boolean isReplicationEnabled() {
+        if (cluster != null && cluster.getDataReplication() != null) {
+            return cluster.getDataReplication().isEnabled();
+        }
+        return false;
+    }
+
+    public boolean isAutoFailoverEnabled() {
+        return isReplicationEnabled() && 
cluster.getDataReplication().isAutoFailover();
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/api/IExternalDataSourceFactory.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/api/IExternalDataSourceFactory.java
 
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/api/IExternalDataSourceFactory.java
index 6a237c6..edb79f2 100644
--- 
a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/api/IExternalDataSourceFactory.java
+++ 
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/api/IExternalDataSourceFactory.java
@@ -26,7 +26,7 @@ import java.util.Set;
 
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.runtime.util.AsterixAppContextInfo;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import org.apache.asterix.runtime.util.ClusterStateManager;
 import 
org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
@@ -96,7 +96,7 @@ public interface IExternalDataSourceFactory extends 
Serializable {
                 Iterator<String> storeIt = stores.iterator();
                 while (storeIt.hasNext()) {
                     String node = storeIt.next();
-                    int numIODevices = 
AsterixClusterProperties.INSTANCE.getIODevices(node).length;
+                    int numIODevices = 
ClusterStateManager.INSTANCE.getIODevices(node).length;
                     for (int k = 0; k < numIODevices; k++) {
                         locs.add(node);
                         i++;

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/stream/factory/TwitterFirehoseStreamFactory.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/stream/factory/TwitterFirehoseStreamFactory.java
 
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/stream/factory/TwitterFirehoseStreamFactory.java
index 5575d2c..abe67fd 100644
--- 
a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/stream/factory/TwitterFirehoseStreamFactory.java
+++ 
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/input/stream/factory/TwitterFirehoseStreamFactory.java
@@ -26,7 +26,7 @@ import java.util.Map;
 import org.apache.asterix.external.api.AsterixInputStream;
 import org.apache.asterix.external.api.IInputStreamFactory;
 import org.apache.asterix.external.input.stream.TwitterFirehoseInputStream;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import org.apache.asterix.runtime.util.ClusterStateManager;
 import 
org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
@@ -69,7 +69,7 @@ public class TwitterFirehoseStreamFactory implements 
IInputStreamFactory {
 
         List<String> chosenLocations = new ArrayList<String>();
         String[] availableLocations = locations != null ? locations
-                : 
AsterixClusterProperties.INSTANCE.getParticipantNodes().toArray(new String[] 
{});
+                : 
ClusterStateManager.INSTANCE.getParticipantNodes().toArray(new String[] {});
         for (int i = 0, k = 0; i < count; i++, k = (k + 1) % 
availableLocations.length) {
             chosenLocations.add(availableLocations[k]);
         }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/FeedUtils.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/FeedUtils.java
 
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/FeedUtils.java
index 44980c8..366534f 100644
--- 
a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/FeedUtils.java
+++ 
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/FeedUtils.java
@@ -25,9 +25,10 @@ import java.util.List;
 import java.util.Map;
 
 import org.apache.asterix.common.cluster.ClusterPartition;
+import org.apache.asterix.common.config.ClusterProperties;
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.common.utils.StoragePathUtil;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import org.apache.asterix.runtime.util.ClusterStateManager;
 import 
org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint;
 import 
org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
 import 
org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint.PartitionConstraintType;
@@ -75,7 +76,7 @@ public class FeedUtils {
     public static FileSplit splitsForAdapter(String dataverseName, String 
feedName, String nodeName,
             ClusterPartition partition) {
         File relPathFile = new File(prepareDataverseFeedName(dataverseName, 
feedName));
-        String storageDirName = 
AsterixClusterProperties.INSTANCE.getStorageDirectoryName();
+        String storageDirName = 
ClusterProperties.INSTANCE.getStorageDirectoryName();
         String storagePartitionPath =
                 StoragePathUtil.prepareStoragePartitionPath(storageDirName, 
partition.getPartitionId());
         // Note: feed adapter instances in a single node share the feed logger
@@ -93,7 +94,7 @@ public class FeedUtils {
         List<FileSplit> splits = new ArrayList<>();
         for (String nd : locations) {
             splits.add(splitsForAdapter(dataverseName, feedName, nd,
-                    
AsterixClusterProperties.INSTANCE.getNodePartitions(nd)[0]));
+                    ClusterStateManager.INSTANCE.getNodePartitions(nd)[0]));
         }
         return splits.toArray(new FileSplit[] {});
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/HDFSUtils.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/HDFSUtils.java
 
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/HDFSUtils.java
index 0848532..2ce0383 100644
--- 
a/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/HDFSUtils.java
+++ 
b/asterixdb/asterix-external-data/src/main/java/org/apache/asterix/external/util/HDFSUtils.java
@@ -30,7 +30,7 @@ import org.apache.asterix.external.indexing.IndexingScheduler;
 import org.apache.asterix.external.indexing.RecordId.RecordIdType;
 import org.apache.asterix.external.input.stream.HDFSInputStream;
 import org.apache.asterix.runtime.util.AsterixAppContextInfo;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import org.apache.asterix.runtime.util.ClusterStateManager;
 import org.apache.hadoop.fs.BlockLocation;
 import org.apache.hadoop.fs.FileStatus;
 import org.apache.hadoop.fs.FileSystem;
@@ -205,7 +205,7 @@ public class HDFSUtils {
             ArrayList<String> locs = new ArrayList<>();
             Map<String, String[]> stores = 
AsterixAppContextInfo.INSTANCE.getMetadataProperties().getStores();
             for (String node : stores.keySet()) {
-                int numIODevices = 
AsterixClusterProperties.INSTANCE.getIODevices(node).length;
+                int numIODevices = 
ClusterStateManager.INSTANCE.getIODevices(node).length;
                 for (int k = 0; k < numIODevices; k++) {
                     locs.add(node);
                 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/input/record/reader/kv/KVTestReaderFactory.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/input/record/reader/kv/KVTestReaderFactory.java
 
b/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/input/record/reader/kv/KVTestReaderFactory.java
index 61f5021..6841e6b 100644
--- 
a/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/input/record/reader/kv/KVTestReaderFactory.java
+++ 
b/asterixdb/asterix-external-data/src/test/java/org/apache/asterix/external/input/record/reader/kv/KVTestReaderFactory.java
@@ -22,7 +22,7 @@ import java.util.Map;
 
 import org.apache.asterix.external.api.IRecordReader;
 import org.apache.asterix.external.api.IRecordReaderFactory;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import org.apache.asterix.runtime.util.ClusterStateManager;
 import 
org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint;
 import org.apache.hyracks.api.context.IHyracksTaskContext;
 
@@ -42,7 +42,7 @@ public class KVTestReaderFactory implements 
IRecordReaderFactory<DCPRequest> {
 
     @Override
     public AlgebricksAbsolutePartitionConstraint getPartitionConstraint() {
-        clusterLocations = 
AsterixClusterProperties.INSTANCE.getClusterLocations();
+        clusterLocations = ClusterStateManager.INSTANCE.getClusterLocations();
         numOfReaders = clusterLocations.getLocations().length;
         return clusterLocations;
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
index 55b1045..c1dfd02 100644
--- 
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
+++ 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/bootstrap/MetadataBootstrap.java
@@ -32,6 +32,7 @@ import org.apache.asterix.common.api.IDatasetLifecycleManager;
 import org.apache.asterix.common.api.ILocalResourceMetadata;
 import org.apache.asterix.common.cluster.ClusterPartition;
 import org.apache.asterix.common.config.AsterixMetadataProperties;
+import org.apache.asterix.common.config.ClusterProperties;
 import org.apache.asterix.common.config.DatasetConfig.DatasetType;
 import org.apache.asterix.common.config.GlobalConfig;
 import org.apache.asterix.common.config.IAsterixPropertiesProvider;
@@ -68,7 +69,6 @@ import org.apache.asterix.metadata.utils.MetadataConstants;
 import org.apache.asterix.om.types.BuiltinType;
 import org.apache.asterix.om.types.IAType;
 import org.apache.asterix.runtime.formats.NonTaggedDataFormat;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
 import 
org.apache.asterix.transaction.management.resource.LSMBTreeLocalResourceMetadata;
 import 
org.apache.asterix.transaction.management.resource.PersistentLocalResourceFactoryProvider;
 import 
org.apache.asterix.transaction.management.service.transaction.TransactionManagementConstants.LockManagerConstants.LockMode;
@@ -315,7 +315,7 @@ public class MetadataBootstrap {
         ClusterPartition metadataPartition = 
propertiesProvider.getMetadataProperties().getMetadataPartition();
         int metadataDeviceId = metadataPartition.getIODeviceNum();
         String metadataPartitionPath = 
StoragePathUtil.prepareStoragePartitionPath(
-                AsterixClusterProperties.INSTANCE.getStorageDirectoryName(), 
metadataPartition.getPartitionId());
+                ClusterProperties.INSTANCE.getStorageDirectoryName(), 
metadataPartition.getPartitionId());
         String resourceName = metadataPartitionPath + File.separator + 
index.getFileNameRelativePath();
         FileReference file = ioManager.getAbsoluteFileRef(metadataDeviceId, 
resourceName);
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/cluster/ClusterManager.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/cluster/ClusterManager.java
 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/cluster/ClusterManager.java
index f076152..6371f3e 100644
--- 
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/cluster/ClusterManager.java
+++ 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/cluster/ClusterManager.java
@@ -31,6 +31,7 @@ import javax.xml.bind.Unmarshaller;
 
 import org.apache.asterix.common.api.IClusterEventsSubscriber;
 import org.apache.asterix.common.config.AsterixExternalProperties;
+import org.apache.asterix.common.config.ClusterProperties;
 import org.apache.asterix.common.exceptions.AsterixException;
 import org.apache.asterix.event.management.AsterixEventServiceClient;
 import org.apache.asterix.event.model.AsterixInstance;
@@ -46,7 +47,6 @@ import org.apache.asterix.event.util.PatternCreator;
 import org.apache.asterix.installer.schema.conf.Configuration;
 import org.apache.asterix.metadata.api.IClusterManager;
 import org.apache.asterix.runtime.util.AsterixAppContextInfo;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
 
 public class ClusterManager implements IClusterManager {
 
@@ -61,7 +61,7 @@ public class ClusterManager implements IClusterManager {
     private static final Set<IClusterEventsSubscriber> eventSubscribers = new 
HashSet<IClusterEventsSubscriber>();
 
     private ClusterManager() {
-        Cluster asterixCluster = 
AsterixClusterProperties.INSTANCE.getCluster();
+        Cluster asterixCluster = ClusterProperties.INSTANCE.getCluster();
         String eventHome = asterixCluster == null ? null
                 : asterixCluster.getWorkingDir() == null ? null : 
asterixCluster.getWorkingDir().getDir();
 
@@ -75,8 +75,7 @@ public class ClusterManager implements IClusterManager {
                 Unmarshaller unmarshaller = configCtx.createUnmarshaller();
                 configuration = (Configuration) 
unmarshaller.unmarshal(configFile);
                 AsterixEventService.initialize(configuration, asterixDir, 
eventHome);
-                client = AsterixEventService
-                        
.getAsterixEventServiceClient(AsterixClusterProperties.INSTANCE.getCluster());
+                client = 
AsterixEventService.getAsterixEventServiceClient(ClusterProperties.INSTANCE.getCluster());
 
                 lookupService = ServiceProvider.INSTANCE.getLookupService();
                 if (!lookupService.isRunning(configuration)) {
@@ -99,11 +98,11 @@ public class ClusterManager implements IClusterManager {
     @Override
     public void addNode(Node node) throws AsterixException {
         try {
-            Cluster cluster = AsterixClusterProperties.INSTANCE.getCluster();
+            Cluster cluster = ClusterProperties.INSTANCE.getCluster();
             List<Pattern> pattern = new ArrayList<Pattern>();
             String asterixInstanceName = 
AsterixAppContextInfo.INSTANCE.getMetadataProperties().getInstanceName();
             Patterns prepareNode = 
PatternCreator.INSTANCE.createPrepareNodePattern(asterixInstanceName,
-                    AsterixClusterProperties.INSTANCE.getCluster(), node);
+                    ClusterProperties.INSTANCE.getCluster(), node);
             cluster.getNode().add(node);
             client.submit(prepareNode);
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/AqlMetadataProvider.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/AqlMetadataProvider.java
 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/AqlMetadataProvider.java
index d8ac7b9..41a843f 100644
--- 
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/AqlMetadataProvider.java
+++ 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/AqlMetadataProvider.java
@@ -92,7 +92,7 @@ import 
org.apache.asterix.runtime.job.listener.JobEventListenerFactory;
 import 
org.apache.asterix.runtime.operators.AsterixLSMInvertedIndexUpsertOperatorDescriptor;
 import 
org.apache.asterix.runtime.operators.AsterixLSMTreeUpsertOperatorDescriptor;
 import org.apache.asterix.runtime.util.AsterixAppContextInfo;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import org.apache.asterix.runtime.util.ClusterStateManager;
 import org.apache.asterix.runtime.util.AsterixRuntimeComponentsProvider;
 import 
org.apache.asterix.transaction.management.opcallbacks.LockThenSearchOperationCallbackFactory;
 import 
org.apache.asterix.transaction.management.opcallbacks.PrimaryIndexInstantSearchOperationCallbackFactory;
@@ -951,7 +951,7 @@ public class AqlMetadataProvider implements 
IMetadataProvider<AqlSourceId, Strin
         List<String> nodeGroup = 
MetadataManager.INSTANCE.getNodegroup(mdTxnCtx, dataset.getNodeGroupName())
                 .getNodeNames();
         for (String nd : nodeGroup) {
-            numPartitions += 
AsterixClusterProperties.INSTANCE.getNodePartitionsCount(nd);
+            numPartitions += 
ClusterStateManager.INSTANCE.getNodePartitionsCount(nd);
         }
         numElementsHint = numElementsHint / numPartitions;
         return numElementsHint;
@@ -1027,7 +1027,7 @@ public class AqlMetadataProvider implements 
IMetadataProvider<AqlSourceId, Strin
     }
 
     public AlgebricksAbsolutePartitionConstraint getClusterLocations() {
-        return AsterixClusterProperties.INSTANCE.getClusterLocations();
+        return ClusterStateManager.INSTANCE.getClusterLocations();
     }
 
     public Pair<IFileSplitProvider, AlgebricksPartitionConstraint> 
splitProviderAndPartitionConstraintsForFilesIndex(

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/FeedDataSource.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/FeedDataSource.java
 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/FeedDataSource.java
index 5853a39..d1d5df0 100644
--- 
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/FeedDataSource.java
+++ 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/FeedDataSource.java
@@ -33,7 +33,7 @@ import org.apache.asterix.metadata.feeds.BuiltinFeedPolicies;
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.om.types.IAType;
 import org.apache.asterix.runtime.formats.NonTaggedDataFormat;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import org.apache.asterix.runtime.util.ClusterStateManager;
 import 
org.apache.hyracks.algebricks.common.constraints.AlgebricksAbsolutePartitionConstraint;
 import 
org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
@@ -76,7 +76,7 @@ public class FeedDataSource extends AqlDataSource implements 
IMutationDataSource
         this.locations = locations;
         this.pkTypes = pkTypes;
         this.keyAccessExpression = keyAccessExpression;
-        this.computeCardinality = 
AsterixClusterProperties.INSTANCE.getParticipantNodes().size();
+        this.computeCardinality = 
ClusterStateManager.INSTANCE.getParticipantNodes().size();
         initFeedDataSource();
     }
 

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/MetadataManagerUtil.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/MetadataManagerUtil.java
 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/MetadataManagerUtil.java
index 3dfa8a5..39ad1c6 100644
--- 
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/MetadataManagerUtil.java
+++ 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/declared/MetadataManagerUtil.java
@@ -36,7 +36,7 @@ import org.apache.asterix.metadata.entities.NodeGroup;
 import org.apache.asterix.metadata.utils.MetadataConstants;
 import org.apache.asterix.om.types.ARecordType;
 import org.apache.asterix.om.types.IAType;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import org.apache.asterix.runtime.util.ClusterStateManager;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import 
org.apache.hyracks.algebricks.core.algebra.properties.DefaultNodeGroupDomain;
 import org.apache.hyracks.algebricks.core.algebra.properties.INodeDomain;
@@ -116,7 +116,7 @@ public class MetadataManagerUtil {
         NodeGroup nodeGroup = MetadataManager.INSTANCE.getNodegroup(mdTxnCtx, 
nodeGroupName);
         List<String> partitions = new ArrayList<>();
         for (String location : nodeGroup.getNodeNames()) {
-            int numPartitions = 
AsterixClusterProperties.INSTANCE.getNodePartitionsCount(location);
+            int numPartitions = 
ClusterStateManager.INSTANCE.getNodePartitionsCount(location);
             for (int i = 0; i < numPartitions; i++) {
                 partitions.add(location);
             }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SplitsAndConstraintsUtil.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SplitsAndConstraintsUtil.java
 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SplitsAndConstraintsUtil.java
index 85e4405..21e2150 100644
--- 
a/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SplitsAndConstraintsUtil.java
+++ 
b/asterixdb/asterix-metadata/src/main/java/org/apache/asterix/metadata/utils/SplitsAndConstraintsUtil.java
@@ -23,12 +23,13 @@ import java.util.ArrayList;
 import java.util.List;
 
 import org.apache.asterix.common.cluster.ClusterPartition;
+import org.apache.asterix.common.config.ClusterProperties;
 import org.apache.asterix.common.utils.StoragePathUtil;
 import org.apache.asterix.metadata.MetadataException;
 import org.apache.asterix.metadata.MetadataManager;
 import org.apache.asterix.metadata.MetadataTransactionContext;
 import org.apache.asterix.metadata.entities.Dataset;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import org.apache.asterix.runtime.util.ClusterStateManager;
 import 
org.apache.hyracks.algebricks.common.constraints.AlgebricksPartitionConstraint;
 import org.apache.hyracks.algebricks.common.exceptions.AlgebricksException;
 import org.apache.hyracks.algebricks.common.utils.Pair;
@@ -44,11 +45,11 @@ public class SplitsAndConstraintsUtil {
         File relPathFile = new File(dataverseName);
         List<FileSplit> splits = new ArrayList<>();
         // get all partitions
-        ClusterPartition[] clusterPartition = 
AsterixClusterProperties.INSTANCE.getClusterPartitons();
-        String storageDirName = 
AsterixClusterProperties.INSTANCE.getStorageDirectoryName();
+        ClusterPartition[] clusterPartition = 
ClusterStateManager.INSTANCE.getClusterPartitons();
+        String storageDirName = 
ClusterProperties.INSTANCE.getStorageDirectoryName();
         for (int j = 0; j < clusterPartition.length; j++) {
             int nodePartitions =
-                    
AsterixClusterProperties.INSTANCE.getNodePartitionsCount(clusterPartition[j].getNodeId());
+                    
ClusterStateManager.INSTANCE.getNodePartitionsCount(clusterPartition[j].getNodeId());
             for (int i = 0; i < nodePartitions; i++) {
                 File f = new 
File(StoragePathUtil.prepareStoragePartitionPath(storageDirName,
                         clusterPartition[i].getPartitionId()) + File.separator 
+ relPathFile);
@@ -70,11 +71,11 @@ public class SplitsAndConstraintsUtil {
                 throw new AlgebricksException("Couldn't find node group " + 
dataset.getNodeGroupName());
             }
 
-            String storageDirName = 
AsterixClusterProperties.INSTANCE.getStorageDirectoryName();
+            String storageDirName = 
ClusterProperties.INSTANCE.getStorageDirectoryName();
             List<FileSplit> splits = new ArrayList<>();
             for (String nd : nodeGroup) {
-                int numPartitions = 
AsterixClusterProperties.INSTANCE.getNodePartitionsCount(nd);
-                ClusterPartition[] nodePartitions = 
AsterixClusterProperties.INSTANCE.getNodePartitions(nd);
+                int numPartitions = 
ClusterStateManager.INSTANCE.getNodePartitionsCount(nd);
+                ClusterPartition[] nodePartitions = 
ClusterStateManager.INSTANCE.getNodePartitions(nd);
                 // currently this case is never executed since the metadata 
group doesn't exists
                 if 
(dataset.getNodeGroupName().compareTo(MetadataConstants.METADATA_NODEGROUP_NAME)
 == 0) {
                     numPartitions = 1;
@@ -110,8 +111,8 @@ public class SplitsAndConstraintsUtil {
             List<FileSplit> splits = new ArrayList<>();
             for (String nodeId : nodeGroup) {
                 // get node partitions
-                ClusterPartition[] nodePartitions = 
AsterixClusterProperties.INSTANCE.getNodePartitions(nodeId);
-                String storageDirName = 
AsterixClusterProperties.INSTANCE.getStorageDirectoryName();
+                ClusterPartition[] nodePartitions = 
ClusterStateManager.INSTANCE.getNodePartitions(nodeId);
+                String storageDirName = 
ClusterProperties.INSTANCE.getStorageDirectoryName();
                 int firstPartition = 0;
                 if (create) {
                     // Only the first partition when create
@@ -146,7 +147,7 @@ public class SplitsAndConstraintsUtil {
     }
 
     public static String getIndexPath(String partitionPath, int partition, 
String dataverse, String fullIndexName) {
-        String storageDirName = 
AsterixClusterProperties.INSTANCE.getStorageDirectoryName();
+        String storageDirName = 
ClusterProperties.INSTANCE.getStorageDirectoryName();
         return partitionPath + 
StoragePathUtil.prepareStoragePartitionPath(storageDirName, partition) + 
File.separator
                 + StoragePathUtil.prepareDataverseIndexName(dataverse, 
fullIndexName);
     }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/management/ReplicationManager.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/management/ReplicationManager.java
 
b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/management/ReplicationManager.java
index 53bd164..87be768 100644
--- 
a/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/management/ReplicationManager.java
+++ 
b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/management/ReplicationManager.java
@@ -53,6 +53,7 @@ import java.util.logging.Logger;
 
 import org.apache.asterix.common.cluster.ClusterPartition;
 import org.apache.asterix.common.config.AsterixReplicationProperties;
+import org.apache.asterix.common.config.ClusterProperties;
 import org.apache.asterix.common.config.IAsterixPropertiesProvider;
 import org.apache.asterix.common.dataflow.AsterixLSMIndexUtil;
 import org.apache.asterix.common.replication.AsterixReplicationJob;
@@ -65,7 +66,6 @@ import 
org.apache.asterix.common.transactions.IAsterixAppRuntimeContextProvider;
 import org.apache.asterix.common.transactions.ILogManager;
 import org.apache.asterix.common.transactions.ILogRecord;
 import org.apache.asterix.common.transactions.LogType;
-import 
org.apache.asterix.transaction.management.resource.PersistentLocalResourceRepository;
 import org.apache.asterix.event.schema.cluster.Node;
 import org.apache.asterix.replication.functions.ReplicaFilesRequest;
 import org.apache.asterix.replication.functions.ReplicaIndexFlushRequest;
@@ -76,6 +76,7 @@ import 
org.apache.asterix.replication.logging.TxnLogReplicator;
 import org.apache.asterix.replication.storage.LSMComponentProperties;
 import org.apache.asterix.replication.storage.LSMIndexFileProperties;
 import org.apache.asterix.replication.storage.ReplicaResourcesManager;
+import 
org.apache.asterix.transaction.management.resource.PersistentLocalResourceRepository;
 import 
org.apache.hyracks.api.application.IClusterLifecycleListener.ClusterEventType;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.replication.IReplicationJob;
@@ -441,7 +442,7 @@ public class ReplicationManager implements 
IReplicationManager {
 
     @Override
     public boolean isReplicationEnabled() {
-        return replicationProperties.isReplicationEnabled();
+        return ClusterProperties.INSTANCE.isReplicationEnabled();
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/recovery/RemoteRecoveryManager.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/recovery/RemoteRecoveryManager.java
 
b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/recovery/RemoteRecoveryManager.java
index 46a2076..866831b 100644
--- 
a/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/recovery/RemoteRecoveryManager.java
+++ 
b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/recovery/RemoteRecoveryManager.java
@@ -32,15 +32,15 @@ import 
org.apache.asterix.common.api.IAsterixAppRuntimeContext;
 import org.apache.asterix.common.api.IDatasetLifecycleManager;
 import org.apache.asterix.common.cluster.ClusterPartition;
 import org.apache.asterix.common.config.AsterixReplicationProperties;
+import org.apache.asterix.common.config.ClusterProperties;
 import org.apache.asterix.common.config.IAsterixPropertiesProvider;
 import org.apache.asterix.common.exceptions.ACIDException;
 import org.apache.asterix.common.replication.IRemoteRecoveryManager;
 import org.apache.asterix.common.replication.IReplicationManager;
 import org.apache.asterix.common.transactions.ILogManager;
 import org.apache.asterix.common.transactions.IRecoveryManager;
-import 
org.apache.asterix.transaction.management.resource.PersistentLocalResourceRepository;
 import org.apache.asterix.replication.storage.ReplicaResourcesManager;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import 
org.apache.asterix.transaction.management.resource.PersistentLocalResourceRepository;
 
 public class RemoteRecoveryManager implements IRemoteRecoveryManager {
 
@@ -181,7 +181,7 @@ public class RemoteRecoveryManager implements 
IRemoteRecoveryManager {
 
                 //3. remove any existing storage data and initialize storage 
metadata
                 resourceRepository.deleteStorageData(true);
-                
resourceRepository.initializeNewUniverse(AsterixClusterProperties.INSTANCE.getStorageDirectoryName());
+                
resourceRepository.initializeNewUniverse(ClusterProperties.INSTANCE.getStorageDirectoryName());
 
                 //4. select remote replicas to recover from per lost replica 
data
                 failbackRecoveryReplicas = constructRemoteRecoveryPlan();

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/storage/ReplicaResourcesManager.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/storage/ReplicaResourcesManager.java
 
b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/storage/ReplicaResourcesManager.java
index 01d6db7..6fc8fd5 100644
--- 
a/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/storage/ReplicaResourcesManager.java
+++ 
b/asterixdb/asterix-replication/src/main/java/org/apache/asterix/replication/storage/ReplicaResourcesManager.java
@@ -39,11 +39,11 @@ import java.util.logging.Logger;
 
 import org.apache.asterix.common.cluster.ClusterPartition;
 import org.apache.asterix.common.config.AsterixMetadataProperties;
+import org.apache.asterix.common.config.ClusterProperties;
 import org.apache.asterix.common.replication.IReplicaResourcesManager;
-import 
org.apache.asterix.transaction.management.resource.PersistentLocalResourceRepository;
 import org.apache.asterix.common.utils.StoragePathUtil;
 import org.apache.asterix.metadata.utils.SplitsAndConstraintsUtil;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import 
org.apache.asterix.transaction.management.resource.PersistentLocalResourceRepository;
 import org.apache.commons.io.FileUtils;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.storage.common.file.ILocalResourceRepository;
@@ -245,7 +245,7 @@ public class ReplicaResourcesManager implements 
IReplicaResourcesManager {
      */
     public Set<File> getPartitionIndexes(int partition) {
         Set<File> partitionIndexes = new HashSet<File>();
-        String storageDirName = 
AsterixClusterProperties.INSTANCE.getStorageDirectoryName();
+        String storageDirName = 
ClusterProperties.INSTANCE.getStorageDirectoryName();
         String partitionStoragePath = 
localRepository.getPartitionPath(partition)
                 + StoragePathUtil.prepareStoragePartitionPath(storageDirName, 
partition);
         File partitionRoot = new File(partitionStoragePath);

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/CompleteFailbackResponseMessage.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/CompleteFailbackResponseMessage.java
 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/CompleteFailbackResponseMessage.java
index 73e5fd2..4ae73ea 100644
--- 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/CompleteFailbackResponseMessage.java
+++ 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/CompleteFailbackResponseMessage.java
@@ -20,7 +20,7 @@ package org.apache.asterix.runtime.message;
 
 import java.util.Set;
 
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import org.apache.asterix.runtime.util.ClusterStateManager;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.service.IControllerService;
 
@@ -49,6 +49,6 @@ public class CompleteFailbackResponseMessage extends 
AbstractFailbackPlanMessage
 
     @Override
     public void handle(IControllerService cs) throws HyracksDataException {
-        
AsterixClusterProperties.INSTANCE.processCompleteFailbackResponse(this);
+        ClusterStateManager.INSTANCE.processCompleteFailbackResponse(this);
     }
 }

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/PreparePartitionsFailbackResponseMessage.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/PreparePartitionsFailbackResponseMessage.java
 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/PreparePartitionsFailbackResponseMessage.java
index 299121a..db89f7c 100644
--- 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/PreparePartitionsFailbackResponseMessage.java
+++ 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/PreparePartitionsFailbackResponseMessage.java
@@ -20,7 +20,7 @@ package org.apache.asterix.runtime.message;
 
 import java.util.Set;
 
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import org.apache.asterix.runtime.util.ClusterStateManager;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.service.IControllerService;
 
@@ -40,7 +40,7 @@ public class PreparePartitionsFailbackResponseMessage extends 
AbstractFailbackPl
 
     @Override
     public void handle(IControllerService cs) throws HyracksDataException {
-        
AsterixClusterProperties.INSTANCE.processPreparePartitionsFailbackResponse(this);
+        
ClusterStateManager.INSTANCE.processPreparePartitionsFailbackResponse(this);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/ResourceIdRequestMessage.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/ResourceIdRequestMessage.java
 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/ResourceIdRequestMessage.java
index 32d3f64..afe2427 100644
--- 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/ResourceIdRequestMessage.java
+++ 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/ResourceIdRequestMessage.java
@@ -25,7 +25,7 @@ import 
org.apache.asterix.common.messaging.api.IApplicationMessage;
 import org.apache.asterix.common.messaging.api.ICCMessageBroker;
 import org.apache.asterix.common.transactions.IAsterixResourceIdManager;
 import org.apache.asterix.runtime.util.AsterixAppContextInfo;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import org.apache.asterix.runtime.util.ClusterStateManager;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.service.IControllerService;
 
@@ -43,7 +43,7 @@ public class ResourceIdRequestMessage implements 
IApplicationMessage {
             ICCMessageBroker broker =
                     (ICCMessageBroker) 
AsterixAppContextInfo.INSTANCE.getCCApplicationContext().getMessageBroker();
             ResourceIdRequestResponseMessage reponse = new 
ResourceIdRequestResponseMessage();
-            if (!AsterixClusterProperties.INSTANCE.isClusterActive()) {
+            if (!ClusterStateManager.INSTANCE.isClusterActive()) {
                 reponse.setResourceId(-1);
                 reponse.setException(new Exception("Cannot generate global 
resource id when cluster is not active."));
             } else {
@@ -63,7 +63,7 @@ public class ResourceIdRequestMessage implements 
IApplicationMessage {
 
     private void requestMaxResourceID(IAsterixResourceIdManager 
resourceIdManager, ICCMessageBroker broker)
             throws Exception {
-        Set<String> getParticipantNodes = 
AsterixClusterProperties.INSTANCE.getParticipantNodes();
+        Set<String> getParticipantNodes = 
ClusterStateManager.INSTANCE.getParticipantNodes();
         ReportMaxResourceIdRequestMessage msg = new 
ReportMaxResourceIdRequestMessage();
         for (String nodeId : getParticipantNodes) {
             if (!resourceIdManager.reported(nodeId)) {

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/TakeoverMetadataNodeResponseMessage.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/TakeoverMetadataNodeResponseMessage.java
 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/TakeoverMetadataNodeResponseMessage.java
index e18fc8d..2466e2b 100644
--- 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/TakeoverMetadataNodeResponseMessage.java
+++ 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/TakeoverMetadataNodeResponseMessage.java
@@ -19,7 +19,7 @@
 package org.apache.asterix.runtime.message;
 
 import org.apache.asterix.common.messaging.api.IApplicationMessage;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import org.apache.asterix.runtime.util.ClusterStateManager;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.service.IControllerService;
 
@@ -38,7 +38,7 @@ public class TakeoverMetadataNodeResponseMessage implements 
IApplicationMessage
 
     @Override
     public void handle(IControllerService cs) throws HyracksDataException {
-        
AsterixClusterProperties.INSTANCE.processMetadataNodeTakeoverResponse(this);
+        ClusterStateManager.INSTANCE.processMetadataNodeTakeoverResponse(this);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/asterixdb/blob/1d5412dc/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/TakeoverPartitionsResponseMessage.java
----------------------------------------------------------------------
diff --git 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/TakeoverPartitionsResponseMessage.java
 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/TakeoverPartitionsResponseMessage.java
index 1c57a2a..a4a5226 100644
--- 
a/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/TakeoverPartitionsResponseMessage.java
+++ 
b/asterixdb/asterix-runtime/src/main/java/org/apache/asterix/runtime/message/TakeoverPartitionsResponseMessage.java
@@ -19,7 +19,7 @@
 package org.apache.asterix.runtime.message;
 
 import org.apache.asterix.common.messaging.api.IApplicationMessage;
-import org.apache.asterix.runtime.util.AsterixClusterProperties;
+import org.apache.asterix.runtime.util.ClusterStateManager;
 import org.apache.hyracks.api.exceptions.HyracksDataException;
 import org.apache.hyracks.api.service.IControllerService;
 
@@ -50,7 +50,7 @@ public class TakeoverPartitionsResponseMessage implements 
IApplicationMessage {
 
     @Override
     public void handle(IControllerService cs) throws HyracksDataException {
-        
AsterixClusterProperties.INSTANCE.processPartitionTakeoverResponse(this);
+        ClusterStateManager.INSTANCE.processPartitionTakeoverResponse(this);
     }
 
     @Override

Reply via email to