stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From im...@apache.org
Subject [2/7] stratos git commit: Introducing KubernetesIaas class, MemberContext.clusterInstanceId, removing Cartridge.deployerType
Date Sat, 20 Dec 2014 21:56:40 GMT
http://git-wip-us.apache.org/repos/asf/stratos/blob/b575c7d6/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
index 48d56db..7363410 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/util/converter/ObjectConverter.java
@@ -63,19 +63,18 @@ public class ObjectConverter {
 
         CartridgeConfig cartridgeConfig = new CartridgeConfig();
 
-        cartridgeConfig.setType(cartridgeDefinitionBean.getType());
-        cartridgeConfig.setHostName(cartridgeDefinitionBean.getHost());
-        cartridgeConfig.setProvider(cartridgeDefinitionBean.getProvider());
-        cartridgeConfig.setCategory(cartridgeDefinitionBean.getCategory());
-        cartridgeConfig.setVersion(cartridgeDefinitionBean.getVersion());
-        cartridgeConfig.setMultiTenant(cartridgeDefinitionBean.isMultiTenant());
-        cartridgeConfig.setIsPublic(cartridgeDefinitionBean.isPublic());
-        cartridgeConfig.setDisplayName(cartridgeDefinitionBean.getDisplayName());
-        cartridgeConfig.setDescription(cartridgeDefinitionBean.getDescription());
-        cartridgeConfig.setDefaultAutoscalingPolicy(cartridgeDefinitionBean.getDefaultAutoscalingPolicy());
-        cartridgeConfig.setDefaultDeploymentPolicy(cartridgeDefinitionBean.getDefaultDeploymentPolicy());
-        cartridgeConfig.setServiceGroup(cartridgeDefinitionBean.getServiceGroup());
-        cartridgeConfig.setDeployerType(cartridgeDefinitionBean.getDeployerType());
+	    cartridgeConfig.setType(cartridgeDefinitionBean.getType());
+	    cartridgeConfig.setHostName(cartridgeDefinitionBean.getHost());
+	    cartridgeConfig.setProvider(cartridgeDefinitionBean.getProvider());
+	    cartridgeConfig.setCategory(cartridgeDefinitionBean.getCategory());
+	    cartridgeConfig.setVersion(cartridgeDefinitionBean.getVersion());
+	    cartridgeConfig.setMultiTenant(cartridgeDefinitionBean.isMultiTenant());
+	    cartridgeConfig.setIsPublic(cartridgeDefinitionBean.isPublic());
+	    cartridgeConfig.setDisplayName(cartridgeDefinitionBean.getDisplayName());
+	    cartridgeConfig.setDescription(cartridgeDefinitionBean.getDescription());
+	    cartridgeConfig.setDefaultAutoscalingPolicy(cartridgeDefinitionBean.getDefaultAutoscalingPolicy());
+	    cartridgeConfig.setDefaultDeploymentPolicy(cartridgeDefinitionBean.getDefaultDeploymentPolicy());
+	    cartridgeConfig.setServiceGroup(cartridgeDefinitionBean.getServiceGroup());
 
         //deployment information
         if (cartridgeDefinitionBean.getDeployment() != null) {
@@ -217,7 +216,7 @@ public class ObjectConverter {
         properties.setProperties(propertyArray);
         return properties;
     }
-
+    
     public static org.apache.stratos.cloud.controller.stub.Properties convertPropertyBeansToCCStubProperties(
             List<PropertyBean> propertyBeans) {
 
@@ -272,7 +271,7 @@ public class ObjectConverter {
             networkInterface.setFixedIp(nib.getFixedIp());
             networkInterface.setPortUuid(nib.getPortUuid());
             if (nib.getFloatingNetworks() != null && !nib.getFloatingNetworks().isEmpty())
{
-                networkInterface.setFloatingNetworks(ObjectConverter.convertFloatingNetworkBeansToFloatingNetworks(nib.getFloatingNetworks()));
+            	networkInterface.setFloatingNetworks(ObjectConverter.convertFloatingNetworkBeansToFloatingNetworks(nib.getFloatingNetworks()));
             }
 
             networkInterfacesArray[i++] = networkInterface;
@@ -282,7 +281,7 @@ public class ObjectConverter {
         networkInterfaces.setNetworkInterfaces(networkInterfacesArray);
         return networkInterfaces;
     }
-
+    
     private static FloatingNetworks convertFloatingNetworkBeansToFloatingNetworks(List<FloatingNetworkBean>
floatingNetworkBeans) {
 
         FloatingNetwork[] floatingNetworksArray = new FloatingNetwork[floatingNetworkBeans.size()];
@@ -397,7 +396,7 @@ public class ObjectConverter {
     public static DeploymentPolicy convertStubDeploymentPolicyToDeploymentPolicy(
             org.apache.stratos.autoscaler.stub.deployment.policy.DeploymentPolicy stubDeploymentPolicy)
{
 
-        if (stubDeploymentPolicy == null) {
+        if(stubDeploymentPolicy == null) {
             return null;
         }
 
@@ -408,12 +407,12 @@ public class ObjectConverter {
         if (stubDeploymentPolicy.getApplicationLevelNetworkPartitions() != null) {
             org.apache.stratos.autoscaler.stub.deployment.partition.ApplicationLevelNetworkPartition[]
                     networkPartitions = stubDeploymentPolicy.getApplicationLevelNetworkPartitions();
-            if (networkPartitions != null) {
+            if(networkPartitions != null) {
                 deploymentPolicy.setApplicationPolicy(new ApplicationPolicy());
                 List<ApplicationLevelNetworkPartition> networkPartitionList = new ArrayList<ApplicationLevelNetworkPartition>();
-                for (org.apache.stratos.autoscaler.stub.deployment.partition.ApplicationLevelNetworkPartition
+                for(org.apache.stratos.autoscaler.stub.deployment.partition.ApplicationLevelNetworkPartition
                         networkPartition : networkPartitions) {
-                    if (networkPartition != null) {
+                    if(networkPartition != null) {
                         networkPartitionList.add(convertStubNetworkPartitionToNetworkPartition(networkPartition));
                     }
                 }
@@ -424,9 +423,9 @@ public class ObjectConverter {
         if (stubDeploymentPolicy.getChildPolicies() != null) {
             List<org.apache.stratos.common.beans.autoscaler.policy.deployment.ChildPolicy>
childPolicyList =
                     new ArrayList<org.apache.stratos.common.beans.autoscaler.policy.deployment.ChildPolicy>();
-            for (org.apache.stratos.autoscaler.stub.deployment.policy.ChildPolicy stubChildDeploymentPolicy
:
+            for(org.apache.stratos.autoscaler.stub.deployment.policy.ChildPolicy stubChildDeploymentPolicy
:
                     stubDeploymentPolicy.getChildPolicies()) {
-                if (stubChildDeploymentPolicy != null) {
+                if(stubChildDeploymentPolicy != null) {
                     childPolicyList.add(convertStubChildPolicyToChildPolicy(stubChildDeploymentPolicy));
                 }
             }
@@ -437,16 +436,16 @@ public class ObjectConverter {
 
     private static org.apache.stratos.common.beans.autoscaler.policy.deployment.ChildPolicy
     convertStubChildPolicyToChildPolicy(ChildPolicy stubChildDeploymentPolicy) {
-        if (stubChildDeploymentPolicy == null) {
+        if(stubChildDeploymentPolicy == null) {
             return null;
         }
         org.apache.stratos.common.beans.autoscaler.policy.deployment.ChildPolicy childPolicy
= new
                 org.apache.stratos.common.beans.autoscaler.policy.deployment.ChildPolicy();
         childPolicy.setAlias(stubChildDeploymentPolicy.getAlias());
-        if (stubChildDeploymentPolicy.getChildLevelNetworkPartitions() != null) {
+        if(stubChildDeploymentPolicy.getChildLevelNetworkPartitions() != null) {
             List<org.apache.stratos.common.beans.autoscaler.partition.ChildLevelNetworkPartition>
networkPartitionList
                     = new ArrayList<org.apache.stratos.common.beans.autoscaler.partition.ChildLevelNetworkPartition>();
-            for (org.apache.stratos.autoscaler.stub.deployment.partition.ChildLevelNetworkPartition
+            for(org.apache.stratos.autoscaler.stub.deployment.partition.ChildLevelNetworkPartition
                     stubChildLevelNetworkPartition : stubChildDeploymentPolicy.getChildLevelNetworkPartitions())
{
                 networkPartitionList.add(convertStubChildLevelNetworkPartitionToChildLevelNetworkPartition(stubChildLevelNetworkPartition));
             }
@@ -458,17 +457,17 @@ public class ObjectConverter {
     private static org.apache.stratos.common.beans.autoscaler.partition.ChildLevelNetworkPartition
     convertStubChildLevelNetworkPartitionToChildLevelNetworkPartition(
             ChildLevelNetworkPartition stubChildLevelNetworkPartition) {
-        if (stubChildLevelNetworkPartition == null) {
+        if(stubChildLevelNetworkPartition == null) {
             return null;
         }
         org.apache.stratos.common.beans.autoscaler.partition.ChildLevelNetworkPartition childLevelNetworkPartition
=
                 new org.apache.stratos.common.beans.autoscaler.partition.ChildLevelNetworkPartition();
         childLevelNetworkPartition.setId(stubChildLevelNetworkPartition.getId());
         childLevelNetworkPartition.setPartitionAlgo(stubChildLevelNetworkPartition.getPartitionAlgo());
-        if (stubChildLevelNetworkPartition.getChildLevelPartitions() != null) {
+        if(stubChildLevelNetworkPartition.getChildLevelPartitions() != null) {
             List<org.apache.stratos.common.beans.autoscaler.partition.ChildLevelPartition>
partitionList =
                     new ArrayList<org.apache.stratos.common.beans.autoscaler.partition.ChildLevelPartition>();
-            for (org.apache.stratos.autoscaler.stub.deployment.partition.ChildLevelPartition
stubChildLevelPartition : stubChildLevelNetworkPartition.getChildLevelPartitions()) {
+            for(org.apache.stratos.autoscaler.stub.deployment.partition.ChildLevelPartition
stubChildLevelPartition : stubChildLevelNetworkPartition.getChildLevelPartitions()) {
                 partitionList.add(convertStubChildLevelPartitionToChildLevelPartition(stubChildLevelPartition));
             }
             childLevelNetworkPartition.setPartitions(partitionList);
@@ -478,7 +477,7 @@ public class ObjectConverter {
 
     private static org.apache.stratos.common.beans.autoscaler.partition.ChildLevelPartition
     convertStubChildLevelPartitionToChildLevelPartition(ChildLevelPartition stubChildLevelPartition)
{
-        if (stubChildLevelPartition == null) {
+        if(stubChildLevelPartition == null) {
             return null;
         }
         org.apache.stratos.common.beans.autoscaler.partition.ChildLevelPartition childLevelPartition
=
@@ -490,18 +489,18 @@ public class ObjectConverter {
 
     private static ApplicationLevelNetworkPartition convertStubNetworkPartitionToNetworkPartition(
             org.apache.stratos.autoscaler.stub.deployment.partition.ApplicationLevelNetworkPartition
stubNetworkPartition) {
-        if (stubNetworkPartition == null) {
+        if(stubNetworkPartition == null) {
             return null;
         }
 
         ApplicationLevelNetworkPartition networkPartition = new ApplicationLevelNetworkPartition();
         networkPartition.setId(stubNetworkPartition.getId());
         networkPartition.setActiveByDefault(stubNetworkPartition.getActiveByDefault());
-        if (stubNetworkPartition.getPartitions() != null) {
+        if(stubNetworkPartition.getPartitions() != null) {
             List<Partition> partitionList = new ArrayList<Partition>();
-            for (org.apache.stratos.autoscaler.stub.deployment.partition.Partition stubPartition
:
+            for(org.apache.stratos.autoscaler.stub.deployment.partition.Partition stubPartition
:
                     stubNetworkPartition.getPartitions()) {
-                if (stubPartition != null) {
+                if(stubPartition != null) {
                     partitionList.add(convertStubPartitionToPartition(stubPartition));
                 }
             }
@@ -511,7 +510,7 @@ public class ObjectConverter {
     }
 
     private static Partition convertStubPartitionToPartition(org.apache.stratos.autoscaler.stub.deployment.partition.Partition
stubPartition) {
-        if (stubPartition == null) {
+        if(stubPartition == null) {
             return null;
         }
         Partition partition = new Partition();
@@ -519,10 +518,10 @@ public class ObjectConverter {
         partition.setPublic(stubPartition.getIsPublic());
         partition.setDescription(stubPartition.getDescription());
         partition.setProvider(stubPartition.getProvider());
-        if (stubPartition.getProperties() != null) {
+        if(stubPartition.getProperties() != null) {
             List<PropertyBean> propertyBeanList = new ArrayList<PropertyBean>();
-            for (org.apache.stratos.autoscaler.stub.Property stubProperty : stubPartition.getProperties().getProperties())
{
-                if (stubProperty != null) {
+            for(org.apache.stratos.autoscaler.stub.Property stubProperty : stubPartition.getProperties().getProperties())
{
+                if(stubProperty != null) {
                     propertyBeanList.add(convertStubPropertyToPropertyBean(stubProperty));
                 }
             }
@@ -532,7 +531,7 @@ public class ObjectConverter {
     }
 
     private static PropertyBean convertStubPropertyToPropertyBean(org.apache.stratos.autoscaler.stub.Property
stubProperty) {
-        if (stubProperty == null) {
+        if(stubProperty == null) {
             return null;
         }
 
@@ -604,25 +603,29 @@ public class ObjectConverter {
         clusterBean.setHostNames(new ArrayList<String>());
         Collection<ClusterInstance> clusterInstances = cluster.getClusterInstances();
         List<org.apache.stratos.common.beans.topology.Instance> instancesList =
-                new ArrayList<org.apache.stratos.common.beans.topology.Instance>();
-        if (clusterInstances != null) {
-            for (ClusterInstance clusterInstance : clusterInstances) {
-                org.apache.stratos.common.beans.topology.Instance instance =
-                        new org.apache.stratos.common.beans.topology.Instance();
-                instance.setInstanceId(clusterInstance.getInstanceId());
-                instance.setStatus(clusterInstance.getStatus().toString());
-                instancesList.add(instance);
-            }
-            clusterBean.setInstances(instancesList);
-        }
+        		new ArrayList<org.apache.stratos.common.beans.topology.Instance>();
+		if (clusterInstances != null) {
+			for (ClusterInstance clusterInstance : clusterInstances) {
+				org.apache.stratos.common.beans.topology.Instance instance =
+						new org.apache.stratos.common.beans.topology.Instance();
+				instance.setInstanceId(clusterInstance.getInstanceId());
+				instance.setStatus(clusterInstance.getStatus().toString());
+				instancesList.add(instance);
+			}
+			clusterBean.setInstances(instancesList);
+		}
 
         for (org.apache.stratos.messaging.domain.topology.Member member : cluster.getMembers())
{
             Member memberBean = new Member();
+            memberBean.setServiceName(member.getServiceName());
             memberBean.setClusterId(member.getClusterId());
+            memberBean.setMemberId(member.getMemberId());
+            memberBean.setInstanceId(member.getInstanceId());
+            memberBean.setClusterInstanceId(member.getClusterInstanceId());
+
             memberBean.setLbClusterId(member.getLbClusterId());
             memberBean.setNetworkPartitionId(member.getNetworkPartitionId());
             memberBean.setPartitionId(member.getPartitionId());
-            memberBean.setMemberId(member.getMemberId());
             if (member.getMemberIp() == null) {
                 memberBean.setMemberIp("NULL");
             } else {
@@ -633,7 +636,6 @@ public class ObjectConverter {
             } else {
                 memberBean.setMemberPublicIp(member.getMemberPublicIp());
             }
-            memberBean.setServiceName(member.getServiceName());
             memberBean.setStatus(member.getStatus().toString());
             memberBean.setProperty(convertJavaUtilPropertiesToPropertyBeans(member.getProperties()));
             clusterBean.getMember().add(memberBean);
@@ -942,7 +944,7 @@ public class ObjectConverter {
     }
 
     private static org.apache.stratos.cloud.controller.stub.kubernetes.KubernetesHost[]
-    convertToASKubernetesHostsPojo(List<KubernetesHost> kubernetesHosts) {
+        convertToASKubernetesHostsPojo(List<KubernetesHost> kubernetesHosts) {
 
         if (kubernetesHosts == null || kubernetesHosts.isEmpty()) {
             return null;
@@ -959,7 +961,7 @@ public class ObjectConverter {
 
 
     private static org.apache.stratos.cloud.controller.stub.kubernetes.PortRange
-    convertPortRangeToStubPortRange(PortRange portRangeBean) {
+        convertPortRangeToStubPortRange(PortRange portRangeBean) {
 
         if (portRangeBean == null) {
             return null;
@@ -972,7 +974,7 @@ public class ObjectConverter {
     }
 
     public static org.apache.stratos.cloud.controller.stub.kubernetes.KubernetesHost
-    convertKubernetesHostToStubKubernetesHost(KubernetesHost kubernetesHostBean) {
+        convertKubernetesHostToStubKubernetesHost(KubernetesHost kubernetesHostBean) {
 
         if (kubernetesHostBean == null) {
             return null;
@@ -989,7 +991,7 @@ public class ObjectConverter {
     }
 
     public static org.apache.stratos.cloud.controller.stub.kubernetes.KubernetesMaster
-    convertStubKubernetesMasterToKubernetesMaster(KubernetesMaster kubernetesMasterBean)
{
+        convertStubKubernetesMasterToKubernetesMaster(KubernetesMaster kubernetesMasterBean)
{
 
         if (kubernetesMasterBean == null) {
             return null;
@@ -1068,7 +1070,7 @@ public class ObjectConverter {
         kubernetesHostBean.setProperty(convertCCStubPropertiesToPropertyBeans(kubernetesHost.getProperties()));
         return kubernetesHostBean;
     }
-
+    
     private static List<PropertyBean> convertCCStubPropertiesToPropertyBeans(org.apache.stratos.cloud.controller.stub.Properties
properties) {
         if (properties == null || properties.getProperties() == null) {
             return null;
@@ -1089,7 +1091,7 @@ public class ObjectConverter {
         propertyBean.setValue(propertyE.getValue());
         return propertyBean;
     }
-
+    
     private static PropertyBean convertStubPropertyToPropertyBean(org.apache.stratos.cloud.controller.stub.Property
propertyE) {
         if (propertyE == null) {
             return null;
@@ -1124,7 +1126,7 @@ public class ObjectConverter {
         if (applicationDefinition.getComponents() != null) {
             org.apache.stratos.autoscaler.stub.pojo.ComponentContext componentContext =
                     new org.apache.stratos.autoscaler.stub.pojo.ComponentContext();
-
+                      
             // top level Groups
             if (applicationDefinition.getComponents().getGroups() != null) {
                 componentContext.setGroupContexts(
@@ -1147,7 +1149,7 @@ public class ObjectConverter {
 
     public static ApplicationDefinition convertStubApplicationContextToApplicationDefinition(
             ApplicationContext applicationContext) {
-        if (applicationContext == null) {
+        if(applicationContext == null) {
             return null;
         }
 
@@ -1182,9 +1184,9 @@ public class ObjectConverter {
 
     private static List<GroupDefinition> convertStubGroupContextsToGroupDefinitions(GroupContext[]
groupContexts) {
         List<GroupDefinition> groupDefinitions = new ArrayList<GroupDefinition>();
-        if (groupContexts != null) {
+        if(groupContexts != null) {
             for (GroupContext groupContext : groupContexts) {
-                if (groupContext != null) {
+                if(groupContext != null) {
                     GroupDefinition groupDefinition = new GroupDefinition();
                     groupDefinition.setAlias(groupContext.getAlias());
                     groupDefinition.setGroupMaxInstances(groupContext.getGroupMaxInstances());
@@ -1205,28 +1207,28 @@ public class ObjectConverter {
         DependencyDefinitions dependencyDefinitions = new DependencyDefinitions();
         dependencyDefinitions.setTerminationBehaviour(dependencyContext.getTerminationBehaviour());
 
-        if (dependencyContext.getStartupOrdersContexts() != null) {
-            List<String> startupOrders = new ArrayList<String>();
-            for (String item : dependencyContext.getStartupOrdersContexts()) {
-                startupOrders.add(item);
+            if(dependencyContext.getStartupOrdersContexts() != null) {
+                List<String> startupOrders = new ArrayList<String>();
+                for(String item : dependencyContext.getStartupOrdersContexts()) {
+                    startupOrders.add(item);
+                }
+                dependencyDefinitions.setStartupOrders(startupOrders);
             }
-            dependencyDefinitions.setStartupOrders(startupOrders);
-        }
-        if (dependencyContext.getScalingDependents() != null) {
-            List<String> scalingDependents = new ArrayList<String>();
-            for (String item : dependencyContext.getScalingDependents()) {
-                scalingDependents.add(item);
+            if (dependencyContext.getScalingDependents() != null) {
+                List<String> scalingDependents = new ArrayList<String>();
+                for(String item : dependencyContext.getScalingDependents()) {
+                    scalingDependents.add(item);
+                }
+                dependencyDefinitions.setScalingDependants(scalingDependents);
             }
-            dependencyDefinitions.setScalingDependants(scalingDependents);
-        }
         return dependencyDefinitions;
     }
 
     private static List<CartridgeDefinition> convertStubCartridgeContextsToCartridgeDefinitions(CartridgeContext[]
cartridgeContexts) {
         List<CartridgeDefinition> cartridgeDefinitions = new ArrayList<CartridgeDefinition>();
-        if (cartridgeContexts != null) {
+        if(cartridgeContexts != null) {
             for (CartridgeContext cartridgeContext : cartridgeContexts) {
-                if (cartridgeContext != null) {
+                if(cartridgeContext != null) {
                     CartridgeDefinition cartridgeDefinition = new CartridgeDefinition();
                     cartridgeDefinition.setType(cartridgeContext.getType());
                     cartridgeDefinition.setCartridgeMin(cartridgeContext.getCartridgeMin());
@@ -1244,7 +1246,7 @@ public class ObjectConverter {
         SubscribableInfo subscribableInfo = new SubscribableInfo();
         subscribableInfo.setAlias(subscribableInfoContext.getAlias());
         subscribableInfo.setAutoscalingPolicy(subscribableInfoContext.getAutoscalingPolicy());
-        if (!CommonUtil.isEmptyArray(subscribableInfoContext.getDependencyAliases())) {
+        if(!CommonUtil.isEmptyArray(subscribableInfoContext.getDependencyAliases())) {
             subscribableInfo.setDependencyAliases(subscribableInfoContext.getDependencyAliases());
         }
         subscribableInfo.setDeploymentPolicy(subscribableInfoContext.getDeploymentPolicy());
@@ -1259,13 +1261,13 @@ public class ObjectConverter {
     }
 
     private static List<org.apache.stratos.manager.composite.application.beans.PropertyBean>
-    convertStubPropertiesToPropertyBeanList(org.apache.stratos.autoscaler.stub.Properties
properties) {
+        convertStubPropertiesToPropertyBeanList(org.apache.stratos.autoscaler.stub.Properties
properties) {
 
         List<org.apache.stratos.manager.composite.application.beans.PropertyBean> propertyBeanList
=
                 new ArrayList<org.apache.stratos.manager.composite.application.beans.PropertyBean>();
-        if ((properties != null) && (properties.getProperties() != null)) {
+        if((properties != null) && (properties.getProperties() != null)) {
             for (org.apache.stratos.autoscaler.stub.Property property : properties.getProperties())
{
-                if (property != null) {
+                if(property != null) {
                     org.apache.stratos.manager.composite.application.beans.PropertyBean propertyBean
=
                             new org.apache.stratos.manager.composite.application.beans.PropertyBean();
                     propertyBean.setName(property.getName());
@@ -1280,58 +1282,58 @@ public class ObjectConverter {
     private static CartridgeContext[] convertCartridgeDefinitionsToStubCartridgeContexts(
             List<CartridgeDefinition> cartridges) {
 
-        CartridgeContext[] cartridgeContextArray = new CartridgeContext[cartridges.size()];
-        int i = 0;
-        for (CartridgeDefinition cartridgeDefinition : cartridges) {
-            CartridgeContext context = new CartridgeContext();
-            context.setCartridgeMax(cartridgeDefinition.getCartridgeMax());
-            context.setCartridgeMin(cartridgeDefinition.getCartridgeMin());
-            context.setType(cartridgeDefinition.getType());
-            context.setSubscribableInfoContext(convertSubscribableInfo(cartridgeDefinition.getSubscribableInfo()));
-            cartridgeContextArray[i++] = context;
+    	CartridgeContext[] cartridgeContextArray = new CartridgeContext[cartridges.size()];
+    	int i = 0;
+    	for (CartridgeDefinition cartridgeDefinition : cartridges) {
+    		CartridgeContext context = new CartridgeContext();
+    		context.setCartridgeMax(cartridgeDefinition.getCartridgeMax());
+    		context.setCartridgeMin(cartridgeDefinition.getCartridgeMin());
+    		context.setType(cartridgeDefinition.getType());
+    		context.setSubscribableInfoContext(convertSubscribableInfo(cartridgeDefinition.getSubscribableInfo()));
 
+    		cartridgeContextArray[i++] = context;
         }
-
-        return cartridgeContextArray;
+    	
+	    return cartridgeContextArray;
     }
 
-    private static SubscribableInfoContext convertSubscribableInfo(
+	private static SubscribableInfoContext convertSubscribableInfo(
             SubscribableInfo subscribableInfo) {
-        SubscribableInfoContext infoContext = new SubscribableInfoContext();
-        infoContext.setAlias(subscribableInfo.getAlias());
-        infoContext.setAutoscalingPolicy(subscribableInfo.getAutoscalingPolicy());
-        infoContext.setDependencyAliases(subscribableInfo.getDependencyAliases());
-        infoContext.setDeploymentPolicy(subscribableInfo.getDeploymentPolicy());
-        infoContext.setMaxMembers(subscribableInfo.getMaxMembers());
-        infoContext.setMinMembers(subscribableInfo.getMinMembers());
-        infoContext.setRepoPassword(subscribableInfo.getRepoPassword());
-        infoContext.setRepoUrl(subscribableInfo.getRepoUrl());
-        infoContext.setRepoUsername(subscribableInfo.getRepoUsername());
-        infoContext.setProperties(convertPropertyBeansToStubProperties(subscribableInfo.getProperty()));
-
-        return infoContext;
-    }
-
-    private static org.apache.stratos.autoscaler.stub.Properties convertPropertyBeansToStubProperties(
+		SubscribableInfoContext infoContext = new SubscribableInfoContext();
+		infoContext.setAlias(subscribableInfo.getAlias());
+		infoContext.setAutoscalingPolicy(subscribableInfo.getAutoscalingPolicy());
+		infoContext.setDependencyAliases(subscribableInfo.getDependencyAliases());
+		infoContext.setDeploymentPolicy(subscribableInfo.getDeploymentPolicy());
+		infoContext.setMaxMembers(subscribableInfo.getMaxMembers());
+		infoContext.setMinMembers(subscribableInfo.getMinMembers());
+		infoContext.setRepoPassword(subscribableInfo.getRepoPassword());
+		infoContext.setRepoUrl(subscribableInfo.getRepoUrl());
+		infoContext.setRepoUsername(subscribableInfo.getRepoUsername());
+		infoContext.setProperties(convertPropertyBeansToStubProperties(subscribableInfo.getProperty()));
+		
+	    return infoContext;
+    }
+
+	private static org.apache.stratos.autoscaler.stub.Properties convertPropertyBeansToStubProperties(
             List<org.apache.stratos.manager.composite.application.beans.PropertyBean>
property) {
-        org.apache.stratos.autoscaler.stub.Properties prop = new org.apache.stratos.autoscaler.stub.Properties();
-        if (property != null) {
-            for (org.apache.stratos.manager.composite.application.beans.PropertyBean propertyBean
: property) {
-                org.apache.stratos.autoscaler.stub.Property p = new org.apache.stratos.autoscaler.stub.Property();
-                p.setName(propertyBean.getName());
-                p.setValue(propertyBean.getValue());
-                prop.addProperties(p);
-            }
-        }
-        return prop;
-    }
-
-
+		org.apache.stratos.autoscaler.stub.Properties prop = new org.apache.stratos.autoscaler.stub.Properties();
+		if (property != null) {
+			for (org.apache.stratos.manager.composite.application.beans.PropertyBean propertyBean
: property) {
+				org.apache.stratos.autoscaler.stub.Property p = new org.apache.stratos.autoscaler.stub.Property();
+				p.setName(propertyBean.getName());
+				p.setValue(propertyBean.getValue());
+				prop.addProperties(p);
+			}
+		}
+	    return prop;
+    }
+
+	
     private static DependencyContext convertDependencyDefinitionsToDependencyContexts(DependencyDefinitions
dependencyDefinitions) {
         DependencyContext dependencyContext = new DependencyContext();
         dependencyContext.setTerminationBehaviour(dependencyDefinitions.getTerminationBehaviour());
 
-        if (dependencyDefinitions != null) {
-            if (dependencyDefinitions.getStartupOrders() != null) {
+        if (dependencyDefinitions != null){
+            if(dependencyDefinitions.getStartupOrders() != null) {
                 String[] startupOrders = new String[dependencyDefinitions.getStartupOrders().size()];
                 startupOrders = dependencyDefinitions.getStartupOrders().toArray(startupOrders);
                 dependencyContext.setStartupOrdersContexts(startupOrders);
@@ -1346,7 +1348,7 @@ public class ObjectConverter {
     }
 
     private static org.apache.stratos.autoscaler.stub.pojo.GroupContext[]
-    convertGroupDefinitionsToStubGroupContexts(List<GroupDefinition> groupDefinitions)
{
+        convertGroupDefinitionsToStubGroupContexts(List<GroupDefinition> groupDefinitions)
{
 
         GroupContext[] groupContexts = new GroupContext[groupDefinitions.size()];
         int i = 0;
@@ -1357,12 +1359,12 @@ public class ObjectConverter {
             groupContext.setGroupMaxInstances(groupDefinition.getGroupMaxInstances());
             groupContext.setGroupMinInstances(groupDefinition.getGroupMinInstances());
             groupContext.setGroupScalingEnabled(groupDefinition.isGroupScalingEnabled);
-
+           
             // Groups
             if (groupDefinition.getGroups() != null) {
                 groupContext.setGroupContexts(convertGroupDefinitionsToStubGroupContexts(groupDefinition.getGroups()));
             }
-
+            
             groupContext.setCartridgeContexts(convertCartridgeDefinitionsToStubCartridgeContexts(groupDefinition.getCartridges()));
             groupContexts[i++] = groupContext;
         }
@@ -1371,57 +1373,39 @@ public class ObjectConverter {
     }
 
 
-    public static ApplicationInfoBean convertApplicationToApplicationBean(Application application)
{
-        if (application == null) {
-            return null;
-        }
-
-        ApplicationInfoBean applicationBean = new ApplicationInfoBean();
-        applicationBean.setId(application.getUniqueIdentifier());
-        applicationBean.setName(application.getName());
-        applicationBean.setDescription(application.getDescription());
-        applicationBean.setTenantDomain(application.getTenantDomain());
-        applicationBean.setTenantAdminUsername(application.getTenantAdminUserName());
-        //applicationBean.set(convertApplicationToApplicationInstanceBean(application));
-        return applicationBean;
-    }
-
-    public static ApplicationInfoBean convertApplicationToApplicationInstanceBean(Application
application) {
+    public static ApplicationBean convertApplicationToApplicationBean(Application application)
{
         if (application == null) {
             return null;
         }
 
-        ApplicationInfoBean applicationBean = new
-                ApplicationInfoBean();
+        ApplicationBean applicationBean = new ApplicationBean();
         applicationBean.setId(application.getUniqueIdentifier());
         applicationBean.setName(application.getName());
         applicationBean.setDescription(application.getDescription());
         applicationBean.setTenantDomain(application.getTenantDomain());
         applicationBean.setTenantAdminUsername(application.getTenantAdminUserName());
-        applicationBean.setApplicationInstances(convertApplicationInstancesToApplicationInstances(application));
+        applicationBean.setInstances(convertApplicationInstancesToInstances(application));
         return applicationBean;
     }
 
-    private static List<ApplicationInstanceBean> convertApplicationInstancesToApplicationInstances(
+    private static List<Instance> convertApplicationInstancesToInstances(
             Application application) {
-        List<ApplicationInstanceBean> applicationInstanceList = new ArrayList<ApplicationInstanceBean>();
-        Collection<ApplicationInstance> applicationInstancesInTopology =
-                application.getInstanceIdToInstanceContextMap().values();
-
-        if (applicationInstancesInTopology != null) {
-            for (ApplicationInstance applicationInstance : applicationInstancesInTopology)
{
-                ApplicationInstanceBean instance = new ApplicationInstanceBean();
-                instance.setInstanceId(applicationInstance.getInstanceId());
-                instance.setApplicationId(application.getUniqueIdentifier());
-                instance.setParentInstanceId(applicationInstance.getParentId());
-                instance.setStatus(applicationInstance.getStatus().toString());
-                applicationInstanceList.add(instance);
+    	List<Instance> applicationInstanceList = new ArrayList<Instance>();
+    	Collection<ApplicationInstance> applicationInstancesInTopology = 
+    			application.getInstanceIdToInstanceContextMap().values();
+    	
+    	if(applicationInstancesInTopology != null) {
+    		for (ApplicationInstance applicationInstance : applicationInstancesInTopology) {
+    			Instance instance = new Instance();
+    			instance.setInstanceId(applicationInstance.getInstanceId());
+    			instance.setStatus(applicationInstance.getStatus().toString());
+    			applicationInstanceList.add(instance);
             }
-        }
-        return applicationInstanceList;
+    	}
+	    return applicationInstanceList;
     }
 
-    public static GroupBean convertGroupToGroupBean(Group group) {
+	public static GroupBean convertGroupToGroupBean(Group group) {
         if (group == null) {
             return null;
         }
@@ -1433,63 +1417,24 @@ public class ObjectConverter {
         return groupBean;
     }
 
-    public static List<GroupInstanceBean> convertGroupToGroupInstancesBean(String instanceId,
Group group) {
-        if (group == null) {
-            return null;
-        }
-
-        List<GroupInstanceBean> groupInstanceBeans = new ArrayList<GroupInstanceBean>();
-        if (group.getInstanceContexts(instanceId) != null) {
-            GroupInstance groupInstance = group.getInstanceContexts(instanceId);
-            GroupInstanceBean groupInstanceBean = new GroupInstanceBean();
-            groupInstanceBean.setParentInstanceId(instanceId);
-            groupInstanceBean.setInstanceId(groupInstance.getInstanceId());
-            groupInstanceBean.setStatus(groupInstance.getStatus().toString());
-            groupInstanceBean.setGroupId(group.getUniqueIdentifier());
-            /*for(Group group1 : group.getGroups()) {
-                groupInstanceBean.setGroupInstances(convertGroupToGroupInstancesBean(
-                        groupInstance.getInstanceId(), group1));
-            }*/
-            groupInstanceBeans.add(groupInstanceBean);
-
-        } else {
-            List<org.apache.stratos.messaging.domain.instance.Instance> groupInstances
=
-                    group.getInstanceContextsWithParentId(instanceId);
-            for (org.apache.stratos.messaging.domain.instance.Instance groupInstance : groupInstances)
{
-                GroupInstanceBean groupInstanceBean = new GroupInstanceBean();
-                groupInstanceBean.setParentInstanceId(instanceId);
-                groupInstanceBean.setInstanceId(groupInstance.getInstanceId());
-                groupInstanceBean.setStatus(((GroupInstance) groupInstance).getStatus().toString());
-                groupInstanceBean.setGroupId(group.getUniqueIdentifier());
-                /*for(Group group1 : group.getGroups()) {
-                    groupInstanceBean.setGroupInstances(convertGroupToGroupInstancesBean(
-                            groupInstance.getInstanceId(), group1));
-                }*/
-                groupInstanceBeans.add(groupInstanceBean);
-            }
-        }
-
-        return groupInstanceBeans;
-    }
-
-    private static List<Instance> convertGroupInstancesToInstances(Group group) {
-        List<Instance> instanceList = new ArrayList<Instance>();
-        Collection<GroupInstance> instancesInTopology = group.getInstanceIdToInstanceContextMap().values();
-        if (instancesInTopology != null) {
-            for (GroupInstance groupInstance : instancesInTopology) {
-                Instance instance = new Instance();
-                instance.setStatus(groupInstance.getStatus().toString());
-                instance.setInstanceId(groupInstance.getInstanceId());
-                instanceList.add(instance);
+	private static List<Instance> convertGroupInstancesToInstances(Group group) {
+	    List<Instance> instanceList = new ArrayList<Instance>();
+	    Collection<GroupInstance> instancesInTopology = group.getInstanceIdToInstanceContextMap().values();
+	    if(instancesInTopology != null) {
+	    	for (GroupInstance groupInstance : instancesInTopology) {
+	            Instance instance = new Instance();
+	            instance.setStatus(groupInstance.getStatus().toString());
+	            instance.setInstanceId(groupInstance.getInstanceId());
+	            instanceList.add(instance);
             }
-        }
-        return instanceList;
+	    }
+	    return instanceList;
     }
 
     public static org.apache.stratos.common.beans.TenantInfoBean convertCarbonTenantInfoBeanToTenantInfoBean(
             TenantInfoBean carbonTenantInfoBean) {
 
-        if (carbonTenantInfoBean == null) {
+        if(carbonTenantInfoBean == null) {
             return null;
         }
 
@@ -1510,7 +1455,7 @@ public class ObjectConverter {
     public static TenantInfoBean convertTenantInfoBeanToCarbonTenantInfoBean(
             org.apache.stratos.common.beans.TenantInfoBean tenantInfoBean) {
 
-        if (tenantInfoBean == null) {
+        if(tenantInfoBean == null) {
             return null;
         }
 
@@ -1523,7 +1468,7 @@ public class ObjectConverter {
         carbonTenantInfoBean.setAdminPassword(tenantInfoBean.getAdminPassword());
         carbonTenantInfoBean.setFirstname(tenantInfoBean.getFirstname());
         carbonTenantInfoBean.setLastname(tenantInfoBean.getLastname());
-        if (tenantInfoBean.getCreatedDate() > 0) {
+        if(tenantInfoBean.getCreatedDate() > 0) {
             Calendar calendar = Calendar.getInstance();
             calendar.setTimeInMillis(tenantInfoBean.getCreatedDate());
             carbonTenantInfoBean.setCreatedDate(calendar);

http://git-wip-us.apache.org/repos/asf/stratos/blob/b575c7d6/service-stubs/org.apache.stratos.autoscaler.service.stub/src/main/resources/AutoScalerService.wsdl
----------------------------------------------------------------------
diff --git a/service-stubs/org.apache.stratos.autoscaler.service.stub/src/main/resources/AutoScalerService.wsdl
b/service-stubs/org.apache.stratos.autoscaler.service.stub/src/main/resources/AutoScalerService.wsdl
index 11ea4a2..83f99a2 100644
--- a/service-stubs/org.apache.stratos.autoscaler.service.stub/src/main/resources/AutoScalerService.wsdl
+++ b/service-stubs/org.apache.stratos.autoscaler.service.stub/src/main/resources/AutoScalerService.wsdl
@@ -426,29 +426,29 @@
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getAutoScalingPolicies">
+            <xs:element name="serviceGroupExist">
                 <xs:complexType>
-                    <xs:sequence/>
+                    <xs:sequence>
+                        <xs:element minOccurs="0" name="serviceName" nillable="true" type="xs:string"/>
+                    </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="getAutoScalingPoliciesResponse">
+            <xs:element name="serviceGroupExistResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return"
nillable="true" type="ax23:AutoscalePolicy"/>
+                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="serviceGroupExist">
+            <xs:element name="getAutoScalingPolicies">
                 <xs:complexType>
-                    <xs:sequence>
-                        <xs:element minOccurs="0" name="serviceName" nillable="true" type="xs:string"/>
-                    </xs:sequence>
+                    <xs:sequence/>
                 </xs:complexType>
             </xs:element>
-            <xs:element name="serviceGroupExistResponse">
+            <xs:element name="getAutoScalingPoliciesResponse">
                 <xs:complexType>
                     <xs:sequence>
-                        <xs:element minOccurs="0" name="return" type="xs:boolean"/>
+                        <xs:element maxOccurs="unbounded" minOccurs="0" name="return"
nillable="true" type="ax23:AutoscalePolicy"/>
                     </xs:sequence>
                 </xs:complexType>
             </xs:element>


Mime
View raw message