2 * ============LICENSE_START=======================================================
3 * Copyright (C) 2019 Nordix Foundation
4 * Modification Copyright (C) 2021 Nokia.
5 * ================================================================================
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 * SPDX-License-Identifier: Apache-2.0
18 * ============LICENSE_END=========================================================
21 package org.openecomp.sdc.tosca.csar;
23 import java.util.Arrays;
24 import java.util.Optional;
26 public enum ManifestTokenType {
27 ALGORITHM("Algorithm"),
28 ATTRIBUTE_VALUE_SEPARATOR(":"),
29 CMS_BEGIN("-----BEGIN CMS-----"),
30 CMS_END("-----END CMS-----"),
33 NON_MANO_ARTIFACT_SETS("non_mano_artifact_sets"),
35 VNF_PRODUCT_NAME("vnf_product_name"),
36 VNF_PROVIDER_ID("vnf_provider_id"),
37 VNF_PACKAGE_VERSION("vnf_package_version"),
38 VNF_RELEASE_DATE_TIME("vnf_release_date_time"),
39 PNFD_NAME("pnfd_name"),
40 PNFD_PROVIDER("pnfd_provider"),
41 PNFD_ARCHIVE_VERSION("pnfd_archive_version"),
42 PNFD_RELEASE_DATE_TIME("pnfd_release_date_time"),
43 SIGNATURE("Signature"),
44 CERTIFICATE("Certificate");
46 private final String token;
48 ManifestTokenType(final String token) {
52 public String getToken() {
56 public static Optional<ManifestTokenType> parse(final String token) {
57 return Arrays.stream(values()).filter(it -> it.getToken() != null && it.getToken().equals(token)).findFirst();
60 public boolean isMetadataEntry() {
61 return isMetadataVnfEntry() || isMetadataPnfEntry();
64 public boolean isMetadataVnfEntry() {
66 case VNF_PRODUCT_NAME:
68 case VNF_PACKAGE_VERSION:
69 case VNF_RELEASE_DATE_TIME:
76 public boolean isMetadataPnfEntry() {
80 case PNFD_ARCHIVE_VERSION:
81 case PNFD_RELEASE_DATE_TIME: