You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by re...@apache.org on 2014/01/28 08:55:21 UTC

git commit: fixing STRATOS-383

Updated Branches:
  refs/heads/master 938585b1c -> 3a07eff08


fixing STRATOS-383


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

Branch: refs/heads/master
Commit: 3a07eff0838cd9c1ffc3ad929388eeeedeff1f72
Parents: 938585b
Author: rekathiru <rt...@gmail.com>
Authored: Tue Jan 28 13:25:28 2014 +0530
Committer: rekathiru <rt...@gmail.com>
Committed: Tue Jan 28 13:25:28 2014 +0530

----------------------------------------------------------------------
 .../stratos/cli/RestCommandLineService.java     | 104 ++++++++--
 .../stratos/cli/beans/AutoscalePolicy.java      |  52 -----
 .../org/apache/stratos/cli/beans/Cartridge.java | 201 -------------------
 .../stratos/cli/beans/CartridgeInfoBean.java    | 124 ------------
 .../stratos/cli/beans/DeploymentPolicy.java     |  31 ---
 .../org/apache/stratos/cli/beans/Partition.java |  76 -------
 .../apache/stratos/cli/beans/PropertyBean.java  |  42 ----
 .../beans/autoscaler/partition/Partition.java   |  76 +++++++
 .../autoscaler/partition/PropertyBean.java      |  42 ++++
 .../policy/autoscale/AutoscalePolicy.java       |  63 ++++++
 .../policy/deployment/DeploymentPolicy.java     |  31 +++
 .../stratos/cli/beans/cartridge/Cartridge.java  | 201 +++++++++++++++++++
 .../cli/beans/cartridge/CartridgeInfoBean.java  | 124 ++++++++++++
 .../stratos/cli/beans/topology/Cluster.java     | 170 ++++++++++++++++
 .../stratos/cli/beans/topology/Member.java      | 117 +++++++++++
 .../cli/beans/topology/MemberStatus.java        |   5 +
 .../apache/stratos/cli/beans/topology/Port.java |  43 ++++
 17 files changed, 963 insertions(+), 539 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3a07eff0/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
index 457e040..e064f8e 100644
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/RestCommandLineService.java
@@ -30,11 +30,21 @@ import org.apache.http.HttpResponse;
 import org.apache.http.client.ClientProtocolException;
 import org.apache.http.impl.client.DefaultHttpClient;
 import org.apache.stratos.cli.beans.*;
+import org.apache.stratos.cli.beans.autoscaler.partition.Partition;
+import org.apache.stratos.cli.beans.autoscaler.policy.deployment.DeploymentPolicy;
+import org.apache.stratos.cli.beans.autoscaler.policy.autoscale.AutoscalePolicy;
+import org.apache.stratos.cli.beans.cartridge.Cartridge;
+import org.apache.stratos.cli.beans.cartridge.CartridgeInfoBean;
+import org.apache.stratos.cli.beans.topology.Cluster;
+import org.apache.stratos.cli.beans.topology.Member;
 import org.apache.stratos.cli.exception.CommandException;
 import org.apache.stratos.cli.utils.CliConstants;
+import org.apache.stratos.cli.utils.CommandLineUtils;
+import org.apache.stratos.cli.utils.RowMapper;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import javax.net.ssl.*;
 import java.io.BufferedReader;
 import java.io.IOException;
 import java.io.InputStreamReader;
