From 192fb69a5cadfb2a7038bff87c0a0645a7fd1c3e Mon Sep 17 00:00:00 2001 From: Lukas Harzenetter Date: Thu, 26 Nov 2020 15:52:48 +0100 Subject: [PATCH] Add project RADON extensions Signed-off-by: Lukas Harzenetter Co-authored-by: Michael Wurster Co-authored-by: Felix Burk Co-authored-by: Vladimir Yussupov Co-authored-by: Nick Fode Co-authored-by: Clemens Lieb Co-authored-by: Tobias Mathony Co-authored-by: Karoline Saatkamp Co-authored-by: Karoline Saatkamp karoline.saatkamp@iaas.uni-stuttgart.de --- .idea/runConfigurations/Winery_Server.xml | 6 +- .mvn/extensions.xml | 22 + .mvn/settings.xml | 36 + Dockerfile | 3 + NOTICE | 4 +- checkstyle-suppressions.xml | 1 + deploy/che/devfile-full-pvc.yml | 98 ++ ...file-with-content.yml => devfile-full.yml} | 4 + deploy/che/winery-pvc.yaml | 75 + deploy/che/winery.yaml | 4 + docker/docker-entrypoint.sh | 8 + docker/winery.yml.tpl | 2 + org.eclipse.winery.accountability/pom.xml | 18 +- ...ountabilityManagerImplIntegrationTest.java | 9 +- .../AccountabilityManagerImplTest.java | 22 +- .../src/test/resources/Tosca.meta | 2 +- .../pom.xml | 9 +- .../winery/bpmn2bpel/BPMN4Tosca2BpelTest.java | 33 +- .../bpmn2bpel/BpelPlanArtefactWriterTest.java | 2 +- org.eclipse.winery.cli/pom.xml | 13 +- org.eclipse.winery.common/.gitignore | 14 - org.eclipse.winery.common/about.html | 150 -- .../about_files/Apache-LICENSE-2.0.txt | 202 --- .../about_files/CDDL-v1.1.txt | 129 -- .../about_files/LICENSE-logback.txt | 15 - .../about_files/LICENSE-slf4j-api.txt | 21 - org.eclipse.winery.common/pom.xml | 42 +- .../sonar-project.properties | 31 - .../src/main/java/META-INF/MANIFEST.MF | 3 - .../configuration/ConfigurationTestUtils.java | 2 +- .../common/configuration/Environment.java | 4 +- .../common/configuration/Environments.java | 14 +- .../FileBasedRepositoryConfiguration.java | 3 +- .../RepositoryConfigurationObject.java | 75 +- .../winery/common/version/VersionUtils.java | 164 +- .../src/main/resources/winery.yml | 25 +- .../winery/common/HashingUtilTests.java | 39 + .../winery/common/VersionUtilsTest.java | 74 - .../configuration/EnvironmentsTest.java | 13 + org.eclipse.winery.compliance/pom.xml | 9 +- .../checking/ComplianceRuleChecker.java | 2 +- ...viceTemplateComplianceRuleRuleChecker.java | 6 +- .../checking/ToscaComplianceRuleMatcher.java | 48 +- .../ComplianceRuleCheckerTests.java | 322 ++++ .../compliance/ToscaGraphIsomorphismTest.java | 280 +--- .../winery/compliance/ToscaModelHelper.java | 33 +- .../ToscaModelPropertiesBuilder.java | 123 +- .../model/tosca/utils/ModelUtilitiesTest.java | 6 +- org.eclipse.winery.crawler/pom.xml | 12 +- .../CookbookConfigurationToscaConverter.java | 2 +- org.eclipse.winery.edmm/pom.xml | 74 + .../org/eclipse/winery/edmm}/EdmmManager.java | 17 +- .../org/eclipse/winery/edmm}/EdmmUtils.java | 16 +- .../winery/edmm}/JsonBasedEdmmManager.java | 7 +- .../winery/edmm/model}/EdmmConverter.java | 11 +- .../winery/edmm/model}/EdmmMappingItem.java | 2 +- .../eclipse/winery/edmm/model}/EdmmType.java | 2 +- .../edmm/model}/EdmmTypeProperties.java | 2 +- .../edmm}/toscalight/ToscaLightChecker.java | 16 +- .../edmm}/toscalight/ToscaLightUtils.java | 2 +- .../winery}/edmm/EdmmDependantTest.java | 28 +- .../eclipse/winery/edmm}/EdmmUtilsTest.java | 2 +- .../edmm}/JsonBasedEdmmManagerTest.java | 8 +- .../winery/edmm/model}/EdmmConverterTest.java | 49 +- .../toscalight/ToscaLightCheckerTest.java | 16 +- .../src/app/model/qName.ts} | 34 +- .../src/app/canvas/canvas.component.css | 1 - .../src/app/canvas/canvas.component.html | 20 +- .../src/app/canvas/canvas.component.ts | 259 ++-- .../entities-modal.component.css | 4 + .../entities-modal.component.html | 7 +- .../entities-modal.component.ts | 10 +- .../app/canvas/entities-modal/modal-model.ts | 2 + .../edmmTransformationCheck.service.ts | 1 + .../src/app/enricher/enricher.component.ts | 13 +- .../src/app/enricher/enricher.service.ts | 19 +- .../src/app/enricher/enrichmentEntity.ts | 3 +- .../app/group-view/group-view.component.css | 45 + .../app/group-view/group-view.component.html | 52 + .../app/group-view/group-view.component.ts | 75 + .../policies/policies.component.css | 23 + .../policies/policies.component.html | 46 + .../group-view/policies/policies.component.ts | 66 + .../src/app/models/InheritanceUtils.ts | 113 +- .../src/app/models/UpdateInfo.ts | 5 +- .../src/app/models/entityTypesModel.ts | 4 +- .../topologymodeler/src/app/models/enums.ts | 3 +- .../src/app/models/threatModelingModalData.ts | 2 +- .../models/topologyModelerConfiguration.ts | 2 +- .../src/app/models/topologyTemplateUtil.ts | 55 +- .../src/app/models/toscaUtils.ts} | 24 +- .../src/app/models/ttopology-template.ts | 66 +- .../multi-participants.component.css | 0 .../multi-participants.component.html | 0 .../multi-participants.component.ts | 102 ++ .../src/app/navbar/navbar.component.html | 266 ++-- .../src/app/navbar/navbar.component.ts | 36 +- .../src/app/node/groups/groups.component.css | 52 + .../src/app/node/groups/groups.component.html | 48 + .../src/app/node/groups/groups.component.ts | 67 + .../src/app/node/node.component.css | 14 +- .../src/app/node/node.component.html | 78 +- .../src/app/node/node.component.ts | 48 +- .../app/node/policies/policies.component.html | 18 +- .../app/node/policies/policies.component.ts | 4 + .../toscatype-table.component.html | 7 - .../toscatype-table.component.ts | 26 +- .../src/app/node/versions/update.service.ts | 1 - .../app/node/versions/versions.component.ts | 13 +- .../src/app/palette/palette.component.scss | 5 +- .../assign-participants.component.css | 52 + .../assign-participants.component.html | 42 + .../assign-participants.component.ts | 92 ++ .../manage-participants.component.css | 45 + .../manage-participants.component.html | 36 + .../manage-participants.component.ts | 60 + .../problemDetection.component.ts | 10 +- .../problemDetection.service.ts | 23 +- .../kv-properties.component.html | 44 + .../kv-properties/kv-properties.component.ts | 54 + .../properties-content.component.html | 56 - .../properties-content.component.ts | 108 -- .../app/properties/properties.component.css | 2 +- .../app/properties/properties.component.html | 30 +- .../app/properties/properties.component.ts | 167 +- .../src/app/properties/properties.module.ts | 14 +- .../app/properties/property-constraints.ts | 84 + .../xml-properties.component.html | 23 + .../xml-properties.component.ts | 42 + .../type-conformance-validator.ts | 250 +++ .../typeaware-input.component.html | 27 + .../typeaware-input.component.ts | 127 ++ .../yaml-properties.component.html | 38 + .../yaml-properties.component.ts | 118 ++ .../redux/actions/topologyRenderer.actions.ts | 40 + .../src/app/redux/actions/winery.actions.ts | 89 +- .../reducers/topologyRenderer.reducer.ts | 81 +- .../src/app/redux/reducers/winery.reducer.ts | 154 +- .../src/app/redux/store/winery.store.ts | 4 +- .../src/app/services/backend.service.ts | 654 +++++--- .../src/app/services/che.service.ts | 54 + .../services/multi-participants.service.ts | 67 + .../services/statefulAnnotations.service.ts | 14 +- .../node-details/node-details-sidebar.ts | 34 + .../nodeDetailsSidebar.component.css} | 24 +- .../nodeDetailsSidebar.component.html} | 43 +- .../nodeDetailsSidebar.component.ts} | 173 +-- .../refinementSidebar.component.css | 0 .../refinementSidebar.component.html | 0 .../refinementSidebar.component.ts | 20 +- .../refinementWebSocket.service.ts | 4 +- .../topology-renderer.module.ts | 7 +- .../version-slider.component.ts | 13 +- .../version-slider/version-slider.service.ts | 3 +- .../src/app/winery.component.css | 13 +- .../src/app/winery.component.html | 83 +- .../src/app/winery.component.ts | 272 +--- .../topologymodeler/src/app/winery.module.ts | 29 +- .../src/assets/styles/styles.scss | 24 +- .../app/topologymodeler/src/index.html | 1 + .../app/topologymodeler/src/tsconfig.app.json | 3 +- .../src/app/header/header.component.html | 6 +- .../src/app/header/header.component.ts | 2 +- .../configuration.component.html | 8 +- .../instance/dataTypes/dataTypes.service.ts | 74 + .../src/app/instance/instance.component.css | 18 + .../src/app/instance/instance.component.html | 19 +- .../src/app/instance/instance.component.ts | 1 + .../src/app/instance/instance.service.ts | 13 +- .../instanceHeader.component.css | 4 + .../instanceHeader.component.html | 27 +- .../instanceHeader.component.ts | 28 +- .../capOrReqDef.component.ts | 21 +- .../capOrReqDef.html | 18 +- .../yamlRequirementDefinitions.component.ts | 18 +- .../yamlRequirementDefinitions.service.ts | 5 + .../stayMappings/stayMappings.component.ts | 2 +- .../propertyConstraints.component.ts | 1 - .../propertyMappings.service.ts | 2 +- .../serviceTemplates/plans/plans.service.ts | 2 +- .../selfServicePortal.component.html | 2 + .../threatAssessment.component.ts | 4 +- .../artifacts/artifacts.component.html | 6 +- .../artifacts/artifacts.component.ts | 7 + .../filesTag/files.service.ts | 5 +- .../inheritance/inheritance.component.ts | 15 +- .../interfaceDefinitions.component.ts | 8 +- .../propertiesDefinition.component.html | 143 +- .../propertiesDefinition.component.ts | 360 ++++- .../propertiesDefinition.module.ts | 3 +- .../propertiesDefinitionsResourceApiData.ts | 3 + .../sharedComponents/tag/tag.component.ts | 4 +- .../sharedComponents/tag/tag.service.ts | 5 +- .../validSourceTypes.component.html | 5 +- .../validSourceTypes.component.ts | 53 +- .../validSourceTypes.service.ts | 5 + .../validTargetTypes.component.html | 53 + .../validTargetTypes.component.ts | 50 + .../validTargetTypes.module.ts | 46 + .../visualAppearance.component.css | 7 + .../visualAppearance.component.html | 18 +- .../visualAppearance.component.ts | 16 +- .../wineryArtifacts/artifact.component.html | 1 + .../yaml-constraints.component.css} | 9 +- .../yaml-constraints.component.html | 56 + .../constraints/yaml-constraints.component.ts | 121 ++ .../src/app/model/constraint.ts | 21 +- .../tosca-management/src/app/model/enums.ts | 1 + .../src/app/model/interfaces.ts | 26 +- .../src/app/model/qNameApiData.ts | 4 +- .../src/app/model/subMenuItem.ts | 4 +- .../tosca-management/src/app/model/yaml.ts | 35 + .../src/app/other/other.component.html | 5 + .../src/app/section/section.component.html | 12 +- .../src/app/section/section.module.ts | 2 +- .../src/app/section/section.service.ts | 1 - .../xaasPackager/xaasPackager.component.html | 4 +- .../addComponentData.component.html | 2 +- .../addComponentData.component.ts | 37 +- .../addComponentValidation.ts | 1 + .../wineryComponentExists.component.ts | 5 +- .../wineryDynamicTable.module.ts | 3 +- .../WineryRepositoryConfiguration.service.ts | 12 +- .../wineryRepository.feature.direct.ts | 2 +- .../wineryIoParameter.component.ts | 10 +- .../wineryLicense.component.html | 5 +- .../wineryLicense.component.ts | 10 +- .../wineryLicense.service.ts | 9 +- .../dataTypes/dataType.module.ts | 46 + .../dataTypes/dataTypeRouter.module.ts | 63 + .../nodeTypes/nodeType.module.ts | 2 + .../relationshipType.module.ts | 21 +- .../relationshipTypeRouter.module.ts | 2 + .../winery.modal.component.ts | 6 +- .../wineryNamespaceSelector.component.ts | 15 +- .../src/app/wineryRepository.module.ts | 6 +- .../wineryTable.component.ts | 38 +- .../src/app/wineryUtils/utils.ts | 17 +- .../wineryDuplicateValidator.directive.ts | 6 +- .../src/css/wineryRepository.css | 28 + .../package-lock.json | 13 +- org.eclipse.winery.frontends/package.json | 5 +- org.eclipse.winery.frontends/pom.xml | 2 +- org.eclipse.winery.frontends/tsconfig.json | 2 +- org.eclipse.winery.generators.ia/.gitignore | 9 - org.eclipse.winery.generators.ia/about.html | 164 -- .../about_files/Apache-LICENSE-2.0.txt | 202 --- .../about_files/CDDL-v1.1.txt | 129 -- .../about_files/LICENSE-logback.txt | 15 - .../about_files/LICENSE-slf4j-api.txt | 21 - org.eclipse.winery.generators.ia/pom.xml | 10 +- .../winery/generators/ia/Generator.java | 3 +- .../main/resources/template/project/pom.xml | 13 +- .../.gitignore | 10 - .../about.html | 136 -- .../about_files/Apache-LICENSE-2.0.txt | 202 --- .../about_files/LICENSE-logback.txt | 15 - .../about_files/LICENSE-slf4j-api.txt | 21 - .../notice.html | 9 - org.eclipse.winery.highlevelrestapi/pom.xml | 3 +- org.eclipse.winery.model.adaptation/pom.xml | 16 +- .../adaptation/enhance/EnhancementUtils.java | 43 +- .../adaptation/placement/PlacementUtils.java | 10 +- .../AbstractSecureProxyAlgorithm.java | 2 +- .../algorithms/IpSecAlgorithm.java | 2 +- .../substitution/AbstractSubstitution.java | 10 +- .../FindFirstSubstitutionStrategy.java | 3 +- .../NamespaceSubstitutionStrategy.java | 3 +- .../adaptation/substitution/Substitution.java | 6 +- .../substitution/SubstitutionUtils.java | 3 +- .../refinement/AbstractRefinement.java | 30 +- .../refinement/DefaultRefinementChooser.java | 2 +- .../refinement/PermutationGenerator.java | 31 +- .../refinement/RefinementCandidate.java | 2 +- .../refinement/RefinementChooser.java | 2 +- .../refinement/RefinementUtils.java | 22 +- .../patterns/PatternRefinement.java | 2 +- .../refinement/tests/TestRefinement.java | 6 +- .../TopologyFragmentRefinement.java | 69 +- ...ementUtilsTestWithGitBackedRepository.java | 17 +- .../algorithms/IpSecAlgorithmTest.java | 2 +- .../SecureContainerProxyAlgorithmTest.java | 2 +- ...bstitutionTestWithGitBackedRepository.java | 2 +- .../substitution/SubstitutionUtilsTest.java | 7 +- ...utionUtilsTestWithGitBackedRepository.java | 4 +- .../refinement/AbstractRefinementTest.java | 118 +- .../refinement/PermutationGeneratorTest.java | 18 +- ...nGeneratorTestWithGitBackedRepository.java | 6 +- .../refinement/PermutationHelper.java | 511 +++--- .../patterns/PatternRefinementTest.java | 85 +- ...RefinementTestWithGitBackedRepository.java | 2 +- .../refinement/tests/TestRefinementTest.java | 64 +- org.eclipse.winery.model.bpmn4tosca/pom.xml | 2 +- .../about.html | 106 -- .../about_files/Apache-LICENSE-2.0.txt | 202 --- .../about_files/LICENSE-logback.txt | 15 - .../about_files/LICENSE-slf4j-api.txt | 21 - .../notice.html | 9 - .../pom.xml | 6 +- .../about.html | 34 - .../notice.html | 9 - org.eclipse.winery.model.selfservice/pom.xml | 9 +- .../pom.xml | 24 +- .../model/threatmodeling/ThreatModeling.java | 12 +- .../threatmodeling/ThreatModelingUtils.java | 81 +- ...atModelingTestWithGitBackedRepository.java | 9 +- ...lingUtilsWithGitBackendRepositoryTest.java | 14 +- .../.gitignore | 8 - .../winery/model/tosca/yaml/TGroupType.java | 302 ---- .../model/tosca/yaml/visitor/IVisitor.java | 99 -- org.eclipse.winery.model.tosca/.gitignore | 8 - org.eclipse.winery.model.tosca/about.html | 51 - org.eclipse.winery.model.tosca/notice.html | 9 - .../kvproperties/AttributeDefinitionList.java | 38 - .../kvproperties/ParameterDefinitionList.java | 38 - .../PropertyDefinitionKVList.java | 33 - .../.editorconfig | 0 .../.gitignore | 0 .../pom.xml | 63 + .../model}/converter/support/Defaults.java | 6 +- .../model}/converter/support/Namespaces.java | 6 +- .../support/exception/ExceptionHierarchy.yml | 0 .../converter/support/exception/Invalid.java | 2 +- .../support/exception/InvalidDefinition.java | 2 +- .../support/exception/InvalidField.java | 2 +- .../support/exception/InvalidParentType.java | 2 +- .../support/exception/InvalidSyntax.java | 2 +- .../support/exception/InvalidToscaSyntax.java | 4 +- .../exception/InvalidToscaVersion.java | 4 +- .../support/exception/InvalidType.java | 2 +- .../support/exception/InvalidTypeExtend.java | 2 +- .../support/exception/InvalidYamlSyntax.java | 2 +- .../support/exception/MultiException.java | 4 +- .../support/exception/Undefined.java | 2 +- .../exception/UndefinedDefinition.java | 2 +- .../support/exception/UndefinedField.java | 2 +- .../support/exception/UndefinedFile.java | 2 +- .../support/exception/UndefinedImport.java | 2 +- .../support/exception/UndefinedPrefix.java | 2 +- .../exception/UndefinedRequiredKeyname.java | 2 +- .../exception/UndefinedToscaVersion.java | 2 +- .../support/exception/UndefinedType.java | 2 +- .../exception/YAMLParserException.java | 2 +- .../converter/support/xml/TypeConverter.java | 4 +- .../winery/model/ids/EncodingUtil.java | 37 + .../eclipse/winery/model}/ids/GenericId.java | 6 +- .../eclipse/winery/model}/ids/IdNames.java | 4 +- .../org/eclipse/winery/model}/ids/IdUtil.java | 79 +- .../eclipse/winery/model}/ids/Namespace.java | 6 +- .../model/ids}/StringEncodedAndDecoded.java | 8 +- .../org/eclipse/winery/model}/ids/XmlId.java | 4 +- .../model}/ids/admin/AccountabilityId.java | 6 +- .../winery/model}/ids/admin/AdminId.java | 6 +- .../model}/ids/admin/ConstraintTypesId.java | 6 +- .../model}/ids/admin/EdmmMappingsId.java | 6 +- .../winery/model}/ids/admin/NamespacesId.java | 6 +- .../model}/ids/admin/PlanLanguagesId.java | 6 +- .../winery/model}/ids/admin/PlanTypesId.java | 6 +- .../winery/model}/ids/admin/TypesId.java | 4 +- .../ids/definitions/ArtifactTemplateId.java | 6 +- .../ids/definitions/ArtifactTypeId.java | 6 +- .../ids/definitions/CapabilityTypeId.java | 6 +- .../model/ids/definitions/DataTypeId.java | 40 + .../ids/definitions/DefinitionsChildId.java | 30 +- .../ids/definitions/EntityTemplateId.java | 8 +- .../model}/ids/definitions/EntityTypeId.java | 6 +- .../EntityTypeImplementationId.java | 6 +- .../ids/definitions/HasInheritanceId.java | 6 +- .../ids/definitions/InterfaceTypeId.java | 6 +- .../model}/ids/definitions/NodeTypeId.java | 6 +- .../definitions/NodeTypeImplementationId.java | 6 +- .../ids/definitions/PolicyTemplateId.java | 6 +- .../model}/ids/definitions/PolicyTypeId.java | 6 +- .../ids/definitions/RelationshipTypeId.java | 6 +- .../RelationshipTypeImplementationId.java | 6 +- .../ids/definitions/RequirementTypeId.java | 6 +- .../ids/definitions/ServiceTemplateId.java | 6 +- .../TopologyGraphElementEntityTypeId.java | 6 +- .../definitions/imports/GenericImportId.java | 16 +- .../ids/definitions/imports/WsdlImportId.java | 6 +- .../ids/definitions/imports/XSDImportId.java | 6 +- .../model}/ids/definitions/package-info.java | 2 +- .../winery/model}/ids/elements/PlanId.java | 4 +- .../winery/model}/ids/elements/PlansId.java | 6 +- .../model}/ids/elements/ToscaElementId.java | 6 +- .../model}/ids/elements/package-info.java | 2 +- .../ids/extensions}/ComplianceRuleId.java | 13 +- .../extensions}/PatternRefinementModelId.java | 10 +- .../model/ids/extensions}/RefinementId.java | 9 +- .../extensions}/TestRefinementModelId.java | 8 +- .../TopologyFragmentRefinementModelId.java | 6 +- .../model/jaxbsupport/map/BooleanToYesNo.java | 43 + .../jaxbsupport/map/PropertiesAdapter.java | 283 ++++ .../PropertiesDefinitionDeserializer.java | 86 ++ .../PropertiesDefinitionSerializer.java | 66 + .../winery/model/jsonsupport/YesNo.java | 53 + .../org/eclipse/winery/model/tosca/HasId.java | 11 +- .../model/tosca/HasIdInIdOrNameField.java | 6 +- .../winery/model/tosca/HasInheritance.java | 14 +- .../eclipse/winery/model/tosca/HasName.java | 2 +- .../winery/model/tosca/HasPolicies.java | 2 +- .../eclipse/winery/model/tosca/HasTags.java | 0 .../model/tosca/HasTargetNamespace.java | 2 +- .../eclipse/winery/model/tosca/HasType.java | 6 +- .../tosca/RelationshipSourceOrTarget.java | 13 +- .../winery/model/tosca/TAppliesTo.java | 13 +- .../eclipse/winery/model/tosca/TArtifact.java | 12 +- .../model/tosca/TArtifactReference.java | 195 +++ .../winery/model/tosca/TArtifactTemplate.java | 6 +- .../winery/model/tosca/TArtifactType.java | 6 +- .../winery/model/tosca/TArtifacts.java | 5 +- .../model/tosca/TBoundaryDefinitions.java | 17 +- .../winery/model/tosca/TCapability.java | 18 +- .../model/tosca/TCapabilityDefinition.java | 10 +- .../winery/model/tosca/TCapabilityRef.java | 5 +- .../winery/model/tosca/TCapabilityType.java | 10 +- .../winery/model/tosca/TCondition.java | 5 +- .../winery/model/tosca/TConstraint.java | 5 +- .../eclipse/winery/model/tosca/TDataType.java | 134 ++ .../winery/model/tosca/TDefinitions.java | 302 +++- .../model/tosca/TDeploymentArtifact.java | 9 +- .../model/tosca/TDeploymentArtifacts.java | 33 +- .../winery/model/tosca/TDocumentation.java | 5 +- .../winery/model/tosca/TEntityTemplate.java | 397 +++++ .../winery/model/tosca/TEntityType.java | 729 +++++++++ .../tosca/TEntityTypeImplementation.java | 61 +- .../model/tosca/TExportedInterface.java | 23 +- .../model/tosca/TExportedOperation.java | 17 +- .../model/tosca/TExtensibleElements.java | 8 +- .../winery/model/tosca/TExtension.java | 34 +- .../winery/model/tosca/TExtensions.java | 5 +- .../winery/model/tosca/TGroupDefinition.java | 170 ++ .../winery/model/tosca/TGroupType.java | 123 ++ .../winery/model/tosca/TImplementation.java | 4 +- .../model/tosca/TImplementationArtifact.java | 7 +- .../model/tosca/TImplementationArtifacts.java | 11 +- .../eclipse/winery/model/tosca/TImport.java | 37 +- .../winery/model/tosca/TInterface.java | 18 +- .../model/tosca/TInterfaceDefinition.java | 6 +- .../winery/model/tosca/TInterfaceType.java | 26 +- .../winery/model/tosca/TInterfaces.java | 5 +- .../winery/model/tosca/TNodeTemplate.java | 7 +- .../eclipse/winery/model/tosca/TNodeType.java | 10 +- .../model/tosca/TNodeTypeImplementation.java | 37 +- .../winery/model/tosca/TOperation.java | 6 +- .../model/tosca/TOperationDefinition.java | 6 +- .../winery/model/tosca/TParameter.java | 36 +- .../org/eclipse/winery/model/tosca/TPlan.java | 7 +- .../eclipse/winery/model/tosca/TPlans.java | 19 +- .../eclipse/winery/model/tosca/TPolicies.java | 3 +- .../eclipse/winery/model/tosca/TPolicy.java | 9 +- .../winery/model/tosca/TPolicyTemplate.java | 7 +- .../winery/model/tosca/TPolicyType.java | 8 +- .../model/tosca/TPropertyConstraint.java | 5 +- .../model/tosca/TPropertyDefinition.java | 5 +- .../winery/model/tosca/TPropertyMapping.java | 11 +- .../model/tosca/TRelationshipTemplate.java | 37 +- .../winery/model/tosca/TRelationshipType.java | 57 +- .../TRelationshipTypeImplementation.java | 21 +- .../tosca/TRequiredContainerFeature.java | 16 +- .../tosca/TRequiredContainerFeatures.java | 16 +- .../winery/model/tosca/TRequirement.java | 12 +- .../model/tosca/TRequirementDefinition.java | 7 +- .../winery/model/tosca/TRequirementRef.java | 5 +- .../winery/model/tosca/TRequirementType.java | 6 +- .../eclipse/winery/model/tosca/TSchema.java | 177 +++ .../winery/model/tosca/TServiceTemplate.java | 11 +- .../org/eclipse/winery/model/tosca/TTag.java | 7 +- .../org/eclipse/winery/model/tosca/TTags.java | 16 +- .../tosca/TTopologyElementInstanceStates.java | 11 +- .../winery/model/tosca/TTopologyTemplate.java | 92 +- .../model/tosca/constants/Namespaces.java | 4 +- .../tosca/constants/OpenToscaBaseTypes.java | 0 .../tosca/constants/OpenToscaInterfaces.java | 0 .../winery/model/tosca/constants/QNames.java | 4 +- .../model/tosca/constants/ToscaBaseTypes.java | 0 .../tosca/extensions}/OTAttributeMapping.java | 53 +- .../extensions}/OTAttributeMappingType.java | 4 +- .../tosca/extensions}/OTComplianceRule.java | 81 +- .../OTDeploymentArtifactMapping.java | 37 +- .../model/tosca/extensions/OTParticipant.java | 99 ++ .../extensions/OTPatternRefinementModel.java | 47 + .../extensions/OTPermutationMapping.java | 50 + .../model/tosca/extensions}/OTPrmMapping.java | 37 +- .../extensions}/OTPrmModelElementType.java | 4 +- .../tosca/extensions}/OTRefinementModel.java | 75 +- .../extensions}/OTRelationDirection.java | 4 +- .../tosca/extensions}/OTRelationMapping.java | 60 +- .../tosca/extensions}/OTStayMapping.java | 35 +- .../model/tosca/extensions}/OTStringList.java | 35 +- .../extensions}/OTTestRefinementModel.java | 35 +- .../OTTopologyFragmentRefinementModel.java | 88 +- .../kvproperties/AttributeDefinition.java | 6 +- .../kvproperties/ConstraintClauseKV.java | 2 +- .../kvproperties/ParameterDefinition.java | 15 +- .../kvproperties/PropertyDefinitionKV.java | 25 +- .../extensions}/kvproperties/PropertyKV.java | 4 +- .../WinerysPropertiesDefinition.java | 35 +- .../kvproperties/package-info.java | 30 +- .../model/tosca/extensions/package-info.java | 27 + .../winery/model/tosca/package-info.java | 15 +- .../model/tosca/utils/ModelUtilities.java | 150 +- .../model/tosca/utils/RemoveEmptyLists.java | 20 +- .../winery/model/tosca/visitor/Visitor.java | 29 +- .../winery/model}/version/ToscaDiff.java | 14 +- .../winery/model/version/VersionSupport.java | 159 ++ .../definitions/DefinitionsChildIdTest.java | 2 +- .../ids/definitions/NodeTypeIdTest.java | 2 +- .../model/tosca/utils/ModelUtilitiesTest.java | 52 + .../model/version/VersionSupportTest.java | 101 ++ .../README.md | 0 .../pom.xml | 12 +- .../winery/model/tosca/xml/XDefinitions.java | 20 +- .../winery/model/tosca/xml/XHasId.java | 88 ++ .../tosca/xml/XHasIdInIdOrNameField.java | 46 + .../model/tosca/xml/XHasInheritance.java | 32 + .../winery/model/tosca/xml/XHasName.java | 22 + .../winery/model/tosca/xml/XHasPolicies.java | 22 + .../winery/model/tosca/xml/XHasTags.java | 20 + .../model/tosca/xml/XHasTargetNamespace.java | 22 + .../winery/model/tosca/xml/XHasType.java | 48 + .../xml/XRelationshipSourceOrTarget.java | 47 + .../winery/model/tosca/xml/XTAppliesTo.java | 137 ++ .../winery/model/tosca/xml/XTArtifact.java | 121 ++ .../model/tosca/xml/XTArtifactReference.java | 29 +- .../model/tosca/xml/XTArtifactTemplate.java | 204 +++ .../model/tosca/xml/XTArtifactType.java | 100 ++ .../winery/model/tosca/xml/XTArtifacts.java | 72 + .../winery/model/tosca/xml/XTBoolean.java | 12 +- .../tosca/xml/XTBoundaryDefinitions.java | 342 +++++ .../winery/model/tosca/xml/XTCapability.java | 117 ++ .../tosca/xml/XTCapabilityDefinition.java | 257 ++++ .../model/tosca/xml/XTCapabilityRef.java | 104 ++ .../model/tosca/xml/XTCapabilityType.java | 81 + .../winery/model/tosca/xml/XTCondition.java | 107 ++ .../winery/model/tosca/xml/XTConstraint.java | 108 ++ .../winery/model/tosca/xml/XTDefinitions.java | 846 ++++++++++ .../model/tosca/xml/XTDeploymentArtifact.java | 124 ++ .../tosca/xml/XTDeploymentArtifacts.java | 116 ++ .../model/tosca/xml/XTDocumentation.java | 132 ++ .../model/tosca/xml/XTEntityTemplate.java | 192 +-- .../winery/model/tosca/xml/XTEntityType.java | 179 +-- .../tosca/xml/XTEntityTypeImplementation.java | 366 +++++ .../model/tosca/xml/XTExportedInterface.java | 106 ++ .../model/tosca/xml/XTExportedOperation.java | 413 +++++ .../model/tosca/xml/XTExtensibleElements.java | 260 ++++ .../winery/model/tosca/xml/XTExtension.java | 120 ++ .../winery/model/tosca/xml/XTExtensions.java | 69 + .../tosca/xml/XTImplementationArtifact.java | 181 +++ .../tosca/xml/XTImplementationArtifacts.java | 163 ++ .../winery/model/tosca/xml/XTImport.java | 134 ++ .../winery/model/tosca/xml/XTInterface.java | 141 ++ .../winery/model/tosca/xml/XTInterfaces.java | 60 + .../model/tosca/xml/XTNodeTemplate.java | 487 ++++++ .../winery/model/tosca/xml/XTNodeType.java | 319 ++++ .../tosca/xml/XTNodeTypeImplementation.java | 366 +++++ .../winery/model/tosca/xml/XTOperation.java | 265 ++++ .../winery/model/tosca/xml/XTParameter.java | 128 ++ .../winery/model/tosca/xml/XTPlan.java | 434 ++++++ .../winery/model/tosca/xml/XTPlans.java | 121 ++ .../winery/model/tosca/xml/XTPolicies.java | 65 + .../winery/model/tosca/xml/XTPolicy.java | 175 +++ .../model/tosca/xml/XTPolicyTemplate.java | 92 ++ .../winery/model/tosca/xml/XTPolicyType.java | 120 ++ .../model/tosca/xml/XTPropertyConstraint.java | 89 ++ .../model/tosca/xml/XTPropertyMapping.java | 130 ++ .../tosca/xml/XTRelationshipTemplate.java | 354 +++++ .../model/tosca/xml/XTRelationshipType.java | 376 +++++ .../xml/XTRelationshipTypeImplementation.java | 157 ++ .../tosca/xml/XTRequiredContainerFeature.java | 86 ++ .../xml/XTRequiredContainerFeatures.java | 100 ++ .../winery/model/tosca/xml/XTRequirement.java | 166 ++ .../tosca/xml/XTRequirementDefinition.java | 298 ++++ .../model/tosca/xml/XTRequirementRef.java | 106 ++ .../model/tosca/xml/XTRequirementType.java | 96 ++ .../model/tosca/xml/XTServiceTemplate.java | 265 ++++ .../eclipse/winery/model/tosca/xml/XTTag.java | 104 ++ .../winery/model/tosca/xml/XTTags.java | 153 ++ .../xml/XTTopologyElementInstanceStates.java | 153 ++ .../model/tosca/xml/XTTopologyTemplate.java | 230 +++ .../model/tosca/xml/constants/Namespaces.java | 47 + .../xml/constants/OpenToscaBaseTypes.java | 40 + .../xml/constants/OpenToscaInterfaces.java | 22 + .../model/tosca/xml/constants/QNames.java | 28 + .../tosca/xml/constants/TOSCA_xml_1_0.java | 46 + .../tosca/xml/constants/ToscaBaseTypes.java | 24 + .../xml/extensions/XOTAttributeMapping.java | 120 ++ .../extensions/XOTAttributeMappingType.java | 51 + .../xml/extensions/XOTComplianceRule.java | 168 ++ .../XOTDeploymentArtifactMapping.java | 68 + .../extensions/XOTPatternRefinementModel.java | 29 +- .../xml/extensions/XOTPermutationMapping.java | 54 + .../tosca/xml/extensions/XOTPrmMapping.java | 95 ++ .../extensions/XOTPrmModelElementType.java | 51 + .../xml/extensions/XOTRefinementModel.java | 169 ++ .../xml/extensions/XOTRelationDirection.java | 51 + .../xml/extensions/XOTRelationMapping.java | 117 ++ .../tosca/xml/extensions/XOTStayMapping.java | 61 + .../tosca/xml/extensions/XOTStringList.java | 75 + .../extensions/XOTTestRefinementModel.java | 79 + .../XOTTopologyFragmentRefinementModel.java | 180 +++ .../tosca/xml/extensions/package-info.java | 21 + .../winery/model/tosca/xml}/package-info.java | 4 +- .../model/tosca/xml/utils/ModelUtilities.java | 904 +++++++++++ .../tosca/xml/utils/RemoveEmptyLists.java | 88 ++ .../model/tosca/xml/visitor/Visitor.java | 365 +++++ .../src/test/java/.gitkeep | 0 .../xml}/utils/RemoveEmptyListsTest.java | 29 +- ...-xml-test--topology-with-empty-policy.json | 0 .../src/test/resources/logback-test.xml | 0 .../.editorconfig | 0 .../.gitignore | 0 .../LICENSE-ASL.txt | 0 .../LICENSE-EPL.txt | 0 .../README.md | 0 .../pom.xml | 9 +- .../tosca/yaml/YTArtifactDefinition.java | 42 +- .../model/tosca/yaml/YTArtifactType.java | 31 +- .../tosca/yaml/YTAttributeAssignment.java | 24 +- .../tosca/yaml/YTAttributeDefinition.java | 97 +- .../tosca/yaml/YTCapabilityAssignment.java | 52 +- .../tosca/yaml/YTCapabilityDefinition.java | 59 +- .../model/tosca/yaml/YTCapabilityType.java | 28 +- .../model/tosca/yaml/YTConstraintClause.java | 41 +- .../winery/model/tosca/yaml/YTDataType.java | 44 +- .../winery/model/tosca/yaml/YTEntityType.java | 71 +- .../model/tosca/yaml/YTGroupDefinition.java | 94 +- .../winery/model/tosca/yaml/YTGroupType.java | 129 ++ .../model/tosca/yaml/YTImplementation.java | 60 +- .../model/tosca/yaml/YTImportDefinition.java | 34 +- .../tosca/yaml/YTInterfaceAssignment.java | 19 +- .../tosca/yaml/YTInterfaceDefinition.java | 52 +- .../model/tosca/yaml/YTInterfaceType.java | 56 +- .../tosca/yaml/YTNodeFilterDefinition.java | 64 +- .../model/tosca/yaml/YTNodeOrGroupType.java | 15 +- .../model/tosca/yaml/YTNodeTemplate.java | 140 +- .../winery/model/tosca/yaml/YTNodeType.java | 109 +- .../tosca/yaml/YTOperationDefinition.java | 63 +- .../tosca/yaml/YTParameterDefinition.java | 129 +- .../model/tosca/yaml/YTPolicyDefinition.java | 42 +- .../winery/model/tosca/yaml/YTPolicyType.java | 27 +- .../tosca/yaml/YTPropertyAssignment.java | 31 +- .../YTPropertyAssignmentOrDefinition.java | 13 +- .../tosca/yaml/YTPropertyDefinition.java | 168 +- .../yaml/YTPropertyFilterDefinition.java | 37 +- .../tosca/yaml/YTRelationshipAssignment.java | 56 +- .../tosca/yaml/YTRelationshipDefinition.java | 39 +- .../tosca/yaml/YTRelationshipTemplate.java | 72 +- .../model/tosca/yaml/YTRelationshipType.java | 48 +- .../tosca/yaml/YTRepositoryDefinition.java | 30 +- .../tosca/yaml/YTRequirementAssignment.java | 52 +- .../tosca/yaml/YTRequirementDefinition.java | 38 +- .../model/tosca/yaml/YTSchemaDefinition.java | 95 +- .../model/tosca/yaml/YTServiceTemplate.java | 215 ++- .../model/tosca/yaml/YTStatusValue.java | 15 +- .../tosca/yaml/YTSubstitutionMappings.java | 56 +- .../yaml/YTTopologyTemplateDefinition.java | 170 +- .../winery/model/tosca/yaml/YTVersion.java | 34 +- .../model/tosca/yaml/support/Annotations.java | 6 + .../model/tosca/yaml/support/Defaults.java | 0 .../model/tosca/yaml/support/Metadata.java | 0 .../model/tosca/yaml/support/ValueHelper.java | 9 +- .../tosca/yaml/support/YTListString.java | 20 +- .../yaml/support/YTMapImportDefinition.java | 36 +- .../model/tosca/yaml/support/YTMapObject.java | 16 +- .../yaml/support/YTMapPolicyDefinition.java | 36 +- .../YTMapPropertyFilterDefinition.java | 34 +- .../support/YTMapRequirementAssignment.java | 36 +- .../support/YTMapRequirementDefinition.java | 36 +- .../yaml/tosca/datatypes/Credential.java | 0 .../tosca/yaml/visitor/AbstractParameter.java | 0 .../tosca/yaml/visitor/AbstractResult.java | 0 .../tosca/yaml/visitor/AbstractVisitor.java | 163 +- .../model/tosca/yaml/visitor/IParameter.java | 0 .../model/tosca/yaml/visitor/IResult.java | 0 .../model/tosca/yaml/visitor/IVisitor.java | 99 ++ .../model/tosca/yaml/visitor/VisitorNode.java | 0 .../src/test/java/.gitkeep | 0 .../src/test/resources/logback-test.xml | 0 org.eclipse.winery.model/pom.xml | 52 + .../.gitignore | 14 - .../de.loskutov.anyedit.AnyEditTools.prefs | 16 - .../about.html | 321 ---- .../about_files/Apache-LICENSE-2.0.txt | 202 --- .../about_files/CDDL-v1.1.txt | 129 -- .../about_files/LICENSE-logback.txt | 15 - .../about_files/LICENSE-slf4j-api.txt | 21 - org.eclipse.winery.repository.client/pom.xml | 24 +- .../client/WineryRepositoryClient.java | 29 +- .../beans/NamespaceIdOptionalName.java | 4 +- .../client/TestWineryRepositoryClient.java | 5 +- org.eclipse.winery.repository.rest/.gitignore | 26 - .../de.loskutov.anyedit.AnyEditTools.prefs | 16 - org.eclipse.winery.repository.rest/about.html | 1124 -------------- .../about_files/Apache-LICENSE-2.0.txt | 202 --- .../about_files/CDDL-v1.1.txt | 129 -- .../about_files/LICENSE-ASM.txt | 29 - .../about_files/LICENSE-EDL.txt | 13 - .../about_files/LICENSE-EPL.txt | 227 --- .../about_files/LICENSE-JSch.txt | 30 - .../about_files/LICENSE-KeyboardJS.txt | 25 - .../about_files/LICENSE-XMLWriter.txt | 27 - .../about_files/LICENSE-biltong.txt | 22 - .../about_files/LICENSE-boostrap.txt | 21 - .../about_files/LICENSE-bootstrap-switch.txt | 176 --- .../LICENSE-bootstrap-touchspin.txt | 202 --- .../LICENSE-bootstrap3-wysihtml5-bower.txt | 9 - .../about_files/LICENSE-colorPicker.txt | 22 - .../about_files/LICENSE-datatables.txt | 10 - .../about_files/LICENSE-handlebars.txt | 19 - .../about_files/LICENSE-jQuery-UI.txt | 26 - .../about_files/LICENSE-jQuery.txt | 21 - .../about_files/LICENSE-jsPlumb-MIT.txt | 20 - .../about_files/LICENSE-logback.txt | 15 - .../about_files/LICENSE-open-sans.txt | 204 --- .../about_files/LICENSE-requirejs.txt | 58 - .../about_files/LICENSE-slf4j-api.txt | 21 - .../about_files/LICENSE-slf4j-ext.txt | 24 - .../about_files/LICENSE-wysihtml5.txt | 9 - .../about_files/LICENSE-x-editable.txt | 22 - .../about_files/LICENSE-xmltree.txt | 21 - .../about_files/MPL-v1.1.txt | 470 ------ .../about_files/file-icons.txt | 27 - org.eclipse.winery.repository.rest/bower.json | 65 - org.eclipse.winery.repository.rest/pom.xml | 41 +- .../sonar-project.java.properties | 30 - .../sonar-project.twomodules.properties | 35 - .../eclipse/winery/repository/rest/Prefs.java | 31 +- .../winery/repository/rest/RestUtils.java | 93 +- .../rest/datatypes/ComponentId.java | 8 +- .../repository/rest/datatypes/FileMeta.java | 2 +- .../rest/datatypes/LocalNameForAngular.java | 8 +- ...mespaceAndDefinedLocalNamesForAngular.java | 2 +- .../rest/resources/API/APIResource.java | 13 +- .../resources/API/AccountabilityResource.java | 16 +- .../rest/resources/MainResource.java | 29 +- .../AbstractComponentInstanceResource.java | 77 +- ...ntInstanceResourceContainingATopology.java | 4 +- ...ourceWithNameDerivedFromAbstractFinal.java | 20 +- ...mponentInstanceWithReferencesResource.java | 6 +- .../_support/AbstractComponentsResource.java | 18 +- ...ctComponentsWithTypeReferenceResource.java | 15 +- ...omponentsWithoutTypeReferenceResource.java | 2 +- ...stractRefinementModelMappingsResource.java | 2 +- .../AbstractRefinementModelResource.java | 12 +- .../ComponentsOfOneNamespaceResource.java | 2 +- .../_support/GenericFileResource.java | 10 +- .../GenericVisualAppearanceResource.java | 6 +- ...elationshipTypeImplementationResource.java | 2 +- .../rest/resources/_support/IPersistable.java | 4 +- .../resources/_support/ResourceResult.java | 2 +- .../_support/VisualAppearanceResource.java | 2 +- .../collections/EntityCollectionResource.java | 8 +- .../_support/collections/EntityResource.java | 7 +- .../EntityWithoutIdCollectionResource.java | 4 +- .../withoutid/EntityWithoutIdResource.java | 3 +- .../IdDeterminationWithHashCode.java | 20 +- .../admin/AbstractAdminResource.java | 2 +- .../resources/admin/AdminTopResource.java | 54 + .../resources/admin/EdmmMappingsResource.java | 6 +- .../resources/admin/NamespacesResource.java | 8 +- .../admin/RepositoryAdminResource.java | 38 +- .../admin/types/AbstractTypesManager.java | 10 +- .../admin/types/ConstraintTypesManager.java | 2 +- .../admin/types/PlanLanguagesManager.java | 2 +- .../admin/types/PlanTypesManager.java | 2 +- .../RepositoryConfigurationResponse.java | 22 + .../admin/types/che/CheResponse.java | 22 + .../resources/admin/types/che/Machine.java | 21 + .../resources/admin/types/che/Runtime.java | 20 + .../resources/admin/types/che/Server.java | 19 + .../admin/types/che/WorkspaceResponse.java | 19 + .../apiData/AvailableSuperclassesApiData.java | 2 +- .../apiData/NameAndQNameApiData.java | 2 +- .../apiData/NamespaceWithPrefix.java | 2 +- .../apiData/PermutationsResponse.java | 2 +- .../apiData/PrmAttributeMappingApiData.java | 20 +- .../PrmDeploymentArtifactMappingApiData.java | 14 +- .../apiData/PrmPermutationMappingApiData.java | 11 +- .../apiData/PrmStayMappingApiData.java | 16 +- .../apiData/PropertiesDefinitionEnum.java | 2 +- .../PropertiesDefinitionResourceApiData.java | 24 +- .../rest/resources/apiData/QNameApiData.java | 18 +- .../apiData/RefinementElementApiData.java | 2 +- .../apiData/RelationMappingApiData.java | 20 +- .../rest/resources/apiData/UpdateInfo.java | 11 + ...piData.java => ValidTypesListApiData.java} | 17 +- .../resources/apiData/VisualsApiData.java | 4 +- .../artifacts/DeploymentArtifactResource.java | 4 +- .../artifacts/GenericArtifactResource.java | 4 +- .../artifacts/GenericArtifactsResource.java | 25 +- .../ImplementationArtifactResource.java | 4 +- .../ComplianceRuleResource.java | 26 +- .../dataflowmodels/DataFlowResource.java | 49 +- .../entitytemplates/PropertiesResource.java | 90 +- .../ArtifactTemplateFilesResource.java | 4 +- .../ArtifactTemplateResource.java | 2 +- .../PolicyTemplateResource.java | 2 +- .../PolicyTemplatesResource.java | 2 +- .../EntityTypeImplementationResource.java | 2 +- .../NodeTypeImplementationResource.java | 2 +- ...elationshipTypeImplementationResource.java | 2 +- .../AttributeDefinitionsResource.java | 8 +- .../entitytypes/EntityTypeResource.java | 8 +- .../entitytypes/InstanceStatesResource.java | 4 +- .../entitytypes/TemplatesOfOneType.java | 2 +- ...opologyGraphElementEntityTypeResource.java | 2 +- .../artifacttypes/ArtifactTypeResource.java | 4 +- .../artifacttypes/ArtifactTypesResource.java | 10 +- .../TemplatesOfOneArtifactTypeResource.java | 4 +- .../CapabilityTypeResource.java | 10 +- .../nodetypes/NodeTypeResource.java | 6 +- .../nodetypes/NodeTypesResource.java | 2 +- .../nodetypes/VisualAppearanceResource.java | 2 +- .../CapabilityDefinitionsResource.java | 2 +- .../RequirementDefinitionsResource.java | 6 +- .../policytypes/AppliesToResource.java | 8 +- .../policytypes/PolicyTypeResource.java | 4 +- .../policytypes/PolicyTypesResource.java | 2 +- .../TemplatesOfOnePolicyTypeResource.java | 4 +- .../PropertiesDefinitionResource.java | 42 +- .../PropertyDefinitionKVListResource.java | 7 +- .../winery/PropertyDefinitionKVResource.java | 2 +- .../RelationshipTypeResource.java | 27 +- .../RelationshipTypesResource.java | 2 +- .../VisualAppearanceResource.java | 2 +- .../RequiredCapabilityTypeResource.java | 2 +- .../RequirementTypeResource.java | 2 +- .../resources/imports/ImportsResource.java | 9 +- .../genericimports/GenericImportResource.java | 12 +- .../GenericImportsResource.java | 2 +- .../wsdlimports/WsdlImportResource.java | 2 +- .../imports/xsdimports/XSDImportResource.java | 9 +- .../xsdimports/XSDImportsResource.java | 2 +- .../AttributeMappingsResource.java | 2 +- .../DeploymentArtifactMappingsResource.java | 2 +- .../PatternRefinementModelResource.java | 2 +- .../PermutationMappingsResource.java | 2 +- .../RelationMappingsResource.java | 2 +- .../StayMappingsResource.java | 22 +- .../TestRefinementModelResource.java | 6 +- ...pologyFragmentRefinementModelResource.java | 16 +- .../servicetemplates/ParameterResource.java | 12 +- .../ServiceTemplateResource.java | 463 +++++- .../ServiceTemplatesResource.java | 6 +- .../BoundaryDefinitionsJSPData.java | 15 +- .../BoundaryDefinitionsResource.java | 11 +- .../PropertyConstraintsResource.java | 18 +- .../PropertyMappingsResource.java | 4 +- .../plans/ParameterResource.java | 6 +- .../plans/ParametersResource.java | 11 +- .../plans/PlanFileResource.java | 4 +- .../servicetemplates/plans/PlanResource.java | 8 +- .../servicetemplates/plans/PlansResource.java | 17 +- .../selfserviceportal/OptionResource.java | 2 +- .../selfserviceportal/OptionsResource.java | 2 +- .../SelfServicePortalResource.java | 23 +- .../NodeTemplateResource.java | 15 +- .../TopologyTemplateResource.java | 65 +- .../rest/resources/yaml/DataTypeResource.java | 112 ++ .../resources/yaml/DataTypesResource.java | 31 + .../rest/websockets/GitWebSocket.java | 4 +- .../rest/websockets/RefinementWebSocket.java | 2 +- .../rest/RestUtilsWithGitBackendTest.java | 58 +- .../rest/resources/AbstractResourceTest.java | 13 +- .../repository/rest/resources/TestIds.java | 6 +- .../nodetypes/NodeTypeResourceTest.java | 4 +- .../nodetypes/YamlNodeTypesResourceTest.java | 45 + .../PatternRefinementModelResourceTest.java | 2 + .../PatternRefinementModelsResourceTest.java | 3 + .../ServiceTemplateResourceTest.java | 2 +- .../policies/PoliciesResourceTest.java | 5 +- .../TopologyTemplateResourceTest.java | 2 +- ...5aa724201824fce6eddcc7c35a666c6e015880.xml | 2 +- ...5aa724201824fce6eddcc7c35a666c6e015880.xml | 2 +- .../artifacttypes/jar_inheritance.xml | 2 +- .../entitytypes/artifacttypes/war.xml | 2 +- .../artifacttypes/war_with_properties.xml | 4 +- .../war_with_properties_element.xml | 4 +- .../artifacttypes/war_with_properties_kv.xml | 9 +- .../war_with_properties_type.xml | 2 +- .../create_configure_interface_result.xml | 2 +- .../NodeTypeWithTwoKVProperties.json | 45 +- .../nodetypes/addYamlNodeType.json | 4 + .../nodetypes/addecYamlNodeType.yml | 8 + ...b1650522ced3872220ad2d17c1afd82e7e1f3.json | 70 +- .../nodetypes/baobab_capabilites.json | 63 +- .../entitytypes/nodetypes/baobab_initial.xml | 1 + .../baobab_initial_with_definitions.xml | 7 +- ...obab_initial_with_definitions_expected.xml | 5 - .../nodetypes/baobab_tag_step3_values.json | 4 +- .../nodetypes/baobab_tag_step5_values.json | 2 +- .../nodetypes/baobab_updated_expected.xml | 5 - .../nodetypes/grape_inheritance.xml | 4 - .../nodetypes/grape_inheritance_none.xml | 4 - ...5aa724201824fce6eddcc7c35a666c6e015880.xml | 2 +- .../servicetemplates/DriverInjection.json | 2 + .../policies/initialPolicy.json | 2 +- .../entitytypes/servicetemplates/instance.xml | 6 +- .../created_patternrefinementmodel.xml | 9 +- .../first_patternrefinementmodel.json | 11 +- .../first_patternrefinementmodel.xml | 3 + .../initial_patternrefinementmodel.json | 11 +- .../Placement_Test_ServiceTemplate1.xml | 66 +- .../Placement_Test_ServiceTemplate2.xml | 66 +- ...cement_Test_ServiceTemplate_Completed1.xml | 148 +- ...cement_Test_ServiceTemplate_Completed2.xml | 132 +- ...tInjectionOptions-DriverInjectionTest.json | 2 + .../apache-spark-on-vsphere-input.json | 2 + .../apache-spark-on-vsphere-result.json | 2 + .../baobab_topologytemplate.json | 1 + .../baobab_topologytemplate.xml | 15 +- ...opologytemplate_v2-with-empty-objects.json | 1 + .../baobab_topologytemplate_v2.json | 1 + .../farm_topologytemplate.json | 5 + .../farm_topologytemplate.xml | 81 +- .../servicetemplates/newVersion.json | 3 + ...MinimalExampleWithAllPropertyVariants.json | 4 + ...e0df76e98d46ead68295920e5d1cf1354bdea1.xml | 15 +- ...MinimalExampleWithAllPropertyVariants.json | 4 + ...xampleWithAllPropertyVariants_w1-wip1.json | 2 + ...ExampleWithAllPropertyVariants_w1-wip1.xml | 8 +- .../initial_testrefinementmodel.json | 4 +- org.eclipse.winery.repository/.gitignore | 26 - .../de.loskutov.anyedit.AnyEditTools.prefs | 16 - org.eclipse.winery.repository/about.html | 514 ------- .../about_files/Apache-LICENSE-2.0.txt | 202 --- .../about_files/CDDL-v1.1.txt | 129 -- .../about_files/EDL.txt | 13 - .../about_files/LICENSE-ASM.txt | 29 - .../about_files/LICENSE-JSch.txt | 30 - .../about_files/LICENSE-logback.txt | 15 - .../about_files/LICENSE-slf4j-api.txt | 21 - .../about_files/LICENSE-slf4j-ext.txt | 24 - .../about_files/MPL-v1.1.txt | 470 ------ .../about_files/file-icons.txt | 27 - org.eclipse.winery.repository/pom.xml | 138 +- .../winery/repository/JAXBSupport.java | 74 +- .../TestWithGitBackedRepository.java | 18 +- .../repository/backend/BackendUtils.java | 610 +++----- .../repository/backend/IRepository.java | 367 +++-- .../repository/backend/IWineryRepository.java | 4 +- .../backend/IWineryRepositoryCommon.java | 60 +- .../backend/IWrappingRepository.java | 19 + .../repository/backend/ImportUtils.java | 17 +- .../repository/backend/MockXMLElement.java | 2 +- .../repository/backend/NamespaceManager.java | 64 +- .../repository/backend/RepositoryFactory.java | 35 +- .../backend/SelfServiceMetaDataUtils.java | 22 +- .../backend/WineryVersionUtils.java | 143 ++ .../backend/YamlArtifactsSynchronizer.java | 13 +- .../consistencycheck/ConsistencyChecker.java | 189 ++- .../ConsistencyCheckerConfiguration.java | 19 - .../ConsistencyErrorCollector.java | 6 +- .../consistencycheck/QNameValidator.java | 4 +- .../AbstractFileBasedRepository.java | 43 +- .../ConfigurationBasedNamespaceManager.java | 3 +- .../backend/filebased/FileUtils.java | 27 +- .../backend/filebased/GitBasedRepository.java | 100 +- .../filebased/JsonBasedNamespaceManager.java | 3 + .../filebased/model/ConvertedPath.java | 46 - .../xsd/NamespaceAndDefinedLocalNames.java | 2 +- .../xsd/RepositoryBasedXsdImportManager.java | 32 +- .../backend/xsd/XsdImportManager.java | 4 +- .../common/RepositoryFileReference.java | 8 +- .../winery/repository}/common/Util.java | 243 +-- .../repository/converter/X2YConverter.java | 1155 -------------- .../{support => }/reader/XmlReader.java | 15 +- .../{support => }/reader/YamlBuilder.java | 881 ++++++----- .../{support => }/reader/YamlReader.java | 56 +- .../converter/support/ValueConverter.java | 28 - .../validator/DefinitionValidator.java | 30 +- .../validator/DefinitionsVisitor.java | 14 +- .../validator/FieldValidator.java | 40 +- .../validator/ImportVisitor.java | 32 +- .../validator/ObjectValidator.java | 4 +- .../validator/TypeValidator.java | 90 +- .../{support => }/validator/TypeVisitor.java | 42 +- .../{support => }/validator/Validator.java | 44 +- .../support/ExceptionInterpreter.java | 4 +- .../validator/support/ExceptionVisitor.java | 4 +- .../validator/support/Parameter.java | 2 +- .../validator/support/Result.java | 2 +- .../{support => }/writer/WriterUtils.java | 74 +- .../{support => }/writer/XmlWriter.java | 6 +- .../{support => }/writer/YamlPrinter.java | 36 +- .../{support => }/writer/YamlWriter.java | 372 +++-- .../support/AnonymousPropertiesList.java | 2 +- .../writer/support/PropertiesList.java | 2 +- .../ArtifactTemplateFilesDirectoryId.java | 4 +- .../ArtifactTemplateSourceDirectoryId.java | 4 +- .../datatypes/ids/elements/DirectoryId.java | 6 +- .../ids/elements/GenericDirectoryId.java | 2 +- .../ids/elements/SelfServiceMetaDataId.java | 6 +- ...ceTemplateSelfServiceFilesDirectoryId.java | 4 +- .../ids/elements/VisualAppearanceId.java | 6 +- .../DASpecification.java | 38 +- .../DriverInjection.java | 52 +- .../repository/export/CsarExporter.java | 100 +- .../repository/export/ExportedState.java | 2 +- .../repository/export/ToscaExportUtil.java | 135 +- .../entries/DefinitionsBasedCsarEntry.java | 48 + .../entries/RemoteRefBasedCsarEntry.java | 19 +- .../entries/RepositoryRefBasedCsarEntry.java | 12 +- .../entries/XMLDefinitionsBasedCsarEntry.java | 29 +- .../JsonBasedMultiNamespaceManager.java | 13 +- .../filebased/MultiRepository.java | 91 +- .../filebased/MultiRepositoryManager.java | 4 +- .../filebased/RepositoryUtils.java | 37 +- .../management/AbstractGitResolver.java | 2 +- .../filebased/management/GitResolver.java | 6 +- .../management/IRepositoryResolver.java | 2 +- .../management/RepositoryResolverFactory.java | 6 +- .../repository/importing/CsarImporter.java | 117 +- .../importing/ImportMetaInformation.java | 2 +- .../importing/YamlCsarImporter.java | 105 +- .../patterndetection/Detection.java | 2 +- .../splitting/ProviderRepository.java | 9 +- .../repository/splitting/Splitting.java | 220 ++- .../targetallocation/Allocation.java | 2 +- .../fulfillpolicies/PolicyComparison.java | 4 +- .../fulfillpolicies/PolicyWrapper.java | 23 +- .../util/AllocationUtils.java | 8 +- .../XmlRepository.java} | 99 +- .../xml/converter/FromCanonical.java | 1113 ++++++++++++++ .../xml/converter/PropertyMappingSupport.java | 105 ++ .../repository/xml/converter/ToCanonical.java | 1200 +++++++++++++++ .../xml/export/XmlModelJAXBSupport.java | 118 ++ .../filebased => yaml}/YamlRepository.java | 406 ++--- .../yaml/converter/FromCanonical.java | 1364 +++++++++++++++++ .../converter/ToCanonical.java} | 861 +++++------ .../converter/support}/AssignmentBuilder.java | 12 +- .../converter/support}/InheritanceUtils.java | 12 +- .../converter/support/Parameter.java | 2 +- .../converter/support}/ReferenceVisitor.java | 44 +- .../converter/support}/SchemaBuilder.java | 8 +- .../converter/support}/SchemaVisitor.java | 76 +- .../converter/support}/TypeConverter.java | 4 +- .../YTImplementationArtifactDefinition.java} | 24 +- .../support}/visitors/ReferenceVisitor.java | 44 +- .../export/YamlExportAdjustmentsBuilder.java | 22 +- .../{ => yaml}/export/YamlExporter.java | 27 +- .../export/YamlToscaExportUtil.java | 49 +- .../YAMLDefinitionsBasedCsarEntry.java | 57 +- .../winery}/librarytests/DateTest.java | 7 +- .../librarytests/InheritanceIllustration.java | 6 +- .../winery/repository/ImportUtilsTest.java | 10 +- ...rsionUtilsTestWithGitBackedRepository.java | 32 +- .../repository/backend/BackendUtilsTest.java | 41 +- ...ckendUtilsTestWithGitBackedRepository.java | 53 +- .../repository/backend/IRepositoryTest.java | 11 +- .../ConsistencyCheckerTest.java | 13 +- .../winery/repository/common/UtilTests.java | 24 +- .../repository/converter/YamlReaderTest.java | 63 - .../DASpecificationTest.java | 32 +- .../DriverInjectionTest.java | 4 +- .../repository/export/CsarExporterTest.java | 16 +- .../filebased/MultiRepositoryManagerTest.java | 3 +- .../XmlRepositoryTest.java} | 15 +- .../management/RepositoryResolverTest.java | 4 +- .../importing/CsarImporterValidationTest.java | 4 +- .../repository/splitting/SplittingTest.java | 15 +- .../FulfillPoliciesTest.java | 7 +- .../ConnectsToGraphTest.java | 4 +- .../KargerMinCutVariationTest.java | 4 +- .../MinExternalConnectionsTest.java | 4 +- .../criteria/minhosts/MinHostsTest.java | 4 +- .../util/AllocationUtilsTest.java | 4 +- .../util/TopologyMappingsWrapperTest.java | 40 +- .../xml/XmlRepositoryIntegrationTests.java | 105 ++ .../xml/export/XmlModelJAXBSupportTests.java | 29 +- .../repository/yaml/YamlReaderTest.java | 109 ++ .../yaml/YamlRepositoryIntegrationTests.java | 148 ++ .../repository/yaml/YamlWriterTests.java | 239 +++ .../resources/yaml/property_functions.yml | 34 + .../valid-topology_templates-1_3.yml | 16 + .../simple-tests/wrong-policy-map-in-tt.yml | 16 + .../pom.xml | 11 +- .../copybaragenerator/CopybaraGenerator.java | 4 +- .../pom.xml | 7 +- org.eclipse.winery.topologygraph/pom.xml | 16 +- .../matching/ToscaPrmPropertyMatcher.java | 36 +- .../transformation/ToscaTransformer.java | 15 +- .../matching/ToscaPrmPropertyMatcherTest.java | 28 +- pom.xml | 60 +- 1085 files changed, 38128 insertions(+), 19888 deletions(-) create mode 100644 .mvn/extensions.xml create mode 100644 .mvn/settings.xml create mode 100644 deploy/che/devfile-full-pvc.yml rename deploy/che/{devfile-with-content.yml => devfile-full.yml} (90%) create mode 100644 deploy/che/winery-pvc.yaml delete mode 100644 org.eclipse.winery.common/.gitignore delete mode 100644 org.eclipse.winery.common/about.html delete mode 100644 org.eclipse.winery.common/about_files/Apache-LICENSE-2.0.txt delete mode 100644 org.eclipse.winery.common/about_files/CDDL-v1.1.txt delete mode 100644 org.eclipse.winery.common/about_files/LICENSE-logback.txt delete mode 100644 org.eclipse.winery.common/about_files/LICENSE-slf4j-api.txt delete mode 100644 org.eclipse.winery.common/sonar-project.properties delete mode 100644 org.eclipse.winery.common/src/main/java/META-INF/MANIFEST.MF create mode 100644 org.eclipse.winery.common/src/test/java/org/eclipse/winery/common/HashingUtilTests.java create mode 100644 org.eclipse.winery.compliance/src/test/java/org/eclipse/winery/compliance/ComplianceRuleCheckerTests.java create mode 100644 org.eclipse.winery.edmm/pom.xml rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/backend => org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm}/EdmmManager.java (67%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/export => org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm}/EdmmUtils.java (84%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/backend/filebased => org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm}/JsonBasedEdmmManager.java (93%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/edmm => org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/model}/EdmmConverter.java (98%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/edmm => org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/model}/EdmmMappingItem.java (96%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/edmm => org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/model}/EdmmType.java (97%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/edmm => org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/model}/EdmmTypeProperties.java (99%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm}/toscalight/ToscaLightChecker.java (93%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm}/toscalight/ToscaLightUtils.java (96%) rename {org.eclipse.winery.common/src/test/java/org/eclipse/winery/common => org.eclipse.winery.edmm/src/test/java/org/eclipse/winery}/edmm/EdmmDependantTest.java (93%) rename {org.eclipse.winery.repository/src/test/java/org/eclipse/winery/repository/export => org.eclipse.winery.edmm/src/test/java/org/eclipse/winery/edmm}/EdmmUtilsTest.java (96%) rename {org.eclipse.winery.repository/src/test/java/org/eclipse/winery/repository/backend/filebased => org.eclipse.winery.edmm/src/test/java/org/eclipse/winery/edmm}/JsonBasedEdmmManagerTest.java (87%) rename {org.eclipse.winery.common/src/test/java/org/eclipse/winery/common/edmm => org.eclipse.winery.edmm/src/test/java/org/eclipse/winery/edmm/model}/EdmmConverterTest.java (86%) rename {org.eclipse.winery.common/src/test/java/org/eclipse/winery/common => org.eclipse.winery.edmm/src/test/java/org/eclipse/winery/edmm}/toscalight/ToscaLightCheckerTest.java (83%) rename org.eclipse.winery.frontends/app/{topologymodeler/src/app/models/qname.ts => shared/src/app/model/qName.ts} (70%) create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/group-view.component.css create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/group-view.component.html create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/group-view.component.ts create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/policies/policies.component.css create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/policies/policies.component.html create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/policies/policies.component.ts rename org.eclipse.winery.frontends/app/{tosca-management/src/app/model/qName.ts => topologymodeler/src/app/models/toscaUtils.ts} (58%) rename org.eclipse.winery.model.tosca.yaml/src/test/java/.gitkeep => org.eclipse.winery.frontends/app/topologymodeler/src/app/multi-participants/multi-participants.component.css (100%) rename org.eclipse.winery.model.tosca/src/test/java/.gitkeep => org.eclipse.winery.frontends/app/topologymodeler/src/app/multi-participants/multi-participants.component.html (100%) create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/multi-participants/multi-participants.component.ts create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/node/groups/groups.component.css create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/node/groups/groups.component.html create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/node/groups/groups.component.ts create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/assign-participants.component.css create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/assign-participants.component.html create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/assign-participants.component.ts create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/manage-participants.component.css create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/manage-participants.component.html create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/manage-participants.component.ts create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/kv-properties/kv-properties.component.html create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/kv-properties/kv-properties.component.ts delete mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties-content/properties-content.component.html delete mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties-content/properties-content.component.ts create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/property-constraints.ts create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/xml-properties/xml-properties.component.html create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/xml-properties/xml-properties.component.ts create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/yaml-properties/type-conformance-validator.ts create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/yaml-properties/typeaware-input.component.html create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/yaml-properties/typeaware-input.component.ts create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/yaml-properties/yaml-properties.component.html create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/yaml-properties/yaml-properties.component.ts create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/services/che.service.ts create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/services/multi-participants.service.ts create mode 100644 org.eclipse.winery.frontends/app/topologymodeler/src/app/sidebars/node-details/node-details-sidebar.ts rename org.eclipse.winery.frontends/app/topologymodeler/src/app/{sidebar/sidebar.component.css => sidebars/node-details/nodeDetailsSidebar.component.css} (69%) rename org.eclipse.winery.frontends/app/topologymodeler/src/app/{sidebar/sidebar.component.html => sidebars/node-details/nodeDetailsSidebar.component.html} (88%) rename org.eclipse.winery.frontends/app/topologymodeler/src/app/{sidebar/sidebar.component.ts => sidebars/node-details/nodeDetailsSidebar.component.ts} (67%) rename org.eclipse.winery.frontends/app/topologymodeler/src/app/{refinementSidebar => sidebars/refinement}/refinementSidebar.component.css (100%) rename org.eclipse.winery.frontends/app/topologymodeler/src/app/{refinementSidebar => sidebars/refinement}/refinementSidebar.component.html (100%) rename org.eclipse.winery.frontends/app/topologymodeler/src/app/{refinementSidebar => sidebars/refinement}/refinementSidebar.component.ts (85%) rename org.eclipse.winery.frontends/app/topologymodeler/src/app/{refinementSidebar => sidebars/refinement}/refinementWebSocket.service.ts (95%) create mode 100644 org.eclipse.winery.frontends/app/tosca-management/src/app/instance/dataTypes/dataTypes.service.ts create mode 100644 org.eclipse.winery.frontends/app/tosca-management/src/app/instance/instance.component.css create mode 100644 org.eclipse.winery.frontends/app/tosca-management/src/app/instance/sharedComponents/validTargetTypes/validTargetTypes.component.html create mode 100644 org.eclipse.winery.frontends/app/tosca-management/src/app/instance/sharedComponents/validTargetTypes/validTargetTypes.component.ts create mode 100644 org.eclipse.winery.frontends/app/tosca-management/src/app/instance/sharedComponents/validTargetTypes/validTargetTypes.module.ts rename org.eclipse.winery.frontends/app/{topologymodeler/src/app/properties/properties-content/properties-content.component.css => tosca-management/src/app/instance/sharedComponents/yaml/constraints/yaml-constraints.component.css} (81%) create mode 100644 org.eclipse.winery.frontends/app/tosca-management/src/app/instance/sharedComponents/yaml/constraints/yaml-constraints.component.html create mode 100644 org.eclipse.winery.frontends/app/tosca-management/src/app/instance/sharedComponents/yaml/constraints/yaml-constraints.component.ts create mode 100644 org.eclipse.winery.frontends/app/tosca-management/src/app/model/yaml.ts create mode 100644 org.eclipse.winery.frontends/app/tosca-management/src/app/wineryMainModules/dataTypes/dataType.module.ts create mode 100644 org.eclipse.winery.frontends/app/tosca-management/src/app/wineryMainModules/dataTypes/dataTypeRouter.module.ts delete mode 100644 org.eclipse.winery.generators.ia/.gitignore delete mode 100644 org.eclipse.winery.generators.ia/about.html delete mode 100644 org.eclipse.winery.generators.ia/about_files/Apache-LICENSE-2.0.txt delete mode 100644 org.eclipse.winery.generators.ia/about_files/CDDL-v1.1.txt delete mode 100644 org.eclipse.winery.generators.ia/about_files/LICENSE-logback.txt delete mode 100644 org.eclipse.winery.generators.ia/about_files/LICENSE-slf4j-api.txt delete mode 100644 org.eclipse.winery.highlevelrestapi/.gitignore delete mode 100644 org.eclipse.winery.highlevelrestapi/about.html delete mode 100644 org.eclipse.winery.highlevelrestapi/about_files/Apache-LICENSE-2.0.txt delete mode 100644 org.eclipse.winery.highlevelrestapi/about_files/LICENSE-logback.txt delete mode 100644 org.eclipse.winery.highlevelrestapi/about_files/LICENSE-slf4j-api.txt delete mode 100644 org.eclipse.winery.highlevelrestapi/notice.html delete mode 100644 org.eclipse.winery.model.csar.toscametafile/about.html delete mode 100644 org.eclipse.winery.model.csar.toscametafile/about_files/Apache-LICENSE-2.0.txt delete mode 100644 org.eclipse.winery.model.csar.toscametafile/about_files/LICENSE-logback.txt delete mode 100644 org.eclipse.winery.model.csar.toscametafile/about_files/LICENSE-slf4j-api.txt delete mode 100644 org.eclipse.winery.model.csar.toscametafile/notice.html delete mode 100644 org.eclipse.winery.model.selfservice/about.html delete mode 100644 org.eclipse.winery.model.selfservice/notice.html delete mode 100644 org.eclipse.winery.model.tosca.yaml/.gitignore delete mode 100644 org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TGroupType.java delete mode 100644 org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/visitor/IVisitor.java delete mode 100644 org.eclipse.winery.model.tosca/.gitignore delete mode 100644 org.eclipse.winery.model.tosca/about.html delete mode 100644 org.eclipse.winery.model.tosca/notice.html delete mode 100644 org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca/kvproperties/AttributeDefinitionList.java delete mode 100644 org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca/kvproperties/ParameterDefinitionList.java delete mode 100644 org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca/kvproperties/PropertyDefinitionKVList.java rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/.editorconfig (100%) rename {org.eclipse.winery.model.csar.toscametafile => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/.gitignore (100%) create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/pom.xml rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/Defaults.java (96%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/Namespaces.java (80%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/exception/ExceptionHierarchy.yml (100%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/exception/Invalid.java (92%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/exception/InvalidDefinition.java (92%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/exception/InvalidField.java (92%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/exception/InvalidParentType.java (92%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/exception/InvalidSyntax.java (92%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/exception/InvalidToscaSyntax.java (90%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/exception/InvalidToscaVersion.java (90%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/exception/InvalidType.java (92%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/exception/InvalidTypeExtend.java (92%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/exception/InvalidYamlSyntax.java (92%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/exception/MultiException.java (94%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/exception/Undefined.java (92%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/exception/UndefinedDefinition.java (92%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/exception/UndefinedField.java (92%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/exception/UndefinedFile.java (92%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/exception/UndefinedImport.java (92%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/exception/UndefinedPrefix.java (92%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/exception/UndefinedRequiredKeyname.java (92%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/exception/UndefinedToscaVersion.java (92%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/exception/UndefinedType.java (92%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/exception/YAMLParserException.java (96%) rename {org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/converter/support/xml/TypeConverter.java (95%) create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/ids/EncodingUtil.java rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/GenericId.java (92%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/IdNames.java (96%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/IdUtil.java (53%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/Namespace.java (86%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/ids}/StringEncodedAndDecoded.java (90%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/XmlId.java (92%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/admin/AccountabilityId.java (86%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/admin/AdminId.java (91%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/admin/ConstraintTypesId.java (87%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/admin/EdmmMappingsId.java (86%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/admin/NamespacesId.java (86%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/admin/PlanLanguagesId.java (86%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/admin/PlanTypesId.java (86%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/admin/TypesId.java (90%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/definitions/ArtifactTemplateId.java (89%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/definitions/ArtifactTypeId.java (90%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/definitions/CapabilityTypeId.java (89%) create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/ids/definitions/DataTypeId.java rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/definitions/DefinitionsChildId.java (82%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/definitions/EntityTemplateId.java (87%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/definitions/EntityTypeId.java (88%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/definitions/EntityTypeImplementationId.java (88%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/definitions/HasInheritanceId.java (88%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/definitions/InterfaceTypeId.java (88%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/definitions/NodeTypeId.java (88%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/definitions/NodeTypeImplementationId.java (89%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/definitions/PolicyTemplateId.java (89%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/definitions/PolicyTypeId.java (88%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/definitions/RelationshipTypeId.java (89%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/definitions/RelationshipTypeImplementationId.java (89%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/definitions/RequirementTypeId.java (89%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/definitions/ServiceTemplateId.java (89%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/definitions/TopologyGraphElementEntityTypeId.java (89%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/definitions/imports/GenericImportId.java (80%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/definitions/imports/WsdlImportId.java (87%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/definitions/imports/XSDImportId.java (89%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/definitions/package-info.java (94%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/elements/PlanId.java (89%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/elements/PlansId.java (85%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/elements/ToscaElementId.java (94%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/ids/elements/package-info.java (94%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/ids/definitions => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/ids/extensions}/ComplianceRuleId.java (76%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/ids/definitions => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/ids/extensions}/PatternRefinementModelId.java (83%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/ids/definitions => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/ids/extensions}/RefinementId.java (78%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/ids/definitions => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/ids/extensions}/TestRefinementModelId.java (84%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/ids/definitions => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/ids/extensions}/TopologyFragmentRefinementModelId.java (89%) create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/jaxbsupport/map/BooleanToYesNo.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/jaxbsupport/map/PropertiesAdapter.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/jsonsupport/PropertiesDefinitionDeserializer.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/jsonsupport/PropertiesDefinitionSerializer.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/jsonsupport/YesNo.java rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/HasId.java (89%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/HasIdInIdOrNameField.java (95%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/HasInheritance.java (73%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/HasName.java (92%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/HasPolicies.java (92%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/HasTags.java (100%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/HasTargetNamespace.java (92%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/HasType.java (95%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/RelationshipSourceOrTarget.java (82%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TAppliesTo.java (92%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TArtifact.java (92%) create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/TArtifactReference.java rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TArtifactTemplate.java (97%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TArtifactType.java (94%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TArtifacts.java (95%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TBoundaryDefinitions.java (96%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TCapability.java (87%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TCapabilityDefinition.java (97%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TCapabilityRef.java (93%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TCapabilityType.java (85%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TCondition.java (93%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TConstraint.java (93%) create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/TDataType.java rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TDefinitions.java (70%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TDeploymentArtifact.java (93%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TDeploymentArtifacts.java (86%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TDocumentation.java (94%) create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/TEntityTemplate.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/TEntityType.java rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TEntityTypeImplementation.java (87%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TExportedInterface.java (78%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TExportedOperation.java (94%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TExtensibleElements.java (96%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TExtension.java (77%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TExtensions.java (92%) create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/TGroupDefinition.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/TGroupType.java rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TImplementation.java (95%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TImplementationArtifact.java (96%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TImplementationArtifacts.java (94%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TImport.java (87%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TInterface.java (90%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TInterfaceDefinition.java (93%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TInterfaceType.java (91%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TInterfaces.java (91%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TNodeTemplate.java (98%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TNodeType.java (98%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TNodeTypeImplementation.java (96%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TOperation.java (98%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TOperationDefinition.java (92%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TParameter.java (79%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TPlan.java (98%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TPlans.java (88%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TPolicies.java (93%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TPolicy.java (95%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TPolicyTemplate.java (93%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TPolicyType.java (95%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TPropertyConstraint.java (91%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TPropertyDefinition.java (90%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TPropertyMapping.java (90%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TRelationshipTemplate.java (89%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TRelationshipType.java (86%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TRelationshipTypeImplementation.java (92%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TRequiredContainerFeature.java (85%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TRequiredContainerFeatures.java (95%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TRequirement.java (96%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TRequirementDefinition.java (98%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TRequirementRef.java (93%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TRequirementType.java (94%) create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/TSchema.java rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TServiceTemplate.java (95%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TTag.java (94%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TTags.java (96%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TTopologyElementInstanceStates.java (93%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/TTopologyTemplate.java (75%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/constants/Namespaces.java (96%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/constants/OpenToscaBaseTypes.java (100%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/constants/OpenToscaInterfaces.java (100%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/constants/QNames.java (94%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/constants/ToscaBaseTypes.java (100%) rename {org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions}/OTAttributeMapping.java (60%) rename {org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions}/OTAttributeMappingType.java (92%) rename {org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions}/OTComplianceRule.java (55%) rename {org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions}/OTDeploymentArtifactMapping.java (59%) create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions/OTParticipant.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions/OTPatternRefinementModel.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions/OTPermutationMapping.java rename {org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions}/OTPrmMapping.java (66%) rename {org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions}/OTPrmModelElementType.java (92%) rename {org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions}/OTRefinementModel.java (60%) rename {org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions}/OTRelationDirection.java (92%) rename {org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions}/OTRelationMapping.java (56%) rename {org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions}/OTStayMapping.java (65%) rename {org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions}/OTStringList.java (63%) rename {org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions}/OTTestRefinementModel.java (63%) rename {org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions}/OTTopologyFragmentRefinementModel.java (54%) rename {org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions}/kvproperties/AttributeDefinition.java (92%) rename {org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions}/kvproperties/ConstraintClauseKV.java (96%) rename {org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions}/kvproperties/ParameterDefinition.java (84%) rename {org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions}/kvproperties/PropertyDefinitionKV.java (83%) rename {org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions}/kvproperties/PropertyKV.java (93%) rename {org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions}/kvproperties/WinerysPropertiesDefinition.java (63%) rename {org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions}/kvproperties/package-info.java (51%) create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/extensions/package-info.java rename org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca/OTPermutationMapping.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/tosca/package-info.java (69%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/utils/ModelUtilities.java (90%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/utils/RemoveEmptyLists.java (84%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical}/src/main/java/org/eclipse/winery/model/tosca/visitor/Visitor.java (94%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model}/version/ToscaDiff.java (96%) create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/main/java/org/eclipse/winery/model/version/VersionSupport.java rename {org.eclipse.winery.common/src/test/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/test/java/org/eclipse/winery/model}/ids/definitions/DefinitionsChildIdTest.java (98%) rename {org.eclipse.winery.common/src/test/java/org/eclipse/winery/common => org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/test/java/org/eclipse/winery/model}/ids/definitions/NodeTypeIdTest.java (96%) create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/test/java/org/eclipse/winery/model/tosca/utils/ModelUtilitiesTest.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.canonical/src/test/java/org/eclipse/winery/model/version/VersionSupportTest.java rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml}/README.md (100%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml}/pom.xml (92%) rename org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca/Definitions.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XDefinitions.java (81%) create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XHasId.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XHasIdInIdOrNameField.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XHasInheritance.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XHasName.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XHasPolicies.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XHasTags.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XHasTargetNamespace.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XHasType.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XRelationshipSourceOrTarget.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTAppliesTo.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTArtifact.java rename org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca/TArtifactReference.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTArtifactReference.java (84%) create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTArtifactTemplate.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTArtifactType.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTArtifacts.java rename org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca/TBoolean.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTBoolean.java (85%) create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTBoundaryDefinitions.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTCapability.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTCapabilityDefinition.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTCapabilityRef.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTCapabilityType.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTCondition.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTConstraint.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTDefinitions.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTDeploymentArtifact.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTDeploymentArtifacts.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTDocumentation.java rename org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca/TEntityTemplate.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTEntityTemplate.java (60%) rename org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca/TEntityType.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTEntityType.java (63%) create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTEntityTypeImplementation.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTExportedInterface.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTExportedOperation.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTExtensibleElements.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTExtension.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTExtensions.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTImplementationArtifact.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTImplementationArtifacts.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTImport.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTInterface.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTInterfaces.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTNodeTemplate.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTNodeType.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTNodeTypeImplementation.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTOperation.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTParameter.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTPlan.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTPlans.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTPolicies.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTPolicy.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTPolicyTemplate.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTPolicyType.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTPropertyConstraint.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTPropertyMapping.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTRelationshipTemplate.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTRelationshipType.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTRelationshipTypeImplementation.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTRequiredContainerFeature.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTRequiredContainerFeatures.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTRequirement.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTRequirementDefinition.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTRequirementRef.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTRequirementType.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTServiceTemplate.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTTag.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTTags.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTTopologyElementInstanceStates.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/XTTopologyTemplate.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/constants/Namespaces.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/constants/OpenToscaBaseTypes.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/constants/OpenToscaInterfaces.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/constants/QNames.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/constants/TOSCA_xml_1_0.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/constants/ToscaBaseTypes.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/extensions/XOTAttributeMapping.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/extensions/XOTAttributeMappingType.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/extensions/XOTComplianceRule.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/extensions/XOTDeploymentArtifactMapping.java rename org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca/OTPatternRefinementModel.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/extensions/XOTPatternRefinementModel.java (52%) create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/extensions/XOTPermutationMapping.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/extensions/XOTPrmMapping.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/extensions/XOTPrmModelElementType.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/extensions/XOTRefinementModel.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/extensions/XOTRelationDirection.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/extensions/XOTRelationMapping.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/extensions/XOTStayMapping.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/extensions/XOTStringList.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/extensions/XOTTestRefinementModel.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/extensions/XOTTopologyFragmentRefinementModel.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/extensions/package-info.java rename {org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml}/package-info.java (88%) create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/utils/ModelUtilities.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/utils/RemoveEmptyLists.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/main/java/org/eclipse/winery/model/tosca/xml/visitor/Visitor.java create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/test/java/.gitkeep rename {org.eclipse.winery.model.tosca/src/test/java/org/eclipse/winery/model/tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml/src/test/java/org/eclipse/winery/model/tosca/xml}/utils/RemoveEmptyListsTest.java (52%) rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml}/src/test/resources/empty-xml-test--topology-with-empty-policy.json (100%) rename {org.eclipse.winery.model.tosca.yaml => org.eclipse.winery.model/org.eclipse.winery.model.tosca.xml}/src/test/resources/logback-test.xml (100%) rename {org.eclipse.winery.model.tosca.yaml => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml}/.editorconfig (100%) rename {org.eclipse.winery.model.selfservice => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml}/.gitignore (100%) rename {org.eclipse.winery.model.tosca.yaml => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml}/LICENSE-ASL.txt (100%) rename {org.eclipse.winery.model.tosca.yaml => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml}/LICENSE-EPL.txt (100%) rename {org.eclipse.winery.model.tosca.yaml => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml}/README.md (100%) rename {org.eclipse.winery.model.tosca.yaml => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml}/pom.xml (92%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TArtifactDefinition.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTArtifactDefinition.java (79%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TArtifactType.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTArtifactType.java (81%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TAttributeAssignment.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTAttributeAssignment.java (78%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TAttributeDefinition.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTAttributeDefinition.java (63%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TCapabilityAssignment.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTCapabilityAssignment.java (67%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TCapabilityDefinition.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTCapabilityDefinition.java (79%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TCapabilityType.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTCapabilityType.java (80%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TConstraintClause.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTConstraintClause.java (72%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TDataType.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTDataType.java (71%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TEntityType.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTEntityType.java (77%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TGroupDefinition.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTGroupDefinition.java (65%) create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTGroupType.java rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TImplementation.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTImplementation.java (64%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TImportDefinition.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTImportDefinition.java (80%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TInterfaceAssignment.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTInterfaceAssignment.java (70%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TInterfaceDefinition.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTInterfaceDefinition.java (71%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TInterfaceType.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTInterfaceType.java (68%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TNodeFilterDefinition.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTNodeFilterDefinition.java (69%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TNodeOrGroupType.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTNodeOrGroupType.java (69%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TNodeTemplate.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTNodeTemplate.java (72%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TNodeType.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTNodeType.java (66%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TOperationDefinition.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTOperationDefinition.java (70%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TParameterDefinition.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTParameterDefinition.java (66%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TPolicyDefinition.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTPolicyDefinition.java (80%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TPolicyType.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTPolicyType.java (83%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TPropertyAssignment.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTPropertyAssignment.java (68%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TPropertyAssignmentOrDefinition.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTPropertyAssignmentOrDefinition.java (68%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TPropertyDefinition.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTPropertyDefinition.java (58%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TPropertyFilterDefinition.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTPropertyFilterDefinition.java (68%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TRelationshipAssignment.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTRelationshipAssignment.java (69%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TRelationshipDefinition.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTRelationshipDefinition.java (70%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TRelationshipTemplate.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTRelationshipTemplate.java (73%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TRelationshipType.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTRelationshipType.java (73%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TRepositoryDefinition.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTRepositoryDefinition.java (78%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TRequirementAssignment.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTRequirementAssignment.java (72%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TRequirementDefinition.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTRequirementDefinition.java (81%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TEntrySchema.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTSchemaDefinition.java (62%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TServiceTemplate.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTServiceTemplate.java (70%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TStatusValue.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTStatusValue.java (75%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TSubstitutionMappings.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTSubstitutionMappings.java (70%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TTopologyTemplateDefinition.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTTopologyTemplateDefinition.java (61%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/TVersion.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/YTVersion.java (76%) rename {org.eclipse.winery.model.tosca.yaml => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml}/src/main/java/org/eclipse/winery/model/tosca/yaml/support/Annotations.java (88%) rename {org.eclipse.winery.model.tosca.yaml => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml}/src/main/java/org/eclipse/winery/model/tosca/yaml/support/Defaults.java (100%) rename {org.eclipse.winery.model.tosca.yaml => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml}/src/main/java/org/eclipse/winery/model/tosca/yaml/support/Metadata.java (100%) rename {org.eclipse.winery.model.tosca.yaml => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml}/src/main/java/org/eclipse/winery/model/tosca/yaml/support/ValueHelper.java (89%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/support/TListString.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/support/YTListString.java (87%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/support/TMapImportDefinition.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/support/YTMapImportDefinition.java (65%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/support/TMapObject.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/support/YTMapObject.java (84%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/support/TMapPolicyDefinition.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/support/YTMapPolicyDefinition.java (65%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/support/TMapPropertyFilterDefinition.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/support/YTMapPropertyFilterDefinition.java (62%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/support/TMapRequirementAssignment.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/support/YTMapRequirementAssignment.java (64%) rename org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/support/TMapRequirementDefinition.java => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/support/YTMapRequirementDefinition.java (64%) rename {org.eclipse.winery.model.tosca.yaml => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml}/src/main/java/org/eclipse/winery/model/tosca/yaml/tosca/datatypes/Credential.java (100%) rename {org.eclipse.winery.model.tosca.yaml => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml}/src/main/java/org/eclipse/winery/model/tosca/yaml/visitor/AbstractParameter.java (100%) rename {org.eclipse.winery.model.tosca.yaml => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml}/src/main/java/org/eclipse/winery/model/tosca/yaml/visitor/AbstractResult.java (100%) rename {org.eclipse.winery.model.tosca.yaml => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml}/src/main/java/org/eclipse/winery/model/tosca/yaml/visitor/AbstractVisitor.java (67%) rename {org.eclipse.winery.model.tosca.yaml => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml}/src/main/java/org/eclipse/winery/model/tosca/yaml/visitor/IParameter.java (100%) rename {org.eclipse.winery.model.tosca.yaml => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml}/src/main/java/org/eclipse/winery/model/tosca/yaml/visitor/IResult.java (100%) create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/main/java/org/eclipse/winery/model/tosca/yaml/visitor/IVisitor.java rename {org.eclipse.winery.model.tosca.yaml => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml}/src/main/java/org/eclipse/winery/model/tosca/yaml/visitor/VisitorNode.java (100%) create mode 100644 org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml/src/test/java/.gitkeep rename {org.eclipse.winery.model.tosca => org.eclipse.winery.model/org.eclipse.winery.model.tosca.yaml}/src/test/resources/logback-test.xml (100%) create mode 100644 org.eclipse.winery.model/pom.xml delete mode 100644 org.eclipse.winery.repository.client/.settings/de.loskutov.anyedit.AnyEditTools.prefs delete mode 100644 org.eclipse.winery.repository.client/about.html delete mode 100644 org.eclipse.winery.repository.client/about_files/Apache-LICENSE-2.0.txt delete mode 100644 org.eclipse.winery.repository.client/about_files/CDDL-v1.1.txt delete mode 100644 org.eclipse.winery.repository.client/about_files/LICENSE-logback.txt delete mode 100644 org.eclipse.winery.repository.client/about_files/LICENSE-slf4j-api.txt rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery/common => org.eclipse.winery.repository.client/src/main/java/org/eclipse/winery/repository/client}/beans/NamespaceIdOptionalName.java (93%) delete mode 100644 org.eclipse.winery.repository.rest/.gitignore delete mode 100644 org.eclipse.winery.repository.rest/.settings/de.loskutov.anyedit.AnyEditTools.prefs delete mode 100644 org.eclipse.winery.repository.rest/about.html delete mode 100644 org.eclipse.winery.repository.rest/about_files/Apache-LICENSE-2.0.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/CDDL-v1.1.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-ASM.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-EDL.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-EPL.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-JSch.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-KeyboardJS.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-XMLWriter.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-biltong.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-boostrap.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-bootstrap-switch.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-bootstrap-touchspin.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-bootstrap3-wysihtml5-bower.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-colorPicker.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-datatables.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-handlebars.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-jQuery-UI.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-jQuery.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-jsPlumb-MIT.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-logback.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-open-sans.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-requirejs.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-slf4j-api.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-slf4j-ext.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-wysihtml5.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-x-editable.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/LICENSE-xmltree.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/MPL-v1.1.txt delete mode 100644 org.eclipse.winery.repository.rest/about_files/file-icons.txt delete mode 100644 org.eclipse.winery.repository.rest/bower.json delete mode 100644 org.eclipse.winery.repository.rest/sonar-project.java.properties delete mode 100644 org.eclipse.winery.repository.rest/sonar-project.twomodules.properties create mode 100644 org.eclipse.winery.repository.rest/src/main/java/org/eclipse/winery/repository/rest/resources/admin/types/RepositoryConfigurationResponse.java create mode 100644 org.eclipse.winery.repository.rest/src/main/java/org/eclipse/winery/repository/rest/resources/admin/types/che/CheResponse.java create mode 100644 org.eclipse.winery.repository.rest/src/main/java/org/eclipse/winery/repository/rest/resources/admin/types/che/Machine.java create mode 100644 org.eclipse.winery.repository.rest/src/main/java/org/eclipse/winery/repository/rest/resources/admin/types/che/Runtime.java create mode 100644 org.eclipse.winery.repository.rest/src/main/java/org/eclipse/winery/repository/rest/resources/admin/types/che/Server.java create mode 100644 org.eclipse.winery.repository.rest/src/main/java/org/eclipse/winery/repository/rest/resources/admin/types/che/WorkspaceResponse.java rename org.eclipse.winery.repository.rest/src/main/java/org/eclipse/winery/repository/rest/resources/apiData/{ValidSourceTypesApiData.java => ValidTypesListApiData.java} (83%) create mode 100644 org.eclipse.winery.repository.rest/src/main/java/org/eclipse/winery/repository/rest/resources/yaml/DataTypeResource.java create mode 100644 org.eclipse.winery.repository.rest/src/main/java/org/eclipse/winery/repository/rest/resources/yaml/DataTypesResource.java create mode 100644 org.eclipse.winery.repository.rest/src/test/java/org/eclipse/winery/repository/rest/resources/entitytypes/nodetypes/YamlNodeTypesResourceTest.java create mode 100644 org.eclipse.winery.repository.rest/src/test/resources/entitytypes/nodetypes/addYamlNodeType.json create mode 100644 org.eclipse.winery.repository.rest/src/test/resources/entitytypes/nodetypes/addecYamlNodeType.yml delete mode 100644 org.eclipse.winery.repository/.gitignore delete mode 100644 org.eclipse.winery.repository/.settings/de.loskutov.anyedit.AnyEditTools.prefs delete mode 100644 org.eclipse.winery.repository/about.html delete mode 100644 org.eclipse.winery.repository/about_files/Apache-LICENSE-2.0.txt delete mode 100644 org.eclipse.winery.repository/about_files/CDDL-v1.1.txt delete mode 100644 org.eclipse.winery.repository/about_files/EDL.txt delete mode 100644 org.eclipse.winery.repository/about_files/LICENSE-ASM.txt delete mode 100644 org.eclipse.winery.repository/about_files/LICENSE-JSch.txt delete mode 100644 org.eclipse.winery.repository/about_files/LICENSE-logback.txt delete mode 100644 org.eclipse.winery.repository/about_files/LICENSE-slf4j-api.txt delete mode 100644 org.eclipse.winery.repository/about_files/LICENSE-slf4j-ext.txt delete mode 100644 org.eclipse.winery.repository/about_files/MPL-v1.1.txt delete mode 100644 org.eclipse.winery.repository/about_files/file-icons.txt create mode 100644 org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/backend/IWrappingRepository.java create mode 100644 org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/backend/WineryVersionUtils.java delete mode 100644 org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/backend/filebased/model/ConvertedPath.java rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery => org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository}/common/RepositoryFileReference.java (93%) rename {org.eclipse.winery.common/src/main/java/org/eclipse/winery => org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository}/common/Util.java (73%) delete mode 100644 org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/converter/X2YConverter.java rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/converter/{support => }/reader/XmlReader.java (70%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/converter/{support => }/reader/YamlBuilder.java (56%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/converter/{support => }/reader/YamlReader.java (81%) delete mode 100644 org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/converter/support/ValueConverter.java rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/converter/{support => }/validator/DefinitionValidator.java (68%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/converter/{support => }/validator/DefinitionsVisitor.java (79%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/converter/{support => }/validator/FieldValidator.java (62%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/converter/{support => }/validator/ImportVisitor.java (73%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/converter/{support => }/validator/ObjectValidator.java (91%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/converter/{support => }/validator/TypeValidator.java (71%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/converter/{support => }/validator/TypeVisitor.java (85%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/converter/{support => }/validator/Validator.java (74%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/converter/{support => }/validator/support/ExceptionInterpreter.java (94%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/converter/{support => }/validator/support/ExceptionVisitor.java (90%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/converter/{support => }/validator/support/Parameter.java (93%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/converter/{support => }/validator/support/Result.java (92%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/converter/{support => }/writer/WriterUtils.java (78%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/converter/{support => }/writer/XmlWriter.java (88%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/converter/{support => }/writer/YamlPrinter.java (90%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/converter/{support => }/writer/YamlWriter.java (60%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/converter/{support => }/writer/support/AnonymousPropertiesList.java (94%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/converter/{support => }/writer/support/PropertiesList.java (95%) create mode 100644 org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/export/entries/DefinitionsBasedCsarEntry.java rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{backend => }/filebased/JsonBasedMultiNamespaceManager.java (93%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{backend => }/filebased/MultiRepository.java (87%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{backend => }/filebased/MultiRepositoryManager.java (96%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{backend => }/filebased/RepositoryUtils.java (87%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{backend => }/filebased/management/AbstractGitResolver.java (97%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{backend => }/filebased/management/GitResolver.java (92%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{backend => }/filebased/management/IRepositoryResolver.java (94%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{backend => }/filebased/management/RepositoryResolverFactory.java (91%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{backend/filebased/XMLRepository.java => xml/XmlRepository.java} (53%) create mode 100644 org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/xml/converter/FromCanonical.java create mode 100644 org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/xml/converter/PropertyMappingSupport.java create mode 100644 org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/xml/converter/ToCanonical.java create mode 100644 org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/xml/export/XmlModelJAXBSupport.java rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{backend/filebased => yaml}/YamlRepository.java (68%) create mode 100644 org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/yaml/converter/FromCanonical.java rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{converter/Y2XConverter.java => yaml/converter/ToCanonical.java} (51%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{converter/support/yaml => yaml/converter/support}/AssignmentBuilder.java (90%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{backend => yaml/converter/support}/InheritanceUtils.java (87%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{ => yaml}/converter/support/Parameter.java (97%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{converter/support/yaml => yaml/converter/support}/ReferenceVisitor.java (76%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{converter/support/yaml => yaml/converter/support}/SchemaBuilder.java (95%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{converter/support/yaml/visitors => yaml/converter/support}/SchemaVisitor.java (78%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{converter/support/yaml => yaml/converter/support}/TypeConverter.java (94%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{converter/support/yaml/extension/TImplementationArtifactDefinition.java => yaml/converter/support/extension/YTImplementationArtifactDefinition.java} (72%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{converter/support/yaml => yaml/converter/support}/visitors/ReferenceVisitor.java (76%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{ => yaml}/export/YamlExportAdjustmentsBuilder.java (75%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{ => yaml}/export/YamlExporter.java (91%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{ => yaml}/export/YamlToscaExportUtil.java (89%) rename org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/{ => yaml}/export/entries/YAMLDefinitionsBasedCsarEntry.java (51%) rename org.eclipse.winery.repository/src/test/java/{ => org/eclipse/winery}/librarytests/DateTest.java (95%) rename org.eclipse.winery.repository/src/test/java/{ => org/eclipse/winery}/librarytests/InheritanceIllustration.java (95%) rename org.eclipse.winery.common/src/test/java/org/eclipse/winery/common/TestUtil.java => org.eclipse.winery.repository/src/test/java/org/eclipse/winery/repository/common/UtilTests.java (65%) delete mode 100644 org.eclipse.winery.repository/src/test/java/org/eclipse/winery/repository/converter/YamlReaderTest.java rename org.eclipse.winery.repository/src/test/java/org/eclipse/winery/repository/{backend => }/filebased/MultiRepositoryManagerTest.java (98%) rename org.eclipse.winery.repository/src/test/java/org/eclipse/winery/repository/{backend/filebased/XMLRepositoryTest.java => filebased/XmlRepositoryTest.java} (93%) rename org.eclipse.winery.repository/src/test/java/org/eclipse/winery/repository/{backend => }/filebased/management/RepositoryResolverTest.java (96%) rename org.eclipse.winery.repository/src/test/java/org/eclipse/winery/repository/targetallocation/criteria/{fulfillpolicies => fulfilpolicies}/FulfillPoliciesTest.java (97%) create mode 100644 org.eclipse.winery.repository/src/test/java/org/eclipse/winery/repository/xml/XmlRepositoryIntegrationTests.java rename org.eclipse.winery.model.tosca/src/main/java/org/eclipse/winery/model/tosca/kvproperties/ConstraintClauseKVList.java => org.eclipse.winery.repository/src/test/java/org/eclipse/winery/repository/xml/export/XmlModelJAXBSupportTests.java (56%) create mode 100644 org.eclipse.winery.repository/src/test/java/org/eclipse/winery/repository/yaml/YamlReaderTest.java create mode 100644 org.eclipse.winery.repository/src/test/java/org/eclipse/winery/repository/yaml/YamlRepositoryIntegrationTests.java create mode 100644 org.eclipse.winery.repository/src/test/java/org/eclipse/winery/repository/yaml/YamlWriterTests.java create mode 100644 org.eclipse.winery.repository/src/test/resources/yaml/property_functions.yml create mode 100644 org.eclipse.winery.repository/src/test/resources/yaml/simple-tests/valid-topology_templates-1_3.yml create mode 100644 org.eclipse.winery.repository/src/test/resources/yaml/simple-tests/wrong-policy-map-in-tt.yml diff --git a/.idea/runConfigurations/Winery_Server.xml b/.idea/runConfigurations/Winery_Server.xml index aa6758acfc..b8a652fc5d 100644 --- a/.idea/runConfigurations/Winery_Server.xml +++ b/.idea/runConfigurations/Winery_Server.xml @@ -1,7 +1,7 @@ \ No newline at end of file diff --git a/.mvn/extensions.xml b/.mvn/extensions.xml new file mode 100644 index 0000000000..41949c8321 --- /dev/null +++ b/.mvn/extensions.xml @@ -0,0 +1,22 @@ + + + + + com.github.gzm55.maven + project-settings-extension + 0.1.1 + + diff --git a/.mvn/settings.xml b/.mvn/settings.xml new file mode 100644 index 0000000000..24fb777bab --- /dev/null +++ b/.mvn/settings.xml @@ -0,0 +1,36 @@ + + + + + + google-maven-central + GCS Maven Central mirror + https://maven-central.storage-download.googleapis.com/maven2/ + central + + + google-maven-central-eu + GCS Maven Central mirror EU + https://maven-central-eu.storage-download.googleapis.com/maven2/ + central + + + google-maven-central-asia + GCS Maven Central mirror Asia Pacific + https://maven-central-asia.storage-download.googleapis.com/maven2/ + central + + + diff --git a/Dockerfile b/Dockerfile index 29edb0f521..6fd20126a0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -37,7 +37,10 @@ ENV WINERY_FEATURE_RADON false ENV WINERY_FEATURE_SPLITTING false ENV WINERY_FEATURE_TEST_REFINEMENT false ENV WINERY_FEATURE_EDMM_MODELING false +ENV WINERY_FEATURE_UPDATE_TEMPLATES false ENV DOCKERIZE_VERSION v0.6.1 +ENV CHE_URL "che.localhost" +ENV CHE_URL_PROTOCOL "http" RUN rm /dev/random && ln -s /dev/urandom /dev/random \ && curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash \ diff --git a/NOTICE b/NOTICE index afb5c3f468..2539d1a76a 100644 --- a/NOTICE +++ b/NOTICE @@ -49,7 +49,7 @@ Copyright (c) 2017-2020 Clemens Lieb Copyright (c) 2017 Heiko Nickerl Copyright (c) 2017 Huabing Zhao Copyright (c) 2017 Huixin Liu -Copyright (c) 2017-2019 Karoline Saatkamp +Copyright (c) 2017-2020 Karoline Saatkamp Copyright (c) 2017 Marvin Wohlfarth Copyright (c) 2017 Michael Falkenthal Copyright (c) 2017-2020 Michael Wurster @@ -77,7 +77,7 @@ Copyright (c) 2019 Markus Schütterle Copyright (c) 2019 Michael Zimmermann Copyright (c) 2019 Ruben Verma Copyright (c) 2019 Sascha Zeller -Copyright (c) 2019 Tobias Mathony +Copyright (c) 2019-2020 Tobias Mathony Copyright (c) 2019 Yannik Dietrich Copyright (c) 2019 Yuye Tong Copyright (c) 2019-2020 Felix Burk diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml index 2ec1e997da..1e20ff345c 100644 --- a/checkstyle-suppressions.xml +++ b/checkstyle-suppressions.xml @@ -18,4 +18,5 @@ + diff --git a/deploy/che/devfile-full-pvc.yml b/deploy/che/devfile-full-pvc.yml new file mode 100644 index 0000000000..8b1ad400ac --- /dev/null +++ b/deploy/che/devfile-full-pvc.yml @@ -0,0 +1,98 @@ +apiVersion: 1.0.0 +metadata: + generateName: radon-workspace- +projects: + - name: radon-particles + source: + type: git + location: https://github.com/radon-h2020/radon-particles +components: + - alias: theia-editor + type: cheEditor + id: eclipse/che-theia/next + - alias: radon-gmt + type: kubernetes + endpoints: + - name: radon-gmt + port: 8080 + attributes: + protocol: http + secure: "false" + discoverable: "false" + public: "true" + referenceContent: | + --- + apiVersion: v1 + kind: PersistentVolume + metadata: + name: projects-volume + labels: + type: local + spec: + storageClassName: manual + capacity: + storage: 2Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/data" + --- + apiVersion: v1 + kind: PersistentVolumeClaim + metadata: + name: projects + spec: + storageClassName: manual + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi + --- + apiVersion: apps/v1 + kind: Deployment + metadata: + name: winery-deployment + labels: + app: winery + tier: frontend + spec: + replicas: 1 + selector: + matchLabels: + app: winery + tier: frontend + template: + metadata: + labels: + app: winery + tier: frontend + spec: + volumes: + - name: projects-storage + persistentVolumeClaim: + claimName: projects + containers: + - name: winery + image: opentosca/radon-gmt:latest + imagePullPolicy: Always + ports: + - containerPort: 8080 + env: + - name: WINERY_FEATURE_RADON + value: "true" + - name: WINERY_FEATURE_UPDATE_TEMPLATES + value: "true" + - name: WINERY_REPOSITORY_PROVIDER + value: "yaml" + - name: WINERY_REPOSITORY_URL + value: "https://github.com/radon-h2020/radon-particles" + - name: WINERY_REPOSITORY_PATH + value: "/projects/radon-particles" + - name: WINERY_CSAR_OUTPUT_PATH + value: "/projects/radon-csars" + - name: CHE_URL_PROTOCOL + value: "http" + volumeMounts: + - mountPath: "/projects" + name: projects-storage diff --git a/deploy/che/devfile-with-content.yml b/deploy/che/devfile-full.yml similarity index 90% rename from deploy/che/devfile-with-content.yml rename to deploy/che/devfile-full.yml index b96f09ac5a..ee2f6a0de5 100644 --- a/deploy/che/devfile-with-content.yml +++ b/deploy/che/devfile-full.yml @@ -51,6 +51,8 @@ components: env: - name: WINERY_FEATURE_RADON value: "true" + - name: WINERY_FEATURE_UPDATE_TEMPLATES + value: "true" - name: WINERY_REPOSITORY_PROVIDER value: "yaml" - name: WINERY_REPOSITORY_URL @@ -59,3 +61,5 @@ components: value: "/projects/radon-particles" - name: WINERY_CSAR_OUTPUT_PATH value: "/projects/radon-csars" + - name: CHE_URL_PROTOCOL + value: "http" diff --git a/deploy/che/winery-pvc.yaml b/deploy/che/winery-pvc.yaml new file mode 100644 index 0000000000..991dcd5eef --- /dev/null +++ b/deploy/che/winery-pvc.yaml @@ -0,0 +1,75 @@ +--- +apiVersion: v1 +kind: PersistentVolume +metadata: + name: projects-volume + labels: + type: local +spec: + storageClassName: manual + capacity: + storage: 2Gi + accessModes: + - ReadWriteOnce + hostPath: + path: "/mnt/data" +--- +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: projects +spec: + storageClassName: manual + accessModes: + - ReadWriteOnce + resources: + requests: + storage: 1Gi +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: winery-deployment + labels: + app: winery + tier: frontend +spec: + replicas: 1 + selector: + matchLabels: + app: winery + tier: frontend + template: + metadata: + labels: + app: winery + tier: frontend + spec: + volumes: + - name: projects-storage + persistentVolumeClaim: + claimName: projects + containers: + - name: winery + image: opentosca/radon-gmt:latest + imagePullPolicy: Always + ports: + - containerPort: 8080 + env: + - name: WINERY_FEATURE_RADON + value: "true" + - name: WINERY_FEATURE_UPDATE_TEMPLATES + value: "true" + - name: WINERY_REPOSITORY_PROVIDER + value: "yaml" + - name: WINERY_REPOSITORY_URL + value: "https://github.com/radon-h2020/radon-particles" + - name: WINERY_REPOSITORY_PATH + value: "/projects/radon-particles" + - name: WINERY_CSAR_OUTPUT_PATH + value: "/projects/radon-csars" + - name: CHE_URL_PROTOCOL + value: "http" + volumeMounts: + - mountPath: "/projects" + name: projects-storage diff --git a/deploy/che/winery.yaml b/deploy/che/winery.yaml index 2589d4fa38..f0a2deec4e 100644 --- a/deploy/che/winery.yaml +++ b/deploy/che/winery.yaml @@ -27,6 +27,8 @@ spec: env: - name: WINERY_FEATURE_RADON value: "true" + - name: WINERY_FEATURE_UPDATE_TEMPLATES + value: "true" - name: WINERY_REPOSITORY_PROVIDER value: "yaml" - name: WINERY_REPOSITORY_URL @@ -35,3 +37,5 @@ spec: value: "/projects/radon-particles" - name: WINERY_CSAR_OUTPUT_PATH value: "/projects/radon-csars" + - name: CHE_URL_PROTOCOL + value: "http" diff --git a/docker/docker-entrypoint.sh b/docker/docker-entrypoint.sh index 0396927fe5..6fa162c09f 100644 --- a/docker/docker-entrypoint.sh +++ b/docker/docker-entrypoint.sh @@ -1,4 +1,12 @@ #!/bin/bash + +# detect if eclipse che environment is present +if [ ! -z "${CHE_API}" ]; then + cheBaseUrl=$(echo "$CHE_API" | cut -d"/" -f3) + cheUrl=${cheBaseUrl}/dashboard/\#/ide/${CHE_WORKSPACE_NAMESPACE}/${CHE_WORKSPACE_NAME} + export CHE_URL=$cheUrl +fi + mkdir -p .winery dockerize -template winery.yml.tpl:.winery/winery.yml if [ -d "${WINERY_REPOSITORY_PATH}" ] && [ "$(ls -A ${WINERY_REPOSITORY_PATH})" ]; then diff --git a/docker/winery.yml.tpl b/docker/winery.yml.tpl index f9ef7e8d01..175f5eee21 100644 --- a/docker/winery.yml.tpl +++ b/docker/winery.yml.tpl @@ -12,6 +12,7 @@ ui: splitting: {{ .Env.WINERY_FEATURE_SPLITTING }} testRefinement: {{ .Env.WINERY_FEATURE_TEST_REFINEMENT }} edmmModeling: {{ .Env.WINERY_FEATURE_EDMM_MODELING }} + updateTemplates: {{ .Env.WINERY_FEATURE_UPDATE_TEMPLATES }} endpoints: container: http://{{ .Env.CONTAINER_HOSTNAME }}:{{ .Env.CONTAINER_PORT }} workflowmodeler: http://{{ .Env.WORKFLOWMODELER_HOSTNAME }}:{{ .Env.WORKFLOWMODELER_PORT }}/winery-workflowmodeler @@ -19,6 +20,7 @@ ui: repositoryApiUrl: http://{{ .Env.WINERY_HOSTNAME }}:{{ .Env.WINERY_PORT }}/winery repositoryUiUrl: http://{{ .Env.WINERY_HOSTNAME }}:{{ .Env.WINERY_PORT }}/# edmmTransformationTool: http://{{ .Env.EDMM_TRANSFORMATION_HOSTNAME }}:{{ .Env.EDMM_TRANSFORMATION_PORT }}/plugins/check-model-support + eclipseChe: {{ .Env.CHE_URL_PROTOCOL }}://{{ .Env.CHE_URL }} repository: provider: {{ .Env.WINERY_REPOSITORY_PROVIDER }} repositoryRoot: {{ .Env.WINERY_REPOSITORY_PATH }} diff --git a/org.eclipse.winery.accountability/pom.xml b/org.eclipse.winery.accountability/pom.xml index 5645888f6b..0f4e5d720b 100644 --- a/org.eclipse.winery.accountability/pom.xml +++ b/org.eclipse.winery.accountability/pom.xml @@ -20,18 +20,10 @@ org.eclipse.winery winery - 2.0.0-SNAPSHOT + 3.0.0-SNAPSHOT org.eclipse.winery.accountability - - - internal.repo - Temporary Staging Repository - file://${main.basedir}/target/mvn-repo - - - ../checkstyle.xml @@ -43,13 +35,11 @@ ch.qos.logback logback-classic 1.2.3 - compile org.slf4j jcl-over-slf4j 1.7.25 - compile org.junit.jupiter @@ -81,14 +71,12 @@ org.eclipse.winery org.eclipse.winery.common - 2.0.0-SNAPSHOT - compile + ${project.version} org.eclipse.virgo.util org.eclipse.virgo.util.parser.manifest 3.5.0.RELEASE - compile org.glassfish.jersey.core @@ -108,7 +96,7 @@ org.eclipse.winery org.eclipse.winery.model.csar.toscametafile - 2.0.0-SNAPSHOT + ${project.version} diff --git a/org.eclipse.winery.accountability/src/test/java/org/eclipse/winery/accountability/AccountabilityManagerImplIntegrationTest.java b/org.eclipse.winery.accountability/src/test/java/org/eclipse/winery/accountability/AccountabilityManagerImplIntegrationTest.java index 00d704cf44..1977dee5fb 100644 --- a/org.eclipse.winery.accountability/src/test/java/org/eclipse/winery/accountability/AccountabilityManagerImplIntegrationTest.java +++ b/org.eclipse.winery.accountability/src/test/java/org/eclipse/winery/accountability/AccountabilityManagerImplIntegrationTest.java @@ -34,6 +34,7 @@ import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; +import org.junit.platform.commons.util.Preconditions; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -61,12 +62,13 @@ static void killGanache() throws InterruptedException { } @BeforeEach - public void setUp() throws Exception { + public void setUp() { AccountabilityConfigurationManager.getInstance().setDefaultKeystore(); Environments.getInstance().getAccountabilityConfig().setEthereumPassword("winery"); Environments.getInstance().getAccountabilityConfig().setGethUrl("http://127.0.0.1:8545"); Environments.getInstance().getAccountabilityConfig().setSwarmGatewayUrl("https://swarm-gateways.net/"); // deploy smart contracts to (a new address in) the blockchain + try { ContractDeployer deployer = new ContractDeployer(Environments.getInstance().getAccountabilityConfig()); Environments.getInstance().getAccountabilityConfig().setEthereumProvenanceSmartContractAddress(deployer.deployProvenance()); Environments.getInstance().getAccountabilityConfig().setEthereumAuthorizationSmartContractAddress(deployer.deployAuthorization()); @@ -81,6 +83,9 @@ public void setUp() throws Exception { .getStorageProvider(ImmutableStorageProviderFactory.AvailableImmutableStorages.SWARM, Environments.getInstance().getAccountabilityConfig()); this.accountabilityManager = new AccountabilityManagerImpl(blockchainAccess, storageProvider); + } catch (Exception e) { + Preconditions.condition(false, e.getMessage()); + } } @Test @@ -103,7 +108,7 @@ public void makeHistory() throws Exception { String file0 = "myTestFile.tosca"; String manifest = "TOSCA-Meta-Version: 1.0\n" + "CSAR-Version: 1.0\n" + - "Created-By: Winery 2.0.0-SNAPSHOT\n" + + "Created-By: Winery 3.0.0-SNAPSHOT\n" + "Entry-Definitions: Definitions/servicetemplates1__MyTinyToDo_Bare_Docker.tosca\n" + "\n" + "Name: " + file0 + "\n" + diff --git a/org.eclipse.winery.accountability/src/test/java/org/eclipse/winery/accountability/AccountabilityManagerImplTest.java b/org.eclipse.winery.accountability/src/test/java/org/eclipse/winery/accountability/AccountabilityManagerImplTest.java index 7f2d3f06b9..31db361ad7 100644 --- a/org.eclipse.winery.accountability/src/test/java/org/eclipse/winery/accountability/AccountabilityManagerImplTest.java +++ b/org.eclipse.winery.accountability/src/test/java/org/eclipse/winery/accountability/AccountabilityManagerImplTest.java @@ -188,7 +188,7 @@ private static Stream verifyFileInManifestArguments() { "9e69d43768c487b7a68b95faed372544", "TOSCA-Meta-Version: 1.0\n" + "CSAR-Version: 1.0\n" + - "Created-By: Winery 2.0.0-SNAPSHOT\n" + + "Created-By: Winery 3.0.0-SNAPSHOT\n" + "Entry-Definitions: Definitions/servicetemplates1__MyTinyToDo_Bare_Docker.tosca\n" + "\n" + "Name: %s\n" + @@ -204,7 +204,7 @@ private static Stream verifyFileInManifestArguments() { "9e69d43768c487b7a68b95faed372544", "TOSCA-Meta-Version: 1.0\n" + "CSAR-Version: 1.0\n" + - "Created-By: Winery 2.0.0-SNAPSHOT\n" + + "Created-By: Winery 3.0.0-SNAPSHOT\n" + "Entry-Definitions: Definitions/servicetemplates1__MyTinyToDo_Bare_Docker.tosca\n" + "\n" + "Name: %s\n" + @@ -220,7 +220,7 @@ private static Stream verifyFileInManifestArguments() { "9e69d43768c487b7a68b95faed372544", "TOSCA-Meta-Version: 1.0\n" + "CSAR-Version: 1.0\n" + - "Created-By: Winery 2.0.0-SNAPSHOT\n" + + "Created-By: Winery 3.0.0-SNAPSHOT\n" + "Entry-Definitions: Definitions/servicetemplates1__MyTinyToDo_Bare_Docker.tosca\n" + "\n" + "Name: %s\n" + @@ -238,7 +238,7 @@ private static Stream verifyFileInManifestArguments() { "9e69d43768c487b7a68b95faed372544", "TOSCA-Meta-Version: 1.0\n" + "CSAR-Version: 1.0\n" + - "Created-By: Winery 2.0.0-SNAPSHOT\n" + + "Created-By: Winery 3.0.0-SNAPSHOT\n" + "Entry-Definitions: Definitions/servicetemplates1__MyTinyToDo_Bare_Docker.tosca\n" + "\n" + "Name: %sAD\n" + @@ -255,7 +255,7 @@ private static Stream verifyFileInManifestArguments() { private static Stream verifyManifestArguments() { String validState = "TOSCA-Meta-Version: 1.0\n" + "CSAR-Version: 1.0\n" + - "Created-By: Winery 2.0.0-SNAPSHOT\n" + + "Created-By: Winery 3.0.0-SNAPSHOT\n" + "Entry-Definitions: Definitions/servicetemplates1__MyTinyToDo_Bare_Docker.tosca\n" + "\n" + "Name: myTestFile.tosca\n" + @@ -277,7 +277,7 @@ private static Stream verifyManifestArguments() { ModelProvenanceElement unauthorizedElement = new ModelProvenanceElement(); unauthorizedElement.setFingerprint("TOSCA-Meta-Version: 1.0\n" + "CSAR-Version: 1.0\n" + - "Created-By: Winery 2.0.0-SNAPSHOT\n" + + "Created-By: Winery 3.0.0-SNAPSHOT\n" + "Entry-Definitions: Definitions/servicetemplates1__MyTinyToDo_Bare_Docker.tosca\n" + "\n" + "Name: myTestFile.tosca\n" + @@ -328,7 +328,7 @@ private static Stream verifyManifestArguments() { private static Stream validateBlockchainInputArguments() throws Exception { String manifestFile = "TOSCA-Meta-Version: 1.0\n" + "CSAR-Version: 1.0\n" + - "Created-By: Winery 2.0.0-SNAPSHOT\n" + + "Created-By: Winery 3.0.0-SNAPSHOT\n" + "Entry-Definitions: Definitions/servicetemplates1__MyTinyToDo_Bare_Docker.tosca\n" + "\n" + "Name: myTestFile.tosca\n" + @@ -374,7 +374,7 @@ private static Stream getHistoryOfSingleFileArguments() { // region string "TOSCA-Meta-Version: 1.0\n" + "CSAR-Version: 1.0\n" + - "Created-By: Winery 2.0.0-SNAPSHOT\n" + + "Created-By: Winery 3.0.0-SNAPSHOT\n" + "Entry-Definitions: Definitions/servicetemplates1__MyTinyToDo_Bare_Docker.tosca\n" + "\n" + "Name: Definitions/myTestFile.tosca\n" + @@ -390,7 +390,7 @@ private static Stream getHistoryOfSingleFileArguments() { // region string "TOSCA-Meta-Version: 1.0\n" + "CSAR-Version: 1.0\n" + - "Created-By: Winery 2.0.0-SNAPSHOT\n" + + "Created-By: Winery 3.0.0-SNAPSHOT\n" + "Entry-Definitions: Definitions/servicetemplates1__MyTinyToDo_Bare_Docker.tosca\n" + "\n" + "Name: Definitions/myTestFile.tosca\n" + @@ -410,7 +410,7 @@ private static Stream getHistoryOfSingleFileArguments() { // region string "TOSCA-Meta-Version: 1.0\n" + "CSAR-Version: 1.0\n" + - "Created-By: Winery 2.0.0-SNAPSHOT\n" + + "Created-By: Winery 3.0.0-SNAPSHOT\n" + "Entry-Definitions: Definitions/servicetemplates1__MyTinyToDo_Bare_Docker.tosca\n" + "\n" + "Name: Definitions/myTestFile.tosca\n" + @@ -460,7 +460,7 @@ private static Stream verifyFileInProvenanceElementArguments() throws String file1 = "myTestFile2.tosca"; String missingFileManifest = "TOSCA-Meta-Version: 1.0\n" + "CSAR-Version: 1.0\n" + - "Created-By: Winery 2.0.0-SNAPSHOT\n" + + "Created-By: Winery 3.0.0-SNAPSHOT\n" + "Entry-Definitions: Definitions/servicetemplates1__MyTinyToDo_Bare_Docker.tosca\n" + "\n" + "Name: " + file0 + "\n" + diff --git a/org.eclipse.winery.accountability/src/test/resources/Tosca.meta b/org.eclipse.winery.accountability/src/test/resources/Tosca.meta index ec0caafd56..c97b1c5b6f 100644 --- a/org.eclipse.winery.accountability/src/test/resources/Tosca.meta +++ b/org.eclipse.winery.accountability/src/test/resources/Tosca.meta @@ -1,6 +1,6 @@ TOSCA-Meta-Version: 1.0 CSAR-Version: 1.0 -Created-By: Winery 2.0.0-SNAPSHOT +Created-By: Winery 3.0.0-SNAPSHOT Entry-Definitions: Definitions/servicetemplates1__MyTinyToDo_Bare_Docker.tosca Name: myTestFile.tosca diff --git a/org.eclipse.winery.bpmn4tosca.converter.tobpel/pom.xml b/org.eclipse.winery.bpmn4tosca.converter.tobpel/pom.xml index dab21a5571..cac1fd154d 100644 --- a/org.eclipse.winery.bpmn4tosca.converter.tobpel/pom.xml +++ b/org.eclipse.winery.bpmn4tosca.converter.tobpel/pom.xml @@ -17,7 +17,7 @@ org.eclipse.winery winery - 2.0.0-SNAPSHOT + 3.0.0-SNAPSHOT ../pom.xml org.eclipse.winery.bpmn4tosca.converter.tobpel @@ -58,7 +58,6 @@ commons-collections - compile commons-collections @@ -69,13 +68,11 @@ org.slf4j slf4j-api ${org.slf4j} - compile org.eclipse.winery org.eclipse.winery.model.bpmn4tosca - 2.0.0-SNAPSHOT - compile + ${project.version} org.slf4j @@ -98,7 +95,7 @@ org.eclipse.winery org.eclipse.winery.common - 2.0.0-SNAPSHOT + 3.0.0-SNAPSHOT diff --git a/org.eclipse.winery.bpmn4tosca.converter.tobpel/src/test/java/org/eclipse/winery/bpmn2bpel/BPMN4Tosca2BpelTest.java b/org.eclipse.winery.bpmn4tosca.converter.tobpel/src/test/java/org/eclipse/winery/bpmn2bpel/BPMN4Tosca2BpelTest.java index f2ec31870d..8721d45123 100644 --- a/org.eclipse.winery.bpmn4tosca.converter.tobpel/src/test/java/org/eclipse/winery/bpmn2bpel/BPMN4Tosca2BpelTest.java +++ b/org.eclipse.winery.bpmn4tosca.converter.tobpel/src/test/java/org/eclipse/winery/bpmn2bpel/BPMN4Tosca2BpelTest.java @@ -16,6 +16,7 @@ import java.net.MalformedURLException; import java.net.URI; import java.net.URISyntaxException; +import java.nio.file.Path; import java.nio.file.Paths; import org.eclipse.winery.bpmn2bpel.parser.ParseException; @@ -27,12 +28,22 @@ public class BPMN4Tosca2BpelTest { - protected static String RESOURCES_DIR = "src/test/resources/bpmn4tosca"; + protected static final Path RESOURCES_DIR; + + static { + Path stub; + try { + stub = Paths.get(BPMN4Tosca2BpelTest.class.getClassLoader().getResource("bpmn4tosca").toURI()); + } catch (URISyntaxException e) { + stub = Paths.get(System.getProperty("java.io.tmpdir"), "resolution-failed"); + } + RESOURCES_DIR = stub; + } @Test public void testTransform() throws ParseException, PlanWriterException, MalformedURLException, URISyntaxException { - URI srcUri = Paths.get(RESOURCES_DIR, "bpmn4tosca.json").toUri(); - URI targetUri = Paths.get(RESOURCES_DIR, "managementplan.zip").toUri(); + URI srcUri = RESOURCES_DIR.resolve("bpmn4tosca.json").toUri(); + URI targetUri = RESOURCES_DIR.resolve("managementplan.zip").toUri(); BPMN4Tosca2BpelTest.class.getResource("."); Bpmn4Tosca2Bpel transformer = new Bpmn4Tosca2Bpel(); transformer.transform(srcUri, targetUri); @@ -41,8 +52,8 @@ public void testTransform() throws ParseException, PlanWriterException, Malforme @Test public void testTransformGateway() throws ParseException, PlanWriterException, MalformedURLException, URISyntaxException { - URI srcUri = Paths.get(RESOURCES_DIR, "bpmn4tosca.exclusivegateway.json").toUri(); - URI targetUri = Paths.get(RESOURCES_DIR, "managementplan.exclusivegateway.zip").toUri(); + URI srcUri = RESOURCES_DIR.resolve("bpmn4tosca.exclusivegateway.json").toUri(); + URI targetUri = RESOURCES_DIR.resolve("managementplan.exclusivegateway.zip").toUri(); BPMN4Tosca2BpelTest.class.getResource("."); Bpmn4Tosca2Bpel transformer = new Bpmn4Tosca2Bpel(); transformer.transform(srcUri, targetUri); @@ -51,8 +62,8 @@ public void testTransformGateway() @Test public void testNoEndpointGateway() throws ParseException, PlanWriterException, MalformedURLException, URISyntaxException { - URI srcUri = Paths.get(RESOURCES_DIR, "bpmn4tosca.noEndpoint.json").toUri(); - URI targetUri = Paths.get(RESOURCES_DIR, "managementplan.noEndpoint.zip").toUri(); + URI srcUri = RESOURCES_DIR.resolve("bpmn4tosca.noEndpoint.json").toUri(); + URI targetUri = RESOURCES_DIR.resolve("managementplan.noEndpoint.zip").toUri(); BPMN4Tosca2BpelTest.class.getResource("."); Bpmn4Tosca2Bpel transformer = new Bpmn4Tosca2Bpel(); transformer.transform(srcUri, targetUri); @@ -61,8 +72,8 @@ public void testNoEndpointGateway() @Test public void testUndefinedEndpointGateway() throws ParseException, PlanWriterException, MalformedURLException, URISyntaxException { - URI srcUri = Paths.get(RESOURCES_DIR, "bpmn4tosca.undefinedEndpoint.json").toUri(); - URI targetUri = Paths.get(RESOURCES_DIR, "managementplan.undefinedEndpoint.zip").toUri(); + URI srcUri = RESOURCES_DIR.resolve("bpmn4tosca.undefinedEndpoint.json").toUri(); + URI targetUri = RESOURCES_DIR.resolve("managementplan.undefinedEndpoint.zip").toUri(); BPMN4Tosca2BpelTest.class.getResource("."); Bpmn4Tosca2Bpel transformer = new Bpmn4Tosca2Bpel(); transformer.transform(srcUri, targetUri); @@ -71,8 +82,8 @@ public void testUndefinedEndpointGateway() @Test public void testNonExistingEndpointGateway() throws ParseException, PlanWriterException, MalformedURLException, URISyntaxException { - URI srcUri = Paths.get(RESOURCES_DIR, "bpmn4tosca.nonExistingEndpoint.json").toUri(); - URI targetUri = Paths.get(RESOURCES_DIR, "managementplan.nonExistingEndpoint.zip").toUri(); + URI srcUri = RESOURCES_DIR.resolve("bpmn4tosca.nonExistingEndpoint.json").toUri(); + URI targetUri = RESOURCES_DIR.resolve("managementplan.nonExistingEndpoint.zip").toUri(); BPMN4Tosca2BpelTest.class.getResource("."); diff --git a/org.eclipse.winery.bpmn4tosca.converter.tobpel/src/test/java/org/eclipse/winery/bpmn2bpel/BpelPlanArtefactWriterTest.java b/org.eclipse.winery.bpmn4tosca.converter.tobpel/src/test/java/org/eclipse/winery/bpmn2bpel/BpelPlanArtefactWriterTest.java index 1cf0e143bf..46805716ae 100644 --- a/org.eclipse.winery.bpmn4tosca.converter.tobpel/src/test/java/org/eclipse/winery/bpmn2bpel/BpelPlanArtefactWriterTest.java +++ b/org.eclipse.winery.bpmn4tosca.converter.tobpel/src/test/java/org/eclipse/winery/bpmn2bpel/BpelPlanArtefactWriterTest.java @@ -33,7 +33,7 @@ public class BpelPlanArtefactWriterTest { @Test public void testWritePlan() throws MalformedURLException, ParseException, URISyntaxException { Bpmn4JsonParser parser = new Bpmn4JsonParser(); - URI uri = Paths.get("src/test/resources/bpmn4tosca/bpmn4tosca.json").toUri(); + URI uri = getClass().getClassLoader().getResource("bpmn4tosca/bpmn4tosca.json").toURI(); //Path testBpmn4JsonFile = Paths.get("C:/temp/bpmn4tosca/bpmn4tosca.json"); ManagementFlow mngmtFlow = parser.parse(uri); diff --git a/org.eclipse.winery.cli/pom.xml b/org.eclipse.winery.cli/pom.xml index 27372743e2..47aac4f805 100644 --- a/org.eclipse.winery.cli/pom.xml +++ b/org.eclipse.winery.cli/pom.xml @@ -18,16 +18,16 @@ org.eclipse.winery winery - 2.0.0-SNAPSHOT + 3.0.0-SNAPSHOT org.eclipse.winery.cli jar - + ../checkstyle.xml ${project.parent.basedir} - + commons-cli @@ -42,12 +42,12 @@ org.eclipse.winery org.eclipse.winery.repository - 2.0.0-SNAPSHOT + ${project.version} org.eclipse.winery org.eclipse.winery.tools.copybaragenerator - 2.0.0-SNAPSHOT + ${project.version} ch.qos.logback @@ -60,6 +60,7 @@ ${org.slf4j} + @@ -133,7 +134,7 @@ false + implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer"> org.eclipse.winery.cli.WineryCli diff --git a/org.eclipse.winery.common/.gitignore b/org.eclipse.winery.common/.gitignore deleted file mode 100644 index 4cac871a1d..0000000000 --- a/org.eclipse.winery.common/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -/.gradle -.classpath -.project -.settings/org.eclipse.core.resources.prefs -.settings/org.eclipse.jdt.core.prefs -.settings/org.eclipse.m2e.core.prefs -.settings/org.eclipse.wst.common.component -.settings/org.eclipse.wst.common.project.facet.core.xml -.settings/org.eclipse.wst.validation.prefs -/.sonar -/bin -/build -/src/main/resources/rebel.xml -/target diff --git a/org.eclipse.winery.common/about.html b/org.eclipse.winery.common/about.html deleted file mode 100644 index 3fccaa63ee..0000000000 --- a/org.eclipse.winery.common/about.html +++ /dev/null @@ -1,150 +0,0 @@ - - - - - About - - -

About This Content

- -

January 24, 2014

-

License

- -

The Eclipse Foundation makes available all content in this plug-in (“Content”). Unless otherwise - indicated below, the Content is provided to you under the terms and conditions of the - Eclipse Public License Version 2.0 (“EPL”) - and Apache License Version 2.0. - A copy of the EPL is available at http://www.eclipse.org/legal/epl-v20.html - and a copy of the Apache License Version 2.0 is available at http://www.opensource.org/licenses/apache2.0.php. - You may elect to redistribute this code under either of these licenses. - For purposes of the EPL, “Program” will mean the Content. -

- -

- If you did not receive this Content directly from the Eclipse Foundation, the Content is - being redistributed by another party (“Redistributor”) and different terms and conditions may - apply to your use of any object code in the Content. Check the Redistributor’s license that was - provided with the Content. If no such license exists, contact the Redistributor. Unless otherwise - indicated below, the terms and conditions of the EPL and Apache License 2.0 still apply to any source code - in the Content and such source code may be obtained at http://www.eclipse.org. -

- -

Third Party Content

- -

Java Libraries

- -
Apache Commons IO – Version 2.4
- - - - - - - - - -
URLhttp://commons.apache.org/proper/commons-io/
LicenseApache 2.0. A copy of the license is contained in the file Apache-LICENSE-2.0.txt and - is also available at http://www.apache.org/licenses/LICENSE-2.0 -
- -
Apache Commons Lang3 – Version 3.1
- - - - - - - - - -
URLhttp://commons.apache.org/proper/commons-lang/ -
LicenseApache 2.0. A copy of the license is contained in the file Apache-LICENSE-2.0.txt and - is also available at http://www.apache.org/licenses/LICENSE-2.0 -
- -
JSP Standard Tag Library – Version 1.2
- - - - - - - - - -
URLhttps://jstl.java.net/
LicenseCDDL and GPL with classpath exception (https://jersey.java.net/license.html). - The Eclipse Foundation elects to include this software in this distribution under the CDDL license. - A copy of the license is available at CDDL-v1.1.txt. -
- -
Logback Classic – Version 1.1.1
- - - - - - - - - -
URLhttp://logback.qos.ch/
LicenseEPL/LGPL dual license. - EPL: http://www.eclipse.org/legal/epl-v20.html. - LGPL v2.1: http://www.gnu.org/licenses/old-licenses/lgpl-2.1. - A copy of the license is contained in the file LICENSE-logback.txt - and is also available at http://logback.qos.ch/license.html. - The Eclipse Foundation elects to include this software in this distribution under the EPL license. -
- -
Logback Core – Version 1.1.1
- - - - - - - - - -
URLhttp://logback.qos.ch/
LicenseEPL/LGPL dual license. - EPL: http://www.eclipse.org/legal/epl-v20.html. - LGPL v2.1: http://www.gnu.org/licenses/old-licenses/lgpl-2.1. - A copy of the license is contained in the file LICENSE-logback.txt - and is also available at http://logback.qos.ch/license.html. - The Eclipse Foundation elects to include this software in this distribution under the EPL license. -
- -
SLF4J: slf4j-api – Version 1.7.6
- - - - - - - - - -
URLhttp://www.slf4j.org/
LicenseMIT. A copy of the license is contained in the file LICENSE-slf4j-api.txt and is also - available at http://www.slf4j.org/license.html
- -
SLF4J: jcl-over-slf4j – Version 1.7.6
- - - - - - - - - -
URLhttp://www.slf4j.org/legacy.html
LicenseApache 2.0. A copy of the license is contained in the file Apache-LICENSE-2.0.txt and - is also available at http://www.apache.org/licenses/LICENSE-2.0 -
- - - diff --git a/org.eclipse.winery.common/about_files/Apache-LICENSE-2.0.txt b/org.eclipse.winery.common/about_files/Apache-LICENSE-2.0.txt deleted file mode 100644 index d645695673..0000000000 --- a/org.eclipse.winery.common/about_files/Apache-LICENSE-2.0.txt +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - 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. diff --git a/org.eclipse.winery.common/about_files/CDDL-v1.1.txt b/org.eclipse.winery.common/about_files/CDDL-v1.1.txt deleted file mode 100644 index 7cc8719b3b..0000000000 --- a/org.eclipse.winery.common/about_files/CDDL-v1.1.txt +++ /dev/null @@ -1,129 +0,0 @@ -COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL - Version 1.1) -1. Definitions. - - 1.1. “Contributor†means each individual or entity that creates or contributes to the creation of Modifications. - - 1.2. “Contributor Version†means the combination of the Original Software, prior Modifications used by a Contributor (if any), and the Modifications made by that particular Contributor. - - 1.3. “Covered Software†means (a) the Original Software, or (b) Modifications, or (c) the combination of files containing Original Software with files containing Modifications, in each case including portions thereof. - - 1.4. “Executable†means the Covered Software in any form other than Source Code. - - 1.5. “Initial Developer†means the individual or entity that first makes Original Software available under this License. - - 1.6. “Larger Work†means a work which combines Covered Software or portions thereof with code not governed by the terms of this License. - - 1.7. “License†means this document. - - 1.8. “Licensable†means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein. - - 1.9. “Modifications†means the Source Code and Executable form of any of the following: - - A. Any file that results from an addition to, deletion from or modification of the contents of a file containing Original Software or previous Modifications; - - B. Any new file that contains any part of the Original Software or previous Modification; or - - C. Any new file that is contributed or otherwise made available under the terms of this License. - - 1.10. “Original Software†means the Source Code and Executable form of computer software code that is originally released under this License. - - 1.11. “Patent Claims†means any patent claim(s), now owned or hereafter acquired, including without limitation, method, process, and apparatus claims, in any patent Licensable by grantor. - - 1.12. “Source Code†means (a) the common form of computer software code in which modifications are made and (b) associated documentation included in or with such code. - - 1.13. “You†(or “Yourâ€) means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License. For legal entities, “You†includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, “control†means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. - -2. License Grants. - - 2.1. The Initial Developer Grant. - - Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, the Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than patent or trademark) Licensable by Initial Developer, to use, reproduce, modify, display, perform, sublicense and distribute the Original Software (or portions thereof), with or without Modifications, and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using or selling of Original Software, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Software (or portions thereof). - - (c) The licenses granted in Sections 2.1(a) and (b) are effective on the date Initial Developer first distributes or otherwise makes the Original Software available to a third party under the terms of this License. - - (d) Notwithstanding Section 2.1(b) above, no patent license is granted: (1) for code that You delete from the Original Software, or (2) for infringements caused by: (i) the modification of the Original Software, or (ii) the combination of the Original Software with other software or devices. - - 2.2. Contributor Grant. - - Conditioned upon Your compliance with Section 3.1 below and subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license: - - (a) under intellectual property rights (other than patent or trademark) Licensable by Contributor to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof), either on an unmodified basis, with other Modifications, as Covered Software and/or as part of a Larger Work; and - - (b) under Patent Claims infringed by the making, using, or selling of Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: (1) Modifications made by that Contributor (or portions thereof); and (2) the combination of Modifications made by that Contributor with its Contributor Version (or portions of such combination). - - (c) The licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first distributes or otherwise makes the Modifications available to a third party. - - (d) Notwithstanding Section 2.2(b) above, no patent license is granted: (1) for any code that Contributor has deleted from the Contributor Version; (2) for infringements caused by: (i) third party modifications of Contributor Version, or (ii) the combination of Modifications made by that Contributor with other software (except as part of the Contributor Version) or other devices; or (3) under Patent Claims infringed by Covered Software in the absence of Modifications made by that Contributor. - -3. Distribution Obligations. - - 3.1. Availability of Source Code. - - Any Covered Software that You distribute or otherwise make available in Executable form must also be made available in Source Code form and that Source Code form must be distributed only under the terms of this License. You must include a copy of this License with every copy of the Source Code form of the Covered Software You distribute or otherwise make available. You must inform recipients of any such Covered Software in Executable form as to how they can obtain such Covered Software in Source Code form in a reasonable manner on or through a medium customarily used for software exchange. - - 3.2. Modifications. - - The Modifications that You create or to which You contribute are governed by the terms of this License. You represent that You believe Your Modifications are Your original creation(s) and/or You have sufficient rights to grant the rights conveyed by this License. - - 3.3. Required Notices. - - You must include a notice in each of Your Modifications that identifies You as the Contributor of the Modification. You may not remove or alter any copyright, patent or trademark notices contained within the Covered Software, or any notices of licensing or any descriptive text giving attribution to any Contributor or the Initial Developer. - - 3.4. Application of Additional Terms. - - You may not offer or impose any terms on any Covered Software in Source Code form that alters or restricts the applicable version of this License or the recipients’ rights hereunder. You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, you may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear that any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer. - - 3.5. Distribution of Executable Versions. - - You may distribute the Executable form of the Covered Software under the terms of this License or under the terms of a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable form does not attempt to limit or alter the recipient’s rights in the Source Code form from the rights set forth in this License. If You distribute the Covered Software in Executable form under a different license, You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer. - - 3.6. Larger Works. - - You may create a Larger Work by combining Covered Software with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Software. - -4. Versions of the License. - - 4.1. New Versions. - - Oracle is the initial license steward and may publish revised and/or new versions of this License from time to time. Each version will be given a distinguishing version number. Except as provided in Section 4.3, no one other than the license steward has the right to modify this License. - - 4.2. Effect of New Versions. - - You may always continue to use, distribute or otherwise make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. If the Initial Developer includes a notice in the Original Software prohibiting it from being distributed or otherwise made available under any subsequent version of the License, You must distribute and make the Covered Software available under the terms of the version of the License under which You originally received the Covered Software. Otherwise, You may also choose to use, distribute or otherwise make the Covered Software available under the terms of any subsequent version of the License published by the license steward. - - 4.3. Modified Versions. - - When You are an Initial Developer and You want to create a new license for Your Original Software, You may create and use a modified version of this License if You: (a) rename the license and remove any references to the name of the license steward (except to note that the license differs from this License); and (b) otherwise make it clear that the license contains terms which differ from this License. - -5. DISCLAIMER OF WARRANTY. - -COVERED SOFTWARE IS PROVIDED UNDER THIS LICENSE ON AN “AS IS†BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED SOFTWARE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED SOFTWARE IS WITH YOU. SHOULD ANY COVERED SOFTWARE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED SOFTWARE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER. -6. TERMINATION. - - 6.1. This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive. - - 6.2. If You assert a patent infringement claim (excluding declaratory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You assert such claim is referred to as “Participantâ€) alleging that the Participant Software (meaning the Contributor Version where the Participant is a Contributor or the Original Software where the Participant is the Initial Developer) directly or indirectly infringes any patent, then any and all rights granted directly or indirectly to You by such Participant, the Initial Developer (if the Initial Developer is not the Participant) and all Contributors under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively and automatically at the expiration of such 60 day notice period, unless if within such 60 day period You withdraw Your claim with respect to the Participant Software against such Participant either unilaterally or pursuant to a written agreement with Participant. - - 6.3. If You assert a patent infringement claim against Participant alleging that the Participant Software directly or indirectly infringes any patent where such claim is resolved (such as by license or settlement) prior to the initiation of patent infringement litigation, then the reasonable value of the licenses granted by such Participant under Sections 2.1 or 2.2 shall be taken into account in determining the amount or value of any payment or license. - - 6.4. In the event of termination under Sections 6.1 or 6.2 above, all end user licenses that have been validly granted by You or any distributor hereunder prior to termination (excluding licenses granted to You by any distributor) shall survive termination. - -7. LIMITATION OF LIABILITY. - -UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED SOFTWARE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY’S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU. -8. U.S. GOVERNMENT END USERS. - -The Covered Software is a “commercial item,†as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of “commercial computer software†(as that term is defined at 48 C.F.R. § 252.227-7014(a)(1)) and “commercial computer software documentation†as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Software with only those rights set forth herein. This U.S. Government Rights clause is in lieu of, and supersedes, any other FAR, DFAR, or other clause or provision that addresses Government rights in computer software under this License. -9. MISCELLANEOUS. - -This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by the law of the jurisdiction specified in a notice contained within the Original Software (except to the extent applicable law, if any, provides otherwise), excluding such jurisdiction’s conflict-of-law provisions. Any litigation relating to this License shall be subject to the jurisdiction of the courts located in the jurisdiction and venue specified in a notice contained within the Original Software, with the losing party responsible for costs, including, without limitation, court costs and reasonable attorneys’ fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License. You agree that You alone are responsible for compliance with the United States export administration regulations (and the export control laws and regulation of any other countries) when You use, distribute or otherwise make available any Covered Software. -10. RESPONSIBILITY FOR CLAIMS. - -As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability. -NOTICE PURSUANT TO SECTION 9 OF THE COMMON DEVELOPMENT AND DISTRIBUTION LICENSE (CDDL) - -The code released under the CDDL shall be governed by the laws of the State of California (excluding conflict-of-law provisions). Any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California and the state courts of the State of California, with venue lying in Santa Clara County, California. \ No newline at end of file diff --git a/org.eclipse.winery.common/about_files/LICENSE-logback.txt b/org.eclipse.winery.common/about_files/LICENSE-logback.txt deleted file mode 100644 index b4fe24e02a..0000000000 --- a/org.eclipse.winery.common/about_files/LICENSE-logback.txt +++ /dev/null @@ -1,15 +0,0 @@ -Logback LICENSE ---------------- - -Logback: the reliable, generic, fast and flexible logging framework. -Copyright (C) 1999-2012, QOS.ch. All rights reserved. - -This program and the accompanying materials are dual-licensed under -either the terms of the Eclipse Public License v1.0 as published by -the Eclipse Foundation - - or (per the licensee's choosing) - -under the terms of the GNU Lesser General Public License version 2.1 -as published by the Free Software Foundation. - diff --git a/org.eclipse.winery.common/about_files/LICENSE-slf4j-api.txt b/org.eclipse.winery.common/about_files/LICENSE-slf4j-api.txt deleted file mode 100644 index 37050c9568..0000000000 --- a/org.eclipse.winery.common/about_files/LICENSE-slf4j-api.txt +++ /dev/null @@ -1,21 +0,0 @@ - Copyright (c) 2004-2013 QOS.ch - All rights reserved. - - Permission is hereby granted, free of charge, to any person obtaining - a copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - - The above copyright notice and this permission notice shall be - included in all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/org.eclipse.winery.common/pom.xml b/org.eclipse.winery.common/pom.xml index 9758a43e41..2dae3fc98b 100644 --- a/org.eclipse.winery.common/pom.xml +++ b/org.eclipse.winery.common/pom.xml @@ -18,7 +18,7 @@ org.eclipse.winery winery - 2.0.0-SNAPSHOT + 3.0.0-SNAPSHOT org.eclipse.winery.common @@ -32,21 +32,15 @@ jitpack.io - https://jitpack.io + https://www.jitpack.io - - com.github.ust-edmm.edmm - edmm-core - v1.0.6 - org.slf4j slf4j-api ${org.slf4j} - compile org.yaml @@ -54,28 +48,35 @@ 1.17 - org.eclipse.winery - org.eclipse.winery.model.tosca - 2.0.0-SNAPSHOT - compile + com.fasterxml.jackson.core + jackson-core + 2.10.1 + + + org.glassfish.jaxb + jaxb-runtime + ${org.glassfish.jxb} + runtime + + + org.glassfish.jersey.media + jersey-media-json-jackson + ${jersey.version} org.slf4j jcl-over-slf4j ${org.slf4j} - compile jstl jstl 1.2 - compile commons-io commons-io 2.4 - compile commons-logging @@ -87,7 +88,6 @@ org.apache.commons commons-lang3 ${org.apache.commons-lang3.version} - compile org.apache.commons @@ -111,6 +111,16 @@ ${junit.jupiter.version} test + + io.github.adr + e-adr + ${io.github.adr.e-adr.version} + + + org.eclipse.jdt + org.eclipse.jdt.annotation + ${org.eclipse.jdt.annotation} + diff --git a/org.eclipse.winery.common/sonar-project.properties b/org.eclipse.winery.common/sonar-project.properties deleted file mode 100644 index 34b855df56..0000000000 --- a/org.eclipse.winery.common/sonar-project.properties +++ /dev/null @@ -1,31 +0,0 @@ -################################################################################ -# Copyright (c) 2014 Contributors to the Eclipse Foundation -# -# See the NOTICE file(s) distributed with this work for additional -# information regarding copyright ownership. -# -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License 2.0 which is available at -# http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 -# which is available at https://www.apache.org/licenses/LICENSE-2.0. -# -# SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 -################################################################################# -# required metadata -sonar.projectKey=org.eclipse.winery.common -sonar.projectName=org.eclipse.winery.common -sonar.projectVersion=0.1.2 -# path to source directories (required) -sonar.sources=src/main/java -# path to test source directories (optional) -#sonar.tests= -# path to project binaries (optional), for example directory of Java bytecode -#sonar.binaries=binDir -# optional comma-separated list of paths to libraries. Only path to JAR file and path to directory of classes are supported. -#sonar.libraries=org.eclipse.jgit-2.1.0.201209190230-r.jar -# The value of the property must be the key of the language. -sonar.language=java -# enforce Java 1.7 to enable analysis of diamond operator by PMD -# Winery uses 1.8 -sonar.java.source=1.8 -sonar.sourceEncoding=UTF-8 diff --git a/org.eclipse.winery.common/src/main/java/META-INF/MANIFEST.MF b/org.eclipse.winery.common/src/main/java/META-INF/MANIFEST.MF deleted file mode 100644 index 254272e1c0..0000000000 --- a/org.eclipse.winery.common/src/main/java/META-INF/MANIFEST.MF +++ /dev/null @@ -1,3 +0,0 @@ -Manifest-Version: 1.0 -Class-Path: - diff --git a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/configuration/ConfigurationTestUtils.java b/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/configuration/ConfigurationTestUtils.java index 93b6580766..8767d0b6a5 100644 --- a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/configuration/ConfigurationTestUtils.java +++ b/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/configuration/ConfigurationTestUtils.java @@ -55,7 +55,7 @@ public static void saveCurrentConfiguration() { */ public static void replaceFileWithTestFile() throws IOException { Environment.getInstance().setConfiguration(null); - InputStream testConfigInputStream = ConfigurationTestUtils.class.getClassLoader().getResourceAsStream("wineryTest.yml"); + InputStream testConfigInputStream = ConfigurationTestUtils.class.getClassLoader().getResourceAsStream(Environment.TEST_CONFIG_NAME); if (testConfigInputStream == null) { throw new NullPointerException(); } diff --git a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/configuration/Environment.java b/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/configuration/Environment.java index b23f32fd3a..a74311c210 100644 --- a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/configuration/Environment.java +++ b/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/configuration/Environment.java @@ -37,10 +37,11 @@ */ final class Environment { + static final String TEST_CONFIG_NAME = "wineryTest.yml"; private static final Logger LOGGER = LoggerFactory.getLogger(Environment.class); private static final String DEFAULT_CONFIG_NAME = "winery.yml"; - private static final String TEST_CONFIG_NAME = "wineryTest.yml"; + // Visible for test classes private static final File DEFAULT_CONFIG_DIRECTORY = new File(System.getProperty("user.home"), ".winery"); private static final File DEFAULT_CONFIG_FILE = new File(DEFAULT_CONFIG_DIRECTORY, DEFAULT_CONFIG_NAME); private static final File LINUX_CONFIG_FILE = new File("/opt/winery/.winery", DEFAULT_CONFIG_NAME); @@ -164,6 +165,7 @@ private void copyDefaultConfigFile() { if (defaultConfigInputStream == null) { throw new NullPointerException(); } + LOGGER.info("Copying default configuration to user home"); FileUtils.copyInputStreamToFile(defaultConfigInputStream, Environment.DEFAULT_CONFIG_FILE); } catch (IOException | NullPointerException e) { LOGGER.debug("Error while copying the default config file into the winery directory", e); diff --git a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/configuration/Environments.java b/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/configuration/Environments.java index ce2b274166..1ea854db7a 100644 --- a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/configuration/Environments.java +++ b/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/configuration/Environments.java @@ -20,7 +20,6 @@ import java.nio.file.Paths; import java.util.ArrayList; import java.util.Objects; -import java.util.Optional; import java.util.Properties; import org.apache.commons.configuration2.YAMLConfiguration; @@ -182,9 +181,9 @@ public FileBasedRepositoryConfiguration getFilebasedRepositoryConfiguration() { * * @return an instance of GitBasedRepositoryConfiguration */ - public Optional getGitBasedRepositoryConfiguration() { + public GitBasedRepositoryConfiguration getGitBasedRepositoryConfiguration() { final FileBasedRepositoryConfiguration filebasedRepositoryConfiguration = getFilebasedRepositoryConfiguration(); - return Optional.of(new GitBasedRepositoryConfiguration(this.getGitConfig().isAutocommit(), filebasedRepositoryConfiguration)); + return new GitBasedRepositoryConfiguration(this.getGitConfig().isAutocommit(), filebasedRepositoryConfiguration); } /** @@ -210,5 +209,12 @@ public static void resetAccountabilityConfiguration() throws IOException { Environment.getInstance().reloadAccountabilityConfiguration(inputStream); } } + + public static boolean isFeatureEnabled(String name) { + Boolean value = getInstance().getUiConfig().getFeatures().get(name); + if (value == null) { + return false; + } + return value; + } } - diff --git a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/configuration/FileBasedRepositoryConfiguration.java b/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/configuration/FileBasedRepositoryConfiguration.java index 567b6470c6..49550b1390 100644 --- a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/configuration/FileBasedRepositoryConfiguration.java +++ b/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/configuration/FileBasedRepositoryConfiguration.java @@ -35,7 +35,8 @@ public FileBasedRepositoryConfiguration(@NonNull Path repositoryPath) { this(repositoryPath, Environments.getInstance().getRepositoryConfig().getProvider()); } - private FileBasedRepositoryConfiguration(@NonNull Path repositoryPath, RepositoryConfigurationObject.RepositoryProvider repositoryProvider) { + // We are making the access public here to enable proper testing. + public FileBasedRepositoryConfiguration(@NonNull Path repositoryPath, RepositoryConfigurationObject.RepositoryProvider repositoryProvider) { this.repositoryPath = Objects.requireNonNull(repositoryPath); this.repositoryProvider = Objects.requireNonNull(repositoryProvider); } diff --git a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/configuration/RepositoryConfigurationObject.java b/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/configuration/RepositoryConfigurationObject.java index 25e46636cd..6796534553 100644 --- a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/configuration/RepositoryConfigurationObject.java +++ b/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/configuration/RepositoryConfigurationObject.java @@ -15,13 +15,23 @@ package org.eclipse.winery.common.configuration; import java.io.File; +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; -import org.eclipse.winery.common.Util; +import org.eclipse.winery.common.Constants; import org.apache.commons.configuration2.YAMLConfiguration; +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.SystemUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; public class RepositoryConfigurationObject extends AbstractConfigurationObject { - + // this class shares the responsibility of the Environment class in abstracting + // over interactions with the configuration file. Loggers are therefore shared. + private static final Logger LOGGER = LoggerFactory.getLogger(Environment.class); + private static final String key = "repository."; private GitConfigurationObject gitConfiguration; @@ -99,7 +109,7 @@ public void setProvider(RepositoryProvider provider) { public String getRepositoryRoot() { String repositoryRoot = this.repositoryRoot; if (repositoryRoot == null || repositoryRoot.isEmpty()) { - repositoryRoot = Util.determineAndCreateRepositoryPath().toString(); + repositoryRoot = determineAndCreateRepositoryPath().toString(); } setRepositoryRoot(repositoryRoot); return repositoryRoot; @@ -116,7 +126,7 @@ public String getCsarOutputPath() { csarOutputPath = getRepositoryRoot() + File.separator + "csars"; } setCsarOutputPath(csarOutputPath); - Util.createCsarOutputPath(csarOutputPath); + createCsarOutputPath(csarOutputPath); return csarOutputPath; } @@ -132,4 +142,61 @@ public GitConfigurationObject getGitConfiguration() { public void setGitConfiguration(GitConfigurationObject gitConfiguration) { this.gitConfiguration = gitConfiguration; } + + private static Path determineAndCreateRepositoryPath() { + Path repositoryPath; + if (SystemUtils.IS_OS_WINDOWS) { + if (Files.exists(Constants.GLOBAL_REPO_PATH_WINDOWS)) { + repositoryPath = Constants.GLOBAL_REPO_PATH_WINDOWS; + } else { + repositoryPath = createDefaultRepositoryPath(); + } + } else { + repositoryPath = createDefaultRepositoryPath(); + } + return repositoryPath; + } + + private static Path createDefaultRepositoryPath() { + File repo = null; + boolean operationalFileSystemAccess; + try { + repo = new File(FileUtils.getUserDirectory(), Constants.DEFAULT_REPO_NAME); + operationalFileSystemAccess = true; + } catch (NullPointerException e) { + // it seems, we run at a system, where we do not have any filesystem + // access + operationalFileSystemAccess = false; + } + + // operationalFileSystemAccess = false; + + Path repositoryPath; + if (operationalFileSystemAccess) { + try { + FileUtils.forceMkdir(repo); + } catch (IOException e) { + LOGGER.debug("Error while creating directory.", e); + } + repositoryPath = repo.toPath(); + } else { + // we do not have access to the file system + throw new IllegalStateException("No write access to file system"); + } + + return repositoryPath; + } + + private static void createCsarOutputPath(String csarOutputPath) { + File outputPath = new File(csarOutputPath); + if (outputPath.exists() && outputPath.isDirectory()) { + return; + } + try { + org.apache.commons.io.FileUtils.forceMkdir(outputPath); + } catch (IOException e) { + LOGGER.error("Error while creating directory: {}", e.getMessage(), e); + throw new IllegalStateException(e); + } + } } diff --git a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/version/VersionUtils.java b/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/version/VersionUtils.java index 0d15c5f76d..002fcdee1a 100644 --- a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/version/VersionUtils.java +++ b/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/version/VersionUtils.java @@ -18,58 +18,17 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; -import javax.xml.namespace.QName; - -import org.eclipse.winery.common.ids.definitions.ArtifactTemplateId; -import org.eclipse.winery.common.ids.definitions.ArtifactTypeId; -import org.eclipse.winery.common.ids.definitions.CapabilityTypeId; -import org.eclipse.winery.common.ids.definitions.DefinitionsChildId; -import org.eclipse.winery.common.ids.definitions.NodeTypeId; -import org.eclipse.winery.common.ids.definitions.NodeTypeImplementationId; -import org.eclipse.winery.common.ids.definitions.PolicyTemplateId; -import org.eclipse.winery.common.ids.definitions.PolicyTypeId; -import org.eclipse.winery.common.ids.definitions.RelationshipTypeId; -import org.eclipse.winery.common.ids.definitions.RelationshipTypeImplementationId; -import org.eclipse.winery.common.ids.definitions.RequirementTypeId; -import org.eclipse.winery.common.ids.definitions.ServiceTemplateId; -import org.eclipse.winery.model.tosca.HasIdInIdOrNameField; -import org.eclipse.winery.model.tosca.TExtensibleElements; -import org.eclipse.winery.model.tosca.TRelationshipTemplate; - -import de.danielbechler.diff.ObjectDifferBuilder; -import de.danielbechler.diff.identity.IdentityStrategy; -import de.danielbechler.diff.node.DiffNode; import io.github.adr.embedded.ADR; /** * Utility class for working with versions. - * - * TODO: DefinitionsChildId specific parts should go into into the DefinitionsChildId to have a true object-oriented - * thinking */ public class VersionUtils { - private static final Pattern VERSION_PATTERN = Pattern.compile("_(([^_]*)-)?w([0-9]+)(-wip([0-9]+))?$"); - private static final int COMPONENT_VERSION_GROUP = 2; - private static final int WINERY_VERSION_GROUP = 3; - private static final int WIP_VERSION_GROUP_EXISTS = 4; - private static final int WIP_VERSION_GROUP = 5; - - private static String REFERENCING_OBJECT = "referencingObject"; - - public static WineryVersion getVersion(DefinitionsChildId id) { - return getVersion(id.getXmlId().getDecoded()); - } - - public static WineryVersion getVersionWithCurrentFlag(DefinitionsChildId id, DefinitionsChildId requestingElementInSet) { - Objects.requireNonNull(id); - Objects.requireNonNull(requestingElementInSet); - return getVersionWithCurrentFlag(id.getXmlId().getDecoded(), requestingElementInSet.getXmlId().getDecoded()); - } - - public static String getNameWithoutVersion(DefinitionsChildId id) { - return getNameWithoutVersion(id.getXmlId().getDecoded()); - } + public static final Pattern VERSION_PATTERN = Pattern.compile("_((?[^_]*)-)?w(?\\d+)(-wip(?\\d+))?$"); + public static final String COMPONENT_VERSION_GROUP = "component"; + public static final String WINERY_VERSION_GROUP = "winery"; + public static final String WIP_VERSION_GROUP = "wip"; public static String getNameWithoutVersion(String id) { Matcher m = VERSION_PATTERN.matcher(id); @@ -88,8 +47,9 @@ public static WineryVersion getVersion(String id) { if (m.find()) { String componentVersion = Objects.nonNull(m.group(COMPONENT_VERSION_GROUP)) ? m.group(COMPONENT_VERSION_GROUP) : ""; - int wineryVersion = Objects.nonNull(m.group(WINERY_VERSION_GROUP)) ? Integer.parseInt(m.group(WINERY_VERSION_GROUP)) : 0; - int workInProgressVersion = Objects.nonNull(m.group(WIP_VERSION_GROUP_EXISTS)) ? Integer.parseInt(m.group(WIP_VERSION_GROUP)) : 0; + // winery group is not optional + int wineryVersion = Integer.parseInt(m.group(WINERY_VERSION_GROUP)); + int workInProgressVersion = Objects.nonNull(m.group(WIP_VERSION_GROUP)) ? Integer.parseInt(m.group(WIP_VERSION_GROUP)) : 0; return new WineryVersion(componentVersion, wineryVersion, workInProgressVersion); } @@ -97,122 +57,12 @@ public static WineryVersion getVersion(String id) { return new WineryVersion(); } - public static String getQNameWithComponentVersionOnly(DefinitionsChildId id) { - Matcher m = VERSION_PATTERN.matcher(id.getXmlId().getDecoded()); - String componentVersion = ""; - - if (m.find()) { - componentVersion = Objects.nonNull(m.group(COMPONENT_VERSION_GROUP)) ? m.group(COMPONENT_VERSION_GROUP) : ""; - } - - String nameWithoutVersion = getNameWithoutVersion(id.getQName().toString()); - if (componentVersion.length() > 0) { - nameWithoutVersion += WineryVersion.WINERY_VERSION_SEPARATOR + componentVersion; - } - - return nameWithoutVersion; - } - - public static DefinitionsChildId getDefinitionInTheGivenVersion(DefinitionsChildId childId, WineryVersion otherVersion) { - if (getVersion(childId).compareTo(otherVersion) == 0) { - return childId; - } - - String localPart = getNameWithoutVersion(childId) + - (otherVersion.toString().length() > 0 ? WineryVersion.WINERY_NAME_FROM_VERSION_SEPARATOR + otherVersion.toString() : ""); - - QName qName = new QName(childId.getNamespace().getDecoded(), localPart); - if (childId instanceof RelationshipTypeImplementationId) { - return new RelationshipTypeImplementationId(qName); - } else if (childId instanceof NodeTypeImplementationId) { - return new NodeTypeImplementationId(qName); - } else if (childId instanceof RequirementTypeId) { - return new RequirementTypeId(qName); - } else if (childId instanceof NodeTypeId) { - return new NodeTypeId(qName); - } else if (childId instanceof RelationshipTypeId) { - return new RelationshipTypeId(qName); - } else if (childId instanceof CapabilityTypeId) { - return new CapabilityTypeId(qName); - } else if (childId instanceof ArtifactTypeId) { - return new ArtifactTypeId(qName); - } else if (childId instanceof PolicyTypeId) { - return new PolicyTypeId(qName); - } else if (childId instanceof PolicyTemplateId) { - return new PolicyTemplateId(qName); - } else if (childId instanceof ServiceTemplateId) { - return new ServiceTemplateId(qName); - } else if (childId instanceof ArtifactTemplateId) { - return new ArtifactTemplateId(qName); - } else { - throw new IllegalStateException("Unhandled id branch. Could happen for XSDImportId"); - } - } - public static WineryVersion getVersionWithCurrentFlag(String id, String requestingElementInSet) { WineryVersion version = getVersion(id); version.setCurrentVersion(id.equals(requestingElementInSet)); return version; } - public static ToscaDiff calculateDifferences(T oldVersion, T newVersion) { - IdentityStrategy identityStrategy = (o, o1) -> { - if (o instanceof HasIdInIdOrNameField && o1 instanceof HasIdInIdOrNameField) { - return Objects.equals( - ((HasIdInIdOrNameField) o).getIdFromIdOrNameField(), - ((HasIdInIdOrNameField) o1).getIdFromIdOrNameField()); - } else { - return Objects.equals(o, o1); - } - }; - - DiffNode diffNode = ObjectDifferBuilder - .startBuilding() - .categories() - // In the scope of winery, a source or target element will not be changed, because relationship templates will be removed if - // either one of the source or target element is removed. Therefore, to avoid changed relationships, if one of the source or - // target element was changed, we ignore referencing elements. - .ofType(TRelationshipTemplate.SourceOrTargetElement.class) - .toBe(REFERENCING_OBJECT) - .and() - .inclusion() - .exclude() - .propertyName("nodeTemplateOrRelationshipTemplate") - .propertyName("fakeJacksonType") - // Ignore 'any', otherwise, it crashes if a policy with a XML content is contained somehow: java.util.Collections$EmptyEnumeration - // at nodeTemplate/policies/policy/any/[content]/parentNode/identifiers - .propertyName("any") - .propertyName("internalAny") - // ignore changes of the namespace prefix - .propertyName("prefix") - .category(REFERENCING_OBJECT) - .and() - .identity() - // to provide a proper identification of elements in lists, use the custom identity strategy - .setDefaultCollectionItemIdentityStrategy(identityStrategy) - .and() - .build() - .compare(newVersion, oldVersion); - - return ToscaDiff.convertDiffToToscaDiff(diffNode, oldVersion, newVersion); - } - - public static String getNewComponentVersionId(DefinitionsChildId oldId, String appendixName) { - WineryVersion version = VersionUtils.getVersion(oldId); - String oldVersion = version.toString(); - - if (Objects.nonNull(oldVersion) && !oldVersion.isEmpty()) { - version.setComponentVersion(oldVersion + "-" + appendixName); - } else { - version.setComponentVersion(appendixName); - } - - version.setWineryVersion(1); - version.setWorkInProgressVersion(1); - - return VersionUtils.getNameWithoutVersion(oldId) + WineryVersion.WINERY_NAME_FROM_VERSION_SEPARATOR + version.toString(); - } - public static WineryVersion getNewWineryVersion(List versions) { WineryVersion[] version = new WineryVersion[1]; version[0] = versions.stream().filter(WineryVersion::isCurrentVersion) diff --git a/org.eclipse.winery.common/src/main/resources/winery.yml b/org.eclipse.winery.common/src/main/resources/winery.yml index 396e610f64..80729166d9 100644 --- a/org.eclipse.winery.common/src/main/resources/winery.yml +++ b/org.eclipse.winery.common/src/main/resources/winery.yml @@ -1,18 +1,19 @@ ui: features: - accountability: true - completion: true - compliance: true - freezeAndDefrost: true - managementFeatureEnrichment: true - nfv: true - patternRefinement: true - problemDetection: true - radon: false - splitting: true - testRefinement: true - placement: true + updateTemplates: true + splitting: false edmmModeling: false + freezeAndDefrost: false + managementFeatureEnrichment: false + problemDetection: false + patternRefinement: false + topologyFragmentRefinementModel: false + testRefinement: false + completion: false + accountability: false + compliance: false + placement: false + radon: false endpoints: container: http://localhost:1337 workflowmodeler: http://localhost:9527 diff --git a/org.eclipse.winery.common/src/test/java/org/eclipse/winery/common/HashingUtilTests.java b/org.eclipse.winery.common/src/test/java/org/eclipse/winery/common/HashingUtilTests.java new file mode 100644 index 0000000000..55014e27be --- /dev/null +++ b/org.eclipse.winery.common/src/test/java/org/eclipse/winery/common/HashingUtilTests.java @@ -0,0 +1,39 @@ +/******************************************************************************* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + *******************************************************************************/ + +package org.eclipse.winery.common; + +import java.io.File; + +import org.apache.commons.io.IOUtils; +import org.junit.jupiter.api.Test; + +import static org.junit.jupiter.api.Assertions.assertEquals; + +public class HashingUtilTests { + + @Test + public void testGetChecksum() throws Exception { + String text = "my super content of any file which will be hashed using a SHA-256 hash."; + assertEquals("c0af55785d21197a9fe4c5e9435fa77bb763f386810909e97f646eba7c827df7", + HashingUtil.getChecksum(IOUtils.toInputStream(text), "SHA-256")); + } + + @Test + public void testGetChecksumOfFile() throws Exception { + File file = new File(ClassLoader.getSystemClassLoader().getResource("org/eclipse/winery/common/invalid.xml").getFile()); + assertEquals("4406bff97249955ef46ea3ae590f9813fd44dcd769b8204cbb702ee6767173b0", + HashingUtil.getChecksum(file, "SHA-256")); + } +} diff --git a/org.eclipse.winery.common/src/test/java/org/eclipse/winery/common/VersionUtilsTest.java b/org.eclipse.winery.common/src/test/java/org/eclipse/winery/common/VersionUtilsTest.java index d73f0937d2..0eee6ee128 100644 --- a/org.eclipse.winery.common/src/test/java/org/eclipse/winery/common/VersionUtilsTest.java +++ b/org.eclipse.winery.common/src/test/java/org/eclipse/winery/common/VersionUtilsTest.java @@ -14,9 +14,6 @@ package org.eclipse.winery.common; -import org.eclipse.winery.common.ids.definitions.ArtifactTypeId; -import org.eclipse.winery.common.ids.definitions.DefinitionsChildId; -import org.eclipse.winery.common.ids.definitions.ServiceTemplateId; import org.eclipse.winery.common.version.VersionUtils; import org.eclipse.winery.common.version.WineryVersion; @@ -58,16 +55,6 @@ public void getVersionWithNoVersionInTheName() { assertEquals("", version.toString()); } - @Test - public void getVersionWithLeadingDashButNoComponentVersion() { - DefinitionsChildId id = new ServiceTemplateId("http://example.org/tosca/versioning", "myServiceTemplate_-w1-wip5", false); - WineryVersion version = VersionUtils.getVersion(id); - - assertEquals("", version.getComponentVersion()); - assertEquals(1, version.getWineryVersion()); - assertEquals(5, version.getWorkInProgressVersion()); - } - @Test public void getVersionFromNameWithMultipleUnderscores() { WineryVersion version = VersionUtils.getVersion("myExample_Component_v1.3.0-w1"); @@ -112,66 +99,5 @@ public void getVersionWithCurrentFlag() { assertTrue(VersionUtils.getVersionWithCurrentFlag(name, name).isCurrentVersion()); } - @Test - public void getVersion() { - String componentVersion = "1.0.0"; - int wineryVersion = 6; - int wipVersion = 3; - - DefinitionsChildId id = getDefinitionChildId("http://example.org/tosca/versions", "myElement", componentVersion, wineryVersion, wipVersion); - WineryVersion version = VersionUtils.getVersion(id); - - assertEquals(componentVersion, version.getComponentVersion()); - assertEquals(wineryVersion, version.getWineryVersion()); - assertEquals(wipVersion, version.getWorkInProgressVersion()); - } - - @Test - public void getNameWithoutVersionFromDefinitionsChildId() { - String name = "myElementTest"; - DefinitionsChildId id = getDefinitionChildId("http://example.org/tosca/versions", name, "1.2.3", 1, 1); - - assertEquals(name, VersionUtils.getNameWithoutVersion(id)); - } - - @Test - public void getQNameWithComponentVersionOnly() { - String name = "myElementTest"; - String namespace = "http://example.org/tosca/versions"; - String componentVersion = "1.2.3"; - - DefinitionsChildId id = getDefinitionChildId(namespace, name, componentVersion, 1, 1); - - assertEquals("{" + namespace + "}" + name + WineryVersion.WINERY_VERSION_SEPARATOR + componentVersion, - VersionUtils.getQNameWithComponentVersionOnly(id)); - } - - @Test - public void getNewIdName() { - String id = "myId_w1-wip56"; - String appendix = "test"; - String expectedId = "myId_w1-wip56-" + appendix + "-w1-wip1"; - ServiceTemplateId serviceTemplateId = new ServiceTemplateId("https://ex.org/tosca/sts", id, false); - - assertEquals(expectedId, VersionUtils.getNewComponentVersionId(serviceTemplateId, appendix)); - } - @Test - public void getNewIdIfComponentVersionIsAvailable() { - String id = "myId_component-version-w1"; - String appendix = "test"; - String expectedId = "myId_component-version-w1-" + appendix + "-w1-wip1"; - ArtifactTypeId serviceTemplateId = new ArtifactTypeId("https://ex.org/tosca/sts", id, false); - - assertEquals(expectedId, VersionUtils.getNewComponentVersionId(serviceTemplateId, appendix)); - } - - private DefinitionsChildId getDefinitionChildId(String namespace, String name, String componentVersion, int wineryVersion, int wipVersion) { - String elementName = name - + WineryVersion.WINERY_NAME_FROM_VERSION_SEPARATOR + componentVersion - + WineryVersion.WINERY_VERSION_SEPARATOR + WineryVersion.WINERY_VERSION_PREFIX + wineryVersion - + WineryVersion.WINERY_VERSION_SEPARATOR + WineryVersion.WINERY_WIP_VERSION_PREFIX + wipVersion; - - return new ServiceTemplateId(namespace, elementName, false); - } } diff --git a/org.eclipse.winery.common/src/test/java/org/eclipse/winery/common/configuration/EnvironmentsTest.java b/org.eclipse.winery.common/src/test/java/org/eclipse/winery/common/configuration/EnvironmentsTest.java index 269321c288..d181d46778 100644 --- a/org.eclipse.winery.common/src/test/java/org/eclipse/winery/common/configuration/EnvironmentsTest.java +++ b/org.eclipse.winery.common/src/test/java/org/eclipse/winery/common/configuration/EnvironmentsTest.java @@ -25,6 +25,7 @@ import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; +import static org.junit.jupiter.api.Assertions.assertNull; import static org.junit.jupiter.api.Assertions.assertTrue; @Disabled("This test seems to fail transiently on test infrastructure") @@ -148,4 +149,16 @@ public void testSaveEndpoints() { UiConfigurationObject result = Environments.getInstance().getUiConfig(); assertEquals("", result.getEndpoints().get("quaz")); } + + @Test + public void testIsFeatureEnabled() { + UiConfigurationObject object = Environments.getInstance().getUiConfig(); + object.getFeatures().put("test1", true); + object.getFeatures().put("test2", false); + object.save(); + UiConfigurationObject result = Environments.getInstance().getUiConfig(); + assertTrue(result.getFeatures().get("test1")); + assertFalse(result.getFeatures().get("test2")); + assertNull(result.getFeatures().get("test3")); + } } diff --git a/org.eclipse.winery.compliance/pom.xml b/org.eclipse.winery.compliance/pom.xml index 1d7eb6dc86..41b91ba8ab 100644 --- a/org.eclipse.winery.compliance/pom.xml +++ b/org.eclipse.winery.compliance/pom.xml @@ -19,7 +19,7 @@ org.eclipse.winery winery - 2.0.0-SNAPSHOT + 3.0.0-SNAPSHOT org.eclipse.winery.compliance @@ -31,9 +31,8 @@ org.eclipse.winery - org.eclipse.winery.model.tosca - 2.0.0-SNAPSHOT - compile + org.eclipse.winery.model.tosca.canonical + ${project.version} org.jgrapht @@ -43,7 +42,7 @@ org.eclipse.winery org.eclipse.winery.topologygraph - 2.0.0-SNAPSHOT + ${project.version} org.junit.jupiter diff --git a/org.eclipse.winery.compliance/src/main/java/org/eclipse/winery/compliance/checking/ComplianceRuleChecker.java b/org.eclipse.winery.compliance/src/main/java/org/eclipse/winery/compliance/checking/ComplianceRuleChecker.java index 66f2b18ef4..2c718dfbaf 100644 --- a/org.eclipse.winery.compliance/src/main/java/org/eclipse/winery/compliance/checking/ComplianceRuleChecker.java +++ b/org.eclipse.winery.compliance/src/main/java/org/eclipse/winery/compliance/checking/ComplianceRuleChecker.java @@ -20,7 +20,7 @@ import java.util.Map; import java.util.Optional; -import org.eclipse.winery.model.tosca.OTComplianceRule; +import org.eclipse.winery.model.tosca.extensions.OTComplianceRule; import org.eclipse.winery.model.tosca.TTopologyTemplate; import org.eclipse.winery.topologygraph.matching.ToscaIsomorphismMatcher; import org.eclipse.winery.topologygraph.model.ToscaEdge; diff --git a/org.eclipse.winery.compliance/src/main/java/org/eclipse/winery/compliance/checking/ServiceTemplateComplianceRuleRuleChecker.java b/org.eclipse.winery.compliance/src/main/java/org/eclipse/winery/compliance/checking/ServiceTemplateComplianceRuleRuleChecker.java index ea660c88b5..b6e3b23496 100644 --- a/org.eclipse.winery.compliance/src/main/java/org/eclipse/winery/compliance/checking/ServiceTemplateComplianceRuleRuleChecker.java +++ b/org.eclipse.winery.compliance/src/main/java/org/eclipse/winery/compliance/checking/ServiceTemplateComplianceRuleRuleChecker.java @@ -19,9 +19,9 @@ import java.util.Map; import java.util.stream.Collectors; -import org.eclipse.winery.common.ids.Namespace; -import org.eclipse.winery.common.ids.definitions.ComplianceRuleId; -import org.eclipse.winery.model.tosca.OTComplianceRule; +import org.eclipse.winery.model.ids.Namespace; +import org.eclipse.winery.model.ids.extensions.ComplianceRuleId; +import org.eclipse.winery.model.tosca.extensions.OTComplianceRule; import org.eclipse.winery.model.tosca.TServiceTemplate; import org.eclipse.winery.repository.backend.IRepository; import org.eclipse.winery.repository.backend.RepositoryFactory; diff --git a/org.eclipse.winery.compliance/src/main/java/org/eclipse/winery/compliance/checking/ToscaComplianceRuleMatcher.java b/org.eclipse.winery.compliance/src/main/java/org/eclipse/winery/compliance/checking/ToscaComplianceRuleMatcher.java index 364bb8c24b..916cd5a41a 100644 --- a/org.eclipse.winery.compliance/src/main/java/org/eclipse/winery/compliance/checking/ToscaComplianceRuleMatcher.java +++ b/org.eclipse.winery.compliance/src/main/java/org/eclipse/winery/compliance/checking/ToscaComplianceRuleMatcher.java @@ -13,11 +13,12 @@ *******************************************************************************/ package org.eclipse.winery.compliance.checking; -import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; import java.util.Map.Entry; import java.util.stream.Collectors; +import org.eclipse.winery.model.tosca.TEntityTemplate; import org.eclipse.winery.topologygraph.matching.IToscaMatcher; import org.eclipse.winery.topologygraph.model.ToscaEdge; import org.eclipse.winery.topologygraph.model.ToscaEntity; @@ -61,21 +62,43 @@ private List mapToStringList(@NonNull List policy) { } public boolean isPropertiesCompatible(ToscaNode left, ToscaNode right) { - if (left.getTemplate().getProperties() != null) { - if (right.getTemplate().getProperties() != null) { - for (Entry leftEntry : left.getTemplate().getProperties().getKVProperties().entrySet()) { - if (!isPropertyCompatible(leftEntry, right.getTemplate().getProperties().getKVProperties())) { - return false; - } + TEntityTemplate.Properties leftProps = left.getTemplate().getProperties(); + TEntityTemplate.Properties rightProps = right.getTemplate().getProperties(); + if (leftProps == null) { + // no constraints on the properties, so all rightProps are valid + return true; + } + if (rightProps == null) { + // there are property requirements, so right must have a value + return false; + } + // property types are different + if (leftProps.getClass() != rightProps.getClass()) { + return false; + } + if (leftProps instanceof TEntityTemplate.WineryKVProperties) { + assert (rightProps instanceof TEntityTemplate.WineryKVProperties); + + Map leftMap = ((TEntityTemplate.WineryKVProperties) leftProps).getKVProperties(); + Map rightMap = ((TEntityTemplate.WineryKVProperties) rightProps).getKVProperties(); + + for (Entry leftEntry : leftMap.entrySet()) { + if (!isPropertyCompatible(leftEntry, rightMap)) { + return false; } - } else { - return false; } + return true; + } else if (leftProps instanceof TEntityTemplate.XmlProperties) { + assert (rightProps instanceof TEntityTemplate.XmlProperties); + + return ((TEntityTemplate.XmlProperties) leftProps).getAny().equals(((TEntityTemplate.XmlProperties) rightProps).getAny()); + } else { + // There's no ComplianceRules in YAML mode + return false; } - return true; } - public boolean isPropertyCompatible(Entry leftEntry, @ADR(12) LinkedHashMap rightProperties) { + public boolean isPropertyCompatible(Entry leftEntry, @ADR(12) Map rightProperties) { return rightProperties.containsKey(leftEntry.getKey()) && rightProperties.get(leftEntry.getKey()) != null && isPropertyValueCompatible(leftEntry.getValue(), rightProperties.get(leftEntry.getKey())); @@ -102,7 +125,8 @@ public boolean isTEntityTypesCompatible(ToscaEntity left, ToscaEntity right) { } public boolean equals(TEntityType lType, TEntityType rType) { - return StringUtils.equals(lType.getIdFromIdOrNameField(), rType.getIdFromIdOrNameField()) && StringUtils.equals(lType.getTargetNamespace(), rType.getTargetNamespace()); + return StringUtils.equals(lType.getIdFromIdOrNameField(), rType.getIdFromIdOrNameField()) + && StringUtils.equals(lType.getTargetNamespace(), rType.getTargetNamespace()); } @Override diff --git a/org.eclipse.winery.compliance/src/test/java/org/eclipse/winery/compliance/ComplianceRuleCheckerTests.java b/org.eclipse.winery.compliance/src/test/java/org/eclipse/winery/compliance/ComplianceRuleCheckerTests.java new file mode 100644 index 0000000000..3df18b6b64 --- /dev/null +++ b/org.eclipse.winery.compliance/src/test/java/org/eclipse/winery/compliance/ComplianceRuleCheckerTests.java @@ -0,0 +1,322 @@ +/******************************************************************************* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + *******************************************************************************/ + +package org.eclipse.winery.compliance; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.xml.namespace.QName; + +import org.eclipse.winery.compliance.checking.ComplianceCheckingException; +import org.eclipse.winery.compliance.checking.ComplianceRuleChecker; +import org.eclipse.winery.model.ids.definitions.DefinitionsChildId; +import org.eclipse.winery.model.ids.definitions.NodeTypeId; +import org.eclipse.winery.model.ids.definitions.RelationshipTypeId; +import org.eclipse.winery.model.tosca.TExtensibleElements; +import org.eclipse.winery.model.tosca.TNodeTemplate; +import org.eclipse.winery.model.tosca.TNodeType; +import org.eclipse.winery.model.tosca.TRelationshipTemplate; +import org.eclipse.winery.model.tosca.TRelationshipType; +import org.eclipse.winery.model.tosca.TTopologyTemplate; +import org.eclipse.winery.repository.TestWithGitBackedRepository; +import org.eclipse.winery.topologygraph.model.ToscaEdge; +import org.eclipse.winery.topologygraph.model.ToscaNode; + +import org.apache.commons.lang3.StringUtils; +import org.jgrapht.GraphMapping; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import static org.eclipse.winery.compliance.ToscaModelHelper.TEST_TARGET_NAMESPACE; +import static org.eclipse.winery.compliance.ToscaModelHelper.createNodeTypeId; +import static org.eclipse.winery.compliance.ToscaModelHelper.createTNodeTemplate; +import static org.eclipse.winery.compliance.ToscaModelHelper.createTNodeType; +import static org.eclipse.winery.compliance.ToscaModelHelper.createTRelationshipTemplate; +import static org.eclipse.winery.compliance.ToscaModelHelper.createTRelationshipType; +import static org.eclipse.winery.compliance.ToscaModelHelper.createTTopologyTemplate; +import static org.junit.jupiter.api.Assertions.assertEquals; +import static org.junit.jupiter.api.Assertions.assertNotNull; +import static org.junit.jupiter.api.Assertions.assertTrue; + +public class ComplianceRuleCheckerTests extends TestWithGitBackedRepository { + + private TTopologyTemplate topologyTemplateToSearchIn; + private TTopologyTemplate requiredStructure; + private TTopologyTemplate identifier; + private TTopologyTemplate unrelatedTopology; + + private void persist(HashMap allEntities) throws IOException { + for (Map.Entry entry : allEntities.entrySet()) { + repository.setElement(entry.getKey(), entry.getValue()); + } + } + + @BeforeEach + public void setup() throws IOException { + HashMap allEntities = new HashMap<>(); + + ToscaModelPropertiesBuilder bldr = new ToscaModelPropertiesBuilder(TEST_TARGET_NAMESPACE, "MyProperties"); + bldr.addProperty("key1", "value1"); + bldr.addProperty("key2", "value2"); + + //create NodeTypes A B + String idNodeTypeA = "idA"; + TNodeType nodeTypeA = createTNodeType(idNodeTypeA, TEST_TARGET_NAMESPACE); + String idNodeTypeB = "idB"; + TNodeType nodeTypeB = createTNodeType(idNodeTypeB, TEST_TARGET_NAMESPACE); + String idNodeTypeC = "idC"; + TNodeType nodeTypeC = createTNodeType(idNodeTypeC, TEST_TARGET_NAMESPACE); + + NodeTypeId idA = createNodeTypeId(idNodeTypeA); + NodeTypeId idB = createNodeTypeId(idNodeTypeB); + NodeTypeId idC = createNodeTypeId(idNodeTypeC); + + allEntities.put(idA, nodeTypeA); + allEntities.put(idB, nodeTypeB); + allEntities.put(idC, nodeTypeC); + + //createRelationshipTypes + String relTypeIdAString = "adRelA"; + RelationshipTypeId relTypeIdA = new RelationshipTypeId(new QName(TEST_TARGET_NAMESPACE, relTypeIdAString)); + TRelationshipType relTypeA = createTRelationshipType(relTypeIdAString, TEST_TARGET_NAMESPACE); + + allEntities.put(relTypeIdA, relTypeA); + + //createNodeTemplates + TNodeTemplate nodeTemplate1 = createTNodeTemplate("01"); + nodeTemplate1.setType(idA.getQName()); + + TNodeTemplate nodeTemplate2 = createTNodeTemplate("02"); + nodeTemplate2.setType(idB.getQName()); + + TNodeTemplate nodeTemplate3 = createTNodeTemplate("03"); + nodeTemplate3.setType(idA.getQName()); + nodeTemplate3.setProperties(bldr.build()); + + TNodeTemplate nodeTemplate4 = createTNodeTemplate("04"); + nodeTemplate4.setType(idB.getQName()); + + TNodeTemplate nodeTemplate5 = createTNodeTemplate("05"); + nodeTemplate5.setType(idA.getQName()); + + TNodeTemplate nodeTemplate6 = createTNodeTemplate("06"); + nodeTemplate6.setType(idB.getQName()); + + TNodeTemplate nodeTemplate7 = createTNodeTemplate("07"); + nodeTemplate7.setType(idA.getQName()); + nodeTemplate7.setProperties(bldr.build()); + + TNodeTemplate nodeTemplate8 = createTNodeTemplate("08"); + nodeTemplate8.setType(idB.getQName()); + + TNodeTemplate nodeTemplate9 = createTNodeTemplate("CompletelyUnrelated"); + nodeTemplate9.setType(idC.getQName()); + + //create RelationshipTemplates + TRelationshipTemplate relTemplate1 = createTRelationshipTemplate("1"); + relTemplate1.setSourceNodeTemplate(nodeTemplate1); + relTemplate1.setTargetNodeTemplate(nodeTemplate2); + relTemplate1.setType(relTypeIdA.getQName()); + + TRelationshipTemplate relTemplate2 = createTRelationshipTemplate("2"); + relTemplate2.setSourceNodeTemplate(nodeTemplate3); + relTemplate2.setTargetNodeTemplate(nodeTemplate4); + relTemplate2.setType(relTypeIdA.getQName()); + + TRelationshipTemplate relTemplate3 = createTRelationshipTemplate("3"); + relTemplate3.setSourceNodeTemplate(nodeTemplate5); + relTemplate3.setTargetNodeTemplate(nodeTemplate6); + relTemplate3.setType(relTypeIdA.getQName()); + + TRelationshipTemplate relTemplate4 = createTRelationshipTemplate("4"); + relTemplate4.setSourceNodeTemplate(nodeTemplate7); + relTemplate4.setTargetNodeTemplate(nodeTemplate8); + relTemplate4.setType(relTypeIdA.getQName()); + + //create TopologyTemplates + List nodeTemplates = new ArrayList<>(); + List relationshipTemplates = new ArrayList<>(); + + // create identifier + nodeTemplates.add(nodeTemplate1); + nodeTemplates.add(nodeTemplate2); + relationshipTemplates.add(relTemplate1); + identifier = createTTopologyTemplate(nodeTemplates, relationshipTemplates); + identifier.setNodeTemplates(nodeTemplates); + identifier.setRelationshipTemplates(relationshipTemplates); + nodeTemplates.clear(); + relationshipTemplates.clear(); + + //create required structure + nodeTemplates.add(nodeTemplate3); + nodeTemplates.add(nodeTemplate4); + relationshipTemplates.add(relTemplate2); + requiredStructure = createTTopologyTemplate(nodeTemplates, relationshipTemplates); + requiredStructure.setNodeTemplates(nodeTemplates); + requiredStructure.setRelationshipTemplates(relationshipTemplates); + nodeTemplates.clear(); + relationshipTemplates.clear(); + + //create topologyToSearchIn + nodeTemplates.add(nodeTemplate5); + nodeTemplates.add(nodeTemplate6); + nodeTemplates.add(nodeTemplate7); + nodeTemplates.add(nodeTemplate8); + relationshipTemplates.add(relTemplate3); + relationshipTemplates.add(relTemplate4); + topologyTemplateToSearchIn = createTTopologyTemplate(nodeTemplates, relationshipTemplates); + topologyTemplateToSearchIn.setNodeTemplates(nodeTemplates); + topologyTemplateToSearchIn.setRelationshipTemplates(relationshipTemplates); + nodeTemplates.clear(); + relationshipTemplates.clear(); + + //create unrelated topology + nodeTemplates.add(nodeTemplate9); + unrelatedTopology = createTTopologyTemplate(nodeTemplates, relationshipTemplates); + unrelatedTopology.setNodeTemplates(nodeTemplates); + unrelatedTopology.setRelationshipTemplates(relationshipTemplates); + nodeTemplates.clear(); + relationshipTemplates.clear(); + + persist(allEntities); + } + + @Test + public void nullTemplateToCheck() { + ComplianceRuleChecker checker = new ComplianceRuleChecker(null, null, null); + ComplianceCheckingException expected = null; + try { + checker.checkComplianceRule(); + } catch (ComplianceCheckingException e) { + expected = e; + } + assertNotNull(expected); + assertTrue(StringUtils.equals(ComplianceCheckingException.NO_TEMPLATE_TO_CHECK, expected.getMessage())); + } + + @Test + public void emptyRule() { + ComplianceRuleChecker checker = new ComplianceRuleChecker(null, null, null); + checker.setToCheckTemplate(topologyTemplateToSearchIn); + + ComplianceCheckingException expected = null; + try { + checker.checkComplianceRule(); + } catch (ComplianceCheckingException e) { + expected = e; + } + assertNotNull(expected); + assertTrue(StringUtils.equals(ComplianceCheckingException.EMPTY_COMPLIANCE_RULE, expected.getMessage())); + } + + @Test + public void whitelist() { + ComplianceRuleChecker checker = new ComplianceRuleChecker(null, null, null); + checker.setToCheckTemplate(topologyTemplateToSearchIn); + + checker.setRequiredStructureTemplate(requiredStructure); + ComplianceCheckingException expected = null; + try { + checker.checkComplianceRule(); + } catch (ComplianceCheckingException e) { + expected = e; + } + assertNotNull(expected); + assertTrue(StringUtils.equals(ComplianceCheckingException.WHITELISTING_NOT_YET_IMPLEMENTED, expected.getMessage())); + } + + @Test + public void blacklist() throws Exception { + ComplianceRuleChecker checker = new ComplianceRuleChecker(null, null, null); + checker.setToCheckTemplate(topologyTemplateToSearchIn); + checker.setRequiredStructureTemplate(null); + checker.setIdentifierTemplate(identifier); + List blacklistResult = checker.checkComplianceRule(); + assertEquals(2, blacklistResult.size()); + } + + @Test + public void completeRule() { + ComplianceRuleChecker checker = new ComplianceRuleChecker(null, null, null); + checker.setToCheckTemplate(topologyTemplateToSearchIn); + + checker.setIdentifierTemplate(unrelatedTopology); + checker.setRequiredStructureTemplate(requiredStructure); + ComplianceCheckingException expected = null; + try { + checker.checkComplianceRule(); + } catch (ComplianceCheckingException e) { + expected = e; + } + assertNotNull(expected); + assertTrue(StringUtils.equals(ComplianceCheckingException.IDENTIFIER_NOT_IN_REQUIREDSTRUCTURE, expected.getMessage())); + } + + @Test + public void completeRule_noMapping() { + ComplianceRuleChecker checker = new ComplianceRuleChecker(null, null, null); + checker.setToCheckTemplate(topologyTemplateToSearchIn); + + // test completeRule + // invalid Rule: identifier and required structure have no mapping + checker.setIdentifierTemplate(unrelatedTopology); + checker.setRequiredStructureTemplate(requiredStructure); + ComplianceCheckingException expected = null; + try { + checker.checkComplianceRule(); + } catch (ComplianceCheckingException e) { + expected = e; + } + assertNotNull(expected); + assertTrue(StringUtils.equals(ComplianceCheckingException.IDENTIFIER_NOT_IN_REQUIREDSTRUCTURE, expected.getMessage())); + } + + @Test + public void validRule_identifierInRequired_findsOne() throws Exception { + ComplianceRuleChecker checker = new ComplianceRuleChecker(null, null, null); + checker.setToCheckTemplate(topologyTemplateToSearchIn); + + checker.setIdentifierTemplate(identifier); + checker.setRequiredStructureTemplate(requiredStructure); + List violatingMappings = checker.checkComplianceRule(); + assertEquals(1, violatingMappings.size()); + + ToscaNode identifierNode1 = checker.getIdentifierGraph().getNode("01"); + ToscaNode identifierNode2 = checker.getIdentifierGraph().getNode("02"); + ToscaEdge identifierEdge = checker.getIdentifierGraph().getEdge(identifierNode1, identifierNode2); + + GraphMapping violatingMapping = violatingMappings.stream().findFirst().get(); + + assertNotNull(violatingMapping); + Map resultMap = checker.getSubGraphMappingAsMap(violatingMapping, checker.getIdentifierGraph()); + + assertTrue(resultMap.get(identifierNode1).getId().matches("05")); + assertTrue(resultMap.get(identifierNode2).getId().matches("06")); + assertTrue(((ToscaEdge) violatingMapping.getEdgeCorrespondence(identifierEdge, false)).getId().matches("3")); + } + + @Test + public void findsNoViolation() throws Exception { + ComplianceRuleChecker checker = new ComplianceRuleChecker(null, null, null); + checker.setToCheckTemplate(topologyTemplateToSearchIn); + + checker.setIdentifierTemplate(identifier); + checker.setRequiredStructureTemplate(identifier); + assertEquals(0, checker.checkComplianceRule().size()); + } +} diff --git a/org.eclipse.winery.compliance/src/test/java/org/eclipse/winery/compliance/ToscaGraphIsomorphismTest.java b/org.eclipse.winery.compliance/src/test/java/org/eclipse/winery/compliance/ToscaGraphIsomorphismTest.java index 7131de1fd6..b496e2ad38 100644 --- a/org.eclipse.winery.compliance/src/test/java/org/eclipse/winery/compliance/ToscaGraphIsomorphismTest.java +++ b/org.eclipse.winery.compliance/src/test/java/org/eclipse/winery/compliance/ToscaGraphIsomorphismTest.java @@ -15,7 +15,6 @@ import java.io.IOException; import java.io.StringWriter; -import java.util.ArrayList; import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; @@ -27,24 +26,18 @@ import javax.xml.bind.Marshaller; import javax.xml.namespace.QName; -import org.eclipse.winery.common.ids.definitions.ComplianceRuleId; -import org.eclipse.winery.common.ids.definitions.DefinitionsChildId; -import org.eclipse.winery.common.ids.definitions.NodeTypeId; -import org.eclipse.winery.common.ids.definitions.RelationshipTypeId; -import org.eclipse.winery.common.ids.definitions.ServiceTemplateId; -import org.eclipse.winery.compliance.checking.ComplianceCheckingException; -import org.eclipse.winery.compliance.checking.ComplianceRuleChecker; import org.eclipse.winery.compliance.checking.ServiceTemplateCheckingResult; import org.eclipse.winery.compliance.checking.ServiceTemplateComplianceRuleRuleChecker; import org.eclipse.winery.compliance.checking.ToscaComplianceRuleMatcher; -import org.eclipse.winery.model.tosca.OTComplianceRule; +import org.eclipse.winery.model.ids.extensions.ComplianceRuleId; +import org.eclipse.winery.model.ids.definitions.DefinitionsChildId; +import org.eclipse.winery.model.ids.definitions.NodeTypeId; +import org.eclipse.winery.model.ids.definitions.ServiceTemplateId; import org.eclipse.winery.model.tosca.TExtensibleElements; import org.eclipse.winery.model.tosca.TNodeTemplate; import org.eclipse.winery.model.tosca.TNodeType; -import org.eclipse.winery.model.tosca.TRelationshipTemplate; -import org.eclipse.winery.model.tosca.TRelationshipType; import org.eclipse.winery.model.tosca.TServiceTemplate; -import org.eclipse.winery.model.tosca.TTopologyTemplate; +import org.eclipse.winery.model.tosca.extensions.OTComplianceRule; import org.eclipse.winery.repository.TestWithGitBackedRepository; import org.eclipse.winery.repository.backend.BackendUtils; import org.eclipse.winery.topologygraph.matching.ToscaIsomorphismMatcher; @@ -52,9 +45,7 @@ import org.eclipse.winery.topologygraph.model.ToscaGraph; import org.eclipse.winery.topologygraph.model.ToscaNode; -import org.apache.commons.lang3.StringUtils; import org.jgrapht.GraphMapping; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import static com.google.common.collect.Lists.newArrayList; @@ -67,41 +58,24 @@ import static org.eclipse.winery.compliance.ToscaModelHelper.createTOSCANode; import static org.eclipse.winery.compliance.ToscaModelHelper.createTOSCANodeOnlyProperties; import static org.eclipse.winery.compliance.ToscaModelHelper.createTOSCANodeOnlyTypes; -import static org.eclipse.winery.compliance.ToscaModelHelper.createTRelationshipTemplate; -import static org.eclipse.winery.compliance.ToscaModelHelper.createTRelationshipType; import static org.eclipse.winery.compliance.ToscaModelHelper.createTServiceTemplate; import static org.eclipse.winery.compliance.ToscaModelHelper.createTTopologyTemplate; import static org.eclipse.winery.compliance.ToscaModelHelper.setDerivedFrom; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertFalse; -import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; public class ToscaGraphIsomorphismTest extends TestWithGitBackedRepository { - // TODO revise -// private final IRepository repository = initializeRepository(); -// -// private IRepository initializeRepository() { -// Path path = Paths.get(System.getProperty("java.io.tmpdir")).resolve("test-repository"); -// return RepositoryFactory.getRepository(new FileBasedRepositoryConfiguration(path)); -// } - private void persist(HashMap allEntities) throws IOException { for (Map.Entry entry : allEntities.entrySet()) { repository.setElement(entry.getKey(), entry.getValue()); } } - // TODO revise -// @BeforeEach -// public void cleanUp() { -// repository.doClear(); -// } - @Test public void testTComplianceRulePersistence() throws Exception { - OTComplianceRule rule = new OTComplianceRule(); + OTComplianceRule rule = new OTComplianceRule(new OTComplianceRule.Builder()); rule.setName("test"); rule.setTargetNamespace(TEST_TARGET_NAMESPACE); @@ -196,25 +170,12 @@ public void testTOSCAComplianceRuleMatcher() throws IOException { // other way round assertFalse(matcher.isPropertiesCompatible(createTOSCANodeOnlyProperties(bldrRight), createTOSCANodeOnlyProperties(bldrLeft))); - -// String repositoryURI = "http://localhost:8080/winery"; -// -// boolean USE_PROXY = false; -// -// IWineryRepositoryClient client = new WineryRepositoryClient(USE_PROXY); -// -// client.addRepository(repositoryURI); -// -// TTopologyTemplate testTemplate = client.getTopologyTemplate(new QName( "http://opentosca.org/compliancerules","TestTemplate")); -// -// TNodeTemplate.Policies leftPolicies; -// TPolicy policy; - } @Test - @Disabled // TODO Fix this test using the repo test superclass - public void testServiceTemplateComplianceRuleChecker() throws IOException { + public void testServiceTemplateComplianceRuleChecker() throws Exception { + this.setRevisionTo("origin/plain"); + HashMap allEntities = new HashMap<>(); TServiceTemplate tServiceTemplate = createTServiceTemplate("ServiceTemplateTestId", TEST_TARGET_NAMESPACE); @@ -297,229 +258,6 @@ public void testServiceTemplateComplianceRuleChecker() throws IOException { } } - @Test - public void testTOSCAComplianceRuleChecker() throws IOException, ComplianceCheckingException { - - HashMap allEntities = new HashMap<>(); - - ToscaModelPropertiesBuilder bldr = new ToscaModelPropertiesBuilder(TEST_TARGET_NAMESPACE, "MyProperties"); - bldr.addProperty("key1", "value1"); - bldr.addProperty("key2", "value2"); - - //create NodeTypes A B - String idNodeTypeA = "idA"; - TNodeType nodeTypeA = createTNodeType(idNodeTypeA, TEST_TARGET_NAMESPACE); - String idNodeTypeB = "idB"; - TNodeType nodeTypeB = createTNodeType(idNodeTypeB, TEST_TARGET_NAMESPACE); - String idNodeTypeC = "idC"; - TNodeType nodeTypeC = createTNodeType(idNodeTypeC, TEST_TARGET_NAMESPACE); - - NodeTypeId idA = createNodeTypeId(idNodeTypeA); - NodeTypeId idB = createNodeTypeId(idNodeTypeB); - NodeTypeId idC = createNodeTypeId(idNodeTypeC); - - allEntities.put(idA, nodeTypeA); - allEntities.put(idB, nodeTypeB); - allEntities.put(idC, nodeTypeC); - - //createRelationshipTypes - String relTypeIdAString = "adRelA"; - RelationshipTypeId relTypeIdA = new RelationshipTypeId(new QName(TEST_TARGET_NAMESPACE, relTypeIdAString)); - TRelationshipType relTypeA = createTRelationshipType(relTypeIdAString, TEST_TARGET_NAMESPACE); - - allEntities.put(relTypeIdA, relTypeA); - - //createNodeTemplates - TNodeTemplate nodeTemplate1 = createTNodeTemplate("01"); - nodeTemplate1.setType(idA.getQName()); - - TNodeTemplate nodeTemplate2 = createTNodeTemplate("02"); - nodeTemplate2.setType(idB.getQName()); - - TNodeTemplate nodeTemplate3 = createTNodeTemplate("03"); - nodeTemplate3.setType(idA.getQName()); - nodeTemplate3.setProperties(bldr.build()); - - TNodeTemplate nodeTemplate4 = createTNodeTemplate("04"); - nodeTemplate4.setType(idB.getQName()); - - TNodeTemplate nodeTemplate5 = createTNodeTemplate("05"); - nodeTemplate5.setType(idA.getQName()); - - TNodeTemplate nodeTemplate6 = createTNodeTemplate("06"); - nodeTemplate6.setType(idB.getQName()); - - TNodeTemplate nodeTemplate7 = createTNodeTemplate("07"); - nodeTemplate7.setType(idA.getQName()); - nodeTemplate7.setProperties(bldr.build()); - - TNodeTemplate nodeTemplate8 = createTNodeTemplate("08"); - nodeTemplate8.setType(idB.getQName()); - - TNodeTemplate nodeTemplate9 = createTNodeTemplate("CompletelyUnrelated"); - nodeTemplate9.setType(idC.getQName()); - - //create RelationshipTemplates - TRelationshipTemplate relTemplate1 = createTRelationshipTemplate("1"); - relTemplate1.setSourceNodeTemplate(nodeTemplate1); - relTemplate1.setTargetNodeTemplate(nodeTemplate2); - relTemplate1.setType(relTypeIdA.getQName()); - - TRelationshipTemplate relTemplate2 = createTRelationshipTemplate("2"); - relTemplate2.setSourceNodeTemplate(nodeTemplate3); - relTemplate2.setTargetNodeTemplate(nodeTemplate4); - relTemplate2.setType(relTypeIdA.getQName()); - - TRelationshipTemplate relTemplate3 = createTRelationshipTemplate("3"); - relTemplate3.setSourceNodeTemplate(nodeTemplate5); - relTemplate3.setTargetNodeTemplate(nodeTemplate6); - relTemplate3.setType(relTypeIdA.getQName()); - - TRelationshipTemplate relTemplate4 = createTRelationshipTemplate("4"); - relTemplate4.setSourceNodeTemplate(nodeTemplate7); - relTemplate4.setTargetNodeTemplate(nodeTemplate8); - relTemplate4.setType(relTypeIdA.getQName()); - - //create TopologyTemplates - List nodeTemplates = new ArrayList<>(); - List relationshipTemplates = new ArrayList<>(); - - // create identifier - nodeTemplates.add(nodeTemplate1); - nodeTemplates.add(nodeTemplate2); - relationshipTemplates.add(relTemplate1); - TTopologyTemplate identifier = createTTopologyTemplate(nodeTemplates, relationshipTemplates); - identifier.setNodeTemplates(nodeTemplates); - identifier.setRelationshipTemplates(relationshipTemplates); - nodeTemplates.clear(); - relationshipTemplates.clear(); - - //create required structure - nodeTemplates.add(nodeTemplate3); - nodeTemplates.add(nodeTemplate4); - relationshipTemplates.add(relTemplate2); - TTopologyTemplate requiredStructure = createTTopologyTemplate(nodeTemplates, relationshipTemplates); - requiredStructure.setNodeTemplates(nodeTemplates); - requiredStructure.setRelationshipTemplates(relationshipTemplates); - nodeTemplates.clear(); - relationshipTemplates.clear(); - - //create topologyToSearchIn - nodeTemplates.add(nodeTemplate5); - nodeTemplates.add(nodeTemplate6); - nodeTemplates.add(nodeTemplate7); - nodeTemplates.add(nodeTemplate8); - relationshipTemplates.add(relTemplate3); - relationshipTemplates.add(relTemplate4); - TTopologyTemplate topologyTemplateToSearchIn = createTTopologyTemplate(nodeTemplates, relationshipTemplates); - topologyTemplateToSearchIn.setNodeTemplates(nodeTemplates); - topologyTemplateToSearchIn.setRelationshipTemplates(relationshipTemplates); - nodeTemplates.clear(); - relationshipTemplates.clear(); - - //create unrelated topology - nodeTemplates.add(nodeTemplate9); - TTopologyTemplate unrelatedTopology = createTTopologyTemplate(nodeTemplates, relationshipTemplates); - unrelatedTopology.setNodeTemplates(nodeTemplates); - unrelatedTopology.setRelationshipTemplates(relationshipTemplates); - nodeTemplates.clear(); - relationshipTemplates.clear(); - - persist(allEntities); - - // **************** // - // Test starts here // - // **************** // - - ComplianceRuleChecker checker; - - // test null topologyTemplateToCheck - checker = new ComplianceRuleChecker(null, null, null); - ComplianceCheckingException expected = null; - try { - checker.checkComplianceRule(); - } catch (ComplianceCheckingException e) { - expected = e; - } - assertNotNull(expected); - assertTrue(StringUtils.equals(ComplianceCheckingException.NO_TEMPLATE_TO_CHECK, expected.getMessage())); - - checker.setToCheckTemplate(topologyTemplateToSearchIn); - - // test empty rule - expected = null; - try { - checker.checkComplianceRule(); - } catch (ComplianceCheckingException e) { - expected = e; - } - assertNotNull(expected); - assertTrue(StringUtils.equals(ComplianceCheckingException.EMPTY_COMPLIANCE_RULE, expected.getMessage())); - - // test Whitelist - checker.setRequiredStructureTemplate(requiredStructure); - expected = null; - try { - checker.checkComplianceRule(); - } catch (ComplianceCheckingException e) { - expected = e; - } - assertNotNull(expected); - assertTrue(StringUtils.equals(ComplianceCheckingException.WHITELISTING_NOT_YET_IMPLEMENTED, expected.getMessage())); - - // test blacklist - checker.setRequiredStructureTemplate(null); - checker.setIdentifierTemplate(identifier); - List blacklistResult = checker.checkComplianceRule(); - assertEquals(2, blacklistResult.size()); - - // test completeRule - // invalid Rule: identifier and required structure have no mapping - checker.setIdentifierTemplate(unrelatedTopology); - checker.setRequiredStructureTemplate(requiredStructure); - expected = null; - try { - checker.checkComplianceRule(); - } catch (ComplianceCheckingException e) { - expected = e; - } - assertNotNull(expected); - assertTrue(StringUtils.equals(ComplianceCheckingException.IDENTIFIER_NOT_IN_REQUIREDSTRUCTURE, expected.getMessage())); - - // valid Rule: identifier in required structure - // finds one violation - checker.setIdentifierTemplate(identifier); - checker.setRequiredStructureTemplate(requiredStructure); - List violatingMappings = checker.checkComplianceRule(); - assertEquals(1, violatingMappings.size()); - - // check the mapping. - // must contain nodesTemplates 5 & 6 and relTemplate3 - - ToscaNode identifierNode1 = checker.getIdentifierGraph().getNode("01"); - ToscaNode identifierNode2 = checker.getIdentifierGraph().getNode("02"); - ToscaEdge identifierEdge = checker.getIdentifierGraph().getEdge(identifierNode1, identifierNode2); - - GraphMapping violatingMapping = violatingMappings.stream().findFirst().get(); - - assertNotNull(violatingMapping); - Map resultMap = checker.getSubGraphMappingAsMap(violatingMapping, checker.getIdentifierGraph()); - - assertTrue(resultMap.get(identifierNode1).getId().matches("05")); - assertTrue(resultMap.get(identifierNode2).getId().matches("06")); - assertTrue(((ToscaEdge) violatingMapping.getEdgeCorrespondence(identifierEdge, false)).getId().matches("3")); - - //finds no violation - checker.setRequiredStructureTemplate(identifier); - assertEquals(0, checker.checkComplianceRule().size()); - - OTComplianceRule rule = new OTComplianceRule(); - rule.setName("test"); - rule.setTargetNamespace(TEST_TARGET_NAMESPACE); - rule.setIdentifier(identifier); - rule.setRequiredStructure(requiredStructure); - } - @Test public void testTOSCADefaultMatcher() { ToscaGraph queryGraph = new ToscaGraph(); diff --git a/org.eclipse.winery.compliance/src/test/java/org/eclipse/winery/compliance/ToscaModelHelper.java b/org.eclipse.winery.compliance/src/test/java/org/eclipse/winery/compliance/ToscaModelHelper.java index 276349700c..acf42ad99c 100644 --- a/org.eclipse.winery.compliance/src/test/java/org/eclipse/winery/compliance/ToscaModelHelper.java +++ b/org.eclipse.winery.compliance/src/test/java/org/eclipse/winery/compliance/ToscaModelHelper.java @@ -17,13 +17,8 @@ import javax.xml.namespace.QName; -import org.eclipse.winery.common.ids.definitions.ComplianceRuleId; -import org.eclipse.winery.common.ids.definitions.NodeTypeId; -import org.eclipse.winery.topologygraph.model.ToscaEdge; -import org.eclipse.winery.topologygraph.model.ToscaGraph; -import org.eclipse.winery.topologygraph.model.ToscaNode; -import org.eclipse.winery.topologygraph.transformation.ToscaTransformer; -import org.eclipse.winery.model.tosca.OTComplianceRule; +import org.eclipse.winery.model.ids.extensions.ComplianceRuleId; +import org.eclipse.winery.model.ids.definitions.NodeTypeId; import org.eclipse.winery.model.tosca.TEntityType; import org.eclipse.winery.model.tosca.TNodeTemplate; import org.eclipse.winery.model.tosca.TNodeType; @@ -31,6 +26,11 @@ import org.eclipse.winery.model.tosca.TRelationshipType; import org.eclipse.winery.model.tosca.TServiceTemplate; import org.eclipse.winery.model.tosca.TTopologyTemplate; +import org.eclipse.winery.model.tosca.extensions.OTComplianceRule; +import org.eclipse.winery.topologygraph.model.ToscaEdge; +import org.eclipse.winery.topologygraph.model.ToscaGraph; +import org.eclipse.winery.topologygraph.model.ToscaNode; +import org.eclipse.winery.topologygraph.transformation.ToscaTransformer; public class ToscaModelHelper { @@ -44,10 +44,10 @@ public static TNodeTemplate createTNodeTemplate(String id) { } public static TTopologyTemplate createTTopologyTemplate(List nodeTemplates, List relationshipTemplates) { - TTopologyTemplate template = new TTopologyTemplate(); - template.setNodeTemplates(nodeTemplates); - template.setRelationshipTemplates(relationshipTemplates); - return template; + return new TTopologyTemplate.Builder() + .addNodeTemplates(nodeTemplates) + .addRelationshipTemplates(relationshipTemplates) + .build(); } public static TNodeType createTNodeType(NodeTypeId nodeTypeIdAbstractA) { @@ -85,13 +85,14 @@ public static ToscaNode createTOSCANode(String id, String name) { template.setName(name); ToscaNode node = new ToscaNode(); node.setNodeTemplate(template); + node.setId(id); return node; } - public static ToscaNode createTOSCANodeOnlyProperties(ToscaModelPropertiesBuilder bldr) { + public static ToscaNode createTOSCANodeOnlyProperties(ToscaModelPropertiesBuilder propertiesBuilder) { ToscaNode node = new ToscaNode(); node.setNodeTemplate(new TNodeTemplate()); - node.getTemplate().setProperties(bldr.build()); + node.getTemplate().setProperties(propertiesBuilder.build()); return node; } @@ -147,9 +148,7 @@ public static OTComplianceRule createTComplianceRule(ComplianceRuleId id) { } public static OTComplianceRule createTComplianceRule(String id, String ns) { - OTComplianceRule rule = new OTComplianceRule(); - rule.setId(id); - rule.setTargetNamespace(ns); - return rule; + return new OTComplianceRule(new OTComplianceRule.Builder(id) + .setTargetNamespace(ns)); } } diff --git a/org.eclipse.winery.compliance/src/test/java/org/eclipse/winery/compliance/ToscaModelPropertiesBuilder.java b/org.eclipse.winery.compliance/src/test/java/org/eclipse/winery/compliance/ToscaModelPropertiesBuilder.java index 69904f2e28..8b6c9aeac7 100644 --- a/org.eclipse.winery.compliance/src/test/java/org/eclipse/winery/compliance/ToscaModelPropertiesBuilder.java +++ b/org.eclipse.winery.compliance/src/test/java/org/eclipse/winery/compliance/ToscaModelPropertiesBuilder.java @@ -13,84 +13,61 @@ ********************************************************************************/ package org.eclipse.winery.compliance; -import java.util.Map; -import java.util.Properties; - -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; +import java.util.LinkedHashMap; import org.eclipse.winery.model.tosca.TEntityTemplate; import org.eclipse.jdt.annotation.NonNull; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Text; public class ToscaModelPropertiesBuilder { - java.util.Properties properties = new Properties(); - @NonNull - public static String namespaceURI; - @NonNull - public static String prefix = "rnd"; - @NonNull - public static String localName; - - public ToscaModelPropertiesBuilder(@NonNull String namespaceURI, @NonNull String localName) { - this.namespaceURI = namespaceURI; - this.localName = localName; - } - - public ToscaModelPropertiesBuilder addProperty(@NonNull String key, @NonNull String value) { - properties.put(key, value); - return this; - } - - public TEntityTemplate.Properties build() { - Document doc = null; - TEntityTemplate.Properties result = new TEntityTemplate.Properties(); - - if (properties.isEmpty()) { - return result; - } - try { - doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); - Element propertiesElement = doc.createElementNS(namespaceURI, prefix + ":" + localName); - for (Map.Entry e : properties.entrySet()) { - Element keyNode = doc.createElementNS(namespaceURI, e.getKey().toString()); - Text textValue = doc.createTextNode(e.getValue().toString()); - textValue.setTextContent(e.getValue().toString()); - keyNode.appendChild(textValue); - propertiesElement.appendChild(keyNode); - } - result.setAny(propertiesElement); - } catch (ParserConfigurationException e) { - e.printStackTrace(); - } - return result; - } - - public String getNamespaceURI() { - return namespaceURI; - } - - public void setNamespaceURI(String namespaceURI) { - this.namespaceURI = namespaceURI; - } - - public String getPrefix() { - return prefix; - } - - public void setPrefix(String prefix) { - this.prefix = prefix; - } - - public String getLocalName() { - return localName; - } - - public void setLocalName(String localName) { - this.localName = localName; - } + LinkedHashMap properties = new LinkedHashMap<>(); + @NonNull + public static String namespaceURI; + @NonNull + public static String prefix = "rnd"; + @NonNull + public static String localName; + + public ToscaModelPropertiesBuilder(@NonNull String namespaceURI, @NonNull String localName) { + this.namespaceURI = namespaceURI; + this.localName = localName; + } + + public ToscaModelPropertiesBuilder addProperty(@NonNull String key, @NonNull String value) { + properties.put(key, value); + return this; + } + + public TEntityTemplate.Properties build() { + TEntityTemplate.WineryKVProperties result = new TEntityTemplate.WineryKVProperties(); + result.setNamespace(namespaceURI); + result.setElementName(localName); + result.setKVProperties(properties); + return result; + } + + public String getNamespaceURI() { + return namespaceURI; + } + + public void setNamespaceURI(String namespaceURI) { + this.namespaceURI = namespaceURI; + } + + public String getPrefix() { + return prefix; + } + + public void setPrefix(String prefix) { + this.prefix = prefix; + } + + public String getLocalName() { + return localName; + } + + public void setLocalName(String localName) { + this.localName = localName; + } } diff --git a/org.eclipse.winery.compliance/src/test/java/org/eclipse/winery/model/tosca/utils/ModelUtilitiesTest.java b/org.eclipse.winery.compliance/src/test/java/org/eclipse/winery/model/tosca/utils/ModelUtilitiesTest.java index 07bc433806..1c8524902e 100644 --- a/org.eclipse.winery.compliance/src/test/java/org/eclipse/winery/model/tosca/utils/ModelUtilitiesTest.java +++ b/org.eclipse.winery.compliance/src/test/java/org/eclipse/winery/model/tosca/utils/ModelUtilitiesTest.java @@ -18,7 +18,8 @@ import javax.xml.namespace.QName; -import org.eclipse.winery.common.ids.definitions.NodeTypeId; +import org.eclipse.winery.model.ids.definitions.NodeTypeId; +import org.eclipse.winery.model.tosca.TEntityTemplate; import org.eclipse.winery.model.tosca.TEntityType; import org.eclipse.winery.model.tosca.TNodeTemplate; import org.eclipse.winery.model.tosca.TNodeType; @@ -82,7 +83,6 @@ public void instantiateNodeTemplate() throws Exception { assertNotNull(nodeTemplate); assertNotNull(nodeTemplate.getProperties()); - assertNotNull(nodeTemplate.getProperties().getKVProperties()); - assertEquals(8, nodeTemplate.getProperties().getKVProperties().size()); + assertEquals(8, ((TEntityTemplate.WineryKVProperties) nodeTemplate.getProperties()).getKVProperties().size()); } } diff --git a/org.eclipse.winery.crawler/pom.xml b/org.eclipse.winery.crawler/pom.xml index dfdb55e991..bc703c359d 100644 --- a/org.eclipse.winery.crawler/pom.xml +++ b/org.eclipse.winery.crawler/pom.xml @@ -19,7 +19,7 @@ winery org.eclipse.winery - 2.0.0-SNAPSHOT + 3.0.0-SNAPSHOT 4.0.0 org.eclipse.winery.crawler @@ -28,7 +28,7 @@ ../checkstyle.xml ${project.parent.basedir}
- + org.apache.httpcomponents @@ -65,13 +65,11 @@ commons-io commons-io 2.6 - compile org.apache.commons commons-compress ${org.apache.commons.compress.version} - compile org.tukaani @@ -88,13 +86,11 @@ org.eclipse.winery org.eclipse.winery.model.tosca.yaml ${project.version} - compile org.eclipse.winery - org.eclipse.winery.model.tosca + org.eclipse.winery.model.tosca.canonical ${project.version} - compile @@ -106,9 +102,7 @@ org.eclipse.winery org.eclipse.winery.repository ${project.version} - compile - diff --git a/org.eclipse.winery.crawler/src/main/java/org/eclipse/winery/crawler/chefcookbooks/chefcookbook/CookbookConfigurationToscaConverter.java b/org.eclipse.winery.crawler/src/main/java/org/eclipse/winery/crawler/chefcookbooks/chefcookbook/CookbookConfigurationToscaConverter.java index 2dd1fbe7af..452724f27e 100644 --- a/org.eclipse.winery.crawler/src/main/java/org/eclipse/winery/crawler/chefcookbooks/chefcookbook/CookbookConfigurationToscaConverter.java +++ b/org.eclipse.winery.crawler/src/main/java/org/eclipse/winery/crawler/chefcookbooks/chefcookbook/CookbookConfigurationToscaConverter.java @@ -21,7 +21,7 @@ import javax.xml.namespace.QName; -import org.eclipse.winery.common.ids.definitions.NodeTypeId; +import org.eclipse.winery.model.ids.definitions.NodeTypeId; import org.eclipse.winery.common.version.WineryVersion; import org.eclipse.winery.model.tosca.*; import org.eclipse.winery.repository.backend.RepositoryFactory; diff --git a/org.eclipse.winery.edmm/pom.xml b/org.eclipse.winery.edmm/pom.xml new file mode 100644 index 0000000000..eec37e38a7 --- /dev/null +++ b/org.eclipse.winery.edmm/pom.xml @@ -0,0 +1,74 @@ + + + + + 4.0.0 + + winery + org.eclipse.winery + 3.0.0-SNAPSHOT + + org.eclipse.winery.edmm + + + + jitpack.io + https://www.jitpack.io + + + + + + com.github.UST-EDMM.edmm + edmm-core + v1.0.8 + + + org.eclipse.winery + org.eclipse.winery.common + ${project.version} + + + org.eclipse.winery + org.eclipse.winery.model.tosca.canonical + ${project.version} + + + org.eclipse.winery + org.eclipse.winery.repository + ${project.version} + + + org.junit.jupiter + junit-jupiter-api + ${junit.jupiter.version} + test + + + io.github.adr + e-adr + ${io.github.adr.e-adr.version} + + + org.eclipse.jdt + org.eclipse.jdt.annotation + ${org.eclipse.jdt.annotation} + + + + + diff --git a/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/backend/EdmmManager.java b/org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/EdmmManager.java similarity index 67% rename from org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/backend/EdmmManager.java rename to org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/EdmmManager.java index d986011f17..3a8b929ad1 100644 --- a/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/backend/EdmmManager.java +++ b/org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/EdmmManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019 Contributors to the Eclipse Foundation + * Copyright (c) 2019-2020 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -12,7 +12,7 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 *******************************************************************************/ -package org.eclipse.winery.repository.backend; +package org.eclipse.winery.edmm; import java.util.HashMap; import java.util.List; @@ -20,11 +20,20 @@ import javax.xml.namespace.QName; -import org.eclipse.winery.common.edmm.EdmmMappingItem; -import org.eclipse.winery.common.edmm.EdmmType; +import org.eclipse.winery.edmm.model.EdmmMappingItem; +import org.eclipse.winery.edmm.model.EdmmType; +import org.eclipse.winery.model.ids.admin.EdmmMappingsId; +import org.eclipse.winery.repository.backend.BackendUtils; +import org.eclipse.winery.repository.backend.IRepository; +import org.eclipse.winery.repository.common.RepositoryFileReference; public interface EdmmManager { + static EdmmManager forRepository(IRepository repo) { + RepositoryFileReference ref = BackendUtils.getRefOfJsonConfiguration(new EdmmMappingsId()); + return new JsonBasedEdmmManager(repo.ref2AbsolutePath(ref).toFile()); + } + List getOneToOneMappings(); void setOneToOneMappings(List list); diff --git a/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/export/EdmmUtils.java b/org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/EdmmUtils.java similarity index 84% rename from org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/export/EdmmUtils.java rename to org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/EdmmUtils.java index c215314bb8..0c51cea9eb 100644 --- a/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/export/EdmmUtils.java +++ b/org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/EdmmUtils.java @@ -12,7 +12,7 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 *******************************************************************************/ -package org.eclipse.winery.repository.export; +package org.eclipse.winery.edmm; import java.util.HashMap; import java.util.List; @@ -21,11 +21,11 @@ import javax.xml.namespace.QName; -import org.eclipse.winery.common.edmm.EdmmType; -import org.eclipse.winery.common.ids.definitions.NodeTypeId; -import org.eclipse.winery.common.ids.definitions.RelationshipTypeId; -import org.eclipse.winery.common.ids.definitions.ServiceTemplateId; -import org.eclipse.winery.common.toscalight.ToscaLightChecker; +import org.eclipse.winery.edmm.model.EdmmType; +import org.eclipse.winery.edmm.toscalight.ToscaLightChecker; +import org.eclipse.winery.model.ids.definitions.NodeTypeId; +import org.eclipse.winery.model.ids.definitions.RelationshipTypeId; +import org.eclipse.winery.model.ids.definitions.ServiceTemplateId; import org.eclipse.winery.model.tosca.TNodeType; import org.eclipse.winery.model.tosca.TRelationshipType; import org.eclipse.winery.model.tosca.TServiceTemplate; @@ -53,8 +53,8 @@ public static ToscaLightChecker getToscaLightChecker() { Map relationshipTypes = repository.getQNameToElementMapping(RelationshipTypeId.class); Map nodeTypes = repository.getQNameToElementMapping(NodeTypeId.class); - Map typeMap = repository.getEdmmManager().getTypeMap(); - Map oneToOneMap = repository.getEdmmManager().getOneToOneMap(); + Map typeMap = EdmmManager.forRepository(repository).getTypeMap(); + Map oneToOneMap = EdmmManager.forRepository(repository).getOneToOneMap(); return new ToscaLightChecker(nodeTypes, relationshipTypes, typeMap, oneToOneMap); } diff --git a/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/backend/filebased/JsonBasedEdmmManager.java b/org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/JsonBasedEdmmManager.java similarity index 93% rename from org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/backend/filebased/JsonBasedEdmmManager.java rename to org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/JsonBasedEdmmManager.java index fed2022575..6e99f91361 100644 --- a/org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/backend/filebased/JsonBasedEdmmManager.java +++ b/org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/JsonBasedEdmmManager.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019 Contributors to the Eclipse Foundation + * Copyright (c) 2019-2020 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -12,7 +12,7 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 *******************************************************************************/ -package org.eclipse.winery.repository.backend.filebased; +package org.eclipse.winery.edmm; import java.io.File; import java.io.IOException; @@ -20,9 +20,8 @@ import java.util.List; import java.util.Objects; -import org.eclipse.winery.common.edmm.EdmmMappingItem; import org.eclipse.winery.common.json.JacksonProvider; -import org.eclipse.winery.repository.backend.EdmmManager; +import org.eclipse.winery.edmm.model.EdmmMappingItem; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/edmm/EdmmConverter.java b/org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/model/EdmmConverter.java similarity index 98% rename from org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/edmm/EdmmConverter.java rename to org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/model/EdmmConverter.java index 72c766b013..30baa4289c 100644 --- a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/edmm/EdmmConverter.java +++ b/org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/model/EdmmConverter.java @@ -12,7 +12,7 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 *******************************************************************************/ -package org.eclipse.winery.common.edmm; +package org.eclipse.winery.edmm.model; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; @@ -39,6 +39,7 @@ import org.eclipse.winery.model.tosca.TRelationshipType; import org.eclipse.winery.model.tosca.TRelationshipTypeImplementation; import org.eclipse.winery.model.tosca.TServiceTemplate; +import org.eclipse.winery.model.tosca.utils.ModelUtilities; import io.github.edmm.core.parser.Entity; import io.github.edmm.core.parser.EntityGraph; @@ -115,7 +116,7 @@ private void createRelation(TRelationshipTemplate relationship, EntityGraph enti EntityId relationEntityId = relationsCollectionEntityId.extend(relationTypeEntityId.getName()); - if (Objects.nonNull(relationship.getProperties()) && Objects.nonNull(relationship.getProperties().getKVProperties())) { + if (Objects.nonNull(relationship.getProperties()) && Objects.nonNull(ModelUtilities.getPropertiesKV(relationship))) { entityGraph.addEntity(new MappingEntity(relationEntityId, entityGraph)); createProperties(relationship, relationEntityId, entityGraph); } else { @@ -191,11 +192,11 @@ private void createPathReferenceEntity(EntityGraph entityGraph, String givenPath } private void createProperties(TEntityTemplate toscaTemplate, EntityId componentNodeId, EntityGraph entityGraph) { - if (Objects.nonNull(toscaTemplate.getProperties()) && Objects.nonNull(toscaTemplate.getProperties().getKVProperties())) { + if (Objects.nonNull(toscaTemplate.getProperties()) && Objects.nonNull(ModelUtilities.getPropertiesKV(toscaTemplate))) { EntityId propertiesEntityId = componentNodeId.extend(DefaultKeys.PROPERTIES); entityGraph.addEntity(new MappingEntity(propertiesEntityId, entityGraph)); - toscaTemplate.getProperties().getKVProperties() + ModelUtilities.getPropertiesKV(toscaTemplate) .forEach((key, value) -> { EntityId propertyEntityId = propertiesEntityId.extend(key); entityGraph.addEntity(new ScalarEntity(value, propertyEntityId, entityGraph)); @@ -269,7 +270,7 @@ private void createPropertiesDefinition(TEntityType toscaType, EntityId typeEnti EntityId propertiesEntityId = typeEntityId.extend(DefaultKeys.PROPERTIES); entityGraph.addEntity(new MappingEntity(propertiesEntityId, entityGraph)); - toscaType.getWinerysPropertiesDefinition().getPropertyDefinitionKVList().getPropertyDefinitionKVs() + toscaType.getWinerysPropertiesDefinition().getPropertyDefinitions() .forEach(propertyDef -> { EntityId propertyEntityId = propertiesEntityId.extend(propertyDef.getKey()); entityGraph.addEntity(new MappingEntity(propertyEntityId, entityGraph)); diff --git a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/edmm/EdmmMappingItem.java b/org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/model/EdmmMappingItem.java similarity index 96% rename from org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/edmm/EdmmMappingItem.java rename to org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/model/EdmmMappingItem.java index 317d1b9465..55ac1c8992 100644 --- a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/edmm/EdmmMappingItem.java +++ b/org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/model/EdmmMappingItem.java @@ -12,7 +12,7 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 *******************************************************************************/ -package org.eclipse.winery.common.edmm; +package org.eclipse.winery.edmm.model; import javax.xml.namespace.QName; diff --git a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/edmm/EdmmType.java b/org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/model/EdmmType.java similarity index 97% rename from org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/edmm/EdmmType.java rename to org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/model/EdmmType.java index 16fdd4f561..4ae2da5360 100644 --- a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/edmm/EdmmType.java +++ b/org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/model/EdmmType.java @@ -12,7 +12,7 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 *******************************************************************************/ -package org.eclipse.winery.common.edmm; +package org.eclipse.winery.edmm.model; import java.io.Serializable; diff --git a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/edmm/EdmmTypeProperties.java b/org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/model/EdmmTypeProperties.java similarity index 99% rename from org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/edmm/EdmmTypeProperties.java rename to org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/model/EdmmTypeProperties.java index 769092165c..7ad9023243 100644 --- a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/edmm/EdmmTypeProperties.java +++ b/org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/model/EdmmTypeProperties.java @@ -12,7 +12,7 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 *******************************************************************************/ -package org.eclipse.winery.common.edmm; +package org.eclipse.winery.edmm.model; import io.github.edmm.core.parser.EntityGraph; import io.github.edmm.core.parser.EntityId; diff --git a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/toscalight/ToscaLightChecker.java b/org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/toscalight/ToscaLightChecker.java similarity index 93% rename from org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/toscalight/ToscaLightChecker.java rename to org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/toscalight/ToscaLightChecker.java index cae11c0538..a16d8f8571 100644 --- a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/toscalight/ToscaLightChecker.java +++ b/org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/toscalight/ToscaLightChecker.java @@ -12,7 +12,7 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 *******************************************************************************/ -package org.eclipse.winery.common.toscalight; +package org.eclipse.winery.edmm.toscalight; import java.util.ArrayList; import java.util.HashMap; @@ -21,7 +21,7 @@ import javax.xml.namespace.QName; -import org.eclipse.winery.common.edmm.EdmmType; +import org.eclipse.winery.edmm.model.EdmmType; import org.eclipse.winery.model.tosca.HasPolicies; import org.eclipse.winery.model.tosca.TEntityTemplate; import org.eclipse.winery.model.tosca.TInterface; @@ -32,6 +32,8 @@ import org.eclipse.winery.model.tosca.TServiceTemplate; import org.eclipse.winery.model.tosca.TTopologyTemplate; import org.eclipse.winery.model.tosca.utils.ModelUtilities; +import org.eclipse.winery.repository.backend.RepositoryFactory; +import org.eclipse.winery.repository.filebased.RepositoryUtils; public class ToscaLightChecker { @@ -42,7 +44,7 @@ public class ToscaLightChecker { private QName hostedOn; private QName connectsTo; private QName dependsOn; - private Map> errorList; + private Map> errorList = new HashMap<>(); private boolean foundError; public ToscaLightChecker(Map nodeTypes, @@ -73,8 +75,12 @@ public Map> getErrorList() { } public boolean isToscaLightCompliant(TServiceTemplate serviceTemplate) { - this.checkToscaLightCompatibility(serviceTemplate); - return !this.foundError; + // Only in non-YAML mode for now + if (!RepositoryUtils.isYamlRepository(RepositoryFactory.getRepository())) { + this.checkToscaLightCompatibility(serviceTemplate); + return !this.foundError; + } + return false; } public Map> checkToscaLightCompatibility(TServiceTemplate serviceTemplate) { diff --git a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/toscalight/ToscaLightUtils.java b/org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/toscalight/ToscaLightUtils.java similarity index 96% rename from org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/toscalight/ToscaLightUtils.java rename to org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/toscalight/ToscaLightUtils.java index 3c16180eb7..543612a7d8 100644 --- a/org.eclipse.winery.common/src/main/java/org/eclipse/winery/common/toscalight/ToscaLightUtils.java +++ b/org.eclipse.winery.edmm/src/main/java/org/eclipse/winery/edmm/toscalight/ToscaLightUtils.java @@ -12,7 +12,7 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 *******************************************************************************/ -package org.eclipse.winery.common.toscalight; +package org.eclipse.winery.edmm.toscalight; import org.eclipse.winery.model.tosca.TInterface; diff --git a/org.eclipse.winery.common/src/test/java/org/eclipse/winery/common/edmm/EdmmDependantTest.java b/org.eclipse.winery.edmm/src/test/java/org/eclipse/winery/edmm/EdmmDependantTest.java similarity index 93% rename from org.eclipse.winery.common/src/test/java/org/eclipse/winery/common/edmm/EdmmDependantTest.java rename to org.eclipse.winery.edmm/src/test/java/org/eclipse/winery/edmm/EdmmDependantTest.java index 5332e63d9e..aa40f06545 100644 --- a/org.eclipse.winery.common/src/test/java/org/eclipse/winery/common/edmm/EdmmDependantTest.java +++ b/org.eclipse.winery.edmm/src/test/java/org/eclipse/winery/edmm/EdmmDependantTest.java @@ -12,14 +12,19 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 *******************************************************************************/ -package org.eclipse.winery.common.edmm; +package org.eclipse.winery.edmm; import java.io.UnsupportedEncodingException; import java.net.URLEncoder; +import java.util.ArrayList; +import java.util.Arrays; import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; import javax.xml.namespace.QName; +import org.eclipse.winery.edmm.model.EdmmType; import org.eclipse.winery.model.tosca.TArtifactReference; import org.eclipse.winery.model.tosca.TArtifactTemplate; import org.eclipse.winery.model.tosca.TDeploymentArtifact; @@ -36,9 +41,8 @@ import org.eclipse.winery.model.tosca.TRelationshipTemplate; import org.eclipse.winery.model.tosca.TRelationshipType; import org.eclipse.winery.model.tosca.TRelationshipTypeImplementation; -import org.eclipse.winery.model.tosca.kvproperties.PropertyDefinitionKV; -import org.eclipse.winery.model.tosca.kvproperties.PropertyDefinitionKVList; -import org.eclipse.winery.model.tosca.kvproperties.WinerysPropertiesDefinition; +import org.eclipse.winery.model.tosca.extensions.kvproperties.PropertyDefinitionKV; +import org.eclipse.winery.model.tosca.extensions.kvproperties.WinerysPropertiesDefinition; import org.eclipse.winery.model.tosca.utils.ModelUtilities; import org.junit.jupiter.api.BeforeEach; @@ -82,12 +86,14 @@ void setup() { TNodeType nodeType3 = new TNodeType(); nodeType3.setName(nodeType3QName.getLocalPart()); nodeType3.setTargetNamespace(nodeType3QName.getNamespaceURI()); - PropertyDefinitionKVList kvList = new PropertyDefinitionKVList(); - kvList.add(new PropertyDefinitionKV("os_family", "xsd:string")); - kvList.add(new PropertyDefinitionKV("public_key", "xsd:string")); - kvList.add(new PropertyDefinitionKV("ssh_port", "number")); + List kvList = new ArrayList<>(); + kvList.addAll(Arrays.asList( + new PropertyDefinitionKV("os_family", "xsd:string"), + new PropertyDefinitionKV("public_key", "xsd:string"), + new PropertyDefinitionKV("ssh_port", "number") + )); WinerysPropertiesDefinition wpd = new WinerysPropertiesDefinition(); - wpd.setPropertyDefinitionKVList(kvList); + wpd.setPropertyDefinitions(kvList); ModelUtilities.replaceWinerysPropertiesDefinition(nodeType3, wpd); nodeTypes.put(nodeType3QName, nodeType3); @@ -200,8 +206,8 @@ void setup() { nt3.setType(nodeType3QName); nt3.setId("test_node_3"); nt3.setName("test_node_3"); - TEntityTemplate.Properties properties = new TEntityTemplate.Properties(); - HashMap nt3Properties = new HashMap<>(); + TEntityTemplate.WineryKVProperties properties = new TEntityTemplate.WineryKVProperties(); + LinkedHashMap nt3Properties = new LinkedHashMap<>(); nt3Properties.put("os_family", "ubuntu"); nt3Properties.put("public_key", "-----BEGIN PUBLIC KEY----- ... -----END PUBLIC KEY-----"); nt3Properties.put("ssh_port", "22"); diff --git a/org.eclipse.winery.repository/src/test/java/org/eclipse/winery/repository/export/EdmmUtilsTest.java b/org.eclipse.winery.edmm/src/test/java/org/eclipse/winery/edmm/EdmmUtilsTest.java similarity index 96% rename from org.eclipse.winery.repository/src/test/java/org/eclipse/winery/repository/export/EdmmUtilsTest.java rename to org.eclipse.winery.edmm/src/test/java/org/eclipse/winery/edmm/EdmmUtilsTest.java index 041511c183..63e0bda7de 100644 --- a/org.eclipse.winery.repository/src/test/java/org/eclipse/winery/repository/export/EdmmUtilsTest.java +++ b/org.eclipse.winery.edmm/src/test/java/org/eclipse/winery/edmm/EdmmUtilsTest.java @@ -12,7 +12,7 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 *******************************************************************************/ -package org.eclipse.winery.repository.export; +package org.eclipse.winery.edmm; import java.util.Map; diff --git a/org.eclipse.winery.repository/src/test/java/org/eclipse/winery/repository/backend/filebased/JsonBasedEdmmManagerTest.java b/org.eclipse.winery.edmm/src/test/java/org/eclipse/winery/edmm/JsonBasedEdmmManagerTest.java similarity index 87% rename from org.eclipse.winery.repository/src/test/java/org/eclipse/winery/repository/backend/filebased/JsonBasedEdmmManagerTest.java rename to org.eclipse.winery.edmm/src/test/java/org/eclipse/winery/edmm/JsonBasedEdmmManagerTest.java index b6951bd953..271aca8b1c 100644 --- a/org.eclipse.winery.repository/src/test/java/org/eclipse/winery/repository/backend/filebased/JsonBasedEdmmManagerTest.java +++ b/org.eclipse.winery.edmm/src/test/java/org/eclipse/winery/edmm/JsonBasedEdmmManagerTest.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2019 Contributors to the Eclipse Foundation + * Copyright (c) 2019-2020 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -12,14 +12,14 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 *******************************************************************************/ -package org.eclipse.winery.repository.backend.filebased; +package org.eclipse.winery.edmm; import java.io.File; import javax.xml.namespace.QName; -import org.eclipse.winery.common.edmm.EdmmMappingItem; -import org.eclipse.winery.common.edmm.EdmmType; +import org.eclipse.winery.edmm.model.EdmmMappingItem; +import org.eclipse.winery.edmm.model.EdmmType; import org.junit.jupiter.api.Test; diff --git a/org.eclipse.winery.common/src/test/java/org/eclipse/winery/common/edmm/EdmmConverterTest.java b/org.eclipse.winery.edmm/src/test/java/org/eclipse/winery/edmm/model/EdmmConverterTest.java similarity index 86% rename from org.eclipse.winery.common/src/test/java/org/eclipse/winery/common/edmm/EdmmConverterTest.java rename to org.eclipse.winery.edmm/src/test/java/org/eclipse/winery/edmm/model/EdmmConverterTest.java index dff8fc5095..01003e8d24 100644 --- a/org.eclipse.winery.common/src/test/java/org/eclipse/winery/common/edmm/EdmmConverterTest.java +++ b/org.eclipse.winery.edmm/src/test/java/org/eclipse/winery/edmm/model/EdmmConverterTest.java @@ -12,7 +12,7 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 *******************************************************************************/ -package org.eclipse.winery.common.edmm; +package org.eclipse.winery.edmm.model; import java.io.StringWriter; import java.io.UnsupportedEncodingException; @@ -20,6 +20,7 @@ import java.util.Optional; import java.util.stream.Stream; +import org.eclipse.winery.edmm.EdmmDependantTest; import org.eclipse.winery.model.tosca.TServiceTemplate; import org.eclipse.winery.model.tosca.TTopologyTemplate; @@ -41,12 +42,12 @@ protected EdmmConverterTest() throws UnsupportedEncodingException { @Test void transformOneNodeTemplate() { // region *** build the TopologyTemplate *** - TTopologyTemplate topology = new TTopologyTemplate(); - topology.addNodeTemplate(nodeTemplates.get("test_node_1")); + TTopologyTemplate.Builder topology = new TTopologyTemplate.Builder(); + topology.addNodeTemplates(nodeTemplates.get("test_node_1")); // endregion TServiceTemplate serviceTemplate = new TServiceTemplate(); - serviceTemplate.setTopologyTemplate(topology); + serviceTemplate.setTopologyTemplate(topology.build()); EdmmConverter edmmConverter = new EdmmConverter(nodeTypes, relationshipTypes, nodeTypeImplementations, relationshipTypeImplementations, artifactTemplates, edmmTypeExtendsMapping, edmm1to1Mapping); @@ -59,12 +60,12 @@ void transformOneNodeTemplate() { @Test void transformDerivedFrom() { // region *** build the TopologyTemplate *** - TTopologyTemplate topology = new TTopologyTemplate(); - topology.addNodeTemplate(nodeTemplates.get("test_node_2")); + TTopologyTemplate.Builder topology = new TTopologyTemplate.Builder(); + topology.addNodeTemplates(nodeTemplates.get("test_node_2")); // endregion TServiceTemplate serviceTemplate = new TServiceTemplate(); - serviceTemplate.setTopologyTemplate(topology); + serviceTemplate.setTopologyTemplate(topology.build()); EdmmConverter edmmConverter = new EdmmConverter(nodeTypes, relationshipTypes, nodeTypeImplementations, relationshipTypeImplementations, artifactTemplates, edmmTypeExtendsMapping, edmm1to1Mapping); @@ -81,12 +82,12 @@ void transformDerivedFrom() { @Test void transformProperties() { // region *** build the TopologyTemplate *** - TTopologyTemplate topology = new TTopologyTemplate(); - topology.addNodeTemplate(nodeTemplates.get("test_node_3")); + TTopologyTemplate.Builder topology = new TTopologyTemplate.Builder(); + topology.addNodeTemplates(nodeTemplates.get("test_node_3")); // endregion TServiceTemplate serviceTemplate = new TServiceTemplate(); - serviceTemplate.setTopologyTemplate(topology); + serviceTemplate.setTopologyTemplate(topology.build()); EdmmConverter edmmConverter = new EdmmConverter(nodeTypes, relationshipTypes, nodeTypeImplementations, relationshipTypeImplementations, artifactTemplates, edmmTypeExtendsMapping, edmm1to1Mapping); @@ -121,17 +122,17 @@ void transformProperties() { @Test void transformTopologyWithRelationsAndRelationTypes() { // region *** build the TopologyTemplate *** - TTopologyTemplate topology = new TTopologyTemplate(); - topology.addNodeTemplate(nodeTemplates.get("test_node_1")); - topology.addNodeTemplate(nodeTemplates.get("test_node_2")); - topology.addNodeTemplate(nodeTemplates.get("test_node_3")); + TTopologyTemplate.Builder topology = new TTopologyTemplate.Builder(); + topology.addNodeTemplates(nodeTemplates.get("test_node_1")); + topology.addNodeTemplates(nodeTemplates.get("test_node_2")); + topology.addNodeTemplates(nodeTemplates.get("test_node_3")); topology.addRelationshipTemplate(relationshipTemplates.get("1_hosted_on_3")); topology.addRelationshipTemplate(relationshipTemplates.get("2_hosted_on_3")); topology.addRelationshipTemplate(relationshipTemplates.get("1_connects_to_2")); // endregion TServiceTemplate serviceTemplate = new TServiceTemplate(); - serviceTemplate.setTopologyTemplate(topology); + serviceTemplate.setTopologyTemplate(topology.build()); EdmmConverter edmmConverter = new EdmmConverter(nodeTypes, relationshipTypes, nodeTypeImplementations, relationshipTypeImplementations, artifactTemplates, edmmTypeExtendsMapping, edmm1to1Mapping); @@ -158,12 +159,12 @@ void transformTopologyWithRelationsAndRelationTypes() { @Test void transformTopologyWithOperations() { // region *** build the TopologyTemplate *** - TTopologyTemplate topology = new TTopologyTemplate(); - topology.addNodeTemplate(nodeTemplates.get("test_node_4")); + TTopologyTemplate.Builder topology = new TTopologyTemplate.Builder(); + topology.addNodeTemplates(nodeTemplates.get("test_node_4")); // endregion TServiceTemplate serviceTemplate = new TServiceTemplate(); - serviceTemplate.setTopologyTemplate(topology); + serviceTemplate.setTopologyTemplate(topology.build()); EdmmConverter edmmConverter = new EdmmConverter(nodeTypes, relationshipTypes, nodeTypeImplementations, relationshipTypeImplementations, artifactTemplates, edmmTypeExtendsMapping, edmm1to1Mapping, false); @@ -187,17 +188,17 @@ void transformTopologyWithOperations() { @Test void transformTopology() { // region *** build the TopologyTemplate *** - TTopologyTemplate topology = new TTopologyTemplate(); - topology.addNodeTemplate(nodeTemplates.get("test_node_1")); - topology.addNodeTemplate(nodeTemplates.get("test_node_2")); - topology.addNodeTemplate(nodeTemplates.get("test_node_3")); - topology.addNodeTemplate(nodeTemplates.get("test_node_4")); + TTopologyTemplate.Builder topology = new TTopologyTemplate.Builder(); + topology.addNodeTemplates(nodeTemplates.get("test_node_1")); + topology.addNodeTemplates(nodeTemplates.get("test_node_2")); + topology.addNodeTemplates(nodeTemplates.get("test_node_3")); + topology.addNodeTemplates(nodeTemplates.get("test_node_4")); topology.addRelationshipTemplate(relationshipTemplates.get("1_hosted_on_3")); topology.addRelationshipTemplate(relationshipTemplates.get("2_hosted_on_3")); topology.addRelationshipTemplate(relationshipTemplates.get("4_hosted_on_1")); topology.addRelationshipTemplate(relationshipTemplates.get("1_connects_to_2")); TServiceTemplate serviceTemplate = new TServiceTemplate(); - serviceTemplate.setTopologyTemplate(topology); + serviceTemplate.setTopologyTemplate(topology.build()); // endregion EdmmConverter edmmConverter = new EdmmConverter(nodeTypes, relationshipTypes, nodeTypeImplementations, diff --git a/org.eclipse.winery.common/src/test/java/org/eclipse/winery/common/toscalight/ToscaLightCheckerTest.java b/org.eclipse.winery.edmm/src/test/java/org/eclipse/winery/edmm/toscalight/ToscaLightCheckerTest.java similarity index 83% rename from org.eclipse.winery.common/src/test/java/org/eclipse/winery/common/toscalight/ToscaLightCheckerTest.java rename to org.eclipse.winery.edmm/src/test/java/org/eclipse/winery/edmm/toscalight/ToscaLightCheckerTest.java index 9896ddd705..c53063e75b 100644 --- a/org.eclipse.winery.common/src/test/java/org/eclipse/winery/common/toscalight/ToscaLightCheckerTest.java +++ b/org.eclipse.winery.edmm/src/test/java/org/eclipse/winery/edmm/toscalight/ToscaLightCheckerTest.java @@ -12,7 +12,7 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 *******************************************************************************/ -package org.eclipse.winery.common.toscalight; +package org.eclipse.winery.edmm.toscalight; import java.io.UnsupportedEncodingException; import java.util.List; @@ -20,7 +20,7 @@ import javax.xml.namespace.QName; -import org.eclipse.winery.common.edmm.EdmmDependantTest; +import org.eclipse.winery.edmm.EdmmDependantTest; import org.eclipse.winery.model.tosca.TServiceTemplate; import org.eclipse.winery.model.tosca.TTopologyTemplate; @@ -37,17 +37,17 @@ protected ToscaLightCheckerTest() throws UnsupportedEncodingException { @Test void checkValidServiceTemplate() throws Exception { // region *** build the TopologyTemplate *** - TTopologyTemplate topology = new TTopologyTemplate(); - topology.addNodeTemplate(nodeTemplates.get("test_node_1")); - topology.addNodeTemplate(nodeTemplates.get("test_node_2")); - topology.addNodeTemplate(nodeTemplates.get("test_node_3")); - topology.addNodeTemplate(nodeTemplates.get("test_node_4")); + TTopologyTemplate.Builder topology = new TTopologyTemplate.Builder(); + topology.addNodeTemplates(nodeTemplates.get("test_node_1")); + topology.addNodeTemplates(nodeTemplates.get("test_node_2")); + topology.addNodeTemplates(nodeTemplates.get("test_node_3")); + topology.addNodeTemplates(nodeTemplates.get("test_node_4")); topology.addRelationshipTemplate(relationshipTemplates.get("1_hosted_on_3")); topology.addRelationshipTemplate(relationshipTemplates.get("2_hosted_on_3")); topology.addRelationshipTemplate(relationshipTemplates.get("4_hosted_on_1")); topology.addRelationshipTemplate(relationshipTemplates.get("1_connects_to_2")); TServiceTemplate serviceTemplate = new TServiceTemplate(); - serviceTemplate.setTopologyTemplate(topology); + serviceTemplate.setTopologyTemplate(topology.build()); serviceTemplate.setName("MyTestServiceTemplate"); serviceTemplate.setId(serviceTemplate.getName()); serviceTemplate.setTargetNamespace(this.NAMESPACE); diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/qname.ts b/org.eclipse.winery.frontends/app/shared/src/app/model/qName.ts similarity index 70% rename from org.eclipse.winery.frontends/app/topologymodeler/src/app/models/qname.ts rename to org.eclipse.winery.frontends/app/shared/src/app/model/qName.ts index fc8e00a732..24a5ca4fc7 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/qname.ts +++ b/org.eclipse.winery.frontends/app/shared/src/app/model/qName.ts @@ -1,5 +1,5 @@ -/******************************************************************************** - * Copyright (c) 2017-2018 Contributors to the Eclipse Foundation +/******************************************************************************* + * Copyright (c) 2020 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -10,16 +10,34 @@ * which is available at https://www.apache.org/licenses/LICENSE-2.0. * * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 - ********************************************************************************/ + *******************************************************************************/ -/** - * Retrieves the local name and the namespace from the qname - */ export class QName { + + public static stringToQName(name: string): QName { + return new QName(name); + } + + public static create(nameSpace: string, localName: string): QName { + return new QName(`{${nameSpace}}${localName}`); + } + private _localName: string; private _nameSpace: string; constructor(private _qName?: string) { + this.parseQName(); + } + + private parseQName() { + const regex = /\{(.*?)\}(.*)/g; + const res = regex.exec(this._qName); + + if (!res || res.length !== 3) { + throw new Error(); + } + this._nameSpace = res[1]; + this._localName = res[2]; } /** @@ -35,6 +53,7 @@ export class QName { */ set localName(value: string) { this._localName = value; + this._qName = `{${this._nameSpace}}${this._localName}`; } /** @@ -51,6 +70,7 @@ export class QName { */ set nameSpace(value: string) { this._nameSpace = value; + this._qName = `{${this._nameSpace}}${this._localName}`; } /** @@ -68,6 +88,7 @@ export class QName { */ set qName(value: string) { this._qName = value; + this.parseQName(); } /** @@ -77,5 +98,6 @@ export class QName { */ setQNameWithLocalNameAndNamespace(localname: string, namespace: string) { this._qName = '{' + namespace + '}' + localname; + this.parseQName(); } } diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/canvas.component.css b/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/canvas.component.css index 3cf86f01e9..cb465f1f09 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/canvas.component.css +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/canvas.component.css @@ -49,7 +49,6 @@ #grid { position: absolute; - z-index: 4; } .labelStyle path { diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/canvas.component.html b/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/canvas.component.html index ac1ae99d88..0290289085 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/canvas.component.html +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/canvas.component.html @@ -386,16 +386,15 @@
Existing Policies:
Properties of {{selectedYamlPolicy.name}}:
-
+
- +
+ (click)="addMitigationToTopology(mitigation)">{{mitigation.localName}} +
diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/canvas.component.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/canvas.component.ts index 86896c5370..05844b0f6e 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/canvas.component.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/canvas.component.ts @@ -34,13 +34,11 @@ import { ToggleModalDataModel } from '../models/toggleModalDataModel'; import { ToastrService } from 'ngx-toastr'; import { BackendService } from '../services/backend.service'; import { CapabilityModel } from '../models/capabilityModel'; -import { isNullOrUndefined } from 'util'; import { RequirementModel } from '../models/requirementModel'; import { EntityTypesModel } from '../models/entityTypesModel'; import { ExistsService } from '../services/exists.service'; import { ModalVariant, ModalVariantAndState } from './entities-modal/modal-model'; import { align, toggleModalType } from '../models/enums'; -import { QName } from '../models/qname'; import { ImportTopologyModalData } from '../models/importTopologyModalData'; import { ImportTopologyService } from '../services/import-topology.service'; import { SplitMatchTopologyService } from '../services/split-match-topology.service'; @@ -60,6 +58,7 @@ import { CapabilityDefinitionModel } from '../models/capabilityDefinitionModel'; import { WineryRowData } from '../../../../tosca-management/src/app/wineryTableModule/wineryTable.component'; import { InheritanceUtils } from '../models/InheritanceUtils'; import { PolicyService } from '../services/policy.service'; +import { QName } from '../../../../shared/src/app/model/qName'; @Component({ selector: 'winery-canvas', @@ -99,8 +98,6 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI dragSourceActive = false; event: any; selectedRelationshipType: EntityType; - nodeChildrenIdArray: Array; - nodeChildrenArray: Array; jsPlumbBindConnection = false; newNode: TNodeTemplate; paletteOpened: boolean; @@ -197,16 +194,13 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI this.subscriptions.push(this.ngRedux.select(state => state.wineryState.currentJsonTopology.policies) .subscribe(policies => this.handleUpdatedYamlPolicies(policies))); this.subscriptions.push(this.ngRedux.select(state => state.wineryState.currentJsonTopology.nodeTemplates) - .subscribe(currentNodes => this.updateNodes(currentNodes))); + .subscribe(storeNodes => this.updateNodes(storeNodes))); this.subscriptions.push(this.ngRedux.select(state => state.wineryState.currentJsonTopology.relationshipTemplates) .subscribe(currentRelationships => this.updateRelationships(currentRelationships))); this.subscriptions.push(this.ngRedux.select(state => state.topologyRendererState) .subscribe(currentButtonsState => this.setRendererState(currentButtonsState))); - this.subscriptions.push(this.ngRedux.select(state => state.wineryState.currentNodeData) - .subscribe(currentNodeData => this.toggleMarkNode(currentNodeData))); + this.gridTemplate = new GridTemplate(100, false, false, 30); - this.subscriptions.push(this.ngRedux.select(state => state.wineryState.currentPaletteOpenedState) - .subscribe(currentPaletteOpened => this.setPaletteState(currentPaletteOpened))); this.hotkeysService.add(new Hotkey('mod+a', (event: KeyboardEvent): boolean => { event.stopPropagation(); this.allNodeTemplates.forEach(node => this.enhanceDragSelection(node.id)); @@ -256,25 +250,25 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI /** * Gets called if nodes get deleted, created, or node attributes are updated and calls the * correct handler. - * @param currentNodes List of all displayed nodes. + * @param storeNodes List of all displayed nodes. */ - updateNodes(currentNodes: Array): void { - const storeNodesLength = currentNodes.length; + updateNodes(storeNodes: Array): void { + const storeNodesLength = storeNodes.length; const localCopyNodesLength = this.allNodeTemplates.length; if (storeNodesLength !== localCopyNodesLength) { - const difference = currentNodes.length - this.allNodeTemplates.length; + const difference = storeNodes.length - this.allNodeTemplates.length; if (difference === 1 && this.paletteOpened) { - this.handleNewNode(currentNodes); + this.handleNewNode(storeNodes); } else if (difference < 0) { - this.handleDeletedNodes(currentNodes); + this.handleDeletedNodes(storeNodes); } else if (difference === 1 && !this.paletteOpened) { - this.allNodeTemplates.push(currentNodes[currentNodes.length - 1]); + this.allNodeTemplates.push(storeNodes[storeNodes.length - 1]); this.revalidateContainer(); } else { - this.allNodeTemplates = currentNodes; + this.allNodeTemplates = storeNodes; } } else if (storeNodesLength !== 0 && localCopyNodesLength !== 0) { - this.updateNodeAttributes(currentNodes); + this.updateNodeAttributes(storeNodes); } this.allNodesIds = this.allNodeTemplates.map(node => node.id); } @@ -286,17 +280,11 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI * of the node */ toggleMarkNode(currentNodeData: NodeIdAndFocusModel) { - if (this.nodeChildrenArray) { - this.nodeChildrenArray.forEach(node => { - if (node.nodeTemplate.id === currentNodeData.id) { - if (currentNodeData.focus === true) { - node.makeSelectionVisible = true; - } else { - node.makeSelectionVisible = false; - } - } - }); - } + this.nodeComponentChildren.forEach(component => { + if (component.nodeTemplate.id === currentNodeData.id) { + component.makeSelectionVisible = currentNodeData.focus; + } + }); } /** @@ -342,7 +330,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI this.requirements.requirements = currentNodeData.requirements; this.requirements.nodeId = currentNodeData.id; // if a requirement in the table is clicked show the data in the modal - if (!isNullOrUndefined(currentNodeData.currentRequirement)) { + if (currentNodeData.currentRequirement) { this.showCurrentRequirement = true; this.requirements.reqId = currentNodeData.currentRequirement.id; this.requirements.oldReqId = currentNodeData.currentRequirement.id; @@ -424,7 +412,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI this.capabilities.capabilities = currentNodeData.capabilities; this.capabilities.nodeId = currentNodeData.id; // if a capability in the table is clicked show the data in the modal - if (!isNullOrUndefined(currentNodeData.currentCapability)) { + if (currentNodeData.currentCapability) { this.showCurrentCapability = true; this.capabilities.capId = currentNodeData.currentCapability.id; this.capabilities.oldCapId = currentNodeData.currentCapability.id; @@ -506,11 +494,10 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI * This function sets the capability default KV properties */ setDefaultCapKVProperties(): void { - this.capabilities.capabilities.capability.some(cap => { + this.capabilities.capabilities.capability.forEach(cap => { if (cap.id === this.currentModalData.currentCapability.id) { cap.properties = { - kvproperties: - this.capabilities.properties + kvproperties: this.capabilities.properties }; } }); @@ -520,11 +507,10 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI * This function sets the requirement default KV properties */ setDefaultReqKVProperties(): void { - this.requirements.requirements.requirement.some(req => { + this.requirements.requirements.requirement.forEach(req => { if (req.id === this.currentModalData.currentRequirement.id) { req.properties = { - kvproperties: - this.requirements.properties + kvproperties: this.requirements.properties }; } }); @@ -534,7 +520,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI * This function sets the capability default XML properties */ setDefaultCapXMLProperties(): void { - this.capabilities.capabilities.capability.some(cap => { + this.capabilities.capabilities.capability.forEach(cap => { if (cap.id === this.currentModalData.currentCapability.id) { cap.properties = { any: this.capabilities.properties @@ -547,7 +533,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI * This function sets the requirement default XML properties */ setDefaultReqXMLProperties(): void { - this.requirements.requirements.requirement.some(req => { + this.requirements.requirements.requirement.forEach(req => { if (req.id === this.currentModalData.currentCapability.id) { req.properties = { any: this.requirements.properties @@ -922,7 +908,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI if (difference === 1) { this.handleNewRelationship(currentRelationships); } else if (difference > 0 || difference < 0) { - if (this.configuration.isYaml() && difference < 0) { + if (this.configuration.isYaml() && difference < 0 && this.allNodeTemplates.length > 0) { // a relationship is deleted. reset the associated source requirement const deletedRels = this.allRelationshipTemplates.filter(rel => currentRelationships.every(curRel => curRel.id !== rel.id)); deletedRels.forEach(deletedRel => { @@ -1006,7 +992,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI let leaveNodesAsSelectedAfterLayouting; if (this.topologyRendererState.buttonsState.layoutButton) { - this.layoutDirective.layoutNodes(this.nodeChildrenArray, this.allRelationshipTemplates) + this.layoutDirective.layoutNodes(this.nodeComponentChildren.toArray(), this.allRelationshipTemplates) .then(done => { leaveNodesAsSelectedAfterLayouting = false; // This call might seem confusing as we are calling it again right after executing, @@ -1020,7 +1006,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI const nodesToBeAligned = selectionActive ? this.selectedNodes : this.allNodeTemplates; leaveNodesAsSelectedAfterLayouting = selectionActive; const alignmentMode = this.topologyRendererState.buttonsState.alignHButton ? align.Horizontal : align.Vertical; - this.layoutDirective.align(this.nodeChildrenArray, nodesToBeAligned, alignmentMode) + this.layoutDirective.align(this.nodeComponentChildren.toArray(), nodesToBeAligned, alignmentMode) .then(() => { leaveNodesAsSelectedAfterLayouting = false; // This call might seem confusing as we are calling it again right after executing, @@ -1194,13 +1180,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI * @param nodeTemplate Node Element (DOM). */ setNewCoordinates(nodeTemplate: any): void { - let nodeIndex; - this.allNodeTemplates.some((node, index) => { - if (node.id === nodeTemplate.firstChild.id) { - nodeIndex = index; - return true; - } - }); + const nodeIndex = this.allNodeTemplates.findIndex(node => node.id === nodeTemplate.firstChild.id); const nodeCoordinates = { id: nodeTemplate.firstChild.id, x: nodeTemplate.firstChild.offsetLeft, @@ -1231,7 +1211,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI paintRelationship(newRelationship: TRelationshipTemplate) { const allJsPlumbRelationships = this.newJsPlumbInstance.getAllConnections(); if (!allJsPlumbRelationships.some(rel => rel.id === newRelationship.id)) { - let labelString = (isNullOrUndefined(newRelationship.state) ? '' : newRelationship.state + '
') + let labelString = (!newRelationship.state ? '' : newRelationship.state + '
') // why not use name -> save the type's id into the name (without management version) + newRelationship.name; @@ -1282,7 +1262,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI } } - const border = isNullOrUndefined(newRelationship.state) + const border = !newRelationship.state ? '#fafafa' : VersionUtils.getElementColorByDiffState(newRelationship.state); const me = this; const conn = this.newJsPlumbInstance.connect({ @@ -1349,9 +1329,9 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI this.newJsPlumbInstance.unmakeSource(this.dragSourceInfos.nodeId); } } - const indexOfNode = this.nodeChildrenIdArray.indexOf(this.dragSourceInfos.nodeId); - if (this.nodeChildrenArray[indexOfNode]) { - this.nodeChildrenArray[indexOfNode].connectorEndpointVisible = false; + const nodeComponent = this.nodeComponentChildren.find(c => c.nodeTemplate.id === this.dragSourceInfos.nodeId); + if (nodeComponent) { + nodeComponent.connectorEndpointVisible = false; this.revalidateContainer(); } this.dragSourceActive = false; @@ -1367,19 +1347,13 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI * @param nodeId */ toggleClosedEndpoint(nodeId: string): void { - const node = this.nodeChildrenArray.find((nodeTemplate => nodeTemplate.nodeTemplate.id === nodeId)); + const node = this.nodeComponentChildren.find((c => c.nodeTemplate.id === nodeId)); node.connectorEndpointVisible = !node.connectorEndpointVisible; - if (node.connectorEndpointVisible === true) { + if (node.connectorEndpointVisible) { this.dragSourceActive = false; this.resetDragSource(nodeId); - this.nodeChildrenArray.some(currentNode => { - if (currentNode.nodeTemplate.id !== nodeId) { - if (currentNode.connectorEndpointVisible === true) { - currentNode.connectorEndpointVisible = false; - return true; - } - } - }); + this.nodeComponentChildren.filter(c => c.nodeTemplate.id !== nodeId) + .forEach(c => c.connectorEndpointVisible = false); } } @@ -1416,7 +1390,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI // if name, min or max instances has changed, do not delete the node. if (this.selectedNodes.length > 0) { let selectedNodeSideBarVisible = false; - this.nodeChildrenArray.forEach(node => { + this.nodeComponentChildren.forEach(node => { if (node.makeSelectionVisible === true) { if (!selectedNodeSideBarVisible) { this.hideSidebar(); @@ -1458,7 +1432,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI */ clearSelectedNodes(): void { if (this.selectedNodes.length > 0) { - this.nodeChildrenArray.forEach(node => { + this.nodeComponentChildren.forEach(node => { if (this.selectedNodes.find(selectedNode => selectedNode && selectedNode.id === node.nodeTemplate.id)) { node.makeSelectionVisible = false; } @@ -1477,7 +1451,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI this.ngRedux.dispatch(this.actions.sendPaletteOpened(false)); this.hideSidebar(); this.clearSelectedNodes(); - this.nodeChildrenArray.forEach(node => node.makeSelectionVisible = false); + this.nodeComponentChildren.forEach(node => node.makeSelectionVisible = false); this.gridTemplate.pageX = $event.pageX; this.gridTemplate.pageY = $event.pageY; this.gridTemplate.initialW = $event.pageX; @@ -1565,14 +1539,17 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI hideSidebar() { this.ngRedux.dispatch(this.actions.openSidebar({ sidebarContents: { - sidebarVisible: false, + visible: false, nodeClicked: false, - id: '', - nameTextFieldValue: '', - type: '', - properties: '', + template: { + id: '', + name: '', + type: '', + properties: '', + }, + relationshipTemplate: undefined, source: '', - target: '' + target: '', } })); } @@ -1758,7 +1735,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI * Removes the dragSource of a node which marks the area where a connection can be dragged from */ removeDragSource(): void { - this.nodeChildrenArray.some(node => { + this.nodeComponentChildren.some(node => { if (node.dragSource) { if (this.newJsPlumbInstance.isSource(node.dragSource)) { this.newJsPlumbInstance.unmakeSource(node.dragSource); @@ -1801,13 +1778,12 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI * Lifecycle event */ ngAfterViewInit() { - this.nodeChildrenArray = this.nodeComponentChildren.toArray(); - this.nodeChildrenIdArray = this.nodeChildrenArray.map(node => node.nodeTemplate.id); - this.nodeComponentChildren.changes.subscribe(children => { - this.nodeChildrenArray = children.toArray(); - this.nodeChildrenIdArray = this.nodeChildrenArray.map(node => node.nodeTemplate.id); - }); - if (this.allRelationshipTemplates.length > 0 && this.nodeChildrenArray.length > 1) { + this.subscriptions.push(this.ngRedux.select(state => state.wineryState.currentNodeData) + .subscribe(currentNodeData => this.toggleMarkNode(currentNodeData))); + this.subscriptions.push(this.ngRedux.select(state => state.wineryState.currentPaletteOpenedState) + .subscribe(currentPaletteOpened => this.setPaletteState(currentPaletteOpened))); + + if (this.allRelationshipTemplates.length > 0 && this.nodeComponentChildren.length > 1) { this.allRelationshipTemplates.forEach(rel => { setTimeout(() => this.manageRelationships(rel), 1); }); @@ -1890,6 +1866,9 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI } }); + // define default properties of the node based on the type of the node + this.newNode.properties = InheritanceUtils.getDefaultPropertiesFromEntityTypes(this.newNode.type, this.entityTypes.unGroupedNodeTypes); + // if in YAML mode, automatically add all requirement and capability definitions to the node template! if (this.configuration.isYaml()) { this.newNode.requirements = { requirement: [] }; @@ -1935,49 +1914,29 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI } /** - * Gets called if node is updated, implements some checks. - * @param currentNodes List of all displayed nodes. + * Gets called if node is updated + * @param storeNodes List of all displayed nodes. */ - private updateNodeAttributes(currentNodes: Array): void { - this.allNodeTemplates.some(nodeTemplate => { - const node = currentNodes.find(el => el.id === nodeTemplate.id); - if (node) { - if (nodeTemplate.name !== node.name) { - const nodeId = this.nodeChildrenIdArray.indexOf(nodeTemplate.id); - this.nodeChildrenArray[nodeId].nodeTemplate.name = node.name; - this.nodeChildrenArray[nodeId].flash('name'); - nodeTemplate.name = node.name; - return true; - } else if (nodeTemplate.minInstances !== node.minInstances) { - const nodeId = this.nodeChildrenIdArray.indexOf(nodeTemplate.id); - nodeTemplate.minInstances = node.minInstances; - this.nodeChildrenArray[nodeId].flash('min'); - return true; - } else if (nodeTemplate.maxInstances !== node.maxInstances) { - const nodeId = this.nodeChildrenIdArray.indexOf(nodeTemplate.id); - nodeTemplate.maxInstances = node.maxInstances; - this.nodeChildrenArray[nodeId].flash('max'); - return true; - } else if (nodeTemplate.properties !== node.properties) { - nodeTemplate.properties = node.properties; - return true; - } else if (nodeTemplate.capabilities !== node.capabilities) { - nodeTemplate.capabilities = node.capabilities; - return true; - } else if (nodeTemplate.requirements !== node.requirements) { - nodeTemplate.requirements = node.requirements; - return true; - } else if (nodeTemplate.deploymentArtifacts !== node.deploymentArtifacts) { - nodeTemplate.deploymentArtifacts = node.deploymentArtifacts; - return true; - } else if (nodeTemplate.policies !== node.policies) { - nodeTemplate.policies = node.policies; - return true; - } else if (nodeTemplate.otherAttributes !== node.otherAttributes) { - nodeTemplate.otherAttributes = node.otherAttributes; - return true; + private updateNodeAttributes(storeNodes: Array): void { + this.allNodeTemplates = this.allNodeTemplates.map(nodeTemplate => { + const storeData = storeNodes.find(el => el.id === nodeTemplate.id); + if (storeData) { + // update exposed keys + for (const key of ['name', 'minInstances', 'maxInstances', 'properties', + 'capabilities', 'requirements', 'deploymentArtifacts', + 'policies', 'otherAttributes']) { + nodeTemplate[key] = storeData[key]; + } + const nodeComponent = this.nodeComponentChildren.find(c => c.nodeTemplate.id === nodeTemplate.id); + if (nodeTemplate.name !== storeData.name) { + nodeComponent.flash('name'); + } else if (nodeTemplate.minInstances !== storeData.minInstances) { + nodeComponent.flash('min'); + } else if (nodeTemplate.maxInstances !== storeData.maxInstances) { + nodeComponent.flash('max'); } } + return nodeTemplate; }); } @@ -2011,20 +1970,22 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI this.clearSelectedNodes(); this.newJsPlumbInstance.select().removeType('marked'); const currentRel = this.allRelationshipTemplates.find(con => con.id === conn.id); - let name = currentRel.name; - if (currentRel.name.startsWith(this.backendService.configuration.relationshipPrefix)) { - // Workaround to support old topology templates with the real name - name = currentRel.type.substring(currentRel.type.indexOf('}') + 1); - } if (currentRel) { + let name = currentRel.name; + if (currentRel.name.startsWith(this.backendService.configuration.relationshipPrefix)) { + // Workaround to support old topology templates with the real name + name = currentRel.type.substring(currentRel.type.indexOf('}') + 1); + } this.ngRedux.dispatch(this.actions.openSidebar({ sidebarContents: { - sidebarVisible: true, + visible: true, nodeClicked: false, - id: currentRel.id, - nameTextFieldValue: name, - type: currentRel.type, - properties: currentRel.properties, + template: { + id: currentRel.id, + name: name, + type: currentRel.type, + properties: currentRel.properties, + }, relationshipTemplate: currentRel, source: currentRel.sourceElement.ref, target: currentRel.targetElement.ref @@ -2069,7 +2030,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI } if (!this.arrayContainsNode(this.selectedNodes, nodeId)) { this.enhanceDragSelection(nodeId); - this.nodeChildrenArray.forEach(node => { + this.nodeComponentChildren.forEach(node => { let nodeIndex; this.selectedNodes.some((selectedNode, index) => { if (selectedNode.id === node.nodeTemplate.id) { @@ -2088,14 +2049,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI }); } else { this.newJsPlumbInstance.removeFromAllPosses(nodeId); - let nodeIndex; - this.nodeChildrenArray.some((node, index) => { - if (node.nodeTemplate.id === nodeId) { - nodeIndex = index; - return true; - } - }); - this.nodeChildrenArray[nodeIndex].makeSelectionVisible = false; + this.nodeComponentChildren.find(c => c.nodeTemplate.id === nodeId).makeSelectionVisible = false; let selectedNodeIndex; this.selectedNodes.some((node, index) => { if (node.id === nodeId) { @@ -2112,7 +2066,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI * @param nodeId */ private handleNodePressActions(nodeId: string): void { - this.nodeChildrenArray.forEach(node => { + this.nodeComponentChildren.forEach(node => { if (node.nodeTemplate.id === nodeId) { node.makeSelectionVisible = true; } else if (!this.arrayContainsNode(this.selectedNodes, node.nodeTemplate.id)) { @@ -2140,7 +2094,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI if (!this.arrayContainsNode(this.selectedNodes, nodeId)) { this.selectedNodes.push(this.getNodeByID(this.allNodeTemplates, nodeId)); this.newJsPlumbInstance.addToPosse(nodeId, 'dragSelection'); - this.nodeChildrenArray.forEach(node => { + this.nodeComponentChildren.forEach(node => { if (this.selectedNodes.find(selectedNode => selectedNode && selectedNode.id === node.nodeTemplate.id)) { if (node.makeSelectionVisible === false) { node.makeSelectionVisible = true; @@ -2308,7 +2262,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI if (this.matchType(reqDefinition.node, targetNodeType.qName, this.entityTypes.unGroupedNodeTypes) && this.matchType(reqDefinition.capability, capDefinition.capabilityType, this.entityTypes.capabilityTypes)) { const validSourceTypes: string[] = InheritanceUtils.getValidSourceTypes(capDefinition, this.entityTypes.capabilityTypes); - if (validSourceTypes) { + if (validSourceTypes && validSourceTypes.length) { if (validSourceTypes.some(e => this.matchType(e, sourceNodeType.qName, this.entityTypes.unGroupedNodeTypes))) { return true; } else { @@ -2386,7 +2340,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI } private layoutTopology() { - this.layoutDirective.layoutNodes(this.nodeChildrenArray, this.allRelationshipTemplates); + this.layoutDirective.layoutNodes(this.nodeComponentChildren.toArray(), this.allRelationshipTemplates); this.ngRedux.dispatch(this.topologyRendererActions.executeLayout()); } @@ -2401,7 +2355,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI if (rel.policies !== relationshipTemplate.policies) { const oldCon = this.newJsPlumbInstance.getAllConnections().find(jSPlumbConnection => jSPlumbConnection.id === relationshipTemplate.id); if (relationshipTemplate.policies && relationshipTemplate.policies.policy) { - let labelString = (isNullOrUndefined(relationshipTemplate.state) ? '' : relationshipTemplate.state + '
') + let labelString = (!relationshipTemplate.state ? '' : relationshipTemplate.state + '
') + relationshipTemplate.name; if (labelString.startsWith(this.backendService.configuration.relationshipPrefix)) { // Workaround to support old topology templates with the real name @@ -2421,7 +2375,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI const relationshipType = this.entityTypes.relationshipTypes.filter(rT => rT.qName === relationshipTemplate.type)[0]; if (oldCon) { - const border = isNullOrUndefined(relationshipTemplate.state) + const border = !relationshipTemplate.state ? '#fafafa' : VersionUtils.getElementColorByDiffState(relationshipTemplate.state); const me = this; // create new JsPlumb instance with updated attributes @@ -2473,7 +2427,7 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI this.notify.warning('Duplicate policy name!', 'Policy not Added!'); } else { const newPolicy = new TPolicy(policyName, undefined, this.selectedNewPolicyType, [], - [], {}, { kvproperties: {} }, []); + [], {}, { properties: {} }, []); const newPolicies = [...this.entityTypes.yamlPolicies, newPolicy]; this.ngRedux.dispatch(this.actions.changeYamlPolicies(newPolicies)); this.addYamlPolicyModal.hide(); @@ -2501,25 +2455,28 @@ export class CanvasComponent implements OnInit, OnDestroy, OnChanges, AfterViewI handleYamlPolicySelected($event: WineryRowData) { this.selectedYamlPolicy = this.entityTypes.yamlPolicies.find(policy => policy.name === ($event.row).name); - this.selectedYamlPolicy.properties = InheritanceUtils.getEffectiveKVPropertiesOfTemplateElement(this.selectedYamlPolicy.properties, + this.selectedYamlPolicy.properties = InheritanceUtils.getEffectivePropertiesOfTemplateElement(this.selectedYamlPolicy.properties, this.selectedYamlPolicy.policyType, this.entityTypes.policyTypes); } savePolicyProperties(): void { this.yamlPolicyProperties.forEach(txtArea => { const keyOfChangedTextArea = txtArea.nativeElement.parentElement.innerText.replace(/\s/g, ''); - this.selectedYamlPolicy.properties.kvproperties[keyOfChangedTextArea] = txtArea.nativeElement.value; + this.selectedYamlPolicy.properties.properties[keyOfChangedTextArea] = txtArea.nativeElement.value; }); } showPropertiesOfSelectedYamlPolicy(): boolean { - if (this.selectedYamlPolicy && this.selectedYamlPolicy.properties && this.selectedYamlPolicy.properties.kvproperties) { - return Object.keys(this.selectedYamlPolicy.properties.kvproperties).length > 0; + if (this.selectedYamlPolicy && this.selectedYamlPolicy.properties && this.selectedYamlPolicy.properties.properties) { + return Object.keys(this.selectedYamlPolicy.properties.properties).length > 0; } return false; } getYamlPoliciesTableData() { + if (!this.entityTypes.yamlPolicies) { + return []; + } return this.entityTypes.yamlPolicies.map(policy => { const result: { diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/entities-modal/entities-modal.component.css b/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/entities-modal/entities-modal.component.css index c634a64c24..24b06e5cde 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/entities-modal/entities-modal.component.css +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/entities-modal/entities-modal.component.css @@ -26,4 +26,8 @@ padding: 0; border: 0; vertical-align: baseline; + width: 100%; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; } diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/entities-modal/entities-modal.component.html b/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/entities-modal/entities-modal.component.html index 416567eb21..7c7eefefda 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/entities-modal/entities-modal.component.html +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/entities-modal/entities-modal.component.html @@ -263,12 +263,12 @@ -
@@ -281,7 +281,7 @@
-
+
diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/entities-modal/entities-modal.component.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/entities-modal/entities-modal.component.ts index 87515aba8a..d48a3cd3d4 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/entities-modal/entities-modal.component.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/entities-modal/entities-modal.component.ts @@ -27,11 +27,11 @@ import { ExistsService } from '../../services/exists.service'; import { ToastrService } from 'ngx-toastr'; import { DeploymentArtifactOrPolicyModalData, ModalVariant, ModalVariantAndState } from './modal-model'; import { EntitiesModalService, OpenModalEvent } from './entities-modal.service'; -import { QName } from '../../models/qname'; import { urlElement } from '../../models/enums'; import { TArtifact, TTopologyTemplate } from '../../models/ttopology-template'; import { WineryRepositoryConfigurationService } from '../../../../../tosca-management/src/app/wineryFeatureToggleModule/WineryRepositoryConfiguration.service'; import { Subscription } from 'rxjs'; +import { QName } from '../../../../../shared/src/app/model/qName'; @Component({ selector: 'winery-entities-modal', @@ -533,9 +533,15 @@ export class EntitiesModalComponent implements OnInit, OnChanges, OnDestroy { if (this.selectedYamlArtifactAllowedTypes.length > 0) { this.selectedYamlArtifactAllowedTypes += ','; } - this.selectedYamlArtifactAllowedTypes += selectedYamlArtifactType.mimeType; } + // in this case we only allow referencing the artifact as URL + if (selectedYamlArtifactType.qName === '{radon.artifacts}Repository') { + this.deploymentArtifactOrPolicyModalData.isRepositoryType = true; + this.deploymentArtifactOrPolicyModalData.isFileRemote = true; + } else { + this.deploymentArtifactOrPolicyModalData.isRepositoryType = false; + } } } } diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/entities-modal/modal-model.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/entities-modal/modal-model.ts index 017ce9dff2..6a9b3f5cf5 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/entities-modal/modal-model.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/canvas/entities-modal/modal-model.ts @@ -64,6 +64,8 @@ export class DeploymentArtifactOrPolicyModalData { public modalTargetLocation?: string, // yaml artifact provided as a reference public isFileRemote?: boolean, + // yaml artifact only as reference available + public isRepositoryType?: boolean, // file reference public selectedArtifactReference?: string ) { diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/edmmTransformationCheck/edmmTransformationCheck.service.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/edmmTransformationCheck/edmmTransformationCheck.service.ts index 0aef4e69a9..0a1effe5f2 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/edmmTransformationCheck/edmmTransformationCheck.service.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/edmmTransformationCheck/edmmTransformationCheck.service.ts @@ -17,6 +17,7 @@ import { Observable } from 'rxjs'; import { BackendService } from '../services/backend.service'; import { WineryRepositoryConfigurationService } from '../../../../tosca-management/src/app/wineryFeatureToggleModule/WineryRepositoryConfiguration.service'; import { TTopologyTemplate } from '../models/ttopology-template'; +import 'rxjs/add/operator/mergeMap'; export interface EdmmTechnologyTransformationCheck { id: string; diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/enricher/enricher.component.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/enricher/enricher.component.ts index b15b3cf53f..7e7d1cd232 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/enricher/enricher.component.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/enricher/enricher.component.ts @@ -11,7 +11,7 @@ * * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 *******************************************************************************/ -import { Component } from '@angular/core'; +import { Component, Input } from '@angular/core'; import { NgRedux } from '@angular-redux/store'; import { IWineryState } from '../redux/store/winery.store'; import { TopologyRendererActions } from '../redux/actions/topologyRenderer.actions'; @@ -24,6 +24,7 @@ import { TopologyTemplateUtil } from '../models/topologyTemplateUtil'; import { EnricherService } from './enricher.service'; import { Enrichment, FeatureEntity } from './enrichmentEntity'; import { WineryRepositoryConfigurationService } from '../../../../tosca-management/src/app/wineryFeatureToggleModule/WineryRepositoryConfiguration.service'; +import { EntityTypesModel } from '../models/entityTypesModel'; @Component({ selector: 'winery-enricher', @@ -32,6 +33,8 @@ import { WineryRepositoryConfigurationService } from '../../../../tosca-manageme }) export class EnricherComponent { + entityTypes: EntityTypesModel; + // enrichment object containing available features availableFeatures: Enrichment; // array to store enrichment to be applied @@ -45,6 +48,12 @@ export class EnricherComponent { private enricherService: EnricherService) { this.ngRedux.select(state => state.topologyRendererState) .subscribe(currentButtonsState => this.checkButtonsState(currentButtonsState)); + this.ngRedux.select(state => state.wineryState.entityTypes) + .subscribe(data => { + if (data) { + this.entityTypes = data; + } + }); } /** @@ -207,7 +216,7 @@ export class EnricherComponent { * @param data: topology template that was updated */ private enrichmentApplied(data: TTopologyTemplate) { - TopologyTemplateUtil.updateTopologyTemplate(this.ngRedux, this.wineryActions, data, this.configurationService.isYaml()); + TopologyTemplateUtil.updateTopologyTemplate(this.ngRedux, this.wineryActions, data, this.entityTypes, this.configurationService.isYaml()); // reset available features since they are no longer valid this.availableFeatures = null; this.alert.success('Updated Topology Template!'); diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/enricher/enricher.service.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/enricher/enricher.service.ts index 2dea79d58e..b0be617116 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/enricher/enricher.service.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/enricher/enricher.service.ts @@ -14,7 +14,6 @@ import { Injectable } from '@angular/core'; import { HttpClient, HttpHeaders } from '@angular/common/http'; import { BackendService } from '../services/backend.service'; -import { TopologyModelerConfiguration } from '../models/topologyModelerConfiguration'; import { Observable } from 'rxjs'; import { Enrichment } from './enrichmentEntity'; import { TTopologyTemplate } from '../models/ttopology-template'; @@ -24,12 +23,10 @@ import { TTopologyTemplate } from '../models/ttopology-template'; }) export class EnricherService { - private readonly configuration: TopologyModelerConfiguration; private readonly httpHeaders: HttpHeaders; constructor(private http: HttpClient, - backendService: BackendService) { - this.configuration = backendService.configuration; + private backendService: BackendService) { this.httpHeaders = new HttpHeaders().set('Accept', 'application/json'); } @@ -37,11 +34,11 @@ export class EnricherService { * This method fetches available enrichments/features for a topology template. */ getAvailableFeatures(): Observable { - const url = this.configuration.repositoryURL + const url = this.backendService.configuration.repositoryURL + '/servicetemplates/' - + encodeURIComponent(encodeURIComponent(this.configuration.ns)) + + encodeURIComponent(encodeURIComponent(this.backendService.configuration.ns)) + '/' - + encodeURIComponent(this.configuration.id) + + encodeURIComponent(this.backendService.configuration.id) + '/topologytemplate/availablefeatures'; return this.http.get(url, { headers: this.httpHeaders }); } @@ -51,12 +48,12 @@ export class EnricherService { * @param toApplyFeatures: Enrichment Object containing selected features for node templates. */ applySelectedFeatures(toApplyFeatures: Enrichment[]): Observable { - const url = this.configuration.repositoryURL + const url = this.backendService.configuration.repositoryURL + '/servicetemplates/' - + encodeURIComponent(encodeURIComponent(this.configuration.ns)) + + encodeURIComponent(encodeURIComponent(this.backendService.configuration.ns)) + '/' - + encodeURIComponent(this.configuration.id) - + '/topologytemplate/availablefeatures'; + + encodeURIComponent(this.backendService.configuration.id) + + '/topologytemplate/availablefeatures'; return this.http.put(url, toApplyFeatures, { headers: this.httpHeaders }); } } diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/enricher/enrichmentEntity.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/enricher/enrichmentEntity.ts index d7dddad0f7..fc851ed6be 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/enricher/enrichmentEntity.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/enricher/enrichmentEntity.ts @@ -11,7 +11,8 @@ * * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 *******************************************************************************/ -import { QName } from '../models/qname'; + +import { QName } from '../../../../shared/src/app/model/qName'; /** * Enrichment interface containing features of FeatureEntity type and a node template id. diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/group-view.component.css b/org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/group-view.component.css new file mode 100644 index 0000000000..f994424f24 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/group-view.component.css @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + *******************************************************************************/ + +.button-bar { + margin-bottom: 5px; +} + +.sidebar-root { + padding: 4px; +} + +.table { + margin-top: 5px; + margin-bottom: 10px; +} + +.table th { + font-size: 14px; + padding-top: 3px; + padding-bottom: 3px; +} + +.table td { + font-size: 16px; +} + +.btn-sm { + padding: 5px; + line-height: 1; +} + +.btn-sm i { + width: 14px; +} diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/group-view.component.html b/org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/group-view.component.html new file mode 100644 index 0000000000..73e1d7d59f --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/group-view.component.html @@ -0,0 +1,52 @@ + diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/group-view.component.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/group-view.component.ts new file mode 100644 index 0000000000..1bddcfec79 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/group-view.component.ts @@ -0,0 +1,75 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { IWineryState } from '../redux/store/winery.store'; +import { NgRedux } from '@angular-redux/store'; +import { TGroupDefinition } from '../models/ttopology-template'; +import { WineryActions } from '../redux/actions/winery.actions'; +import { DynamicTextData } from '../../../../tosca-management/src/app/wineryDynamicTable/formComponents/dynamicText.component'; +import { WineryDynamicTableMetadata } from '../../../../tosca-management/src/app/wineryDynamicTable/wineryDynamicTableMetadata'; +import { WineryDynamicFormModalComponent } from '../../../../tosca-management/src/app/wineryDynamicTable/modal/wineryDynamicFormModal.component'; + +@Component({ + selector: 'winery-group-view', + templateUrl: './group-view.component.html', + styleUrls: ['./group-view.component.css'] +}) +export class GroupViewComponent implements OnInit { + + showGroupView = false; + groups: TGroupDefinition[] = []; + formMetadata: Array = []; + + private expandedDefinitions: TGroupDefinition[] = []; + + @ViewChild('generatedModal') generatedModal: WineryDynamicFormModalComponent; + + constructor(private ngRedux: NgRedux, + private ngActions: WineryActions) { + this.ngRedux.select((state) => state.topologyRendererState.buttonsState.manageYamlGroupsButton) + .subscribe((showGroupView) => this.showGroupView = showGroupView); + this.ngRedux.select((state) => state.wineryState.currentJsonTopology) + .subscribe((topology) => this.groups = topology.groups); + } + + ngOnInit() { + this.formMetadata = [ + new DynamicTextData('name', 'Name', + 0, [], '', false, false, true), + new DynamicTextData('description', 'Description', + 1, [], '', false, false, true), + ]; + } + + addGroup() { + this.generatedModal.show({}); + } + + onSaveClicked(param: any) { + const newGroups = Object.assign([], this.groups); + newGroups.push(new TGroupDefinition(param.name, param.description, [])); + this.ngRedux.dispatch(this.ngActions.updateGroupDefinitions(newGroups)); + } + + removeGroup(definition: TGroupDefinition) { + const newGroups = Object.assign([], this.groups); + const index = newGroups.findIndex((d) => d.name === definition.name); + newGroups.splice(index, 1); + this.ngRedux.dispatch(this.ngActions.updateGroupDefinitions(newGroups)); + } + + isEmpty(): boolean { + return !this.groups || this.groups.length === 0; + } + + isCollapsed(definition: TGroupDefinition) { + return !this.expandedDefinitions.some((d) => d.name === definition.name); + } + + toggleCollapse(definition: TGroupDefinition) { + const index = this.expandedDefinitions.findIndex((d) => d.name === definition.name); + if (index >= 0) { + this.expandedDefinitions.splice(index, 1); + } else { + this.expandedDefinitions.push(definition); + } + } +} diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/policies/policies.component.css b/org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/policies/policies.component.css new file mode 100644 index 0000000000..dfe96cd702 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/policies/policies.component.css @@ -0,0 +1,23 @@ +/******************************************************************************* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + *******************************************************************************/ + +.table { + font-size: 12px; +} + +.table td, +.table th { + padding-top: 5px; + padding-bottom: 3px; +} diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/policies/policies.component.html b/org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/policies/policies.component.html new file mode 100644 index 0000000000..7fad07fc6e --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/policies/policies.component.html @@ -0,0 +1,46 @@ + + +
+ No policies defined for this Topology Template. +
+ + + + + + + + + + + + + + + + +
Policy NamePolicy TypeIs Active?
+
{{ policy.name }}
+ {{ policy.name }} +
+
{{ policy.policyType | localname }}
+ {{ policy.policyType | localname }} +
+
+ + +
+
diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/policies/policies.component.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/policies/policies.component.ts new file mode 100644 index 0000000000..4dcdd3d995 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/group-view/policies/policies.component.ts @@ -0,0 +1,66 @@ +/******************************************************************************** + * Copyright (c) 2017-2020 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + ********************************************************************************/ + +import { Component, Input, OnInit } from '@angular/core'; +import { TPolicy } from '../../models/policiesModalData'; +import { TGroupDefinition } from '../../models/ttopology-template'; +import { EntityTypesModel } from '../../models/entityTypesModel'; +import { NgRedux } from '@angular-redux/store'; +import { IWineryState } from '../../redux/store/winery.store'; + +@Component({ + selector: 'winery-group-view-policies', + templateUrl: './policies.component.html', + styleUrls: ['./policies.component.css'] +}) +export class GroupViewPoliciesComponent implements OnInit { + + @Input() definition: TGroupDefinition; + @Input() entityTypes: EntityTypesModel; + + policies: TPolicy[]; + + constructor(private ngRedux: NgRedux) { + } + + ngOnInit() { + this.ngRedux.select((state) => state.wineryState.currentJsonTopology.policies) + .subscribe((policies) => this.policies = policies.policy); + } + + isEmpty(): boolean { + return !this.policies || this.policies.length === 0; + } + + isEllipsisActive(cell): boolean { + return (cell.offsetWidth < cell.scrollWidth); + } + + isPolicyActive(policy: TPolicy): boolean { + return policy.targets && policy.targets.some((target) => target === this.definition.name); + } + + togglePolicy(policy: TPolicy) { + if (policy.targets) { + const index = policy.targets.indexOf(this.definition.name); + if (index >= 0) { + policy.targets.splice(index, 1); + } else { + policy.targets.push(this.definition.name); + } + } else { + policy.targets = [this.definition.name]; + } + } +} diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/InheritanceUtils.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/InheritanceUtils.ts index 92f1d995cc..39b303545a 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/InheritanceUtils.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/InheritanceUtils.ts @@ -16,7 +16,7 @@ import { EntityTypesModel } from './entityTypesModel'; import { CapabilityDefinitionModel } from './capabilityDefinitionModel'; import { RequirementDefinitionModel } from './requirementDefinitonModel'; import { EntityType, TPolicyType } from './ttopology-template'; -import { QName } from './qname'; +import { PropertyDefinitionType } from './enums'; export class InheritanceUtils { @@ -28,8 +28,8 @@ export class InheritanceUtils { return null; } - static getInheritanceAncestry(entityType: string, entityTypes: EntityType[]): EntityType[] { - const entity = entityTypes.find(type => type.qName === entityType); + static getInheritanceAncestry(entityType: string, entityTypes: T[]): T[] { + const entity = entityTypes.find(type => type.qName === entityType || type.id === entityType); const result = []; if (entity) { @@ -150,21 +150,26 @@ export class InheritanceUtils { return result; } - static getEffectiveKVPropertiesOfTemplateElement(templateElementProperties: any, typeQName: string, entityTypes: EntityType[]): any { + static getEffectivePropertiesOfTemplateElement(templateElementProperties: any, typeQName: string, entityTypes: EntityType[]): any { const defaultTypeProperties = this.getDefaultPropertiesFromEntityTypes(typeQName, entityTypes); const result = {}; - if (defaultTypeProperties && defaultTypeProperties.kvproperties) { - Object.keys(defaultTypeProperties.kvproperties).forEach(currentPropKey => { - - if (templateElementProperties && templateElementProperties.kvproperties && - Object.keys(templateElementProperties.kvproperties).some(tempPropertyKey => tempPropertyKey === currentPropKey)) { - result[currentPropKey] = templateElementProperties.kvproperties[currentPropKey]; - } else { - result[currentPropKey] = defaultTypeProperties.kvproperties[currentPropKey]; - } - }); + if (!defaultTypeProperties) { + console.log('Could not find default type properties for type ' + typeQName); + return { propertyType: PropertyDefinitionType.NONE }; + } + if (defaultTypeProperties.propertyType === PropertyDefinitionType.KV) { + Object.assign(result, defaultTypeProperties.kvproperties); + } + if (defaultTypeProperties.propertyType === PropertyDefinitionType.YAML) { + Object.assign(result, defaultTypeProperties.properties); } - return { kvproperties: result }; + // overwrite defaults from the entity type with the properties of the element + if (templateElementProperties && templateElementProperties.properties) { + Object.assign(result, templateElementProperties.properties); + } + // FIXME: because this method is only used for Yaml Policies this forced mapping to YAML-properties is doable + // This is highly likely to break for anything beyond that specific usecase! + return { propertyType: PropertyDefinitionType.YAML, properties: result }; } /** @@ -174,7 +179,7 @@ export class InheritanceUtils { */ static getKVProperties(type: any): any { const newKVProperies = {}; - const kvProperties = type.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].any[0].propertyDefinitionKVList; + const kvProperties = type.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].propertiesDefinition.propertyDefinitionKVList; for (const obj of kvProperties) { const key = obj.key; let value; @@ -192,12 +197,33 @@ export class InheritanceUtils { static hasKVPropDefinition(element: EntityType): boolean { return (element && element.full && - element.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].any && - element.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].any.length > 0 && - element.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].any[0].propertyDefinitionKVList + element.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].propertiesDefinition && + element.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].propertiesDefinition.propertyDefinitionKVList && + element.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].propertiesDefinition.propertyDefinitionKVList.length > 0 ); } + static hasYamlPropDefinition(element: EntityType): boolean { + return (element && element.full && + element.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].propertiesDefinition && + element.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].propertiesDefinition.properties + ); + } + + static getYamlProperties(type: EntityType): any { + const newProperties = {}; + const definedProperties = type.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].propertiesDefinition.properties; + for (const obj of definedProperties) { + // set default value, regardless of whether the property is required + try { + newProperties[obj.name] = JSON.parse(obj.defaultValue); + } catch (e) { + newProperties[obj.name] = obj.defaultValue; + } + } + return newProperties; + } + /** * Generates default properties from node types or relationshipTypes * The assumption appears to be that types only add new properties and never change existing ones (e.g., change type or default value) @@ -211,11 +237,54 @@ export class InheritanceUtils { for (const element of entities) { if (element.qName === qName) { // if propertiesDefinition is defined it's a XML property + // FIXME this needs to correctly handle the type option for defining XML properties if (element.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].propertiesDefinition && element.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].propertiesDefinition.element) { return { + propertyType: PropertyDefinitionType.XML, any: element.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].propertiesDefinition.element }; + // properties definition contains yaml properties + } else if (element.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].propertiesDefinition + && element.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].propertiesDefinition.properties) { + let inheritedProperties = {}; + if (InheritanceUtils.hasParentType(element)) { + let parent = element.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].derivedFrom.typeRef; + let continueFlag; + + while (parent) { + continueFlag = false; + for (const parentElement of entities) { + if (parentElement.qName === parent) { + if (InheritanceUtils.hasYamlPropDefinition(parentElement)) { + inheritedProperties = { + ...inheritedProperties, ...InheritanceUtils.getYamlProperties(parentElement) + }; + } + if (InheritanceUtils.hasParentType(parentElement)) { + parent = parentElement.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].derivedFrom.typeRef; + continueFlag = true; + } + break; + } + } + if (!continueFlag) { + break; + } + } + } + + let typeProperties = {}; + if (InheritanceUtils.hasYamlPropDefinition(element)) { + typeProperties = InheritanceUtils.getYamlProperties(element); + } + + const mergedProperties = { ...inheritedProperties, ...typeProperties }; + + return { + propertyType: PropertyDefinitionType.YAML, + properties: { ...mergedProperties } + }; } else { // otherwise KV properties or no properties at all let inheritedProperties = {}; if (InheritanceUtils.hasParentType(element)) { @@ -253,6 +322,7 @@ export class InheritanceUtils { const mergedProperties = { ...inheritedProperties, ...typeProperties }; return { + propertyType: PropertyDefinitionType.KV, kvproperties: { ...mergedProperties } }; } @@ -270,16 +340,17 @@ export class InheritanceUtils { * @param capabilityTypes The list of all Capability Types */ static getValidSourceTypes(capabilityDefinition: CapabilityDefinitionModel, capabilityTypes: EntityType[]): string[] { - if (capabilityDefinition.validSourceTypes) { + if (capabilityDefinition.validSourceTypes && capabilityDefinition.validSourceTypes.length) { return capabilityDefinition.validSourceTypes; } else { const ancestry: EntityType[] = InheritanceUtils.getInheritanceAncestry(capabilityDefinition.capabilityType, capabilityTypes); for (const ancestor of ancestry) { const listOfValidSourceTypes = ancestor.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].validNodeTypes; - if (listOfValidSourceTypes) { + if (listOfValidSourceTypes && listOfValidSourceTypes.length) { return listOfValidSourceTypes; } } } + return []; } } diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/UpdateInfo.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/UpdateInfo.ts index de4f2fcbbd..94264c3bec 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/UpdateInfo.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/UpdateInfo.ts @@ -11,13 +11,16 @@ * * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 ********************************************************************************/ +import { TTopologyTemplate } from './ttopology-template'; + export class UpdateInfo { constructor(public nodeTemplateId: string, public newComponentType: string, public propertyMatchingList?: PropertyMatching[], public newList?: string[], public resolvedList?: string[], - public saveAfterUpdate = false) { + public saveAfterUpdate = false, + public topologyTemplate?: TTopologyTemplate) { } } diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/entityTypesModel.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/entityTypesModel.ts index 4a57219283..b0060a716c 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/entityTypesModel.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/entityTypesModel.ts @@ -12,7 +12,7 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 ********************************************************************************/ -import { Entity, EntityType, TArtifactType, TPolicyType, TTopologyTemplate, VisualEntityType } from './ttopology-template'; +import { Entity, EntityType, TArtifactType, TDataType, TPolicyType, TTopologyTemplate, VisualEntityType } from './ttopology-template'; import { TopologyModelerConfiguration } from './topologyModelerConfiguration'; import { VersionElement } from './versionElement'; import { Visuals } from './visuals'; @@ -22,6 +22,7 @@ import { GroupedNodeTypeModel } from './groupedNodeTypeModel'; /** * Internal representation of entity Types */ +// TODO reconsider bundling the visuals with the entity types export class EntityTypesModel { artifactTemplates: any; artifactTypes: TArtifactType[]; @@ -38,6 +39,7 @@ export class EntityTypesModel { requirementTypes: EntityType[]; unGroupedNodeTypes: EntityType[]; yamlPolicies: TPolicy[]; + dataTypes: TDataType[]; } /** diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/enums.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/enums.ts index a757757878..75ca257d5e 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/enums.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/enums.ts @@ -54,5 +54,6 @@ export enum toggleModalType { export enum PropertyDefinitionType { NONE = 'NONE', KV = 'KV', - XML = 'XML' + XML = 'XML', + YAML = 'YAML', } diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/threatModelingModalData.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/threatModelingModalData.ts index 866c90905a..81f051e590 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/threatModelingModalData.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/threatModelingModalData.ts @@ -11,8 +11,8 @@ * * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 ********************************************************************************/ -import { QName } from './qname'; import { ThreatCreation } from './threatCreation'; +import { QName } from '../../../../shared/src/app/model/qName'; /** * Encompasses the threat modelling data defined by the user when using the modal diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/topologyModelerConfiguration.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/topologyModelerConfiguration.ts index 0347b08d64..cc1a6561c9 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/topologyModelerConfiguration.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/topologyModelerConfiguration.ts @@ -11,7 +11,7 @@ * * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 *******************************************************************************/ -import { QName } from './qname'; +import { QName } from '../../../../shared/src/app/model/qName'; export class TopologyModelerConfiguration { diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/topologyTemplateUtil.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/topologyTemplateUtil.ts index e210d2e5d9..693ac0b796 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/topologyTemplateUtil.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/topologyTemplateUtil.ts @@ -12,7 +12,6 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 ********************************************************************************/ import { TNodeTemplate, TRelationshipTemplate, TTopologyTemplate } from './ttopology-template'; -import { QName } from './qname'; import { DifferenceStates, ToscaDiff, VersionUtils } from './ToscaDiff'; import { Visuals } from './visuals'; import { NgRedux } from '@angular-redux/store'; @@ -24,12 +23,44 @@ import { CapabilityModel } from './capabilityModel'; import { RequirementDefinitionModel } from './requirementDefinitonModel'; import { RequirementModel } from './requirementModel'; import { InheritanceUtils } from './InheritanceUtils'; +import { QName } from '../../../../shared/src/app/model/qName'; +import { TPolicy } from './policiesModalData'; -export class TopologyTemplateUtil { +export abstract class TopologyTemplateUtil { static HORIZONTAL_OFFSET_FOR_NODES_WITHOUT_COORDINATES = 350; static VERTICAL_OFFSET_FOR_NODES_WITHOUT_COORDINATES = 200; + static prepareSave(topologyTemplate: TTopologyTemplate): TTopologyTemplate { + // Initialization + const topologySkeleton = { + documentation: [], + any: [], + otherAttributes: {}, + relationshipTemplates: [], + nodeTemplates: [], + policies: { policy: new Array() }, + groups: [], + participants: [], + }; + // Prepare for saving by updating the existing topology with the current topology state inside the Redux store + topologySkeleton.nodeTemplates = topologyTemplate.nodeTemplates; + topologySkeleton.relationshipTemplates = topologyTemplate.relationshipTemplates; + topologySkeleton.relationshipTemplates.map(relationship => { + delete relationship.state; + }); + // remove the 'Color' field from all nodeTemplates as the REST Api does not recognize it. + topologySkeleton.nodeTemplates.map(nodeTemplate => { + delete nodeTemplate.visuals; + delete nodeTemplate._state; + }); + topologySkeleton.policies = topologyTemplate.policies; + topologySkeleton.groups = topologyTemplate.groups; + topologySkeleton.participants = topologyTemplate.participants; + + return topologySkeleton; + } + static createTNodeTemplateFromObject(node: TNodeTemplate, nodeVisuals: Visuals[], isYaml: boolean, types: EntityTypesModel, state?: DifferenceStates): TNodeTemplate { const nodeVisualsObject = this.getNodeVisualsForNodeTemplate(node.type, nodeVisuals, state); @@ -37,11 +68,11 @@ export class TopologyTemplateUtil { if (node.properties) { properties = node.properties; } - let nameSpace: string; let targetLocationKey: string; let providerKey: string; let regionKey: string; + let participantKey: string; let otherAttributes; for (const key in node.otherAttributes) { if (node.otherAttributes.hasOwnProperty(key)) { @@ -56,10 +87,14 @@ export class TopologyTemplateUtil { if (key.substring(key.indexOf('}') + 1) === 'region') { regionKey = key; } + if (key.substring(key.indexOf('}') + 1) === 'participant') { + participantKey = key; + } otherAttributes = { [nameSpace + 'location']: node.otherAttributes[targetLocationKey], [nameSpace + 'provider']: node.otherAttributes[providerKey], [nameSpace + 'region']: node.otherAttributes[regionKey], + [nameSpace + 'participant']: node.otherAttributes[participantKey], [nameSpace + 'x']: node.x, [nameSpace + 'y']: node.y }; @@ -239,22 +274,24 @@ export class TopologyTemplateUtil { return relationshipTemplates; } - static updateTopologyTemplate(ngRedux: NgRedux, wineryActions: WineryActions, topology: TTopologyTemplate, isYaml: boolean) { + static updateTopologyTemplate(ngRedux: NgRedux, wineryActions: WineryActions, topology: TTopologyTemplate, + types: EntityTypesModel, isYaml: boolean) { const wineryState = ngRedux.getState().wineryState; // Required because if the palette is open, the last node inserted will be bound to the mouse movement. ngRedux.dispatch(wineryActions.sendPaletteOpened(false)); - wineryState.currentJsonTopology.nodeTemplates - .forEach( - node => ngRedux.dispatch(wineryActions.deleteNodeTemplate(node.id)) - ); + // It's important to remove the relations first, as the YAML mode may break. wineryState.currentJsonTopology.relationshipTemplates .forEach( relationship => ngRedux.dispatch(wineryActions.deleteRelationshipTemplate(relationship.id)) ); + wineryState.currentJsonTopology.nodeTemplates + .forEach( + node => ngRedux.dispatch(wineryActions.deleteNodeTemplate(node.id)) + ); - TopologyTemplateUtil.initNodeTemplates(topology.nodeTemplates, wineryState.nodeVisuals, isYaml, null) + TopologyTemplateUtil.initNodeTemplates(topology.nodeTemplates, wineryState.nodeVisuals, isYaml, types) .forEach( node => ngRedux.dispatch(wineryActions.saveNodeTemplate(node)) ); diff --git a/org.eclipse.winery.frontends/app/tosca-management/src/app/model/qName.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/toscaUtils.ts similarity index 58% rename from org.eclipse.winery.frontends/app/tosca-management/src/app/model/qName.ts rename to org.eclipse.winery.frontends/app/topologymodeler/src/app/models/toscaUtils.ts index e24335d587..a54e723808 100644 --- a/org.eclipse.winery.frontends/app/tosca-management/src/app/model/qName.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/toscaUtils.ts @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2018 Contributors to the Eclipse Foundation + * Copyright (c) 2020 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -12,23 +12,11 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 *******************************************************************************/ -export class QName { - - public static stringToQName(name: string): QName { - - const regex = /\{(.*?)\}(.*)/g; - const res = regex.exec(name); - - if (res.length !== 3) { - throw new Error(); +export class ToscaUtils { + static getDefinition(definitionsChild: {full?: { serviceTemplateOrNodeTypeOrNodeTypeImplementation: any[] }}): any { + if (!definitionsChild.full) { + return null; } - - return { - namespace: res[1], - localPart: res[2] - }; - } - - constructor(public namespace: string, public localPart: string) { + return definitionsChild.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0]; } } diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/ttopology-template.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/ttopology-template.ts index 67e23edc90..f8ddfa803a 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/ttopology-template.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/models/ttopology-template.ts @@ -16,6 +16,7 @@ import { Visuals } from './visuals'; import { TPolicy } from './policiesModalData'; import { Interface } from '../../../../tosca-management/src/app/model/interfaces'; import { PropertiesDefinition } from '../../../../tosca-management/src/app/instance/sharedComponents/propertiesDefinition/propertiesDefinitionsResourceApiData'; +import { Constraint } from '../../../../tosca-management/src/app/model/constraint'; export class AbstractTEntity { constructor(public documentation?: any, @@ -24,6 +25,24 @@ export class AbstractTEntity { } } +export class TGroupDefinition extends AbstractTEntity { + + constructor(public name: string, + public description: string, + public members: string[], + public properties?: any, + documentation?: any, + any?: any, + otherAttributes?: any) { + super(documentation, any, otherAttributes); + } +} + +export interface OTParticipant { + name: string; + url: string; +} + /** * This is the datamodel for node Templates and relationship templates */ @@ -31,6 +50,8 @@ export class TTopologyTemplate extends AbstractTEntity { nodeTemplates: Array = []; relationshipTemplates: Array = []; policies: { policy: Array }; + groups: Array = []; + participants: Array = []; } /** @@ -62,7 +83,7 @@ export class TNodeTemplate extends AbstractTEntity { /** * needed for the winery redux reducer, * updates a specific attribute and returns a whole new node template - * @param indexOfUpdatedAttribute: index of the to be updated attribute in the constructor + * @param updatedAttribute: index of the to be updated attribute in the constructor * @param updatedValue: the new value * * @return nodeTemplate: a new node template with the updated value @@ -98,17 +119,29 @@ export class TNodeTemplate extends AbstractTEntity { }; nodeTemplate.otherAttributes = otherAttributes; } - console.log(nodeTemplate); } else if (updatedAttribute === ('minInstances') || updatedAttribute === ('maxInstances')) { if (Number.isNaN(+updatedValue)) { nodeTemplate[updatedAttribute] = updatedValue; } else { nodeTemplate[updatedAttribute] = +updatedValue; } + } else if (updatedAttribute === 'participant') { + let nameSpace: string; + for (const key in nodeTemplate.otherAttributes) { + if (nodeTemplate.otherAttributes.hasOwnProperty(key)) { + nameSpace = key.substring(key.indexOf('{'), key.indexOf('}') + 1); + if (updatedValue.length === 0) { + delete nodeTemplate.otherAttributes[nameSpace + 'participant']; + break; + } + if (nameSpace) { + nodeTemplate.otherAttributes[nameSpace + 'participant'] = updatedValue; + break; + } + } + } } else { - console.log(updatedValue); nodeTemplate[updatedAttribute] = updatedValue; - console.log(nodeTemplate); } return nodeTemplate; } @@ -180,6 +213,29 @@ export class TPolicyType extends EntityType { } } +export class TDataType extends EntityType { + constructor(id: string, + qName: string, + name: string, + namespace: string, + properties: any, + public full: any, + public constraints: Constraint[] = [], + public keySchema: SchemaDefinition = undefined, + public entrySchema: SchemaDefinition = undefined) { + super(id, qName, name, namespace, properties, full); + } +} + +export class SchemaDefinition { + constructor(public type: string, + public description: string = '', + public constraints: Constraint[] = [], + public keySchema: SchemaDefinition = undefined, + public entrySchema: SchemaDefinition = undefined) { + } +} + export class TArtifactType extends EntityType { constructor(id: string, qName: string, @@ -244,7 +300,7 @@ export class TArtifact extends AbstractTEntity { export class TNodeType extends AbstractTEntity { constructor(public name: string, - public interfaces: { interfaces: Interface[]}, + public interfaces: { interfaces: Interface[] }, public propertiesDefinition: PropertiesDefinition, public derivedFrom: any, documentation?: any, diff --git a/org.eclipse.winery.model.tosca.yaml/src/test/java/.gitkeep b/org.eclipse.winery.frontends/app/topologymodeler/src/app/multi-participants/multi-participants.component.css similarity index 100% rename from org.eclipse.winery.model.tosca.yaml/src/test/java/.gitkeep rename to org.eclipse.winery.frontends/app/topologymodeler/src/app/multi-participants/multi-participants.component.css diff --git a/org.eclipse.winery.model.tosca/src/test/java/.gitkeep b/org.eclipse.winery.frontends/app/topologymodeler/src/app/multi-participants/multi-participants.component.html similarity index 100% rename from org.eclipse.winery.model.tosca/src/test/java/.gitkeep rename to org.eclipse.winery.frontends/app/topologymodeler/src/app/multi-participants/multi-participants.component.html diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/multi-participants/multi-participants.component.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/multi-participants/multi-participants.component.ts new file mode 100644 index 0000000000..ccc3b59f25 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/multi-participants/multi-participants.component.ts @@ -0,0 +1,102 @@ +import { Component, OnInit } from '@angular/core'; +import { NgRedux } from '@angular-redux/store'; +import { IWineryState } from '../redux/store/winery.store'; +import { TopologyRendererActions } from '../redux/actions/topologyRenderer.actions'; +import { WineryActions } from '../redux/actions/winery.actions'; +import { ToastrService } from 'ngx-toastr'; +import { MultiParticipantsService } from '../services/multi-participants.service'; +import { TopologyRendererState } from '../redux/reducers/topologyRenderer.reducer'; +import { WineryRepositoryConfigurationService } from '../../../../tosca-management/src/app/wineryFeatureToggleModule/WineryRepositoryConfiguration.service'; +import { backendBaseURL } from '../../../../tosca-management/src/app/configuration'; +import { TopologyModelerConfiguration } from '../models/topologyModelerConfiguration'; +import { BackendService } from '../services/backend.service'; +import { ErrorHandlerService } from '../services/error-handler.service'; + +@Component({ + selector: 'winery-multi-participants', + providers: [MultiParticipantsService], + templateUrl: './multi-participants.component.html', + styleUrls: ['./multi-participants.component.css'] +}) +export class MultiParticipantsComponent implements OnInit { + + readonly uiURL = encodeURIComponent(window.location.origin + window.location.pathname + '#/'); + private editorConfiguration; + + constructor(private ngRedux: NgRedux, + private actions: TopologyRendererActions, + private wineryActions: WineryActions, + private alert: ToastrService, + private errorHandlerService: ErrorHandlerService, + private multiParticipantsService: MultiParticipantsService, + private wineryConfigurationService: WineryRepositoryConfigurationService, + private backendService: BackendService) { + this.ngRedux.select(state => state.topologyRendererState).subscribe( + currentButtonState => this.checkButtonsState(currentButtonState) + ); + } + + private checkButtonsState(currentButtonsState: TopologyRendererState) { + // check if Generate Placeholder Button is clicked + if (currentButtonsState.buttonsState.generateGDM) { + this.multiParticipantsService.postNewVersion().subscribe( + newVersion => { + this.alert.success('Successfully created placeholders for tolopgy template'); + this.ngRedux.dispatch(this.actions.generatePlaceholder()); + const editorConfig = '?repositoryURL=' + this.backendService.configuration.repositoryURL + + '&uiURL=' + encodeURIComponent(backendBaseURL) + + '&ns=' + newVersion.namespace + + '&id=' + newVersion.localname; + this.editorConfiguration = editorConfig; + this.multiParticipantsService.postPlaceholders(newVersion.localname).subscribe( + placeholderResponse => { + window.open(this.wineryConfigurationService.configuration.endpoints.topologymodeler + this.editorConfiguration); + }, + error => { + window.open(this.wineryConfigurationService.configuration.endpoints.topologymodeler + this.editorConfiguration); + } + ); + }, + error => { + this.errorHandlerService.handleError(error); + } + ); + } else if (currentButtonsState.buttonsState.generatePlaceholderSubs) { + this.multiParticipantsService.postSubstituteVersion().subscribe( + placeholderSubstitution => { + this.ngRedux.dispatch(this.actions.generatePlaceholderSubs()); + const editorConfig = '?repositoryURL=' + this.backendService.configuration.repositoryURL + + '&uiURL=' + encodeURIComponent(backendBaseURL) + + '&ns=' + placeholderSubstitution.namespace + + '&id=' + placeholderSubstitution.localname; + this.alert.success('Successfully substituted placeholder for topology'); + window.open(this.wineryConfigurationService.configuration.endpoints.topologymodeler + editorConfig); + }, + error => { + this.errorHandlerService.handleError(error); + } + ); + } else if (currentButtonsState.buttonsState.extractLDM) { + this.multiParticipantsService.postParticipantsVersion().subscribe( + participantVersions => { + this.ngRedux.dispatch(this.actions.extractLDM()); + this.alert.success('Successfully extracted partner LDM'); + for (const participantVersion of participantVersions) { + const editorConfiguration = '?repositoryURL=' + this.backendService.configuration.repositoryURL + + '&uiURL=' + encodeURIComponent(backendBaseURL) + + '&ns=' + participantVersion.entity.namespace + + '&id=' + participantVersion.entity.localname; + window.open(this.wineryConfigurationService.configuration.endpoints.topologymodeler + editorConfiguration); + } + }, + error => { + this.errorHandlerService.handleError(error); + } + ); + } + } + + ngOnInit() { + } + +} diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/navbar/navbar.component.html b/org.eclipse.winery.frontends/app/topologymodeler/src/app/navbar/navbar.component.html index 29e81b4dd6..e5d674a985 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/navbar/navbar.component.html +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/navbar/navbar.component.html @@ -26,34 +26,30 @@

winery

- - - -
@@ -67,44 +63,46 @@

winery

[style.background-color]="getStyle(navbarButtonsState.buttonsState.idsButton)"> Ids - - - - - +
- - -
-
-
+
-
-
-
@@ -216,6 +207,19 @@

winery

+
+ + +
+
+
+ +
+
+ +
+ + +
+
- diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/navbar/navbar.component.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/navbar/navbar.component.ts index 31aa79adaa..96a485ae41 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/navbar/navbar.component.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/navbar/navbar.component.ts @@ -28,6 +28,7 @@ import { FeatureEnum } from '../../../../tosca-management/src/app/wineryFeatureT import { WineryRepositoryConfigurationService } from '../../../../tosca-management/src/app/wineryFeatureToggleModule/WineryRepositoryConfiguration.service'; import { TTopologyTemplate } from '../models/ttopology-template'; import { VersionSliderService } from '../version-slider/version-slider.service'; +import { CheService } from '../services/che.service'; /** * The navbar of the topologymodeler. @@ -74,7 +75,8 @@ export class NavbarComponent implements OnDestroy { private statefulService: StatefulAnnotationsService, private hotkeysService: HotkeysService, private versionSliderService: VersionSliderService, - public configurationService: WineryRepositoryConfigurationService) { + public configurationService: WineryRepositoryConfigurationService, + private che: CheService) { this.subscriptions.push(ngRedux.select(state => state.topologyRendererState) .subscribe(newButtonsState => this.setButtonsState(newButtonsState))); this.subscriptions.push(ngRedux.select(currentState => currentState.wineryState.currentJsonTopology) @@ -208,7 +210,7 @@ export class NavbarComponent implements OnDestroy { this.matchingOngoing = true; break; } - case 'problemdetection': { + case 'problemDetection': { this.ngRedux.dispatch(this.actions.detectProblems()); break; } @@ -234,6 +236,15 @@ export class NavbarComponent implements OnDestroy { this.ngRedux.dispatch(this.wineryActions.sendPaletteOpened(false)); this.ngRedux.dispatch(this.actions.addTestRefinements()); break; + case 'generateGDM': + this.ngRedux.dispatch(this.actions.generatePlaceholder()); + break; + case 'extractLDM': + this.ngRedux.dispatch(this.actions.extractLDM()); + break; + case 'generatePlaceholderSubs': + this.ngRedux.dispatch(this.actions.generatePlaceholderSubs()); + break; case 'determineStatefulComponents': this.ngRedux.dispatch(this.actions.determineStatefulComponents()); break; @@ -255,6 +266,18 @@ export class NavbarComponent implements OnDestroy { this.ngRedux.dispatch(this.wineryActions.sendPaletteOpened(false)); this.ngRedux.dispatch(this.actions.toggleVersionSlider()); break; + case 'manageYamlGroups': + this.ngRedux.dispatch(this.actions.toggleManageYamlGroups()); + break; + case 'yamlGroups': + this.ngRedux.dispatch(this.actions.toggleYamlGroups()); + break; + case 'manageParticipants': + this.ngRedux.dispatch(this.actions.toggleManageParticipants()); + break; + case 'assignParticipants': + this.ngRedux.dispatch(this.actions.toggleAssignParticipants()); + break; } } @@ -282,4 +305,13 @@ export class NavbarComponent implements OnDestroy { openManagementUi() { window.open(this.backendService.serviceTemplateUiUrl, '_blank'); } + + openChe() { + this.che.openChe( + this.backendService.configuration.repositoryURL, + this.backendService.configuration.id, + this.backendService.configuration.ns, + 'servicetemplates' + ); + } } diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/groups/groups.component.css b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/groups/groups.component.css new file mode 100644 index 0000000000..6ca883cb55 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/groups/groups.component.css @@ -0,0 +1,52 @@ +/******************************************************************************** + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + ********************************************************************************/ +table { + width: 210px; + table-layout: fixed; + border: 1px solid #ddd; +} + +th { + background-color: #cfd8dc; + color: #000; + text-align: left; +} + +th, +td { + border-top: 0; + border-left: 0; + border-right: 0; + border-bottom: 1px solid #ddd; + padding-left: 2px; +} + +tr { + cursor: pointer; +} + +tr:nth-child(even) { + background-color: #f2f2f2; +} + +.table-td div { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + position: relative; + width: auto; + max-width: 100%; + -webkit-transition: max-width linear 1ms; + transition: max-width linear 1ms; +} diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/groups/groups.component.html b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/groups/groups.component.html new file mode 100644 index 0000000000..cf378a4df1 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/groups/groups.component.html @@ -0,0 +1,48 @@ + + +
+ No groups defined
for this Topology Template.
+
+ + + + + + + + + + + + + + +
NameIs Member?
+
{{ definition.name }}
+ {{ definition.name }} +
+
+ + +
+
+ +
+
+ Add new Group +
+
diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/groups/groups.component.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/groups/groups.component.ts new file mode 100644 index 0000000000..2ae3d57234 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/groups/groups.component.ts @@ -0,0 +1,67 @@ +/******************************************************************************** + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + ********************************************************************************/ + +import { Component, Input, OnInit } from '@angular/core'; +import { TGroupDefinition, TNodeTemplate } from '../../models/ttopology-template'; +import { NgRedux } from '@angular-redux/store'; +import { IWineryState } from '../../redux/store/winery.store'; +import { TopologyRendererActions } from '../../redux/actions/topologyRenderer.actions'; + +@Component({ + selector: 'winery-groups', + templateUrl: './groups.component.html', + styleUrls: ['./groups.component.css'] +}) +export class GroupsComponent implements OnInit { + + @Input() readonly: boolean; + @Input() groups: TGroupDefinition[]; + @Input() node: TNodeTemplate; + + constructor(private ngRedux: NgRedux, + private rendererActions: TopologyRendererActions) { + } + + ngOnInit() { + } + + manageYamlGroups() { + this.ngRedux.dispatch(this.rendererActions.showManageYamlGroups()); + } + + isEllipsisActive(cell): boolean { + return (cell.offsetWidth < cell.scrollWidth); + } + + isNodeMemberOfGroup(group: TGroupDefinition) { + return group.members && group.members.some((m) => m === this.node.id); + } + + toggleGroupMembership(group: TGroupDefinition) { + if (group.members) { + const index = group.members.indexOf(this.node.id); + if (index >= 0) { + group.members.splice(index, 1); + } else { + group.members.push(this.node.id); + } + } else { + group.members = [this.node.id]; + } + } + + isEmpty(): boolean { + return !this.groups || this.groups.length === 0; + } +} diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/node.component.css b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/node.component.css index 8b10d3e808..543a5129d1 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/node.component.css +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/node.component.css @@ -45,13 +45,25 @@ div.pattern { .patternImage { margin-top: 10px; margin-left: 3px; + max-width: 50px; + max-height: 50px; +} + +.winery-image { + height: 50px; + position: relative; } -img { +.winery-image img { max-width: 50px; max-height: 50px; margin-top: 0.1em; border-radius: 10%; + position: absolute; + top: 50%; + left: 50%; + margin-right: -50%; + transform: translate(-50%, -50%); } .padding-top--2px { diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/node.component.html b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/node.component.html index d7dc70af1a..63fa55e199 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/node.component.html +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/node.component.html @@ -38,7 +38,7 @@ + [nodeType]="nodeTemplate.type" [entityTypes]="entityTypes">
-
+
@@ -135,22 +135,19 @@ + class="card-header-node-accordions" + #propertiesgroup + panelClass="accordionGroupPanel" + *ngIf="navbarButtonsState.buttonsState.propertiesButton">
Properties
- +
@@ -167,13 +164,13 @@ >
+ [deploymentArtifacts]="nodeTemplate.deploymentArtifacts?.deploymentArtifact" + [yamlArtifacts]="nodeTemplate.artifacts?.artifact"> @@ -190,10 +187,10 @@ >
@@ -212,14 +209,45 @@ > + + +
+ Groups + + +
+ + +
+ + + +
+ Participants + + +
+ + +
+ diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/node.component.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/node.component.ts index 9af0562c6a..1a5b05f5a7 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/node.component.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/node.component.ts @@ -13,14 +13,14 @@ ********************************************************************************/ import { - AfterViewInit, Component, ComponentRef, DoCheck, ElementRef, EventEmitter, Input, KeyValueDiffers, NgZone, OnDestroy, OnInit, Output, Renderer2, ViewChild + AfterViewInit, Component, ComponentRef, DoCheck, ElementRef, EventEmitter, Input, KeyValueDiffers, NgZone, + OnDestroy, OnInit, Output, Renderer2, ViewChild } from '@angular/core'; import { animate, keyframes, state, style, transition, trigger } from '@angular/animations'; import { NgRedux } from '@angular-redux/store'; import { IWineryState } from '../redux/store/winery.store'; import { WineryActions } from '../redux/actions/winery.actions'; -import { EntityType, TNodeTemplate } from '../models/ttopology-template'; -import { QName } from '../models/qname'; +import { EntityType, OTParticipant, TGroupDefinition, TNodeTemplate } from '../models/ttopology-template'; import { PropertyDefinitionType, urlElement } from '../models/enums'; import { BackendService } from '../services/backend.service'; import { GroupedNodeTypeModel } from '../models/groupedNodeTypeModel'; @@ -36,6 +36,7 @@ import { FeatureEnum } from '../../../../tosca-management/src/app/wineryFeatureT import { WineryRepositoryConfigurationService } from '../../../../tosca-management/src/app/wineryFeatureToggleModule/WineryRepositoryConfiguration.service'; import { Subscription } from 'rxjs'; import { InheritanceUtils } from '../models/InheritanceUtils'; +import { QName } from '../../../../shared/src/app/model/qName'; /** * Every node has its own component and gets created dynamically. @@ -72,12 +73,14 @@ export class NodeComponent implements OnInit, AfterViewInit, OnDestroy, DoCheck policyTemplates: any; artifactTypes: any; removeZIndex: any; - propertyDefinitionType: string; + propertyDefinitionType: PropertyDefinitionType; policyIcons: string[]; configEnum = FeatureEnum; policiesOfNode: TPolicy[]; private policyChangeSubscription: Subscription; private artifactsChangedSubscription: Subscription; + groupDefinitions: TGroupDefinition[]; + participants: OTParticipant[]; @Input() readonly: boolean; @Input() entityTypes: EntityTypesModel; @@ -162,6 +165,11 @@ export class NodeComponent implements OnInit, AfterViewInit, OnDestroy, DoCheck } }); } + this.$ngRedux.select((store) => store.wineryState.currentJsonTopology) + .subscribe((topology) => { + this.groupDefinitions = topology.groups; + this.participants = topology.participants; + }); this.$ngRedux.subscribe(() => this.setPolicyIcons()); } @@ -170,7 +178,6 @@ export class NodeComponent implements OnInit, AfterViewInit, OnDestroy, DoCheck */ get nodeTypeLocalName() { return this.nodeTemplate.type.split('}').pop(); - // return this.nodeTemplate.type ? new QName(this.nodeTemplate.type).localName : JSON.stringify({}); } public addItem(): void { @@ -179,7 +186,7 @@ export class NodeComponent implements OnInit, AfterViewInit, OnDestroy, DoCheck /** * This function determines which kind of properties the nodeType embodies. - * We have 3 possibilities: none, XML element, or Key value pairs. + * We have 4 possibilities: none, XML element, Key value pairs or yaml-datatypes. */ findOutPropertyDefinitionTypeForProperties(type: string, groupedNodeTypes: Array): void { let propertyDefinitionTypeAssigned: boolean; @@ -197,7 +204,8 @@ export class NodeComponent implements OnInit, AfterViewInit, OnDestroy, DoCheck } else { // if no XML element inside PropertiesDefinition then it must be of type Key Value if (!node.propertiesDefinition.element) { - this.propertyDefinitionType = PropertyDefinitionType.KV; + this.propertyDefinitionType = this.configurationService.isYaml() ? + PropertyDefinitionType.YAML : PropertyDefinitionType.KV; propertyDefinitionTypeAssigned = true; } else { // else we have XML @@ -220,13 +228,13 @@ export class NodeComponent implements OnInit, AfterViewInit, OnDestroy, DoCheck if (entry.qName === parentType) { parentFound = true; const node = entry.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0]; - if (!node.propertiesDefinition && node.derivedFrom) { + if (!node.properties && node.derivedFrom) { this.checkParentPropertyDefinitions(node.derivedFrom.typeRef); - } else if (!node.propertiesDefinition) { + } else if (!node.properties) { this.propertyDefinitionType = PropertyDefinitionType.NONE; return true; } else { - if (!node.propertiesDefinition.element) { + if (!node.properties.element) { this.propertyDefinitionType = PropertyDefinitionType.KV; } else { this.propertyDefinitionType = PropertyDefinitionType.XML; @@ -466,11 +474,14 @@ export class NodeComponent implements OnInit, AfterViewInit, OnDestroy, DoCheck this.sendPaletteStatus.emit('close Sidebar'); this.$ngRedux.dispatch(this.actions.openSidebar({ sidebarContents: { - sidebarVisible: false, + visible: false, nodeClicked: true, - id: '', - nameTextFieldValue: '', - type: '', + template: { + id: '', + name: '', + type: '', + properties: {}, + }, minInstances: -1, maxInstances: -1 } @@ -478,13 +489,12 @@ export class NodeComponent implements OnInit, AfterViewInit, OnDestroy, DoCheck } else { this.$ngRedux.dispatch(this.actions.openSidebar({ sidebarContents: { - sidebarVisible: true, + visible: true, nodeClicked: true, - id: this.nodeTemplate.id, - nameTextFieldValue: this.nodeTemplate.name, - type: this.nodeTemplate.type, + template: this.nodeTemplate, + // special handling for instance restrictions due to infinity minInstances: this.nodeTemplate.minInstances, - maxInstances: this.nodeTemplate.maxInstances + maxInstances: this.nodeTemplate.maxInstances, } })); } diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/policies/policies.component.html b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/policies/policies.component.html index 34852de8ad..7a6f5ca28a 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/policies/policies.component.html +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/policies/policies.component.html @@ -12,11 +12,15 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 --> - +
+ No policies defined
for this Topology Template.
+
+ +
@@ -24,7 +28,3 @@ Add new Policy
- - - - diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/policies/policies.component.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/policies/policies.component.ts index 95446b5f69..a663676437 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/policies/policies.component.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/policies/policies.component.ts @@ -56,4 +56,8 @@ export class PoliciesComponent implements OnInit { handleShowYamlPolicyModalEvent() { this.showYamlPolicyManagementModal.emit(); } + + isEmpty(): boolean { + return !this.policies || this.policies.length === 0; + } } diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/toscatype-table/toscatype-table.component.html b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/toscatype-table/toscatype-table.component.html index f7825f6dce..772cb480e4 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/toscatype-table/toscatype-table.component.html +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/toscatype-table/toscatype-table.component.html @@ -46,7 +46,6 @@ Name Type File - Depl. Path @@ -66,12 +65,6 @@
{{ artifact.file }}
{{ artifact.file }} - -
{{ artifact.targetLocation }}
- {{ artifact.targetLocation }} - - diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/toscatype-table/toscatype-table.component.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/toscatype-table/toscatype-table.component.ts index ca74dce1f8..c6f034c33c 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/toscatype-table/toscatype-table.component.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/toscatype-table/toscatype-table.component.ts @@ -13,7 +13,6 @@ *******************************************************************************/ import { Component, EventEmitter, Input, OnChanges, OnInit, Output, SimpleChanges } from '@angular/core'; -import { QName } from '../../models/qname'; import { EntitiesModalService, OpenModalEvent } from '../../canvas/entities-modal/entities-modal.service'; import { ModalVariant } from '../../canvas/entities-modal/modal-model'; import { definitionType, TableType, urlElement } from '../../models/enums'; @@ -27,6 +26,7 @@ import { RequirementDefinitionModel } from '../../models/requirementDefinitonMod import { TArtifact, VisualEntityType } from '../../models/ttopology-template'; import { TPolicy } from '../../models/policiesModalData'; import { InheritanceUtils } from '../../models/InheritanceUtils'; +import { QName } from '../../../../../shared/src/app/model/qName'; @Component({ selector: 'winery-toscatype-table', @@ -333,16 +333,20 @@ export class ToscatypeTableComponent implements OnInit, OnChanges { clickArtifactFile(artifact: TArtifact) { if (artifact) { - this.backendService.downloadYamlArtifactFile(this.currentNodeData.currentNodeId, - artifact.id, - artifact.file).subscribe(data => { - const blob = new Blob([data.body], { type: 'application/octet-stream' }); - const url = window.URL.createObjectURL(blob); - const anchor = document.createElement('a'); - anchor.download = artifact.file; - anchor.href = url; - anchor.click(); - }); + if (artifact.type && artifact.type === '{radon.artifacts}Repository') { + window.open(artifact.file, '_blank'); + } else { + this.backendService.downloadYamlArtifactFile(this.currentNodeData.currentNodeId, + artifact.id, + artifact.file).subscribe(data => { + const blob = new Blob([data.body], { type: 'application/octet-stream' }); + const url = window.URL.createObjectURL(blob); + const anchor = document.createElement('a'); + anchor.download = artifact.file; + anchor.href = url; + anchor.click(); + }); + } } } diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/versions/update.service.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/versions/update.service.ts index 7f39afd15d..73a8df76ef 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/versions/update.service.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/versions/update.service.ts @@ -40,7 +40,6 @@ export class UpdateService { update(updateInfo: UpdateInfo): Observable { const url = this.url + '/update'; - console.log(updateInfo); return this.http.post(url, updateInfo, { headers: this.headers }); } diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/versions/versions.component.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/versions/versions.component.ts index 03c5ed348d..366235b4af 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/versions/versions.component.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/node/versions/versions.component.ts @@ -27,6 +27,7 @@ import { PropertyDiffList } from '../../models/propertyDiffList'; import { Utils } from '../../../../../tosca-management/src/app/wineryUtils/utils'; import { WineryVersion } from '../../../../../tosca-management/src/app/model/wineryVersion'; import { WineryRepositoryConfigurationService } from '../../../../../tosca-management/src/app/wineryFeatureToggleModule/WineryRepositoryConfiguration.service'; +import { EntityTypesModel } from '../../models/entityTypesModel'; @Component({ selector: 'winery-versions', @@ -55,6 +56,8 @@ export class VersionsComponent implements OnInit { @Input() aVersionElement: VersionElement; @Input() nodeTemplateId: string; @Input() nodeType: string; + @Input() entityTypes: EntityTypesModel; + qNamePrefix: string; versions: WineryVersion[]; kvComparison: any; @@ -62,6 +65,7 @@ export class VersionsComponent implements OnInit { propertyDiff: PropertyDiffList; saveAfterUpdate: boolean; + private topologyTemplate: TTopologyTemplate; constructor(private modalService: BsModalService, private updateService: UpdateService, @@ -69,6 +73,8 @@ export class VersionsComponent implements OnInit { private ngRedux: NgRedux, private configurationService: WineryRepositoryConfigurationService, private wineryActions: WineryActions) { + this.ngRedux.select(state => state.wineryState.currentJsonTopology) + .subscribe(topology => this.topologyTemplate = topology); } ngOnInit() { @@ -95,9 +101,7 @@ export class VersionsComponent implements OnInit { openProperty() { this.updatePropertyModalRef = this.modalService.show(this.updatePropertyModal); - this.continueOrMap = this.CONTINUE; - } matchProperties() { @@ -125,7 +129,8 @@ export class VersionsComponent implements OnInit { this.matchedProperties, this.propertyDiff.newProperties, this.propertyDiff.resolvedProperties, - this.saveAfterUpdate + this.saveAfterUpdate, + this.topologyTemplate, ); this.updateService.update(updateInfo) @@ -152,7 +157,7 @@ export class VersionsComponent implements OnInit { } updateTopology(topology: TTopologyTemplate) { - TopologyTemplateUtil.updateTopologyTemplate(this.ngRedux, this.wineryActions, topology, this.configurationService.isYaml()); + TopologyTemplateUtil.updateTopologyTemplate(this.ngRedux, this.wineryActions, topology, this.entityTypes, this.configurationService.isYaml()); } showKVComparison() { diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/palette/palette.component.scss b/org.eclipse.winery.frontends/app/topologymodeler/src/app/palette/palette.component.scss index 013db46288..2f903ff32a 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/palette/palette.component.scss +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/palette/palette.component.scss @@ -47,6 +47,10 @@ user-select: none; } +.panel-group { + padding-bottom: 100px; +} + .accordion-root { } @@ -54,7 +58,6 @@ accordion-group { font-size: x-small; max-width: 300px; text-overflow: ellipsis; - overflow: scroll; white-space: nowrap !important; text-align: start !important; } diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/assign-participants.component.css b/org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/assign-participants.component.css new file mode 100644 index 0000000000..6ca883cb55 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/assign-participants.component.css @@ -0,0 +1,52 @@ +/******************************************************************************** + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + ********************************************************************************/ +table { + width: 210px; + table-layout: fixed; + border: 1px solid #ddd; +} + +th { + background-color: #cfd8dc; + color: #000; + text-align: left; +} + +th, +td { + border-top: 0; + border-left: 0; + border-right: 0; + border-bottom: 1px solid #ddd; + padding-left: 2px; +} + +tr { + cursor: pointer; +} + +tr:nth-child(even) { + background-color: #f2f2f2; +} + +.table-td div { + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + position: relative; + width: auto; + max-width: 100%; + -webkit-transition: max-width linear 1ms; + transition: max-width linear 1ms; +} diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/assign-participants.component.html b/org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/assign-participants.component.html new file mode 100644 index 0000000000..f223287820 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/assign-participants.component.html @@ -0,0 +1,42 @@ + + +
+ No participants defined
for this Topology Template.
+
+ + + + + + + + + + + + + + +
NameIs Member?
+
{{ p.name }}
+ {{ p.name }} +
+
+ + +
+
diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/assign-participants.component.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/assign-participants.component.ts new file mode 100644 index 0000000000..673a7f31a0 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/assign-participants.component.ts @@ -0,0 +1,92 @@ +/******************************************************************************** + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + ********************************************************************************/ + +import { Component, Input, OnInit } from '@angular/core'; +import { NgRedux } from '@angular-redux/store'; +import { OTParticipant, TNodeTemplate } from '../models/ttopology-template'; +import { IWineryState } from '../redux/store/winery.store'; +import { TopologyRendererActions } from '../redux/actions/topologyRenderer.actions'; +import { WineryActions } from '../redux/actions/winery.actions'; + +@Component({ + selector: 'winery-assign-participants', + templateUrl: './assign-participants.component.html', + styleUrls: ['./assign-participants.component.css'] +}) +export class AssignParticipantsComponent implements OnInit { + + static NAMESPACE = '{http://www.opentosca.org/winery/extensions/tosca/2013/02/12}'; + + @Input() readonly: boolean; + @Input() participants: OTParticipant[]; + @Input() node: TNodeTemplate; + + constructor(private ngRedux: NgRedux, + private ngActions: WineryActions, + private rendererActions: TopologyRendererActions) { + } + + ngOnInit() { + } + + isEllipsisActive(cell): boolean { + return (cell.offsetWidth < cell.scrollWidth); + } + + isMember(participant: OTParticipant) { + const value = this.node.otherAttributes[AssignParticipantsComponent.NAMESPACE + 'participant']; + if (value) { + if (value.indexOf(',') > -1) { + return value.split(',').indexOf(participant.name) > -1; + } else { + return participant.name === value; + } + } + return false; + } + + toggleMembership(participant: OTParticipant) { + const value = this.node.otherAttributes[AssignParticipantsComponent.NAMESPACE + 'participant']; + if (this.isMember(participant)) { + if (value.indexOf(',') > -1) { + const arr = value.split(','); + const index = arr.findIndex((p) => p === participant.name); + arr.splice(index, 1); + this.ngRedux.dispatch(this.ngActions.assignParticipant(this.node, arr.join(','))); + } else { + this.ngRedux.dispatch(this.ngActions.assignParticipant(this.node, '')); + } + } else { + if (value) { + if (value.indexOf(',') > -1) { + const arr = value.split(','); + arr.push(participant.name); + this.ngRedux.dispatch(this.ngActions.assignParticipant( + this.node, arr.join(',') + )); + } else { + this.ngRedux.dispatch(this.ngActions.assignParticipant( + this.node, value + ',' + participant.name + )); + } + } else { + this.ngRedux.dispatch(this.ngActions.assignParticipant(this.node, participant.name)); + } + } + } + + isEmpty(): boolean { + return !this.participants || this.participants.length === 0; + } +} diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/manage-participants.component.css b/org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/manage-participants.component.css new file mode 100644 index 0000000000..f994424f24 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/manage-participants.component.css @@ -0,0 +1,45 @@ +/******************************************************************************* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + *******************************************************************************/ + +.button-bar { + margin-bottom: 5px; +} + +.sidebar-root { + padding: 4px; +} + +.table { + margin-top: 5px; + margin-bottom: 10px; +} + +.table th { + font-size: 14px; + padding-top: 3px; + padding-bottom: 3px; +} + +.table td { + font-size: 16px; +} + +.btn-sm { + padding: 5px; + line-height: 1; +} + +.btn-sm i { + width: 14px; +} diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/manage-participants.component.html b/org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/manage-participants.component.html new file mode 100644 index 0000000000..1994120475 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/manage-participants.component.html @@ -0,0 +1,36 @@ + diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/manage-participants.component.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/manage-participants.component.ts new file mode 100644 index 0000000000..4b7b82c350 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/participants/manage-participants.component.ts @@ -0,0 +1,60 @@ +import { Component, OnInit, ViewChild } from '@angular/core'; +import { IWineryState } from '../redux/store/winery.store'; +import { NgRedux } from '@angular-redux/store'; +import { OTParticipant } from '../models/ttopology-template'; +import { WineryActions } from '../redux/actions/winery.actions'; +import { DynamicTextData } from '../../../../tosca-management/src/app/wineryDynamicTable/formComponents/dynamicText.component'; +import { WineryDynamicTableMetadata } from '../../../../tosca-management/src/app/wineryDynamicTable/wineryDynamicTableMetadata'; +import { WineryDynamicFormModalComponent } from '../../../../tosca-management/src/app/wineryDynamicTable/modal/wineryDynamicFormModal.component'; + +@Component({ + selector: 'winery-manage-participants', + templateUrl: './manage-participants.component.html', + styleUrls: ['./manage-participants.component.css'] +}) +export class ManageParticipantsComponent implements OnInit { + + visible = false; + participants: OTParticipant[] = []; + formMetadata: Array = []; + + @ViewChild('generatedModal') generatedModal: WineryDynamicFormModalComponent; + + constructor(private ngRedux: NgRedux, + private ngActions: WineryActions) { + this.ngRedux.select((state) => state.topologyRendererState.buttonsState.manageParticipantsButton) + .subscribe((visible) => this.visible = visible); + this.ngRedux.select((state) => state.wineryState.currentJsonTopology) + .subscribe((topology) => this.participants = topology.participants); + } + + ngOnInit() { + this.formMetadata = [ + new DynamicTextData('name', 'Name', + 0, [], '', false, false, true), + new DynamicTextData('url', 'URL', + 1, [], '', false, false, true), + ]; + } + + openModal() { + this.generatedModal.show({}); + } + + save(param: any) { + const newParticipants = Object.assign([], this.participants); + newParticipants.push({ name: param.name, url: param.url } as OTParticipant); + this.ngRedux.dispatch(this.ngActions.updateParticipants(newParticipants)); + } + + remove(participant: OTParticipant) { + const newParticipants = Object.assign([], this.participants); + const index = newParticipants.findIndex((p) => p.name === participant.name); + newParticipants.splice(index, 1); + this.ngRedux.dispatch(this.ngActions.updateParticipants(newParticipants)); + } + + isEmpty(): boolean { + return !this.participants || this.participants.length === 0; + } +} diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/problemDetection/problemDetection.component.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/problemDetection/problemDetection.component.ts index 5d6216469d..b468db30f7 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/problemDetection/problemDetection.component.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/problemDetection/problemDetection.component.ts @@ -26,6 +26,7 @@ import { TTopologyTemplate } from '../models/ttopology-template'; import { TopologyTemplateUtil } from '../models/topologyTemplateUtil'; import { WineryActions } from '../redux/actions/winery.actions'; import { WineryRepositoryConfigurationService } from '../../../../tosca-management/src/app/wineryFeatureToggleModule/WineryRepositoryConfiguration.service'; +import { EntityTypesModel } from '../models/entityTypesModel'; @Component({ selector: 'winery-problem-detection', @@ -42,6 +43,7 @@ export class ProblemDetectionComponent { selectedFinding: ProblemOccurrence; possibleSolutions: SolutionInputData[]; selectedSolution: SolutionInputData; + entityTypes: EntityTypesModel; constructor(private ngRedux: NgRedux, private actions: TopologyRendererActions, @@ -52,6 +54,12 @@ export class ProblemDetectionComponent { private backendService: BackendService) { this.ngRedux.select(state => state.topologyRendererState) .subscribe(currentButtonsState => this.checkButtonsState(currentButtonsState)); + this.ngRedux.select(state => state.wineryState.entityTypes) + .subscribe(data => { + if (data) { + this.entityTypes = data; + } + }); } private checkButtonsState(currentButtonsState: TopologyRendererState) { @@ -133,7 +141,7 @@ export class ProblemDetectionComponent { } private solutionApplied(data: TTopologyTemplate) { - TopologyTemplateUtil.updateTopologyTemplate(this.ngRedux, this.wineryActions, data, this.configurationService.isYaml()); + TopologyTemplateUtil.updateTopologyTemplate(this.ngRedux, this.wineryActions, data, this.entityTypes, this.configurationService.isYaml()); this.loading = false; } } diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/problemDetection/problemDetection.service.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/problemDetection/problemDetection.service.ts index d6f4dda2e8..38a0e398c5 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/problemDetection/problemDetection.service.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/problemDetection/problemDetection.service.ts @@ -17,44 +17,41 @@ import { BackendService } from '../services/backend.service'; import { Observable } from 'rxjs/Observable'; import { ProblemFindings, ProblemOccurrence } from './problemEntity'; import { SolutionInputData } from './solutionEntity'; -import { TopologyModelerConfiguration } from '../models/topologyModelerConfiguration'; import { TTopologyTemplate } from '../models/ttopology-template'; @Injectable() export class ProblemDetectionService { - private readonly configuration: TopologyModelerConfiguration; private readonly postHeaders: HttpHeaders; constructor(private http: HttpClient, - backendService: BackendService) { - this.configuration = backendService.configuration; + private backendService: BackendService) { this.postHeaders = new HttpHeaders().set('Accept', 'application/json'); this.postHeaders.set('Content-Type', 'application/json'); } detectProblems(): Observable { const header = new HttpHeaders().set('Accept', 'application/json'); - const url = this.configuration.topologyProDecURL + '/checkProblems?' - + 'wineryURL=' + encodeURIComponent(this.configuration.repositoryURL) - + '&serviceTemplateNS=' + encodeURIComponent(this.configuration.ns) - + '&serviceTemplateID=' + encodeURIComponent(this.configuration.id); + const url = this.backendService.configuration.topologyProDecURL + '/checkProblems?' + + 'wineryURL=' + encodeURIComponent(this.backendService.configuration.repositoryURL) + + '&serviceTemplateNS=' + encodeURIComponent(this.backendService.configuration.ns) + + '&serviceTemplateID=' + encodeURIComponent(this.backendService.configuration.id); return this.http.get(url, { headers: header }); } findSolutions(selectedProblem: ProblemOccurrence): Observable { - const url = this.configuration.topologyProDecURL + '/findSolutions'; + const url = this.backendService.configuration.topologyProDecURL + '/findSolutions'; return this.http.post(url, selectedProblem, { headers: this.postHeaders }); } applySolution(selectedSolution: SolutionInputData) { let url; if (selectedSolution.csi.serviceEndpoint.endsWith('eclipse/winery')) { - url = this.configuration.repositoryURL + '/' + this.configuration.parentPath + '/' - + encodeURIComponent(encodeURIComponent(this.configuration.ns)) + '/' - + encodeURIComponent(encodeURIComponent(this.configuration.id)) + '/' - + this.configuration.elementPath + url = this.backendService.configuration.repositoryURL + '/' + this.backendService.configuration.parentPath + '/' + + encodeURIComponent(encodeURIComponent(this.backendService.configuration.ns)) + '/' + + encodeURIComponent(encodeURIComponent(this.backendService.configuration.id)) + '/' + + this.backendService.configuration.elementPath + '/applysolution'; } else { url = selectedSolution.csi.serviceEndpoint; diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/kv-properties/kv-properties.component.html b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/kv-properties/kv-properties.component.html new file mode 100644 index 0000000000..d10eb87c63 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/kv-properties/kv-properties.component.html @@ -0,0 +1,44 @@ + + +
+ No properties defined
for this Node Template.
+
+ + + + + + + + + +
+ Key + + Values +
{{key.key}} + +
diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/kv-properties/kv-properties.component.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/kv-properties/kv-properties.component.ts new file mode 100644 index 0000000000..27e909bbb2 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/kv-properties/kv-properties.component.ts @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + *******************************************************************************/ +import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core'; +import { Subject, Subscription } from 'rxjs'; +import { KeyValueItem } from '../../../../../tosca-management/src/app/model/keyValueItem'; +import { debounceTime } from 'rxjs/operators'; +import { Utils } from '../../../../../tosca-management/src/app/wineryUtils/utils'; + +@Component({ + selector: 'winery-kv-properties', + templateUrl: './kv-properties.component.html', +}) +export class KvPropertiesComponent implements OnInit, OnDestroy { + @Input() readonly: boolean; + @Input() nodeProperties: object; + + @Output() propertyEdited: EventEmitter = new EventEmitter(); + + debouncer: Subject = new Subject(); + subscriptions: Array = []; + + ngOnInit(): void { + this.subscriptions.push(this.debouncer.pipe(debounceTime(50)) + .subscribe(target => { + this.propertyEdited.emit({ + key: target.name, + value: target.value, + }); + })); + } + + ngOnDestroy(): void { + this.subscriptions.forEach(s => s.unsubscribe()); + } + + isEmpty(): boolean { + return !this.nodeProperties || Utils.isEmpty(this.nodeProperties); + } + + keyup(target: any): void { + this.debouncer.next(target); + } +} diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties-content/properties-content.component.html b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties-content/properties-content.component.html deleted file mode 100644 index 7b67e7d185..0000000000 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties-content/properties-content.component.html +++ /dev/null @@ -1,56 +0,0 @@ - -
- -
- - - - - - - - -
- Key - - Values -
{{key.key}} - -
- -
- -
- -
- No properties defined
for this Element.
diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties-content/properties-content.component.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties-content/properties-content.component.ts deleted file mode 100644 index 37984c5fb2..0000000000 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties-content/properties-content.component.ts +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2017-2019 Contributors to the Eclipse Foundation - * - * See the NOTICE file(s) distributed with this work for additional - * information regarding copyright ownership. - * - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License 2.0 which is available at - * http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 - * which is available at https://www.apache.org/licenses/LICENSE-2.0. - * - * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 - ********************************************************************************/ - -import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; -import { Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core'; -import { Subject, Subscription } from 'rxjs'; -import { NgRedux } from '@angular-redux/store'; -import { IWineryState } from '../../redux/store/winery.store'; -import { WineryActions } from '../../redux/actions/winery.actions'; -import { JsPlumbService } from '../../services/jsPlumb.service'; -import { PropertyDefinitionType } from '../../models/enums'; - -@Component({ - selector: 'winery-properties-content', - templateUrl: './properties-content.component.html', - styleUrls: ['./properties-content.component.css'] -}) -export class PropertiesContentComponent implements OnInit, OnChanges, OnDestroy { - - properties: Subject = new Subject(); - keyOfEditedKVProperty: Subject = new Subject(); - @Input() readonly: boolean; - @Input() currentNodeData: any; - key: string; - nodeProperties: any; - subscriptions: Array = []; - - constructor(private $ngRedux: NgRedux, - private actions: WineryActions, - private jsPlumbService: JsPlumbService) { - } - - /** - * Angular lifecycle event. - */ - ngOnChanges(changes: SimpleChanges) { - if (changes.currentNodeData.currentValue.nodeTemplate.properties) { - try { - const currentProperties = changes.currentNodeData.currentValue.nodeTemplate.properties; - if (this.currentNodeData.propertyDefinitionType === PropertyDefinitionType.KV) { - this.nodeProperties = currentProperties.kvproperties; - } else if (this.currentNodeData.propertyDefinitionType === PropertyDefinitionType.XML) { - this.nodeProperties = currentProperties.any; - } - } catch (e) { - } - } - // repaint jsPlumb to account for height change of the accordion - setTimeout(() => this.jsPlumbService.getJsPlumbInstance().repaintEverything(), 1); - } - - /** - * Angular lifecycle event. - */ - ngOnInit() { - if (this.currentNodeData.nodeTemplate.properties) { - try { - const currentProperties = this.currentNodeData.nodeTemplate.properties; - if (this.currentNodeData.propertyDefinitionType === PropertyDefinitionType.KV) { - this.nodeProperties = currentProperties.kvproperties; - } else if (this.currentNodeData.propertyDefinitionType === PropertyDefinitionType.XML) { - this.nodeProperties = currentProperties.any; - } - } catch (e) { - } - } - // find out which row was edited by key - this.subscriptions.push(this.keyOfEditedKVProperty.pipe( - debounceTime(200), - distinctUntilChanged(), ) - .subscribe(key => { - this.key = key; - })); - // set key value property with a debounceTime of 300ms - this.subscriptions.push(this.properties.pipe( - debounceTime(300), - distinctUntilChanged(), ) - .subscribe(value => { - if (this.currentNodeData.propertyDefinitionType === PropertyDefinitionType.KV) { - this.nodeProperties[this.key] = value; - } else { - this.nodeProperties = value; - } - this.$ngRedux.dispatch(this.actions.setProperty({ - nodeProperty: { - newProperty: this.nodeProperties, - propertyType: this.currentNodeData.propertyDefinitionType, - nodeId: this.currentNodeData.nodeTemplate.id - } - })); - })); - } - - ngOnDestroy() { - this.subscriptions.forEach(subscription => subscription.unsubscribe()); - } -} diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties.component.css b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties.component.css index a46582069a..208c2a82ad 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties.component.css +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties.component.css @@ -13,9 +13,9 @@ ********************************************************************************/ textarea { + overflow: hidden; pointer-events: auto; resize: none; margin-left: 5px; width: 100%; - overflow: hidden !important; } diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties.component.html b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties.component.html index fe52d04e41..d6efabd7d5 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties.component.html +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties.component.html @@ -1,5 +1,5 @@ - + + + - + [nodeProperties]="templateProperties" + (propertyEdited)="kvPropertyEdit($event)"> + + + + + + + + +
+ No properties defined
for this Element.
+
diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties.component.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties.component.ts index f88144ccd4..78aa277c95 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties.component.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties.component.ts @@ -1,5 +1,5 @@ -/******************************************************************************** - * Copyright (c) 2017-2018 Contributors to the Eclipse Foundation +/******************************************************************************* + * Copyright (c) 2017-2020 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -10,23 +10,176 @@ * which is available at https://www.apache.org/licenses/LICENSE-2.0. * * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 - ********************************************************************************/ + *******************************************************************************/ -import { Component, Input, OnInit } from '@angular/core'; +import { Component, Input, OnChanges, OnDestroy, OnInit, SimpleChanges } from '@angular/core'; +import { Subscription } from 'rxjs'; +import { NgRedux } from '@angular-redux/store'; +import { IWineryState } from '../redux/store/winery.store'; +import { WineryActions } from '../redux/actions/winery.actions'; +import { JsPlumbService } from '../services/jsPlumb.service'; +import { PropertyDefinitionType } from '../models/enums'; +import { KeyValueItem } from '../../../../tosca-management/src/app/model/keyValueItem'; +import { TNodeTemplate, TRelationshipTemplate } from '../models/ttopology-template'; @Component({ selector: 'winery-properties', templateUrl: './properties.component.html', styleUrls: ['./properties.component.css'] }) -export class PropertiesComponent implements OnInit { - @Input() currentNodeData: any; +export class PropertiesComponent implements OnInit, OnChanges, OnDestroy { + @Input() readonly: boolean; + @Input() templateId: string; + @Input() isNode: boolean; + + propertyDefinitionType: PropertyDefinitionType; + templateProperties: any = {}; + templateType: string; + + private subscriptions: Array = []; + // flag to allow skipping an update when this instance is the instigator of said update + // this way we avoid recreating the input form during the editing process + private skipUpdate = false; - constructor() { + constructor(private $ngRedux: NgRedux, + private actions: WineryActions, + private jsPlumbService: JsPlumbService) { } + /** + * Angular lifecycle event. + */ + ngOnChanges(changes: SimpleChanges) { + if (changes.isNode) { + this.isNode = changes.isNode.currentValue; + } + if (changes.templateId) { + this.clearSubscriptions(); + this.templateId = changes.templateId.currentValue; + if (this.templateId) { + this.subscriptions.push(this.buildSubscription()); + } else { + this.templateProperties = {}; + this.propertyDefinitionType = PropertyDefinitionType.NONE; + } + } + // repaint jsPlumb to account for height change of the accordion + setTimeout(() => this.jsPlumbService.getJsPlumbInstance().repaintEverything(), 1); + } + + /** + * Angular lifecycle event. + */ ngOnInit() { + if (this.templateId) { + this.clearSubscriptions(); + this.subscriptions.push(this.buildSubscription()); + } + } + + private loadData(template: TNodeTemplate | TRelationshipTemplate): void { + if (this.skipUpdate) { + this.skipUpdate = false; + return; + } + + const propertyData = template.properties && Object.keys(template.properties).length > 0 + ? template.properties + : { propertyType: PropertyDefinitionType.NONE, properties: {} }; + + this.propertyDefinitionType = propertyData.propertyType; + this.templateType = template.type; + // reset nodeProperties to empty object to change it's pointer for change detection to work + this.templateProperties = {}; + try { + if (this.propertyDefinitionType === PropertyDefinitionType.KV) { + // need to use Object.assign here to avoid overwriting the refreshed pointer + Object.assign(this.templateProperties, propertyData.kvproperties); + } else if (this.propertyDefinitionType === PropertyDefinitionType.XML) { + // since this particular value is a String, Angular correctly detects changes + this.templateProperties = propertyData.any; + } else if (this.propertyDefinitionType === PropertyDefinitionType.YAML) { + // need to use Object.assign here to avoid overwriting the refreshed pointer + Object.assign(this.templateProperties, propertyData.properties); + } + } catch (e) { + } + } + + private clearSubscriptions() { + this.subscriptions.forEach(s => s.unsubscribe()); } + ngOnDestroy() { + this.clearSubscriptions(); + } + + xmlPropertyEdit($event: string) { + this.templateProperties = $event; + this.dispatchRedux('any'); + } + + kvPropertyEdit($event: KeyValueItem) { + this.templateProperties[$event.key] = $event.value; + this.dispatchRedux('kvproperties'); + } + + // TODO? rewrite to have a "PathValueItem" + yamlPropertyEdit($event: KeyValueItem) { + // FIXME deal with the fact that yaml properties support complex datatypes, implying nesting + this.templateProperties[$event.key] = $event.value; + this.dispatchRedux('properties'); + } + + private dispatchRedux(member: string): void { + const newProperty = { propertyType: this.propertyDefinitionType }; + newProperty[member] = this.templateProperties; + this.skipUpdate = true; + if (this.isNode) { + this.$ngRedux.dispatch(this.actions.setProperty({ + newProperty: newProperty, + nodeId: this.templateId, + })); + } else { + this.$ngRedux.dispatch(this.actions.setProperty({ + newProperty: newProperty, + relationId: this.templateId, + })); + } + } + + private buildSubscription(): Subscription { + if (!this.templateId) { + return; + } + // we also need to display relationships here + if (this.isNode) { + return this.$ngRedux.select(wineryState => wineryState + .wineryState + .currentJsonTopology + .nodeTemplates + .find(nt => { + return nt.id === this.templateId; + }) + ).subscribe(nodeTemplate => { + if (nodeTemplate) { + this.loadData(nodeTemplate); + } + }); + } else { + return this.$ngRedux.select(wineryState => wineryState + .wineryState + .currentJsonTopology + .relationshipTemplates + .find(rt => { + return rt.id === this.templateId; + }) + ).subscribe(relationship => { + if (relationship) { + this.loadData(relationship); + } + }); + } + } } diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties.module.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties.module.ts index 5bfef647a3..42f60ea032 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties.module.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties.module.ts @@ -22,9 +22,13 @@ import { ToastrModule } from 'ngx-toastr'; import { NgReduxModule } from '@angular-redux/store'; import { RouterModule } from '@angular/router'; import { PropertiesComponent } from './properties.component'; -import { PropertiesContentComponent } from './properties-content/properties-content.component'; import { KeysPipe } from '../pipes/keys.pipe'; import { WineryModalModule } from '../../../../tosca-management/src/app/wineryModalModule/winery.modal.module'; +import { KvPropertiesComponent } from './kv-properties/kv-properties.component'; +import { XmlPropertiesComponent } from './xml-properties/xml-properties.component'; +import { YamlPropertiesComponent } from './yaml-properties/yaml-properties.component'; +import { ConstraintChecking, ConstraintClause } from './property-constraints'; +import { TypeawareInputComponent } from './yaml-properties/typeaware-input.component'; @NgModule({ imports: [ @@ -42,12 +46,14 @@ import { WineryModalModule } from '../../../../tosca-management/src/app/wineryMo ], declarations: [ PropertiesComponent, - PropertiesContentComponent, - KeysPipe + KvPropertiesComponent, + XmlPropertiesComponent, + YamlPropertiesComponent, + TypeawareInputComponent, + KeysPipe, ], exports: [ PropertiesComponent, - PropertiesContentComponent, KeysPipe ] }) diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/property-constraints.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/property-constraints.ts new file mode 100644 index 0000000000..e262be7ded --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/property-constraints.ts @@ -0,0 +1,84 @@ +/******************************************************************************* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + *******************************************************************************/ + +/** + * constraint operators defined in tosca yaml spec 3.6.3.1 + */ +import * as assert from 'assert'; + +enum ConstraintOperator { + equal = 'equal', + greater_than = 'greater_than', + greater_or_equal = 'greater_or_equal', + less_than = 'less_than', + less_or_equal = 'less_or_equal', + in_range = 'in_range', + valid_values = 'valid_values', + length = 'length', + min_length = 'min_length', + max_length = 'max_length', + pattern = 'pattern', + schema = 'schema' +} + +export class ConstraintClause { + operator: string; + value: any; // string | number | [number, number] | any[] | Object; +} + +export class ConstraintChecking { + // FIXME comparison needs to be aware of the builtin scalar-unit types and their units + /** + * Checks a value against a given constraint. The first argument is the ConstraintClause to check. + */ + static isValid(constraint: ConstraintClause, checked: any): boolean { + switch (constraint.operator) { + case ConstraintOperator.equal: + return checked === constraint.value; + case ConstraintOperator.greater_than: + return checked > constraint.value; + case ConstraintOperator.greater_or_equal: + return checked >= constraint.value; + case ConstraintOperator.less_than: + return checked < constraint.value; + case ConstraintOperator.less_or_equal: + return checked <= constraint.value; + case ConstraintOperator.in_range: + if (Array.isArray(checked)) { + // assume we have a range that needs to be checked + assert(checked.length === 2, 'Checked array value for in_range operator was not a range'); + return checked[0] >= constraint.value[0] && (checked[1] <= constraint.value[1] || constraint.value[1] === 'UNBOUNDED'); + } + return checked >= constraint.value[0] + && (checked <= constraint.value[1] || constraint.value[1] === 'UNBOUNDED'); + case ConstraintOperator.valid_values: + return constraint.value.some(v => checked === v); + case ConstraintOperator.length: + return checked.length === constraint.value; + case ConstraintOperator.min_length: + return checked.length >= constraint.value; + case ConstraintOperator.max_length: + return checked.length <= constraint.value; + case ConstraintOperator.pattern: + // we assume that the constraint is valid and therefore the value is a string + return new RegExp(constraint.value).test(checked); + case ConstraintOperator.schema: + // schema validation is only performed on the Orchestrator + return true; + default: + // if no operator is specified, infer "equal" + return checked === constraint.value; + } + } +} diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/xml-properties/xml-properties.component.html b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/xml-properties/xml-properties.component.html new file mode 100644 index 0000000000..bdbbfc36b4 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/xml-properties/xml-properties.component.html @@ -0,0 +1,23 @@ + + + diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/xml-properties/xml-properties.component.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/xml-properties/xml-properties.component.ts new file mode 100644 index 0000000000..98d3ffd501 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/xml-properties/xml-properties.component.ts @@ -0,0 +1,42 @@ +/******************************************************************************* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + *******************************************************************************/ + +import { Component, EventEmitter, Input, OnDestroy, OnInit, Output } from '@angular/core'; +import { Subject, Subscription } from 'rxjs'; +import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; + +@Component({ + selector: 'winery-xml-properties', + templateUrl: './xml-properties.component.html', +}) +export class XmlPropertiesComponent implements OnInit, OnDestroy { + @Input() readonly: boolean; + @Input() propertiesValue: any; + + @Output() propertyEdited: EventEmitter = new EventEmitter(); + properties: Subject = new Subject(); + + subscriptions: Array = []; + + ngOnInit(): void { + this.subscriptions.push(this.properties.pipe(debounceTime(300), distinctUntilChanged()) + .subscribe(value => { + this.propertyEdited.emit(value); + })); + } + + ngOnDestroy(): void { + this.subscriptions.forEach(s => s.unsubscribe()); + } +} diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/yaml-properties/type-conformance-validator.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/yaml-properties/type-conformance-validator.ts new file mode 100644 index 0000000000..8054e4d591 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/yaml-properties/type-conformance-validator.ts @@ -0,0 +1,250 @@ +/******************************************************************************* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + *******************************************************************************/ +import { AbstractControl, ValidationErrors, Validator } from '@angular/forms'; +import { TDataType } from '../../models/ttopology-template'; +// TODO this should possibly not be from tosca-management +import { YamlPropertyDefinition } from '../../../../../tosca-management/src/app/model/yaml'; +import { Constraint, isWellKnown, YamlWellKnown } from '../../../../../tosca-management/src/app/model/constraint'; +import { ConstraintChecking } from '../property-constraints'; +import { InheritanceUtils } from '../../models/InheritanceUtils'; +import { ToscaUtils } from '../../models/toscaUtils'; +import { QName } from 'app/shared/src/app/model/qName'; + +export class TypeConformanceValidator implements Validator { + + private readonly laxParsing: boolean; + private readonly enforcedType: TDataType | YamlWellKnown; + + constructor(private dataTypes: TDataType[], private propDef: YamlPropertyDefinition) { + const typeId = propDef.type; + if (isWellKnown(typeId)) { + this.enforcedType = typeId; + } else { + // typeId can be a QName or just the name of a type without namespacing + this.enforcedType = dataTypes.find(t => t.qName === typeId || t.name === typeId); + } + if (this.enforcedType === undefined) { + console.warn('Could not determine enforceable type for definition ' + JSON.stringify(propDef)); + } + this.laxParsing = this.determineParsingStandard(this.enforcedType); + } + + private determineParsingStandard(enforcedType: TDataType | YamlWellKnown): boolean { + if (isWellKnown(enforcedType)) { + // these known types need to be parseable as objects because they are + return enforcedType !== 'list' && enforcedType !== 'map' && enforcedType !== 'range'; + } + const dataTypeInheritance = InheritanceUtils.getInheritanceAncestry(enforcedType.qName, this.dataTypes); + return !dataTypeInheritance.some(definesProperties); + } + + validate(control: AbstractControl): ValidationErrors | null { + const structuredValue = this.parseValue(control.value); + if (structuredValue === undefined && (this.propDef.required || control.value !== '')) { + // this only happens if parsing is not lax OR the value could not be parsed as string after enquoting it + return { 'typeConformance': [ 'Could not parse entered value as JSON' ]}; + } + // if (!this.propDef.required && structuredValue === null) { + if (structuredValue === null || structuredValue === '') { + // skip all validation for null values and empty form-fields + return; + } + const results = this.fulfilsTypeDefinition(this.enforcedType, '', structuredValue); + for (const error of this.fulfilsConstraints(this.propDef.constraints, structuredValue, '')) { + results.push(error); + } + return results.length === 0 ? null : { 'typeConformance': results }; + } + + private fulfilsTypeDefinition(type: TDataType | YamlWellKnown, valuePath: string, structuredValue: any): string[] { + // we cannot perform "static typechecking" on property functions defined in Section 4.4 of the spec + if (isPropertyFunction(structuredValue)) { + return []; + } + if (isWellKnown(type)) { + return this.fulfilsWellKnownType(structuredValue, type) ? [] + : [ `Value ${valuePath.substr(1)} was not conform to TOSCA-YAML well known type ${type}.` ]; + } + const hierarchy = InheritanceUtils.getInheritanceAncestry(type.id, this.dataTypes); + if (hierarchy.some(definesProperties)) { + return this.fulfilsPropertyRequirements(structuredValue, hierarchy, valuePath); + } + return this.fulfilsKnownConstraints(structuredValue, hierarchy, valuePath); + } + + /** + * Checks whether a given structured value fulfils the requirements of a well-known type. + * @param structuredValue the structured value to check + * @param knownType the well-known type to check the value against + */ + private fulfilsWellKnownType(structuredValue: any, knownType: YamlWellKnown): boolean { + switch (knownType) { + case 'string': + // consider that this might need to also accept stuff that's parseable as number, boolean or anything else + return typeof structuredValue === 'string'; + case 'integer': + case 'float': + return typeof structuredValue === 'number'; + case 'boolean': + return typeof structuredValue === 'boolean' || structuredValue === 'yes' || structuredValue === 'no'; + case 'timestamp': + // FIXME actual check for conformance to typestamp value + return typeof structuredValue === 'string'; + case 'null': + // why ever you'd want to do this? + return structuredValue === null || structuredValue === undefined; + case 'version': + return typeof structuredValue === 'string' && structuredValue.match(/\d+\.\d+(\.\d+(\..+?(-\d+)?)?)?/) !== undefined; + case 'range': + // FIXME check whether the borders used are in fact scalar values or UNBOUNDED + return Array.isArray(structuredValue) && structuredValue.length === 2; + case 'list': + return Array.isArray(structuredValue); + case 'map': + // FIXME need to actually check that this is an object with SOME entries + return structuredValue !== undefined; + case 'scalar-unit': + case 'scalar-unit.size': + case 'scalar-unit.time': + case 'scalar-unit.frequency': + case 'scalar-unit.bitrate': + // FIXME check unit conformance + return typeof structuredValue === 'string'; + default: + // not actually one of the well-known types here! + return false; + } + } + + private fulfilsKnownConstraints(structuredValue: any, hierarchy: TDataType[], valuePath: string): string[] { + const constraints: Constraint[] = []; + for (const parent of hierarchy) { + for (const c of ToscaUtils.getDefinition(parent).constraints) { + constraints.push(c); + } + } + return this.fulfilsConstraints(constraints, structuredValue, valuePath); + } + + private fulfilsConstraints(constraints: Constraint[], structuredValue: any, valuePath: string) { + const errors: string[] = []; + for (const constraint of constraints) { + if (!ConstraintChecking.isValid({ operator: constraint.key, value: constraint.list || constraint.value }, structuredValue)) { + errors.push(`Value ${valuePath.substr(1)} does not conform to constraint "${constraint.key} - ${constraint.list || constraint.value}"`); + } + } + return errors; + } + + private fulfilsPropertyRequirements(structuredValue: any, hierarchy: TDataType[], valuePath: string): string[] { + const properties: YamlPropertyDefinition[] = []; + for (const parent of hierarchy) { + if (definesProperties(parent)) { + for (const prop of ToscaUtils.getDefinition(parent).propertiesDefinition.properties) { + properties.push(prop); + } + } + } + + const errors: string[] = []; + if (structuredValue === undefined || structuredValue === null) { + // handling of "required" status is not on this level. + // Assume no validation errors because structuredValue cannot have properties here + return []; + } + // Verify all properties that are given for: + // 1. being defined in the first place + // 2. conforming to the type they are defined as + // 3. fulfilling the narrowing constraints defined on the property definition itself + // tslint:disable-next-line:forin + for (const member in structuredValue) { + const correspondingProperty = properties.find(prop => prop.name === member); + if (correspondingProperty === undefined) { + errors.push(`${valuePath.substr(1)} includes the member ${member} that is not defined on the type`); + continue; + } + const memberType = this.resolveType(correspondingProperty.type); + if (typeof memberType === 'undefined') { + errors.push(`Could not resolve type ${correspondingProperty.type} of property ${correspondingProperty.name}`); + continue; + } + const memberValue = structuredValue[member]; + if (memberValue === null && !correspondingProperty.required) { + continue; + } + for (const error of this.fulfilsTypeDefinition(memberType, valuePath + '.' + member, memberValue)) { + errors.push(error); + } + // propertiesDefinitions can include constraints. They are validated here + const violations = this.fulfilsConstraints(correspondingProperty.constraints, memberValue, valuePath + '.' + member); + for (const error of violations) { + errors.push(error); + } + } + for (const requiredProperty of properties.filter(prop => prop.required)) { + if (structuredValue[requiredProperty.name] === undefined) { + errors.push(`${valuePath.substr(1)} does not include the required member ${requiredProperty.name}`); + } + } + return errors; + } + + private parseValue(value: string): any { + let result; + try { + result = JSON.parse(value); + } catch (e) { + if (!this.laxParsing) { + // the value is not actually a string or something deriving from it + // therefore we expect something that's parseable as JSON and bail here + return undefined; + } + // try reparsing as string + try { + // this should never ever fail because we should be able to parse literally anything as a string, so long as we enquote it + result = JSON.parse( '"' + value.replace(/"/g, '\\"') + '"'); + } catch (e) { + return undefined; + } + } + return result; + } + + private resolveType(type: QName | YamlWellKnown | string): YamlWellKnown | TDataType | undefined { + if (isWellKnown(type)) { + return type; + } + return this.dataTypes.find((t) => t.qName === type || t.id === type); + } +} + +const function_keys: string[] = [ + 'get_input', 'get_property', 'get_attribute', 'get_operation_output', 'get_nodes_of_type', 'get_artifact' +]; + +function isPropertyFunction(structuredValue: any) { + if (structuredValue === undefined || structuredValue === null) { return false; } + for (const func of function_keys) { + if (structuredValue.hasOwnProperty(func)) { + // TODO evaluate whether we'd need to check for that key to be the only key present? + return true; + } + } + return false; +} + +function definesProperties(type: TDataType): boolean { + const full = ToscaUtils.getDefinition(type); + return full.properties || (full.propertiesDefinition && full.propertiesDefinition.properties); +} diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/yaml-properties/typeaware-input.component.html b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/yaml-properties/typeaware-input.component.html new file mode 100644 index 0000000000..e02ce429d7 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/yaml-properties/typeaware-input.component.html @@ -0,0 +1,27 @@ + + + +
+

{{ message }}

+
diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/yaml-properties/typeaware-input.component.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/yaml-properties/typeaware-input.component.ts new file mode 100644 index 0000000000..7be9d60e10 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/yaml-properties/typeaware-input.component.ts @@ -0,0 +1,127 @@ +/******************************************************************************* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + *******************************************************************************/ + +import { Component, forwardRef, Input, OnChanges, OnInit, SimpleChanges } from '@angular/core'; +import { ControlValueAccessor, FormControl, NG_VALIDATORS, NG_VALUE_ACCESSOR, ValidationErrors, Validator } from '@angular/forms'; +import { TDataType } from '../../models/ttopology-template'; +import { Subject } from 'rxjs'; +import { debounceTime } from 'rxjs/operators'; +import { BackendService } from '../../services/backend.service'; +import { TypeConformanceValidator } from './type-conformance-validator'; +import { YamlPropertyDefinition } from '../../../../../tosca-management/src/app/model/yaml'; + +/** + * This is an input component that is aware of the DataType that the value it receives must conform to. + * It's internally validating the input given by the user and respects property functions that compute the actual value + * of the property later. + * It will only emit a changed event for values that conform to the type it expects. + * Values, especially complex objects are expected to be specified (and parseable) as JSON. + */ +@Component({ + selector: 'winery-properties-input', + templateUrl: 'typeaware-input.component.html', + providers: [ + { + provide: NG_VALUE_ACCESSOR, + useExisting: forwardRef(() => TypeawareInputComponent), + multi: true + }, + ] +}) +export class TypeawareInputComponent implements ControlValueAccessor, OnInit, OnChanges, Validator { + + @Input() + definition: YamlPropertyDefinition; + + // values used to render the view + isDisabled: boolean; + errors: string[] = []; + _value: any; + + // storage for callbacks + private _onChange: any = e => {}; + private _onTouch: any = e => {}; + private desugaredValidator: Validator = undefined; + + // this subject helps reduce computation load by debouncing validation triggers while the user adds input. + private validationDebouncer: Subject = new Subject(); + private availableDataTypes: TDataType[] = []; + + JSON: JSON; + + constructor(private dataTypes: BackendService) { + this.dataTypes.model$.subscribe(backendModel => { + this.availableDataTypes = backendModel.dataTypes; + }); + } + + ngOnInit() { + this.validationDebouncer.pipe(debounceTime(350)) + .subscribe(control => { + const errors = this.validate(control); + if (errors) { + this.errors = errors['typeConformance']; + } else { + // clear errors and emit change-event if no validation errors occurred + this.errors = []; + this._onChange(control.value); + } + }); + // this is a fix to make the global javascript object available inside the component template + this.JSON = JSON; + } + + ngOnChanges(changes: SimpleChanges) { + if (changes.definition) { + // compute the complete type definition including all required properties for this value + this.definition = changes.definition.currentValue; + this.desugaredValidator = new TypeConformanceValidator(this.availableDataTypes, this.definition); + } + } + + keyup(target: any): void { + this.validationDebouncer.next(target); + this._onTouch(target); + } + + validate(control: FormControl): ValidationErrors | null { + return this.desugaredValidator !== undefined && this.desugaredValidator.validate(control); + } + + registerOnChange(fn: any): void { + this._onChange = fn; + } + + registerOnTouched(fn: any): void { + this._onTouch = fn; + } + + writeValue(obj: any): void { + this._value = obj; + } + + setDisabledState(isDisabled: boolean) { + this.isDisabled = isDisabled; + } + + unQuote(value: string): string { + if (value === undefined) { + return ''; + } + if (value.startsWith('"') && value.endsWith('"')) { + return value.substr(1, value.length - 2); + } + return value; + } +} diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/yaml-properties/yaml-properties.component.html b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/yaml-properties/yaml-properties.component.html new file mode 100644 index 0000000000..f9ab455f84 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/yaml-properties/yaml-properties.component.html @@ -0,0 +1,38 @@ + + +
+ No properties defined
for this Node Template.
+
+ + + + + + + + + +
+ Key + + Values +
{{definition.name}} + + +
diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/yaml-properties/yaml-properties.component.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/yaml-properties/yaml-properties.component.ts new file mode 100644 index 0000000000..a9a39aea22 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/yaml-properties/yaml-properties.component.ts @@ -0,0 +1,118 @@ +/******************************************************************************* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + *******************************************************************************/ + +import { Component, EventEmitter, Input, OnChanges, OnDestroy, Output, SimpleChanges } from '@angular/core'; +import { Subject, Subscription } from 'rxjs'; +import { KeyValueItem } from '../../../../../tosca-management/src/app/model/keyValueItem'; +import { debounceTime, distinctUntilChanged } from 'rxjs/operators'; +import { BackendService } from '../../services/backend.service'; +import { EntityType } from '../../models/ttopology-template'; +import { InheritanceUtils } from '../../models/InheritanceUtils'; +import { ToscaUtils } from '../../models/toscaUtils'; + +function patchJson(rawKV: KeyValueItem) { + const userInput = rawKV.value; + let result; + try { + result = JSON.parse(userInput); + } catch (e) { + // if the user input is not actually JSON, we just fall back to it + result = userInput; + } + return { key: rawKV.key, value: result }; +} + +@Component({ + selector: 'winery-yaml-properties', + templateUrl: './yaml-properties.component.html', +}) +export class YamlPropertiesComponent implements OnChanges, OnDestroy { + @Input() readonly: boolean; + @Input() properties: object; + @Input() templateType: string; + + @Output() propertyEdited: EventEmitter = new EventEmitter(); + + propertyValues: any; + propertyDefinitions: Array; + + private outputDebouncer: Subject = new Subject(); + private nodeTypes: Array = []; + private subscriptions: Array = []; + + constructor(private backend: BackendService) { + this.subscriptions.push(this.backend.model$.subscribe( + model => { + this.nodeTypes = model.unGroupedNodeTypes.concat(model.relationshipTypes); + } + )); + this.subscriptions.push(this.outputDebouncer.pipe(debounceTime(300), distinctUntilChanged()) + .subscribe(rawValue => this.propertyEdited.emit(patchJson(rawValue)))); + } + + ngOnChanges(changes: SimpleChanges): void { + // TODO flattening the object graph for yaml properties is a more involved operation than we can leave to the keysPipe + if (changes.templateType) { + this.templateType = changes.templateType.currentValue; + this.determineProperties(); + } + if (changes.properties) { + this.propertyValues = changes.properties.currentValue; + // values that are property functions need to be marked as complex + this.backfillPropertyDefaults(); + } + } + + ngOnDestroy(): void { + this.subscriptions.forEach(s => s.unsubscribe()); + } + + onPropertyValueChange(rawValue: any, definition: any) { + this.outputDebouncer.next({ + key: definition.name, + value: rawValue, + }); + } + + private determineProperties(): void { + const inheritance = InheritanceUtils.getInheritanceAncestry(this.templateType, this.nodeTypes); + const definedProperties = []; + for (const type of inheritance) { + const definition = ToscaUtils.getDefinition(type); + if (definition.propertiesDefinition === undefined) { + continue; + } + for (const propertyDefinition of definition.propertiesDefinition.properties || []) { + // only add properties that have not been overwritten by subtypes. + // "lower" types come earlier in the ancestry list, that's why we can afford this + if (definedProperties.find(def => def.name === propertyDefinition.name) === undefined) { + definedProperties.push(propertyDefinition); + } + } + } + this.propertyDefinitions = definedProperties; + } + + private backfillPropertyDefaults() { + for (const propDefinition of this.propertyDefinitions) { + if (this.propertyValues[propDefinition.name] === undefined) { + this.propertyValues[propDefinition.name] = propDefinition.defaultValue || ''; + } + } + } + + isEmpty(): boolean { + return !this.propertyDefinitions || this.propertyDefinitions.length === 0; + } +} diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/redux/actions/topologyRenderer.actions.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/redux/actions/topologyRenderer.actions.ts index 9904dbc1e0..b195d85d62 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/redux/actions/topologyRenderer.actions.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/redux/actions/topologyRenderer.actions.ts @@ -44,6 +44,9 @@ export class TopologyRendererActions { static REFINE_TOPOLOGY = 'REFINE_TOPOLOGY'; static REFINE_PATTERNS = 'REFINE_PATTERNS'; static REFINE_TOPOLOGY_WITH_TESTS = 'REFINE_TOPOLOGY_WITH_TESTS'; + static GENERATE_GDM = 'GENERATE_GDM'; + static GENERATE_PLACEHOLDER_SUBS = 'GENERATE_PLACEHOLDER_SUBS'; + static EXTRACT_LDM = 'EXTRACT_LDM'; static HIGHLIGHT_NODES = 'HIGHLIGHT_NODES'; static DETECT_PROBLEMS = 'DETECT_PROBLEMS'; static ENRICH_NODE_TEMPLATES = 'ENRICH_NODE_TEMPLATES'; @@ -53,6 +56,11 @@ export class TopologyRendererActions { static PLACE_COMPONENTS = 'PLACE_COMPONENTS'; static MANAGE_YAML_POLICIES = 'MANAGE_YAML_POLICIES'; static TOGGLE_VERSION_SLIDER = 'TOGGLE_VERSION_SLIDER'; + static SHOW_MANAGE_YAML_GROUPS = 'SHOW_MANAGE_YAML_GROUPS'; + static TOGGLE_MANAGE_YAML_GROUPS = 'TOGGLE_MANAGE_YAML_GROUPS'; + static TOGGLE_YAML_GROUPS = 'TOGGLE_YAML_GROUPS'; + static TOGGLE_MANAGE_PARTICIPANTS = 'TOGGLE_MANAGE_PARTICIPANTS'; + static TOGGLE_ASSIGN_PARTICIPANTS = 'TOGGLE_ASSIGN_PARTICIPANTS'; togglePolicies(): Action { return { type: TopologyRendererActions.TOGGLE_POLICIES }; @@ -130,6 +138,18 @@ export class TopologyRendererActions { return { type: TopologyRendererActions.REFINE_TOPOLOGY }; } + extractLDM(): Action { + return { type: TopologyRendererActions.EXTRACT_LDM }; + } + + generatePlaceholder(): Action { + return { type: TopologyRendererActions.GENERATE_GDM }; + } + + generatePlaceholderSubs(): Action { + return { type: TopologyRendererActions.GENERATE_PLACEHOLDER_SUBS }; + } + refinePatterns(): Action { return { type: TopologyRendererActions.REFINE_PATTERNS }; } @@ -170,4 +190,24 @@ export class TopologyRendererActions { toggleVersionSlider(): Action { return { type: TopologyRendererActions.TOGGLE_VERSION_SLIDER }; } + + showManageYamlGroups(): Action { + return { type: TopologyRendererActions.SHOW_MANAGE_YAML_GROUPS }; + } + + toggleManageYamlGroups(): Action { + return { type: TopologyRendererActions.TOGGLE_MANAGE_YAML_GROUPS }; + } + + toggleYamlGroups(): Action { + return { type: TopologyRendererActions.TOGGLE_YAML_GROUPS }; + } + + toggleManageParticipants(): Action { + return { type: TopologyRendererActions.TOGGLE_MANAGE_PARTICIPANTS }; + } + + toggleAssignParticipants(): Action { + return { type: TopologyRendererActions.TOGGLE_ASSIGN_PARTICIPANTS }; + } } diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/redux/actions/winery.actions.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/redux/actions/winery.actions.ts index c6f16e6b1b..2bab50da51 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/redux/actions/winery.actions.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/redux/actions/winery.actions.ts @@ -14,10 +14,14 @@ import { Action, ActionCreator } from 'redux'; import { Injectable } from '@angular/core'; -import { TArtifact, TNodeTemplate, TRelationshipTemplate } from '../../models/ttopology-template'; +import { + OTParticipant, TArtifact, TGroupDefinition, TNodeTemplate, TRelationshipTemplate +} from '../../models/ttopology-template'; import { TDeploymentArtifact } from '../../models/artifactsModalData'; import { TPolicy } from '../../models/policiesModalData'; import { Visuals } from '../../models/visuals'; +import { DetailsSidebarState } from '../../sidebars/node-details/node-details-sidebar'; +import { EntityTypesModel } from '../../models/entityTypesModel'; export interface SendPaletteOpenedAction extends Action { paletteOpened: boolean; @@ -28,21 +32,14 @@ export interface HideNavBarAndPaletteAction extends Action { } export interface SidebarStateAction extends Action { - sidebarContents: { - sidebarVisible: boolean, - nodeClicked: boolean, - id: string, - nameTextFieldValue: string, - type: string, - minInstances: string, - maxInstances: string, - properties: string, - source: string, - target: string - }; + sidebarContents: DetailsSidebarState; } -export interface SidebarNodeNamechange extends Action { +export interface AddEntityTypesAction extends Action { + types: EntityTypesModel; +} + +export interface SidebarChangeNodeName extends Action { nodeNames: { newNodeName: string, id: string @@ -115,14 +112,19 @@ export interface UpdateRelationshipNameAction extends Action { } export interface SetPropertyAction extends Action { - nodeProperty: { - newProperty: any, - propertyType: string, - nodeId: string, + propertyData: { + newProperty: { + propertyType: string, + properties?: any[], + kvproperties?: any[], + any?: any + }, + nodeId?: string, + relationId?: string }; } -export interface SetCababilityAction extends Action { +export interface SetCapabilityAction extends Action { nodeCapability: { nodeId: string, color: string, @@ -185,6 +187,19 @@ export interface ChangeYamlPoliciesAction extends Action { }; } +export interface UpdateParticipantsAction extends Action { + participants: OTParticipant[]; +} + +export interface AssignParticipantAction extends Action { + node: TNodeTemplate; + participant: string; +} + +export interface UpdateGroupDefinitionAction extends Action { + groups: TGroupDefinition[]; +} + export interface SetTargetLocation extends Action { nodeTargetLocation: { nodeId: string, @@ -225,10 +240,9 @@ export class WineryActions { static UPDATE_REL_DATA = 'UPDATE_REL_DATA'; static CHANGE_MIN_INSTANCES = 'CHANGE_MIN_INSTANCES'; static CHANGE_MAX_INSTANCES = 'CHANGE_MAX_INSTANCES'; - + static ADD_ENTITY_TYPES = 'ADD_ENTITY_TYPES'; static INC_MIN_INSTANCES = 'INC_MIN_INSTANCES'; static DEC_MIN_INSTANCES = 'DEC_MIN_INSTANCES'; - static INC_MAX_INSTANCES = 'INC_MAX_INSTANCES'; static DEC_MAX_INSTANCES = 'DEC_MAX_INSTANCES'; static SET_PROPERTY = 'SET_PROPERTY'; @@ -245,6 +259,14 @@ export class WineryActions { static DELETE_POLICY = 'DELETE_POLICY'; static SEND_CURRENT_NODE_ID = 'SEND_CURRENT_NODE_ID'; static SET_NODE_VISUALS = 'SET_NODE_VISUALS'; + static UPDATE_GROUP_DEFINITIONS = 'UPDATE_GROUP_DEFINITIONS'; + static UPDATE_PARTICIPANTS = 'UPDATE_PARTICIPANTS'; + static ASSIGN_PARTICIPANT = 'ASSIGN_PARTICIPANT'; + + addEntityTypes: ActionCreator = ((entityTypes) => ({ + type: WineryActions.ADD_ENTITY_TYPES, + types: entityTypes, + })); sendPaletteOpened: ActionCreator = ((paletteOpened) => ({ @@ -261,7 +283,7 @@ export class WineryActions { type: WineryActions.OPEN_SIDEBAR, sidebarContents: newSidebarData.sidebarContents })); - changeNodeName: ActionCreator = + changeNodeName: ActionCreator = ((nodeNames) => ({ type: WineryActions.CHANGE_NODE_NAME, nodeNames: nodeNames.nodeNames @@ -327,12 +349,11 @@ export class WineryActions { relData: currentRelData.relData })); setProperty: ActionCreator = - ((newProperty) => ({ + ((data) => ({ type: WineryActions.SET_PROPERTY, - nodeProperty: newProperty.nodeProperty, - propertyType: newProperty.propertyType + propertyData: data, })); - setCapability: ActionCreator = + setCapability: ActionCreator = ((newCapability) => ({ type: WineryActions.SET_CAPABILITY, nodeCapability: newCapability @@ -381,6 +402,22 @@ export class WineryActions { } } })); + updateGroupDefinitions: ActionCreator = + ((groups) => ({ + type: WineryActions.UPDATE_GROUP_DEFINITIONS, + groups, + })); + updateParticipants: ActionCreator = + ((participants) => ({ + type: WineryActions.UPDATE_PARTICIPANTS, + participants, + })); + assignParticipant: ActionCreator = + ((node, participant) => ({ + type: WineryActions.ASSIGN_PARTICIPANT, + node: node, + participant: participant, + })); setTargetLocation: ActionCreator = ((newTargetLocation) => ({ type: WineryActions.SET_TARGET_LOCATION, diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/redux/reducers/topologyRenderer.reducer.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/redux/reducers/topologyRenderer.reducer.ts index a0142d190d..b8c70eb82d 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/redux/reducers/topologyRenderer.reducer.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/redux/reducers/topologyRenderer.reducer.ts @@ -38,12 +38,19 @@ export interface TopologyRendererState { refinePatternsButton?: boolean; refineTopologyButton?: boolean; refineTopologyWithTestsButton?: boolean; + generateGDM?: boolean; + extractLDM?: boolean; + generatePlaceholderSubs?: boolean; determineStatefulComponents?: boolean; determineFreezableComponentsButton?: boolean; cleanFreezableComponentsButton?: boolean; placeComponentsButton?: boolean; manageYamlPoliciesButton?: boolean; versionSliderButton?: boolean; + manageYamlGroupsButton?: boolean; + yamlGroupsButton?: boolean; + manageParticipantsButton?: boolean; + assignParticipantsButton?: boolean; }; nodesToSelect?: string[]; } @@ -72,12 +79,18 @@ export const INITIAL_TOPOLOGY_RENDERER_STATE: TopologyRendererState = { refineTopologyButton: false, refineTopologyWithTestsButton: false, determineStatefulComponents: false, + generateGDM: false, + extractLDM: false, + generatePlaceholderSubs: false, determineFreezableComponentsButton: false, cleanFreezableComponentsButton: false, placeComponentsButton: false, manageYamlPoliciesButton: false, - versionSliderButton: false - } + versionSliderButton: false, + manageYamlGroupsButton: false, + yamlGroupsButton: false, + manageParticipantsButton: false, + }, }; /** * Reducer for the TopologyRenderer @@ -85,6 +98,46 @@ export const INITIAL_TOPOLOGY_RENDERER_STATE: TopologyRendererState = { export const TopologyRendererReducer = function (lastState: TopologyRendererState = INITIAL_TOPOLOGY_RENDERER_STATE, action: Action): TopologyRendererState { switch (action.type) { + case TopologyRendererActions.TOGGLE_YAML_GROUPS: + return { + ...lastState, + buttonsState: { + ...lastState.buttonsState, + yamlGroupsButton: !lastState.buttonsState.yamlGroupsButton + } + }; + case TopologyRendererActions.SHOW_MANAGE_YAML_GROUPS: + return { + ...lastState, + buttonsState: { + ...lastState.buttonsState, + manageYamlGroupsButton: true + } + }; + case TopologyRendererActions.TOGGLE_MANAGE_YAML_GROUPS: + return { + ...lastState, + buttonsState: { + ...lastState.buttonsState, + manageYamlGroupsButton: !lastState.buttonsState.manageYamlGroupsButton + } + }; + case TopologyRendererActions.TOGGLE_MANAGE_PARTICIPANTS: + return { + ...lastState, + buttonsState: { + ...lastState.buttonsState, + manageParticipantsButton: !lastState.buttonsState.manageParticipantsButton + } + }; + case TopologyRendererActions.TOGGLE_ASSIGN_PARTICIPANTS: + return { + ...lastState, + buttonsState: { + ...lastState.buttonsState, + assignParticipantsButton: !lastState.buttonsState.assignParticipantsButton + } + }; case TopologyRendererActions.TOGGLE_POLICIES: return { ...lastState, @@ -109,6 +162,14 @@ export const TopologyRendererReducer = propertiesButton: !lastState.buttonsState.propertiesButton } }; + case TopologyRendererActions.EXTRACT_LDM: + return { + ...lastState, + buttonsState: { + ...lastState.buttonsState, + extractLDM: !lastState.buttonsState.extractLDM + } + }; case TopologyRendererActions.TOGGLE_REQUIREMENTS_CAPABILITIES: return { ...lastState, @@ -253,6 +314,22 @@ export const TopologyRendererReducer = refineTopologyWithTestsButton: !lastState.buttonsState.refineTopologyWithTestsButton } }; + case TopologyRendererActions.GENERATE_GDM: + return { + ...lastState, + buttonsState: { + ...lastState.buttonsState, + generateGDM: !lastState.buttonsState.generateGDM + } + }; + case TopologyRendererActions.GENERATE_PLACEHOLDER_SUBS: + return { + ...lastState, + buttonsState: { + ...lastState.buttonsState, + generatePlaceholderSubs: !lastState.buttonsState.generatePlaceholderSubs + } + }; case TopologyRendererActions.HIGHLIGHT_NODES: const data = action; if (data.nodesToHighlight) { diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/redux/reducers/winery.reducer.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/redux/reducers/winery.reducer.ts index 269c391ea8..2e21999453 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/redux/reducers/winery.reducer.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/redux/reducers/winery.reducer.ts @@ -14,37 +14,46 @@ import { Action } from 'redux'; import { - ChangeYamlPoliciesAction, DecMaxInstances, DecMinInstances, DeleteDeploymentArtifactAction, DeleteNodeAction, DeletePolicyAction, DeleteRelationshipAction, - DeleteYamlArtifactAction, HideNavBarAndPaletteAction, IncMaxInstances, IncMinInstances, SaveNodeTemplateAction, SaveRelationshipAction, - SendCurrentNodeIdAction, SendPaletteOpenedAction, SetCababilityAction, SetDeploymentArtifactAction, SetNodeVisuals, SetPolicyAction, SetPropertyAction, - SetRequirementAction, SetTargetLocation, SetYamlArtifactAction, SidebarMaxInstanceChanges, SidebarMinInstanceChanges, SidebarNodeNamechange, - SidebarStateAction, UpdateNodeCoordinatesAction, UpdateRelationshipNameAction, WineryActions + AddEntityTypesAction, AssignParticipantAction, ChangeYamlPoliciesAction, DecMaxInstances, DecMinInstances, + DeleteDeploymentArtifactAction, DeleteNodeAction, DeletePolicyAction, DeleteRelationshipAction, + DeleteYamlArtifactAction, HideNavBarAndPaletteAction, IncMaxInstances, IncMinInstances, SaveNodeTemplateAction, + SaveRelationshipAction, SendCurrentNodeIdAction, SendPaletteOpenedAction, SetCapabilityAction, + SetDeploymentArtifactAction, SetNodeVisuals, SetPolicyAction, SetPropertyAction, SetRequirementAction, + SetTargetLocation, SetYamlArtifactAction, SidebarChangeNodeName, SidebarMaxInstanceChanges, + SidebarMinInstanceChanges, SidebarStateAction, UpdateGroupDefinitionAction, UpdateNodeCoordinatesAction, + UpdateParticipantsAction, UpdateRelationshipNameAction, WineryActions } from '../actions/winery.actions'; import { TArtifact, TNodeTemplate, TRelationshipTemplate, TTopologyTemplate } from '../../models/ttopology-template'; import { TDeploymentArtifact } from '../../models/artifactsModalData'; import { Visuals } from '../../models/visuals'; +import { DetailsSidebarState } from '../../sidebars/node-details/node-details-sidebar'; +import { EntityTypesModel } from '../../models/entityTypesModel'; export interface WineryState { currentPaletteOpenedState: boolean; hideNavBarAndPaletteState: boolean; - sidebarContents: any; + sidebarContents: DetailsSidebarState; currentJsonTopology: TTopologyTemplate; currentNodeData: any; nodeVisuals: Visuals[]; + entityTypes?: EntityTypesModel; } export const INITIAL_WINERY_STATE: WineryState = { currentPaletteOpenedState: true, hideNavBarAndPaletteState: false, sidebarContents: { - sidebarVisible: false, + visible: false, nodeClicked: false, - id: '', - nameTextFieldValue: '', - type: '', + template: { + id: '', + name: '', + type: '', + properties: '', + }, + relationshipTemplate: undefined, minInstances: 1, maxInstances: 1, - properties: '', source: '', target: '' }, @@ -62,6 +71,11 @@ export const INITIAL_WINERY_STATE: WineryState = { export const WineryReducer = function (lastState: WineryState = INITIAL_WINERY_STATE, action: Action): WineryState { switch (action.type) { + case WineryActions.ADD_ENTITY_TYPES: + return { + ...lastState, + entityTypes: (action).types, + }; case WineryActions.SEND_PALETTE_OPENED: const paletteOpened: boolean = (action).paletteOpened; @@ -77,7 +91,7 @@ export const WineryReducer = hideNavBarAndPaletteState: hideNavBarAndPalette }; case WineryActions.OPEN_SIDEBAR: - const newSidebarData: any = (action).sidebarContents; + const newSidebarData: DetailsSidebarState = (action).sidebarContents; return { ...lastState, @@ -86,8 +100,6 @@ export const WineryReducer = case WineryActions.CHANGE_MIN_INSTANCES: const sideBarNodeId: any = (action).minInstances.id; const minInstances: any = (action).minInstances.count; - const indexChangeMinInstances = lastState.currentJsonTopology.nodeTemplates.map(el => el.id).indexOf(sideBarNodeId); - const fool = true; return { ...lastState, @@ -101,8 +113,6 @@ export const WineryReducer = case WineryActions.CHANGE_MAX_INSTANCES: const sideBarNodeId2: any = (action).maxInstances.id; const maxInstances: any = (action).maxInstances.count; - const indexChangeMaxInstances = lastState.currentJsonTopology.nodeTemplates - .map(el => el.id).indexOf(sideBarNodeId2); return { ...lastState, @@ -165,6 +175,20 @@ export const WineryReducer = ) } }; + case WineryActions.ASSIGN_PARTICIPANT: + const node = (action).node; + const participant = (action).participant; + return { + ...lastState, + currentJsonTopology: { + ...lastState.currentJsonTopology, + nodeTemplates: lastState.currentJsonTopology.nodeTemplates + .map(nodeTemplate => nodeTemplate.id === node.id ? + nodeTemplate.generateNewNodeTemplateWithUpdatedAttribute('participant', participant) + : nodeTemplate + ) + } + }; case WineryActions.DEC_MAX_INSTANCES: const id_decMaxInstances: any = (action).maxInstances.id; const indexDecMaxInstances = lastState.currentJsonTopology.nodeTemplates @@ -199,22 +223,37 @@ export const WineryReducer = } }; case WineryActions.SET_PROPERTY: - const newProperty: any = (action).nodeProperty; - - return { - ...lastState, - currentJsonTopology: { - ...lastState.currentJsonTopology, - nodeTemplates: lastState.currentJsonTopology.nodeTemplates - .map(nodeTemplate => nodeTemplate.id === newProperty.nodeId ? - nodeTemplate.generateNewNodeTemplateWithUpdatedAttribute('properties', - newProperty.propertyType === 'KV' ? - { kvproperties: newProperty.newProperty } : { any: newProperty.newProperty }) : nodeTemplate - ) - } - }; + const update = (action).propertyData; + + if (update.nodeId !== undefined) { + return { + ...lastState, + currentJsonTopology: { + ...lastState.currentJsonTopology, + nodeTemplates: lastState.currentJsonTopology.nodeTemplates + .map(nodeTemplate => nodeTemplate.id === update.nodeId + ? nodeTemplate.generateNewNodeTemplateWithUpdatedAttribute('properties', update.newProperty) + : nodeTemplate + ) + } + }; + } else if (update.relationId !== undefined) { + return { + ...lastState, + currentJsonTopology: { + ...lastState.currentJsonTopology, + relationshipTemplates: lastState.currentJsonTopology.relationshipTemplates + .map(relationshipTemplate => relationshipTemplate.id === update.relationId + ? relationshipTemplate.generateNewRelTemplateWithUpdatedAttribute('properties', update.newProperty) + : relationshipTemplate + ) + } + }; + } else { + return lastState; + } case WineryActions.SET_CAPABILITY: - const newCapability: any = (action).nodeCapability; + const newCapability: any = (action).nodeCapability; return { ...lastState, @@ -233,7 +272,7 @@ export const WineryReducer = const newDepArt: any = (action).nodeDeploymentArtifact; const newDeploymentArtifact: TDeploymentArtifact = newDepArt.newDeploymentArtifact; const indexOfNodeDepArt = lastState.currentJsonTopology.nodeTemplates - .map(node => node.id).indexOf(newDepArt.nodeId); + .map(n => n.id).indexOf(newDepArt.nodeId); const nodeDepArtTemplate = lastState.currentJsonTopology.nodeTemplates .find(nodeTemplate => nodeTemplate.id === newDepArt.nodeId); const depArtExist = nodeDepArtTemplate.deploymentArtifacts && nodeDepArtTemplate.deploymentArtifacts.deploymentArtifact; @@ -262,7 +301,7 @@ export const WineryReducer = const newArtActionData: any = (action).nodeYamlArtifact; const newYamlArtifact: TArtifact = newArtActionData.newYamlArtifact; const indexOfContainingNodeTemplate = lastState.currentJsonTopology.nodeTemplates - .map(node => node.id).indexOf(newArtActionData.nodeId); + .map(n => n.id).indexOf(newArtActionData.nodeId); const containingNodeTemplate = lastState.currentJsonTopology.nodeTemplates .find(nodeTemplate => nodeTemplate.id === newArtActionData.nodeId); const artifactsExistInNodeTemplate = containingNodeTemplate.artifacts && containingNodeTemplate.artifacts.artifact; @@ -292,9 +331,7 @@ export const WineryReducer = case WineryActions.DELETE_DEPLOYMENT_ARTIFACT: const deletedDeploymentArtifact: any = (action).nodeDeploymentArtifact.deletedDeploymentArtifact; const indexOfNodeWithDeletedDeploymentArtifact = lastState.currentJsonTopology.nodeTemplates - .map((node) => { - return node.id; - }) + .map((n) => n.id) .indexOf((action).nodeDeploymentArtifact.nodeId); return { @@ -317,7 +354,7 @@ export const WineryReducer = case WineryActions.DELETE_YAML_ARTIFACT: const deletedYamlArtifactId: any = (action).nodeYamlArtifact.deletedYamlArtifactId; const indexOfNodeWithDeletedYamlArtifact = lastState.currentJsonTopology.nodeTemplates - .map(node => node.id) + .map(n => n.id) .indexOf((action).nodeYamlArtifact.nodeId); return { @@ -342,7 +379,7 @@ export const WineryReducer = const newPolicy: any = (action).nodePolicy; const policy = newPolicy.newPolicy; const indexOfNodePolicy = lastState.currentJsonTopology.nodeTemplates - .map(node => node.id).indexOf(newPolicy.nodeId); + .map(n => n.id).indexOf(newPolicy.nodeId); const nodePolicyTemplate = lastState.currentJsonTopology.nodeTemplates .find(nodeTemplate => nodeTemplate.id === newPolicy.nodeId); const policyExist = nodePolicyTemplate.policies && nodePolicyTemplate.policies.policy; @@ -375,12 +412,27 @@ export const WineryReducer = policies: (action).yamlPolicies.policies } }; - + case WineryActions.UPDATE_GROUP_DEFINITIONS: + return { + ...lastState, + currentJsonTopology: { + ...lastState.currentJsonTopology, + groups: (action).groups + } + }; + case WineryActions.UPDATE_PARTICIPANTS: + return { + ...lastState, + currentJsonTopology: { + ...lastState.currentJsonTopology, + participants: (action).participants + } + }; case WineryActions.SET_POLICY_FOR_RELATIONSHIP: const newRelPolicy: any = (action).nodePolicy; const relPolicy = newRelPolicy.newPolicy; const indexOfRelationshipPolicy = lastState.currentJsonTopology.relationshipTemplates - .map(node => node.id).indexOf(newRelPolicy.nodeId); + .map(n => n.id).indexOf(newRelPolicy.nodeId); const relationshipPolicyTemplate = lastState.currentJsonTopology.relationshipTemplates .find(relationshipTemplate => relationshipTemplate.id === newRelPolicy.nodeId); const policyExistCheck = relationshipPolicyTemplate.policies && relationshipPolicyTemplate.policies.policy; @@ -422,9 +474,7 @@ export const WineryReducer = case WineryActions.DELETE_POLICY: const deletedPolicy: any = (action).nodePolicy.deletedPolicy; const indexOfNodeWithDeletedPolicy = lastState.currentJsonTopology.nodeTemplates - .map((node) => { - return node.id; - }) + .map((n) => n.id) .indexOf((action).nodePolicy.nodeId); return { @@ -445,9 +495,7 @@ export const WineryReducer = } }; case WineryActions.CHANGE_NODE_NAME: - const newNodeName: any = (action).nodeNames; - const indexChangeNodeName = lastState.currentJsonTopology.nodeTemplates - .map(el => el.id).indexOf(newNodeName.id); + const newNodeName: any = (action).nodeNames; return { ...lastState, @@ -467,8 +515,6 @@ export const WineryReducer = x: currentNodeCoordinates.x, y: currentNodeCoordinates.y }; - const indexUpdateNodeCoordinates = lastState.currentJsonTopology.nodeTemplates - .map(nodeTemplate => nodeTemplate.id).indexOf(nodeId); return { ...lastState, @@ -514,7 +560,7 @@ export const WineryReducer = relationshipTemplate.targetElement.ref !== deletedNodeId), // we check if the targets of YAML policies include the deleted node template< policies: { - policy: lastState.currentJsonTopology.policies.policy.map(pol => { + policy: lastState.currentJsonTopology.policies.policy && lastState.currentJsonTopology.policies.policy.map(pol => { if (pol.targets) { pol.targets = pol.targets.filter(target => target !== deletedNodeId); // to keep a consistent behavior, if no targets remain, remove the field. @@ -522,10 +568,14 @@ export const WineryReducer = pol.targets = undefined; } } - return pol; }) - } + }, + // update groups + groups: lastState.currentJsonTopology.groups && lastState.currentJsonTopology.groups.map((group) => { + group.members = group.members.filter((member) => member !== deletedNodeId); + return group; + }), } }; case WineryActions.DELETE_RELATIONSHIP_TEMPLATE: @@ -541,8 +591,6 @@ export const WineryReducer = }; case WineryActions.UPDATE_REL_DATA: const relData: any = (action).relData; - const indexRel = lastState.currentJsonTopology.relationshipTemplates - .map(rel => rel.id).indexOf(relData.id); return { ...lastState, diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/redux/store/winery.store.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/redux/store/winery.store.ts index 03c82716ce..0809cb92c5 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/redux/store/winery.store.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/redux/store/winery.store.ts @@ -14,9 +14,7 @@ import { combineReducers, Reducer } from 'redux'; import { INITIAL_WINERY_STATE, WineryReducer, WineryState } from '../reducers/winery.reducer'; -import { - INITIAL_TOPOLOGY_RENDERER_STATE, TopologyRendererReducer, TopologyRendererState -} from '../reducers/topologyRenderer.reducer'; +import { INITIAL_TOPOLOGY_RENDERER_STATE, TopologyRendererReducer, TopologyRendererState } from '../reducers/topologyRenderer.reducer'; /** * The topology modeler has one store for all data. diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/services/backend.service.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/services/backend.service.ts index 0e995b1811..45a22604e4 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/services/backend.service.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/services/backend.service.ts @@ -14,8 +14,9 @@ import { Injectable } from '@angular/core'; import { Subject } from 'rxjs/Subject'; -import { isNullOrUndefined } from 'util'; -import { EntityType, TTopologyTemplate } from '../models/ttopology-template'; +import { + Entity, EntityType, TArtifactType, TDataType, TPolicyType, TTopologyTemplate, VisualEntityType +} from '../models/ttopology-template'; import { QNameWithTypeApiData } from '../models/generateArtifactApiData'; import { HttpClient, HttpHeaders, HttpResponse } from '@angular/common/http'; import { urlElement } from '../models/enums'; @@ -23,7 +24,7 @@ import { ServiceTemplateId } from '../models/serviceTemplateId'; import { ToscaDiff } from '../models/ToscaDiff'; import { ToastrService } from 'ngx-toastr'; import { Observable } from 'rxjs/Observable'; -import { concat, forkJoin } from 'rxjs'; +import { BehaviorSubject, concat, forkJoin, of } from 'rxjs'; import { TopologyModelerConfiguration } from '../models/topologyModelerConfiguration'; import { ErrorHandlerService } from './error-handler.service'; import { ThreatCreation } from '../models/threatCreation'; @@ -33,7 +34,9 @@ import { VersionElement } from '../models/versionElement'; import { WineryRepositoryConfigurationService } from '../../../../tosca-management/src/app/wineryFeatureToggleModule/WineryRepositoryConfiguration.service'; import { takeLast } from 'rxjs/operators'; import { TPolicy } from '../models/policiesModalData'; -import { backendBaseURL } from '../../../../tosca-management/src/app/configuration'; +import { EntityTypesModel } from '../models/entityTypesModel'; +import { ToscaUtils } from '../models/toscaUtils'; +import { TopologyTemplateUtil } from '../models/topologyTemplateUtil'; /** * Responsible for interchanging data between the app and the server. @@ -47,193 +50,305 @@ export class BackendService { serviceTemplateURL: string; serviceTemplateUiUrl: string; - endpointConfiguration = new Subject(); - endpointConfiguration$ = this.endpointConfiguration.asObservable(); + private loaded = new Subject(); + loaded$ = this.loaded.asObservable(); - private allEntities = new Subject(); - allEntities$ = this.allEntities.asObservable(); + // use stored model to aggregate data + private storedModel: EntityTypesModel = new EntityTypesModel(); + // BehaviourSubject allows caching the latest value for subscribers + model$ = new BehaviorSubject(this.storedModel); + + // TODO avoid splitting the stored data into four different subjects including a loaded state + private topologyTemplate: TTopologyTemplate; + private topTemplate = new Subject(); + topTemplate$ = this.topTemplate.asObservable(); + + private topologyDifferences: [ToscaDiff, TTopologyTemplate]; + private topDiff = new Subject<[ToscaDiff, TTopologyTemplate]>(); + topDiff$ = this.topDiff.asObservable(); constructor(private http: HttpClient, private alert: ToastrService, private errorHandler: ErrorHandlerService, private configurationService: WineryRepositoryConfigurationService) { - this.endpointConfiguration$.subscribe((params: TopologyModelerConfiguration) => { - if (!(isNullOrUndefined(params.id) && isNullOrUndefined(params.ns) && - isNullOrUndefined(params.repositoryURL) && isNullOrUndefined(params.uiURL))) { - - this.configuration = new TopologyModelerConfiguration( - params.id, - params.ns, - params.repositoryURL, - params.uiURL, - params.compareTo, - params.compareTo ? true : params.isReadonly, - params.parentPath, - params.elementPath, - params.topologyProDecURL - ); - - const url = this.configuration.parentPath + '/' - + encodeURIComponent(encodeURIComponent(this.configuration.ns)) + '/' - + this.configuration.id; - this.serviceTemplateURL = this.configuration.repositoryURL + '/' + url; - this.serviceTemplateUiUrl = this.configuration.uiURL + url; - - // All Entity types - this.requestAllEntitiesAtOnce().subscribe(data => { - // add JSON to Promise, WineryComponent will subscribe to its Observable - this.allEntities.next(data); - }); - } - }); } - /** - * Requests all entities together. - * We use forkJoin() to await all responses from the backend. - * This is required - */ - private requestAllEntitiesAtOnce(): Observable { - if (this.configuration) { - return forkJoin( - this.requestGroupedNodeTypes(), - this.requestArtifactTemplates(), - this.requestTopologyTemplateAndVisuals(), - this.requestArtifactTypes(), - this.requestPolicyTypes(), - this.requestCapabilityTypes(), - this.requestRequirementTypes(), - this.requestPolicyTemplates(), - this.requestRelationshipTypes(), - this.requestNodeTypes(), - this.requestVersionElements(), - this.configurationService.getConfigurationFromBackend(this.configuration.repositoryURL) + public configure(params: TopologyModelerConfiguration) { + if (params.id && params.ns && params.repositoryURL && params.uiURL) { + this.configuration = new TopologyModelerConfiguration( + params.id, + params.ns, + params.repositoryURL, + params.uiURL, + params.compareTo, + params.compareTo ? true : params.isReadonly, + params.parentPath, + params.elementPath, + params.topologyProDecURL ); - } - } - - /** - * Requests topologyTemplate and visualappearances together. If the topology should be compared, it also gets - * the old topology as well as the diff representation. - * We use Observable.forkJoin to await all responses from the backend. - * This is required - */ - private requestTopologyTemplateAndVisuals(): Observable { - if (this.configuration) { - const nodeVisualsUrl = this.configuration.repositoryURL + '/nodetypes/allvisualappearancedata'; - const relationshipVisualsUrl = this.configuration.repositoryURL + '/relationshiptypes/allvisualappearancedata'; - const policyVisualsUrl = this.configuration.repositoryURL + '/policytemplates/allvisualappearancedata'; - const policyTypesVisualsUrl = this.configuration.repositoryURL + '/policytypes/allvisualappearancedata'; - // This is required because the information has to be returned together - if (isNullOrUndefined(this.configuration.compareTo)) { - return forkJoin( - this.http.get(this.configuration.elementUrl), - this.http.get(nodeVisualsUrl), - this.http.get(relationshipVisualsUrl), - this.http.get(policyVisualsUrl), - this.http.get(policyTypesVisualsUrl), - ); - } else { - const url = this.configuration.repositoryURL + '/' + this.configuration.parentPath + '/' - + encodeURIComponent(encodeURIComponent(this.configuration.ns)) + '/'; - const compareUrl = url - + this.configuration.id + '/?compareTo=' - + this.configuration.compareTo; - const templateUrl = url - + this.configuration.compareTo + '/topologytemplate'; + const url = this.configuration.parentPath + '/' + + encodeURIComponent(encodeURIComponent(this.configuration.ns)) + '/' + + this.configuration.id; + this.serviceTemplateURL = this.configuration.repositoryURL + '/' + url; + this.serviceTemplateUiUrl = this.configuration.uiURL + url; - return forkJoin( - this.http.get(this.configuration.elementUrl), - this.http.get(nodeVisualsUrl), - this.http.get(relationshipVisualsUrl), - this.http.get(policyVisualsUrl), - this.http.get(policyTypesVisualsUrl), - this.http.get(compareUrl), - this.http.get(templateUrl) - ); - } + // All Entity types + this.requestAllEntitiesAtOnce().subscribe(r => this.handleAllEntitiesResult(r)); } } - /** - * Requests all policy types from the backend - */ - private requestPolicyTypes(): Observable { - if (this.configuration) { - return this.http.get(this.configuration.repositoryURL + '/policytypes?full', { headers: this.headers }); + private handleAllEntitiesResult(results: [any, any, boolean]) { + const templateAndVisuals = results[0]; + + this.topologyTemplate = BackendService.patchProperties(templateAndVisuals[0]); + const visuals = templateAndVisuals[1]; + const diff = templateAndVisuals[2]; + + this.storedModel.nodeVisuals = visuals[0]; + this.storedModel.relationshipVisuals = visuals[1]; + this.storedModel.policyTemplateVisuals = visuals[2]; + this.storedModel.policyTypeVisuals = visuals[3]; + this.topologyDifferences = diff; + // FIXME EWWWWW! + if (this.topologyDifferences[0] !== undefined && this.topologyDifferences[1] !== undefined) { + this.topDiff.next(this.topologyDifferences); } - } - /** - * Requests all requirement types from the backend - */ - private requestRequirementTypes(): Observable { - if (this.configuration) { - return this.http.get(this.configuration.repositoryURL + '/requirementtypes?full', { headers: this.headers }); - } - } - - /** - * Requests all capability types from the backend - */ - private requestCapabilityTypes(): Observable { - if (this.configuration) { - return this.http.get(this.configuration.repositoryURL + '/capabilitytypes?full', { headers: this.headers }); - } - } - - /** - * Requests all grouped node types from the backend - */ - private requestGroupedNodeTypes(): Observable { - if (this.configuration) { - return this.http.get(this.configuration.repositoryURL + '/nodetypes?grouped&full', { headers: this.headers }); + // entity types are encapsulated in a separate forkJoin + const entityTypes = results[1]; + this.initEntityType(entityTypes[0], 'groupedNodeTypes'); + this.initEntityType(entityTypes[1], 'artifactTemplates'); + this.initEntityType(entityTypes[2], 'artifactTypes'); + this.initEntityType(entityTypes[3], 'policyTypes'); + this.initEntityType(entityTypes[4], 'capabilityTypes'); + this.initEntityType(entityTypes[5], 'requirementTypes'); + this.initEntityType(entityTypes[6], 'policyTemplates'); + this.initEntityType(entityTypes[7], 'relationshipTypes'); + this.initEntityType(entityTypes[8], 'unGroupedNodeTypes'); + this.initEntityType(entityTypes[9], 'versionElements'); + + // handle YAML specifics + if (this.configurationService.isYaml()) { + this.initEntityType(entityTypes[10], 'dataTypes'); + // init YAML policies if they exist + if (this.topologyTemplate.policies) { + this.initEntityType(this.topologyTemplate.policies.policy, 'yamlPolicies'); + } else { + this.initEntityType([], 'yamlPolicies'); + } } - } - /** - * Requests all ungrouped node types from the backend - */ - private requestNodeTypes(): Observable { - if (this.configuration) { - return this.http.get(this.configuration.repositoryURL + '/nodetypes?full', { headers: this.headers }); - } + this.model$.next(this.storedModel); + // FIXME there is currently some temporal coupling in winery component that requires us to push the model before the topologyTemplate + this.topTemplate.next(this.topologyTemplate); + this.loaded.next(true); } /** - * Requests all artifact types from the backend - */ - private requestArtifactTypes(): Observable { - if (this.configuration) { - return this.http.get(this.configuration.repositoryURL + '/artifacttypes?full', { headers: this.headers }); - } - } - - /** - * Requests all artifact templates from the backend + * Requests all entities together. + * We use forkJoin() to await all responses from the backend. + * This is required */ - requestArtifactTemplates(): Observable { + private requestAllEntitiesAtOnce(): Observable<[any, any, boolean]> { if (this.configuration) { - return this.http.get(this.configuration.repositoryURL + '/artifacttemplates', { headers: this.headers }); + // TODO latest rxjs allows passing a dictionary to forkJoin to get a strongly typed object instead + // that would allow us to change this mess to an Observable[TTopologyTemplate, EntityTypesModel, [ToscaDiff, TTopologyTemplate], boolean] + // or even encapsulate that complication into a single type + return forkJoin([ + forkJoin([ + this.requestTopologyTemplate(), + forkJoin([ + this.requestNodeVisuals(), + this.requestRelationshipVisuals(), + this.requestPolicyVisuals(), + this.requestPolicyTypesVisuals(), + ]), + this.requestTopologyDiff(), + ]), + forkJoin([ + this.requestGroupedNodeTypes(), + this.requestArtifactTemplates(), + this.requestArtifactTypes(), + this.requestPolicyTypes(), + this.requestCapabilityTypes(), + this.requestRequirementTypes(), + this.requestPolicyTemplates(), + this.requestRelationshipTypes(), + this.requestNodeTypes(), + this.requestVersionElements(), + this.requestDataTypes(), + ]), + this.configurationService.getConfigurationFromBackend(this.configuration.repositoryURL), + ]); } } /** - * Requests all policy templates from the backend + * Save the received Array of Entity Types inside the respective variables in the entityTypes array of arrays + * which is getting passed to the palette and the topology renderer */ - requestPolicyTemplates(): Observable { - if (this.configuration) { - return this.http.get(this.configuration.repositoryURL + '/policytemplates', { headers: this.headers }); + // FIXME push the mappings here into the request methods instead and strongly type the observable they yield + private initEntityType(entityTypeJSON: Array, entityType: string): void { + if (!entityTypeJSON || entityTypeJSON.length === 0) { + this.alert.info('No ' + entityType + ' available!'); } - } - /** - * Requests all relationship types from the backend - */ - private requestRelationshipTypes(): Observable { - if (this.configuration) { - return this.http.get(this.configuration.repositoryURL + '/relationshiptypes?full', { headers: this.headers }); + switch (entityType) { + case 'yamlPolicies': { + this.storedModel.yamlPolicies = []; + entityTypeJSON.forEach(policy => { + this.storedModel.yamlPolicies.push( + new TPolicy( + policy.name, + policy.policyRef, + policy.policyType, + policy.any, + policy.documentation, + policy.otherAttributes, + policy.properties, + policy.targets) + ); + }); + break; + } + case 'artifactTypes': { + this.storedModel.artifactTypes = []; + entityTypeJSON.forEach(artifactType => { + + this.storedModel.artifactTypes + .push(new TArtifactType( + artifactType.id, + artifactType.qName, + artifactType.name, + artifactType.namespace, + artifactType.full, + artifactType.properties, + artifactType.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].mimeType, + artifactType.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].fileExtensions + )); + }); + break; + } + case 'artifactTemplates': { + this.storedModel.artifactTemplates = entityTypeJSON; + break; + } + case 'policyTypes': { + this.storedModel.policyTypes = []; + entityTypeJSON.forEach(element => { + const policyType = new TPolicyType(element.id, + element.qName, + element.name, + element.namespace, + element.properties, + element.full); + if (element.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].appliesTo) { + policyType.targets = element.full.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0].appliesTo + .nodeTypeReference.map(ntr => ntr.typeRef); + } + this.storedModel.policyTypes.push(policyType); + }); + break; + } + case 'capabilityTypes': { + this.storedModel.capabilityTypes = []; + entityTypeJSON.forEach(capabilityType => { + this.storedModel.capabilityTypes + .push(new EntityType( + capabilityType.id, + capabilityType.qName, + capabilityType.name, + capabilityType.namespace, + capabilityType.properties, + capabilityType.full + )); + }); + break; + } + case 'requirementTypes': { + this.storedModel.requirementTypes = []; + entityTypeJSON.forEach(requirementType => { + this.storedModel.requirementTypes + .push(new EntityType( + requirementType.id, + requirementType.qName, + requirementType.name, + requirementType.namespace, + requirementType.properties, + requirementType.full + )); + }); + break; + } + case 'policyTemplates': { + this.storedModel.policyTemplates = []; + entityTypeJSON.forEach(policyTemplate => { + this.storedModel.policyTemplates + .push(new Entity( + policyTemplate.id, + policyTemplate.qName, + policyTemplate.name, + policyTemplate.namespace + )); + }); + break; + } + case 'groupedNodeTypes': { + this.storedModel.groupedNodeTypes = entityTypeJSON; + break; + } + case 'versionElements': { + this.storedModel.versionElements = []; + entityTypeJSON.forEach((versionElements => { + this.storedModel.versionElements.push(new VersionElement(versionElements.qName, versionElements.versions)); + })); + break; + } + case 'unGroupedNodeTypes': { + this.storedModel.unGroupedNodeTypes = entityTypeJSON; + break; + } + case 'relationshipTypes': { + this.storedModel.relationshipTypes = []; + entityTypeJSON.forEach((relationshipType: EntityType) => { + const visuals = this.storedModel.relationshipVisuals + .find(value => value.typeId === relationshipType.qName); + this.storedModel.relationshipTypes + .push(new VisualEntityType( + relationshipType.id, + relationshipType.qName, + relationshipType.name, + relationshipType.namespace, + relationshipType.properties, + visuals.color, + relationshipType.full) + ); + }); + break; + } + case 'dataTypes': { + this.storedModel.dataTypes = []; + entityTypeJSON.forEach((dType: EntityType) => { + const definition = ToscaUtils.getDefinition(dType); + this.storedModel.dataTypes + .push(new TDataType( + dType.id, + dType.qName, + dType.name, + dType.namespace, + dType.properties, + dType.full, + definition.constraints, + definition.keySchema, + definition.entrySchema) + ); + }); + break; + } + default: { + console.log(`attempting to add unhandled entityTypes of type ${entityType}`); + } } } @@ -275,32 +390,9 @@ export class BackendService { */ saveTopologyTemplate(topologyTemplate: TTopologyTemplate): Observable> { if (this.configuration) { - // Initialization - const topologySkeleton = { - documentation: [], - any: [], - otherAttributes: {}, - relationshipTemplates: [], - nodeTemplates: [], - policies: { policy: new Array() } - }; - // Prepare for saving by updating the existing topology with the current topology state inside the Redux store - topologySkeleton.nodeTemplates = topologyTemplate.nodeTemplates; - topologySkeleton.relationshipTemplates = topologyTemplate.relationshipTemplates; - topologySkeleton.relationshipTemplates.map(relationship => { - delete relationship.state; - }); - // remove the 'Color' field from all nodeTemplates as the REST Api does not recognize it. - topologySkeleton.nodeTemplates.map(nodeTemplate => { - delete nodeTemplate.visuals; - delete nodeTemplate._state; - }); - topologySkeleton.policies = topologyTemplate.policies; - console.log(topologySkeleton); - const headers = new HttpHeaders().set('Content-Type', 'application/json'); return this.http.put(this.configuration.elementUrl, - topologySkeleton, + TopologyTemplateUtil.prepareSave(topologyTemplate), { headers: headers, responseType: 'text', observe: 'response' } ); } @@ -356,8 +448,7 @@ export class BackendService { * */ threatCreation(data: ThreatCreation): Observable { - const url = this.configuration.repositoryURL; - return this.http.post(url + '/threats', data, { responseType: 'text' }); + return this.http.post(`${(this.configuration.repositoryURL)}/threats`, data, { responseType: 'text' }); } /** @@ -377,7 +468,7 @@ export class BackendService { + '&id=' + res.xmlId.encoded + '&parentPath=' + this.configuration.parentPath + '&elementPath=' + this.configuration.elementPath; - this.alert.success('automatically opening does not work currently...', 'Substitution successful!'); + this.alert.success('Automatically opening does not work currently: ' + url, 'Substitution successful!'); }, error => { this.errorHandler.handleError(error); @@ -441,9 +532,194 @@ export class BackendService { return this.http.get(url, { headers: this.headers }); } - requestVersionElements(): Observable { + /** + * Patches the property values of all node- and relationship templates in the given topology. + * @param topology + */ + private static patchProperties(topology: TTopologyTemplate): TTopologyTemplate { + function patchMembers(p: object): void { + function jsonParse(v: string): string | object { + let result; + try { + result = JSON.parse(v); + } catch (e) { + result = v; + } + return result; + } + + for (const member in p) { + if (!{}.hasOwnProperty.call(p, member)) { + // skipping object prototype inherited members to make tslint happy + continue; + } + const memberType = typeof (p[member]); + if (memberType === 'string') { + const patched = jsonParse(p[member]); + if (typeof (patched) !== 'string') { + p[member] = patched; + } + } else if (memberType === 'object') { + // recurse, just to be safe + patchMembers(p[member]); + } + } + } + + for (const node of topology.nodeTemplates) { + if (node.properties && node.properties.properties) { + patchMembers(node.properties.properties); + } + } + for (const rel of topology.relationshipTemplates) { + if (rel.properties && rel.properties.properties) { + patchMembers(rel.properties.properties); + } + } + return topology; + } + + /** + * Requests all policy types from the backend + */ + private requestPolicyTypes(): Observable { + if (this.configuration) { + return this.http.get(this.configuration.repositoryURL + '/policytypes?full', { headers: this.headers }); + } + } + + /** + * Requests all requirement types from the backend + */ + private requestRequirementTypes(): Observable { + if (this.configuration) { + return this.http.get(this.configuration.repositoryURL + '/requirementtypes?full', { headers: this.headers }); + } + } + + /** + * Requests all capability types from the backend + */ + private requestCapabilityTypes(): Observable { + if (this.configuration) { + return this.http.get(this.configuration.repositoryURL + '/capabilitytypes?full', { headers: this.headers }); + } + } + + /** + * Requests all grouped node types from the backend + */ + private requestGroupedNodeTypes(): Observable { + if (this.configuration) { + return this.http.get(this.configuration.repositoryURL + '/nodetypes?grouped&full', { headers: this.headers }); + } + } + + /** + * Requests all ungrouped node types from the backend + */ + private requestNodeTypes(): Observable { + if (this.configuration) { + return this.http.get(this.configuration.repositoryURL + '/nodetypes?full', { headers: this.headers }); + } + } + + /** + * Requests all artifact types from the backend + */ + private requestArtifactTypes(): Observable { + if (this.configuration) { + return this.http.get(this.configuration.repositoryURL + '/artifacttypes?full', { headers: this.headers }); + } + } + + /** + * Requests all artifact templates from the backend + */ + requestArtifactTemplates(): Observable { + if (this.configuration) { + return this.http.get(this.configuration.repositoryURL + '/artifacttemplates', { headers: this.headers }); + } + } + + /** + * Requests all policy templates from the backend + */ + requestPolicyTemplates(): Observable { + if (this.configuration) { + return this.http.get(this.configuration.repositoryURL + '/policytemplates', { headers: this.headers }); + } + } + + /** + * Requests all relationship types from the backend + */ + private requestRelationshipTypes(): Observable { + if (this.configuration) { + return this.http.get(this.configuration.repositoryURL + '/relationshiptypes?full', { headers: this.headers }); + } + } + + private requestVersionElements(): Observable { if (this.configuration) { return this.http.get(this.configuration.elementUrl + '/newversions', { headers: this.headers }); } } + + private requestDataTypes(): Observable { + if (this.configuration) { + return this.http.get(this.configuration.repositoryURL + '/datatypes?full', { headers: this.headers }); + } + } + + private requestTopologyTemplate(): Observable { + if (this.configuration) { + return this.http.get(this.configuration.elementUrl); + } + } + + private requestNodeVisuals(): Observable { + if (this.configuration) { + return this.http.get(this.configuration.repositoryURL + '/nodetypes/allvisualappearancedata'); + } + } + + private requestRelationshipVisuals(): Observable { + if (this.configuration) { + return this.http.get(this.configuration.repositoryURL + '/relationshiptypes/allvisualappearancedata'); + } + } + + private requestPolicyVisuals(): Observable { + if (this.configuration) { + return this.http.get(this.configuration.repositoryURL + '/policytemplates/allvisualappearancedata'); + } + } + + private requestPolicyTypesVisuals(): Observable { + if (this.configuration) { + return this.http.get(this.configuration.repositoryURL + '/policytypes/allvisualappearancedata'); + } + } + + private requestTopologyDiff(): Observable<[ToscaDiff, TTopologyTemplate]> { + if (this.configuration) { + if (this.configuration.compareTo) { + const url = this.configuration.repositoryURL + '/' + this.configuration.parentPath + '/' + + encodeURIComponent(encodeURIComponent(this.configuration.ns)) + '/'; + const compareUrl = url + + this.configuration.id + '/?compareTo=' + + this.configuration.compareTo; + const templateUrl = url + + this.configuration.compareTo + '/topologytemplate'; + + return forkJoin( + this.http.get(compareUrl), + this.http.get(templateUrl) + ); + } else { + return of<[ToscaDiff, TTopologyTemplate]>([undefined, undefined]); + } + } + } } diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/services/che.service.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/services/che.service.ts new file mode 100644 index 0000000000..879dd668a2 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/services/che.service.ts @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + *******************************************************************************/ + +import { Injectable } from '@angular/core'; +import { HttpClient, HttpErrorResponse } from '@angular/common/http'; +import { Observable } from 'rxjs/Observable'; +import { WineryRepositoryConfigurationService } from '../../../../tosca-management/src/app/wineryFeatureToggleModule/WineryRepositoryConfiguration.service'; +import { map } from 'rxjs/operators'; +import { ToastrService } from 'ngx-toastr'; + +export interface CheResponse { + url: string; +} + +@Injectable({ + providedIn: 'root' +}) +export class CheService { + + constructor(private http: HttpClient, + private toastrService: ToastrService, + private configurationService: WineryRepositoryConfigurationService) { + } + + getCheTheiaUrl(backendUrl: String): Observable { + return this.http.get(`${backendUrl}/admin/che`).pipe(map((res) => res.url)); + } + + async openChe(backendUrl: String, id: String, namespace: String, type: String) { + try { + const theiaUrl = await this.getCheTheiaUrl(backendUrl).toPromise(); + const repositoryConfiguration = await this.configurationService.getRepositoryConfiguration().toPromise(); + const pathToOpen = theiaUrl + `/?path=${repositoryConfiguration.repositoryRoot}/${type}/${namespace}/${id}#/projects`; + window.open(pathToOpen, '_blank'); + } catch (err) { + if (err instanceof HttpErrorResponse) { + if (err.status === 500) { + this.toastrService.error('Winery is not properly configured for IDE usage', 'Configuration Error'); + } + } + } + } +} diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/services/multi-participants.service.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/services/multi-participants.service.ts new file mode 100644 index 0000000000..fc33cf8dea --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/services/multi-participants.service.ts @@ -0,0 +1,67 @@ +import { Injectable } from '@angular/core'; +import { HttpClient, HttpHeaders } from '@angular/common/http'; +import { BackendService } from './backend.service'; +import { Observable } from 'rxjs'; + +@Injectable() +export class MultiParticipantsService { + + private readonly httpHeaders: HttpHeaders; + + constructor(private httpClient: HttpClient, + private backendService: BackendService) { + this.httpHeaders = new HttpHeaders().set('Content-Type', 'application/json'); + } + + postNewVersion(): Observable { + const url = this.backendService.configuration.repositoryURL + + '/servicetemplates/' + + encodeURIComponent(encodeURIComponent(this.backendService.configuration.ns)) + + '/' + + encodeURIComponent(this.backendService.configuration.id) + + '/createplaceholderversion'; + + return this.httpClient.post( + url, + { headers: this.httpHeaders, observe: 'response', responseType: 'text' }); + } + + postParticipantsVersion(): Observable { + const url = this.backendService.configuration.repositoryURL + + '/servicetemplates/' + + encodeURIComponent(encodeURIComponent(this.backendService.configuration.ns)) + + '/' + + encodeURIComponent(this.backendService.configuration.id) + + '/createparticipantsversion'; + return this.httpClient.post( + url, + { headers: this.httpHeaders, observe: 'response', responseType: 'json' } + ); + } + + postSubstituteVersion(): Observable { + const url = this.backendService.configuration.repositoryURL + + '/servicetemplates/' + + encodeURIComponent(encodeURIComponent(this.backendService.configuration.ns)) + + '/' + + encodeURIComponent(this.backendService.configuration.id) + + '/placeholdersubstitution'; + console.log(url); + return this.httpClient.post( + url, + { headers: this.httpHeaders, observe: 'response', responseType: 'json' } + ); + } + + postPlaceholders(serviceTemplateId: string): Observable { + const url = this.backendService.configuration.repositoryURL + + '/servicetemplates/' + + encodeURIComponent(encodeURIComponent(this.backendService.configuration.ns)) + + '/' + + encodeURIComponent(serviceTemplateId) + + '/placeholder/generator'; + return this.httpClient.post( + url, + { headers: this.httpHeaders, observe: 'response', responseType: 'string' }); + } +} diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/services/statefulAnnotations.service.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/services/statefulAnnotations.service.ts index 1e00c10b37..d93dd0f6ef 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/services/statefulAnnotations.service.ts +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/services/statefulAnnotations.service.ts @@ -23,6 +23,7 @@ import { WineryActions } from '../redux/actions/winery.actions'; import { TopologyRendererActions } from '../redux/actions/topologyRenderer.actions'; import { ToastrService } from 'ngx-toastr'; import { WineryRepositoryConfigurationService } from '../../../../tosca-management/src/app/wineryFeatureToggleModule/WineryRepositoryConfiguration.service'; +import { EntityTypesModel } from '../models/entityTypesModel'; interface TopologyAndErrorList { errorList: string[]; @@ -32,6 +33,8 @@ interface TopologyAndErrorList { @Injectable() export class StatefulAnnotationsService { + private entityTypes: EntityTypesModel; + constructor(private ngRedux: NgRedux, private backendService: BackendService, private http: HttpClient, @@ -40,6 +43,12 @@ export class StatefulAnnotationsService { private configurationService: WineryRepositoryConfigurationService, private alert: ToastrService, private errorHandler: ErrorHandlerService) { + this.ngRedux.select(state => state.wineryState.entityTypes) + .subscribe(data => { + if (data) { + this.entityTypes = data; + } + }); this.ngRedux.select(state => state.topologyRendererState.buttonsState.determineStatefulComponents) .subscribe(data => { if (data) { @@ -74,7 +83,7 @@ export class StatefulAnnotationsService { this.http.get(url) .subscribe( data => - TopologyTemplateUtil.updateTopologyTemplate(this.ngRedux, this.actions, data, this.configurationService.isYaml()), + TopologyTemplateUtil.updateTopologyTemplate(this.ngRedux, this.actions, data, this.entityTypes, this.configurationService.isYaml()), error => this.errorHandler.handleError(error) ); } @@ -90,7 +99,8 @@ export class StatefulAnnotationsService { this.http.get(url) .subscribe( data => { - TopologyTemplateUtil.updateTopologyTemplate(this.ngRedux, this.actions, data.topologyTemplate, this.configurationService.isYaml()); + TopologyTemplateUtil.updateTopologyTemplate(this.ngRedux, this.actions, data.topologyTemplate, + this.entityTypes, this.configurationService.isYaml()); if (data.errorList && data.errorList.length > 0) { this.alert.warning( 'There were no freeze operations found for some stateful components!', diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/sidebars/node-details/node-details-sidebar.ts b/org.eclipse.winery.frontends/app/topologymodeler/src/app/sidebars/node-details/node-details-sidebar.ts new file mode 100644 index 0000000000..396582eb19 --- /dev/null +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/sidebars/node-details/node-details-sidebar.ts @@ -0,0 +1,34 @@ +/******************************************************************************* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + *******************************************************************************/ +import { TRelationshipTemplate } from '../../models/ttopology-template'; + +export class DetailsSidebarState { + visible: boolean; + nodeClicked: boolean; + template: SidebarEntityTemplate; + relationshipTemplate?: TRelationshipTemplate; + minInstances: number; + // this shoehorns the possibility of unicode infinity into the type + maxInstances: number | '\u221E'; + // relationship editing information + source: any; + target: any; +} + +export class SidebarEntityTemplate { + id: string; + name: string; + type: string; + properties: any; +} diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/sidebar/sidebar.component.css b/org.eclipse.winery.frontends/app/topologymodeler/src/app/sidebars/node-details/nodeDetailsSidebar.component.css similarity index 69% rename from org.eclipse.winery.frontends/app/topologymodeler/src/app/sidebar/sidebar.component.css rename to org.eclipse.winery.frontends/app/topologymodeler/src/app/sidebars/node-details/nodeDetailsSidebar.component.css index f72fbff102..aaefe1731e 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/sidebar/sidebar.component.css +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/sidebars/node-details/nodeDetailsSidebar.component.css @@ -12,16 +12,17 @@ * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 ********************************************************************************/ -input { - /*background-color: #303030 !important; - color: #fafafa !important; */ - overflow-y: auto; +/* need specific selector here to overwrite .sidebar-root max-width */ +#NTPropertiesView.sidebar-root { + width: 40vw; + /* use all of the available height of the viewport */ + height: 100vh; + min-width: 300px; + max-width: 600px; } -input:active, input:focus, input:hover { - /*background-color: #303030 !important; - color: #fafafa !important; - border-color: #000000 !important;*/ +input { + overflow-y: auto; } input[type='number'] { @@ -34,12 +35,5 @@ input::-webkit-inner-spin-button { } a { - /*background-color: #303030 !important; - color: #fafafa !important;*/ overflow-y: auto; } - -a:hover { - /*background-color: #303030 !important; - color: #03A9F4 !important;*/ -} diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/sidebar/sidebar.component.html b/org.eclipse.winery.frontends/app/topologymodeler/src/app/sidebars/node-details/nodeDetailsSidebar.component.html similarity index 88% rename from org.eclipse.winery.frontends/app/topologymodeler/src/app/sidebar/sidebar.component.html rename to org.eclipse.winery.frontends/app/topologymodeler/src/app/sidebars/node-details/nodeDetailsSidebar.component.html index 48404ea3eb..ddf4c6f1ff 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/sidebar/sidebar.component.html +++ b/org.eclipse.winery.frontends/app/topologymodeler/src/app/sidebars/node-details/nodeDetailsSidebar.component.html @@ -13,22 +13,21 @@ --> diff --git a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties-content/properties-content.component.css b/org.eclipse.winery.frontends/app/tosca-management/src/app/instance/sharedComponents/yaml/constraints/yaml-constraints.component.css similarity index 81% rename from org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties-content/properties-content.component.css rename to org.eclipse.winery.frontends/app/tosca-management/src/app/instance/sharedComponents/yaml/constraints/yaml-constraints.component.css index a250d8b21a..4a5c0f3a2c 100644 --- a/org.eclipse.winery.frontends/app/topologymodeler/src/app/properties/properties-content/properties-content.component.css +++ b/org.eclipse.winery.frontends/app/tosca-management/src/app/instance/sharedComponents/yaml/constraints/yaml-constraints.component.css @@ -1,5 +1,5 @@ -/******************************************************************************** - * Copyright (c) 2017-2018 Contributors to the Eclipse Foundation +/******************************************************************************* + * Copyright (c) 2020 Contributors to the Eclipse Foundation * * See the NOTICE file(s) distributed with this work for additional * information regarding copyright ownership. @@ -10,8 +10,5 @@ * which is available at https://www.apache.org/licenses/LICENSE-2.0. * * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 - ********************************************************************************/ + *******************************************************************************/ -textarea { - overflow: hidden; -} diff --git a/org.eclipse.winery.frontends/app/tosca-management/src/app/instance/sharedComponents/yaml/constraints/yaml-constraints.component.html b/org.eclipse.winery.frontends/app/tosca-management/src/app/instance/sharedComponents/yaml/constraints/yaml-constraints.component.html new file mode 100644 index 0000000000..ef96dee576 --- /dev/null +++ b/org.eclipse.winery.frontends/app/tosca-management/src/app/instance/sharedComponents/yaml/constraints/yaml-constraints.component.html @@ -0,0 +1,56 @@ + +
+
+ +
+
+ +

+

+ {{constraintClause.key}}: + {{constraintClause.value}} + {{constraintClause.list.toString()}} + + +
+

+ This datatype does not define constraints +

+
+
+
+ +
+ Please separate items by using ',' +
+
+ Only two items are allowed. +
+ + +
+
+ +
+ +
+
diff --git a/org.eclipse.winery.frontends/app/tosca-management/src/app/instance/sharedComponents/yaml/constraints/yaml-constraints.component.ts b/org.eclipse.winery.frontends/app/tosca-management/src/app/instance/sharedComponents/yaml/constraints/yaml-constraints.component.ts new file mode 100644 index 0000000000..733cf5e3b8 --- /dev/null +++ b/org.eclipse.winery.frontends/app/tosca-management/src/app/instance/sharedComponents/yaml/constraints/yaml-constraints.component.ts @@ -0,0 +1,121 @@ +/******************************************************************************* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + *******************************************************************************/ + + +import { Component, OnInit } from '@angular/core'; +import { InstanceComponent } from '../../../instance.component'; +import { ActivatedRoute, Router } from '@angular/router'; +import { InstanceService } from '../../../instance.service'; +import { WineryNotificationService } from '../../../../wineryNotificationModule/wineryNotification.service'; +import { ExistService } from '../../../../wineryUtils/existService'; +import { WineryInstance, WineryTemplateOrImplementationComponent } from '../../../../model/wineryComponent'; +import { HttpErrorResponse } from '@angular/common/http'; +import { TDataType } from '../../../../../../../topologymodeler/src/app/models/ttopology-template'; +import { Constraint } from '../../../../model/constraint'; +import { BsModalService } from 'ngx-bootstrap'; +import { DataTypesService } from '../../../dataTypes/dataTypes.service'; + +const valid_constraint_keys = ['equal', 'greater_than', 'greater_or_equal', 'less_than', 'less_or_equal', 'in_range', + 'valid_values', 'length', 'min_length', 'max_length', 'pattern', 'schema']; +const list_constraint_keys = ['valid_values', 'in_range']; +const range_constraint_keys = ['in_range']; + +@Component({ + selector: 'winery-yaml-constraints', + templateUrl: 'yaml-constraints.component.html', + styleUrls: [ + 'yaml-constraints.component.css' + ], + providers: [ + DataTypesService + ] +}) +export class YamlConstraintsComponent implements OnInit { + + component: TDataType; + loadingData = true; + + constructor(private notify: WineryNotificationService, + public sharedData: InstanceService, + private dataTypes: DataTypesService) { + } + + ngOnInit(): void { + this.loadDataType(); + } + + private loadDataType() { + this.sharedData.getComponentData() + .subscribe( + data => this.handleDataInput(data), + error => this.handleError(error) + ); + } + + private handleDataInput(componentData: WineryInstance) { + // TODO: check type hierarchy exposed by WineryInstance? + this.component = componentData.serviceTemplateOrNodeTypeOrNodeTypeImplementation[0] as unknown as TDataType; + // backfill namespace from targetNamespace coming from the sharedData + this.component.namespace = this.component.namespace || (this.component as any).targetNamespace; + this.loadingData = false; + } + + private handleError(error: HttpErrorResponse) { + this.loadingData = false; + this.notify.error(error.message); + } + + /** + * removes item from constraint list + * @param constraintClause + */ + removeConstraint(constraintClause: Constraint) { + const index = this.component.constraints.indexOf(constraintClause); + if (index > -1) { + this.component.constraints.splice(index, 1); + } + } + + addConstraint(selectedConstraintKey: string, constraintValue: string) { + // lists have to be separated by ',' + if (list_constraint_keys.indexOf(selectedConstraintKey) > -1) { + this.component.constraints.push(new Constraint(selectedConstraintKey, null, constraintValue.split(','))); + } else { + this.component.constraints.push(new Constraint(selectedConstraintKey, constraintValue, null)); + } + } + + save(): void { + this.loadingData = true; + this.dataTypes.updateConstraints(this.component) + .subscribe( + emptyResponse => this.loadingData = false, + error => this.handleError(error) + ); + } + + get valid_constraint_keys() { + return valid_constraint_keys; + } + + get list_constraint_keys() { + return list_constraint_keys; + } + + get range_constraint_keys() { + return range_constraint_keys; + } + +} + diff --git a/org.eclipse.winery.frontends/app/tosca-management/src/app/model/constraint.ts b/org.eclipse.winery.frontends/app/tosca-management/src/app/model/constraint.ts index b0dd4d0b12..54c1bd7e3b 100644 --- a/org.eclipse.winery.frontends/app/tosca-management/src/app/model/constraint.ts +++ b/org.eclipse.winery.frontends/app/tosca-management/src/app/model/constraint.ts @@ -13,7 +13,26 @@ *******************************************************************************/ export class Constraint { - constructor(public key: string, public value: string, public list: string[]) { } } + +export const yaml_well_known = [ + 'string', 'integer', 'float', 'boolean', 'timestamp', 'null', + 'version', 'range', 'list', 'map', + 'scalar-unit', 'scalar-unit.size', 'scalar-unit.time', 'scalar-unit.frequency', 'scalar-unit.bitrate', +]; +/** + * Referenced YAML types as defined in YAML spec 3.3.1, as well as the types defined by the spec itself. + */ +export type YamlWellKnown = + 'string' | 'integer' | 'float' | 'boolean' | 'timestamp' | 'null' | + 'version'| 'range' | 'list' | 'map' | + 'scalar-unit' | 'scalar-unit.size' | 'scalar-unit.time' | 'scalar-unit.frequency' | 'scalar-unit.bitrate'; + +/** + * Checks whether a given value is a declaration of a well-known YAML type as defined in {@link YamlWellKnown} and can act as a type guard. + */ +export function isWellKnown(value: any): value is YamlWellKnown { + return (typeof value === 'string') && yaml_well_known.includes(value); +} diff --git a/org.eclipse.winery.frontends/app/tosca-management/src/app/model/enums.ts b/org.eclipse.winery.frontends/app/tosca-management/src/app/model/enums.ts index f5126889b1..456fbaa2b2 100644 --- a/org.eclipse.winery.frontends/app/tosca-management/src/app/model/enums.ts +++ b/org.eclipse.winery.frontends/app/tosca-management/src/app/model/enums.ts @@ -24,6 +24,7 @@ export enum YesNoEnum { * Default is assumed ToscaTypes.Admin. */ export enum ToscaTypes { + DataType = 'datatypes', ServiceTemplate = 'servicetemplates', NodeType = 'nodetypes', RelationshipType = 'relationshiptypes', diff --git a/org.eclipse.winery.frontends/app/tosca-management/src/app/model/interfaces.ts b/org.eclipse.winery.frontends/app/tosca-management/src/app/model/interfaces.ts index 8b2e02078a..f274e5741c 100644 --- a/org.eclipse.winery.frontends/app/tosca-management/src/app/model/interfaces.ts +++ b/org.eclipse.winery.frontends/app/tosca-management/src/app/model/interfaces.ts @@ -37,23 +37,23 @@ export class OperationImplementation { export const StandardInterface: Interface = { name: 'Standard', type: '{tosca.interfaces.node.lifecycle}Standard', inputs: [], operations: [ - Object.assign(new Operation(), { name: 'create' }), - Object.assign(new Operation(), { name: 'configure' }), - Object.assign(new Operation(), { name: 'start' }), - Object.assign(new Operation(), { name: 'stop' }), - Object.assign(new Operation(), { name: 'delete' }), + Object.assign(new Operation(), { name: 'create', description: 'The standard create operation' }), + Object.assign(new Operation(), { name: 'configure', description: 'The standard configure operation' }), + Object.assign(new Operation(), { name: 'start', description: 'The standard start operation' }), + Object.assign(new Operation(), { name: 'stop', description: 'The standard stop operation' }), + Object.assign(new Operation(), { name: 'delete', description: 'The standard delete operation' }), ] }; export const ConfigureInterface: Interface = { name: 'Configure', type: '{tosca.interfaces.relationship}Configure', inputs: [], operations: [ - Object.assign(new Operation(), { name: 'pre_configure_source' }), - Object.assign(new Operation(), { name: 'pre_configure_target' }), - Object.assign(new Operation(), { name: 'post_configure_source' }), - Object.assign(new Operation(), { name: 'post_configure_target' }), - Object.assign(new Operation(), { name: 'add_target' }), - Object.assign(new Operation(), { name: 'add_source' }), - Object.assign(new Operation(), { name: 'target_changed' }), - Object.assign(new Operation(), { name: 'remove_target' }), + Object.assign(new Operation(), { name: 'pre_configure_source', description: 'The standard pre_configure_source operation' }), + Object.assign(new Operation(), { name: 'pre_configure_target', description: 'The standard pre_configure_target operation' }), + Object.assign(new Operation(), { name: 'post_configure_source', description: 'The standard post_configure_source operation' }), + Object.assign(new Operation(), { name: 'post_configure_target', description: 'The standard post_configure_target operation' }), + Object.assign(new Operation(), { name: 'add_target', description: 'The standard add_target operation' }), + Object.assign(new Operation(), { name: 'add_source', description: 'The standard add_source operation' }), + Object.assign(new Operation(), { name: 'target_changed', description: 'The standard target_changed operation' }), + Object.assign(new Operation(), { name: 'remove_target', description: 'The standard remove_target operation' }), ] }; diff --git a/org.eclipse.winery.frontends/app/tosca-management/src/app/model/qNameApiData.ts b/org.eclipse.winery.frontends/app/tosca-management/src/app/model/qNameApiData.ts index 668ad11b0a..fb2e63d8d7 100644 --- a/org.eclipse.winery.frontends/app/tosca-management/src/app/model/qNameApiData.ts +++ b/org.eclipse.winery.frontends/app/tosca-management/src/app/model/qNameApiData.ts @@ -11,12 +11,12 @@ * * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 *******************************************************************************/ -import { QName } from './qName'; +import { QName } from '../../../../shared/src/app/model/qName'; export class QNameApiData { static fromQName(qName: QName) { - return new QNameApiData(qName.localPart, qName.namespace); + return new QNameApiData(qName.localName, qName.nameSpace); } constructor(public localname: string, public namespace: string) { diff --git a/org.eclipse.winery.frontends/app/tosca-management/src/app/model/subMenuItem.ts b/org.eclipse.winery.frontends/app/tosca-management/src/app/model/subMenuItem.ts index 6bfaf7a70e..5743ddf9d8 100644 --- a/org.eclipse.winery.frontends/app/tosca-management/src/app/model/subMenuItem.ts +++ b/org.eclipse.winery.frontends/app/tosca-management/src/app/model/subMenuItem.ts @@ -32,6 +32,7 @@ export class SubMenuItems { static readonly capabilityDefinitions: SubMenuItem = { displayName: 'Capability Definitions', urlFragment: 'capabilitydefinitions' }; static readonly configuration: SubMenuItem = { displayName: 'Configuration', urlFragment: 'configuration' }; static readonly consistencyCheck: SubMenuItem = { displayName: 'Consistency Check', urlFragment: 'consistencycheck' }; + static readonly constraints: SubMenuItem = { displayName: 'Constraints', urlFragment: 'constraints' }; static readonly constraintChecking: SubMenuItem = { displayName: 'Constraint Checking', urlFragment: 'constraintchecking' }; static readonly constraintTypes: SubMenuItem = { displayName: 'Constraint Types', urlFragment: 'constrainttypes' }; static readonly deploymentArtifacts: SubMenuItem = { displayName: 'Deployment Artifacts', urlFragment: 'deploymentartifacts' }; @@ -79,7 +80,8 @@ export class SubMenuItems { static readonly threatModeling: SubMenuItem = { displayName: 'Threat Modeling', urlFragment: 'threatmodeling' }; static readonly topologyTemplate: SubMenuItem = { displayName: 'Topology Template', urlFragment: 'topologytemplate' }; static readonly validSourcesAndTargets: SubMenuItem = { displayName: 'Valid Sources and Targets', urlFragment: 'validsourcesandtargets' }; - static readonly capabilityTypeConstraints: SubMenuItem = { displayName: 'Valid Source Types', urlFragment: 'constraints' }; + static readonly validSourceTypes: SubMenuItem = { displayName: 'Valid Source Types', urlFragment: 'constraints' }; + static readonly validTargetTypes: SubMenuItem = { displayName: 'Valid Target Types', urlFragment: 'validtargettypes' }; static readonly supportedFiles: SubMenuItem = { displayName: 'Supported File Types', urlFragment: 'supportedfiles' }; static readonly xml: SubMenuItem = { displayName: 'XML', urlFragment: 'xml' }; static readonly attributes: SubMenuItem = { displayName: 'Attribute Definitions', urlFragment: 'attributes' }; diff --git a/org.eclipse.winery.frontends/app/tosca-management/src/app/model/yaml.ts b/org.eclipse.winery.frontends/app/tosca-management/src/app/model/yaml.ts new file mode 100644 index 0000000000..1922004c85 --- /dev/null +++ b/org.eclipse.winery.frontends/app/tosca-management/src/app/model/yaml.ts @@ -0,0 +1,35 @@ +/******************************************************************************* + * Copyright (c) 2020 Contributors to the Eclipse Foundation + * + * See the NOTICE file(s) distributed with this work for additional + * information regarding copyright ownership. + * + * This program and the accompanying materials are made available under the + * terms of the Eclipse Public License 2.0 which is available at + * http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0 + * which is available at https://www.apache.org/licenses/LICENSE-2.0. + * + * SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 + *******************************************************************************/ + +import { Constraint, YamlWellKnown } from './constraint'; +import { QName } from '../../../../shared/src/app/model/qName'; +import { SchemaDefinition } from '../../../../topologymodeler/src/app/models/ttopology-template'; + +export class YamlPropertyDefinition { + constructor( + public name: string = '', + public type: QName | YamlWellKnown | string = 'string', + public description: string = '', + public required: boolean = false, + public defaultValue: any = '', + public status: string = 'supported', + public constraints: Constraint[] = [], + public keySchema: SchemaDefinition = undefined, + public entrySchema: SchemaDefinition = undefined) { + } +} + +export function isYamlPropertyDefinition(value: any): value is YamlPropertyDefinition { + return (value as YamlPropertyDefinition).name !== undefined; +} diff --git a/org.eclipse.winery.frontends/app/tosca-management/src/app/other/other.component.html b/org.eclipse.winery.frontends/app/tosca-management/src/app/other/other.component.html index 7e4d265672..e55afe0ef0 100644 --- a/org.eclipse.winery.frontends/app/tosca-management/src/app/other/other.component.html +++ b/org.eclipse.winery.frontends/app/tosca-management/src/app/other/other.component.html @@ -50,6 +50,11 @@

Imports

WSDLs +
+
+

YAML Simple Profile

+ Custom YAML Datatypes +

Refinement Models

diff --git a/org.eclipse.winery.frontends/app/tosca-management/src/app/section/section.component.html b/org.eclipse.winery.frontends/app/tosca-management/src/app/section/section.component.html index 3e54e62afb..5b16d796ff 100644 --- a/org.eclipse.winery.frontends/app/tosca-management/src/app/section/section.component.html +++ b/org.eclipse.winery.frontends/app/tosca-management/src/app/section/section.component.html @@ -43,15 +43,15 @@ (click)="addCsarModal.show()"> Import CSAR -
+ + id="sectionCreateFromDataFlowBtn"> +
No duplicates allowed!
-
+
Name is required!
diff --git a/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryAddComponentDataModule/addComponentData.component.ts b/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryAddComponentDataModule/addComponentData.component.ts index 04cc2c07c4..b2245434f6 100644 --- a/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryAddComponentDataModule/addComponentData.component.ts +++ b/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryAddComponentDataModule/addComponentData.component.ts @@ -74,10 +74,16 @@ export class WineryAddComponentDataComponent { onInputChange() { this.validation = new AddComponentValidation(); + + if (!this.newComponentName) { + this.validFormEvent.emit(false); + return { noNameAvailable: true }; + } this.newComponentFinalName = this.newComponentName; if (this.typeRequired && !this.newComponentSelectedType) { this.validation.noTypeAvailable = true; + this.validFormEvent.emit(false); return { noTypeAvailable: true }; } @@ -86,6 +92,7 @@ export class WineryAddComponentDataComponent { if (this.newComponentVersion.componentVersion && this.useComponentVersion) { this.validation.noUnderscoresAllowed = this.newComponentVersion.componentVersion.includes('_'); if (this.validation.noUnderscoresAllowed) { + this.validFormEvent.emit(false); return { noUnderscoresAllowed: true }; } } @@ -129,14 +136,17 @@ export class WineryAddComponentDataComponent { } createUrlAndCheck() { - this.artifactUrl = backendBaseURL + '/' + this.toscaType + '/' + encodeURIComponent(encodeURIComponent( - this.newComponentNamespace)) + '/' + this.newComponentFinalName + '/'; - - this.existService.check(this.artifactUrl) - .subscribe( - () => this.validate(false), - () => this.validate(true) - ); + const namespace = encodeURIComponent(encodeURIComponent(this.newComponentNamespace)); + if (this.toscaType && namespace && this.newComponentFinalName) { + this.artifactUrl = backendBaseURL + '/' + this.toscaType + '/' + encodeURIComponent(encodeURIComponent( + this.newComponentNamespace)) + '/' + this.newComponentFinalName + '/'; + + this.existService.check(this.artifactUrl) + .subscribe( + () => this.validate(false), + () => this.validate(true) + ); + } this.newComponentNameEvent.emit(this.newComponentFinalName); this.newComponentNamespaceEvent.emit(this.newComponentNamespace); } @@ -156,12 +166,11 @@ export class WineryAddComponentDataComponent { } createNoteTypeImplementationName(fullName: SelectData) { - const name = fullName.text.substring(0, fullName.text.lastIndexOf('_')); - const newVersion = fullName.text.slice(fullName.text.indexOf('_'), fullName.text.length); - this.newComponentVersion.componentVersion = newVersion.substring(1, newVersion.indexOf('-')); - this.newComponentName = name + '-Impl'; - this.newComponentFinalName = this.newComponentName + newVersion; - this.createUrlAndCheck(); + const version = Utils.getVersionFromString(fullName.text); + this.newComponentVersion.componentVersion = version ? version.toString() : ''; + // we need to set both as it is required in the determineFinalName + this.newComponentFinalName = this.newComponentName = Utils.getNameWithoutVersion(fullName.text) + '-Impl'; + this.determineFinalName(); } createArtifactName(toscaComponent: ToscaComponent, nodeTypeQName: string, operation: string, diff --git a/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryAddComponentModule/addComponentValidation.ts b/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryAddComponentModule/addComponentValidation.ts index 8fb5b56681..7c06fe888f 100644 --- a/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryAddComponentModule/addComponentValidation.ts +++ b/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryAddComponentModule/addComponentValidation.ts @@ -15,6 +15,7 @@ export class AddComponentValidation { // Errors noDuplicatesAllowed: boolean; noUnderscoresAllowed: boolean; + noNameAvailable: boolean; noTypeAvailable: boolean; // Warnings diff --git a/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryComponentExists/wineryComponentExists.component.ts b/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryComponentExists/wineryComponentExists.component.ts index 07114fc5b2..a1b231f63b 100644 --- a/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryComponentExists/wineryComponentExists.component.ts +++ b/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryComponentExists/wineryComponentExists.component.ts @@ -13,7 +13,6 @@ *******************************************************************************/ import { Component, Input, OnInit } from '@angular/core'; import { ExistService } from '../wineryUtils/existService'; -import { isNullOrUndefined } from 'util'; import { ModalDirective } from 'ngx-bootstrap'; import { backendBaseURL } from '../configuration'; import { ToscaTypes } from '../model/enums'; @@ -48,7 +47,7 @@ export class WineryComponentExistsComponent implements OnInit { } ngOnInit() { - if (!isNullOrUndefined(this.modalRef)) { + if (this.modalRef) { this.modalRef.onShow.subscribe(() => this.checkImplementationExists()); } } @@ -67,7 +66,7 @@ export class WineryComponentExistsComponent implements OnInit { this.generateData.url += '/'; } - if (!this.generateData.namespace.endsWith('/')) { + if (this.generateData && this.generateData.namespace && !this.generateData.namespace.endsWith('/')) { this.existService.check(this.generateData.url) .subscribe( () => this.generateData.createComponent = false, diff --git a/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryDynamicTable/wineryDynamicTable.module.ts b/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryDynamicTable/wineryDynamicTable.module.ts index 49eb02aef8..54923d798d 100644 --- a/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryDynamicTable/wineryDynamicTable.module.ts +++ b/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryDynamicTable/wineryDynamicTable.module.ts @@ -36,7 +36,8 @@ import { DynamicConstraintsComponent } from './formComponents/dynamicConstraints DynamicConstraintsComponent, WineryDynamicFieldDirective], exports: [ - WineryDynamicTableComponent + WineryDynamicTableComponent, + WineryDynamicFormModalComponent ], imports: [ CommonModule, ReactiveFormsModule, BrowserModule, WineryTableModule, WineryModalModule diff --git a/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryFeatureToggleModule/WineryRepositoryConfiguration.service.ts b/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryFeatureToggleModule/WineryRepositoryConfiguration.service.ts index a76b875ee2..1f2897bc24 100644 --- a/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryFeatureToggleModule/WineryRepositoryConfiguration.service.ts +++ b/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryFeatureToggleModule/WineryRepositoryConfiguration.service.ts @@ -23,11 +23,12 @@ export interface WineryConfiguration { compliance: boolean; freezeAndDefrost: boolean; managementFeatureEnrichment: boolean; - nfv: boolean; + nfv: boolean; // deprecated patternRefinement: boolean; problemDetection: boolean; radon: boolean; splitting: boolean; + multiParticipant: boolean; testRefinement: boolean; topologyFragmentRefinementModel: boolean; placement: boolean; @@ -40,9 +41,14 @@ export interface WineryConfiguration { topologymodeler: string; workflowmodeler: string; edmmTransformationTool: string; + eclipseChe: string; }; } +export interface WineryRepositoryConfiguration { + repositoryRoot: String; +} + @Injectable() export class WineryRepositoryConfigurationService { configuration: WineryConfiguration; @@ -71,6 +77,10 @@ export class WineryRepositoryConfigurationService { return subject.asObservable(); } + getRepositoryConfiguration(): Observable { + return this.http.get(backendBaseURL + '/admin/repository-config'); + } + isYaml(): boolean { return this.configuration.features.yaml; } diff --git a/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryFeatureToggleModule/wineryRepository.feature.direct.ts b/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryFeatureToggleModule/wineryRepository.feature.direct.ts index 2a4a48a37a..4c5223b62c 100644 --- a/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryFeatureToggleModule/wineryRepository.feature.direct.ts +++ b/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryFeatureToggleModule/wineryRepository.feature.direct.ts @@ -17,7 +17,7 @@ import { ShowOnFeatureDirective } from './wineryRepository.showOnFeature.direct' export enum FeatureEnum { Accountability = 'accountability', Completion = 'completion', Compliance = 'compliance', EdmmModeling = 'edmmModeling', FreezeAndDefrost = 'freezeAndDefrost', ManagementFeatureEnrichment = 'managementFeatureEnrichment', NFV = 'nfv', PatternRefinement = 'patternRefinement', - ProblemDetection = 'problemDetection', Radon = 'radon', Splitting = 'splitting', TestRefinement = 'testRefinement', + ProblemDetection = 'problemDetection', Radon = 'radon', Splitting = 'splitting', MultiParticipant = 'multiParticipant', TestRefinement = 'testRefinement', TopologyFragmentRefinementModel = 'topologyFragmentRefinementModel', Placement = 'placement', updateTemplates = 'updateTemplates', Yaml = 'yaml' } diff --git a/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryIoParameter/wineryIoParameter.component.ts b/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryIoParameter/wineryIoParameter.component.ts index 2919ed20a1..0ffaa3bf63 100644 --- a/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryIoParameter/wineryIoParameter.component.ts +++ b/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryIoParameter/wineryIoParameter.component.ts @@ -102,7 +102,10 @@ export class WineryIoParameterComponent { this.modalTitle = 'Input Parameter'; this.validatorObject = new WineryValidatorObject(this.inputParameters, 'name'); this.addIntParametersModalRef = this.modalService.show(this.addIntParametersModal); - this.parameterForm.reset(); + + if (this.parameterForm) { + this.parameterForm.reset(); + } } onAddInputParam(name: string, type: string, required: boolean) { @@ -134,7 +137,10 @@ export class WineryIoParameterComponent { this.modalTitle = 'Output Parameter'; this.validatorObject = new WineryValidatorObject(this.outputParameters, 'name'); this.addIntParametersModalRef = this.modalService.show(this.addIntParametersModal); - this.parameterForm.reset(); + + if (this.parameterForm) { + this.parameterForm.reset(); + } } onAddOutputParam(name: string, type: string, required: boolean) { diff --git a/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryLicenseModule/wineryLicense.component.html b/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryLicenseModule/wineryLicense.component.html index 1540530a76..38c0d7c21c 100644 --- a/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryLicenseModule/wineryLicense.component.html +++ b/org.eclipse.winery.frontends/app/tosca-management/src/app/wineryLicenseModule/wineryLicense.component.html @@ -32,8 +32,9 @@
- +