diff options
Diffstat (limited to 'common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java')
54 files changed, 2864 insertions, 0 deletions
diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/AaiModelGenerator.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/AaiModelGenerator.java new file mode 100644 index 0000000000..f3c2cb97e7 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/AaiModelGenerator.java @@ -0,0 +1,72 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai; + +import static org.openecomp.sdc.generator.data.GeneratorConstants.ERROR_CATEGORY; +import static org.openecomp.sdc.generator.data.GeneratorConstants.ERROR_CODE; +import static org.openecomp.sdc.generator.data.GeneratorConstants.ERROR_DESCRIPTION; +import static org.openecomp.sdc.generator.data.GeneratorConstants.GENERATOR_ERROR_CODE; +import static org.openecomp.sdc.generator.data.GeneratorConstants.GENERATOR_ERROR_SERVICE_INSTANTIATION_FAILED; +import static org.openecomp.sdc.generator.data.GeneratorConstants.GENERATOR_PARTNER_NAME; +import static org.openecomp.sdc.generator.data.GeneratorConstants.PARTNER_NAME; + +import org.openecomp.sdc.generator.aai.model.Resource; +import org.openecomp.sdc.generator.aai.model.Service; +import org.openecomp.sdc.generator.aai.model.Widget; +import org.openecomp.sdc.generator.logging.CategoryLogLevel; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.slf4j.MDC; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.Arrays; + +public interface AaiModelGenerator { + + /** + * Gets instance. + * + * @return the instance + */ + public static AaiModelGenerator getInstance() { + Logger log = LoggerFactory.getLogger(AaiModelGenerator.class.getName()); + try { + return AaiModelGenerator.class.cast( + Class.forName("org.openecomp.sdc.generator.aai.AaiModelGeneratorImpl").newInstance()); + } catch (Exception exception) { + MDC.put(PARTNER_NAME, GENERATOR_PARTNER_NAME); + MDC.put(ERROR_CATEGORY, CategoryLogLevel.ERROR.name()); + MDC.put(ERROR_CODE, GENERATOR_ERROR_CODE); + MDC.put(ERROR_DESCRIPTION, GENERATOR_ERROR_SERVICE_INSTANTIATION_FAILED); + StringWriter sw = new StringWriter(); + exception.printStackTrace(new PrintWriter(sw)); + log.error(sw.toString()); + } + return null; + } + + public String generateModelFor(Service service); + + public String generateModelFor(Resource resource); + + +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/AllotedResource.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/AllotedResource.java new file mode 100644 index 0000000000..ef8555002f --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/AllotedResource.java @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +import org.openecomp.sdc.generator.aai.types.Cardinality; +import org.openecomp.sdc.generator.aai.types.Model; + +@Model(widget = Widget.Type.ALLOTTED_RESOURCE, cardinality = Cardinality.UNBOUNDED, + dataDeleteFlag = true) +public class AllotedResource extends Resource { +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/AllotedResourceWidget.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/AllotedResourceWidget.java new file mode 100644 index 0000000000..0b0db794c4 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/AllotedResourceWidget.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +import org.openecomp.sdc.generator.aai.types.Cardinality; +import org.openecomp.sdc.generator.aai.types.ModelType; +import org.openecomp.sdc.generator.aai.types.ModelWidget; + + +@org.openecomp.sdc.generator.aai.types.Model(widget = Widget.Type.ALLOTTED_RESOURCE, cardinality + = Cardinality.UNBOUNDED, dataDeleteFlag = true) +@ModelWidget(type = ModelType.WIDGET, name = "allotted-resource") +public class AllotedResourceWidget extends ResourceWidget { +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/FlavorWidget.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/FlavorWidget.java new file mode 100644 index 0000000000..0cb76ae2b5 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/FlavorWidget.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +import org.openecomp.sdc.generator.aai.types.Cardinality; +import org.openecomp.sdc.generator.aai.types.Model; +import org.openecomp.sdc.generator.aai.types.ModelType; +import org.openecomp.sdc.generator.aai.types.ModelWidget; + +@Model(widget = Widget.Type.FLAVOR, cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = false) +@ModelWidget(type = ModelType.WIDGET, name = "flavor") +public class FlavorWidget extends ResourceWidget { + +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/ImageWidget.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/ImageWidget.java new file mode 100644 index 0000000000..cb514bcc8f --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/ImageWidget.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +import org.openecomp.sdc.generator.aai.types.Cardinality; +import org.openecomp.sdc.generator.aai.types.Model; +import org.openecomp.sdc.generator.aai.types.ModelType; +import org.openecomp.sdc.generator.aai.types.ModelWidget; + +@Model(widget = Widget.Type.IMAGE, cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = false) +@ModelWidget(type = ModelType.WIDGET, name = "image") +public class ImageWidget extends ResourceWidget { + +} + diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/L3Network.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/L3Network.java new file mode 100644 index 0000000000..3a4c564668 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/L3Network.java @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +import org.openecomp.sdc.generator.aai.types.Cardinality; +import org.openecomp.sdc.generator.aai.types.Model; + +@org.openecomp.sdc.generator.aai.types.Model(widget = Widget.Type.L3_NET, cardinality = Cardinality + .UNBOUNDED, dataDeleteFlag = false) +public class L3Network extends Resource{ +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/L3NetworkWidget.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/L3NetworkWidget.java new file mode 100644 index 0000000000..67414b4ed8 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/L3NetworkWidget.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +import org.openecomp.sdc.generator.aai.types.Cardinality; +import org.openecomp.sdc.generator.aai.types.ModelType; +import org.openecomp.sdc.generator.aai.types.ModelWidget; + +@org.openecomp.sdc.generator.aai.types.Model(widget = Widget.Type.L3_NET, + cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) +@ModelWidget(type = ModelType.WIDGET, name = "l3-network") +public class L3NetworkWidget extends Widget { + +} + diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/LIntfWidget.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/LIntfWidget.java new file mode 100644 index 0000000000..4aa6cd29aa --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/LIntfWidget.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +import org.openecomp.sdc.generator.aai.types.Cardinality; +import org.openecomp.sdc.generator.aai.types.Model; +import org.openecomp.sdc.generator.aai.types.ModelType; +import org.openecomp.sdc.generator.aai.types.ModelWidget; + +@Model(widget = Widget.Type.LINT, cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) +@ModelWidget(type = ModelType.WIDGET, name = "l-interface") +public class LIntfWidget extends ResourceWidget { + +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/Model.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/Model.java new file mode 100644 index 0000000000..c55abb36c2 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/Model.java @@ -0,0 +1,259 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +import org.openecomp.sdc.generator.aai.types.Cardinality; +import org.openecomp.sdc.generator.aai.types.ModelType; +import org.openecomp.sdc.generator.data.GeneratorConstants; +import org.openecomp.sdc.generator.error.IllegalAccessException; + +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; + +public abstract class Model { + + protected Set<Resource> resources = new HashSet<>(); + protected Set<Widget> widgets = new HashSet<>(); + private String modelId; + private String modelName; + private ModelType modelType; + private String modelVersion; + private String modelNameVersionId; + private String modelDescription; + + /** + * Gets model for. + * + * @param toscaType the tosca type + * @return the model for + */ + public static Model getModelFor(String toscaType) { + + Model modelToBeReturned = null; + while (toscaType != null && toscaType.lastIndexOf(".") != -1 && modelToBeReturned == null) { + + switch (toscaType) { + + case "org.openecomp.resource.vf.allottedResource": + modelToBeReturned = new AllotedResource(); + break; + case "org.openecomp.resource.vfc.AllottedResource": + modelToBeReturned = new ProvidingService(); + break; + case "org.openecomp.resource.vfc": + modelToBeReturned = new VServerWidget(); + break; + case "org.openecomp.resource.cp": + case "org.openecomp.cp": + modelToBeReturned = new LIntfWidget(); + break; + case "org.openecomp.resource.vl": + modelToBeReturned = new L3Network(); + break; + case "org.openecomp.resource.vf": + modelToBeReturned = new VirtualFunction(); + break; + case "org.openecomp.groups.vfmodule": + case "org.openecomp.groups.VfModule": + modelToBeReturned = new VfModule(); + break; + case "org.openecomp.resource.vfc.nodes.heat.cinder": + modelToBeReturned = new VolumeWidget(); + break; + default: + modelToBeReturned = null; + break; + } + + toscaType = toscaType.substring(0, toscaType.lastIndexOf(".")); + } + + return modelToBeReturned; + } + + public abstract boolean addResource(Resource resource); + + public abstract boolean addWidget(Widget resource); + + /** + * Gets widget version id. + * + * @return the widget version id + */ + public String getWidgetId() { + org.openecomp.sdc.generator.aai.types.Model model = + this.getClass().getAnnotation(org.openecomp.sdc.generator.aai.types.Model.class); + return Widget.getWidget(model.widget()).getId(); + } + + /** + * Gets invariant id. + * + * @return the invariant id + */ + public String getWidgetInvariantId() { + org.openecomp.sdc.generator.aai.types.Model model = + this.getClass().getAnnotation(org.openecomp.sdc.generator.aai.types.Model.class); + return Widget.getWidget(model.widget()).getWidgetId(); + } + + /** + * Gets delete flag. + * + * @return the delete flag + */ + public boolean getDeleteFlag() { + org.openecomp.sdc.generator.aai.types.Model model = + this.getClass().getAnnotation(org.openecomp.sdc.generator.aai.types.Model.class); + return model.dataDeleteFlag(); + } + + /** + * Gets cardinality. + * + * @return the cardinality + */ + public Cardinality getCardinality() { + org.openecomp.sdc.generator.aai.types.Model model = + this.getClass().getAnnotation(org.openecomp.sdc.generator.aai.types.Model.class); + return model.cardinality(); + } + + public abstract Widget.Type getWidgetType(); + + public String getModelId() { + checkSupported(); + return modelId; + } + + /** + * Gets model type. + * + * @return the model type + */ + public ModelType getModelType() { + //checkSupported(); + if (this instanceof Service) { + return ModelType.SERVICE; + } else if (this instanceof Resource) { + return ModelType.RESOURCE; + } else if (this instanceof Widget) { + return ModelType.WIDGET; + } else { + return null; + } + } + + public String getModelName() { + //checkSupported(); + return modelName; + } + + public String getModelVersion() { + //checkSupported(); + return modelVersion; + } + + public String getModelNameVersionId() { + checkSupported(); + return modelNameVersionId; + } + + public String getModelDescription() { + //checkSupported(); + return modelDescription; + } + + /** + * Populate model identification information. + * + * @param modelIdentInfo the model ident info + */ + public void populateModelIdentificationInformation(Map<String, String> modelIdentInfo) { + Iterator<String> iter = modelIdentInfo.keySet().iterator(); + String property; + while (iter.hasNext()) { + switch (property = iter.next()) { + + case "vfModuleModelInvariantUUID": + case "serviceInvariantUUID": + case "resourceInvariantUUID": + case "invariantUUID": + case "providing_service_invariant_uuid": + modelId = modelIdentInfo.get(property); + break; + case "vfModuleModelUUID": + case "resourceUUID": + case "serviceUUID": + case "UUID": + case "providing_service_uuid": + modelNameVersionId = modelIdentInfo.get(property); + break; + case "vfModuleModelVersion": + case "serviceVersion": + case "resourceversion": + case "version": + modelVersion = modelIdentInfo.get(property); + break; + case "vfModuleModelName": + case "serviceName": + case "resourceName": + case "name": + modelName = modelIdentInfo.get(property); + break; + case "serviceDescription": + case "resourceDescription": + case "vf_module_description": + case "description": + modelDescription = modelIdentInfo.get(property); + break; + case "providing_service_name": + modelName = modelIdentInfo.get(property); + modelDescription = modelIdentInfo.get(property); + break; + default: + break; + } + property = null; + } + + + + } + + public Set<Resource> getResources() { + return resources; + } + + public Set<Widget> getWidgets() { + return widgets; + } + + private void checkSupported() throws IllegalAccessException { + if (this instanceof Widget) { + throw new IllegalAccessException(GeneratorConstants + .GENERATOR_AAI_ERROR_UNSUPPORTED_WIDGET_OPERATION); + } + } + +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/OamNetwork.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/OamNetwork.java new file mode 100644 index 0000000000..f51fb529fb --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/OamNetwork.java @@ -0,0 +1,32 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +import org.openecomp.sdc.generator.aai.types.Cardinality; +import org.openecomp.sdc.generator.aai.types.Model; +import org.openecomp.sdc.generator.aai.types.ModelType; +import org.openecomp.sdc.generator.aai.types.ModelWidget; + +@Model(widget = Widget.Type.L3_NET, cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) +@ModelWidget(type = ModelType.WIDGET, name = "oam-network") +public class OamNetwork extends Widget { +} + diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/ProvidingService.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/ProvidingService.java new file mode 100644 index 0000000000..1eb4095f45 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/ProvidingService.java @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +import org.openecomp.sdc.generator.aai.types.Cardinality; + +@org.openecomp.sdc.generator.aai.types.Model(widget = Widget.Type.ALLOTTED_RESOURCE, cardinality = Cardinality + .UNBOUNDED, + dataDeleteFlag = false) +public class ProvidingService extends Resource { +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/Resource.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/Resource.java new file mode 100644 index 0000000000..cc95706d9f --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/Resource.java @@ -0,0 +1,52 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +public class Resource extends Model { + + @Override + public int hashCode() { + return getModelNameVersionId().hashCode(); + } + + @Override + public boolean equals(Object obj) { + if (obj instanceof Resource) { + return getModelNameVersionId().equals(((Resource) obj).getModelNameVersionId()); + } + return false; + } + + public boolean addResource(Resource resource) { + return resources.add(resource); + } + + public boolean addWidget(Widget widget) { + return widgets.add(widget); + } + + @Override + public Widget.Type getWidgetType() { + org.openecomp.sdc.generator.aai.types.Model model = + this.getClass().getAnnotation(org.openecomp.sdc.generator.aai.types.Model.class); + return model.widget(); + } +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/ResourceWidget.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/ResourceWidget.java new file mode 100644 index 0000000000..26ff95dd7a --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/ResourceWidget.java @@ -0,0 +1,26 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +public class ResourceWidget extends Widget { + +} + diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/Service.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/Service.java new file mode 100644 index 0000000000..8b3b7f2c60 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/Service.java @@ -0,0 +1,43 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +import org.openecomp.sdc.generator.aai.types.Cardinality; + +@org.openecomp.sdc.generator.aai.types.Model(widget = Widget.Type.SERVICE, + cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) +public class Service extends Model { + + public boolean addResource(Resource resource) { + return resources.add(resource); + } + + public boolean addWidget(Widget widget) { + return widgets.add(widget); + } + + @Override + public Widget.Type getWidgetType() { + return null; + } + +} + diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/ServiceWidget.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/ServiceWidget.java new file mode 100644 index 0000000000..58ae7b6e63 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/ServiceWidget.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +import org.openecomp.sdc.generator.aai.types.ModelType; +import org.openecomp.sdc.generator.aai.types.ModelWidget; + +@ModelWidget(type = ModelType.WIDGET, name = "service-instance") +public class ServiceWidget extends Widget { + +} + diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/TenantWidget.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/TenantWidget.java new file mode 100644 index 0000000000..4fc6f6e8af --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/TenantWidget.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +import org.openecomp.sdc.generator.aai.types.Cardinality; +import org.openecomp.sdc.generator.aai.types.Model; +import org.openecomp.sdc.generator.aai.types.ModelType; +import org.openecomp.sdc.generator.aai.types.ModelWidget; + +@Model(widget = Widget.Type.TENANT, cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = false) +@ModelWidget(type = ModelType.WIDGET, name = "tenant") +public class TenantWidget extends Widget { + +} + diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/TunnelXconnectWidget.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/TunnelXconnectWidget.java new file mode 100644 index 0000000000..87fd514fa2 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/TunnelXconnectWidget.java @@ -0,0 +1,31 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +import org.openecomp.sdc.generator.aai.types.Cardinality; +import org.openecomp.sdc.generator.aai.types.ModelType; +import org.openecomp.sdc.generator.aai.types.ModelWidget; + +@org.openecomp.sdc.generator.aai.types.Model(widget = Widget.Type.TUNNEL_XCONNECT, + cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) +@ModelWidget(type = ModelType.WIDGET, name = "tunnel-xconnect") +public class TunnelXconnectWidget extends Widget { +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VServerWidget.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VServerWidget.java new file mode 100644 index 0000000000..58dd677a18 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VServerWidget.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +import org.openecomp.sdc.generator.aai.types.Cardinality; +import org.openecomp.sdc.generator.aai.types.Model; +import org.openecomp.sdc.generator.aai.types.ModelType; +import org.openecomp.sdc.generator.aai.types.ModelWidget; + +@Model(widget = Widget.Type.VSERVER, cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) +@ModelWidget(type = ModelType.WIDGET, name = "vserver") +public class VServerWidget extends Widget { + + /** + * Instantiates a new V server widget. + */ + public VServerWidget() { + addWidget(new FlavorWidget()); + addWidget(new ImageWidget()); + addWidget(new TenantWidget()); + addWidget(new VfcWidget()); + } + + public boolean addWidget(Widget widget) { + return widgets.add(widget); + } + +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VfModule.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VfModule.java new file mode 100644 index 0000000000..594cfedcbc --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VfModule.java @@ -0,0 +1,81 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +import org.openecomp.sdc.generator.aai.types.Cardinality; +import org.openecomp.sdc.generator.aai.types.Model; + +import java.util.List; + +@Model(widget = Widget.Type.VFMODULE, cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) +public class VfModule extends Resource { + + Widget vserver = null; + boolean addlintf = false; + boolean addvolume = false; + + List<String> members; + + public void setMembers(List<String> members) { + this.members = members; + } + + /** + * Adds Widget. + * + * @param widget the widget + * @return the boolean + */ + public boolean addWidget(Widget widget) { + if (widget.memberOf(members)) { + if (vserver == null && widget.getId().equals(new VServerWidget().getId())) { + vserver = widget; + if (addlintf) { + vserver.addWidget(new LIntfWidget()); + } + if (addvolume) { + vserver.addWidget(new VolumeWidget()); + } + } else if (widget.getId().equals(new LIntfWidget().getId())) { + if (vserver != null) { + vserver.addWidget(widget); + return true; + } else { + addlintf = true; + } + return false; + } else if (widget.getId().equals(new VolumeWidget().getId())) { + if (vserver != null) { + vserver.addWidget(widget); + } else { + addvolume = true; + } + return true; + } + if (widget.getId().equals(new OamNetwork().getId())) { + return false; + } + return widgets.add(widget); + } + return false; + } + +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VfModuleWidget.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VfModuleWidget.java new file mode 100644 index 0000000000..3641ba9171 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VfModuleWidget.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +import org.openecomp.sdc.generator.aai.types.Cardinality; +import org.openecomp.sdc.generator.aai.types.ModelType; +import org.openecomp.sdc.generator.aai.types.ModelWidget; + +@org.openecomp.sdc.generator.aai.types.Model(widget = Widget.Type.VFMODULE, + cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) +@ModelWidget(type = ModelType.WIDGET, name = "vf-module") +public class VfModuleWidget extends Widget { + +} + diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VfWidget.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VfWidget.java new file mode 100644 index 0000000000..a2fde75b20 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VfWidget.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +import org.openecomp.sdc.generator.aai.types.Cardinality; +import org.openecomp.sdc.generator.aai.types.ModelType; +import org.openecomp.sdc.generator.aai.types.ModelWidget; + +@org.openecomp.sdc.generator.aai.types.Model(widget = Widget.Type.VF, + cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) +@ModelWidget(type = ModelType.WIDGET, name = "generic-vnf") +public class VfWidget extends ResourceWidget { + +} + diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VfcWidget.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VfcWidget.java new file mode 100644 index 0000000000..41a07ce1de --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VfcWidget.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +import org.openecomp.sdc.generator.aai.types.Cardinality; +import org.openecomp.sdc.generator.aai.types.ModelType; +import org.openecomp.sdc.generator.aai.types.ModelWidget; + +@org.openecomp.sdc.generator.aai.types.Model(widget = Widget.Type.VFC, + cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) +@ModelWidget(type = ModelType.WIDGET, name = "vnfc") +public class VfcWidget extends ResourceWidget { + +} + diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VirtualFunction.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VirtualFunction.java new file mode 100644 index 0000000000..ec2ca38cbf --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VirtualFunction.java @@ -0,0 +1,30 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +import org.openecomp.sdc.generator.aai.types.Cardinality; +import org.openecomp.sdc.generator.aai.types.Model; + +@Model(widget = Widget.Type.VF, cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) +public class VirtualFunction extends Resource { + +} + diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VolumeGroupWidget.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VolumeGroupWidget.java new file mode 100644 index 0000000000..c253ea9058 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VolumeGroupWidget.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +import org.openecomp.sdc.generator.aai.types.Cardinality; +import org.openecomp.sdc.generator.aai.types.ModelType; +import org.openecomp.sdc.generator.aai.types.ModelWidget; + +@org.openecomp.sdc.generator.aai.types.Model(widget = Widget.Type.VOLUME_GROUP, + cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) +@ModelWidget(type = ModelType.WIDGET, name = "volume-group") +public class VolumeGroupWidget extends Widget { + +} + diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VolumeWidget.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VolumeWidget.java new file mode 100644 index 0000000000..ddf840a822 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/VolumeWidget.java @@ -0,0 +1,33 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +import org.openecomp.sdc.generator.aai.types.Cardinality; +import org.openecomp.sdc.generator.aai.types.Model; +import org.openecomp.sdc.generator.aai.types.ModelType; +import org.openecomp.sdc.generator.aai.types.ModelWidget; + +@Model(widget = Widget.Type.VOLUME, cardinality = Cardinality.UNBOUNDED, dataDeleteFlag = true) +@ModelWidget(type = ModelType.WIDGET, name = "volume") +public class VolumeWidget extends ResourceWidget { + +} + diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/Widget.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/Widget.java new file mode 100644 index 0000000000..6220519a3f --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/model/Widget.java @@ -0,0 +1,196 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.model; + +import static org.openecomp.sdc.generator.data.GeneratorConstants.GENERATOR_AAI_CONFIGLPROP_NOT_FOUND; + +import org.openecomp.sdc.generator.aai.types.ModelType; +import org.openecomp.sdc.generator.aai.types.ModelWidget; +import org.openecomp.sdc.generator.data.ArtifactType; +import org.openecomp.sdc.generator.data.GeneratorConstants; +import org.openecomp.sdc.generator.data.WidgetConfigurationUtil; +import org.openecomp.sdc.generator.error.IllegalAccessException; + +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Properties; +import java.util.Set; + +public abstract class Widget extends Model { + + private Set<String> keys = new HashSet<>(); + + /** + * Gets widget. + * + * @param type the type + * @return the widget + */ + public static Widget getWidget(Type type) { + + switch (type) { + case SERVICE: + return new ServiceWidget(); + case VF: + return new VfWidget(); + case VFC: + return new VfcWidget(); + case VSERVER: + return new VServerWidget(); + case VOLUME: + return new VolumeWidget(); + case FLAVOR: + return new FlavorWidget(); + case TENANT: + return new TenantWidget(); + case VOLUME_GROUP: + return new VolumeGroupWidget(); + case LINT: + return new LIntfWidget(); + case L3_NET: + return new L3NetworkWidget(); + case VFMODULE: + return new VfModuleWidget(); + case IMAGE: + return new ImageWidget(); + case OAM_NETWORK: + return new OamNetwork(); + case ALLOTTED_RESOURCE: + return new AllotedResourceWidget(); + case TUNNEL_XCONNECT: + return new TunnelXconnectWidget(); + default: + return null; + } + + } + + /** + * Gets id. + * + * @return the id + */ + public String getId() { + Properties properties = WidgetConfigurationUtil.getConfig(); + String id = properties.getProperty(ArtifactType.AAI.name() + ".model-version-id." + getName()); + if (id == null) { + throw new IllegalArgumentException(String.format(GENERATOR_AAI_CONFIGLPROP_NOT_FOUND, + ArtifactType.AAI.name() + ".model-version-id." + getName())); + } + return id; + } + + public ModelType getType() { + ModelWidget widgetModel = this.getClass().getAnnotation(ModelWidget.class); + return widgetModel.type(); + } + + public String getName() { + ModelWidget widgetModel = this.getClass().getAnnotation(ModelWidget.class); + return widgetModel.name(); + } + + /** + * Get Widget Id from properties file. + * @return - Widget Id + */ + public String getWidgetId() { + Properties properties = WidgetConfigurationUtil.getConfig(); + String id = properties.getProperty(ArtifactType.AAI.name() + ".model-invariant-id." + + getName()); + if (id == null) { + throw new IllegalArgumentException(String.format(GENERATOR_AAI_CONFIGLPROP_NOT_FOUND, + ArtifactType.AAI.name() + ".model-invariant-id." + getName())); + } + return id; + } + + public int hashCode() { + return getId().hashCode(); + } + + @Override + public Type getWidgetType() { + return null; + } + + /** + * Equals. + * + * @param obj Object + * @return the boolean + */ + public boolean equals(Object obj) { + if (obj instanceof Widget) { + if (getId().equals(((Widget) obj).getId())) { + ((Widget) obj).keys.addAll(this.keys); + return true; + } + return false; + } else { + return false; + } + } + + public void addKey(String key) { + this.keys.add(key); + } + + /** + * Member of boolean. + * + * @param keys the keys + * @return the boolean + */ + public boolean memberOf(List<String> keys) { + if (keys == null) { + return false; + } + return !Collections.disjoint(this.keys, keys); + } + + /** + * All instances used boolean. + * + * @param collection the collection + * @return the boolean + */ + public boolean allInstancesUsed(Set<String> collection) { + Set<String> keyCopy = new HashSet<>(keys); + keyCopy.removeAll(collection); + return keyCopy.isEmpty(); + } + + public boolean addResource(Resource resource) { + throw new IllegalAccessException(GeneratorConstants + .GENERATOR_AAI_ERROR_UNSUPPORTED_WIDGET_OPERATION); + } + + public boolean addWidget(Widget widget) { + return true; + } + + public enum Type { + SERVICE, VF, VFC, VSERVER, VOLUME, FLAVOR, TENANT, VOLUME_GROUP, LINT, L3_NET, VFMODULE, IMAGE, + OAM_NETWORK,ALLOTTED_RESOURCE,TUNNEL_XCONNECT + } +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/tosca/CapabilityAssignment.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/tosca/CapabilityAssignment.java new file mode 100644 index 0000000000..919d5176db --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/tosca/CapabilityAssignment.java @@ -0,0 +1,45 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.tosca; + +import java.util.Map; + +public class CapabilityAssignment { + + private Map<String, Object> properties; + private Map<String, Object> attributes; + + public Map<String, Object> getProperties() { + return properties; + } + + public void setProperties(Map<String, Object> properties) { + this.properties = properties; + } + + public Map<String, Object> getAttributes() { + return attributes; + } + + public void setAttributes(Map<String, Object> attributes) { + this.attributes = attributes; + } +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/tosca/GroupDefinition.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/tosca/GroupDefinition.java new file mode 100644 index 0000000000..7457929bf4 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/tosca/GroupDefinition.java @@ -0,0 +1,73 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.tosca; + +import java.util.List; +import java.util.Map; + +public class GroupDefinition { + + private String type; + private String description; + private Map<String, Object> properties; + private List<String> members; + private Map<String, String> metadata; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Map<String, Object> getProperties() { + return properties; + } + + public void setProperties(Map<String, Object> properties) { + this.properties = properties; + } + + public List<String> getMembers() { + return members; + } + + public void setMembers(List<String> members) { + this.members = members; + } + + public Map<String, String> getMetadata() { + return metadata; + } + + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/tosca/NodeTemplate.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/tosca/NodeTemplate.java new file mode 100644 index 0000000000..330020ba22 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/tosca/NodeTemplate.java @@ -0,0 +1,82 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.tosca; + +import java.util.List; +import java.util.Map; + +public class NodeTemplate { + + private String type; + private String description; + private Map<String, String> metadata; + private Map<String, Object> properties; + private List<Map<String, RequirementAssignment>> requirements; + private Map<String, CapabilityAssignment> capabilities; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Map<String, Object> getProperties() { + return properties; + } + + public void setProperties(Map<String, Object> properties) { + this.properties = properties; + } + + public List<Map<String, RequirementAssignment>> getRequirements() { + return requirements; + } + + public void setRequirements(List<Map<String, RequirementAssignment>> requirements) { + this.requirements = requirements; + } + + public Map<String, CapabilityAssignment> getCapabilities() { + return capabilities; + } + + public void setCapabilities(Map<String, CapabilityAssignment> capabilities) { + this.capabilities = capabilities; + } + + public Map<String, String> getMetadata() { + return metadata; + } + + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/tosca/RequirementAssignment.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/tosca/RequirementAssignment.java new file mode 100644 index 0000000000..38c89827bc --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/tosca/RequirementAssignment.java @@ -0,0 +1,53 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.tosca; + +public class RequirementAssignment { + + private String capability; + private String node; + private String relationship; + + public String getCapability() { + return capability; + } + + public void setCapability(String capability) { + this.capability = capability; + } + + public String getNode() { + return node; + } + + public void setNode(String node) { + this.node = node; + } + + public String getRelationship() { + return relationship; + } + + public void setRelationship(String relationship) { + this.relationship = relationship; + } + +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/tosca/TopologyTemplate.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/tosca/TopologyTemplate.java new file mode 100644 index 0000000000..572e105133 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/tosca/TopologyTemplate.java @@ -0,0 +1,71 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.tosca; + +import java.util.HashMap; +import java.util.Map; +import java.util.Objects; + +public class TopologyTemplate { + + private String description; + private Map<String, NodeTemplate> node_templates; + private Map<String, GroupDefinition> groups; + + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public Map<String, GroupDefinition> getGroups() { + return groups; + } + + public void setGroups(Map<String, GroupDefinition> groups) { + this.groups = groups; + } + + public Map<String, NodeTemplate> getNode_templates() { + return node_templates; + } + + public void setNode_templates(Map<String, NodeTemplate> node_templates) { + this.node_templates = node_templates; + } + + /** + * Add group. + * + * @param groupKey the group key + * @param groupDefinition the group definition + */ + public void addGroup(String groupKey, GroupDefinition groupDefinition) { + if (Objects.isNull(this.groups)) { + this.groups = new HashMap<>(); + } + this.groups.put(groupKey, groupDefinition); + } + +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/tosca/ToscaTemplate.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/tosca/ToscaTemplate.java new file mode 100644 index 0000000000..bd045b89c2 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/tosca/ToscaTemplate.java @@ -0,0 +1,82 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.tosca; + +import java.util.Map; + +public class ToscaTemplate { + private String toscaDefinitionsVersion; + private Map<String, String> metadata; + private String description; + private TopologyTemplate topology_template; + + public String getToscaDefinitionsVersion() { + return toscaDefinitionsVersion; + } + + public void setToscaDefinitionsVersion(String toscaDefinitionsVersion) { + this.toscaDefinitionsVersion = toscaDefinitionsVersion; + } + + public Map<String, String> getMetadata() { + return metadata; + } + + public void setMetadata(Map<String, String> metadata) { + this.metadata = metadata; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public TopologyTemplate getTopology_template() { + return topology_template; + } + + public void setTopology_template(TopologyTemplate topology_template) { + this.topology_template = topology_template; + } + + /** + * Is Service. + * + * @return the boolean + */ + public boolean isService() { + return metadata.containsKey("serviceUUID") + || ("Service".equalsIgnoreCase(metadata.get("Type")) + || ("Service".equalsIgnoreCase(metadata.get("type")))); + } + + public String getModelId() { + return metadata.get("invariantUUID"); + } + + public String getModelVersionId() { + return metadata.get("UUID"); + } + +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/types/Cardinality.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/types/Cardinality.java new file mode 100644 index 0000000000..4aa967b730 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/types/Cardinality.java @@ -0,0 +1,26 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.types; + +public enum Cardinality { + + UNBOUNDED +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/types/Model.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/types/Model.java new file mode 100644 index 0000000000..5fdadf40b3 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/types/Model.java @@ -0,0 +1,55 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.types; + +import org.openecomp.sdc.generator.aai.model.Widget; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface Model { + + /** + * Widget widget . type. + * + * @return the widget . type + */ + public Widget.Type widget(); + + /** + * Data delete flag boolean. + * + * @return the boolean + */ + public boolean dataDeleteFlag(); + + /** + * Cardinality cardinality. + * + * @return the cardinality + */ + public Cardinality cardinality(); + +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/types/ModelType.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/types/ModelType.java new file mode 100644 index 0000000000..e607b6a705 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/types/ModelType.java @@ -0,0 +1,47 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.types; + +public enum ModelType { + SERVICE, RESOURCE, WIDGET; + + /** + * Gets model type. + * + * @param modelType the model type + * @return the model type + */ + public static ModelType getModelType(String modelType) { + if (modelType != null) { + switch (modelType.toLowerCase()) { + case "service": + return SERVICE; + case "resource": + return RESOURCE; + case "widget": + return WIDGET; + default: + return null; + } + } + return null; + } +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/types/ModelWidget.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/types/ModelWidget.java new file mode 100644 index 0000000000..71dbd5ef46 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/aai/types/ModelWidget.java @@ -0,0 +1,46 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.aai.types; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface ModelWidget { + + /** + * Type model type. + * + * @return the model type + */ + public ModelType type(); + + /** + * Name string. + * + * @return the string + */ + public String name(); + +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/AdditionalParams.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/AdditionalParams.java new file mode 100644 index 0000000000..2ec90cee5f --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/AdditionalParams.java @@ -0,0 +1,39 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.data; + + +public enum AdditionalParams { + ServiceVersion("serviceVersion"); + + private String name; + + AdditionalParams(String name) { + this.name = name; + } + + public String getName() { + return name; + } +} + + + diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/Artifact.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/Artifact.java new file mode 100644 index 0000000000..a6fd487558 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/Artifact.java @@ -0,0 +1,96 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.data; + +public class Artifact { + + String name; + String type; + String groupType; + String description; + String label; + String version; + String checksum; + byte[] payload; + + /** + * Instantiates a new Artifact. + * + * @param type the type + * @param groupType the group type + * @param checksum the checksum + * @param payload the payload + */ + public Artifact(String type, String groupType, String checksum, byte[] payload) { + this.type = type; + this.groupType = groupType; + this.checksum = checksum; + this.payload = payload; + } + + public byte[] getPayload() { + return payload; + } + + public String getChecksum() { + return checksum; + } + + public String getType() { + return type; + } + + public String getGroupType() { + return groupType; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getVersion() { + return version; + } + + public void setVersion(String version) { + this.version = version; + } +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/ArtifactType.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/ArtifactType.java new file mode 100644 index 0000000000..d6585c1e55 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/ArtifactType.java @@ -0,0 +1,27 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.data; + +public enum ArtifactType { + OTHER, + AAI, + MODEL_INVENTORY_PROFILE +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/GenerationData.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/GenerationData.java new file mode 100644 index 0000000000..4c17924162 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/GenerationData.java @@ -0,0 +1,70 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.data; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +public class GenerationData { + + List<Artifact> resultData = new ArrayList<>(); + Map<String, List<String>> errorData = new HashMap<>(); + + public void add(List<Artifact> resultData, Map<String, List<String>> errorData) { + this.resultData.addAll(resultData); + this.errorData.putAll(errorData); + } + + + public void add(Artifact generatedArtifact) { + resultData.add(generatedArtifact); + } + + /** + * Add. + * + * @param generatorId the generator id + * @param errorCode the error code + */ + public void add(String generatorId, String errorCode) { + List<String> errorIds; + if ((errorIds = errorData.get(generatorId)) == null) { + errorIds = new ArrayList<>(); + errorData.put(generatorId, errorIds); + } + errorIds.add(errorCode); + } + + public void add(GenerationData generationData) { + this.resultData.addAll(generationData.resultData); + this.errorData.putAll(generationData.errorData); + } + + public List<Artifact> getResultData() { + return resultData; + } + + public Map<String, List<String>> getErrorData() { + return errorData; + } +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/GeneratorConfiguration.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/GeneratorConfiguration.java new file mode 100644 index 0000000000..7a6a897761 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/GeneratorConfiguration.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.data; + +import java.util.List; + +public class GeneratorConfiguration { + + private List<ArtifactType> artifactTypes = null; + + public List<ArtifactType> getArtifactTypes() { + return artifactTypes; + } + + public void setArtifactTypes(List<ArtifactType> artifactTypes) { + this.artifactTypes = artifactTypes; + } +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/GeneratorConstants.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/GeneratorConstants.java new file mode 100644 index 0000000000..b606e0d86a --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/GeneratorConstants.java @@ -0,0 +1,129 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.data; + +public class GeneratorConstants { + + public static final String GENERATOR_AAI_GENERATED_ARTIFACT_EXTENSION = "xml"; + + //Error codes + public static final String GENERATOR_INVOCATION_ERROR_CODE = + "ARTIFACT_GENERATOR_INVOCATION_ERROR"; + + + //Error Constants + public static final String GENERATOR_ERROR_INVALID_CLIENT_CONFIGURATION = + "Invalid Client Configuration"; + public static final String GENERATOR_ERROR_ARTIFACT_GENERATION_FAILED = + "Unable to generate artifacts for the provided input"; + public static final String GENERATOR_ERROR_SERVICE_INSTANTIATION_FAILED = + "Artifact Generation Service Instantiation failed"; + + //AAI Generator Error Messages + public static final String GENERATOR_AAI_ERROR_CHECKSUM_MISMATCH = + "Checksum Mismatch for file : %s"; + public static final String GENERATOR_AAI_ERROR_INVALID_TOSCA = + "Invalid format for Tosca YML : %s"; + public static final String GENERATOR_AAI_ERROR_MANDATORY_METADATA_DEFINITION = + "Invalid Service/Resource definition mandatory attribute <%s> missing in Artifact: <%s>"; + public static final String GENERATOR_AAI_ERROR_INVALID_ID = + "Invalid value for mandatory attribute <%s> in Artifact: <%s>"; + public static final String GENERATOR_AAI_ERROR_UNSUPPORTED_WIDGET_OPERATION = + "Operation Not Supported for Widgets"; + public static final String GENERATOR_AAI_ERROR_MISSING_SERVICE_TOSCA = + "Service tosca missing from list of input artifacts"; + public static final String GENERATOR_AAI_ERROR_NULL_RESOURCE_VERSION_IN_SERVICE_TOSCA = + "Invalid Service definition mandatory attribute version missing for resource with UUID: <%s>"; + + public static final String GENERATOR_AAI_ERROR_INVALID_RESOURCE_VERSION_IN_SERVICE_TOSCA = + "Cannot generate artifacts. Invalid Resource version in Service tosca for resource with " + + "UUID: " + + "<%s>"; + public static final String GENERATOR_AAI_ERROR_MISSING_RESOURCE_TOSCA = + "Cannot generate artifacts. Resource Tosca missing for resource with UUID: <%s>"; + + public static final String GENERATOR_AAI_ERROR_MISSING_SERVICE_VERSION = + "Cannot generate artifacts. Service version is not specified"; + + public static final String GENERATOR_AAI_INVALID_SERVICE_VERSION = + "Cannot generate artifacts. Service version is incorrect"; + + //Logging constants + public static final String REQUEST_ID = "uuid"; + public static final String SERVICE_INSTANCE_ID = "serviceInstanceID"; + public static final String PARTNER_NAME = "userId"; + public static final String SERVICE_NAME = "ServiceName"; + public static final String INSTANCE_UUID = "InstanceUUID"; + public static final String REMOTE_HOST = "RemoteHost"; + public static final String CLIENT_IP = "ClientIP"; + public static final String CATEGORY_LOG_LEVEL = "level"; + public static final String STATUS_CODE = "StatusCode"; + public static final String RESPONSE_CODE = "ResponseCode"; + public static final String RESPONSE_DESCRIPTION = "ResponseDescription"; + public static final String ELAPSED_TIME = "ElapsedTime"; + public static final String BEGIN_TIMESTAMP = "BeginTimestamp"; + public static final String TARGET_SERVICE_NAME = "TargetServiceName"; + public static final String TARGET_ENTITY = "TargetEntity"; + public static final String END_TIMESTAMP = "EndTimestamp"; + public static final String ERROR_CATEGORY = "ErrorCategory"; + public static final String ERROR_CODE = "ErrorCode"; + public static final String ERROR_DESCRIPTION = "ErrorDescription"; + public static final String MDC_SDC_INSTANCE_UUID = "SDC_INSTANCE_UUID"; + public static final String SERVICE_METRIC_BEGIN_TIMESTAMP = "SERVICE-METRIC-BEGIN-TIMESTAMP"; + public static final String LOCAL_ADDR = "localAddr"; //map ServerIPAddress from loggingfilter + public static final String BE_FQDN = "beFqdn"; //map ServerFQDN from logging filter + public static final String ARTIFACT_MODEL_INFO = "ARTIFACT_MODEL_INFO"; + + public static final String GENERATOR_ERROR_CODE = "300F"; + public static final String GENERATOR_PARTNER_NAME = "SDC Catalog"; + public static final String GENERATOR_METRICS_TARGET_ENTITY = "SDC Catalog"; + public static final String GENERATOR_METRICS_FAILURE_RESPONSE_CODE = "300E"; + public static final String GENERATOR_METRICS_FAILURE_RESPONSE_DESC = "Artifact generation " + + "failed for artifact type %s"; + public static final String GENERATOR_METRICS_SUCCESS_RESPONSE_CODE = "010"; + public static final String GENERATOR_METRICS_SUCCESS_RESPONSE_DESC = "Artifacts for type %s " + + "were generated successfully"; + public static final String GENERATOR_AUDIT_NO_ARTIFACT_TYPE_RESPONSE_DESC = "No Artifact Type " + + "found" ; + + //AAI Generator Error Messages for Logging + public static final String GENERATOR_AAI_ERROR_INVALID_TOSCA_MSG = + "Invalid format for Tosca YML"; + public static final String GENERATOR_AAI_ERROR_MANDATORY_METADATA_DEFINITION_MSG = + "Invalid Service/Resource definition mandatory attribute"; + public static final String GENERATOR_AAI_ERROR_MISSING_SERVICE_TOSCA_MSG = + "Service tosca missing from list of input artifacts"; + public static final String GENERATOR_ERROR_INVALID_CLIENT_CONFIGURATION_MSG = + "Invalid Client Configuration"; + public static final String GENERATOR_ERROR_ARTIFACT_GENERATION_FAILED_MSG = + "Unable to generate artifacts for the provided input"; + public static final String GENERATOR_AAI_CONFIGFILE_NOT_FOUND = + "Cannot generate artifacts. Artifact Generator Configuration file not found at %s"; + public static final String GENERATOR_AAI_CONFIGLOCATION_NOT_FOUND = + "Cannot generate artifacts. artifactgenerator.config system property not configured"; + public static final String GENERATOR_AAI_CONFIGLPROP_NOT_FOUND = + "Cannot generate artifacts. Widget configuration not found for %s"; + public static final String GENERATOR_AAI_PROVIDING_SERVICE_MISSING = + "Cannot generate artifacts. Providing Service is missing for allotted resource %s"; + public static final String GENERATOR_AAI_PROVIDING_SERVICE_METADATA_MISSING = + "Cannot generate artifacts. Providing Service Metadata is missing for allotted resource %s"; + public static final int ID_LENGTH = 36; +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/GeneratorUtil.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/GeneratorUtil.java new file mode 100644 index 0000000000..080ae54944 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/GeneratorUtil.java @@ -0,0 +1,104 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.data; + +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; +import org.apache.commons.codec.digest.DigestUtils; + +import java.io.IOException; +import java.util.Base64; + +/** + * Utility method class for artifact generation. + */ +public class GeneratorUtil { + /** + * Translate tosca yaml into the provided model class. + * + * @param tosca Tosca file content + * @param classOfT Model class for the translated object + * @param <T> Template parameter for the return object + * @return Object model for the provided tosca yaml file + */ + public static <T> T translateTosca(String tosca, Class<T> classOfT) throws IOException { + T tos; + //changing file + ObjectMapper mapper = new ObjectMapper(new YAMLFactory()); // jackson data-bind + mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + tos = mapper.readValue(tosca, classOfT); + return tos; + } + + /** + * Decodes Base64 encode byte array input. + * + * @param input Base64 encoded byte array + * @return Decoded byte array + */ + public static byte[] decoder(byte[] input) { + if (input != null) { + byte[] output = Base64.getDecoder().decode(input); + return output; + } + return null; + } + + /** + * Encode a byte array input using Base64 encoding. + * + * @param input Input byte array to be encoded + * @return Base64 encoded byte array + */ + public static byte[] encode(byte[] input) { + if (input != null) { + byte[] output = Base64.getEncoder().encode(input); + return output; + } + return null; + } + + /** + * Calculate the checksum for a given input. + * + * @param input Byte array for which the checksum has to be calculated + * @return Calculated checksum of the input byte array + */ + public static String checkSum(byte[] input) { + String checksum = null; + if (input != null) { + checksum = (DigestUtils.md5Hex(input)).toUpperCase(); + } + return checksum; + } + + /** + * Check if string is empty or null. + * + * @param input Input String + * @return true if string is empty/null and false otherwise + */ + public static boolean isEmpty(String input) { + return input == null || input.length() == 0; + } + +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/GroupType.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/GroupType.java new file mode 100644 index 0000000000..f68aaed410 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/GroupType.java @@ -0,0 +1,26 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.data; + +public enum GroupType { + DEPLOYMENT, + OTHER +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/WidgetConfigurationUtil.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/WidgetConfigurationUtil.java new file mode 100644 index 0000000000..dd68544a93 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/data/WidgetConfigurationUtil.java @@ -0,0 +1,36 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.data; + +import java.util.Properties; + +public class WidgetConfigurationUtil { + + private static Properties config ; + + public static Properties getConfig() { + return config; + } + + public static void setConfig(Properties config) { + WidgetConfigurationUtil.config = config; + } +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/error/IllegalAccessException.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/error/IllegalAccessException.java new file mode 100644 index 0000000000..06c4e6df31 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/error/IllegalAccessException.java @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.error; + +public class IllegalAccessException extends RuntimeException { + + public IllegalAccessException(String message) { + super(message); + } + +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/intf/ArtifactGenerator.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/intf/ArtifactGenerator.java new file mode 100644 index 0000000000..0c45436dc7 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/intf/ArtifactGenerator.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.intf; + +import org.openecomp.sdc.generator.data.Artifact; +import org.openecomp.sdc.generator.data.GenerationData; + +import java.util.List; +import java.util.Map; + + +public interface ArtifactGenerator { + + public GenerationData generateArtifact(List<Artifact> input, + Map<String, String> additionalParams); + +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/intf/Generator.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/intf/Generator.java new file mode 100644 index 0000000000..6ccf89cc72 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/intf/Generator.java @@ -0,0 +1,40 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.intf; + +import org.openecomp.sdc.generator.data.ArtifactType; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.TYPE) +@Retention(RetentionPolicy.RUNTIME) +public @interface Generator { + + /** + * Artifact type artifact type. + * + * @return the artifact type + */ + public ArtifactType artifactType(); +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/logging/ArtifactGeneratorLogResponseCode.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/logging/ArtifactGeneratorLogResponseCode.java new file mode 100644 index 0000000000..e0887876b8 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/logging/ArtifactGeneratorLogResponseCode.java @@ -0,0 +1,68 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.logging; + +import java.util.HashMap; +import java.util.Map; + +public enum ArtifactGeneratorLogResponseCode { + INTERNAL_SERVER_ERROR(201), + MISSING_CONFIG_PROPERTIES_FILE(202), + MISSING_SYSTME_PROPERY_CONFIGURATION(203), + MANDATORY_ATTRIBUTE_MISSING(313), + SERVICE_TOSCA_MISSING(314), + INVALID_TOSCA_YAML(315), + INVALID_CLIENT_CONFIGURATION(316), + UNABLE_TO_GENERATE_ARTIFACT(317), + MISSING_WIDGET_CONFIGURATION(318), + INVALID_ID_VALUE(319), + MISSING_SERVICE_VERSION(320), + INVALID_SERVICE_VERSION(321), + MISSING_RESOURCE_VERSION(322), + INVALID_RESOURCE_VERSION(323), + MISSING_PRO_SERVICE(324), + MISSING_PRO_SERVICE_METADATA(325), + RESOURCE_TOSCA_MISSING(326); + + + private static Map<Integer, ArtifactGeneratorLogResponseCode> mapValueToEnum = new HashMap<>(); + + static { + for (ArtifactGeneratorLogResponseCode responseCode : + ArtifactGeneratorLogResponseCode.values()) { + mapValueToEnum.put(responseCode.value, responseCode); + } + } + + private int value; + + ArtifactGeneratorLogResponseCode(int value) { + this.value = value; + } + + public static ArtifactGeneratorLogResponseCode parseValue(int value) { + return mapValueToEnum.get(value); + } + + public int getValue() { + return value; + } +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/logging/CategoryLogLevel.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/logging/CategoryLogLevel.java new file mode 100644 index 0000000000..00a2e4d494 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/logging/CategoryLogLevel.java @@ -0,0 +1,29 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.logging; + +public enum CategoryLogLevel { + INFO, + WARN, + DEBUG, + ERROR, + FATAL +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/logging/StatusCode.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/logging/StatusCode.java new file mode 100644 index 0000000000..201cb973be --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/logging/StatusCode.java @@ -0,0 +1,26 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.logging; + +public enum StatusCode { + COMPLETE, + ERROR +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/logging/annotations/Audit.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/logging/annotations/Audit.java new file mode 100644 index 0000000000..9d32c1d1c0 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/logging/annotations/Audit.java @@ -0,0 +1,34 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.logging.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Indicates a method for auditing during artifact generation. + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface Audit { +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/logging/annotations/Metrics.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/logging/annotations/Metrics.java new file mode 100644 index 0000000000..74083a37f1 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/logging/annotations/Metrics.java @@ -0,0 +1,35 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.logging.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * Indicates a method for metrics recording during artifact generation. + * + */ +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface Metrics { +} diff --git a/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/service/ArtifactGenerationService.java b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/service/ArtifactGenerationService.java new file mode 100644 index 0000000000..c94a851c85 --- /dev/null +++ b/common/openecomp-sdc-artifact-generator-lib/openecomp-sdc-artifact-generator-api/src/main/java/org/openecomp/sdc/generator/service/ArtifactGenerationService.java @@ -0,0 +1,80 @@ +/*- + * ============LICENSE_START======================================================= + * SDC + * ================================================================================ + * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * ================================================================================ + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ============LICENSE_END========================================================= + */ + +package org.openecomp.sdc.generator.service; + +import static org.openecomp.sdc.generator.data.GeneratorConstants.ERROR_CATEGORY; +import static org.openecomp.sdc.generator.data.GeneratorConstants.ERROR_CODE; +import static org.openecomp.sdc.generator.data.GeneratorConstants.ERROR_DESCRIPTION; +import static org.openecomp.sdc.generator.data.GeneratorConstants.GENERATOR_ERROR_CODE; +import static org.openecomp.sdc.generator.data.GeneratorConstants.GENERATOR_ERROR_SERVICE_INSTANTIATION_FAILED; +import static org.openecomp.sdc.generator.data.GeneratorConstants.GENERATOR_PARTNER_NAME; +import static org.openecomp.sdc.generator.data.GeneratorConstants.PARTNER_NAME; + +import org.openecomp.core.logging.api.Logger; +import org.openecomp.core.logging.api.LoggerFactory; +import org.openecomp.sdc.generator.data.Artifact; +import org.openecomp.sdc.generator.data.GenerationData; +import org.openecomp.sdc.generator.logging.CategoryLogLevel; +import org.slf4j.MDC; + +import java.io.PrintWriter; +import java.io.StringWriter; +import java.util.Arrays; +import java.util.List; +import java.util.Map; + + +/** + * Artifact Generation Service interface. + */ +public interface ArtifactGenerationService { + + + /** + * Method to get artifact generation service implementation. + * + * @return Artifact generation implementation instance + */ + public static ArtifactGenerationService lookup() { + + Logger log = LoggerFactory.getLogger(ArtifactGenerationService.class.getName()); + log.debug("Instantiating Artifact Generation Service"); + try { + return ArtifactGenerationService.class.cast( + Class.forName("org.openecomp.sdc.generator.impl.ArtifactGenerationServiceImpl") + .newInstance()); + } catch (Exception exception) { + MDC.put(PARTNER_NAME, GENERATOR_PARTNER_NAME); + MDC.put(ERROR_CATEGORY, CategoryLogLevel.ERROR.name()); + MDC.put(ERROR_CODE, GENERATOR_ERROR_CODE); + MDC.put(ERROR_DESCRIPTION, GENERATOR_ERROR_SERVICE_INSTANTIATION_FAILED); + StringWriter sw = new StringWriter(); + exception.printStackTrace(new PrintWriter(sw)); + log.error(sw.toString()); + } + log.debug(GENERATOR_ERROR_SERVICE_INSTANTIATION_FAILED); + return null; + } + + public GenerationData generateArtifact(List<Artifact> input, String overridingConfiguration, + Map<String, String> additionalParams); + +} |