You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ni...@apache.org on 2014/12/07 14:17:57 UTC

[3/3] stratos git commit: Removing Kub host registration APIs and cleaning Autoscaler service.

Removing Kub host registration APIs and cleaning Autoscaler service.


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

Branch: refs/heads/master
Commit: 3ac0be5cb1f43e5dc275052feee7f609d9756ce4
Parents: c733bf0
Author: Nirmal Fernando <ni...@gmail.com>
Authored: Sun Dec 7 18:49:08 2014 +0530
Committer: Nirmal Fernando <ni...@gmail.com>
Committed: Sun Dec 7 18:49:08 2014 +0530

----------------------------------------------------------------------
 .../interfaces/AutoScalerServiceInterface.java  |  143 --
 .../manager/client/AutoscalerServiceClient.java |  125 --
 .../rest/endpoint/api/StratosApiV41Utils.java   |   17 +-
 .../src/main/resources/AutoScalerService.wsdl   | 1742 +++++-------------
 4 files changed, 479 insertions(+), 1548 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/3ac0be5c/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/interfaces/AutoScalerServiceInterface.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/interfaces/AutoScalerServiceInterface.java b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/interfaces/AutoScalerServiceInterface.java
index 3626929..84bda03 100644
--- a/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/interfaces/AutoScalerServiceInterface.java
+++ b/components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/interfaces/AutoScalerServiceInterface.java
@@ -22,7 +22,6 @@
 package org.apache.stratos.autoscaler.interfaces;
 
 import org.apache.stratos.autoscaler.applications.pojo.ApplicationContext;
-import org.apache.stratos.autoscaler.exception.kubernetes.*;
 import org.apache.stratos.autoscaler.pojo.policy.deployment.DeploymentPolicy;
 import org.apache.stratos.autoscaler.exception.*;
 import org.apache.stratos.autoscaler.exception.application.ApplicationDefinitionException;
@@ -30,16 +29,9 @@ import org.apache.stratos.autoscaler.exception.policy.InvalidPolicyException;
 import org.apache.stratos.autoscaler.pojo.ServiceGroup;
 import org.apache.stratos.autoscaler.pojo.policy.autoscale.AutoscalePolicy;
 import org.apache.stratos.common.Properties;
