stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From isu...@apache.org
Subject git commit: adding some comments
Date Mon, 06 Oct 2014 05:56:09 GMT
Repository: stratos
Updated Branches:
  refs/heads/4.0.0-grouping b52735ee7 -> 67b00b93d


adding some comments


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

Branch: refs/heads/4.0.0-grouping
Commit: 67b00b93dfe830958d1021b3e707a77298ed6686
Parents: b52735e
Author: Isuru Haththotuwa <isuruh@apache.org>
Authored: Mon Oct 6 11:25:47 2014 +0530
Committer: Isuru Haththotuwa <isuruh@apache.org>
Committed: Mon Oct 6 11:25:47 2014 +0530

----------------------------------------------------------------------
 .../impl/CloudControllerServiceImpl.java        | 31 +-------
 .../messaging/domain/topology/Application.java  | 28 +++-----
 .../domain/topology/ClusterDataHolder.java      |  7 ++
 .../messaging/domain/topology/Group.java        | 12 ++--
 .../domain/topology/ParentBehavior.java         | 76 ++++++++++++++++++--
 5 files changed, 95 insertions(+), 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/67b00b93/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java
index 0901944..e99a722 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/impl/CloudControllerServiceImpl.java
@@ -1440,42 +1440,13 @@ public class CloudControllerServiceImpl implements CloudControllerService
{
         ApplicationParser applicationParser = new DefaultApplicationParser();
         Application application = applicationParser.parse(applicationContext);
 
+        // Create a Cluster Context obj. for each of the Clusters in the Application
         for (ApplicationClusterContext applicationClusterContext : applicationParser.getApplicationClusterContexts())
{
             dataHolder.addClusterContext(new ClusterContext(applicationClusterContext.getClusterId(),
                     applicationClusterContext.getCartridgeType(), applicationClusterContext.getTextPayload(),
                     applicationClusterContext.getHostName(), applicationClusterContext.isLbCluster()));
         }
 
-        //TODO: improve
-//        Set<MetaDataHolder> medaDataHolders = applicationParser.getPayloadData();
-//        if (medaDataHolders != null) {
-//
-//            MetaDataServiceClient metaDataServiceClient;
-//            try {
-//
-//                metaDataServiceClient = new DefaultMetaDataServiceClient(MetaDataClientConfig.getInstance().getMetaDataServiceBaseUrl());
-//                metaDataServiceClient.initialize();
-//
-//            } catch (RestClientException e) {
-//                log.error("Error creating instance of Metadata Service Client", e);
-//                throw new ApplicationDefinitionException(e);
-//            }
-//
-//            for (MetaDataHolder metaDataHolder : medaDataHolders) {
-//                for (Map.Entry<Object, Object> metaDataEntry : metaDataHolder.getProperties().entrySet())
{
-//                    try {
-//                        metaDataServiceClient.addPropertyToCluster(metaDataHolder.getAppId(),
metaDataHolder.getClusterId(),
-//                                (String)metaDataEntry.getKey(), (String)metaDataEntry.getValue());
-//
-//                    } catch (MetaDataServiceClientExeption e) {
-//                        log.error("Error publishing data to Metadata Service", e);
-//                        throw new ApplicationDefinitionException(e);
-//                    }
-//                }
-//            }
-//        }
-
-
         TopologyBuilder.handleApplicationDeployed(application, applicationParser.getApplicationClusterContexts(),
                 applicationParser.getPayloadData());
 

http://git-wip-us.apache.org/repos/asf/stratos/blob/67b00b93/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Application.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Application.java
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Application.java
index a2e5732..dd7d6ea 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Application.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Application.java
@@ -23,6 +23,10 @@ import org.apache.commons.lang3.RandomStringUtils;
 
 import java.util.*;
 
+/**
+ * Represents an Application in the Topology
+ */
+
 public class Application implements ParentBehavior {
 
     private static final long serialVersionUID = -5092959597171649688L;
@@ -59,13 +63,13 @@ public class Application implements ParentBehavior {
     }
 
     @Override
-    public void setGroups(Map<String, Group> aliasToGroup) {
-        aliasToGroupMap.putAll(aliasToGroup);
+    public void setGroups(Map<String, Group> groupAliasToGroup) {
+        aliasToGroupMap.putAll(groupAliasToGroup);
     }
 
     @Override
-    public Group getGroup(String groupName) {
-        return aliasToGroupMap.get(groupName);
+    public Group getGroup(String groupAlias) {
+        return aliasToGroupMap.get(groupAlias);
     }
 
     @Override
@@ -155,22 +159,6 @@ public class Application implements ParentBehavior {
         return aliasToClusterDataMap.get(alias);
     }
 
-//    @Override
-//    public void addClusterId(String serviceName, String clusterId) {
-//
-//        synchronized (serviceNameToClusterIdsMap) {
-//            if (serviceNameToClusterIdsMap.get(serviceName) == null) {
-//                // not found, create
-//                Set<String> clusterIds = new HashSet<String>();
-//                clusterIds.add(clusterId);
-//                serviceNameToClusterIdsMap.put(serviceName, clusterIds);
-//            } else {
-//                // the cluster id set already exists, update
-//                serviceNameToClusterIdsMap.get(serviceName).add(clusterId);
-//            }
-//        }
-//    }
-
     public String getId() {
         return id;
     }

http://git-wip-us.apache.org/repos/asf/stratos/blob/67b00b93/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/ClusterDataHolder.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/ClusterDataHolder.java
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/ClusterDataHolder.java
index cceb4fc..70eab4c 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/ClusterDataHolder.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/ClusterDataHolder.java
@@ -21,10 +21,17 @@ package org.apache.stratos.messaging.domain.topology;
 
 import java.io.Serializable;
 
+/**
+ * Data Holder for a Cluster.
+ * Will hold the Service Type and Cluster Id.
+ */
+
 public class ClusterDataHolder implements Serializable {
 
+    // Service/Cartridge type
     private String serviceType;
 
+    // Cluster id
     private String clusterId;
 
     public ClusterDataHolder (String serviceType, String clusterId) {

http://git-wip-us.apache.org/repos/asf/stratos/blob/67b00b93/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Group.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Group.java
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Group.java
index c47667f..cd849b6 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Group.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/Group.java
@@ -21,6 +21,10 @@ package org.apache.stratos.messaging.domain.topology;
 
 import java.util.*;
 
+/**
+ * Represents a Group/nested Group in an Application/Group
+ */
+
 public class Group implements ParentBehavior {
 
     private static final long serialVersionUID = 8347096598203655846L;
@@ -55,13 +59,13 @@ public class Group implements ParentBehavior {
     }
 
     @Override
-    public void setGroups(Map<String, Group> groupNameToGroup) {
-        aliasToGroupMap.putAll(groupNameToGroup);
+    public void setGroups(Map<String, Group> groupAliasToGroup) {
+        aliasToGroupMap.putAll(groupAliasToGroup);
     }
 
     @Override
-    public Group getGroup(String groupName) {
-        return aliasToGroupMap.get(groupName);
+    public Group getGroup(String groupAlias) {
+        return aliasToGroupMap.get(groupAlias);
     }
 
     @Override

http://git-wip-us.apache.org/repos/asf/stratos/blob/67b00b93/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/ParentBehavior.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/ParentBehavior.java
b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/ParentBehavior.java
index d6c7035..5fbdf0c 100644
--- a/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/ParentBehavior.java
+++ b/components/org.apache.stratos.messaging/src/main/java/org/apache/stratos/messaging/domain/topology/ParentBehavior.java
@@ -22,29 +22,95 @@ package org.apache.stratos.messaging.domain.topology;
 import java.io.Serializable;
 import java.util.Collection;
 import java.util.Map;
-import java.util.Set;
+
+/**
+ * Abstraction for a an entity that can have child entities
+ * in an Application withing the Topology
+ */
 
 public interface ParentBehavior extends Serializable {
 
+    /**
+     * Adds a group
+     *
+     * @param group Group instance to be added
+     */
     public void addGroup (Group group);
 
-    public void setGroups (Map<String, Group> groupNameToGroup);
+    /**
+     * Setter for Group alias to Group map
+     *
+     * @param groupAliasToGroup Map, key = alias given to the Group, value = Group
+     */
+    public void setGroups (Map<String, Group> groupAliasToGroup);
+
+    /**
+     * Get the Group for the given alias in the context of the parent entity.
+     * Will not search recursively in the nested levels.
+     *
+     * @param groupAlias alias of the Group
+     * @return Group, if exists for the given alias, else null
+     */
+    public Group getGroup (String groupAlias);
 
-    public Group getGroup (String groupName);
+    /**
+     * Get the Group for the given alias in the context of the parent entity.
+     * Will search recursively in the nested levels.
+     *
+     * @param groupAlias alias of the Group
+     * @return Group, if exists for the given alias, else null
+     */
+    public Group getGroupRecursively (String groupAlias);
 
+    /**
+     * Getter for alias to Group map
+     * Will not search recursively in the nested levels.
+     *
+     * @return Map, key = alias given to the Group, value = Group
+     */
     public Map<String, Group> getAliasToGroupMap();
 
+    /**
+     * Getter for cluster alias to ClusterData map for this level
+     *
+     * @return Map, key = alias given to the cluster, value =  ClusterData object
+     */
     public Map<String, ClusterDataHolder> getClusterDataMap();
 
-    public Group getGroupRecursively (String groupAlias);
-
+    /**
+     * Collection of Groups in this level
+     *
+     * @return Group Collection object, empty if no Groups are found
+     */
     public Collection<Group> getGroups ();
 
+    /**
+     * Setter for Dependency Order
+     *
+     * @param dependencyOrder Dependency Order object
+     */
     public void setDependencyOrder (DependencyOrder dependencyOrder);
 
+    /**
+     * Getter for Dependency Order for this level
+     *
+     * @return Dependency Order object
+     */
     public DependencyOrder getDependencyOrder ();
 
+    /**
+     * Setter for alias to Cluster Data map
+     *
+     * @param aliasToClusterData Map, key = alias given to the cluster, value =  ClusterData
object
+     */
     public void setClusterData (Map<String, ClusterDataHolder> aliasToClusterData);
 
+    /**
+     * Getter for Cluster Data instance for the given alias
+     * Will not search recursively in the nested levels.
+     *
+     * @param alias
+     * @return
+     */
     public ClusterDataHolder getClusterData (String alias);
 }


Mime
View raw message