Repository: stratos
Updated Branches:
  refs/heads/4.1.0-beta-deployment-policy-fix 2ebca69e0 -> 5b0ab68ee


removing network partitions stuff from AS policy manager


Project: http://git-wip-us.apache.org/repos/asf/stratos/repo
Commit: http://git-wip-us.apache.org/repos/asf/stratos/commit/5b0ab68e
Tree: http://git-wip-us.apache.org/repos/asf/stratos/tree/5b0ab68e
Diff: http://git-wip-us.apache.org/repos/asf/stratos/diff/5b0ab68e

Branch: refs/heads/4.1.0-beta-deployment-policy-fix
Commit: 5b0ab68ee08dd114f346feab2e4aeab6b6e43ddd
Parents: 2ebca69
Author: R-Rajkumar <[email protected]>
Authored: Thu Feb 19 14:03:41 2015 +0530
Committer: R-Rajkumar <[email protected]>
Committed: Thu Feb 19 14:03:41 2015 +0530

----------------------------------------------------------------------
 .../autoscaler/registry/RegistryManager.java    | 136 -------------------
 .../autoscaler/util/AutoscalerConstants.java    |   1 -
 2 files changed, 137 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/5b0ab68e/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java
 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java
index bb3a9f5..dc2ec7a 100644
--- 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java
+++ 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/registry/RegistryManager.java
@@ -135,142 +135,6 @@ public class RegistryManager {
         }
     }
 