-import org.apache.stratos.common.kubernetes.KubernetesGroup;
-import org.apache.stratos.common.kubernetes.KubernetesHost;
-import org.apache.stratos.common.kubernetes.KubernetesMaster;
 
 public interface AutoScalerServiceInterface {
 
-//    public Partition[] getAllAvailablePartitions();
-
-//    public boolean addPartition(Partition partition) throws InvalidPartitionException;
-
     public DeploymentPolicy[] getAllDeploymentPolicies();
 
     public String addDeploymentPolicy(DeploymentPolicy depPolicy) throws InvalidPolicyException;
@@ -56,147 +48,12 @@ public interface AutoScalerServiceInterface {
 
     public DeploymentPolicy[] getValidDeploymentPoliciesforCartridge(String cartridgeType);
 
-//    public Partition getPartition(String partitionId);
-
     public DeploymentPolicy getDeploymentPolicy(String deploymentPolicyId);
 
     public AutoscalePolicy getAutoscalingPolicy(String autoscalingPolicyId);
 
     public org.apache.stratos.autoscaler.pojo.policy.deployment.partition.network.ApplicationLevelNetworkPartition[] getNetworkPartitions(String deploymentPolicyId);
 
-//    public Partition[] getPartitionsOfGroup(String deploymentPolicyId, String partitionGroup);
-//
-//    public Partition[] getPartitionsOfDeploymentPolicy(String deploymentPolicyId);
-
-    /**
-     * Retrieves registered Kubernetes Groups.
-     */
-    @Deprecated
-    public KubernetesGroup[] getAllKubernetesGroups();
-
-    /**
-     * Retrieves Kubernetes Group for given Kubernetes Group ID.
-     *
-     * @param kubernetesGroupId
-     */
-    @Deprecated
-    public KubernetesGroup getKubernetesGroup(String kubernetesGroupId) throws NonExistingKubernetesGroupException;
-
-    /**
-     * Retrieves Kubernetes Master for given Kubernetes Group ID.
-     *
-     * @param kubernetesGroupId
-     */
-    @Deprecated
-    public KubernetesMaster getMasterForKubernetesGroup(String kubernetesGroupId) throws NonExistingKubernetesGroupException;
-
-    /**
-     * Retrieves Kubernetes Hosts for given Kubernetes Group ID.
-     *
-     * @param kubernetesGroupId
-     */
-    @Deprecated
-    public KubernetesHost[] getHostsForKubernetesGroup(String kubernetesGroupId) throws NonExistingKubernetesGroupException;
-
-    /**
-     * Register a Kubernetes cluster.
-     *
-     * @param kubernetesGroup
-     * @throws org.apache.stratos.autoscaler.exception.kubernetes.InvalidKubernetesGroupException
-     */
-    @Deprecated
-    public boolean addKubernetesGroup(KubernetesGroup kubernetesGroup) throws InvalidKubernetesGroupException;
-
-    /**
-     * Add a Kubernetes host to a Kubernetes Group.
-     *
-     * @param groupId
-     * @param kubernetesHost
-     * @throws org.apache.stratos.autoscaler.exception.kubernetes.InvalidKubernetesHostException
-     */
-    @Deprecated
-    public boolean addKubernetesHost(String groupId, KubernetesHost kubernetesHost) throws
-            InvalidKubernetesHostException, NonExistingKubernetesGroupException;
-
-    /**
-     * Update a Kubernetes host.
-     *
-     * @param kubernetesHost
-     * @throws InvalidKubernetesHostException
-     */
-    @Deprecated
-    public boolean updateKubernetesHost(KubernetesHost kubernetesHost) throws
-            InvalidKubernetesHostException, NonExistingKubernetesHostException;
-
-    /**
-     * Remove a Kubernetes host.
-     *
-     * @param groupId
-     * @throws NonExistingKubernetesGroupException
-     */
-    @Deprecated
-    public boolean removeKubernetesGroup(String groupId) throws NonExistingKubernetesGroupException;
-
-    /**
-     * Update a Kubernetes host.
-     *
-     * @param hostId
-     * @throws InvalidKubernetesHostException
-     */
-    public boolean removeKubernetesHost(String hostId) throws NonExistingKubernetesHostException;
-
-    /**
-     * Update a Kubernetes Master in a Kubernetes Group.
-     *
-     * @param kubernetesMaster
-     * @throws NonExistingKubernetesMasterException
-     */
-    @Deprecated
-    public boolean updateKubernetesMaster(KubernetesMaster kubernetesMaster)
-            throws InvalidKubernetesMasterException, NonExistingKubernetesMasterException;
-
-//    /**
-//     * Check existence of a lb cluster in network partitions of a given policy.
-//     *
-//     * @param lbClusterId
-//     * @param deploymentPolicyId
-//     * @throws NonExistingLBException if the lb cluster id cannot be found in any of the network partitions.
-//     */
-//    public void checkLBExistenceAgainstPolicy(String lbClusterId, String deploymentPolicyId) throws NonExistingLBException;
-//
-//    /**
-//     * Check the existence of default lb in network partitions of a given policy.
-//     *
-//     * @param deploymentPolicyId
-//     * @return true if the LB exists in all the network partitions of this policy,
-//     * false if a LB couldn't find even in one network partition.
-//     */
-//    public boolean checkDefaultLBExistenceAgainstPolicy(String deploymentPolicyId);
-//
-//    /**
-//     * Check the existence of per cluster lb in network partitions of a given policy.
-//     *
-//     * @param clusterId          cluster id of the service cluster which requires a dedicated LB.
-//     * @param deploymentPolicyId
-//     * @return true if the cluster based LB exists in all the network partitions of this policy,
-//     * false if a LB couldn't find even in one network partition.
-//     */
-//    public boolean checkClusterLBExistenceAgainstPolicy(String clusterId, String deploymentPolicyId);
-//
-//    /**
-//     * Check the existence of per service lb in network partitions of a given policy.
-//     *
-//     * @param serviceName        service name of the service cluster which requires a dedicated LB.
-//     * @param deploymentPolicyId
-//     * @return true if the service based LB exists in all the network partitions of this policy,
-//     * false if a LB couldn't find even in one network partition.
-//     */
-//    public boolean checkServiceLBExistenceAgainstPolicy(String serviceName, String deploymentPolicyId);
-//
-//    public String getDefaultLBClusterId(String deploymentPolicyName);
-//
-//    public String getServiceLBClusterId (String serviceType, String deploymentPolicyName);
-
     /**
      * Dynamically update the properties of an Autoscaling Cluster Monitor
      * @param clusterId id of the cluster.

http://git-wip-us.apache.org/repos/asf/stratos/blob/3ac0be5c/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/client/AutoscalerServiceClient.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/client/AutoscalerServiceClient.java b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/client/AutoscalerServiceClient.java
index 8687a4b..223058b 100644
--- a/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/client/AutoscalerServiceClient.java
+++ b/components/org.apache.stratos.manager/src/main/java/org/apache/stratos/manager/client/AutoscalerServiceClient.java
@@ -25,9 +25,6 @@ import org.apache.axis2.transport.http.HTTPConstants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.autoscaler.stub.deployment.partition.ApplicationLevelNetworkPartition;
-import org.apache.stratos.autoscaler.stub.kubernetes.KubernetesGroup;
-import org.apache.stratos.autoscaler.stub.kubernetes.KubernetesHost;
-import org.apache.stratos.autoscaler.stub.kubernetes.KubernetesMaster;
 import org.apache.stratos.autoscaler.stub.pojo.ApplicationContext;
 import org.apache.stratos.autoscaler.stub.pojo.ServiceGroup;
 import org.apache.stratos.autoscaler.stub.*;
@@ -79,49 +76,11 @@ public class AutoscalerServiceClient {
         return serviceClient;
     }
 
-//    public Partition[] getAvailablePartitions() throws RemoteException {
-//
-//        Partition[] partitions;
-//        partitions = stub.getAllAvailablePartitions();
-//
-//        return partitions;
-//    }
-
     public void undeployServiceGroupDefinition(String serviceGroupName)
             throws RemoteException, AutoScalerServiceAutoScalerExceptionException {
         stub.undeployServiceGroup(serviceGroupName);
     }
 
-//    public Partition getPartition(
-//            String partitionId) throws RemoteException {
-//
-//        Partition partition;
-//        partition = stub.getPartition(partitionId);
-//
-//        return partition;
-//    }
-
-//    public Partition[] getPartitionsOfGroup(
-//            String deploymentPolicyId, String partitionGroupId)
-//            throws RemoteException {
-//
-//        Partition[] partitions;
-//        partitions = stub.getPartitionsOfGroup(deploymentPolicyId,
-//                partitionGroupId);
-//
-//        return partitions;
-//    }
-
-//    public Partition[]
-//    getPartitionsOfDeploymentPolicy(
-//            String deploymentPolicyId) throws RemoteException {
-//
-//        Partition[] partitions;
-//        partitions = stub.getPartitionsOfDeploymentPolicy(deploymentPolicyId);
-//
-//        return partitions;
-//    }
-
     public ApplicationLevelNetworkPartition[] getApplicationLevelNetworkPartition(
             String deploymentPolicyId) throws RemoteException {
 
@@ -174,20 +133,6 @@ public class AutoscalerServiceClient {
         stub.undeployDeploymentPolicy(applicationId);
     }
 
-//    public void checkLBExistenceAgainstPolicy(String clusterId, String deploymentPolicyId) throws RemoteException,
-//            AutoScalerServiceNonExistingLBExceptionException {
-//        stub.checkLBExistenceAgainstPolicy(clusterId, deploymentPolicyId);
-//    }
-//
-//    public boolean checkDefaultLBExistenceAgainstPolicy(
-//            String deploymentPolicyId) throws RemoteException {
-//        return stub.checkDefaultLBExistenceAgainstPolicy(deploymentPolicyId);
-//    }
-//
-//    public boolean checkServiceLBExistenceAgainstPolicy(String serviceName, String deploymentPolicyId) throws RemoteException {
-//        return stub.checkServiceLBExistenceAgainstPolicy(serviceName, deploymentPolicyId);
-//    }
-
     public org.apache.stratos.autoscaler.stub.deployment.policy.DeploymentPolicy getDeploymentPolicy(String deploymentPolicyId) throws RemoteException {
 
         org.apache.stratos.autoscaler.stub.deployment.policy.DeploymentPolicy deploymentPolicy;
@@ -222,18 +167,6 @@ public class AutoscalerServiceClient {
         return stub.updateAutoScalingPolicy(autoScalePolicy);
     }
 
-//    public boolean deployPartition(Partition partition) throws RemoteException,
-//            AutoScalerServiceInvalidPartitionExceptionException {
-//
-//        return stub.addPartition(partition);
-//
-//    }
-
-//    public String getDefaultLBClusterId(String deploymentPolicy) throws RemoteException {
-//        return stub.getDefaultLBClusterId(deploymentPolicy);
-//    }
-
-
     public ServiceGroup getServiceGroup(String serviceGroupDefinitionName) throws RemoteException {
         return stub.getServiceGroup(serviceGroupDefinitionName);
     }
@@ -256,64 +189,6 @@ public class AutoscalerServiceClient {
         stub.unDeployApplicationDefinition(applicationId, tenantId, tenantDomain);
     }
 
-
-//    public String getServiceLBClusterId(String serviceType, String deploymentPolicy) throws RemoteException {
-//        return stub.getServiceLBClusterId(serviceType, deploymentPolicy);
-//    }
-
-    public boolean deployKubernetesGroup(KubernetesGroup kubernetesGroup) throws RemoteException,
-            AutoScalerServiceInvalidKubernetesGroupExceptionException {
-        return stub.addKubernetesGroup(kubernetesGroup);
-    }
-
-    public boolean deployKubernetesHost(String kubernetesGroupId, KubernetesHost kubernetesHost)
-            throws RemoteException, AutoScalerServiceInvalidKubernetesHostExceptionException,
-            AutoScalerServiceNonExistingKubernetesGroupExceptionException {
-
-        return stub.addKubernetesHost(kubernetesGroupId, kubernetesHost);
-    }
-
-    public boolean updateKubernetesMaster(KubernetesMaster kubernetesMaster)
-            throws RemoteException, AutoScalerServiceInvalidKubernetesMasterExceptionException,
-            AutoScalerServiceNonExistingKubernetesMasterExceptionException {
-        return stub.updateKubernetesMaster(kubernetesMaster);
-    }
-
-    public KubernetesGroup[] getAvailableKubernetesGroups() throws RemoteException {
-        return stub.getAllKubernetesGroups();
-    }
-
-    public KubernetesGroup getKubernetesGroup(String kubernetesGroupId)
-            throws RemoteException, AutoScalerServiceNonExistingKubernetesGroupExceptionException {
-        return stub.getKubernetesGroup(kubernetesGroupId);
-    }
-
-    public boolean undeployKubernetesGroup(String kubernetesGroupId)
-            throws RemoteException, AutoScalerServiceNonExistingKubernetesGroupExceptionException {
-        return stub.removeKubernetesGroup(kubernetesGroupId);
-    }
-
-    public boolean undeployKubernetesHost(String kubernetesHostId)
-            throws RemoteException, AutoScalerServiceNonExistingKubernetesHostExceptionException {
-        return stub.removeKubernetesHost(kubernetesHostId);
-    }
-
-    public KubernetesHost[] getKubernetesHosts(String kubernetesGroupId)
-            throws RemoteException, AutoScalerServiceNonExistingKubernetesGroupExceptionException {
-        return stub.getHostsForKubernetesGroup(kubernetesGroupId);
-    }
-
-    public KubernetesMaster getKubernetesMaster(String kubernetesGroupId)
-            throws RemoteException, AutoScalerServiceNonExistingKubernetesGroupExceptionException {
-        return stub.getMasterForKubernetesGroup(kubernetesGroupId);
-    }
-
-    public boolean updateKubernetesHost(KubernetesHost kubernetesHost)
-            throws RemoteException, AutoScalerServiceInvalidKubernetesHostExceptionException,
-            AutoScalerServiceNonExistingKubernetesHostExceptionException {
-        return stub.updateKubernetesHost(kubernetesHost);
-    }
-
     public void updateClusterMonitor(String clusterId, Properties properties) throws RemoteException, AutoScalerServiceInvalidArgumentExceptionException {
         stub.updateClusterMonitor(clusterId, ApplicationManagementUtil.toAutoscalerStubProperties(properties));
     }

http://git-wip-us.apache.org/repos/asf/stratos/blob/3ac0be5c/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
index d493c39..c377b08 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/api/StratosApiV41Utils.java
@@ -79,6 +79,7 @@ import org.apache.stratos.rest.endpoint.exception.RestAPIException;
 
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.Response.Status;
+
 import java.rmi.RemoteException;
 import java.util.*;
 import java.util.regex.Pattern;
@@ -1833,15 +1834,15 @@ public class StratosApiV41Utils {
 
     public static boolean undeployKubernetesGroup(String kubernetesGroupId) throws RestAPIException {
 
-        AutoscalerServiceClient autoscalerServiceClient = getAutoscalerServiceClient();
-        if (autoscalerServiceClient != null) {
+        CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient();
+        if (cloudControllerServiceClient != null) {
             try {
-                return autoscalerServiceClient.undeployKubernetesGroup(kubernetesGroupId);
+                return cloudControllerServiceClient.undeployKubernetesGroup(kubernetesGroupId);
 
             } catch (RemoteException e) {
                 log.error(e.getMessage(), e);
                 throw new RestAPIException(e.getMessage(), e);
-            } catch (AutoScalerServiceNonExistingKubernetesGroupExceptionException e) {
+            } catch (CloudControllerServiceNonExistingKubernetesGroupExceptionException e) {
                 String message = e.getFaultMessage().getNonExistingKubernetesGroupException().getMessage();
                 log.error(message, e);
                 throw new RestAPIException(message, e);
@@ -1852,15 +1853,15 @@ public class StratosApiV41Utils {
 
     public static boolean undeployKubernetesHost(String kubernetesHostId) throws RestAPIException {
 
-        AutoscalerServiceClient autoscalerServiceClient = getAutoscalerServiceClient();
-        if (autoscalerServiceClient != null) {
+        CloudControllerServiceClient cloudControllerServiceClient = getCloudControllerServiceClient();
+        if (cloudControllerServiceClient != null) {
             try {
-                return autoscalerServiceClient.undeployKubernetesHost(kubernetesHostId);
+                return cloudControllerServiceClient.undeployKubernetesHost(kubernetesHostId);
 
             } catch (RemoteException e) {
                 log.error(e.getMessage(), e);
                 throw new RestAPIException(e.getMessage(), e);
-            } catch (AutoScalerServiceNonExistingKubernetesHostExceptionException e) {
+            } catch (CloudControllerServiceNonExistingKubernetesHostExceptionException e) {
                 String message = e.getFaultMessage().getNonExistingKubernetesHostException().getMessage();
                 log.error(message, e);
                 throw new RestAPIException(message, e);