@@ -43,9 +53,6 @@ import java.net.SocketException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.List;
-import org.apache.stratos.cli.utils.RowMapper;
-import org.apache.stratos.cli.utils.CommandLineUtils;
-import javax.net.ssl.*;
 
 public class RestCommandLineService {
 
@@ -57,6 +64,7 @@ public class RestCommandLineService {
     private final String initializeEndpoint = "/stratos/admin/init";
     private final String listAvailableCartridgesRestEndpoint = "/stratos/admin/cartridge/list";
     private final String listSubscribedCartridgesRestEndpoint = "/stratos/admin/cartridge/list/subscribed";
+    private final String listClusterRestEndpoint = "/cluster/";
     private final String subscribCartridgeRestEndpoint = "/stratos/admin/cartridge/subscribe";
     private final String addTenantEndPoint = "/stratos/admin/tenant";
     private final String unsubscribeTenantEndPoint = "/stratos/admin/cartridge/unsubscribe";
@@ -342,6 +350,80 @@ public class RestCommandLineService {
         }
     }
 
+    public void listMembersOfCluster(String cartridgeType, String alias) throws CommandException {
+        DefaultHttpClient httpClient = new DefaultHttpClient();
+        try {
+            HttpResponse response = restClientService.doGet(httpClient, restClientService.getUrl() + listClusterRestEndpoint
+                    + cartridgeType + "/" + alias ,
+                    restClientService.getUsername(), restClientService.getPassword());
+
+            String responseCode = "" + response.getStatusLine().getStatusCode();
+            if ( ! responseCode.equals(CliConstants.RESPONSE_OK)) {
+                System.out.println("Error occured while listing members of a cluster");
+                return;
+            }
+
+            String resultString = getHttpResponseString(response);
+
+            GsonBuilder gsonBuilder = new GsonBuilder();
+            Gson gson = gsonBuilder.create();
+            Cluster cluster = gson.fromJson(resultString, Cluster.class);
+
+            if (cluster == null) {
+                System.out.println("Subscribe cartridge list is null");
+                return;
+            }
+
+            Member[] members;
+            members = (Member[]) cluster.getMembers().toArray();
+
+            if (members.length == 0) {
+                if (logger.isDebugEnabled()) {
+                    logger.debug("No subscribed cartridges found");
+                }
+                System.out.println("There are no subscribed cartridges");
+                return;
+            }
+
+            RowMapper<Member> memberMapper = new RowMapper<Member>() {
+
+                public String[] getData(Member member) {
+                    String[] data = new String[9];
+                    data[0] = member.getServiceName();
+                    data[1] = member.getClusterId();
+                    data[2] = member.getNetworkPartitionId();
+                    data[3] = member.getPartitionId();
+                    data[4] = member.getMemberId();
+                    data[5] = member.getStatus().toString();
+                    data[6] = member.getPorts().toString();
+                    data[7] = member.getLbClusterId();
+
+                    return data;
+                }
+            };
+
+            List<String> headers = new ArrayList<String>();
+            headers.add("ServiceName");
+            headers.add("ClusterId");
+            headers.add("NewtworkPartitionId");
+            headers.add("PartitionId");
+            headers.add("MemberId");
+            headers.add("Status");
+            headers.add("Ports");
+            headers.add("LBCluster");
+
+            System.out.println("List of members in the [cluster]: " + alias);
+            CommandLineUtils.printTable(members, memberMapper, headers.toArray(new String[headers.size()]));
+
+            System.out.println("List of LB members for the [cluster]: " + "TODO" );
+            System.out.println();
+        } catch (Exception e) {
+            handleException("Exception in listing subscribe cartridges", e);
+        } finally {
+            httpClient.getConnectionManager().shutdown();
+        }
+    }
+
     // This method does the cartridge subscription
     public void subscribe(String cartridgeType, String alias, String externalRepoURL, boolean privateRepo, String username,
                           String password, String dataCartridgeType, String dataCartridgeAlias, String asPolicy, String depPolicy)
@@ -694,7 +776,7 @@ public class RestCommandLineService {
             RowMapper<Partition> partitionMapper = new RowMapper<Partition>() {
 
                 public String[] getData(Partition partition) {
-                    String[] data = new String[3];
+                    String[] data = new String[4];
                     data[0] = partition.getId();
                     data[1] = partition.getProvider();
                     data[2] = "" + partition.getPartitionMax();
@@ -706,7 +788,7 @@ public class RestCommandLineService {
             Partition[] partitions = new Partition[partitionList.getPartition().size()];
             partitions = partitionList.getPartition().toArray(partitions);
 
-            System.out.println("Available Partitions:");
+            System.out.println("Available Partitions:" );
             CommandLineUtils.printTable(partitions, partitionMapper, "ID", "Provider", "PartitionMax", "PartitionMin");
             System.out.println();
 
@@ -739,7 +821,7 @@ public class RestCommandLineService {
                 System.out.println("Response content is empty");
                 return;
             }
-
+            System.out.println(resultString);
             GsonBuilder gsonBuilder = new GsonBuilder();
             Gson gson = gsonBuilder.create();
             AutoscalePolicyList policyList = gson.fromJson(resultString, AutoscalePolicyList.class);
@@ -752,10 +834,8 @@ public class RestCommandLineService {
             RowMapper<AutoscalePolicy> partitionMapper = new RowMapper<AutoscalePolicy>() {
 
                 public String[] getData(AutoscalePolicy policy) {
-                    String[] data = new String[3];
+                    String[] data = new String[1];
                     data[0] = policy.getId();
-                    data[1] = policy.getDisplayName();
-                    data[2] = policy.getDisplayName();
                     return data;
                 }
             };
@@ -764,8 +844,7 @@ public class RestCommandLineService {
             policyArry = policyList.getAutoscalePolicy().toArray(policyArry);
 
             System.out.println("Available Autoscale Policies:");
-            CommandLineUtils.printTable(policyArry, partitionMapper, "ID", "Display name", "Description");
-            System.out.println();
+            CommandLineUtils.printTable(policyArry, partitionMapper, "ID");
 
         } catch (Exception e) {
             handleException("Exception in listing autoscale policies", e);
@@ -804,11 +883,10 @@ public class RestCommandLineService {
                 System.out.println("Deployment policy list is empty");
                 return;
             }
-
             RowMapper<DeploymentPolicy> partitionMapper = new RowMapper<DeploymentPolicy>() {
 
                 public String[] getData(DeploymentPolicy policy) {
-                    String[] data = new String[3];
+                    String[] data = new String[1];
                     data[0] = policy.getId();
                     return data;
                 }

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3a07eff0/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/AutoscalePolicy.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/AutoscalePolicy.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/AutoscalePolicy.java
deleted file mode 100644
index f810198..0000000
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/AutoscalePolicy.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
-
- *  http://www.apache.org/licenses/LICENSE-2.0
-
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.stratos.cli.beans;
-
-public class AutoscalePolicy {
-
-    private String id;
-
-    private String displayName;
-
-    private String description;
-
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    public String getDisplayName() {
-        return displayName;
-    }
-
-    public void setDisplayName(String displayName) {
-        this.displayName = displayName;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3a07eff0/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/Cartridge.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/Cartridge.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/Cartridge.java
deleted file mode 100644
index 49a4651..0000000
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/Cartridge.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one 
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- * 
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
- * KIND, either express or implied.  See the License for the 
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.stratos.cli.beans;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-public class Cartridge implements Comparable<Cartridge> {
-
-    private String displayName;
-    private String description;
-    private String cartridgeAlias;
-    private String cartridgeType;
-    private int activeInstances;
-    private String status;
-    private String ip;
-    private String password;
-    private String provider;
-    private String version;
-    private boolean multiTenant;
-    private String hostName;
-    private String policy;
-    private String policyDescription;
-    private String repoURL;
-    private String dbUserName;
-    private String mappedDomain;
-
-    private String[] accessURLs;
-
-    public String getDisplayName() {
-        return displayName;
-    }
-
-    public void setDisplayName(String displayName) {
-        this.displayName = displayName;
-    }
-
-    public String getDescription() {
-        return description;
-    }
-
-    public void setDescription(String description) {
-        this.description = description;
-    }
-
-    public String getCartridgeAlias() {
-        return cartridgeAlias;
-    }
-
-    public void setCartridgeAlias(String cartridgeAlias) {
-        this.cartridgeAlias = cartridgeAlias;
-    }
-
-    public String getCartridgeType() {
-        return cartridgeType;
-    }
-
-    public void setCartridgeType(String cartridgeType) {
-        this.cartridgeType = cartridgeType;
-    }
-
-    public int getActiveInstances() {
-        return activeInstances;
-    }
-
-    public void setActiveInstances(int activeInstances) {
-        this.activeInstances = activeInstances;
-    }
-
-    public String getStatus() {
-        return status;
-    }
-
-    public void setStatus(String status) {
-        this.status = status;
-    }
-
-    public String getIp() {
-        return ip;
-    }
-
-    public void setIp(String ip) {
-        this.ip = ip;
-    }
-
-    public String getPassword() {
-        return password;
-    }
-
-    public void setPassword(String password) {
-        this.password = password;
-    }
-
-    public String getProvider() {
-        return provider;
-    }
-
-    public void setProvider(String provider) {
-        this.provider = provider;
-    }
-
-    public String getVersion() {
-        return version;
-    }
-
-    public void setVersion(String version) {
-        this.version = version;
-    }
-
-    public boolean isMultiTenant() {
-        return multiTenant;
-    }
-
-    public void setMultiTenant(boolean multiTenant) {
-        this.multiTenant = multiTenant;
-    }
-
-    public String getHostName() {
-        return hostName;
-    }
-
-    public void setHostName(String hostName) {
-        this.hostName = hostName;
-    }
-
-    public String getPolicy() {
-        return policy;
-    }
-
-    public void setPolicy(String policy) {
-        this.policy = policy;
-    }
-
-    public String getPolicyDescription() {
-        return policyDescription;
-    }
-
-    public void setPolicyDescription(String policyDescription) {
-        this.policyDescription = policyDescription;
-    }
-
-    public String getRepoURL() {
-        return repoURL;
-    }
-
-    public void setRepoURL(String repoURL) {
-        this.repoURL = repoURL;
-    }
-
-    public String getDbUserName() {
-        return dbUserName;
-    }
-
-    public String[] getAccessURLs() {
-        return accessURLs;
-    }
-
-    public void setAccessURLs(String[] accessURLs) {
-        this.accessURLs = accessURLs;
-    }
-
-    public void setDbUserName(String dbUserName) {
-        this.dbUserName = dbUserName;
-    }
-
-    public String getMappedDomain() {
-        return mappedDomain;
-    }
-
-    public void setMappedDomain(String mappedDomain) {
-        this.mappedDomain = mappedDomain;
-    }
-
-    public int compareTo(Cartridge o) {
-        int compare = 0;
-        if (cartridgeAlias != null && o.cartridgeAlias != null) {
-            compare = cartridgeAlias.compareTo(o.cartridgeAlias);
-        }
-        if (compare == 0 && cartridgeType != null && o.cartridgeType != null) {
-            compare = cartridgeType.compareTo(o.cartridgeType);
-        }
-        return compare;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3a07eff0/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/CartridgeInfoBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/CartridgeInfoBean.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/CartridgeInfoBean.java
deleted file mode 100644
index 256902f..0000000
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/CartridgeInfoBean.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*
-*  Copyright (c) 2005-2012, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
-*
-*  WSO2 Inc. licenses this file to you under the Apache License,
-*  Version 2.0 (the "License"); you may not use this file except
-*  in compliance with the License.
-*  You may obtain a copy of the License at
-*
-*    http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied.  See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-package org.apache.stratos.cli.beans;
-
-import javax.xml.bind.annotation.XmlRootElement;
-
-@XmlRootElement
-public class CartridgeInfoBean {
-    String cartridgeType;
-    String alias;
-    String policy;
-    String repoURL;
-    boolean privateRepo;
-    String repoUsername;
-    String repoPassword;
-    String dataCartridgeType;
-    String dataCartridgeAlias;
-    private String autoscalePolicy;
-    private String deploymentPolicy;
-
-
-    public String getCartridgeType() {
-        return cartridgeType;
-    }
-
-    public void setCartridgeType(String cartridgeType) {
-        this.cartridgeType = cartridgeType;
-    }
-
-    public String getAlias() {
-        return alias;
-    }
-
-    public void setAlias(String alias) {
-        this.alias = alias;
-    }
-
-    public String getPolicy() {
-        return policy;
-    }
-
-    public void setPolicy(String policy) {
-        this.policy = policy;
-    }
-
-    public String getRepoURL() {
-        return repoURL;
-    }
-
-    public void setRepoURL(String repoURL) {
-        this.repoURL = repoURL;
-    }
-
-    public boolean isPrivateRepo() {
-        return privateRepo;
-    }
-
-    public void setPrivateRepo(boolean privateRepo) {
-        this.privateRepo = privateRepo;
-    }
-
-    public String getRepoUsername() {
-        return repoUsername;
-    }
-
-    public void setRepoUsername(String repoUsername) {
-        this.repoUsername = repoUsername;
-    }
-
-    public String getRepoPassword() {
-        return repoPassword;
-    }
-
-    public void setRepoPassword(String repoPassword) {
-        this.repoPassword = repoPassword;
-    }
-
-    public String getDataCartridgeType() {
-        return dataCartridgeType;
-    }
-
-    public void setDataCartridgeType(String dataCartridgeType) {
-        this.dataCartridgeType = dataCartridgeType;
-    }
-
-    public String getDataCartridgeAlias() {
-        return dataCartridgeAlias;
-    }
-
-    public void setDataCartridgeAlias(String dataCartridgeAlias) {
-        this.dataCartridgeAlias = dataCartridgeAlias;
-    }
-
-    public String getAutoscalePolicy() {
-        return autoscalePolicy;
-    }
-
-    public void setAutoscalePolicy(String autoscalePolicy) {
-        this.autoscalePolicy = autoscalePolicy;
-    }
-
-    public String getDeploymentPolicy() {
-        return deploymentPolicy;
-    }
-
-    public void setDeploymentPolicy(String deploymentPolicy) {
-        this.deploymentPolicy = deploymentPolicy;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3a07eff0/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/DeploymentPolicy.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/DeploymentPolicy.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/DeploymentPolicy.java
deleted file mode 100644
index 19974ac..0000000
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/DeploymentPolicy.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/**
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
-
- *  http://www.apache.org/licenses/LICENSE-2.0
-
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- */
-package org.apache.stratos.cli.beans;
-
-public class DeploymentPolicy {
-    private String id;
-
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3a07eff0/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/Partition.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/Partition.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/Partition.java
deleted file mode 100644
index 1af9496..0000000
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/Partition.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.cli.beans;
-
-import java.util.List;
-
-public class Partition {
-
-    private String id;
-
-    private int partitionMin;
-
-    private int partitionMax;
-
-    private String provider;
-
-    private List<PropertyBean> property;
-
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    public int getPartitionMin() {
-        return partitionMin;
-    }
-
-    public void setPartitionMin(int partitionMin) {
-        this.partitionMin = partitionMin;
-    }
-
-    public int getPartitionMax() {
-        return partitionMax;
-    }
-
-    public void setPartitionMax(int partitionMax) {
-        this.partitionMax = partitionMax;
-    }
-
-    public String getProvider() {
-        return provider;
-    }
-
-    public void setProvider(String provider) {
-        this.provider = provider;
-    }
-
-    public List<PropertyBean> getProperty() {
-        return property;
-    }
-
-    public void setProperty(List<PropertyBean> property) {
-        this.property = property;
-    }
-}
-
-

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3a07eff0/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/PropertyBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/PropertyBean.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/PropertyBean.java
deleted file mode 100644
index 0efe7f5..0000000
--- a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/PropertyBean.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *  http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.stratos.cli.beans;
-
-public class PropertyBean {
-
-    private String name;
-
-    private String value;
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getValue() {
-        return value;
-    }
-
-    public void setValue(String value) {
-        this.value = value;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3a07eff0/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/autoscaler/partition/Partition.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/autoscaler/partition/Partition.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/autoscaler/partition/Partition.java
new file mode 100644
index 0000000..aeda738
--- /dev/null
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/autoscaler/partition/Partition.java
@@ -0,0 +1,76 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.stratos.cli.beans.autoscaler.partition;
+
+import java.util.List;
+
+public class Partition {
+
+    private String id;
+
+    private int partitionMin;
+
+    private int partitionMax;
+
+    private String provider;
+
+    private List<PropertyBean> property;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public int getPartitionMin() {
+        return partitionMin;
+    }
+
+    public void setPartitionMin(int partitionMin) {
+        this.partitionMin = partitionMin;
+    }
+
+    public int getPartitionMax() {
+        return partitionMax;
+    }
+
+    public void setPartitionMax(int partitionMax) {
+        this.partitionMax = partitionMax;
+    }
+
+    public String getProvider() {
+        return provider;
+    }
+
+    public void setProvider(String provider) {
+        this.provider = provider;
+    }
+
+    public List<PropertyBean> getProperty() {
+        return property;
+    }
+
+    public void setProperty(List<PropertyBean> property) {
+        this.property = property;
+    }
+}
+
+

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3a07eff0/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/autoscaler/partition/PropertyBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/autoscaler/partition/PropertyBean.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/autoscaler/partition/PropertyBean.java
new file mode 100644
index 0000000..6905a2c
--- /dev/null
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/autoscaler/partition/PropertyBean.java
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.stratos.cli.beans.autoscaler.partition;
+
+public class PropertyBean {
+
+    private String name;
+
+    private String value;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public String getValue() {
+        return value;
+    }
+
+    public void setValue(String value) {
+        this.value = value;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3a07eff0/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/autoscaler/policy/autoscale/AutoscalePolicy.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/autoscaler/policy/autoscale/AutoscalePolicy.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/autoscaler/policy/autoscale/AutoscalePolicy.java
new file mode 100644
index 0000000..3f0bc9a
--- /dev/null
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/autoscaler/policy/autoscale/AutoscalePolicy.java
@@ -0,0 +1,63 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+
+ *  http://www.apache.org/licenses/LICENSE-2.0
+
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.stratos.cli.beans.autoscaler.policy.autoscale;
+
+public class AutoscalePolicy {
+
+    private String id;
+
+    private String displayName;
+
+    private String description;
+
+    private LoadThresholds loadThresholds;
+
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+
+    public String getDisplayName() {
+        return displayName;
+    }
+
+    public void setDisplayName(String displayName) {
+        this.displayName = displayName;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public LoadThresholds getLoadThresholds() {
+        return loadThresholds;
+    }
+
+    public void setLoadThresholds(LoadThresholds loadThresholds) {
+        this.loadThresholds = loadThresholds;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3a07eff0/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/autoscaler/policy/deployment/DeploymentPolicy.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/autoscaler/policy/deployment/DeploymentPolicy.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/autoscaler/policy/deployment/DeploymentPolicy.java
new file mode 100644
index 0000000..42611e7
--- /dev/null
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/autoscaler/policy/deployment/DeploymentPolicy.java
@@ -0,0 +1,31 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one
+ *  or more contributor license agreements.  See the NOTICE file
+ *  distributed with this work for additional information
+ *  regarding copyright ownership.  The ASF licenses this file
+ *  to you under the Apache License, Version 2.0 (the
+ *  "License"); you may not use this file except in compliance
+ *  with the License.  You may obtain a copy of the License at
+
+ *  http://www.apache.org/licenses/LICENSE-2.0
+
+ *  Unless required by applicable law or agreed to in writing,
+ *  software distributed under the License is distributed on an
+ *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ *  specific language governing permissions and limitations
+ *  under the License.
+ */
+package org.apache.stratos.cli.beans.autoscaler.policy.deployment;
+
+public class DeploymentPolicy {
+    private String id;
+
+    public String getId() {
+        return id;
+    }
+
+    public void setId(String id) {
+        this.id = id;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3a07eff0/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/cartridge/Cartridge.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/cartridge/Cartridge.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/cartridge/Cartridge.java
new file mode 100644
index 0000000..8bcc45e
--- /dev/null
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/cartridge/Cartridge.java
@@ -0,0 +1,201 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one 
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *  http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
+ * KIND, either express or implied.  See the License for the 
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.stratos.cli.beans.cartridge;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class Cartridge implements Comparable<Cartridge> {
+
+    private String displayName;
+    private String description;
+    private String cartridgeAlias;
+    private String cartridgeType;
+    private int activeInstances;
+    private String status;
+    private String ip;
+    private String password;
+    private String provider;
+    private String version;
+    private boolean multiTenant;
+    private String hostName;
+    private String policy;
+    private String policyDescription;
+    private String repoURL;
+    private String dbUserName;
+    private String mappedDomain;
+
+    private String[] accessURLs;
+
+    public String getDisplayName() {
+        return displayName;
+    }
+
+    public void setDisplayName(String displayName) {
+        this.displayName = displayName;
+    }
+
+    public String getDescription() {
+        return description;
+    }
+
+    public void setDescription(String description) {
+        this.description = description;
+    }
+
+    public String getCartridgeAlias() {
+        return cartridgeAlias;
+    }
+
+    public void setCartridgeAlias(String cartridgeAlias) {
+        this.cartridgeAlias = cartridgeAlias;
+    }
+
+    public String getCartridgeType() {
+        return cartridgeType;
+    }
+
+    public void setCartridgeType(String cartridgeType) {
+        this.cartridgeType = cartridgeType;
+    }
+
+    public int getActiveInstances() {
+        return activeInstances;
+    }
+
+    public void setActiveInstances(int activeInstances) {
+        this.activeInstances = activeInstances;
+    }
+
+    public String getStatus() {
+        return status;
+    }
+
+    public void setStatus(String status) {
+        this.status = status;
+    }
+
+    public String getIp() {
+        return ip;
+    }
+
+    public void setIp(String ip) {
+        this.ip = ip;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+
+    public String getProvider() {
+        return provider;
+    }
+
+    public void setProvider(String provider) {
+        this.provider = provider;
+    }
+
+    public String getVersion() {
+        return version;
+    }
+
+    public void setVersion(String version) {
+        this.version = version;
+    }
+
+    public boolean isMultiTenant() {
+        return multiTenant;
+    }
+
+    public void setMultiTenant(boolean multiTenant) {
+        this.multiTenant = multiTenant;
+    }
+
+    public String getHostName() {
+        return hostName;
+    }
+
+    public void setHostName(String hostName) {
+        this.hostName = hostName;
+    }
+
+    public String getPolicy() {
+        return policy;
+    }
+
+    public void setPolicy(String policy) {
+        this.policy = policy;
+    }
+
+    public String getPolicyDescription() {
+        return policyDescription;
+    }
+
+    public void setPolicyDescription(String policyDescription) {
+        this.policyDescription = policyDescription;
+    }
+
+    public String getRepoURL() {
+        return repoURL;
+    }
+
+    public void setRepoURL(String repoURL) {
+        this.repoURL = repoURL;
+    }
+
+    public String getDbUserName() {
+        return dbUserName;
+    }
+
+    public String[] getAccessURLs() {
+        return accessURLs;
+    }
+
+    public void setAccessURLs(String[] accessURLs) {
+        this.accessURLs = accessURLs;
+    }
+
+    public void setDbUserName(String dbUserName) {
+        this.dbUserName = dbUserName;
+    }
+
+    public String getMappedDomain() {
+        return mappedDomain;
+    }
+
+    public void setMappedDomain(String mappedDomain) {
+        this.mappedDomain = mappedDomain;
+    }
+
+    public int compareTo(Cartridge o) {
+        int compare = 0;
+        if (cartridgeAlias != null && o.cartridgeAlias != null) {
+            compare = cartridgeAlias.compareTo(o.cartridgeAlias);
+        }
+        if (compare == 0 && cartridgeType != null && o.cartridgeType != null) {
+            compare = cartridgeType.compareTo(o.cartridgeType);
+        }
+        return compare;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3a07eff0/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/cartridge/CartridgeInfoBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/cartridge/CartridgeInfoBean.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/cartridge/CartridgeInfoBean.java
new file mode 100644
index 0000000..6f979a8
--- /dev/null
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/cartridge/CartridgeInfoBean.java
@@ -0,0 +1,124 @@
+/*
+*  Copyright (c) 2005-2012, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
+*
+*  WSO2 Inc. licenses this file to you under the Apache License,
+*  Version 2.0 (the "License"); you may not use this file except
+*  in compliance with the License.
+*  You may obtain a copy of the License at
+*
+*    http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied.  See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+package org.apache.stratos.cli.beans.cartridge;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+@XmlRootElement
+public class CartridgeInfoBean {
+    String cartridgeType;
+    String alias;
+    String policy;
+    String repoURL;
+    boolean privateRepo;
+    String repoUsername;
+    String repoPassword;
+    String dataCartridgeType;
+    String dataCartridgeAlias;
+    private String autoscalePolicy;
+    private String deploymentPolicy;
+
+
+    public String getCartridgeType() {
+        return cartridgeType;
+    }
+
+    public void setCartridgeType(String cartridgeType) {
+        this.cartridgeType = cartridgeType;
+    }
+
+    public String getAlias() {
+        return alias;
+    }
+
+    public void setAlias(String alias) {
+        this.alias = alias;
+    }
+
+    public String getPolicy() {
+        return policy;
+    }
+
+    public void setPolicy(String policy) {
+        this.policy = policy;
+    }
+
+    public String getRepoURL() {
+        return repoURL;
+    }
+
+    public void setRepoURL(String repoURL) {
+        this.repoURL = repoURL;
+    }
+
+    public boolean isPrivateRepo() {
+        return privateRepo;
+    }
+
+    public void setPrivateRepo(boolean privateRepo) {
+        this.privateRepo = privateRepo;
+    }
+
+    public String getRepoUsername() {
+        return repoUsername;
+    }
+
+    public void setRepoUsername(String repoUsername) {
+        this.repoUsername = repoUsername;
+    }
+
+    public String getRepoPassword() {
+        return repoPassword;
+    }
+
+    public void setRepoPassword(String repoPassword) {
+        this.repoPassword = repoPassword;
+    }
+
+    public String getDataCartridgeType() {
+        return dataCartridgeType;
+    }
+
+    public void setDataCartridgeType(String dataCartridgeType) {
+        this.dataCartridgeType = dataCartridgeType;
+    }
+
+    public String getDataCartridgeAlias() {
+        return dataCartridgeAlias;
+    }
+
+    public void setDataCartridgeAlias(String dataCartridgeAlias) {
+        this.dataCartridgeAlias = dataCartridgeAlias;
+    }
+
+    public String getAutoscalePolicy() {
+        return autoscalePolicy;
+    }
+
+    public void setAutoscalePolicy(String autoscalePolicy) {
+        this.autoscalePolicy = autoscalePolicy;
+    }
+
+    public String getDeploymentPolicy() {
+        return deploymentPolicy;
+    }
+
+    public void setDeploymentPolicy(String deploymentPolicy) {
+        this.deploymentPolicy = deploymentPolicy;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3a07eff0/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/topology/Cluster.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/topology/Cluster.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/topology/Cluster.java
new file mode 100644
index 0000000..79d330d
--- /dev/null
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/topology/Cluster.java
@@ -0,0 +1,170 @@
+package org.apache.stratos.cli.beans.topology;
+
+import org.apache.commons.lang3.StringUtils;
+
+import java.util.*;
+
+public class Cluster {
+    private static final long serialVersionUID = -361960242360176077L;
+
+	private final String serviceName;
+    private final String clusterId;
+    private final String autoscalePolicyName;
+    private final String deploymentPolicyName;
+
+    private List<String> hostNames;
+    private String tenantRange;
+    private boolean isLbCluster;
+    // Key: Member.memberId
+    private Map<String, Member> memberMap;
+
+    private String loadBalanceAlgorithmName;
+    private Properties properties;
+
+    public Cluster(String serviceName, String clusterId, String deploymentPolicyName, String autoscalePolicyName) {
+        this.serviceName = serviceName;
+        this.clusterId = clusterId;
+        this.deploymentPolicyName = deploymentPolicyName;
+        this.autoscalePolicyName = autoscalePolicyName;
+        this.hostNames = new ArrayList<String>();
+        this.memberMap = new HashMap<String, Member>();
+    }
+
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    public String getClusterId() {
+        return clusterId;
+    }
+
+    public List<String> getHostNames() {
+        return hostNames;
+    }
+
+    public void addHostName(String hostName) {
+        this.hostNames.add(hostName);
+    }
+
+    public String getTenantRange() {
+        return tenantRange;
+    }
+
+    public void setTenantRange(String tenantRange) {
+        this.tenantRange = tenantRange;
+    }
+
+    public Collection<Member> getMembers() {
+        return memberMap.values();
+    }
+
+    public boolean hasMembers() {
+        return  memberMap.isEmpty();
+    }
+
+
+
+    public void addMember(Member member) {
+        memberMap.put(member.getMemberId(), member);
+    }
+
+    public void removeMember(Member member) {
+        memberMap.remove(member.getMemberId());
+    }
+
+    public Member getMember(String memberId) {
+        return memberMap.get(memberId);
+    }
+
+    public boolean memberExists(String memberId) {
+        return this.memberMap.containsKey(memberId);
+    }
+
+    public Properties getProperties() {
+        return properties;
+    }
+
+    public void setProperties(Properties properties) {
+        this.properties = properties;
+    }
+
+    public String getAutoscalePolicyName() {
+        return autoscalePolicyName;
+    }
+
+	public String getDeploymentPolicyName() {
+		return deploymentPolicyName;
+	}
+
+    public String getLoadBalanceAlgorithmName() {
+        return loadBalanceAlgorithmName;
+    }
+
+    public void setLoadBalanceAlgorithmName(String loadBalanceAlgorithmName) {
+        this.loadBalanceAlgorithmName = loadBalanceAlgorithmName;
+    }
+
+    public boolean isLbCluster() {
+        return isLbCluster;
+    }
+
+    public void setLbCluster(boolean isLbCluster) {
+        this.isLbCluster = isLbCluster;
+    }
+
+    @Override
+    public String toString() {
+        return "Cluster [serviceName=" + serviceName + ", clusterId=" + clusterId +
+                ", autoscalePolicyName=" + autoscalePolicyName + ", deploymentPolicyName=" +
+                deploymentPolicyName + ", hostNames=" + hostNames + ", tenantRange=" + tenantRange +
+                ", isLbCluster=" + isLbCluster + ", properties=" + properties + "]";
+    }
+
+    /**
+     * Check whether a given tenant id is in tenant range of the cluster.
+     *
+     * @param tenantId
+     * @return
+     */
+    public boolean tenantIdInRange(int tenantId) {
+        if(StringUtils.isBlank(getTenantRange())) {
+            return false;
+        }
+
+        if("*".equals(getTenantRange())) {
+            return true;
+        }
+        else {
+            String[] array = getTenantRange().split("-");
+            int tenantStart = Integer.parseInt(array[0]);
+            if(tenantStart <= tenantId) {
+                String tenantEndStr = array[1];
+                if("*".equals(tenantEndStr)) {
+                    return true;
+                }
+                else {
+                    int tenantEnd = Integer.parseInt(tenantEndStr);
+                    if(tenantId <= tenantEnd) {
+                        return true;
+                    }
+                }
+            }
+        }
+        return false;
+    }
+
+    /**
+     * Find partitions used by the cluster and return their ids as a collection.
+     *
+     * @return
+     */
+    public Collection<String> findPartitionIds() {
+        Map<String, Boolean> partitionIds = new HashMap<String, Boolean>();
+        for(Member member : getMembers()) {
+            if((StringUtils.isNotBlank(member.getPartitionId())) && (!partitionIds.containsKey(member.getPartitionId()))) {
+                partitionIds.put(member.getPartitionId(), true);
+            }
+        }
+        return partitionIds.keySet();
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3a07eff0/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/topology/Member.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/topology/Member.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/topology/Member.java
new file mode 100644
index 0000000..ce941cf
--- /dev/null
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/topology/Member.java
@@ -0,0 +1,117 @@
+package org.apache.stratos.cli.beans.topology;
+
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Properties;
+
+public class Member {
+    private static final long serialVersionUID = 4179661867903664661L;
+
+    private final String serviceName;
+    private final String clusterId;
+    private final String networkPartitionId;
+    private final String partitionId;
+    private final String memberId;
+
+    private MemberStatus status;
+    private String memberIp;
+    private final Map<String, Port> portMap;
+    private Properties properties;
+    private String lbClusterId;
+
+    public Member(String serviceName, String clusterId, String networkPartitionId, String partitionId, String memberId) {
+        this.serviceName = serviceName;
+        this.clusterId = clusterId;
+        this.networkPartitionId = networkPartitionId;
+        this.partitionId = partitionId;
+        this.memberId = memberId;
+        this.portMap = new HashMap<String, Port>();
+    }
+
+    public String getServiceName() {
+        return serviceName;
+    }
+
+    public String getClusterId() {
+        return clusterId;
+    }
+
+    public String getMemberId() {
+        return memberId;
+    }
+
+    public MemberStatus getStatus() {
+        return status;
+    }
+
+    public void setStatus(MemberStatus status) {
+        this.status = status;
+    }
+
+    public boolean isActive() {
+        return (this.status == MemberStatus.Activated);
+    }
+
+    public Collection<Port> getPorts() {
+        return portMap.values();
+    }
+
+    public void addPort(Port port) {
+        this.portMap.put(port.getProtocol(), port);
+    }
+
+    public void addPorts(Collection<Port> ports) {
+        for(Port port: ports) {
+            addPort(port);
+        }
+    }
+
+    public void removePort(Port port) {
+        this.portMap.remove(port.getProtocol());
+    }
+
+    public void removePort(String protocol) {
+        this.portMap.remove(protocol);
+    }
+
+    public boolean portExists(Port port) {
+        return this.portMap.containsKey(port.getProtocol());
+    }
+
+    public Port getPort(String protocol) {
+        return this.portMap.get(protocol);
+    }
+
+    public Properties getProperties() {
+        return properties;
+    }
+
+    public void setProperties(Properties properties) {
+        this.properties = properties;
+    }
+
+	public String getMemberIp() {
+	    return memberIp;
+    }
+
+	public void setMemberIp(String memberIp) {
+	    this.memberIp = memberIp;
+    }
+
+    public String getPartitionId() {
+        return partitionId;
+    }
+
+    public void setLbClusterId(String lbClusterId) {
+        this.lbClusterId = lbClusterId;
+    }
+
+    public String getLbClusterId() {
+        return lbClusterId;
+    }
+
+    public String getNetworkPartitionId() {
+        return networkPartitionId;
+    }
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3a07eff0/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/topology/MemberStatus.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/topology/MemberStatus.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/topology/MemberStatus.java
new file mode 100644
index 0000000..6e50160
--- /dev/null
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/topology/MemberStatus.java
@@ -0,0 +1,5 @@
+package org.apache.stratos.cli.beans.topology;
+
+public enum MemberStatus {
+     Created, Starting, Activated, Suspended, ReadyToShutDown, ShuttingDown, Terminated
+}

http://git-wip-us.apache.org/repos/asf/incubator-stratos/blob/3a07eff0/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/topology/Port.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/topology/Port.java b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/topology/Port.java
new file mode 100644
index 0000000..b79700c
--- /dev/null
+++ b/components/org.apache.stratos.cli/src/main/java/org/apache/stratos/cli/beans/topology/Port.java
@@ -0,0 +1,43 @@
+package org.apache.stratos.cli.beans.topology;
+
+public class Port {
+    private static final long serialVersionUID = -2530288421360188256L;
+    private String protocol;
+    private int value;
+    private int proxy;
+
+    public Port(String protocol, int value, int proxy) {
+        setProtocol(protocol);
+        setValue(value);
+        setProxy(proxy);
+    }
+
+    public String getProtocol() {
+        return protocol;
+    }
+
+    public void setProtocol(String protocol) {
+        this.protocol = protocol;
+    }
+
+    public int getValue() {
+        return value;
+    }
+
+    public void setValue(int value) {
+        this.value = value;
+    }
+
+    public int getProxy() {
+        return proxy;
+    }
+
+    public void setProxy(int proxy) {
+        this.proxy = proxy;
+    }
+
+    @Override
+    public String toString() {
+        return "Port [protocol=" + protocol + ", value=" + value + ", proxy=" + proxy + "]";
+    }
+}