1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
package org.openecomp.sdc.toscaparser.api.functions;
import java.util.ArrayList;
import org.openecomp.sdc.toscaparser.api.TopologyTemplate;
import org.openecomp.sdc.toscaparser.api.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
*/
|