stratos-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From imesh <...@git.apache.org>
Subject [GitHub] stratos pull request: Refining cartridge classes in cloud controll...
Date Tue, 24 Mar 2015 11:24:42 GMT
Github user imesh commented on a diff in the pull request:

    https://github.com/apache/stratos/pull/277#discussion_r27019089
  
    --- Diff: components/org.apache.stratos.autoscaler/src/main/java/org/apache/stratos/autoscaler/applications/ApplicationUtils.java
---
    @@ -207,31 +207,35 @@ public static PayloadData createPayload(String appId, String groupName,
Cartridg
                     cartridgeInfo.getType(), basicPayloadData);
     
             // get the payload parameters defined in the cartridgeInfo definition file for
this cartridgeInfo type
    -        if (cartridgeInfo.getProperties() != null && cartridgeInfo.getProperties().length
!= 0) {
    -
    -            org.apache.stratos.common.Properties cartridgeProps = AutoscalerUtil.toCommonProperties(cartridgeInfo.getProperties());
    -            
    -            if (cartridgeProps != null) {
    -
    -                for (Property propertyEntry : cartridgeProps.getProperties()) {
    -                    // check if a property is related to the payload. Currently
    -                    // this is done by checking if the
    -                    // property name starts with 'payload_parameter.' suffix. If
    -                    // so the payload param name will
    -                    // be taken as the substring from the index of '.' to the
    -                    // end of the property name.
    -                    if (propertyEntry.getName().startsWith("payload_parameter.")) {
    -                        String payloadParamName = propertyEntry.getName();
    -                        String payloadParamSubstring = payloadParamName.substring(payloadParamName.indexOf(".")
+ 1);
    -                        if ("DEPLOYMENT".equals(payloadParamSubstring)) {
    -                            payloadData.getBasicPayloadData().setDeployment(payloadParamSubstring);
    -                            continue;
    +
    +        if (cartridgeInfo.getProperties() != null) {
    +            if (cartridgeInfo.getProperties().getProperties() != null && cartridgeInfo.getProperties().getProperties().length
!= 0) {
    +
    +                org.apache.stratos.common.Properties cartridgeProps = AutoscalerUtil.toCommonProperties(cartridgeInfo.getProperties().getProperties());
    +
    +                if (cartridgeProps != null) {
    +
    +                    for (Property propertyEntry : cartridgeProps.getProperties()) {
    +                        // check if a property is related to the payload. Currently
    +                        // this is done by checking if the
    +                        // property name starts with 'payload_parameter.' suffix. If
    +                        // so the payload param name will
    +                        // be taken as the substring from the index of '.' to the
    +                        // end of the property name.
    +                        if (propertyEntry.getName().startsWith("payload_parameter."))
{
    +                            String payloadParamName = propertyEntry.getName();
    +                            String payloadParamSubstring = payloadParamName.substring(payloadParamName.indexOf(".")
+ 1);
    +                            if ("DEPLOYMENT".equals(payloadParamSubstring)) {
    --- End diff --
    
    It might be better to move "DEPLOYMENT" string to a constant.
    Thanks


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message