diff options
Diffstat (limited to 'jtosca/src/main/java/org/openecomp/sdc/toscaparser/functions/Concat.java')
-rw-r--r-- | jtosca/src/main/java/org/openecomp/sdc/toscaparser/functions/Concat.java | 76 |
1 files changed, 76 insertions, 0 deletions
diff --git a/jtosca/src/main/java/org/openecomp/sdc/toscaparser/functions/Concat.java b/jtosca/src/main/java/org/openecomp/sdc/toscaparser/functions/Concat.java new file mode 100644 index 0000000..af69f86 --- /dev/null +++ b/jtosca/src/main/java/org/openecomp/sdc/toscaparser/functions/Concat.java @@ -0,0 +1,76 @@ +package org.openecomp.sdc.toscaparser.functions; + +import java.util.ArrayList; + +import org.openecomp.sdc.toscaparser.TopologyTemplate; +import org.openecomp.sdc.toscaparser.common.ExceptionCollector; + +public class Concat extends Function { + // Validate the function and provide an instance of the function + + // Concatenation of values are supposed to be produced at runtime and + // therefore its the responsibility of the TOSCA engine to implement the + // evaluation of Concat functions. + + // Arguments: + + // * List of strings that needs to be concatenated + + // Example: + + // [ 'http://', + // get_attribute: [ server, public_address ], + // ':' , + // get_attribute: [ server, port ] ] + + + public Concat(TopologyTemplate ttpl,Object context,String name,ArrayList<Object> args) { + super(ttpl,context,name,args); + } + + @Override + public Object result() { + return this; + } + + @Override + void validate() { + if(args.size() < 1) { + ExceptionCollector.appendException( + "ValueError: Invalid arguments for function \"concat\". " + + "Expected at least one argument"); + } + } + +} + +/*python + +class Concat(Function): +"""Validate the function and provide an instance of the function + +Concatenation of values are supposed to be produced at runtime and +therefore its the responsibility of the TOSCA engine to implement the +evaluation of Concat functions. + +Arguments: + +* List of strings that needs to be concatenated + +Example: + + [ 'http://', + get_attribute: [ server, public_address ], + ':' , + get_attribute: [ server, port ] ] +""" + +def validate(self): + if len(self.args) < 1: + ExceptionCollector.appendException( + ValueError(_('Invalid arguments for function "{0}". Expected ' + 'at least one arguments.').format(CONCAT))) + +def result(self): + return self +*/
\ No newline at end of file |