stratos-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ud...@apache.org
Subject [07/10] git commit: adding dependecyAliases
Date Tue, 07 Oct 2014 12:18:09 GMT
adding dependecyAliases


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

Branch: refs/heads/4.0.0-grouping
Commit: a07a7532ef9bbfa456b83548db6aff8fd97c3e08
Parents: 08dcefb
Author: Udara Liyanage <udara@wso2.com>
Authored: Tue Oct 7 16:56:33 2014 +0530
Committer: Udara Liyanage <udara@wso2.com>
Committed: Tue Oct 7 16:56:33 2014 +0530

----------------------------------------------------------------------
 .../application/ApplicationUtils.java           |   23 +-
 .../parser/DefaultApplicationParser.java        |   13 +-
 .../application/payload/BasicPayloadData.java   |   58 +
 .../cloud/controller/pojo/Cartridge.java        |   16 +-
 .../cloud/controller/pojo/CartridgeConfig.java  |   12 +-
 .../controller/util/CloudControllerUtil.java    |    4 +
 .../definition/CartridgeDefinitionBean.java     |   13 +-
 .../bean/util/converter/PojoConverter.java      |    7 +
 .../main/resources/CloudControllerService.wsdl  | 1095 +++++++++---------
 tools/test.json                                 |    0
 10 files changed, 675 insertions(+), 566 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/stratos/blob/a07a7532/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/ApplicationUtils.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/ApplicationUtils.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/ApplicationUtils.java
index 697f33a..35600c4 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/ApplicationUtils.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/ApplicationUtils.java
@@ -19,6 +19,8 @@
 
 package org.apache.stratos.cloud.controller.application;
 
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.stratos.cloud.controller.application.payload.BasicPayloadData;
 import org.apache.stratos.cloud.controller.application.payload.PayloadData;
 import org.apache.stratos.cloud.controller.application.payload.PayloadFactory;
