You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ra...@apache.org on 2015/02/26 16:54:20 UTC
stratos git commit: adding comments and removing commented code
Repository: stratos
Updated Branches:
refs/heads/master-deployment-policy-fix-merge 0444ec21c -> cb3f63be4
adding comments and removing commented code
Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/cb3f63be
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/cb3f63be
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/cb3f63be
Branch: refs/heads/master-deployment-policy-fix-merge
Commit: cb3f63be4de48466e9a51b4ff3a648405b67329c
Parents: 0444ec2
Author: R-Rajkumar <rr...@gmail.com>
Authored: Thu Feb 26 21:24:02 2015 +0530
Committer: R-Rajkumar <rr...@gmail.com>
Committed: Thu Feb 26 21:24:02 2015 +0530
----------------------------------------------------------------------
.../stratos/autoscaler/util/AutoscalerUtil.java | 83 ++++++--------------
1 file changed, 22 insertions(+), 61 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/stratos/blob/cb3f63be/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
index f23229e..6ec0197 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerUtil.java
@@ -369,6 +369,12 @@ public class AutoscalerUtil {
return "*";
}
+ /**
+ * Get network partition ids referred in an application. Network partition ids are not referred directly.
+ * Cartridge or cartridge group can refer deployment policy which has network partition references.
+ * @param applicationId the application id
+ * @return list of network partition ids
+ */
public static List<String> getNetworkPartitionIdsReferedInApplication(String applicationId) {
List<String> deploymentPolicyIdsReferedInApplication = getDeploymentPolicyIdsReferedInApplication(applicationId);
@@ -399,6 +405,11 @@ public class AutoscalerUtil {
return networkPartitionIds;
}
+ /**
+ * Get deployment policy ids referred in an application.
+ * @param applicationId the application id
+ * @return list of deployment policy ids
+ */
private static List<String> getDeploymentPolicyIdsReferedInApplication(String applicationId) {
Map<String, String> aliasToDeploymentPolicyIdMap = getAliasToDeploymentPolicyIdMapOfApplication(applicationId);
@@ -418,6 +429,12 @@ public class AutoscalerUtil {
return deploymentPolicyIds;
}
+ /**
+ * Get deployment policy id of an alias in the given application
+ * @param applicationId the application id
+ * @param alias the cartridge or cartridge-group alias
+ * @return the deployment policy id if found, null otherwise
+ */
public static String getDeploymentPolicyIdByAlias(String applicationId, String alias) {
if (alias == null || alias.isEmpty()) {
@@ -433,6 +450,11 @@ public class AutoscalerUtil {
return aliasToDeploymentPolicyIdMap.get(alias);
}
+ /**
+ * Get alias to deployment policy id map in the given application.
+ * @param applicationId the application id
+ * @return alias to deployment policy map
+ */
private static Map<String, String> getAliasToDeploymentPolicyIdMapOfApplication(String applicationId) {
Map<String, String> aliasToDeploymentPolicyIdMap = new HashMap<String, String>();
@@ -529,65 +551,4 @@ public class AutoscalerUtil {
}
}
}
-
-// public static LbClusterMonitor getLbClusterMonitor(Cluster cluster) throws PolicyValidationException, PartitionValidationException {
-// if (null == cluster) {
-// return null;
-// }
-//
-// String autoscalePolicyName = cluster.getAutoscalePolicyName();
-// String deploymentPolicyName = cluster.getDeploymentPolicyName();
-//
-// if (log.isDebugEnabled()) {
-// log.debug("Deployment policy name: " + deploymentPolicyName);
-// log.debug("Autoscaler policy name: " + autoscalePolicyName);
-// }
-//
-// AutoscalePolicy policy =
-// PolicyManager.getInstance()
-// .getAutoscalePolicy(autoscalePolicyName);
-// DeploymentPolicy deploymentPolicy =
-// PolicyManager.getInstance()
-// .getDeploymentPolicy(deploymentPolicyName);
-//
-// if (deploymentPolicy == null) {
-// String msg = "Deployment Policy is null. Policy name: " + deploymentPolicyName;
-// log.error(msg);
-// throw new PolicyValidationException(msg);
-// }
-//
-// Partition[] allPartitions = deploymentPolicy.getAllPartitions();
-// if (allPartitions == null) {
-// String msg =
-// "Deployment Policy's Partitions are null. Policy name: " +
-// deploymentPolicyName;
-// log.error(msg);
-// throw new PolicyValidationException(msg);
-// }
-//
-// try {
-// validateExistenceOfPartions(allPartitions);
-// } catch (InvalidPartitionException e) {
-// String msg = "Deployment Policy is invalid. Policy name: " + deploymentPolicyName;
-// log.error(msg, e);
-// throw new PolicyValidationException(msg, e);
-// }
-//
-// CloudControllerClient.getInstance()
-// .validateDeploymentPolicy(cluster.getServiceName(),
-// allPartitions);
-//
-// LbClusterMonitor clusterMonitor =
-// new LbClusterMonitor(cluster.getClusterId(),
-// cluster.getServiceName(),
-// deploymentPolicy, policy);
-// fNetworkPartitionroup partitionGroup: deploymentPoliNetworkPartitionnGroups()){
-//
-// NetworkPartitionContext networkPartitionContext
-// = PartitionManager.getInstance().getNetworkPartitionLbHolder(partitionGroup.getNetworkPartitionId());
-// clusterMonitor.addNetworkPartitionCtxt(networkPartitionContext);
-// }
-// return null;
-// }
-
}