aboutsummaryrefslogtreecommitdiffstats
path: root/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp
diff options
context:
space:
mode:
authorPatrick Brady <pb071s@att.com>2017-12-13 11:19:06 -0800
committerPatrick Brady <pb071s@att.com>2017-12-13 11:19:17 -0800
commit781b1a6df324419c846c84ea983c18fc8362bfd3 (patch)
tree580008010dd50ca32db2ef6dc2e36628cf8c2b5b /appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp
parent161df8a94bb3b0c34ed16fd4fdba078bd1eeef9a (diff)
Third part of onap rename
This part of the commit changes the folder structure on all other folders of appc. Change-Id: I8acfa11cdfcdcd36be0e137245d1dd7324f1abd3 Signed-off-by: Patrick Brady <pb071s@att.com> Issue-ID: APPC-13
Diffstat (limited to 'appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp')
-rw-r--r--appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseDataAccessServiceImpl.java108
-rw-r--r--appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseManagerImpl.java88
2 files changed, 0 insertions, 196 deletions
diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseDataAccessServiceImpl.java b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseDataAccessServiceImpl.java
deleted file mode 100644
index 8976d1332..000000000
--- a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseDataAccessServiceImpl.java
+++ /dev/null
@@ -1,108 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.licmgr.impl;
-
-import javax.sql.rowset.CachedRowSet;
-
-import org.onap.appc.licmgr.Constants;
-import org.onap.appc.licmgr.LicenseDataAccessService;
-import org.onap.appc.licmgr.exception.DataAccessException;
-import com.att.eelf.configuration.EELFLogger;
-import com.att.eelf.configuration.EELFManager;
-import org.onap.ccsdk.sli.core.dblib.DbLibService;
-
-import static org.onap.appc.licmgr.Constants.SDC_ARTIFACTS_FIELDS;
-
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
-
-@SuppressWarnings("JavaDoc")
-public class LicenseDataAccessServiceImpl implements LicenseDataAccessService {
-
- private static EELFLogger logger = EELFManager.getInstance().getLogger(LicenseDataAccessServiceImpl.class);
-
- public void setSchema(String schema) {
- this.schema = schema;
- }
-
- private String schema;
-
- public void setDbLibService(DbLibService dbLibService) {
- this.dbLibService = dbLibService;
- }
-
- private DbLibService dbLibService;
-
-
- /**
- * empty constructor
- */
- public LicenseDataAccessServiceImpl(){}
-
- @Override
- public Map<String,String> retrieveLicenseModelData(String vnfType, String vnfVersion, String... fields) throws
- DataAccessException {
-
- Map<String,String> result = new HashMap<>();
- if (null == fields || 0 == fields.length) fields = new String[]{SDC_ARTIFACTS_FIELDS.ARTIFACT_CONTENT.name()};
-
- String queryString = buildQueryStatement();
-
- ArrayList<String> argList = new ArrayList<>();
- argList.add(vnfType);
- argList.add(vnfVersion);
- argList.add(Constants.VF_LICENSE);
-
- try {
-
- final CachedRowSet data = dbLibService.getData(queryString, argList, Constants.NETCONF_SCHEMA);
-
- if (data.first()) {
- for (String field : fields) {
- result.put(field, data.getString(field));
- }
- } else {
- String msg = "Missing license model for VNF_TYPE: " + vnfType + " and VNF_VERSION: " + vnfVersion + " in table " + Constants.SDC_ARTIFACTS;
- logger.info(msg);
- }
- } catch (SQLException e) {
- logger.error("Error Accessing Database " + e);
- throw new DataAccessException(e);
- }
-
- return result;
- }
-
- private String buildQueryStatement() {
- return "select * " + "from " + Constants.SDC_ARTIFACTS + " " +
- "where " + SDC_ARTIFACTS_FIELDS.RESOURCE_NAME.name() + " = ?" +
- " AND " + SDC_ARTIFACTS_FIELDS.RESOURCE_VERSION.name() + " = ?" +
- " AND " + SDC_ARTIFACTS_FIELDS.ARTIFACT_TYPE.name() + " = ?";
- }
-
-}
diff --git a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseManagerImpl.java b/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseManagerImpl.java
deleted file mode 100644
index 422db7f2d..000000000
--- a/appc-dispatcher/appc-license-manager/appc-license-manager-core/src/main/java/org/openecomp/appc/licmgr/impl/LicenseManagerImpl.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP : APPC
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Copyright (C) 2017 Amdocs
- * =============================================================================
- * 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.
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- * ============LICENSE_END=========================================================
- */
-
-package org.onap.appc.licmgr.impl;
-
-import static org.onap.appc.licmgr.Constants.SDC_ARTIFACTS_FIELDS.ARTIFACT_CONTENT;
-
-import java.util.Map;
-
-import org.onap.appc.licmgr.LicenseDataAccessService;
-import org.onap.appc.licmgr.LicenseManager;
-import org.onap.appc.licmgr.exception.DataAccessException;
-import org.onap.appc.licmgr.objects.LicenseModel;
-
-
-@SuppressWarnings("all")
-public class LicenseManagerImpl implements LicenseManager {
-
- private LicenseDataAccessService DAService;
-
- public void setDAService(LicenseDataAccessService daSrv){
- DAService = daSrv;
- }
-
- public LicenseManagerImpl() {
- }
-
- @Override
- public LicenseModel retrieveLicenseModel(String vnfType, String vnfVersion) throws DataAccessException {
-
- LicenseModel licenseModel;
- try {
- Map<String,String> resultMap = DAService.retrieveLicenseModelData(vnfType, vnfVersion);
- if (resultMap.isEmpty()) {
- throw new DataAccessException(String.format("License model not found for vnfType='%s' and vnfVersion='%s'", vnfType, vnfVersion));
- }
- String licenseModelXML = resultMap.get(ARTIFACT_CONTENT.name());
- licenseModel = convert(licenseModelXML); // JAXBUtil.<VfLicenseModel>toObject(licenseModelXML, VfLicenseModel.class);
- } catch (DataAccessException le) {
- throw le;
- } catch (Exception e) {
- throw new DataAccessException(e);
- }
- return licenseModel;
- }
-
-
- private static LicenseModel convert(String xml) {
-
- LicenseModel licenseModel = new LicenseModel();
-
- int posEntitlementStart = xml.indexOf("<entitlement-pool-uuid>");
- int posEntitlementEnd = xml.indexOf("</entitlement-pool-uuid>", posEntitlementStart);
- if (-1 != posEntitlementStart) {
- licenseModel.setEntitlementPoolUuid(xml.substring(posEntitlementStart + "<entitlement-pool-uuid>".length(), posEntitlementEnd));
- }
-
- int posLicenseStart = xml.indexOf("<license-key-group-uuid>");
- int posLicenseEnd = xml.indexOf("</license-key-group-uuid>", posEntitlementStart);
- if (-1 != posLicenseStart) {
- licenseModel.setLicenseKeyGroupUuid(xml.substring(posLicenseStart + "<license-key-group-uuid>".length(), posLicenseEnd));
- }
-
- return licenseModel;
- }
-
-}