stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From im...@apache.org
Subject [2/2] stratos git commit: Fixing compilation issues caused by the recent rebase
Date Sat, 20 Dec 2014 22:34:41 GMT
Fixing compilation issues caused by the recent rebase


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

Branch: refs/heads/master
Commit: d45f4fd35faa8ddb3b03d4962ba8bcffef97aa88
Parents: da567d0
Author: Imesh Gunaratne <imesh@apache.org>
Authored: Sun Dec 21 04:04:23 2014 +0530
Committer: Imesh Gunaratne <imesh@apache.org>
Committed: Sun Dec 21 04:04:23 2014 +0530

----------------------------------------------------------------------
 .../rest/endpoint/api/StratosApiV41Utils.java   |  4 +-
 .../util/converter/ObjectConverter.java         | 94 ++++++++++++++++----
 2 files changed, 78 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/d45f4fd3/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 e01e557..db68bd5 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
@@ -402,7 +402,7 @@ public class StratosApiV41Utils {
             String message = e.getMessage();
             log.error(message, e);
             throw new RestAPIException(message, e);
-        } catch (CloudControllerServiceUnregisteredCartridgeExceptionException e) {
+        } catch (CloudControllerServiceCartridgeNotFoundExceptionException e) {
             String message = e.getMessage();
             log.error(message, e);
             throw new RestAPIException(message, e);
@@ -880,7 +880,7 @@ public class StratosApiV41Utils {
             throw new RestAPIException(e);
         } catch (ADCException e) {
             throw new RestAPIException(e);
-        } catch (CloudControllerServiceUnregisteredCartridgeExceptionException e) {
+        } catch (CloudControllerServiceCartridgeNotFoundExceptionException e) {
             throw new RestAPIException(e);
         }
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/d45f4fd3/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 7363410..7153232 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
@@ -27,6 +27,7 @@ import org.apache.stratos.autoscaler.stub.pojo.*;
 import org.apache.stratos.cloud.controller.stub.domain.*;
 import org.apache.stratos.common.Properties;
 import org.apache.stratos.common.Property;
+import org.apache.stratos.common.beans.ApplicationBean;
 import org.apache.stratos.common.beans.GroupBean;
 import org.apache.stratos.common.beans.autoscaler.partition.ApplicationLevelNetworkPartition;
 import org.apache.stratos.common.beans.autoscaler.partition.Partition;
@@ -1373,39 +1374,57 @@ public class ObjectConverter {
     }
 
 
-    public static ApplicationBean convertApplicationToApplicationBean(Application application)
{
+    public static ApplicationInfoBean convertApplicationToApplicationBean(Application application)
{
         if (application == null) {
             return null;
         }
 
-        ApplicationBean applicationBean = new ApplicationBean();
+        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.setInstances(convertApplicationInstancesToInstances(application));
+        //applicationBean.set(convertApplicationToApplicationInstanceBean(application));
         return applicationBean;
     }
 
-    private static List<Instance> convertApplicationInstancesToInstances(
+    public static ApplicationInfoBean convertApplicationToApplicationInstanceBean(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.setApplicationInstances(convertApplicationInstancesToApplicationInstances(application));
+        return applicationBean;
+    }
+
+    private static List<ApplicationInstanceBean> convertApplicationInstancesToApplicationInstances(
             Application application) {
-    	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);
+        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);
             }
-    	}
-	    return applicationInstanceList;
+        }
+        return applicationInstanceList;
     }
 
-	public static GroupBean convertGroupToGroupBean(Group group) {
+    public static GroupBean convertGroupToGroupBean(Group group) {
         if (group == null) {
             return null;
         }
@@ -1417,7 +1436,46 @@ public class ObjectConverter {
         return groupBean;
     }
 
-	private static List<Instance> convertGroupInstancesToInstances(Group group) {
+    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) {


Mime
View raw message