aboutsummaryrefslogtreecommitdiffstats
path: root/vid-app-common/src/main/java/org/openecomp/vid/asdc
diff options
context:
space:
mode:
authorOfir Sonsino <os0695@att.com>2018-01-31 17:19:00 +0200
committerOfir Sonsino <os0695@att.com>2018-01-31 17:19:00 +0200
commit1cfb08779ea0e00be69e072a940b3063e049fe6b (patch)
tree6602a900387c8393ed0dcd81c0539381632903c6 /vid-app-common/src/main/java/org/openecomp/vid/asdc
parent2f20b001b9243e0f8b44aecc768ec265fd538732 (diff)
org.onap migration
Change-Id: I52f0b2851f2c765752b6d21f49b32136d7d72a3d Issue-ID: VID-86 Signed-off-by: Ofir Sonsino <os0695@att.com>
Diffstat (limited to 'vid-app-common/src/main/java/org/openecomp/vid/asdc')
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/AsdcCatalogException.java58
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/AsdcClient.java129
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/beans/Artifact.java314
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/beans/Resource.java429
-rw-r--r--vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/SecureService.java9
-rw-r--r--vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/SecureServices.java31
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/beans/Service.java351
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/beans/SubResource.java175
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Capability.java140
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Constraint.java199
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Group.java135
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Import.java48
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Input.java168
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/NodeTemplate.java117
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Property.java157
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Requirement.java120
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Schema.java53
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/SubstitutionMappings.java101
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/TopologyTemplate.java124
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaCsar.java101
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMeta.java124
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMetadata.java461
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaModel.java166
-rw-r--r--vid-app-common/src/main/java/org/openecomp/vid/asdc/local/LocalAsdcClient.java393
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/memory/InMemoryAsdcClient.java372
-rw-r--r--vid-app-common/src/main/java/org/openecomp/vid/asdc/parser/ToscaParser.java15
-rw-r--r--vid-app-common/src/main/java/org/openecomp/vid/asdc/parser/ToscaParserImpl.java225
-rw-r--r--vid-app-common/src/main/java/org/openecomp/vid/asdc/parser/ToscaParserImpl2.java254
-rwxr-xr-xvid-app-common/src/main/java/org/openecomp/vid/asdc/rest/RestfulAsdcClient.java467
29 files changed, 0 insertions, 5436 deletions
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/AsdcCatalogException.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/AsdcCatalogException.java
deleted file mode 100755
index c8078720..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/AsdcCatalogException.java
+++ /dev/null
@@ -1,58 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.asdc;
-
-/**
- * The Class AsdcCatalogException.
- */
-public class AsdcCatalogException extends Exception {
-
- /** The Constant serialVersionUID. */
- private static final long serialVersionUID = 1L;
-
- /**
- * Instantiates a new sdc catalog exception.
- *
- * @param msg the msg
- */
- public AsdcCatalogException(String msg) {
- super(msg);
- }
-
- /**
- * Instantiates a new sdc catalog exception.
- *
- * @param cause the cause
- */
- public AsdcCatalogException(Throwable cause) {
- super(cause);
- }
-
- /**
- * Instantiates a new sdc catalog exception.
- *
- * @param msg the msg
- * @param t the t
- */
- public AsdcCatalogException(String msg, Throwable t) {
- super(msg, t);
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/AsdcClient.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/AsdcClient.java
deleted file mode 100755
index 314ea037..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/AsdcClient.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.asdc;
-
-import java.io.IOException;
-import java.nio.file.Path;
-import java.util.Collection;
-import java.util.Map;
-import java.util.UUID;
-
-import org.openecomp.vid.asdc.beans.Artifact;
-import org.openecomp.vid.asdc.beans.Resource;
-import org.openecomp.vid.asdc.beans.Service;
-
-/**
- * The Interface AsdcClient.
- */
-public interface AsdcClient {
-
- /**
- * Gets the resource.
- *
- * @param uuid the uuid
- * @return the resource
- * @throws AsdcCatalogException the sdc catalog exception
- */
- public Resource getResource(UUID uuid) throws AsdcCatalogException;
-
- /**
- * Gets the resources.
- *
- * @return the resources
- * @throws AsdcCatalogException the sdc catalog exception
- */
- public Collection<Resource> getResources() throws AsdcCatalogException;
-
- /**
- * Gets the resources.
- *
- * @param filter the filter
- * @return the resources
- * @throws AsdcCatalogException the sdc catalog exception
- */
- public Collection<Resource> getResources(Map<String, String[]> filter) throws AsdcCatalogException;
-
- /**
- * Gets the resource artifact.
- *
- * @param resourceUuid the resource uuid
- * @param artifactUuid the artifact uuid
- * @return the resource artifact
- * @throws AsdcCatalogException the sdc catalog exception
- */
- public Artifact getResourceArtifact(UUID resourceUuid, UUID artifactUuid) throws AsdcCatalogException;
-
- /**
- * Gets the resource tosca model.
- *
- * @param uuid the uuid
- * @return the resource tosca model
- * @throws AsdcCatalogException the sdc catalog exception
- */
- public Path getResourceToscaModel(UUID uuid) throws AsdcCatalogException;
-
- /**
- * Gets the service.
- *
- * @param uuid the uuid
- * @return the service
- * @throws AsdcCatalogException the sdc catalog exception
- */
- public Service getService(UUID uuid) throws AsdcCatalogException;
-
- /**
- * Gets the services.
- *
- * @return the services
- * @throws AsdcCatalogException the sdc catalog exception
- */
- public Collection<Service> getServices() throws AsdcCatalogException;
-
- /**
- * Gets the services.
- *
- * @param filter the filter
- * @return the services
- * @throws AsdcCatalogException the asdc catalog exception
- */
- public Collection<Service> getServices(Map<String, String[]> filter) throws AsdcCatalogException;
-
- /**
- * Gets the service artifact.
- *
- * @param serviceUuid the service uuid
- * @param artifactUuid the artifact uuid
- * @return the service artifact
- * @throws AsdcCatalogException the asdc catalog exception
- */
- public Artifact getServiceArtifact(UUID serviceUuid, UUID artifactUuid) throws AsdcCatalogException;
-
- /**
- * Gets the service tosca model.
- *
- * @param uuid the uuid
- * @return the service tosca model
- * @throws AsdcCatalogException the asdc catalog exception
- */
- public Path getServiceToscaModel(UUID uuid) throws AsdcCatalogException;
-
- //TODO: Collect TOSCA information from CSAR
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/Artifact.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/Artifact.java
deleted file mode 100755
index 4974d44a..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/Artifact.java
+++ /dev/null
@@ -1,314 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.asdc.beans;
-
-import java.util.UUID;
-
-/**
- * The Class Artifact.
- */
-public class Artifact {
-
-/*
- * SDC has widened this to a String type for 1610.
- public enum Type {
- HEAT,
- HEAT_ENV,
- HEAT_VOL,
- HEAT_NET,
- HEAT_NESTED,
- HEAT_ARTIFACT,
- YANG_XML,
- VNF_CATALOG,
- VF_LICENSE,
- VENDOR_LICENSE,
- ASSET_INVENTORY_PROFILE,
- ASSET_QUERY_SPEC,
- APPC_CONFIG,
- VF_MODULES_METADATA,
- DCAE_TOSCA,
- DCAE_JSON,
- DCAE_EMF,
- DCAE_DOC,
- DCAE_BLUEPRINT,
- DCAE_EVENT,
- DCAE_INVENTORY_TOSCA,
- DCAE_INVENTORY_JSON,
- DCAE_INVENTORY_EMF,
- DCAE_INVENTORY_DOC,
- DCAE_INVENTORY_BLUEPRINT,
- DCAE_INVENTORY_EVENT,
- OTHER,
- AAI_SERVICE_MODEL //HEY! READ ME! YES, YOU! I AM A TEMPORARY FIX, PLEASE REMOVE ME BECAUSE I AM A FRAUD. I DON'T BELONG HERE.
- //Warm Regards,
- // *The* Artifact.Type.AAI_SERVICE_MODEL Constant
- }
- */
-
- /** The artifact name. */
- private String artifactName;
-
- /** The artifact label. */
- private String artifactLabel;
-
- /** The artifact group type. */
- private String artifactGroupType;
-
- /** The artifact type. */
- private String artifactType;
-
- /** The artifact URL. */
- private String artifactURL;
-
- /** The artifact description. */
- private String artifactDescription;
-
- /** The artifact timeout. */
- private int artifactTimeout;
-
- /** The artifact checksum. */
- private String artifactChecksum;
-
- /** The artifact UUID. */
- private String artifactUUID;
-
- /** The artifact version. */
- private String artifactVersion;
-
- /** The generated from UUID. */
- private String generatedFromUUID;
-
- /**
- * Gets the artifact name.
- *
- * @return the artifact name
- */
- public String getArtifactName() {
- return artifactName;
- }
-
- /**
- * Gets the artifact type.
- *
- * @return the artifact type
- */
- public String getArtifactType() {
- return artifactType;
- }
- /**
- * Gets the artifact group type.
- *
- * @return the artifact group type
- */
- public String getArtifactGroupType() {
- return artifactGroupType;
- }
-
- /**
- * Gets the artifact label.
- *
- * @return the artifact label
- */
- public String getArtifactLabel() {
- return artifactLabel;
- }
- /**
- * Gets the artifact URL.
- *
- * @return the artifact URL
- */
- public String getArtifactURL() {
- return artifactURL;
- }
-
- /**
- * Gets the artifact description.
- *
- * @return the artifact description
- */
- public String getArtifactDescription() {
- return artifactDescription;
- }
-
- /**
- * Gets the artifact timeout.
- *
- * @return the artifact timeout
- */
- public int getArtifactTimeout() {
- return artifactTimeout;
- }
-
- /**
- * Gets the artifact checksum.
- *
- * @return the artifact checksum
- */
- public String getArtifactChecksum() {
- return artifactChecksum;
- }
-
- /**
- * Gets the artifact UUID.
- *
- * @return the artifact UUID
- */
- public String getArtifactUUID() {
- return artifactUUID;
- }
-
- /**
- * Gets the artifact version.
- *
- * @return the artifact version
- */
- public String getArtifactVersion() {
- return artifactVersion;
- }
-
- /**
- * Gets the generated from UUID.
- *
- * @return the generated from UUID
- */
- public String getGeneratedFromUUID() {
- return generatedFromUUID;
- }
-
- /**
- * Sets the artifact name.
- *
- * @param artifactName the new artifact name
- */
- public void setArtifactName(String artifactName) {
- this.artifactName = artifactName;
- }
-
- /**
- * Sets the artifact type.
- *
- * @param artifactType the new artifact type
- */
- public void setArtifactType(String artifactType) {
- this.artifactType = artifactType;
- }
- /**
- * Sets the artifact group type.
- *
- * @param artifactGroupType the new artifact group type
- */
- public void setArtifactGroupType(String artifactGroupType) {
- this.artifactGroupType = artifactGroupType;
- }
- /**
- * Sets the artifact label.
- *
- * @param artifactGroupType the new artifact label
- */
- public void setArtifactLabel(String artifactLabel) {
- this.artifactLabel = artifactLabel;
- }
- /**
- * Sets the artifact URL.
- *
- * @param artifactURL the new artifact URL
- */
- public void setArtifactURL(String artifactURL) {
- this.artifactURL = artifactURL;
- }
-
- /**
- * Sets the artifact description.
- *
- * @param artifactDescription the new artifact description
- */
- public void setArtifactDescription(String artifactDescription) {
- this.artifactDescription = artifactDescription;
- }
-
- /**
- * Sets the artifact timeout.
- *
- * @param artifactTimeout the new artifact timeout
- */
- public void setArtifactTimeout(int artifactTimeout) {
- this.artifactTimeout = artifactTimeout;
- }
-
- /**
- * Sets the artifact checksum.
- *
- * @param artifactChecksum the new artifact checksum
- */
- public void setArtifactChecksum(String artifactChecksum) {
- this.artifactChecksum = artifactChecksum;
- }
-
- /**
- * Sets the artifact UUID.
- *
- * @param artifactUUID the new artifact UUID
- */
- public void setArtifactUUID(String artifactUUID) {
- this.artifactUUID = artifactUUID;
- }
-
- /**
- * Sets the artifact version.
- *
- * @param artifactVersion the new artifact version
- */
- public void setArtifactVersion(String artifactVersion) {
- this.artifactVersion = artifactVersion;
- }
-
- /**
- * Sets the generated from UUID.
- *
- * @param generatedFromUUID the new generated from UUID
- */
- public void setGeneratedFromUUID(String generatedFromUUID) {
- this.generatedFromUUID = generatedFromUUID;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final UUID uuid = UUID.fromString(getArtifactUUID());
-
- return uuid.hashCode();
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object o) {
- if (o == this) return true;
- if (!(o instanceof Artifact)) return false;
-
- final Artifact artifact = (Artifact) o;
-
- return (artifact.getArtifactUUID().equals(getArtifactUUID()));
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/Resource.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/Resource.java
deleted file mode 100755
index 000aae1a..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/Resource.java
+++ /dev/null
@@ -1,429 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.asdc.beans;
-
-import java.util.Collection;
-import java.util.UUID;
-
-/**
- * The Class Resource.
- */
-public class Resource {
-
- /**
- * The Enum Type.
- */
- public enum Type {
-
- /** The vf. */
- VF,
-
- /** The vfc. */
- VFC,
-
- /** The cp. */
- CP,
-
- /** The vl. */
- VL,
-
- /** The vfcmt. */
- VFCMT
- }
-
- /**
- * The Enum LifecycleState.
- */
- public enum LifecycleState {
-
- /** The not certified checkout. */
- NOT_CERTIFIED_CHECKOUT,
-
- /** The not certified checkin. */
- NOT_CERTIFIED_CHECKIN,
-
- /** The ready for certification. */
- READY_FOR_CERTIFICATION,
-
- /** The certification in progress. */
- CERTIFICATION_IN_PROGRESS,
-
- /** The certified. */
- CERTIFIED
- }
-
- /** The uuid. */
- private String uuid;
-
- /** The invariant UUID. */
- private String invariantUUID;
-
- /** The name. */
- private String name;
-
- /** The description. */
- private String description;
-
- /** The version. */
- private String version;
-
- /** The tosca model URL. */
- private String toscaModelURL;
-
- /** The category. */
- private String category;
-
- /** The sub category. */
- private String subCategory;
-
- /** The resource type. */
- private Resource.Type resourceType;
-
- /** The lifecycle state. */
- private Resource.LifecycleState lifecycleState;
-
- /** The last updater user ID. */
- private String lastUpdaterUserId;
-
- /** The last updater full name. */
- private String lastUpdaterFullName;
-
- /** The tosca model. */
- private String toscaModel;
-
- /** The tosca resource name. */
- private String toscaResourceName;
-
- /** The artifacts. */
- private Collection<Artifact> artifacts;
-
- /** The resources. */
- private Collection<SubResource> resources;
-
- /**
- * Gets the uuid.
- *
- * @return the uuid
- */
- public String getUuid() {
- return uuid;
- }
-
- /**
- * Gets the invariant UUID.
- *
- * @return the invariant UUID
- */
- public String getInvariantUUID() {
- return invariantUUID;
- }
-
- /**
- * Gets the name.
- *
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Gets the description.
- *
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Gets the version.
- *
- * @return the version
- */
- public String getVersion() {
- return version;
- }
-
- /**
- * Gets the tosca model URL.
- *
- * @return the tosca model URL
- */
- public String getToscaModelURL() {
- return toscaModelURL;
- }
-
- /**
- * Gets the category.
- *
- * @return the category
- */
- public String getCategory() {
- return category;
- }
-
- /**
- * Gets the sub category.
- *
- * @return the sub category
- */
- public String getSubCategory() {
- return subCategory;
- }
-
- /**
- * Gets the resource type.
- *
- * @return the resource type
- */
- public Resource.Type getResourceType() {
- return resourceType;
- }
-
- /**
- * Gets the lifecycle state.
- *
- * @return the lifecycle state
- */
- public Resource.LifecycleState getLifecycleState() {
- return lifecycleState;
- }
-
- /**
- * Gets the last updater user ID.
- *
- * @return the last updater user ID
- */
- public String getLastUpdaterUserId() {
- return lastUpdaterUserId;
- }
-
- /**
- * Gets the last updater full name.
- *
- * @return the last updater full name
- */
- public String getLastUpdaterFullName() {
- return lastUpdaterFullName;
- }
-
- /**
- * Gets the tosca model.
- *
- * @return the tosca model
- */
- public String getToscaModel() {
- return toscaModel;
- }
-
- /**
- * Gets the tosca resource name.
- *
- * @return the tosca resource name
- */
- public String getToscaResourceName() {
- return toscaResourceName;
- }
-
- /**
- * Gets the artifacts.
- *
- * @return the artifacts
- */
- public Collection<Artifact> getArtifacts() {
- return artifacts;
- }
-
- /**
- * Gets the resources.
- *
- * @return the resources
- */
- public Collection<SubResource> getResources() {
- return resources;
- }
-
- /**
- * Sets the uuid.
- *
- * @param uuid the new uuid
- */
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- /**
- * Sets the invariant UUID.
- *
- * @param invariantUUID the new invariant UUID
- */
- public void setInvariantUUID(String invariantUUID) {
- this.invariantUUID = invariantUUID;
- }
-
- /**
- * Sets the name.
- *
- * @param name the new name
- */
- public void setName(String name) {
- this.name = name;
- }
- /**
- * Sets the description.
- *
- * @param name the new description
- */
- public void setDescription(String description) {
- this.description = description;
- }
- /**
- * Sets the version.
- *
- * @param version the new version
- */
- public void setVersion(String version) {
- this.version = version;
- }
-
- /**
- * Sets the tosca model URL.
- *
- * @param toscaModelURL the new tosca model URL
- */
- public void setToscaModelURL(String toscaModelURL) {
- this.toscaModelURL = toscaModelURL;
- }
-
- /**
- * Sets the category.
- *
- * @param category the new category
- */
- public void setCategory(String category) {
- this.category = category;
- }
-
- /**
- * Sets the sub category.
- *
- * @param subCategory the new sub category
- */
- public void setSubCategory(String subCategory) {
- this.subCategory = subCategory;
- }
-
- /**
- * Sets the resource type.
- *
- * @param resourceType the new resource type
- */
- public void setResourceType(Resource.Type resourceType) {
- this.resourceType = resourceType;
- }
-
- /**
- * Sets the lifecycle state.
- *
- * @param lifecycleState the new lifecycle state
- */
- public void setLifecycleState(Resource.LifecycleState lifecycleState) {
- this.lifecycleState = lifecycleState;
- }
-
- /**
- * Sets the last updater user ID.
- *
- * @param lastUpdaterUserId the new last updater user ID
- */
- public void setLastUpdaterUserId(String lastUpdaterUserId) {
- this.lastUpdaterUserId = lastUpdaterUserId;
- }
-
- /**
- * Sets the last updater full name.
- *
- * @param lastUpdaterFullName the new last updater full name
- */
- public void setLastUpdaterFullName(String lastUpdaterFullName) {
- this.lastUpdaterFullName = lastUpdaterFullName;
- }
-
- /**
- * Sets the tosca model.
- *
- * @param toscaModel the new tosca model
- */
- public void setToscaModel(String toscaModel) {
- this.toscaModel = toscaModel;
- }
-
- /**
- * Sets the tosca resource name.
- *
- * @param toscaResourceName the new tosca resource name
- */
- public void setToscaResourceName(String toscaResourceName) {
- this.toscaResourceName = toscaResourceName;
- }
-
- /**
- * Sets the artifacts.
- *
- * @param artifacts the new artifacts
- */
- public void setArtifacts(Collection<Artifact> artifacts) {
- this.artifacts = artifacts;
- }
-
- /**
- * Sets the resources.
- *
- * @param resources the new resources
- */
- public void setResources(Collection<SubResource> resources) {
- this.resources = resources;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final UUID uuid = UUID.fromString(getUuid());
-
- return uuid.hashCode();
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object o) {
- if (o == this) return true;
- if (!(o instanceof Resource)) return false;
-
- final Resource resource = (Resource) o;
-
- return (resource.getUuid().equals(getUuid()));
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/SecureService.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/SecureService.java
deleted file mode 100644
index 1372472f..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/SecureService.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package org.openecomp.vid.asdc.beans;
-
-/**
- * Created by Oren on 6/27/17.
- */
-public class SecureService extends Service{
-
- public boolean isPermmited = true;
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/SecureServices.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/SecureServices.java
deleted file mode 100644
index 0fcd7922..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/SecureServices.java
+++ /dev/null
@@ -1,31 +0,0 @@
-package org.openecomp.vid.asdc.beans;
-
-import java.util.Collection;
-import java.util.List;
-
-/**
- * Created by Oren on 6/27/17.
- */
-public class SecureServices {
-
- private Collection<Service> services;
- //Disable roles until AAF integration finishes
- private boolean isReadOnly = false;
-
- public void setServices(Collection<Service> services) {
- this.services = services;
- }
-
- public Collection<Service> getServices() {
-
- return services;
- }
- public boolean isReadOnly() {
- return isReadOnly;
- }
-
- public void setReadOnly(boolean readOnly) {
- isReadOnly = readOnly;
- }
-
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/Service.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/Service.java
deleted file mode 100755
index 2a83cbe3..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/Service.java
+++ /dev/null
@@ -1,351 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.asdc.beans;
-
-import java.util.Collection;
-import java.util.UUID;
-/**
- * The Class Service.
- */
-public class Service {
-
- /**
- * The Enum DistributionStatus.
- */
- public enum DistributionStatus {
-
- /** The distribution not approved. */
- DISTRIBUTION_NOT_APPROVED,
-
- /** The distribution approved. */
- DISTRIBUTION_APPROVED,
-
- /** The distributed. */
- DISTRIBUTED,
-
- /** The distribution rejected. */
- DISTRIBUTION_REJECTED
- }
-
- /**
- * The Enum LifecycleState.
- */
- public enum LifecycleState {
-
- /** The not certified checkout. */
- NOT_CERTIFIED_CHECKOUT,
-
- /** The not certified checkin. */
- NOT_CERTIFIED_CHECKIN,
-
- /** The ready for certification. */
- READY_FOR_CERTIFICATION,
-
- /** The certification in progress. */
- CERTIFICATION_IN_PROGRESS,
-
- /** The certified. */
- CERTIFIED
- }
-
- /** The uuid. */
- private String uuid;
-
- /** The invariant UUID. */
- private String invariantUUID;
-
- /** The name. */
- private String name;
-
- /** The version. */
- private String version;
-
- /** The tosca model URL. */
- private String toscaModelURL;
-
- /** The category. */
- private String category;
-
- /** The lifecycle state. */
- private Service.LifecycleState lifecycleState;
-
- /** The last updater user uid. */
- private String lastUpdaterUserId;
-
- /** The last updater full name. */
- private String lastUpdaterFullName;
-
- /** The distribution status. */
- private Service.DistributionStatus distributionStatus;
-
- /** The artifacts. */
- private Collection<Artifact> artifacts;
-
- /** The resources. */
- private Collection<SubResource> resources;
-
- /**
- * Gets the uuid.
- *
- * @return the uuid
- */
- public String getUuid() {
- return uuid;
- }
-
- /**
- * Gets the invariant UUID.
- *
- * @return the invariant UUID
- */
- public String getInvariantUUID() {
- return invariantUUID;
- }
-
- /**
- * Gets the name.
- *
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Gets the version.
- *
- * @return the version
- */
- public String getVersion() {
- return version;
- }
-
- /**
- * Gets the tosca model URL.
- *
- * @return the tosca model URL
- */
- public String getToscaModelURL() {
- return toscaModelURL;
- }
-
- /**
- * Gets the category.
- *
- * @return the category
- */
- public String getCategory() {
- return category;
- }
-
- /**
- * Gets the lifecycle state.
- *
- * @return the lifecycle state
- */
- public Service.LifecycleState getLifecycleState() {
- return lifecycleState;
- }
-
- /**
- * Gets the last updater user uid.
- *
- * @return the last updater user uid
- */
- public String getLastUpdaterUserId() {
- return lastUpdaterUserId;
- }
-
- /**
- * Gets the last updater full name.
- *
- * @return the last updater full name
- */
- public String getLastUpdaterFullName() {
- return lastUpdaterFullName;
- }
-
- /**
- * Gets the distribution status.
- *
- * @return the distribution status
- */
- public Service.DistributionStatus getDistributionStatus() {
- return distributionStatus;
- }
-
- /**
- * Gets the artifacts.
- *
- * @return the artifacts
- */
- public Collection<Artifact> getArtifacts() {
- return artifacts;
- }
-
- /**
- * Gets the resources.
- *
- * @return the resources
- */
- public Collection<SubResource> getResources() {
- return resources;
- }
-
- /**
- * Sets the uuid.
- *
- * @param uuid the new uuid
- */
- public void setUuid(String uuid) {
- this.uuid = uuid;
- }
-
- /**
- * Sets the invariant UUID.
- *
- * @param invariantUUID the new invariant UUID
- */
- public void setInvariantUUID(String invariantUUID) {
- this.invariantUUID = invariantUUID;
- }
-
- /**
- * Sets the name.
- *
- * @param name the new name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Sets the version.
- *
- * @param version the new version
- */
- public void setVersion(String version) {
- this.version = version;
- }
-
- /**
- * Sets the tosca model URL.
- *
- * @param toscaModelURL the new tosca model URL
- */
- public void setToscaModelURL(String toscaModelURL) {
- this.toscaModelURL = toscaModelURL;
- }
-
- /**
- * Sets the category.
- *
- * @param category the new category
- */
- public void setCategory(String category) {
- this.category = category;
- }
-
- /**
- * Sets the lifecycle state.
- *
- * @param lifecycleState the new lifecycle state
- */
- public void setLifecycleState(Service.LifecycleState lifecycleState) {
- this.lifecycleState = lifecycleState;
- }
-
- /**
- * Sets the last updater user uid.
- *
- * @param lastUpdaterUserId the new last updater user uid
- */
- public void set(String lastUpdaterUserId) {
- this.lastUpdaterUserId = lastUpdaterUserId;
- }
-
- /**
- * Sets the last updater full name.
- *
- * @param lastUpdaterFullName the new last updater full name
- */
- public void setLastUpdaterFullName(String lastUpdaterFullName) {
- this.lastUpdaterFullName = lastUpdaterFullName;
- }
-
- /**
- * Sets the distribution status.
- *
- * @param distributionStatus the new distribution status
- */
- public void setDistributionStatus(Service.DistributionStatus distributionStatus) {
- this.distributionStatus = distributionStatus;
- }
-
- /**
- * Sets the artifacts.
- *
- * @param artifacts the new artifacts
- */
- public void setArtifacts(Collection<Artifact> artifacts) {
- this.artifacts = artifacts;
- }
-
- /**
- * Sets the resources.
- *
- * @param resources the new resources
- */
- public void setResources(Collection<SubResource> resources) {
- this.resources = resources;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return uuid;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#hashCode()
- */
- @Override
- public int hashCode() {
- final UUID uuid = UUID.fromString(getUuid());
-
- return uuid.hashCode();
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#equals(java.lang.Object)
- */
- @Override
- public boolean equals(Object o) {
- if (o == this) return true;
- if (!(o instanceof Service)) return false;
-
- final Service service = (Service) o;
-
- return (service.getUuid().equals(getUuid()));
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/SubResource.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/SubResource.java
deleted file mode 100755
index cd3ec7fe..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/SubResource.java
+++ /dev/null
@@ -1,175 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.asdc.beans;
-
-import java.util.Collection;
-/**
- * The Class SubResource.
- */
-public class SubResource {
-
- /** The resource instance name. */
- private String resourceInstanceName;
-
- /** The resource name. */
- private String resourceName;
-
- /** The resource invariant UUID. */
- private String resourceInvariantUUID;
-
- /** The resource version. */
- private String resourceVersion;
-
- /** The resource type. */
- private String resourceType;
-
- /** The resource UUID. */
- private String resourceUUID;
-
- /** The artifacts. */
- private Collection<Artifact> artifacts;
-
- /**
- * Gets the resource instance name.
- *
- * @return the resource instance name
- */
- public String getResourceInstanceName() {
- return resourceInstanceName;
- }
-
- /**
- * Gets the resource name.
- *
- * @return the resource name
- */
- public String getResourceName() {
- return resourceName;
- }
-
- /**
- * Gets the resource invariant UUID.
- *
- * @return the resource invariant UUID
- */
- public String getResourceInvariantUUID() {
- return resourceInvariantUUID;
- }
-
- /**
- * Gets the resource version.
- *
- * @return the resource version
- */
- public String getResourceVersion() {
- return resourceVersion;
- }
-
- /**
- * Gets the resoucre type.
- *
- * @return the resoucre type
- */
- public String getResoucreType() {
- return resourceType;
- }
-
- /**
- * Gets the resource UUID.
- *
- * @return the resource UUID
- */
- public String getResourceUUID() {
- return resourceUUID;
- }
-
- /**
- * Gets the artifacts.
- *
- * @return the artifacts
- */
- public Collection<Artifact> getArtifacts() {
- return artifacts;
- }
-
- /**
- * Sets the resource instance name.
- *
- * @param resourceInstanceName the new resource instance name
- */
- public void setResourceInstanceName(String resourceInstanceName) {
- this.resourceInstanceName = resourceInstanceName;
- }
-
- /**
- * Sets the resource name.
- *
- * @param resourceName the new resource name
- */
- public void setResourceName(String resourceName) {
- this.resourceName = resourceName;
- }
-
- /**
- * Sets the resource invariant UUID.
- *
- * @param resourceInvariantUUID the new resource invariant UUID
- */
- public void setResourceInvariantUUID(String resourceInvariantUUID) {
- this.resourceInvariantUUID = resourceInvariantUUID;
- }
-
- /**
- * Sets the resource version.
- *
- * @param resourceVersion the new resource version
- */
- public void setResourceVersion(String resourceVersion) {
- this.resourceVersion = resourceVersion;
- }
-
- /**
- * Sets the resoucre type.
- *
- * @param resourceType the new resoucre type
- */
- public void setResoucreType(String resourceType) {
- this.resourceType = resourceType;
- }
-
- /**
- * Sets the resource UUID.
- *
- * @param resourceUUID the new resource UUID
- */
- public void setResourceUUID(String resourceUUID) {
- this.resourceUUID = resourceUUID;
- }
-
- /**
- * Sets the artifacts.
- *
- * @param artifacts the new artifacts
- */
- public void setArtifacts(Collection<Artifact> artifacts) {
- this.artifacts = artifacts;
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Capability.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Capability.java
deleted file mode 100755
index 0d3f17ae..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Capability.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.asdc.beans.tosca;
-
-import java.util.Collection;
-import java.util.Map;
-
-/**
- * The Class Capability.
- */
-public class Capability {
-
- /** The type. */
- private String type; //FIXME: Make an enumeration?
-
- /** The description. */
- private String description;
-
- /** The occurrences. */
- private Collection<String> occurrences; //FIXME: Make an enumeration?
-
- /** The properties. */
- private Map<String, Property> properties;
-
- /** The valid source types. */
- private Collection<String> valid_source_types; //FIXME: Make an enumeration?
-
- /**
- * Instantiates a new capability.
- */
- public Capability() {}
-
- /**
- * Gets the type.
- *
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * Gets the description.
- *
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Gets the occurrences.
- *
- * @return the occurrences
- */
- public Collection<String> getOccurrences() {
- return occurrences;
- }
-
- /**
- * Gets the properties.
- *
- * @return the properties
- */
- public Map<String, Property> getProperties() {
- return properties;
- }
-
- /**
- * Gets the valid source types.
- *
- * @return the valid source types
- */
- public Collection<String> getValid_source_types() {
- return valid_source_types;
- }
-
- /**
- * Sets the type.
- *
- * @param type the new type
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * Sets the description.
- *
- * @param description the new description
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Sets the occurrences.
- *
- * @param occurrences the new occurrences
- */
- public void setOccurrences(Collection<String> occurrences) {
- this.occurrences = occurrences;
- }
-
- /**
- * Sets the properties.
- *
- * @param properties the properties
- */
- public void setProperties(Map<String, Property> properties) {
- this.properties = properties;
- }
-
- /**
- * Sets the valid source types.
- *
- * @param valid_source_types the new valid source types
- */
- public void setValid_source_types(Collection<String> valid_source_types) {
- this.valid_source_types = valid_source_types;
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Constraint.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Constraint.java
deleted file mode 100755
index a91f3831..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Constraint.java
+++ /dev/null
@@ -1,199 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.openecomp.vid.asdc.beans.tosca;
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * The Class Constraint.
- */
-
-public class Constraint {
- private List<Object> valid_values;
- private Object equal;
- private Object greater_than;
- private Object greater_or_equal;
- private Object less_than;
- private Object less_or_equal;
- private List<Object> in_range;
- private Object length;
- private Object min_length;
- private Object max_length;
-
- /**
- * Instantiates a new Constraint.
- */
- public Constraint() {
- valid_values = new ArrayList<Object>();
- in_range = new ArrayList<Object>();
- }
-
- /**
- * Gets the valid_values.
- *
- * @return the valid_values
- */
- public List<Object> getvalid_values() {
- return valid_values;
- }
- /**
- * Gets equal.
- *
- * @return equal
- */
- public Object getEqual() {
- return equal;
- }
- /**
- * Gets greater_than.
- *
- * @return greater_than
- */
- public Object getGreater_than() {
- return greater_than;
- }
- /**
- * Gets greater_or_equal.
- *
- * @return greater_or_equal
- */
- public Object getGreater_or_equal() {
- return greater_or_equal;
- }
- /**
- * Gets less_than.
- *
- * @return less_than
- */
- public Object getLess_than() {
- return less_than;
- }
- /**
- * Gets less_or_equal.
- *
- * @return less_or_equal
- */
- public Object getLess_or_equal() {
- return less_or_equal;
- }
- /**
- * Gets in_range.
- *
- * @return in_range
- */
- public List<Object> getIn_range() {
- return in_range;
- }
- /**
- * Gets length.
- *
- * @return length
- */
- public Object getLength() {
- return length;
- }
- /**
- * Gets min_length.
- *
- * @return min_length
- */
- public Object getMin_length() {
- return min_length;
- }
- /**
- * Gets max_length.
- *
- * @return max_length
- */
- public Object getMax_length() {
- return max_length;
- }
- /**
- * Sets the valid_values.
- *
- * @param op the new valid_values
- */
- public void setvalid_values(List<Object> vlist) {
- this.valid_values = vlist;
- }
- /**
- * Sets equal.
- *
- * @param e the new equal
- */
- public void setEqual(Object e) {
- this.equal = e;
- }
- /**
- * Sets greater_than.
- *
- * @param e the new greater_than
- */
- public void setGreater_than(Object e) {
- this.greater_than = e;
- }
- /**
- * Sets less_than.
- *
- * @param e the new less_than
- */
- public void setLess_than(Object e) {
- this.less_than = e;
- }
- /**
- * Sets in_range.
- *
- * @param e the new in_range
- */
- public void setIn_range(List<Object> e) {
- this.in_range = e;
- }
- /**
- * Sets length.
- *
- * @param e the length
- */
- public void setLength(Object e) {
- this.length = e;
- }
- /**
- * Sets min_length.
- *
- * @param e the min_length
- */
- public void setMin_length(Object e) {
- this.min_length = e;
- }
- /**
- * Sets max_length.
- *
- * @param e the max_length
- */
- public void setMax_length(Object e) {
- this.max_length = e;
- }
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "valid_values=" + valid_values;
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Group.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Group.java
deleted file mode 100755
index 4d31faab..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Group.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.asdc.beans.tosca;
-
-import java.util.Collection;
-import java.util.Map;
-
-/**
- * The Class Group.
- */
-public class Group {
-
- /** The type. */
- private String type;
-
- /** The members. */
- private Collection<String> members;
-
- /** The metadata. */
- private ToscaMetadata metadata;
-
- /** The vf module type. */
- private String vf_module_type;
-
- /** The properties. */
- private Map<String, Object> properties;
-
- /**
- * Gets the metadata.
- *
- * @return the metadata
- */
- public ToscaMetadata getMetadata() {
- return metadata;
- }
-
- /**
- * Sets the metadata.
- *
- * @param metadata the new metadata
- */
- public void setMetadata(ToscaMetadata metadata) {
- this.metadata = metadata;
- }
-
- /**
- * Gets the members.
- *
- * @return the members
- */
- public Collection<String> getMembers() {
- return members;
- }
-
- /**
- * Sets the members.
- *
- * @param members the new members
- */
- public void setMembers(Collection<String> members) {
- this.members = members;
- }
-
- /**
- * Gets the type.
- *
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * Sets the type.
- *
- * @param type the new type
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * Gets the vf module type.
- *
- * @return the vf module type
- */
- public String getvf_module_type() {
- return vf_module_type;
- }
-
- /**
- * Sets the vf module type.
- *
- * @param vf_module_type the new vf module type
- */
- public void setvf_module_type(String vf_module_type) {
- this.vf_module_type = vf_module_type;
- }
-
- /**
- * Gets the properties.
- *
- * @return the properties
- */
- public Map<String, Object> getProperties() {
- return properties;
- }
-
- /**
- * Sets the properties.
- *
- * @param properties the properties
- */
- public void setProperties(Map<String, Object> properties) {
- this.properties = properties;
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Import.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Import.java
deleted file mode 100755
index d64a5806..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Import.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.asdc.beans.tosca;
-
-/**
- * The Class Import.
- */
-public class Import {
-
- /** The file. */
- private String file;
-
- /**
- * Gets the file.
- *
- * @return the file
- */
- public String getFile() {
- return file;
- }
-
- /**
- * Sets the file.
- *
- * @param file the new file
- */
- public void setFile(String file) {
- this.file = file;
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Input.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Input.java
deleted file mode 100755
index e5eec012..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Input.java
+++ /dev/null
@@ -1,168 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.asdc.beans.tosca;
-
-import org.openecomp.sdc.toscaparser.api.elements.constraints.*;
-
-import java.util.List;
-import java.util.ArrayList;
-
-// TODO: Auto-generated Javadoc
-/**
- * The Class Input.
- */
-public class Input {
-
- /** The type. */
- private String type;
-
- /** The description. */
- private String description;
-
- /** The default. */
- private Object _default;
-
- /** The entry schema. */
- private Input entry_schema;
-
- /** The constraints */
- private List<org.openecomp.sdc.toscaparser.api.elements.constraints.Constraint> constraints;
-
- /** The required field. If not set, the default is true */
- private boolean required = true;
-
- /**
- * Instantiates a new input.
- */
- public Input() {
- constraints = new ArrayList<org.openecomp.sdc.toscaparser.api.elements.constraints.Constraint>();
- }
-
- /**
- * Gets the type.
- *
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * Sets the type.
- *
- * @param type the new type
- */
- public void setType(String type) {
- this.type = type;
- }
- /**
- * Gets the required field.
- *
- * @return the required field
- */
- public boolean getRequired() {
- return required;
- }
- /**
- * Sets the required value.
- *
- * @param required the new required value
- */
- public void setRequired(boolean required) {
- this.required = required;
- }
- /**
- * Gets the description.
- *
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description.
- *
- * @param description the new description
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Gets the default.
- *
- * @return the default
- */
- public Object getDefault() {
- return _default;
- }
-
- /**
- * Sets the default.
- *
- * @param _default the new default
- */
- public void setDefault(Object _default) {
- this._default = _default;
- }
-
- /**
- * Gets the entry schema.
- *
- * @return the entry schema
- */
- public Input getentry_schema() {
- return entry_schema;
- }
- /**
- * Sets the entry schema.
- *
- * @param the entry schema
- */
- public void setentry_schema(Input s) {
- this.entry_schema = s;
- }
- /**
- * Sets the constraints.
- *
- * @param c the new constraints
- */
- public void setConstraints(List<org.openecomp.sdc.toscaparser.api.elements.constraints.Constraint> c) {
- this.constraints = c;
- }
- /**
- * Gets the constraints
- *
- * @return the constraints
- */
- public List<org.openecomp.sdc.toscaparser.api.elements.constraints.Constraint> getConstraints() {
- return constraints;
- }
-
- /* (non-Javadoc)
- * @see java.lang.Object#toString()
- */
- @Override
- public String toString() {
- return "type=" + type + ",description=" + description + ",default=" + _default;
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/NodeTemplate.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/NodeTemplate.java
deleted file mode 100755
index 97740b3f..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/NodeTemplate.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.asdc.beans.tosca;
-
-import java.util.Map;
-import java.util.HashMap;
-
-/**
- * The Class NodeTemplate.
- */
-public class NodeTemplate {
-
- /** The type. */
- private String type;
-
- /** The metadata. */
- private ToscaMetadata metadata;
-
- /** The properties. */
- private Map<String, Object> properties; //HEAT?
-
- /** The requirements. */
- private Object requirements;
-
- public NodeTemplate () {
- properties = new HashMap<String,Object>();
- }
- /**
- * Gets the type.
- *
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * Sets the type.
- *
- * @param type the new type
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * Gets the metadata.
- *
- * @return the metadata
- */
- public ToscaMetadata getMetadata() {
- return metadata;
- }
-
- /**
- * Sets the metadata.
- *
- * @param metadata the new metadata
- */
- public void setMetadata(ToscaMetadata metadata) {
- this.metadata = metadata;
- }
-
- /**
- * Gets the properties.
- *
- * @return the properties
- */
- public Map<String, Object> getProperties() {
- return properties;
- }
-
- /**
- * Sets the properties.
- *
- * @param properties the properties
- */
- public void setProperties(Map<String, Object> properties) {
- this.properties = properties;
- }
-
- /**
- * Gets the requirements.
- *
- * @return the requirements
- */
- public Object getRequirements() {
- return requirements;
- }
-
- /**
- * Sets the requirements.
- *
- * @param requirements the new requirements
- */
- public void setRequirements(Object requirements) {
- this.requirements = requirements;
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Property.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Property.java
deleted file mode 100755
index 16b921e2..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Property.java
+++ /dev/null
@@ -1,157 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.asdc.beans.tosca;
-
-/**
- * The Class Property.
- */
-public class Property {
-
- /** The type. */
- private String type;
-
- /** The description. */
- private String description;
-
- /** The entry schema. */
- private Schema entry_schema;
-
- /** The default. */
- private String _default;
-
- /** The required. */
- private boolean required;
-
- /**
- * Instantiates a new property.
- */
- private Property() {}
-
- /**
- * Gets the type.
- *
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * Gets the description.
- *
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Gets the entry schema.
- *
- * @return the entry schema
- */
- public Schema getEntry_schema() {
- return entry_schema;
- }
-
- /**
- * Gets the default.
- *
- * @return the default
- */
- public String get_default() {
- return _default;
- }
-
- /**
- * Sets the type.
- *
- * @param type the new type
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * Sets the description.
- *
- * @param description the new description
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Sets the entry schema.
- *
- * @param entry_schema the new entry schema
- */
- public void setEntry_schema(Schema entry_schema) {
- this.entry_schema = entry_schema;
- }
-
- /**
- * Sets the default.
- *
- * @param _default the new default
- */
- public void set_default(String _default) {
- this._default = _default;
- }
-
- /**
- * Gets the default.
- *
- * @return the default
- */
- public String getDefault() {
- return _default;
- }
-
- /**
- * Checks if is required.
- *
- * @return true, if is required
- */
- public boolean isRequired() {
- return required;
- }
-
- /**
- * Sets the default.
- *
- * @param _default the new default
- */
- public void setDefault(String _default) {
- this._default = _default;
- }
-
- /**
- * Sets the required.
- *
- * @param required the new required
- */
- public void setRequired(boolean required) {
- this.required = required;
- }
-
-
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Requirement.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Requirement.java
deleted file mode 100755
index acb25099..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Requirement.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.asdc.beans.tosca;
-
-import java.util.Collection;
-
-/**
- * The Class Requirement.
- */
-public class Requirement {
-
- /** The occurrences. */
- private Collection<String> occurrences;
-
- /** The capability. */
- private String capability;
-
- /** The node. */
- private String node;
-
- /** The relationship. */
- private String relationship;
-
- /**
- * Instantiates a new requirement.
- */
- private Requirement() {}
-
- /**
- * Gets the occurrences.
- *
- * @return the occurrences
- */
- public Collection<String> getOccurrences() {
- return occurrences;
- }
-
- /**
- * Gets the capability.
- *
- * @return the capability
- */
- public String getCapability() {
- return capability;
- }
-
- /**
- * Gets the node.
- *
- * @return the node
- */
- public String getNode() {
- return node;
- }
-
- /**
- * Gets the relationship.
- *
- * @return the relationship
- */
- public String getRelationship() {
- return relationship;
- }
-
- /**
- * Sets the occurrences.
- *
- * @param occurrences the new occurrences
- */
- public void setOccurrences(Collection<String> occurrences) {
- this.occurrences = occurrences;
- }
-
- /**
- * Sets the capability.
- *
- * @param capability the new capability
- */
- public void setCapability(String capability) {
- this.capability = capability;
- }
-
- /**
- * Sets the node.
- *
- * @param node the new node
- */
- public void setNode(String node) {
- this.node = node;
- }
-
- /**
- * Sets the relationship.
- *
- * @param relationship the new relationship
- */
- public void setRelationship(String relationship) {
- this.relationship = relationship;
- }
-
-
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Schema.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Schema.java
deleted file mode 100755
index f77c1b4b..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/Schema.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.asdc.beans.tosca;
-
-/**
- * The Class Schema.
- */
-public class Schema {
-
- /** The type. */
- public String type;
-
- /**
- * Instantiates a new schema.
- */
- public Schema() {}
-
- /**
- * Gets the type.
- *
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * Sets the type.
- *
- * @param type the new type
- */
- public void setType(String type) {
- this.type = type;
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/SubstitutionMappings.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/SubstitutionMappings.java
deleted file mode 100755
index f59f2467..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/SubstitutionMappings.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.asdc.beans.tosca;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * The Class SubstitutionMappings.
- */
-public class SubstitutionMappings {
-
- /** The node type. */
- private String node_type;
-
- /** The capabilities. */
- private Map<String, Object> capabilities;
-
- /** The requirements. */
- private Map<String, Object> requirements;
-
- /**
- * Instantiates a new substitution mappings.
- */
- public SubstitutionMappings() {
- capabilities = new HashMap<String, Object> ();
- requirements = new HashMap<String, Object> ();
- }
-
- /**
- * Gets the node type.
- *
- * @return the node type
- */
- public String getnode_type() {
- return node_type;
- }
-
- /**
- * Sets the node type.
- *
- * @param node_type the new node type
- */
- public void setnode_type(String node_type) {
- this.node_type = node_type;
- }
-
- /**
- * Gets the capabilities.
- *
- * @return the capabilities
- */
- public Map<String, Object> getCapabilities() {
- return capabilities;
- }
-
- /**
- * Sets the capabilities.
- *
- * @param capabilities the capabilities
- */
- public void setCapabilities(Map<String, Object> capabilities) {
- this.capabilities = capabilities;
- }
-
- /**
- * Gets the requirements.
- *
- * @return the requirements
- */
- public Map<String, Object> getRequirements() {
- return requirements;
- }
-
- /**
- * Sets the requirements.
- *
- * @param requirements the requirements
- */
- public void setRequirements(Map<String, Object> requirements) {
- this.requirements = requirements;
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/TopologyTemplate.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/TopologyTemplate.java
deleted file mode 100755
index 25b2c2c3..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/TopologyTemplate.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.asdc.beans.tosca;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * The Class TopologyTemplate.
- */
-public class TopologyTemplate {
-
- /** The substitution mappings. */
- private SubstitutionMappings substitution_mappings;
-
- /** The inputs. */
- private Map<String, Input> inputs;
-
- /** The node templates. */
- private Map<String, NodeTemplate> node_templates;
-
- /** The groups. */
- private Map<String, Group> groups;
-
- /**
- * Instantiates a new topology template.
- */
- public TopologyTemplate() {
- substitution_mappings = new SubstitutionMappings();
- inputs = new HashMap<String, Input> ();
- node_templates = new HashMap<String, NodeTemplate> ();
- groups = new HashMap<String, Group> ();
- }
-
- /**
- * Gets the substitution mappings.
- *
- * @return the substitution mappings
- */
- public SubstitutionMappings getsubstitution_mappings() {
- return this.substitution_mappings;
- }
-
- /**
- * Sets the substitution mappings.
- *
- * @param substitution_mappings the new substitution mappings
- */
- public void setsubstitution_mappings(SubstitutionMappings substitution_mappings) {
- this.substitution_mappings = substitution_mappings;
- }
-
- /**
- * Gets the inputs.
- *
- * @return the inputs
- */
- public Map<String, Input> getInputs() {
- return inputs;
- }
-
- /**
- * Sets the inputs.
- *
- * @param inputs the inputs
- */
- public void setInputs(Map<String, Input> inputs) {
- this.inputs = inputs;
- }
-
- /**
- * Gets the node templates.
- *
- * @return the node templates
- */
- public Map<String, NodeTemplate> getnode_templates() {
- return node_templates;
- }
-
- /**
- * Setnode templates.
- *
- * @param node_templates the node templates
- */
- public void setnode_templates(Map<String, NodeTemplate> node_templates) {
- this.node_templates = node_templates;
- }
-
- /**
- * Gets the groups.
- *
- * @return the groups
- */
- public Map<String, Group> getGroups() {
- return groups;
- }
-
- /**
- * Sets the groups.
- *
- * @param groups the groups
- */
- public void setGroups(Map<String, Group> groups) {
- this.groups = groups;
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaCsar.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaCsar.java
deleted file mode 100755
index 9e9e1d00..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaCsar.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.asdc.beans.tosca;
-
-import java.util.Collection;
-import java.util.LinkedList;
-
-/**
- * The Class ToscaCsar.
- */
-public class ToscaCsar {
-
- /** The parent. */
- private final ToscaModel parent;
-
- /** The children. */
- private final Collection<ToscaModel> children;
-
- /**
- * The Class Builder.
- */
- public static class Builder {
-
- /** The parent. */
- private final ToscaModel parent;
-
- /** The children. */
- private Collection<ToscaModel> children = new LinkedList<ToscaModel> ();
-
- /**
- * Instantiates a new builder.
- *
- * @param parent the parent
- */
- public Builder(ToscaModel parent) {
- this.parent = parent;
- }
-
- /**
- * Adds the vnf.
- *
- * @param child the child
- * @return the builder
- */
- public Builder addVnf(ToscaModel child) {
- children.add(child);
- return this;
- }
-
- /**
- * Builds the.
- *
- * @return the tosca csar
- */
- public ToscaCsar build() {
- return new ToscaCsar(this);
- }
- }
-
- /**
- * Instantiates a new tosca csar.
- *
- * @param builder the builder
- */
- public ToscaCsar(Builder builder) {
- this.parent = builder.parent;
- this.children = builder.children;
- }
-
- /**
- * Gets the parent.
- *
- * @return the parent
- */
- public ToscaModel getParent() { return parent; }
-
- /**
- * Gets the children.
- *
- * @return the children
- */
- public Collection<ToscaModel> getChildren() { return children; }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMeta.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMeta.java
deleted file mode 100755
index a5295c47..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMeta.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.asdc.beans.tosca;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.openecomp.vid.asdc.AsdcCatalogException;
-
-/**
- * The Class ToscaMeta.
- */
-public class ToscaMeta {
-
- /** The metadata. */
- private final Map<String, String> metadata;
-
- /**
- * Instantiates a new tosca meta.
- *
- * @param builder the builder
- * @throws IOException Signals that an I/O exception has occurred.
- * @throws AsdcCatalogException the asdc catalog exception
- */
- private ToscaMeta(Builder builder) throws IOException, AsdcCatalogException {
- metadata = new HashMap<String, String> ();
-
- read(builder.inputStream);
- }
-
- /**
- * The Class Builder.
- */
- public static class Builder {
-
- /** The input stream. */
- private final InputStream inputStream;
-
- /**
- * Instantiates a new builder.
- *
- * @param inputStream the input stream
- */
- public Builder(InputStream inputStream) {
- this.inputStream = inputStream;
- }
-
- /**
- * Builds the.
- *
- * @return the tosca meta
- * @throws IOException Signals that an I/O exception has occurred.
- * @throws AsdcCatalogException the asdc catalog exception
- */
- public ToscaMeta build() throws IOException, AsdcCatalogException {
- return new ToscaMeta(this);
- }
- }
-
- /**
- * Gets the.
- *
- * @param property the property
- * @return the string
- */
- public String get(String property) {
- return metadata.get(property);
- }
-
- /**
- * Read.
- *
- * @param inputStream the input stream
- * @throws IOException Signals that an I/O exception has occurred.
- * @throws AsdcCatalogException the asdc catalog exception
- */
- private void read(InputStream inputStream) throws IOException, AsdcCatalogException {
-
- final BufferedReader br = new BufferedReader(new InputStreamReader(inputStream));
-
- String line;
-
- try {
- while ((line = br.readLine()) != null) {
- if ( line.length() > 0 ) {
- final String[] entry = line.split(":");
-
- if (entry.length != 2) throw new AsdcCatalogException("TOSCA.meta file cannot be parsed (more than 1 colon found on a single line");
- if (!entry[1].startsWith(" ")) throw new AsdcCatalogException("TOSCA.meta file cannot be parsed (: not immediately followed by ' ')");
-
- metadata.put(entry[0], entry[1].substring(1));
- }
- }
- } catch (IOException e) {
- metadata.clear();
- throw e;
- } catch (AsdcCatalogException e) {
- metadata.clear();
- throw e;
- }
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMetadata.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMetadata.java
deleted file mode 100755
index d42c1f15..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaMetadata.java
+++ /dev/null
@@ -1,461 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.asdc.beans.tosca;
-
-/**
- * The Class ToscaMetadata.
- */
-public class ToscaMetadata {
-
- /** The template name. */
- private String template_name;
-
- /** The invariant UUID. */
- private String invariantUUID;
-
- /** The customization UUID. */
- private String customizationUUID;
-
- /** The uuid. */
- private String uuid;
-
- /** The version. */
- private String version;
-
- /** The name. */
- private String name;
-
- /** The description. */
- private String description;
-
- /** The category. */
- private String category;
-
- /** The subcategory. */
- private String subcategory;
-
- /** The type. */
- private String type;
-
- /** The resource vendor. */
- private String resourceVendor;
-
- /** The resource vendor release. */
- private String resourceVendorRelease;
-
- /** The service ecomp naming. */
- private String serviceEcompNaming;
-
- /** The ecomp generated naming - duplicate for serviceEcompNaming */
- private boolean ecompGeneratedNaming;
-
- /** The naming policy */
- private String namingPolicy;
-
- /** The service homing. */
- private boolean serviceHoming;
-
- /** The vf module model name. */
- //ToscaMetadata for VF Modules
- private String vfModuleModelName;
-
- /** The vf module model invariant UUID. */
- private String vfModuleModelInvariantUUID;
-
- /** The vf module model customization UUID. */
- private String vfModuleModelCustomizationUUID;
-
- /** The vf module model UUID. */
- private String vfModuleModelUUID;
-
- /** The vf module model version. */
- private String vfModuleModelVersion;
-
- /**
- * Instantiates a new tosca metadata.
- */
- public ToscaMetadata() {}
-
- /**
- * Gets the type.
- *
- * @return the type
- */
- public String getType() {
- return type;
- }
-
- /**
- * Gets the invariant UUID.
- *
- * @return the invariant UUID
- */
- public String getInvariantUUID() {
- return invariantUUID;
- }
- /**
- * Gets the customization UUID.
- *
- * @return the customization UUID
- */
- public String getCustomizationUUID() {
- return customizationUUID;
- }
- /**
- * Gets the uuid.
- *
- * @return the uuid
- */
- public String getUUID() {
- return uuid;
- }
-
- /**
- * Gets the version.
- *
- * @return the version
- */
- public String getVersion() {
- return version;
- }
-
- /**
- * Gets the name.
- *
- * @return the name
- */
- public String getName() {
- return name;
- }
-
- /**
- * Gets the description.
- *
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Gets the category.
- *
- * @return the category
- */
- public String getCategory() {
- return category;
- }
-
- /**
- * Gets the subcategory.
- *
- * @return the subcategory
- */
- public String getSubcategory() {
- return subcategory;
- }
-
- /**
- * Gets the resource vendor.
- *
- * @return the resource vendor
- */
- public String getResourceVendor() {
- return resourceVendor;
- }
-
- /**
- * Gets the resource vendor release.
- *
- * @return the resource vendor release
- */
- public String getResourceVendorRelease() {
- return resourceVendorRelease;
- }
-
- /**
- * Returns the value of service ecomp naming.
- *
- * @return serviceEcompNaming
- */
- public String getServiceEcompNaming() {
- return serviceEcompNaming;
- }
- /**
- * Returns the value of the naming policy.
- *
- * @return namingPolicy
- */
- public String getNamingPolicy() {
- return namingPolicy;
- }
- /**
- * Checks if is service homing.
- *
- * @return true, if is service homing
- */
- public boolean isServiceHoming() {
- return serviceHoming;
- }
- /**
- * Checks if is ecomp generated naming.
- *
- * @return true, if ecomp generated naming is true
- */
- public boolean isEcompGeneratedNaming() {
- return ecompGeneratedNaming;
- }
- /**
- * Sets the type.
- *
- * @param type the new type
- */
- public void setType(String type) {
- this.type = type;
- }
-
- /**
- * Sets the invariant UUID.
- *
- * @param invariantUUID the new invariant UUID
- */
- public void setInvariantUUID(String invariantUUID) {
- this.invariantUUID = invariantUUID;
- }
- /**
- * Sets the naming policy.
- *
- * @param namingPolicy the new naming policy
- */
- public void setNamingPolicy(String namingPolicy) {
- this.namingPolicy = namingPolicy;
- }
- /**
- * Sets the uuid.
- *
- * @param uuid the new uuid
- */
- public void setUUID(String uuid) {
- this.uuid = uuid;
- }
- /**
- * Sets the customization uuid.
- *
- * @param u the new customization uuid
- */
- public void setCustomizationUUID(String u) {
- this.customizationUUID = u;
- }
- /**
- * Sets the version.
- *
- * @param version the new version
- */
- public void setVersion(String version) {
- this.version = version;
- }
-
- /**
- * Sets the name.
- *
- * @param name the new name
- */
- public void setName(String name) {
- this.name = name;
- }
-
- /**
- * Sets the description.
- *
- * @param description the new description
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Sets the category.
- *
- * @param category the new category
- */
- public void setCategory(String category) {
- this.category = category;
- }
-
- /**
- * Sets the service ecomp naming.
- *
- * @param serviceEcompNaming the new service ecomp naming
- */
- public void setServiceEcompNaming(String serviceEcompNaming) {
- this.serviceEcompNaming = serviceEcompNaming;
- }
-
- /**
- * Sets the service homing.
- *
- * @param serviceHoming the new service homing
- */
- public void setServiceHoming(boolean serviceHoming) {
- this.serviceHoming = serviceHoming;
- }
- /**
- * Sets the ecomp generated naming.
- *
- * @param ecompGeneratedNaming the new ecomp generated naming
- */
- public void setEcompGeneratedNaming(boolean ecompGeneratedNaming) {
- this.ecompGeneratedNaming = ecompGeneratedNaming;
- }
- /**
- * Gets the template name.
- *
- * @return the template name
- */
- public String gettemplate_name() {
- return template_name;
- }
-
- /**
- * Sets the template name.
- *
- * @param template_name the new template name
- */
- public void settemplate_name(String template_name) {
- this.template_name = template_name;
- }
-
- /**
- * Sets the subcategory.
- *
- * @param subcategory the new subcategory
- */
- public void setSubcategory(String subcategory) {
- this.subcategory = subcategory;
- }
-
- /**
- * Sets the resource vendor.
- *
- * @param resourceVendor the new resource vendor
- */
- public void setResourceVendor(String resourceVendor) {
- this.resourceVendor = resourceVendor;
- }
-
- /**
- * Sets the resource vendor release.
- *
- * @param resourceVendorRelease the new resource vendor release
- */
- public void setResourceVendorRelease(String resourceVendorRelease) {
- this.resourceVendorRelease = resourceVendorRelease;
- }
-
- /**
- * Gets the vf module model name.
- *
- * @return the vf module model name
- */
- public String getVfModuleModelName() {
- return vfModuleModelName;
- }
-
- /**
- * Sets the vf module model name.
- *
- * @param vfModuleModelName the new vf module model name
- */
- public void setVfModuleModelName(String vfModuleModelName) {
- this.vfModuleModelName = vfModuleModelName;
- }
-
- /**
- * Gets the vf module model invariant UUID.
- *
- * @return the vf module model invariant UUID
- */
- public String getVfModuleModelInvariantUUID() {
- return vfModuleModelInvariantUUID;
- }
-
- /**
- * Sets the vf module model invariant UUID.
- *
- * @param vfModuleModelInvariantUUID the new vf module model invariant UUID
- */
- public void setVfModuleModelInvariantUUID(String vfModuleModelInvariantUUID) {
- this.vfModuleModelInvariantUUID = vfModuleModelInvariantUUID;
- }
-
- /**
- * Gets the vf module model UUID.
- *
- * @return the vf module model UUID
- */
- public String getVfModuleModelUUID() {
- return vfModuleModelUUID;
- }
-
- /**
- * Sets the vf module model UUID.
- *
- * @param vfModuleModelUUID the new vf module model UUID
- */
- public void setVfModuleModelUUID(String vfModuleModelUUID) {
- this.vfModuleModelUUID = vfModuleModelUUID;
- }
-
- /**
- * Gets the vf module model version.
- *
- * @return the vf module model version
- */
- public String getVfModuleModelVersion() {
- return vfModuleModelVersion;
- }
-
- /**
- * Sets the vf module model version.
- *
- * @param vfModuleModelVersion the new vf module model version
- */
- public void setVfModuleModelVersion(String vfModuleModelVersion) {
- this.vfModuleModelVersion = vfModuleModelVersion;
- }
- /**
- * Sets the vf module customization uuid.
- *
- * @param u the new vf module model customization uuid
- */
- public void setVfModuleModelCustomizationUUID(String u) {
- this.vfModuleModelCustomizationUUID = u;
- }
- /**
- * Gets the vf module model customization uuid.
- *
- * @return the vf module model customization uuid
- */
- public String getVfModuleModelCustomizationUUID() {
-
- return vfModuleModelCustomizationUUID;
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaModel.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaModel.java
deleted file mode 100755
index 77fbe913..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/beans/tosca/ToscaModel.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.asdc.beans.tosca;
-
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.Map;
-
-/**
- * The Class ToscaModel.
- */
-public class ToscaModel {
-
- /** The tosca definitions version. */
- private String tosca_definitions_version;
-
- /** The description. */
- private String description;
-
- /** The metadata. */
- private ToscaMetadata metadata;
-
- /** The topology template. */
- private TopologyTemplate topology_template;
-
- /** The imports. */
- private Collection<Map<String, Map<String, String>>> imports;
-
- /** The node types. */
- private Map<String, Object> node_types;
-
- /**
- * Instantiates a new tosca model.
- */
- public ToscaModel() {
- metadata = new ToscaMetadata();
- topology_template = new TopologyTemplate();
- imports = new LinkedList<Map<String, Map<String, String>>> ();
- }
-
- /**
- * Gets the metadata.
- *
- * @return the metadata
- */
- public ToscaMetadata getMetadata() {
- return metadata;
- }
-
- /**
- * Sets the metadata.
- *
- * @param metadata the new metadata
- */
- public void setMetadata(ToscaMetadata metadata) {
- this.metadata = metadata;
- }
-
- /**
- * Gets the tosca definitions version.
- *
- * @return the tosca definitions version
- */
- public String gettosca_definitions_version() {
- return tosca_definitions_version;
- }
-
- /**
- * Sets the tosca definitions version.
- *
- * @param tosca_definitions_version the new tosca definitions version
- */
- public void settosca_definitions_version(String tosca_definitions_version) {
- this.tosca_definitions_version = tosca_definitions_version;
- }
-
- /**
- * Gets the topology template.
- *
- * @return the topology template
- */
- public TopologyTemplate gettopology_template() {
- return topology_template;
- }
-
- /**
- * Sets the topology template.
- *
- * @param topology_template the new topology template
- */
- public void settopology_template(TopologyTemplate topology_template) {
- this.topology_template = topology_template;
- }
-
- /**
- * Gets the description.
- *
- * @return the description
- */
- public String getDescription() {
- return description;
- }
-
- /**
- * Sets the description.
- *
- * @param description the new description
- */
- public void setDescription(String description) {
- this.description = description;
- }
-
- /**
- * Gets the imports.
- *
- * @return the imports
- */
- public Collection<Map<String, Map<String, String>>> getImports() {
- return imports;
- }
-
- /**
- * Sets the imports.
- *
- * @param imports the imports
- */
- public void setImports(Collection<Map<String, Map<String, String>>> imports) {
- this.imports = imports;
- }
-
- /**
- * Gets the node types.
- *
- * @return the node types
- */
- public Map<String, Object> getnode_types() {
- return node_types;
- }
-
- /**
- * Setnode types.
- *
- * @param node_types the node types
- */
- public void setnode_types(Map<String, Object> node_types) {
- this.node_types = node_types;
- }
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/local/LocalAsdcClient.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/local/LocalAsdcClient.java
deleted file mode 100644
index 696e1890..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/local/LocalAsdcClient.java
+++ /dev/null
@@ -1,393 +0,0 @@
-package org.openecomp.vid.asdc.local;
-
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.json.JSONArray;
-import org.json.JSONObject;
-import org.openecomp.vid.asdc.AsdcCatalogException;
-import org.openecomp.vid.asdc.AsdcClient;
-import org.openecomp.vid.asdc.beans.Artifact;
-import org.openecomp.vid.asdc.beans.Resource;
-import org.openecomp.vid.asdc.beans.Service;
-import org.openecomp.vid.asdc.beans.tosca.ToscaCsar;
-import org.openecomp.vid.asdc.beans.tosca.ToscaMeta;
-import org.openecomp.vid.asdc.beans.tosca.ToscaModel;
-import org.yaml.snakeyaml.Yaml;
-
-import java.io.File;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.Paths;
-import java.nio.file.StandardCopyOption;
-import java.util.*;
-import java.util.zip.ZipFile;
-
-/**
- * The Class LocalAsdcClient.
- */
-public class LocalAsdcClient implements AsdcClient {
-
-
- /**
- * The catalog.
- */
- private final JSONObject catalog;
-
- /**
- * The mapper.
- */
- private final ObjectMapper mapper;
-
- /**
- * The Class Builder.
- */
- public static class Builder {
-
- /**
- * The catalog.
- */
- private JSONObject catalog = new JSONObject()
- .put("resources", new JSONObject())
- .put("services", new JSONObject());
-
- /**
- * The mapper.
- */
- private ObjectMapper mapper = new ObjectMapper();
-
- /**
- * Instantiates a new builder.
- */
- public Builder() {
- }
-
- /**
- * Catalog.
- *
- * @param catalog the catalog
- * @return the builder
- */
- public org.openecomp.vid.asdc.local.LocalAsdcClient.Builder catalog(JSONObject catalog) {
- this.catalog = catalog;
- return this;
- }
-
- /**
- * Mapper.
- *
- * @param mapper the mapper
- * @return the builder
- */
- public org.openecomp.vid.asdc.local.LocalAsdcClient.Builder mapper(ObjectMapper mapper) {
- this.mapper = mapper;
- return this;
- }
-
- /**
- * Builds the.
- *
- * @return the in local sdc client
- */
- public org.openecomp.vid.asdc.local.LocalAsdcClient build() {
- return new org.openecomp.vid.asdc.local.LocalAsdcClient(this);
- }
- }
-
- /**
- * Instantiates a new in local sdc client.
- *
- * @param builder the builder
- */
- private LocalAsdcClient(org.openecomp.vid.asdc.local.LocalAsdcClient.Builder builder) {
- catalog = builder.catalog;
- mapper = builder.mapper;
- }
-
- /**
- * Gets the catalog.
- *
- * @return the catalog
- */
- private JSONObject getCatalog() {
- return catalog;
- }
-
- /**
- * Gets the mapper.
- *
- * @return the mapper
- */
- private ObjectMapper getMapper() {
- return mapper;
- }
-
- /**
- * Convert.
- *
- * @param <T> the generic type
- * @param json the json
- * @param clazz the clazz
- * @return the t
- * @throws AsdcCatalogException the sdc catalog exception
- */
- private <T> T convert(JSONObject json, Class<T> clazz) throws AsdcCatalogException {
- try {
- return getMapper().readValue(json.toString(), clazz);
- } catch (JsonParseException e) {
- throw new AsdcCatalogException("Failed to parse SDC response (bad data)", e);
- } catch (JsonMappingException e) {
- throw new AsdcCatalogException("Failed to map SDC response to internal VID data structure(s)", e);
- } catch (IOException e) {
- throw new AsdcCatalogException("Failed to get a response from SDC", e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getResource(java.util.UUID)
- */
- public Resource getResource(UUID uuid) throws AsdcCatalogException {
- final JSONObject resource = getCatalog().getJSONObject("resources")
- .getJSONObject(uuid.toString());
- return convert(resource, Resource.class);
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getResources()
- */
- public Collection<Resource> getResources() throws AsdcCatalogException {
- final Collection<Resource> resources = new LinkedList<Resource>();
-
- for (String key : getCatalog().getJSONObject("resources").keySet()) {
- final JSONObject json = getCatalog().getJSONObject("resources").getJSONObject(key);
- final Resource resource = convert(json, Resource.class);
- resources.add(resource);
- }
-
- return resources;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getResources(java.util.Map)
- */
- public Collection<Resource> getResources(Map<String, String[]> filter) throws AsdcCatalogException {
- final Collection<Resource> resources = new LinkedList<Resource>();
-
- for (String key : getCatalog().getJSONObject("resources").keySet()) {
- final JSONObject json = getCatalog().getJSONObject("resources").getJSONObject(key);
-
- boolean filterMatch = true;
-
- for (Map.Entry<String, String[]> entry : filter.entrySet()) {
- for (int i = 0; i < entry.getValue().length; i++) {
- if (!json.getString(entry.getKey()).equals(entry.getValue()[i])) {
- filterMatch = false;
- break;
- }
- }
- }
-
- if (filterMatch) resources.add(convert(json, Resource.class));
- }
-
- return resources;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getService(java.util.UUID)
- */
- public Service getService(UUID uuid) throws AsdcCatalogException {
-
- JSONObject serviceJsonObject = null;
- final JSONArray categoryJsonArray = getCatalog().getJSONArray("services");
-
- for (int i = 0; i < categoryJsonArray.length() ; i++) {
- JSONObject jsonServiceObject = categoryJsonArray.getJSONObject(i);
- if (jsonServiceObject.get("uuid").equals(uuid.toString())) {
- serviceJsonObject = jsonServiceObject;
- break;
- }
- }
-
- if (serviceJsonObject != null)
- return convert(serviceJsonObject, Service.class);
- else return null;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getServices()
- */
- public Collection<Service> getServices() throws AsdcCatalogException {
- final Collection<Service> services = new LinkedList<Service>();
-
- JSONArray servicesArr = getCatalog().getJSONArray("services");
-
- for (Object objService : servicesArr) {
- JSONObject jsonServiceItem = (JSONObject) objService;
- final Service service = convert(jsonServiceItem, Service.class);
- services.add(service);
- }
-
- return services;
- }
-
- /* (non-Javadoc)
- * @see org.openecompt.vid.asdc.AsdcClient#getServices(java.util.Map)
- */
- public Collection<Service> getServices(Map<String, String[]> filter) throws AsdcCatalogException {
- final Collection<Service> services = new LinkedList<Service>();
-
- JSONArray catalogServices = catalog.getJSONArray("services");
-
- for (int i = 0; i < catalogServices.length(); i++) {
-
- JSONObject serviceJson = catalogServices.getJSONObject(i);
-
- boolean filterMatch = true;
-
- for (Map.Entry<String, String[]> entry : filter.entrySet()) {
- for (int j = 0; j < entry.getValue().length; j++) {
- if (!serviceJson.getString(entry.getKey()).equals(entry.getValue()[j])) {
- filterMatch = false;
- break;
- }
- }
- }
- if (filterMatch) services.add(convert(serviceJson, Service.class));
- }
- return services;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getResourceArtifact(java.util.UUID, java.util.UUID)
- */
- public Artifact getResourceArtifact(UUID resourceUuid, UUID artifactUuid) throws AsdcCatalogException {
- final JSONArray artifacts = getCatalog().getJSONObject("resources")
- .getJSONObject(resourceUuid.toString())
- .getJSONArray("artifacts");
-
- for (int i = 0; i < artifacts.length(); i++) {
- final JSONObject artifact = artifacts.getJSONObject(i);
-
- if (artifact.getString("artifactUUID").equals(artifactUuid.toString())) {
- return convert(artifact, Artifact.class);
- }
- }
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getServiceArtifact(java.util.UUID, java.util.UUID)
- */
- public Artifact getServiceArtifact(UUID serviceUuid, UUID artifactUuid) throws AsdcCatalogException {
- final JSONArray artifacts = getCatalog().getJSONObject("services")
- .getJSONObject(serviceUuid.toString())
- .getJSONArray("artifacts");
-
- for (int i = 0; i < artifacts.length(); i++) {
- final JSONObject artifact = artifacts.getJSONObject(i);
-
- if (artifact.getString("artifactUUID").equals(artifactUuid.toString())) {
- return convert(artifact, Artifact.class);
- }
- }
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getResourceToscaModel(java.util.UUID)
- */
- public Path getResourceToscaModel(UUID resourceUuid) throws AsdcCatalogException {
- final String toscaModelURL = getCatalog().getJSONObject("resources")
- .getJSONObject(resourceUuid.toString())
- .getString("toscaModelURL");
-
-
- final InputStream toscaModelStream = getClass().getClassLoader().getResourceAsStream(toscaModelURL);
-
- if (toscaModelStream == null) return null;
-
- return null;//getToscaModel(toscaModelStream);
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getServiceToscaModel(java.util.UUID)
- */
- public Path getServiceToscaModel(UUID serviceUuid) throws AsdcCatalogException {
-
- String toscaModelURL = null;
-
- final JSONArray categoryJsonArray = getCatalog().getJSONArray("services");
-
- for (int i = 0; i < categoryJsonArray.length() ; i++) {
-
- JSONObject jsonServiceObject = categoryJsonArray.getJSONObject(i);
- if (jsonServiceObject.get("uuid").equals(serviceUuid.toString())) {
- toscaModelURL = jsonServiceObject.getString("toscaModelURL");
- break;
- }
- }
-
- if (toscaModelURL==null){
- return null;
- }
-
- final InputStream toscaModelStream = getClass().getClassLoader().getResourceAsStream(toscaModelURL);
-
- ClassLoader classLoader = getClass().getClassLoader();
- File file = new File(classLoader.getResource(toscaModelURL).getFile());
- Path path = Paths.get(file.getPath());
-
- if (toscaModelStream == null) return null;
-
- return path;
- }
-
- /**
- * Gets the tosca model.
- *
- * @param csarInputStream the csar input stream
- * @return the tosca model
- * @throws AsdcCatalogException the asdc catalog exception
- */
- private ToscaCsar getToscaModel(InputStream csarInputStream) throws AsdcCatalogException {
- final Path csarFile;
-
- try {
- csarFile = Files.createTempFile("csar", ".zip");
- Files.copy(csarInputStream, csarFile, StandardCopyOption.REPLACE_EXISTING);
- } catch (IOException e) {
- throw new AsdcCatalogException("Caught IOException while creating CSAR", e);
- }
-
- try (final ZipFile csar = new ZipFile(csarFile.toFile())) {
-
- final InputStream toscaMetaStream = csar.getInputStream(csar.getEntry("TOSCA-Metadata/TOSCA.meta"));
- final ToscaMeta toscaMeta = new ToscaMeta.Builder(toscaMetaStream).build();
- final String entryDefinitions = toscaMeta.get("Entry-Definitions");
- final InputStream toscaParentEntryYamlStream = csar.getInputStream(csar.getEntry(entryDefinitions));
-
- final Yaml yaml = new Yaml();
- final ToscaModel parentModel = yaml.loadAs(toscaParentEntryYamlStream, ToscaModel.class);
-
- final ToscaCsar.Builder csarBuilder = new ToscaCsar.Builder(parentModel);
-
- for (Map<String, Map<String, String>> imports : parentModel.getImports()) {
- for (Map.Entry<String, Map<String, String>> entry : imports.entrySet()) {
- final InputStream toscaChildEntryYamlStream = csar.getInputStream(csar.getEntry("Definitions/" + entry.getValue().get("file")));
- final ToscaModel childModel = yaml.loadAs(toscaChildEntryYamlStream, ToscaModel.class);
- csarBuilder.addVnf(childModel);
- }
- }
-
- return csarBuilder.build();
- } catch (IOException e) {
- throw new AsdcCatalogException("Caught IOException while processing CSAR", e);
- }
- }
-
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/memory/InMemoryAsdcClient.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/memory/InMemoryAsdcClient.java
deleted file mode 100755
index 2b783d45..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/memory/InMemoryAsdcClient.java
+++ /dev/null
@@ -1,372 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.asdc.memory;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.StandardCopyOption;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.UUID;
-import java.util.zip.ZipFile;
-
-import org.codehaus.jackson.JsonParseException;
-import org.codehaus.jackson.map.JsonMappingException;
-import org.codehaus.jackson.map.ObjectMapper;
-import org.json.JSONArray;
-import org.json.JSONObject;
-import org.yaml.snakeyaml.Yaml;
-
-import org.openecomp.vid.asdc.AsdcCatalogException;
-import org.openecomp.vid.asdc.AsdcClient;
-import org.openecomp.vid.asdc.beans.Artifact;
-import org.openecomp.vid.asdc.beans.Resource;
-import org.openecomp.vid.asdc.beans.Service;
-import org.openecomp.vid.asdc.beans.tosca.ToscaCsar;
-import org.openecomp.vid.asdc.beans.tosca.ToscaMeta;
-import org.openecomp.vid.asdc.beans.tosca.ToscaModel;
-
-/**
- * The Class InMemoryAsdcClient.
- */
-public class InMemoryAsdcClient implements AsdcClient {
-
- /** The catalog. */
- private final JSONObject catalog;
-
- /** The mapper. */
- private final ObjectMapper mapper;
-
- /**
- * The Class Builder.
- */
- public static class Builder {
-
- /** The catalog. */
- private JSONObject catalog = new JSONObject()
- .put("resources", new JSONObject())
- .put("services", new JSONObject());
-
- /** The mapper. */
- private ObjectMapper mapper = new ObjectMapper();
-
- /**
- * Instantiates a new builder.
- */
- public Builder() {}
-
- /**
- * Catalog.
- *
- * @param catalog the catalog
- * @return the builder
- */
- public Builder catalog(JSONObject catalog) {
- this.catalog = catalog;
- return this;
- }
-
- /**
- * Mapper.
- *
- * @param mapper the mapper
- * @return the builder
- */
- public Builder mapper(ObjectMapper mapper) {
- this.mapper = mapper;
- return this;
- }
-
- /**
- * Builds the.
- *
- * @return the in memory sdc client
- */
- public InMemoryAsdcClient build() {
- return new InMemoryAsdcClient(this);
- }
- }
-
- /**
- * Instantiates a new in memory sdc client.
- *
- * @param builder the builder
- */
- InMemoryAsdcClient(Builder builder) {
- catalog = builder.catalog;
- mapper = builder.mapper;
- }
-
- /**
- * Gets the catalog.
- *
- * @return the catalog
- */
- private JSONObject getCatalog() {
- return catalog;
- }
-
- /**
- * Gets the mapper.
- *
- * @return the mapper
- */
- private ObjectMapper getMapper() {
- return mapper;
- }
-
- /**
- * Convert.
- *
- * @param <T> the generic type
- * @param json the json
- * @param clazz the clazz
- * @return the t
- * @throws AsdcCatalogException the sdc catalog exception
- */
- private <T> T convert(JSONObject json, Class<T> clazz) throws AsdcCatalogException {
- try {
- return getMapper().readValue(json.toString(), clazz);
- } catch (JsonParseException e) {
- throw new AsdcCatalogException("Failed to parse SDC response (bad data)", e);
- } catch (JsonMappingException e) {
- throw new AsdcCatalogException("Failed to map SDC response to internal VID data structure(s)", e);
- } catch (IOException e) {
- throw new AsdcCatalogException("Failed to get a response from SDC", e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getResource(java.util.UUID)
- */
- public Resource getResource(UUID uuid) throws AsdcCatalogException {
- final JSONObject resource = getCatalog().getJSONObject("resources")
- .getJSONObject(uuid.toString());
- return convert(resource, Resource.class);
- }
-
- /* (non-Javadoc)
- */
- public Collection<Resource> getResources() throws AsdcCatalogException {
- final Collection<Resource> resources = new LinkedList<Resource> ();
-
- for (String key : getCatalog().getJSONObject("resources").keySet()) {
- final JSONObject json = getCatalog().getJSONObject("resources").getJSONObject(key);
- final Resource resource = convert(json, Resource.class);
- resources.add(resource);
- }
-
- return resources;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getResources(java.util.Map)
- */
- public Collection<Resource> getResources(Map<String, String[]> filter) throws AsdcCatalogException {
- final Collection<Resource> resources = new LinkedList<Resource> ();
-
- for (String key : getCatalog().getJSONObject("resources").keySet()) {
- final JSONObject json = getCatalog().getJSONObject("resources").getJSONObject(key);
-
- boolean filterMatch = true;
-
- for (Entry<String, String[]> entry : filter.entrySet()) {
- for (int i = 0; i < entry.getValue().length; i++) {
- if (!json.getString(entry.getKey()).equals(entry.getValue()[i])) {
- filterMatch = false;
- break;
- }
- }
- }
-
- if (filterMatch) resources.add(convert(json, Resource.class));
- }
-
- return resources;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getService(java.util.UUID)
- */
- public Service getService(UUID uuid) throws AsdcCatalogException {
- final JSONObject service = getCatalog().getJSONObject("services")
- .getJSONObject(uuid.toString());
- return convert(service, Service.class);
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getServices()
- */
- public Collection<Service> getServices() throws AsdcCatalogException {
- final Collection<Service> services = new LinkedList<Service> ();
-
- for (String key : getCatalog().getJSONObject("services").keySet()) {
- final JSONObject json = getCatalog().getJSONObject("services").getJSONObject(key);
- final Service service = convert(json, Service.class);
- services.add(service);
- }
-
- return services;
- }
-
- /* (non-Javadoc)
- * @see org.openecompt.vid.asdc.AsdcClient#getServices(java.util.Map)
- */
- public Collection<Service> getServices(Map<String, String[]> filter) throws AsdcCatalogException {
- final Collection<Service> services = new LinkedList<Service> ();
-
- for (String key : getCatalog().getJSONObject("services").keySet()) {
- final JSONObject json = getCatalog().getJSONObject("services").getJSONObject(key);
-
- boolean filterMatch = true;
-
- for (Entry<String, String[]> entry : filter.entrySet()) {
- for (int i = 0; i < entry.getValue().length; i++) {
- if (!json.getString(entry.getKey()).equals(entry.getValue()[i])) {
- filterMatch = false;
- break;
- }
- }
- }
-
- if (filterMatch) services.add(convert(json, Service.class));
- }
-
- return services;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getResourceArtifact(java.util.UUID, java.util.UUID)
- */
- public Artifact getResourceArtifact(UUID resourceUuid, UUID artifactUuid) throws AsdcCatalogException {
- final JSONArray artifacts = getCatalog().getJSONObject("resources")
- .getJSONObject(resourceUuid.toString())
- .getJSONArray("artifacts");
-
- for (int i = 0; i < artifacts.length(); i++) {
- final JSONObject artifact = artifacts.getJSONObject(i);
-
- if (artifact.getString("artifactUUID").equals(artifactUuid.toString())) {
- return convert(artifact, Artifact.class);
- }
- }
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getServiceArtifact(java.util.UUID, java.util.UUID)
- */
- public Artifact getServiceArtifact(UUID serviceUuid, UUID artifactUuid) throws AsdcCatalogException {
- final JSONArray artifacts = getCatalog().getJSONObject("services")
- .getJSONObject(serviceUuid.toString())
- .getJSONArray("artifacts");
-
- for (int i = 0; i < artifacts.length(); i++) {
- final JSONObject artifact = artifacts.getJSONObject(i);
-
- if (artifact.getString("artifactUUID").equals(artifactUuid.toString())) {
- return convert(artifact, Artifact.class);
- }
- }
-
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getResourceToscaModel(java.util.UUID)
- */
- public Path getResourceToscaModel(UUID resourceUuid) throws AsdcCatalogException {
- final String toscaModelURL = getCatalog().getJSONObject("resources")
- .getJSONObject(resourceUuid.toString())
- .getString("toscaModelURL");
-
-
- final InputStream toscaModelStream = getClass().getClassLoader().getResourceAsStream(toscaModelURL);
-
- if (toscaModelStream == null) return null;
-
- return null;//getToscaModel(toscaModelStream);
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getServiceToscaModel(java.util.UUID)
- */
- public Path getServiceToscaModel(UUID serviceUuid) throws AsdcCatalogException {
- final String toscaModelURL = getCatalog().getJSONObject("services")
- .getJSONObject(serviceUuid.toString())
- .getString("toscaModelURL");
-
- final InputStream toscaModelStream = getClass().getClassLoader().getResourceAsStream(toscaModelURL);
-
- if (toscaModelStream == null) return null;
-
- return null;//getToscaModel(toscaModelStream);
- }
-
- /**
- * Gets the tosca model.
- *
- * @param csarInputStream the csar input stream
- * @return the tosca model
- * @throws AsdcCatalogException the asdc catalog exception
- */
- private ToscaCsar getToscaModel(InputStream csarInputStream) throws AsdcCatalogException {
- final Path csarFile;
-
- try {
- csarFile = Files.createTempFile("csar", ".zip");
- Files.copy(csarInputStream, csarFile, StandardCopyOption.REPLACE_EXISTING);
- } catch (IOException e) {
- throw new AsdcCatalogException("Caught IOException while creating CSAR", e);
- }
-
- try (final ZipFile csar = new ZipFile(csarFile.toFile())) {
-
- final InputStream toscaMetaStream = csar.getInputStream(csar.getEntry("TOSCA-Metadata/TOSCA.meta"));
- final ToscaMeta toscaMeta = new ToscaMeta.Builder(toscaMetaStream).build();
- final String entryDefinitions = toscaMeta.get("Entry-Definitions");
- final InputStream toscaParentEntryYamlStream = csar.getInputStream(csar.getEntry(entryDefinitions));
-
- final Yaml yaml = new Yaml();
- final ToscaModel parentModel = yaml.loadAs(toscaParentEntryYamlStream, ToscaModel.class);
-
- final ToscaCsar.Builder csarBuilder = new ToscaCsar.Builder(parentModel);
-
- for (Map<String, Map<String, String>> imports : parentModel.getImports()) {
- for (Entry<String, Map<String, String>> entry : imports.entrySet()) {
- final InputStream toscaChildEntryYamlStream = csar.getInputStream(csar.getEntry("Definitions/" + entry.getValue().get("file")));
- final ToscaModel childModel = yaml.loadAs(toscaChildEntryYamlStream, ToscaModel.class);
- csarBuilder.addVnf(childModel);
- }
- }
-
- return csarBuilder.build();
- } catch (IOException e) {
- throw new AsdcCatalogException("Caught IOException while processing CSAR", e);
- }
- }
-
-}
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/parser/ToscaParser.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/parser/ToscaParser.java
deleted file mode 100644
index eb166984..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/parser/ToscaParser.java
+++ /dev/null
@@ -1,15 +0,0 @@
-package org.openecomp.vid.asdc.parser;
-
-import java.nio.file.Path;
-
-import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
-import org.openecomp.vid.asdc.AsdcCatalogException;
-import org.openecomp.vid.asdc.beans.tosca.ToscaCsar;
-import org.openecomp.vid.asdc.beans.Service;
-import org.openecomp.vid.model.ServiceModel;
-
-public interface ToscaParser{
- ToscaCsar parse(Path path) throws AsdcCatalogException;
-
- ServiceModel makeServiceModel(String uuid,Path path,Service asdcServiceMetadata) throws Exception;
-} \ No newline at end of file
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/parser/ToscaParserImpl.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/parser/ToscaParserImpl.java
deleted file mode 100644
index bea5da87..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/parser/ToscaParserImpl.java
+++ /dev/null
@@ -1,225 +0,0 @@
-package org.openecomp.vid.asdc.parser;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.file.Path;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-import java.util.UUID;
-import java.util.Map.Entry;
-import java.util.zip.ZipFile;
-
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
-import org.openecomp.vid.asdc.AsdcCatalogException;
-import org.openecomp.vid.asdc.beans.Service;
-import org.openecomp.vid.asdc.beans.tosca.NodeTemplate;
-import org.openecomp.vid.asdc.beans.tosca.ToscaCsar;
-import org.openecomp.vid.asdc.beans.tosca.ToscaMeta;
-import org.openecomp.vid.asdc.beans.tosca.ToscaModel;
-import org.openecomp.vid.model.ModelConstants;
-import org.openecomp.vid.model.Network;
-import org.openecomp.vid.model.Node;
-import org.openecomp.vid.model.ServiceModel;
-import org.openecomp.vid.model.VNF;
-import org.openecomp.vid.properties.VidProperties;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.yaml.snakeyaml.Yaml;
-import org.yaml.snakeyaml.error.YAMLException;
-
-public class ToscaParserImpl implements ToscaParser {
- /** The Constant LOG. */
- static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(ToscaParserImpl.class);
-
- @Autowired
- private final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
-
- private static final String asdcModelNamespace = VidProperties.getAsdcModelNamespace();
- private static final String vnfTag = asdcModelNamespace + ModelConstants.VNF;
- private static final String networkTag = asdcModelNamespace + ModelConstants.NETWORK;
- private static final String vfModuleTag = asdcModelNamespace + ModelConstants.VF_MODULE;
-
-
- @Override
- public ToscaCsar parse(Path path) throws AsdcCatalogException {
- return getToscaCsar(path);
- }
-
- private ToscaCsar getToscaCsar(final Path csarFile) throws AsdcCatalogException {
- try (final ZipFile csar = new ZipFile(csarFile.toFile())) {
-
- final InputStream toscaMetaStream = csar.getInputStream(csar.getEntry("TOSCA-Metadata/TOSCA.meta"));
- final ToscaMeta toscaMeta = new ToscaMeta.Builder(toscaMetaStream).build();
- final String entryDefinitions = toscaMeta.get("Entry-Definitions");
- final InputStream toscaParentEntryYamlStream = csar.getInputStream(csar.getEntry(entryDefinitions));
-
- try {
- final Yaml yaml = new Yaml();
- final ToscaModel parentModel = yaml.loadAs(toscaParentEntryYamlStream, ToscaModel.class);
-
- final ToscaCsar.Builder csarBuilder = new ToscaCsar.Builder(parentModel);
-
- for (Map<String, Map<String, String>> imports : parentModel.getImports()) {
- LOG.debug("imports = " + imports.toString());
- for (Entry<String, Map<String, String>> entry : imports.entrySet()) {
- if (entry.getValue() != null) {
- String fname = entry.getValue().get("file");
- if ((fname != null) && (fname.startsWith("service") || fname.startsWith("resource"))) {
- LOG.debug("fname = " + fname);
- final InputStream toscaChildEntryYamlStream = csar
- .getInputStream(csar.getEntry("Definitions/" + fname));
-
- final ToscaModel childModel = yaml.loadAs(toscaChildEntryYamlStream, ToscaModel.class);
- csarBuilder.addVnf(childModel);
- }
- }
- }
- }
-
- return csarBuilder.build();
- } catch (YAMLException e) {
- throw new AsdcCatalogException("Caught exception while processing TOSCA YAML", e);
- }
- } catch (IOException e) {
- throw new AsdcCatalogException("Caught IOException while processing CSAR", e);
- }
- }
-
- public ServiceModel makeServiceModel(String uuid, final Path serviceCsar,Service service ) throws AsdcCatalogException, SdcToscaParserException {
-
-
- final ServiceModel serviceModel = new ServiceModel();
- ToscaCsar toscaCsar = getToscaCsar(serviceCsar);
- String methodName = "getServices";
- LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " start");
- Boolean isNewFlow = false;
- final Map<String, VNF> vnfs = new HashMap<String, VNF>();
- final Map<String, Network> networks = new HashMap<String, Network>();
- final ToscaModel asdcServiceToscaModel = toscaCsar.getParent();
- serviceModel.setService(ServiceModel.extractService(asdcServiceToscaModel, service));
-
-
- populateVnfsAndNetwork(methodName, isNewFlow, vnfs, networks, asdcServiceToscaModel, serviceModel);
-
- // If we see customization uuid under vnf or network, follow 1702 flow
- if (isNewFlow) {
- return (getCustomizedServices(asdcServiceToscaModel, serviceModel));
- } else {
- VNF vnf = null;
- for (ToscaModel vnfModel : toscaCsar.getChildren()) {
- // using uuid to match should only be valid for 1610 models
- final String vnfUuid = (vnfModel.getMetadata().getUUID());
- // find the VNF with that uuid, uuid is not the key anymore
- vnf = findVNFAccordingToUUID(vnfs, vnfUuid);
- if (vnf == null) {
- LOG.warn("Couldn't find VNF object " + vnfUuid + ". Problem with Tosca model?");
- continue;
- }
- extractAndUpdateInputs(vnf, vnfModel);
- ServiceModel.extractGroups(vnfModel, serviceModel);
- }
-
- serviceModel.setVnfs(vnfs);
- serviceModel.setNetworks(networks);
- return serviceModel;
- }
- }
-
- private VNF findVNFAccordingToUUID(final Map<String, VNF> vnfs, final String vnfUuid) {
- VNF vnf = null;
- for (Entry<String, VNF> vnfComp : vnfs.entrySet()) {
- if (((vnfComp.getValue().getUuid()).equalsIgnoreCase(vnfUuid))) {
- // found the vnf
- vnf = vnfComp.getValue();
- }
- }
- return vnf;
- }
-
- private void extractAndUpdateInputs(VNF vnf, ToscaModel vnfModel) {
- vnf.setInputs(vnfModel.gettopology_template().getInputs());
- }
-
- private static void populateVnfsAndNetwork(String methodName, Boolean isNewFlow, final Map<String, VNF> vnfs,
- final Map<String, Network> networks, final ToscaModel asdcServiceToscaModel, ServiceModel serviceModel)
- throws AsdcCatalogException, SdcToscaParserException {
- for (Entry<String, NodeTemplate> component : extractNodeTemplates(asdcServiceToscaModel)) {
- final String modelCustomizationName = component.getKey();
- LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName
- + " model customization name: " + modelCustomizationName);
- final NodeTemplate nodeTemplate = component.getValue();
- final String type = nodeTemplate.getType();
-
- if (type.startsWith(vnfTag)) {
- LOG.debug(EELFLoggerDelegate.debugLogger,
- dateFormat.format(new Date()) + methodName + " found node template type: " + type);
- final VNF vnf = new VNF();
- vnf.extractVnf(modelCustomizationName, nodeTemplate);
-// populateNodeVersionIfMissing(nodeTemplate, vnf,service);
- LOG.debug(EELFLoggerDelegate.debugLogger,
- dateFormat.format(new Date()) + methodName + " VNF commands: " + vnf.getCommands());
- vnfs.put(modelCustomizationName, vnf);
- isNewFlow = isNewFlow(vnf);
- }
- // Networks
- if (type.startsWith(networkTag)) {
- LOG.debug(EELFLoggerDelegate.debugLogger,
- dateFormat.format(new Date()) + methodName + " found node template type: " + type);
- final Network network = new Network();
- network.extractNetwork(modelCustomizationName, nodeTemplate);
-// populateNodeVersionIfMissing(nodeTemplate, network, service);
- isNewFlow = isNewFlow(network);
- networks.put(modelCustomizationName, network);
-
- }
- }
- serviceModel.setVnfs(vnfs);
- serviceModel.setNetworks(networks);
-
- }
-
- private static Set<Entry<String, NodeTemplate>> extractNodeTemplates(final ToscaModel asdcServiceToscaModel) {
- return asdcServiceToscaModel.gettopology_template().getnode_templates().entrySet();
- }
-
- private static boolean isNewFlow(Node node) {
- return (node.getCustomizationUuid() != null) && (node.getCustomizationUuid().length() > 0);
- }
-
- private static boolean isNodeVersionMissing(Node Node) {
- return Node.getVersion() == null;
- }
-
- private static void populateNodeVersionIfMissing(final NodeTemplate nodeTemplate, final Node node, Service service)
- throws AsdcCatalogException {
- if (isNodeVersionMissing(node)) {
- node.setVersion(service.getVersion());
- }
- }
-
- private ServiceModel getCustomizedServices(ToscaModel asdcServiceToscaModel, ServiceModel serviceModel) {
- String methodName = "asdcServiceToscaModel";
- LOG.debug(EELFLoggerDelegate.debugLogger, dateFormat.format(new Date()) + methodName + " start");
-
- // asdcServiceToscaModel should have vf modules and vol groups populated
- // at this point but
- // they are not associated with the VNFs
- ServiceModel.extractGroups(asdcServiceToscaModel,serviceModel);
- // Now put the vf modules and volume groups under the VNF they belong
- // too
- serviceModel.associateGroups();
- return (serviceModel);
- }
-
-
- private UUID extractUUIDFromNodeTemplate(final NodeTemplate nodeTemplate) {
- return UUID.fromString(nodeTemplate.getMetadata().getUUID());
- }
-
-
-} \ No newline at end of file
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/parser/ToscaParserImpl2.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/parser/ToscaParserImpl2.java
deleted file mode 100644
index f364d0b3..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/parser/ToscaParserImpl2.java
+++ /dev/null
@@ -1,254 +0,0 @@
-package org.openecomp.vid.asdc.parser;
-
-import org.openecomp.sdc.tosca.parser.api.ISdcCsarHelper;
-import org.openecomp.sdc.tosca.parser.exceptions.SdcToscaParserException;
-import org.openecomp.sdc.tosca.parser.impl.FilterType;
-import org.openecomp.sdc.tosca.parser.impl.SdcToscaParserFactory;
-import org.openecomp.sdc.toscaparser.api.Group;
-import org.openecomp.sdc.toscaparser.api.NodeTemplate;
-import org.openecomp.sdc.toscaparser.api.Property;
-import org.openecomp.sdc.toscaparser.api.parameters.Input;
-import org.openecomp.vid.asdc.beans.Service;
-import org.openecomp.vid.model.*;
-
-import java.nio.file.Path;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class ToscaParserImpl2 {
-
-
- public class Constants {
- public final static String uuid = "UUID";
- public final static String description = "description";
- public final static String serviceType = "serviceType";
- public final static String serviceRole = "serviceRole";
- public final static String ecompGeneratedNaming = "ecompGeneratedNaming";
-
- public final static String customizationUUID = "customizationUUID";
- public final static String vfModuleModelVersion = "vfModuleModelVersion";
- public final static String vfModuleModelCustomizationUUID = "vfModuleModelCustomizationUUID";
- public final static String volume_group = "volume_group";
- public final static String vfModuleModelInvariantUUID = "vfModuleModelInvariantUUID";
- public final static String vfModuleModelUUID = "vfModuleModelUUID";
- public final static String invariantUUID = "invariantUUID";
- public final static String version = "version";
- public final static String name = "name";
- public final static String category = "category";
- public final static String vfModuleModelName = "vfModuleModelName";
- public final static String getInput = "get_input";
- }
-
- public ToscaParserImpl2() {
-
- }
-
- public ServiceModel makeServiceModel(Path path, Service asdcServiceMetadata) throws Exception {
- ServiceModel serviceModel = new ServiceModel();
- SdcToscaParserFactory factory = SdcToscaParserFactory.getInstance();
- ISdcCsarHelper sdcCsarHelper = factory.getSdcCsarHelper(path.toFile().getAbsolutePath()); //, false);
- serviceModel.setService(extractServiceFromCsar(asdcServiceMetadata, sdcCsarHelper));
- serviceModel.setVolumeGroups(extractVolumeGroups(sdcCsarHelper));
- serviceModel.setVfModules(extractVfModuleFromCsar(sdcCsarHelper));
- serviceModel.setVnfs(extractVnfsFromCsar(serviceModel,sdcCsarHelper));
- serviceModel.setNetworks(extractNetworksFromCsar(sdcCsarHelper));
- return serviceModel;
- }
-
- private org.openecomp.vid.model.Service extractServiceFromCsar(Service asdcServiceMetadata, ISdcCsarHelper csarHelper) throws SdcToscaParserException {
- org.openecomp.vid.model.Service service = new org.openecomp.vid.model.Service();
-
- service.setName(csarHelper.getServiceMetadata().getValue(Constants.name));
- service.setCategory(csarHelper.getServiceMetadata().getValue(Constants.category));
- service.setInvariantUuid(csarHelper.getServiceMetadata().getValue(Constants.invariantUUID));
- service.setUuid(csarHelper.getServiceMetadata().getValue(Constants.uuid));
- service.setVersion(asdcServiceMetadata.getVersion());
- service.setDescription(csarHelper.getServiceMetadata().getValue(Constants.description));
- service.setInputs(inputsListToInputsMap(csarHelper.getServiceInputs()));
- service.setServiceEcompNaming(csarHelper.getServiceMetadata().getValue(Constants.ecompGeneratedNaming));
- service.setServiceType(csarHelper.getServiceMetadata().getValue(Constants.serviceType));
- service.setServiceRole(csarHelper.getServiceMetadata().getValue(Constants.serviceRole));
-
- return service;
- }
-
- private Map<String, VNF> extractVnfsFromCsar(ServiceModel serviceModel,ISdcCsarHelper csarHelper) {
- List<NodeTemplate> nodeTemplates = csarHelper.getServiceVfList();
- Map<String, VNF> vnfsMaps = new HashMap<String, VNF>();
-
- for (NodeTemplate nodeTemplate : nodeTemplates) {
- VNF vnf = new VNF();
- populateNodeFromNodeTemplate(nodeTemplate, csarHelper, vnf);
-
- vnf.setModelCustomizationName(nodeTemplate.getName());
- Map<String, VfModule> vfModuleHashMap = getVfModulesFromVF(csarHelper, vnf.getCustomizationUuid());
- vnf.setVfModules(vfModuleHashMap);
-
- Map<String, VolumeGroup> volumeGroupMap = getVolumeGroupsFromVF(csarHelper, vnf.getCustomizationUuid());
- vnf.setVolumeGroups(volumeGroupMap);
-
- vnfsMaps.put(nodeTemplate.getName(), vnf);
- }
- return vnfsMaps;
- }
-
- private Map<String, VfModule> getVfModulesFromVF(ISdcCsarHelper csarHelper, String vfUuid) {
- Map<String,VfModule> vfModuleHashMap = new HashMap<String,VfModule>();
- for (Group group : csarHelper.getVfModulesByVf(vfUuid)) {
- vfModuleHashMap.put(group.getName(), populateVfModuleFromGroup(group));
- }
- return vfModuleHashMap;
- }
-
- private Map<String, VolumeGroup> getVolumeGroupsFromVF(ISdcCsarHelper csarHelper, String vfCustomizationUuid) {
- Map<String,VolumeGroup> volumeGroupMap = new HashMap<String,VolumeGroup>();
- List<Group> groups = csarHelper.getVfModulesByVf(vfCustomizationUuid);
- for (Group group : groups) {
- boolean isVolumeGroup = Boolean.valueOf(group.getPropertyValue(Constants.volume_group).toString());
- if (isVolumeGroup) {
- volumeGroupMap.put(group.getName(), populateVolumeGroupFromGroup(group));
- }
- }
- return volumeGroupMap;
- }
-
- private Map<String, Network> extractNetworksFromCsar(ISdcCsarHelper csarHelper) {
- List<NodeTemplate> nodeTemplates = csarHelper.getServiceVlList();
- Map<String, Network> networksMap = new HashMap<String, Network>();
-
- for (NodeTemplate nodeTemplate : nodeTemplates) {
- Network newNetwork = new Network();
- populateNodeFromNodeTemplate(nodeTemplate, csarHelper, newNetwork);
- newNetwork.setModelCustomizationName(nodeTemplate.getName());
- networksMap.put(nodeTemplate.getName(), newNetwork);
- }
- return networksMap;
- }
-
- private Map<String, VfModule> extractVfModuleFromCsar(ISdcCsarHelper csarHelper) {
- List<NodeTemplate> serviceVfList = csarHelper.getServiceVfList();
- HashMap<String, VfModule> vfModuleHashMap = new HashMap<>();
-
- for (NodeTemplate nodeTemplate : serviceVfList) {
- Map<String, VfModule> nodeTemplateVfModule =
- getVfModulesFromVF(csarHelper, nodeTemplate.getMetaData().getValue(Constants.customizationUUID));
- vfModuleHashMap.putAll(nodeTemplateVfModule);
- }
- return vfModuleHashMap;
- }
-
- private Map<String, VolumeGroup> extractVolumeGroups(ISdcCsarHelper csarHelper) {
- HashMap<String, VolumeGroup> volumeGroupHashMap = new HashMap<>();
- for (NodeTemplate nodeTemplate : csarHelper.getServiceVfList()) {
- Map<String, VolumeGroup> nodeTemplateVolumeGroups =
- getVolumeGroupsFromVF(csarHelper, csarHelper.getNodeTemplateCustomizationUuid(nodeTemplate));
- volumeGroupHashMap.putAll(nodeTemplateVolumeGroups);
- }
- return volumeGroupHashMap;
- }
-
- private Map<String, org.openecomp.vid.asdc.beans.tosca.Input> inputsListToInputsMap(List<org.openecomp.sdc.toscaparser.api.parameters.Input> inputList) {
- Map<String, org.openecomp.vid.asdc.beans.tosca.Input> inputs = new HashMap<>();
- for (org.openecomp.sdc.toscaparser.api.parameters.Input input : inputList) {
- inputs.put(input.getName(), convertInput(input, new org.openecomp.vid.asdc.beans.tosca.Input()));
- }
- return inputs;
- }
-
- private Node populateNodeFromNodeTemplate(NodeTemplate nodeTemplate, ISdcCsarHelper csarHelper, Node newNode) {
- newNode.setCustomizationUuid(csarHelper.getNodeTemplateCustomizationUuid(nodeTemplate));
- newNode.setDescription(nodeTemplate.getMetaData().getValue(Constants.description));
- newNode.setInvariantUuid(nodeTemplate.getMetaData().getValue(Constants.invariantUUID));
- newNode.setUuid(nodeTemplate.getMetaData().getValue(Constants.uuid));
- newNode.setName(nodeTemplate.getMetaData().getValue(Constants.name));
- newNode.setVersion(nodeTemplate.getMetaData().getValue(Constants.version));
- newNode.setInputs(extractInputsAndCommandsForNodeTemplate(nodeTemplate, csarHelper, newNode));
- Map<String, String> propertiesMap = setPropertiesOfVnf(nodeTemplate.getPropertiesObjects());
- newNode.setProperties(propertiesMap);
- return newNode;
- }
-
- private VfModule populateVfModuleFromGroup(Group group){
- VfModule vfModule = new VfModule();
-
- vfModule.setVersion(group.getMetadata().getValue(Constants.vfModuleModelVersion));
- vfModule.setCustomizationUuid(group.getMetadata().getValue(Constants.vfModuleModelCustomizationUUID));
- vfModule.setModelCustomizationName(group.getMetadata().getValue(Constants.vfModuleModelName));
- vfModule.setName(group.getMetadata().getValue(Constants.vfModuleModelName));
- vfModule.setVolumeGroupAllowed(Boolean.valueOf((group.getPropertyValue(Constants.volume_group)).toString()));
- vfModule.setDescription(group.getDescription());
- vfModule.setInvariantUuid(group.getMetadata().getValue(Constants.vfModuleModelInvariantUUID));
- vfModule.setUuid(group.getMetadata().getValue(Constants.vfModuleModelUUID));
- return vfModule;
- }
-
- private VolumeGroup populateVolumeGroupFromGroup(Group group){
- VolumeGroup volumeGroup = new VolumeGroup();
- volumeGroup.setDescription(group.getDescription());
- volumeGroup.setInvariantUuid(group.getMetadata().getValue(Constants.vfModuleModelInvariantUUID));
- volumeGroup.setName(group.getMetadata().getValue(Constants.vfModuleModelName));
- volumeGroup.setModelCustomizationName(group.getMetadata().getValue(Constants.vfModuleModelName));
- volumeGroup.setVersion(group.getMetadata().getValue(Constants.vfModuleModelVersion));
- volumeGroup.setUuid(group.getMetadata().getValue(Constants.vfModuleModelUUID));
- volumeGroup.setCustomizationUuid(group.getMetadata().getValue(Constants.vfModuleModelCustomizationUUID));
-
- return volumeGroup;
- }
-
-
- private Map<String, org.openecomp.vid.asdc.beans.tosca.Input> extractInputsAndCommandsForNodeTemplate(NodeTemplate nodeTemplate, ISdcCsarHelper csarHelper, Node newNode){
- Map<String, org.openecomp.vid.asdc.beans.tosca.Input> inputMap = new HashMap<>();
- Map<String, CommandProperty> commandPropertyMap = new HashMap<>();
-
- List<Input> inputs = csarHelper.getServiceInputs();
- Map<String, String> properties = csarHelper.filterNodeTemplatePropertiesByValue(nodeTemplate, FilterType.CONTAINS, Constants.getInput);
- for (Map.Entry<String, String> property : properties.entrySet()) {
- String inputKey = property.getValue();
- String key = extractInputValue(inputKey);
- for (Input input: inputs){
- if(input.getName().equals(key)){
- org.openecomp.vid.asdc.beans.tosca.Input localInput = new org.openecomp.vid.asdc.beans.tosca.Input();
- localInput = convertInput(input, localInput);
- String name = property.getKey();
- commandPropertyMap.put(name, extractCommands(name, key));
- inputMap.put(name, localInput);
- }
- }
- }
- newNode.setCommands(commandPropertyMap);
- return inputMap;
- }
-
- private String extractInputValue(String inputKey) {
- return inputKey.substring(inputKey.indexOf(":") + 1);
- }
-
- private org.openecomp.vid.asdc.beans.tosca.Input convertInput(Input parserInput, org.openecomp.vid.asdc.beans.tosca.Input localInput){
- localInput.setDefault(parserInput.getDefault());
- localInput.setDescription(parserInput.getDescription());
- localInput.setRequired(parserInput.isRequired());
- localInput.setType(parserInput.getType());
- localInput.setConstraints(parserInput.getConstraints());
-// localInput.setentry_schema()
- return localInput;
- }
-
- private CommandProperty extractCommands(String displayName, String inputName){
- CommandProperty commandProperty = new CommandProperty();
- commandProperty.setDisplayName(displayName);
- commandProperty.setCommand(Constants.getInput);
- commandProperty.setInputName(inputName);
- return commandProperty;
- }
-
- private Map<String, String> setPropertiesOfVnf(List<Property> properties) {
- Map<String, String> propertiesMap = new HashMap<String, String>();
- for (Property property : properties) {
- propertiesMap.put(property.getName(), property.getValue().toString());
- }
- return propertiesMap;
- }
-
-
-} \ No newline at end of file
diff --git a/vid-app-common/src/main/java/org/openecomp/vid/asdc/rest/RestfulAsdcClient.java b/vid-app-common/src/main/java/org/openecomp/vid/asdc/rest/RestfulAsdcClient.java
deleted file mode 100755
index 67375aa6..00000000
--- a/vid-app-common/src/main/java/org/openecomp/vid/asdc/rest/RestfulAsdcClient.java
+++ /dev/null
@@ -1,467 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * VID
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.vid.asdc.rest;
-
-import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
-import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate;
-import org.openecomp.vid.asdc.AsdcCatalogException;
-import org.openecomp.vid.asdc.AsdcClient;
-import org.openecomp.vid.asdc.beans.Artifact;
-import org.openecomp.vid.asdc.beans.Resource;
-import org.openecomp.vid.asdc.beans.Service;
-import org.openecomp.vid.asdc.parser.ToscaParserImpl;
-import org.openecomp.vid.model.ModelConstants;
-import org.openecomp.vid.properties.VidProperties;
-
-import javax.ws.rs.NotFoundException;
-import javax.ws.rs.ProcessingException;
-import javax.ws.rs.WebApplicationException;
-import javax.ws.rs.client.Client;
-import javax.ws.rs.client.ResponseProcessingException;
-import javax.ws.rs.client.WebTarget;
-import javax.ws.rs.core.GenericType;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedHashMap;
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URI;
-import java.nio.file.Files;
-import java.nio.file.Path;
-import java.nio.file.StandardCopyOption;
-import java.text.DateFormat;
-import java.text.SimpleDateFormat;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.UUID;
-
-/**
- * The Class RestfulAsdcClient.
- */
-@SuppressWarnings("Duplicates")
-public class RestfulAsdcClient implements AsdcClient {
-
- /**
- * The Class Builder.
- */
- public static class Builder {
-
- /**
- * The client.
- */
- private final Client client;
-
- /**
- * The uri.
- */
- private final URI uri;
-
- /**
- * The auth.
- */
- private String auth = null;
-
- /**
- * Instantiates a new builder.
- *
- * @param client the client
- * @param uri the uri
- */
- public Builder(Client client, URI uri) {
- this.client = client;
- this.client.register(JacksonJsonProvider.class);
- this.uri = uri;
- }
-
- /**
- * Auth.
- *
- * @param auth the auth
- * @return the builder
- */
- public Builder auth(String auth) {
- this.auth = auth;
- return this;
- }
-
- /**
- * Builds the.
- *
- * @return the restful asdc client
- */
- public RestfulAsdcClient build() {
- return new RestfulAsdcClient(this);
- }
- }
-
- /**
- * The Constant LOG.
- */
- static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(RestfulAsdcClient.class);
-
- /**
- * The Constant dateFormat.
- */
- final static DateFormat dateFormat = new SimpleDateFormat("HH:mm:ss:SSSS");
-
- /**
- * The client.
- */
- private final Client client;
-
- /**
- * The uri.
- */
- private final URI uri;
-
- /**
- * The common headers.
- */
- private final MultivaluedHashMap<String, Object> commonHeaders;
-
- /**
- * The auth.
- */
- private final String auth;
-
- ToscaParserImpl p = new ToscaParserImpl();
-
- /**
- * Instantiates a new restful asdc client.
- *
- * @param builder the builder
- */
- private RestfulAsdcClient(Builder builder) {
- client = builder.client;
- uri = builder.uri;
- auth = builder.auth;
-
- commonHeaders = new MultivaluedHashMap<String, Object>();
- commonHeaders.put("X-ECOMP-InstanceID", Collections.singletonList((Object) "VID"));
- commonHeaders.put("Authorization", Collections.singletonList((Object) (auth)));
- }
-
- private Path createTmpFile(InputStream csarInputStream) throws AsdcCatalogException {
- final Path csarFile;
- try {
- csarFile = Files.createTempFile("csar", ".zip");
- Files.copy(csarInputStream, csarFile, StandardCopyOption.REPLACE_EXISTING);
- } catch (IOException e) {
- throw new AsdcCatalogException("Caught IOException while creating CSAR", e);
- }
- return csarFile;
- }
-
- /**
- * Gets the client.
- *
- * @return the client
- */
- private Client getClient() {
- return client;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getResource(java.util.UUID)
- */
- public Resource getResource(UUID uuid) throws AsdcCatalogException {
-
- String path = VidProperties.getPropertyWithDefault(ModelConstants.ASDC_RESOURCE_API_PATH, ModelConstants.DEFAULT_ASDC_RESOURCE_API_PATH);
- try {
- return getClient()
- .target(uri)
- .path(path + "/" + uuid.toString() + "/metadata")
- .request(MediaType.APPLICATION_JSON_TYPE)
- .headers(commonHeaders)
- .header("Content-Type", MediaType.APPLICATION_JSON)
- .get(Resource.class);
- } catch (ResponseProcessingException e) {
- //Couldn't convert response to Java type
- throw new AsdcCatalogException("ASDC response could not be processed", e);
- } catch (ProcessingException e) {
- //IO problems during request
- throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
- } catch (WebApplicationException e) {
- //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
- throw new AsdcCatalogException(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getResourceArtifact(java.util.UUID, java.util.UUID)
- */
- public Artifact getResourceArtifact(UUID resourceUuid, UUID artifactUuid) throws AsdcCatalogException {
- String path = VidProperties.getPropertyWithDefault(ModelConstants.ASDC_RESOURCE_API_PATH, ModelConstants.DEFAULT_ASDC_RESOURCE_API_PATH);
- try {
- return getClient()
- .target(uri)
- .path(path + "/" + resourceUuid + "/artifacts/" + artifactUuid)
- .request(MediaType.APPLICATION_JSON_TYPE)
- .headers(commonHeaders)
- .header("Content-Type", MediaType.APPLICATION_JSON)
- .get(Artifact.class);
- } catch (ResponseProcessingException e) {
- //Couldn't convert response to Java type
- throw new AsdcCatalogException("ASDC response could not be processed", e);
- } catch (ProcessingException e) {
- //IO problems during request
- throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
- } catch (WebApplicationException e) {
- //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
- throw new AsdcCatalogException(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getResources()
- */
- public Collection<Resource> getResources() throws AsdcCatalogException {
- String path = VidProperties.getPropertyWithDefault(ModelConstants.ASDC_RESOURCE_API_PATH, ModelConstants.DEFAULT_ASDC_RESOURCE_API_PATH);
- try {
- return getClient()
- .target(uri)
- .path(path)
- .request(MediaType.APPLICATION_JSON_TYPE)
- .headers(commonHeaders)
- .header("Content-Type", MediaType.APPLICATION_JSON)
- .get(new GenericType<Collection<Resource>>() {
- });
- } catch (ResponseProcessingException e) {
- //Couldn't convert response to Java type
- throw new AsdcCatalogException("ASDC response could not be processed", e);
- } catch (ProcessingException e) {
- //IO problems during request
- throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
- } catch (WebApplicationException e) {
- //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
- throw new AsdcCatalogException(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getResources(java.util.Map)
- */
- public Collection<Resource> getResources(Map<String, String[]> filter) throws AsdcCatalogException {
- String path = VidProperties.getPropertyWithDefault(ModelConstants.ASDC_RESOURCE_API_PATH, ModelConstants.DEFAULT_ASDC_RESOURCE_API_PATH);
- WebTarget target = getClient()
- .target(uri)
- .path(path);
-
- for (Entry<String, String[]> filterEntry : filter.entrySet()) {
- target = target.queryParam(filterEntry.getKey(), (Object[]) filterEntry.getValue());
- }
-
- try {
- return target.request()
- .accept(MediaType.APPLICATION_JSON_TYPE)
- .headers(commonHeaders)
- .header("Content-Type", MediaType.APPLICATION_JSON)
- .get(new GenericType<Collection<Resource>>() {
- });
- } catch (ResponseProcessingException e) {
- //Couldn't convert response to Java type
- throw new AsdcCatalogException("ASDC response could not be processed", e);
- } catch (ProcessingException e) {
- //IO problems during request
- throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
- } catch (NotFoundException e) {
- throw e;
- } catch (WebApplicationException e) {
- //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
- throw new AsdcCatalogException(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getResourceToscaModel(java.util.UUID)
- */
- public Path getResourceToscaModel(UUID resourceUuid) throws AsdcCatalogException {
- String path = VidProperties.getPropertyWithDefault(ModelConstants.ASDC_RESOURCE_API_PATH, ModelConstants.DEFAULT_ASDC_RESOURCE_API_PATH);
- try (final InputStream csarInputStream = (InputStream) getClient()
- .target(uri)
- .path(path + "/" + resourceUuid + "/toscaModel")
- .request(MediaType.APPLICATION_OCTET_STREAM_TYPE)
- .headers(commonHeaders)
- .header("Content-Type", MediaType.APPLICATION_OCTET_STREAM)
- .get(InputStream.class)) {
-
- return getToscaCsar(csarInputStream);
- } catch (IOException e) {
- throw new AsdcCatalogException("Failed to retrieve resource TOSCA model from ASDC", e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getService(java.util.UUID)
- */
- public Service getService(UUID uuid) throws AsdcCatalogException {
-
- String path = VidProperties.getPropertyWithDefault(ModelConstants.ASDC_SVC_API_PATH, ModelConstants.DEFAULT_ASDC_SVC_API_PATH);
- try {
- return getClient()
- .target(uri)
- .path(path + "/" + uuid.toString() + "/metadata")
- .request(MediaType.APPLICATION_JSON)
- .headers(commonHeaders)
- .get(Service.class);
- } catch (ResponseProcessingException e) {
- //Couldn't convert response to Java type
- throw new AsdcCatalogException("ASDC response could not be processed", e);
- } catch (ProcessingException e) {
- //IO problems during request
- throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
- } catch (WebApplicationException e) {
- //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
- throw new AsdcCatalogException(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getServiceArtifact(java.util.UUID, java.util.UUID)
- */
- public Artifact getServiceArtifact(UUID serviceUuid, UUID artifactUuid) throws AsdcCatalogException {
- String path = VidProperties.getPropertyWithDefault(ModelConstants.ASDC_SVC_API_PATH, ModelConstants.DEFAULT_ASDC_SVC_API_PATH);
-
- try {
- return getClient()
- .target(uri)
- .path(path + "/" + serviceUuid + "/artifacts/" + artifactUuid)
- .request(MediaType.APPLICATION_JSON_TYPE)
- .headers(commonHeaders)
- .header("Content-Type", MediaType.APPLICATION_JSON)
- .get(Artifact.class);
- } catch (ResponseProcessingException e) {
- //Couldn't convert response to Java type
- throw new AsdcCatalogException("ASDC response could not be processed", e);
- } catch (ProcessingException e) {
- //IO problems during request
- throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
- } catch (WebApplicationException e) {
- //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
- throw new AsdcCatalogException(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getServices()
- */
- public Collection<Service> getServices() throws AsdcCatalogException {
- String path = VidProperties.getPropertyWithDefault(ModelConstants.ASDC_SVC_API_PATH, ModelConstants.DEFAULT_ASDC_SVC_API_PATH);
- try {
- return getClient()
- .target(uri)
- .path(path)
- .request()
- .accept(MediaType.APPLICATION_JSON_TYPE)
- .headers(commonHeaders)
- .header("Content-Type", MediaType.APPLICATION_JSON)
- .get(new GenericType<Collection<Service>>() {
- });
- } catch (ResponseProcessingException e) {
- //Couldn't convert response to Java type
- throw new AsdcCatalogException("ASDC response could not be processed", e);
- } catch (ProcessingException e) {
- //IO problems during request
- throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
- } catch (WebApplicationException e) {
- //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
- throw new AsdcCatalogException(e);
- }
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getServices(java.util.Map)
- */
- public Collection<Service> getServices(Map<String, String[]> filter) throws AsdcCatalogException {
-
- String path = VidProperties.getPropertyWithDefault(ModelConstants.ASDC_SVC_API_PATH, ModelConstants.DEFAULT_ASDC_SVC_API_PATH);
- WebTarget target = getClient()
- .target(uri)
- .path(path);
-
-
- for (Entry<String, String[]> filterEntry : filter.entrySet()) {
- target = target.queryParam(filterEntry.getKey(), (Object[]) filterEntry.getValue());
- }
-
- try {
- return target.request()
- .accept(MediaType.APPLICATION_JSON_TYPE)
- .headers(commonHeaders)
- .header("Content-Type", MediaType.APPLICATION_JSON)
- .get(new GenericType<Collection<Service>>() {
- });
- } catch (ResponseProcessingException e) {
- //Couldn't convert response to Java type
- throw new AsdcCatalogException("ASDC response could not be processed", e);
- } catch (ProcessingException e) {
- //IO problems during request
- throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
- } catch (NotFoundException e) {
- throw e;
- } catch (WebApplicationException e) {
- //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
- throw new AsdcCatalogException(e);
- }
- }
-
-
- /* (non-Javadoc)
- * @see org.openecomp.vid.asdc.AsdcClient#getServiceToscaModel(java.util.UUID)
- */
- public Path getServiceToscaModel(UUID serviceUuid) throws AsdcCatalogException {
- String path = VidProperties.getPropertyWithDefault(ModelConstants.ASDC_SVC_API_PATH, ModelConstants.DEFAULT_ASDC_SVC_API_PATH);
- try {
- final InputStream csarInputStream = (InputStream) getClient()
- .target(uri)
- .path(path + "/" + serviceUuid + "/toscaModel")
- .request(MediaType.APPLICATION_OCTET_STREAM_TYPE)
- .headers(commonHeaders)
- .header("Content-Type", MediaType.APPLICATION_OCTET_STREAM)
- .get(InputStream.class);
-
-
- return getToscaCsar(csarInputStream);
- } catch (ResponseProcessingException e) {
- //Couldn't convert response to Java type
- throw new AsdcCatalogException("ASDC response could not be processed", e);
- } catch (ProcessingException e) {
- //IO problems during request
- throw new AsdcCatalogException("Failed to get a response from ASDC service", e);
- } catch (WebApplicationException e) {
- //Web service returned data, but the response status wasn't a good one (i.e. non 2xx)
- throw new AsdcCatalogException(e);
- }
- }
-
-
- /**
- * Gets the tosca model.
- *
- * @param csarInputStream the csar input stream
- * @return the tosca model
- * @throws AsdcCatalogException the asdc catalog exception
- */
- private Path getToscaCsar(InputStream csarInputStream) throws AsdcCatalogException {
- return createTmpFile(csarInputStream);
- }
-}