-    /**
-     * Persist network partition in the registry
-     * @param networkPartition
-     */
-    public void persistNetworkPartition(NetworkPartition networkPartition) {
-        String resourcePath = AutoscalerConstants.AUTOSCALER_RESOURCE + 
AutoscalerConstants.NETWORK_PARTITIONS_RESOURCE + "/" + 
networkPartition.getId();
-        persist(networkPartition, resourcePath);
-        if (log.isDebugEnabled()) {
-            log.debug(String.format("Network partition written to registry: 
%s", networkPartition.toString()));
-        }
-    }
-
-    /**
-     * Get network partition resource paths
-     * @return
-     */
-    private String[] getNetworkPartitionResourcePaths() {
-        try {
-            PrivilegedCarbonContext.startTenantFlow();
-            PrivilegedCarbonContext carbonContext = 
PrivilegedCarbonContext.getThreadLocalCarbonContext();
-            
carbonContext.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
-            carbonContext.setTenantId(MultitenantConstants.SUPER_TENANT_ID);
-
-            Object obj = retrieve(AutoscalerConstants.AUTOSCALER_RESOURCE +
-                    AutoscalerConstants.NETWORK_PARTITIONS_RESOURCE);
-
-            if (obj != null) {
-                if (obj instanceof String[]) {
-                    return (String[]) obj;
-                } else {
-                    log.warn("Expected object type not found for network 
partitions in registry");
-                    return null;
-                }
-            }
-        } finally {
-            PrivilegedCarbonContext.endTenantFlow();
-        }
-        return null;
-    }
-
-    /**
-     * Get network partitions
-     * @return
-     */
-    public List<NetworkPartition> getNetworkPartitions() {
-        List<NetworkPartition> networkPartitions = new 
ArrayList<NetworkPartition>();
-        String[] networkPartitionResourcePaths = 
getNetworkPartitionResourcePaths();
-        if(networkPartitionResourcePaths != null) {
-            for (String resourcePath : networkPartitionResourcePaths) {
-                if(StringUtils.isNotBlank(resourcePath)) {
-                    NetworkPartition networkPartition = 
getNetworkPartitionByResourcePath(resourcePath);
-                    networkPartitions.add(networkPartition);
-                }
-            }
-        }
-        return networkPartitions;
-    }
-
-    /**
-     * Get network partition by network partition id
-     * @param networkPartitionId
-     * @return
-     */
-    public NetworkPartition getNetworkPartition(String networkPartitionId) {
-
-        try {
-            PrivilegedCarbonContext.startTenantFlow();
-            PrivilegedCarbonContext carbonContext = 
PrivilegedCarbonContext.getThreadLocalCarbonContext();
-            
carbonContext.setTenantDomain(MultitenantConstants.SUPER_TENANT_DOMAIN_NAME);
-            carbonContext.setTenantId(MultitenantConstants.SUPER_TENANT_ID);
-
-            String resourcePath = AutoscalerConstants.AUTOSCALER_RESOURCE +
-                    AutoscalerConstants.NETWORK_PARTITIONS_RESOURCE + "/" + 
networkPartitionId;
-            return getNetworkPartitionByResourcePath(resourcePath);
-        } finally {
-            PrivilegedCarbonContext.endTenantFlow();
-        }
-    }
-
-    /**
-     * Get network partition by resource path
-     * @param resourcePath
-     * @return
-     */
-    private NetworkPartition getNetworkPartitionByResourcePath(String 
resourcePath) {
-        Object obj = retrieve(resourcePath);
-        if (obj != null) {
-            try {
-                Object dataObj = 
Deserializer.deserializeFromByteArray((byte[]) obj);
-                if (dataObj instanceof NetworkPartition) {
-                    return (NetworkPartition) dataObj;
-                } else {
-                    return null;
-                }
-            } catch (Exception e) {
-                String msg = "Could not read network partition from registry: 
[resource-path] " + resourcePath;
-                log.warn(msg, e);
-            }
-        }
-        return null;
-    }
-
-    /**
-     * Remove network partition from the registry
-     * @param networkPartitionId
-     */
-    public void removeNetworkPartition(String networkPartitionId) {
-        String resourcePath = AutoscalerConstants.AUTOSCALER_RESOURCE +
-                AutoscalerConstants.NETWORK_PARTITIONS_RESOURCE + "/" + 
networkPartitionId;
-        this.delete(resourcePath);
-        if (log.isDebugEnabled()) {
-            log.debug(String.format("Network partition deleted from registry: 
[id] %s", networkPartitionId));
-        }
-    }
-
-    /**
-     * Update network partition in the registry
-     * @param networkPartition
-     */
-    public void updateNetworkPartition(NetworkPartition networkPartition) {
-        try {
-            if (getNetworkPartition(networkPartition.getId()) == null) {
-                throw new AutoScalerException(String.format("Network partition 
does not exist: " +
-                        "[network-partition-id] %s", 
networkPartition.getId()));
-            }
-
-            persistNetworkPartition(networkPartition);
-            if (log.isDebugEnabled()) {
-                log.debug(String.format("Network partition updated 
successfully: %s", networkPartition.toString()));
-            }
-        } catch (Exception e) {
-            log.error((String.format("Unable to update network partition 
[network-partition-id] %s",
-                    networkPartition.getId())), e);
-        }
-    }
-
     public void persistApplication(Application application) {
 
         try {

http://git-wip-us.apache.org/repos/asf/stratos/blob/5b0ab68e/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerConstants.java
----------------------------------------------------------------------
diff --git 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerConstants.java
 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerConstants.java
index 1a1ca92..a9d6335 100644
--- 
a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerConstants.java
+++ 
b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/util/AutoscalerConstants.java
@@ -44,7 +44,6 @@ public final class AutoscalerConstants {
         */
        public static final String AUTOSCALER_RESOURCE = "/autoscaler";
        public static final String PARTITION_RESOURCE = "/partitions";
-       public static final String NETWORK_PARTITIONS_RESOURCE = 
"/networkPartitions";
        public static final String AS_POLICY_RESOURCE = 
"/policies/autoscalingPolicies";
        public static final String DEPLOYMENT_POLICY_RESOURCE = 
"/policies/deploymentPolicies";
     public static final String APPLICATIONS_RESOURCE = "/applications";

Reply via email to