@@ -33,6 +35,7 @@ import java.util.*;
 import java.util.regex.Pattern;
 
 public class ApplicationUtils {
+    private static final Log log = LogFactory.getLog(ApplicationUtils.class);
 
     public static boolean isAliasValid (String alias) {
 
@@ -190,13 +193,13 @@ public class ApplicationUtils {
         return payloadBuilder;
     }
 
-    public static PayloadData createPayload (String appId, String groupName, Cartridge cartridge,
String subscriptionKey, int tenantId, String clusterId,
-                                             String hostName, String repoUrl, String alias,
Map<String, String> customPayloadEntries)
+    public static PayloadData createPayload(String appId, String groupName, Cartridge cartridge,
String subscriptionKey, int tenantId, String clusterId,
+                                            String hostName, String repoUrl, String alias,
Map<String, String> customPayloadEntries, String[] dependencyAliases)
             throws ApplicationDefinitionException {
 
         //Create the payload
         BasicPayloadData basicPayloadData = createBasicPayload(appId, groupName, cartridge,
subscriptionKey,
-                clusterId, hostName, repoUrl, alias, tenantId);
+                clusterId, hostName, repoUrl, alias, tenantId, dependencyAliases);
         //Populate the basic payload details
         basicPayloadData.populatePayload();
 
@@ -241,10 +244,10 @@ public class ApplicationUtils {
         return payloadData;
     }
 
-    private static BasicPayloadData createBasicPayload (String appId, String groupName, Cartridge
cartridge,
-                                                        String subscriptionKey, String clusterId,
-                                                        String hostName, String repoUrl,
String alias,
-                                                       int tenantId) {
+    private static BasicPayloadData createBasicPayload(String appId, String groupName, Cartridge
cartridge,
+                                                       String subscriptionKey, String clusterId,
+                                                       String hostName, String repoUrl, String
alias,
+                                                       int tenantId, String[] dependencyAliases)
{
 
         BasicPayloadData basicPayloadData = new BasicPayloadData();
         basicPayloadData.setAppId(appId);
@@ -276,6 +279,12 @@ public class ApplicationUtils {
         basicPayloadData.setTenantId(tenantId);
 
         basicPayloadData.setTenantRange("*");
+        basicPayloadData.setDependencyAliases(dependencyAliases);
+        if(cartridge.getExportingProperties() != null){
+            basicPayloadData.setExportingProperties(cartridge.getExportingProperties());
+            log.info("testing1 getExportingProperties " + cartridge.getExportingProperties());
+
+        }
 
         return basicPayloadData;
     }

http://git-wip-us.apache.org/repos/asf/stratos/blob/a07a7532/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/parser/DefaultApplicationParser.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/parser/DefaultApplicationParser.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/parser/DefaultApplicationParser.java
index 27c4126..2a7b25f 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/parser/DefaultApplicationParser.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/parser/DefaultApplicationParser.java
@@ -489,7 +489,8 @@ public class DefaultApplicationParser implements ApplicationParser {
             assert subscribableInfoCtxt != null;
             ApplicationClusterContext appClusterCtxt = createApplicationClusterContext(appId,
groupName, cartridge,
                     key, tenantId, subscribableInfoCtxt.getRepoUrl(), subscribableCtxt.getAlias(),
-                    clusterId, hostname, subscribableInfoCtxt.getDeploymentPolicy(), false);
+                    clusterId, hostname, subscribableInfoCtxt.getDeploymentPolicy(), false,
subscribableInfoCtxt.getDependencyAliases());
+
             appClusterCtxt.setAutoscalePolicyName(subscribableInfoCtxt.getAutoscalingPolicy());
             this.applicationClusterContexts.add(appClusterCtxt);
 
@@ -521,17 +522,17 @@ public class DefaultApplicationParser implements ApplicationParser {
         //clusterDataHolder.setPayloadDataHolders(payloadDataHolders);
     }
 
-    private ApplicationClusterContext createApplicationClusterContext (String appId, String
groupName, Cartridge cartridge,
-                                                                       String subscriptionKey,
int tenantId, String repoUrl,
-                                                                       String alias, String
clusterId, String hostname,
-                                                                       String deploymentPolicy,
boolean isLB)
+    private ApplicationClusterContext createApplicationClusterContext(String appId, String
groupName, Cartridge cartridge,
+                                                                      String subscriptionKey,
int tenantId, String repoUrl,
+                                                                      String alias, String
clusterId, String hostname,
+                                                                      String deploymentPolicy,
boolean isLB, String[] dependencyAliases)
             throws ApplicationDefinitionException {
 
         // Create text payload
         //String textPayload = ApplicationUtils.getTextPayload(appId, groupName, clusterId).toString();
 
         String textPayload = ApplicationUtils.createPayload(appId, groupName, cartridge,
subscriptionKey, tenantId, clusterId,
-                hostname, repoUrl, alias, null).toString();
+                hostname, repoUrl, alias, null, dependencyAliases).toString();
 
         return new ApplicationClusterContext(cartridge.getType(), clusterId, hostname, textPayload,
deploymentPolicy, isLB);
     }

http://git-wip-us.apache.org/repos/asf/stratos/blob/a07a7532/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/payload/BasicPayloadData.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/payload/BasicPayloadData.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/payload/BasicPayloadData.java
index c15e492..2c3c187 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/payload/BasicPayloadData.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/application/payload/BasicPayloadData.java
@@ -49,6 +49,8 @@ public class BasicPayloadData implements Serializable {
     private String portMappings;
     private String multitenant;
     private String provider;
+    private String[] dependencyAliases;
+    private String[] exportingProperties;
 
     protected StringBuilder payloadBuilder;
 
@@ -100,6 +102,14 @@ public class BasicPayloadData implements Serializable {
         payloadBuilder.append(",");
         payloadBuilder.append("PUPPET_ENV=" + System.getProperty("puppet.dns.available"));
 
+        if(getDependencyAliasesPayloadString() != null){
+            payloadBuilder.append("DEPENDECNY_ALIASES=" + getDependencyAliasesPayloadString());
+        }
+
+        if(getExportingPropertiesPayloadString() != null){
+            payloadBuilder.append("EXPORTING_PROPERTIES=" + getExportingPropertiesPayloadString());
+        }
+
     }
 
     public String getServiceName() {
@@ -250,4 +260,52 @@ public class BasicPayloadData implements Serializable {
     public void setGroupName(String groupName) {
         this.groupName = groupName;
     }
+
+    public String[] getDependencyAliases() {
+        return dependencyAliases;
+    }
+
+    public void setDependencyAliases(String[] dependencyAliases) {
+        this.dependencyAliases = dependencyAliases;
+    }
+
+    private String getDependencyAliasesPayloadString(){
+        if(dependencyAliases == null){
+            return null;
+        }
+
+        StringBuilder dependencyAliasesPayload = new StringBuilder();
+        for(int i=0; i< dependencyAliases.length; i++){
+            dependencyAliasesPayload.append(dependencyAliases[i]);
+            if(i != dependencyAliases.length -1){
+                dependencyAliasesPayload.append("|");
+            }
+        }
+        log.info("testing1 getDependencyAliasesPayloadString " + dependencyAliasesPayload);
+        return dependencyAliasesPayload.toString();
+    }
+
+    private String getExportingPropertiesPayloadString(){
+        if(exportingProperties == null){
+            return null;
+        }
+
+        StringBuilder exportingPropertiesPayload = new StringBuilder();
+        for(int i=0; i< exportingProperties.length; i++){
+            exportingPropertiesPayload.append(exportingProperties[i]);
+            if(i != exportingProperties.length -1){
+                exportingPropertiesPayload.append("|");
+            }
+        }
+        log.info("testing1 getExportingPropertiesPayloadString " + exportingPropertiesPayload);
+        return exportingPropertiesPayload.toString();
+    }
+
+    public String[] getExportingProperties() {
+        return exportingProperties;
+    }
+
+    public void setExportingProperties(String[] exportingProperties) {
+        this.exportingProperties = exportingProperties;
+    }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/a07a7532/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Cartridge.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Cartridge.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Cartridge.java
index dafaa2c..805aaa5 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Cartridge.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/Cartridge.java
@@ -77,7 +77,9 @@ public class Cartridge implements Serializable{
     private List<String> deploymentDirs;
     
     private IaasProvider lastlyUsedIaas;
-    
+
+    private String[] exportingProperties;
+
     /**
      * Key - partition id
      * Value - Corresponding IaasProvider.
@@ -369,6 +371,14 @@ public class Cartridge implements Serializable{
 	public void setServiceGroup(String serviceGroup) {
 		this.serviceGroup = serviceGroup;
 	}
-    
-    
+
+
+    public String[] getExportingProperties() {
+        return exportingProperties;
+    }
+
+    public void setExportingProperties(String[] exportingProperties) {
+        this.exportingProperties = exportingProperties;
+    }
+
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/a07a7532/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/CartridgeConfig.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/CartridgeConfig.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/CartridgeConfig.java
index 0862ad1..00fe884 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/CartridgeConfig.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/pojo/CartridgeConfig.java
@@ -62,6 +62,7 @@ public class CartridgeConfig implements Serializable {
     private LoadbalancerConfig lbConfig;
     
     private String serviceGroup;
+    private String[] exportingProperties;
 
 
     public String getType() {
@@ -269,6 +270,13 @@ public class CartridgeConfig implements Serializable {
 	public void setServiceGroup(String serviceGroup) {
 		this.serviceGroup = serviceGroup;
 	}
-    
-    
+
+
+    public String[] getExportingProperties() {
+        return exportingProperties;
+    }
+
+    public void setExportingProperties(String[] exportingProperties) {
+        this.exportingProperties = exportingProperties;
+    }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/a07a7532/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
index e9a57be..0ad8488 100644
--- a/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
+++ b/components/org.apache.stratos.cloud.controller/src/main/java/org/apache/stratos/cloud/controller/util/CloudControllerUtil.java
@@ -160,6 +160,10 @@ public class CloudControllerUtil {
             }
         }
 
+        if(config.getExportingProperties() != null){
+            cartridge.setExportingProperties(config.getExportingProperties());
+        }
+
         return cartridge;
     }
 	  

http://git-wip-us.apache.org/repos/asf/stratos/blob/a07a7532/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/cartridge/definition/CartridgeDefinitionBean.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/cartridge/definition/CartridgeDefinitionBean.java
b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/cartridge/definition/CartridgeDefinitionBean.java
index 87c6aac..2a99610 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/cartridge/definition/CartridgeDefinitionBean.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/cartridge/definition/CartridgeDefinitionBean.java
@@ -58,12 +58,15 @@ public class CartridgeDefinitionBean {
     
     public String serviceGroup;
 
+    private String[] exportingProperties;
+
     public String toString () {
 
         return "Type: " + type + ", Provider: " + provider + ", Host: " + host + ", Display
Name: " + displayName +
                 ", Description: " + description +  ", Version: " + version + ", Multitenant
" + multiTenant + "\n" +
                 getDeploymentDetails() + "\n PortMapping: " + getPortMappings() + "\n IaaS:
" + getIaasProviders() +
-                "\n LoadBalancer: " + getLoadBalancerInfo() + "\n Properties: " + getProperties()
+"\n VolumeBean mappings "+ persistence.toString();
+                "\n LoadBalancer: " + getLoadBalancerInfo() + "\n Properties: " + getProperties()
+"\n VolumeBean mappings "+ persistence.toString()
+                + "\n Exports " + exportingProperties.toString();
     }
 
 	private String getDeploymentDetails () {
@@ -114,4 +117,12 @@ public class CartridgeDefinitionBean {
         }
         return propertyBuilder.toString();
     }
+
+    public String[] getExportingProperties() {
+        return exportingProperties;
+    }
+
+    public void setExportingProperties(String[] exportingProperties) {
+        this.exportingProperties = exportingProperties;
+    }
 }

http://git-wip-us.apache.org/repos/asf/stratos/blob/a07a7532/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/util/converter/PojoConverter.java
----------------------------------------------------------------------
diff --git a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/util/converter/PojoConverter.java
b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/util/converter/PojoConverter.java
index 0067d37..a100a93 100644
--- a/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/util/converter/PojoConverter.java
+++ b/components/org.apache.stratos.rest.endpoint/src/main/java/org/apache/stratos/rest/endpoint/bean/util/converter/PojoConverter.java
@@ -96,6 +96,11 @@ public class PojoConverter {
             cartridgeConfig.setProperties(getProperties(cartridgeDefinitionBean.property));
         }
 
+        if(cartridgeDefinitionBean.getExportingProperties() != null)
+        {
+            cartridgeConfig.setExportingProperties(cartridgeDefinitionBean.getExportingProperties());
+        }
+        
         return cartridgeConfig;
     }
     
@@ -717,7 +722,9 @@ public class PojoConverter {
             subscribableInfoContext.setPrivateRepo(subscribableInfo.isPrivateRepo());
             subscribableInfoContext.setRepoUsername(subscribableInfo.getRepoUsername());
             subscribableInfoContext.setRepoPassword(subscribableInfo.getRepoPassword());
+            subscribableInfoContext.setDependencyAliases(subscribableInfo.getDependencyAliases());
             subscribableInfoContexts[i++] =  subscribableInfoContext;
+
         }
 
         return subscribableInfoContexts;


Mime
View raw message