return createErrorData(e);
}
+ String configLocation = System.getProperty(ArtifactGeneratorToscaParser.PROPERTY_TOSCA_MAPPING_FILE);
+ if (configLocation == null) {
+ throw new IllegalArgumentException(
+ String.format(ArtifactGeneratorToscaParser.GENERATOR_AAI_CONFIGLOCATION_NOT_FOUND,
+ ArtifactGeneratorToscaParser.PROPERTY_TOSCA_MAPPING_FILE));
+ }
+
try {
ArtifactGeneratorToscaParser.initWidgetConfiguration();
- ArtifactGeneratorToscaParser.initGroupFilterConfiguration();
+ ArtifactGeneratorToscaParser.initToscaMappingsConfiguration(configLocation);
ISdcCsarHelper csarHelper =
SdcToscaParserFactory.getInstance().getSdcCsarHelper(csarPath.toAbsolutePath().toString());
return generateAllArtifacts(validateServiceVersion(additionalParams), csarHelper);
*
* @param serviceVersion
* @param csarHelper
- * interface to the TOSCA parser
+ * interface to the TOSCA parser
* @return the generated Artifacts (containing XML models)
*/
private GenerationData generateAllArtifacts(final String serviceVersion, ISdcCsarHelper csarHelper) {
}
} else {
for (Group group : serviceGroups) {
- if (group.getMembers().contains(nodeTemplate.getName())
+ ArrayList<String> members = group.getMembers();
+ if (members != null && members.contains(nodeTemplate.getName())
&& WidgetConfigurationUtil.isSupportedInstanceGroup(group.getType())) {
log.debug(String.format("Adding group %s (type %s) with members %s", group.getName(),
- group.getType(), group.getMembers()));
+ group.getType(), members));
Resource groupModel = parser.createInstanceGroupModel(
parser.mergeProperties(group.getMetadata().getAllProperties(), group.getProperties()));
Resource model = Model.getModelFor(nodeTypeName, nodeTemplate.getMetaData().getValue("type"));
- Metadata metadata = nodeTemplate.getMetaData();
- if (metadata != null && parser.hasAllottedResource(metadata.getAllProperties())) {
- if (model.getWidgetType() == Type.VF) {
+ if (model != null) {
+ Metadata metadata = nodeTemplate.getMetaData();
+ if (metadata != null && parser.hasAllottedResource(metadata.getAllProperties())
+ && model.getWidgetType() == Type.VF) {
model = new Resource(Type.ALLOTTED_RESOURCE, true);
}
}
private void generateResourceModel(ISdcCsarHelper csarHelper, List<Resource> resources,
ArtifactGeneratorToscaParser parser, NodeTemplate nodeTemplate) {
Resource resourceModel = getModelFor(parser, nodeTemplate);
+ if (resourceModel == null) {
+ log.info(ApplicationMsgs.DISTRIBUTION_EVENT, "Could not generate resource model");
+ return;
+ }
+
Map<String, String> serviceMetadata = nodeTemplate.getMetaData().getAllProperties();
resourceModel.populateModelIdentificationInformation(serviceMetadata);
* Method to generate the artifact name for an AAI model.
*
* @param model
- * AAI artifact model
+ * AAI artifact model
* @return Model artifact name
*/
private String getArtifactName(Model model) {
* Create Resource artifact model from the AAI xml model string.
*
* @param resourceModel
- * Model of the resource artifact
+ * Model of the resource artifact
* @param aaiResourceModel
- * AAI model as string
+ * AAI model as string
* @return Generated {@link Artifact} model for the resource
*/
private Artifact getResourceArtifact(Model resourceModel, String aaiResourceModel) {
* Create Service artifact model from the AAI XML model.
*
* @param serviceModel
- * Model of the service artifact
+ * Model of the service artifact
* @param aaiServiceModel
- * AAI model as string
+ * AAI model as string
* @return Generated {@link Artifact} model for the service
*/
private Artifact getServiceArtifact(Service serviceModel, String aaiServiceModel) {