Skip to content

Commit 9e3b397

Browse files
finish adapting parser
1 parent cd8e173 commit 9e3b397

13 files changed

Lines changed: 278 additions & 39 deletions

plugins/iac/nimble/src/main/java/org/apache/cloudstack/service/NimbleManagerImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ protected Map<String, ToscaNodeType> loadToscaProfile() {
8080
List<IacResourceTypeVO> profileResourceTypes = iacResourceTypeDao.listAll();
8181

8282
return profileResourceTypes.stream()
83-
.map(resourceType -> toscaParser.parseNodeTypeDefinitionFile(resourceType.getName(), resourceType.getContent()))
83+
.map(resourceType -> toscaParser.parseNodeTypeDefinitionFile(resourceType.getContent()))
8484
.collect(Collectors.toMap(ToscaNodeType::getName, nodeType -> nodeType));
8585
}
8686

plugins/iac/nimble/src/main/java/org/apache/cloudstack/tosca/functions/ToscaBooleanFunctions.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
117
package org.apache.cloudstack.tosca.functions;
218

319
import java.util.List;

plugins/iac/nimble/src/main/java/org/apache/cloudstack/tosca/functions/ToscaFunction.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
117
package org.apache.cloudstack.tosca.functions;
218

319
public interface ToscaFunction {

plugins/iac/nimble/src/main/java/org/apache/cloudstack/tosca/functions/ToscaValueProducerFunctions.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
117
package org.apache.cloudstack.tosca.functions;
218

319
public class ToscaValueProducerFunctions {

plugins/iac/nimble/src/main/java/org/apache/cloudstack/tosca/model/ToscaAttributeDefinition.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
117
package org.apache.cloudstack.tosca.model;
218

319
public class ToscaAttributeDefinition extends ToscaFieldDefinition {

plugins/iac/nimble/src/main/java/org/apache/cloudstack/tosca/model/ToscaCollectionType.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
117
package org.apache.cloudstack.tosca.model;
218

319
public enum ToscaCollectionType {

plugins/iac/nimble/src/main/java/org/apache/cloudstack/tosca/model/ToscaDataTypeDefinition.java

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
117
package org.apache.cloudstack.tosca.model;
218

19+
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
20+
321
import java.util.Map;
422

523
public class ToscaDataTypeDefinition {
@@ -10,4 +28,13 @@ public ToscaDataTypeDefinition(String name, Map<String, ToscaPropertyDefinition>
1028
this.name = name;
1129
this.properties = properties;
1230
}
31+
32+
public String getName() {
33+
return name;
34+
}
35+
36+
@Override
37+
public String toString() {
38+
return ReflectionToStringBuilderUtils.reflectOnlySelectedFields(this, "name");
39+
}
1340
}

plugins/iac/nimble/src/main/java/org/apache/cloudstack/tosca/model/ToscaFieldDefinition.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
117
package org.apache.cloudstack.tosca.model;
218

319
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
420

521
public abstract class ToscaFieldDefinition {
6-
private String name;
7-
private String description;
8-
private ToscaTypeDefinition type;
22+
private final String name;
23+
private final String description;
24+
private final ToscaTypeDefinition type;
925

1026
public ToscaFieldDefinition(String name, String description, ToscaTypeDefinition type) {
1127
this.name = name;

plugins/iac/nimble/src/main/java/org/apache/cloudstack/tosca/model/ToscaNodeType.java

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,29 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
117
package org.apache.cloudstack.tosca.model;
218

319
import org.apache.cloudstack.utils.reflectiontostringbuilderutils.ReflectionToStringBuilderUtils;
420

521
import java.util.Map;
622

723
public class ToscaNodeType {
8-
private String name;
9-
private Map<String, ToscaPropertyDefinition> properties;
10-
private Map<String, ToscaAttributeDefinition> attributes;
24+
private final String name;
25+
private final Map<String, ToscaPropertyDefinition> properties;
26+
private final Map<String, ToscaAttributeDefinition> attributes;
1127

1228
public ToscaNodeType(String name, Map<String, ToscaPropertyDefinition> properties, Map<String, ToscaAttributeDefinition> attributes) {
1329
this.name = name;

plugins/iac/nimble/src/main/java/org/apache/cloudstack/tosca/model/ToscaPrimitiveType.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
// Licensed to the Apache Software Foundation (ASF) under one
2+
// or more contributor license agreements. See the NOTICE file
3+
// distributed with this work for additional information
4+
// regarding copyright ownership. The ASF licenses this file
5+
// to you under the Apache License, Version 2.0 (the
6+
// "License"); you may not use this file except in compliance
7+
// with the License. You may obtain a copy of the License at
8+
//
9+
// http://www.apache.org/licenses/LICENSE-2.0
10+
//
11+
// Unless required by applicable law or agreed to in writing,
12+
// software distributed under the License is distributed on an
13+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14+
// KIND, either express or implied. See the License for the
15+
// specific language governing permissions and limitations
16+
// under the License.
117
package org.apache.cloudstack.tosca.model;
218

319
public enum ToscaPrimitiveType {

0 commit comments

Comments
 (0)