summaryrefslogtreecommitdiffstats
path: root/src/main/java/org/openecomp/datarouter/util
diff options
context:
space:
mode:
authorArul.Nambi <arul.nambi@amdocs.com>2017-10-12 10:42:00 -0400
committerArul.Nambi <arul.nambi@amdocs.com>2017-10-12 10:42:20 -0400
commit2a5ff133471c5a69b0dfd760d2743f48112da9a0 (patch)
treeb8382df01a396ccf8fdcea4f7328ee4dad29104b /src/main/java/org/openecomp/datarouter/util
parente6be129e4865104321cdd6313f9729c4e7b07d22 (diff)
Renaming openecomp to onap
Issue-ID: AAI-208 Change-Id: Ib5dc63c9b2f4c580caec21414c2fafae904adca9 Signed-off-by: Arul.Nambi <arul.nambi@amdocs.com>
Diffstat (limited to 'src/main/java/org/openecomp/datarouter/util')
-rw-r--r--src/main/java/org/openecomp/datarouter/util/AaiUiSvcPolicyUtil.java75
-rw-r--r--src/main/java/org/openecomp/datarouter/util/CrossEntityReference.java95
-rw-r--r--src/main/java/org/openecomp/datarouter/util/DataRouterConstants.java59
-rw-r--r--src/main/java/org/openecomp/datarouter/util/DataRouterProperties.java56
-rw-r--r--src/main/java/org/openecomp/datarouter/util/EntityOxmReferenceHelper.java60
-rw-r--r--src/main/java/org/openecomp/datarouter/util/ExternalOxmModelProcessor.java35
-rw-r--r--src/main/java/org/openecomp/datarouter/util/FileWatcher.java48
-rw-r--r--src/main/java/org/openecomp/datarouter/util/NodeUtils.java177
-rw-r--r--src/main/java/org/openecomp/datarouter/util/OxmModelLoader.java140
-rw-r--r--src/main/java/org/openecomp/datarouter/util/RouterServiceUtil.java271
-rw-r--r--src/main/java/org/openecomp/datarouter/util/SearchServiceAgent.java366
-rw-r--r--src/main/java/org/openecomp/datarouter/util/SearchSuggestionPermutation.java98
-rw-r--r--src/main/java/org/openecomp/datarouter/util/Version.java27
-rw-r--r--src/main/java/org/openecomp/datarouter/util/VersionedOxmEntities.java347
-rw-r--r--src/main/java/org/openecomp/datarouter/util/client/NoAuthRestClient.java222
-rw-r--r--src/main/java/org/openecomp/datarouter/util/client/SvcRoutingRestClient.java52
16 files changed, 0 insertions, 2128 deletions
diff --git a/src/main/java/org/openecomp/datarouter/util/AaiUiSvcPolicyUtil.java b/src/main/java/org/openecomp/datarouter/util/AaiUiSvcPolicyUtil.java
deleted file mode 100644
index 856e38a..0000000
--- a/src/main/java/org/openecomp/datarouter/util/AaiUiSvcPolicyUtil.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 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.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.openecomp.datarouter.util;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-
-public class AaiUiSvcPolicyUtil {
-
- static ObjectMapper mapper = new ObjectMapper();
-
- public static JsonNode getOriginPayload(JsonNode payload) throws Exception{
- /*
- *{
- "origin-uri": "/routerService/1search1",
- "origin-payload": {}
- }
- */
- JsonNode origPayload = null;
-
- if (payload.has("origin-payload")){
- origPayload = payload.get("origin-payload");
- }
- return origPayload;
- }
-
- public static String getOriginUri ( JsonNode payload ) throws Exception {
- String originUri = "";
- if (payload.has("origin-uri")){
- originUri = payload.get("origin-uri").textValue();
- }
- return originUri;
- }
-
- public static String getTargetUri(JsonNode payload) throws Exception{
- /*
- *{
- "origin-uri": "/routerService/1search1",
- "origin-payload": {}
- }
- */
- String uri = "";
- String originUri = getOriginUri(payload);
- final Matcher m = Pattern.compile("/routerService/(.*)").matcher(originUri);
- if ( m.find() ) {
- uri = m.group(1);
- }
- return uri;
- }
-
-}
diff --git a/src/main/java/org/openecomp/datarouter/util/CrossEntityReference.java b/src/main/java/org/openecomp/datarouter/util/CrossEntityReference.java
deleted file mode 100644
index e889656..0000000
--- a/src/main/java/org/openecomp/datarouter/util/CrossEntityReference.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 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.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.openecomp.datarouter.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-/**
- * Processing and entity wrapper for property transposition logic and UEB processing
- *
- * @author DAVEA
- */
-public class CrossEntityReference {
-
- private String targetEntityType;
-
- private List<String> attributeNames;
-
- public CrossEntityReference() {
- this.targetEntityType = null;
- this.attributeNames = new ArrayList<>();
- }
-
- public String getTargetEntityType() {
- return targetEntityType;
- }
-
- public void setTargetEntityType(String targetEntityType) {
- this.targetEntityType = targetEntityType;
- }
-
- public List<String> getAttributeNames() {
- return attributeNames;
- }
-
- public void setAttributeNames(List<String> attributeNames) {
- this.attributeNames = attributeNames;
- }
-
- public void addAttributeName(String attributeName) {
- if (!this.attributeNames.contains(attributeName)) {
- this.attributeNames.add(attributeName);
- }
- }
-
- public void initialize(String crossEntityReferenceValueFromModel) {
-
- if (crossEntityReferenceValueFromModel == null
- || crossEntityReferenceValueFromModel.length() == 0) {
- // or throw an exception due to failure to initialize
- return;
- }
-
- String[] tokens = crossEntityReferenceValueFromModel.split(",");
-
- if (tokens.length >= 2) {
- this.targetEntityType = tokens[0];
-
- for (int x = 1; x < tokens.length; x++) {
- this.attributeNames.add(tokens[x]);
- }
- } else {
- // throw a CrossEntityReferenceInitializationException??
- }
-
- }
-
- @Override
- public String toString() {
- return "CrossEntityReference ["
- + (targetEntityType != null ? "entityType=" + targetEntityType + ", " : "")
- + (attributeNames != null ? "attributeNames=" + attributeNames : "") + "]";
- }
-
-}
diff --git a/src/main/java/org/openecomp/datarouter/util/DataRouterConstants.java b/src/main/java/org/openecomp/datarouter/util/DataRouterConstants.java
deleted file mode 100644
index b18b794..0000000
--- a/src/main/java/org/openecomp/datarouter/util/DataRouterConstants.java
+++ /dev/null
@@ -1,59 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 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.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.openecomp.datarouter.util;
-
-public class DataRouterConstants {
- public static final String DR_FILESEP = (System.getProperty("file.separator") == null) ? "/"
- : System.getProperty("file.separator");
-
- public static final String DR_AJSC_HOME = System.getProperty("AJSC_HOME");
-
- public static final String DR_SPECIFIC_CONFIG = System.getProperty("CONFIG_HOME") + DR_FILESEP;
-
- public static final String DR_BUNDLECONFIG_NAME = (System.getProperty("BUNDLECONFIG_DIR") == null)
- ? "bundleconfig" : System.getProperty("BUNDLECONFIG_DIR");
-
- public static final String DR_HOME_BUNDLECONFIG = (DR_AJSC_HOME == null)
- ? DR_FILESEP + "opt" + DR_FILESEP + "app" + DR_FILESEP
- + "datalayer" + DR_FILESEP + DR_BUNDLECONFIG_NAME
- : DR_AJSC_HOME + DR_FILESEP + DR_BUNDLECONFIG_NAME;
-
- /** This is the etc directory, relative to AAI_HOME. */
- public static final String DR_HOME_ETC = DR_HOME_BUNDLECONFIG + DR_FILESEP + "etc" + DR_FILESEP;
-
- public static final String DR_HOME_MODEL = DR_SPECIFIC_CONFIG + "model" + DR_FILESEP;
- public static final String DR_HOME_AUTH = DR_SPECIFIC_CONFIG + "auth" + DR_FILESEP;
-
- public static final String DR_CONFIG_FILE = DR_SPECIFIC_CONFIG + "data-router.properties";
-
- public static final String DR_HOME_ETC_OXM = DR_HOME_ETC + "oxm" + DR_FILESEP;
-
- public static final String UI_FILTER_LIST_FILE =
- DR_SPECIFIC_CONFIG + DR_FILESEP + "filters" + DR_FILESEP + "aaiui_filters.json";
-
- // AAI Related
- public static final String AAI_ECHO_SERVICE = "/util/echo";
-
- // Logging related
- public static final String DATA_ROUTER_SERVICE_NAME = "DataRouter";
-}
diff --git a/src/main/java/org/openecomp/datarouter/util/DataRouterProperties.java b/src/main/java/org/openecomp/datarouter/util/DataRouterProperties.java
deleted file mode 100644
index 30b798f..0000000
--- a/src/main/java/org/openecomp/datarouter/util/DataRouterProperties.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 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.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.openecomp.datarouter.util;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.util.Properties;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class DataRouterProperties {
-
- private static final Logger logger = LoggerFactory.getLogger(DataRouterProperties.class);
-
- private static Properties properties;
-
- static {
- properties = new Properties();
- File file = new File(DataRouterConstants.DR_CONFIG_FILE);
- try {
- properties.load(new FileInputStream(file));
- } catch (FileNotFoundException e) {
- logger.error("FileNotFoundException: ", e);
- } catch (IOException e) {
- logger.error("IOException: ", e);
- }
- }
-
- public static String get(String key) {
- return properties.getProperty(key);
- }
-
-}
diff --git a/src/main/java/org/openecomp/datarouter/util/EntityOxmReferenceHelper.java b/src/main/java/org/openecomp/datarouter/util/EntityOxmReferenceHelper.java
deleted file mode 100644
index cd5a37d..0000000
--- a/src/main/java/org/openecomp/datarouter/util/EntityOxmReferenceHelper.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 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.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.openecomp.datarouter.util;
-
-import java.util.HashMap;
-
-import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
-
-public class EntityOxmReferenceHelper implements ExternalOxmModelProcessor {
-
- private static EntityOxmReferenceHelper _instance = null;
-
- private HashMap<Version, VersionedOxmEntities> versionedModels;
-
- protected EntityOxmReferenceHelper() {
- this.versionedModels = new HashMap<>();
- }
-
- public static EntityOxmReferenceHelper getInstance() {
- if ( _instance == null ) {
- _instance = new EntityOxmReferenceHelper();
- }
-
- return _instance;
- }
-
-
- @Override
- public void onOxmVersionChange(Version version, DynamicJAXBContext context) {
- VersionedOxmEntities oxmEntities = new VersionedOxmEntities();
- oxmEntities.initialize(context);
- this.versionedModels.put(version, oxmEntities);
-
- }
-
- public VersionedOxmEntities getVersionedOxmEntities(Version version){
- return this.versionedModels.get(version);
- }
-
-}
diff --git a/src/main/java/org/openecomp/datarouter/util/ExternalOxmModelProcessor.java b/src/main/java/org/openecomp/datarouter/util/ExternalOxmModelProcessor.java
deleted file mode 100644
index 5c027d3..0000000
--- a/src/main/java/org/openecomp/datarouter/util/ExternalOxmModelProcessor.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 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.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.openecomp.datarouter.util;
-
-import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
-
-/**
- * Exposes a registration and processing contract so that any load/change of an oxm version will
- * inform registered model processors.
- *
- * @author davea
- */
-public interface ExternalOxmModelProcessor {
- public void onOxmVersionChange(Version version, DynamicJAXBContext context);
-}
diff --git a/src/main/java/org/openecomp/datarouter/util/FileWatcher.java b/src/main/java/org/openecomp/datarouter/util/FileWatcher.java
deleted file mode 100644
index 8ae69d3..0000000
--- a/src/main/java/org/openecomp/datarouter/util/FileWatcher.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 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.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.openecomp.datarouter.util;
-
-import java.io.File;
-import java.util.TimerTask;
-
-public abstract class FileWatcher extends TimerTask {
- private long timeStamp;
- private File file;
-
- public FileWatcher(File file) {
- this.file = file;
- this.timeStamp = file.lastModified();
- }
-
- @Override
- public final void run() {
- long newTimeStamp = file.lastModified();
-
- if ((newTimeStamp - this.timeStamp) > 500) {
- this.timeStamp = newTimeStamp;
- onChange(file);
- }
- }
-
- protected abstract void onChange(File file);
-}
diff --git a/src/main/java/org/openecomp/datarouter/util/NodeUtils.java b/src/main/java/org/openecomp/datarouter/util/NodeUtils.java
deleted file mode 100644
index 4362d11..0000000
--- a/src/main/java/org/openecomp/datarouter/util/NodeUtils.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 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.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.openecomp.datarouter.util;
-
-import java.io.IOException;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Iterator;
-import java.util.Map;
-
-import com.fasterxml.jackson.core.JsonProcessingException;
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-import com.fasterxml.jackson.databind.ObjectWriter;
-import com.fasterxml.jackson.databind.SerializationFeature;
-
-public class NodeUtils {
- /**
- * Generate unique sha digest. This method is copy over from NodeUtils class in AAIUI
- *
- * @param keys the keys
- * @return the string
- */
- public static String generateUniqueShaDigest(String... keys) {
- if ((keys == null) || keys.length == 0) {
- return null;
- }
-
- final String keysStr = Arrays.asList(keys).toString();
- final String hashedId = org.apache.commons.codec.digest.DigestUtils.sha256Hex(keysStr);
-
- return hashedId;
- }
-
- /**
- * Extract field value from object.
- *
- * @param node the node
- * @param fieldName the field name
- * @return the string
- */
- public static String extractFieldValueFromObject(JsonNode node, String fieldName) {
-
- if (node == null) {
- return null;
- }
-
- if (node.isObject()) {
-
- JsonNode valueNode = node.get(fieldName);
-
- if (valueNode != null) {
-
- if (valueNode.isValueNode()) {
- return valueNode.asText();
- }
- }
-
- }
- return null;
-
- }
-
- /**
- * Convert json str to json node.
- *
- * @param jsonStr the json str
- * @return the json node
- * @throws IOException Signals that an I/O exception has occurred.
- */
- public static JsonNode convertJsonStrToJsonNode(String jsonStr) throws IOException {
- ObjectMapper mapper = new ObjectMapper();
- if (jsonStr == null || jsonStr.length() == 0) {
- return null;
- }
-
- return mapper.readTree(jsonStr);
- }
-
- /**
- * Extract objects by key.
- *
- * @param node the node
- * @param searchKey the search key
- * @param foundObjects the found objects
- */
- public static void extractObjectsByKey(JsonNode node, String searchKey,
- Collection<JsonNode> foundObjects) {
-
- if ( node == null ) {
- return;
- }
-
- if (node.isObject()) {
- Iterator<Map.Entry<String, JsonNode>> nodeIterator = node.fields();
-
- while (nodeIterator.hasNext()) {
- Map.Entry<String, JsonNode> entry = nodeIterator.next();
- if (!entry.getValue().isValueNode()) {
- extractObjectsByKey(entry.getValue(), searchKey, foundObjects);
- }
-
- String name = entry.getKey();
- if (name.equalsIgnoreCase(searchKey)) {
-
- JsonNode entryNode = entry.getValue();
-
- if (entryNode.isArray()) {
-
- Iterator<JsonNode> arrayItemsIterator = entryNode.elements();
- while (arrayItemsIterator.hasNext()) {
- foundObjects.add(arrayItemsIterator.next());
- }
-
- } else {
- foundObjects.add(entry.getValue());
- }
-
-
- }
- }
- } else if (node.isArray()) {
- Iterator<JsonNode> arrayItemsIterator = node.elements();
- while (arrayItemsIterator.hasNext()) {
- extractObjectsByKey(arrayItemsIterator.next(), searchKey, foundObjects);
- }
-
- }
-
- }
-
- /**
- * Convert object to json.
- *
- * @param object the object
- * @param pretty the pretty
- * @return the string
- * @throws JsonProcessingException the json processing exception
- */
- public static String convertObjectToJson(Object object, boolean pretty)
- throws JsonProcessingException {
- ObjectWriter ow;
-
- ObjectMapper mapper = new ObjectMapper();
- mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
-
- if (pretty) {
- ow = mapper.writer().withDefaultPrettyPrinter();
-
- } else {
- ow = mapper.writer();
- }
-
- return ow.writeValueAsString(object);
- }
-
-}
diff --git a/src/main/java/org/openecomp/datarouter/util/OxmModelLoader.java b/src/main/java/org/openecomp/datarouter/util/OxmModelLoader.java
deleted file mode 100644
index a696740..0000000
--- a/src/main/java/org/openecomp/datarouter/util/OxmModelLoader.java
+++ /dev/null
@@ -1,140 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 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.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.openecomp.datarouter.util;
-
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.concurrent.ConcurrentHashMap;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import javax.ws.rs.core.Response.Status;
-import javax.xml.bind.JAXBException;
-
-import org.eclipse.persistence.jaxb.JAXBContextProperties;
-import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
-import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContextFactory;
-import org.onap.aai.cl.eelf.LoggerFactory;
-import org.openecomp.datarouter.logging.DataRouterMsgs;
-
-import org.openecomp.datarouter.util.ExternalOxmModelProcessor;
-import org.springframework.core.io.Resource;
-import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
-import org.springframework.core.io.support.ResourcePatternResolver;
-
-public class OxmModelLoader {
-
- private static Map<String, DynamicJAXBContext> versionContextMap = new ConcurrentHashMap<>();
- private static List<ExternalOxmModelProcessor> oxmModelProcessorRegistry = new ArrayList<>();
- final static Pattern p = Pattern.compile("aai_oxm_(.*).xml");
-
-
-
- private static org.onap.aai.cl.api.Logger logger = LoggerFactory.getInstance()
- .getLogger(OxmModelLoader.class.getName());
-
- public synchronized static void loadModels() throws FileNotFoundException {
-
- ClassLoader cl = OxmModelLoader.class.getClassLoader();
- ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(cl);
- Resource[] resources;
- try {
- resources = resolver.getResources("classpath*:/oxm/aai_oxm*.xml");
- } catch (IOException ex) {
- logger.error(DataRouterMsgs.LOAD_OXM_ERROR, ex.getMessage());
- throw new FileNotFoundException("Unable to load OXM models from schema path : /oxm/aai_oxm*.xml");
- }
-
- if (resources.length == 0) {
- logger.error(DataRouterMsgs.LOAD_OXM_ERROR, "No OXM schema files found on classpath");
- throw new FileNotFoundException("Unable to load OXM models from schema path : /oxm/aai_oxm*.xml");
- }
-
- for (Resource resource : resources) {
- Matcher matcher = p.matcher(resource.getFilename());
-
- if (matcher.matches()) {
- try {
- OxmModelLoader.loadModel(matcher.group(1), resource.getFilename(),resource.getInputStream());
- } catch (Exception e) {
- logger.error(DataRouterMsgs.LOAD_OXM_ERROR, "Failed to load " + resource.getFilename()
- + ": " + e.getMessage());
- }
- }
- }
-
-
- }
-
-
-
- private synchronized static void loadModel(String version,String resourceName,InputStream inputStream) throws JAXBException, FileNotFoundException {
- Map<String, Object> properties = new HashMap<>();
- properties.put(JAXBContextProperties.OXM_METADATA_SOURCE, inputStream);
- final DynamicJAXBContext jaxbContext = DynamicJAXBContextFactory
- .createContextFromOXM(Thread.currentThread().getContextClassLoader(), properties);
- versionContextMap.put(version, jaxbContext);
- if ( oxmModelProcessorRegistry != null) {
- for ( ExternalOxmModelProcessor processor : oxmModelProcessorRegistry ) {
- processor.onOxmVersionChange(Version.valueOf(version), jaxbContext );
- }
- }
- logger.info(DataRouterMsgs.LOADED_OXM_FILE, resourceName);
- }
-
- public static DynamicJAXBContext getContextForVersion(String version) throws Exception {
- if (versionContextMap == null || versionContextMap.isEmpty()) {
- loadModels();
- } else if (!versionContextMap.containsKey(version)) {
- throw new Exception(Status.NOT_FOUND.toString());
-
- }
-
- return versionContextMap.get(version);
- }
-
- public static Map<String, DynamicJAXBContext> getVersionContextMap() {
- return versionContextMap;
- }
-
- public static void setVersionContextMap(Map<String, DynamicJAXBContext> versionContextMap) {
- OxmModelLoader.versionContextMap = versionContextMap;
- }
-
- public synchronized static void registerExternalOxmModelProcessors(Collection<ExternalOxmModelProcessor> processors) {
- if(processors != null) {
- for(ExternalOxmModelProcessor processor : processors) {
- if(!oxmModelProcessorRegistry.contains(processor)) {
- oxmModelProcessorRegistry.add(processor);
- }
- }
- }
- }
-
-}
diff --git a/src/main/java/org/openecomp/datarouter/util/RouterServiceUtil.java b/src/main/java/org/openecomp/datarouter/util/RouterServiceUtil.java
deleted file mode 100644
index 77366c5..0000000
--- a/src/main/java/org/openecomp/datarouter/util/RouterServiceUtil.java
+++ /dev/null
@@ -1,271 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 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.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.openecomp.datarouter.util;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-import org.apache.camel.Exchange;
-import org.apache.camel.component.cxf.common.message.CxfConstants;
-import org.apache.cxf.message.Message;
-import org.json.JSONObject;
-import org.onap.aai.cl.mdc.MdcContext;
-import org.onap.aai.restclient.client.Headers;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.servlet.ServletRequest;
-
-public class RouterServiceUtil {
-
- public static void setMdcContext(Exchange exchange){
- String txnID = exchange.getIn().getHeader(Headers.TRANSACTION_ID,
- Arrays.asList(UUID.randomUUID())).toString();
- String remote = exchange.getIn().getHeader(Headers.FROM_APP_ID, "").toString();
- String remoteAddress = "";
- Message cxfMessage = exchange.getIn().getHeader(CxfConstants.CAMEL_CXF_MESSAGE, Message.class);
- if (cxfMessage != null) {
- ServletRequest request = (ServletRequest) cxfMessage.get("HTTP.REQUEST");
- if ( request != null)
- remoteAddress = request.getRemoteAddr();
- }
-
- MdcContext.initialize(txnID, "Synapse", "", remote, remoteAddress);
- }
-
- public static Map<String, String> parseJsonPayloadIntoMap(String jsonPayload) {
-
- JSONObject jsonObject = new JSONObject(jsonPayload);
- Map<String, String> map = new HashMap<>();
- Iterator iter = jsonObject.keys();
- while (iter.hasNext()) {
- String key = (String) iter.next();
- String value = jsonObject.getString(key);
- map.put(key, value);
- }
- return map;
- }
-
- public static String getNodeFieldAsText(JsonNode node, String fieldName) {
-
- String fieldValue = null;
-
- JsonNode valueNode = node.get(fieldName);
-
- if (valueNode != null) {
- fieldValue = valueNode.asText();
- }
-
- return fieldValue;
- }
-
- public static String concatArray(List<String> list) {
- return concatArray(list, " ");
- }
-
- public static String concatArray(List<String> list, String delimiter) {
-
- if (list == null || !list.isEmpty()) {
- return "";
- }
-
- StringBuilder result = new StringBuilder(64);
-
- boolean firstValue = true;
-
- for (String item : list) {
-
- if (firstValue) {
- result.append(item);
- firstValue = false;
- } else {
- result.append(delimiter).append(item);
- }
- }
-
- return result.toString();
-
- }
-
- public static String concatArray(String[] values) {
-
- if (values == null || values.length == 0) {
- return "";
- }
-
- StringBuilder result = new StringBuilder(64);
-
- boolean firstValue = true;
-
- for (String item : values) {
-
- if (firstValue) {
- result.append(item);
- firstValue = false;
- } else {
- result.append(".").append(item);
- }
-
- }
-
- return result.toString();
-
- }
-
- public static String recursivelyLookupJsonPayload(JsonNode node, String key) {
- String value = null;
- if (node.isObject()) {
- Iterator<Map.Entry<String, JsonNode>> nodeIterator = node.fields();
-
- while (nodeIterator.hasNext()) {
- Map.Entry<String, JsonNode> entry = (Map.Entry<String, JsonNode>) nodeIterator.next();
- if (!entry.getValue().isValueNode()) {
- value = recursivelyLookupJsonPayload(entry.getValue(), key);
- if (value != null) {
- return value;
- }
- }
-
- String name = entry.getKey();
- if (name.equalsIgnoreCase(key)) {
- return entry.getValue().asText();
- }
- }
- } else if (node.isArray()) {
- Iterator<JsonNode> arrayItemsIterator = node.elements();
- while (arrayItemsIterator.hasNext()) {
- value = recursivelyLookupJsonPayload(arrayItemsIterator.next(), key);
- if (value != null) {
- return value;
- }
- }
- }
- return value;
- }
-
- public static void extractObjectsByKey(JsonNode node, String searchKey,
- Collection<JsonNode> foundObjects) {
-
- if (node.isObject()) {
- Iterator<Map.Entry<String, JsonNode>> nodeIterator = node.fields();
-
- while (nodeIterator.hasNext()) {
- Map.Entry<String, JsonNode> entry = (Map.Entry<String, JsonNode>) nodeIterator.next();
- if (!entry.getValue().isValueNode()) {
- extractObjectsByKey(entry.getValue(), searchKey, foundObjects);
- }
-
- String name = entry.getKey();
- if (name.equalsIgnoreCase(searchKey)) {
-
- JsonNode entryValue = entry.getValue();
-
- if (entryValue.isArray()) {
-
- Iterator<JsonNode> arrayItemsIterator = entryValue.elements();
- while (arrayItemsIterator.hasNext()) {
- foundObjects.add(arrayItemsIterator.next());
- }
-
- } else {
- foundObjects.add(entry.getValue());
- }
- }
- }
- } else if (node.isArray()) {
- Iterator<JsonNode> arrayItemsIterator = node.elements();
- while (arrayItemsIterator.hasNext()) {
- extractObjectsByKey(arrayItemsIterator.next(), searchKey, foundObjects);
- }
- }
- }
-
- public static void convertArrayIntoList(JsonNode node, Collection<JsonNode> instances) {
-
- if (node.isArray()) {
- Iterator<JsonNode> arrayItemsIterator = node.elements();
- while (arrayItemsIterator.hasNext()) {
- instances.add(arrayItemsIterator.next());
- }
- } else {
- instances.add(node);
- }
- }
-
- public static void extractFieldValuesFromObject(JsonNode node,
- Collection<String> attributesToExtract, Collection<String> fieldValues) {
-
- if (node.isObject()) {
-
- JsonNode valueNode;
-
- for (String attrToExtract : attributesToExtract) {
-
- valueNode = node.get(attrToExtract);
-
- if (valueNode != null) {
-
- if (valueNode.isValueNode()) {
- fieldValues.add(valueNode.asText());
- }
- }
- }
- }
- }
-
-
- public static String objToJson(Object obj) {
- JSONObject jsonObject = new JSONObject(obj);
- String json = jsonObject.toString();
- return json;
- }
-
- /**
- * Helper utility to concatenate substrings of a URI together to form a proper URI.
- *
- * @param suburis the list of substrings to concatenate together
- * @return the concatenated list of substrings
- */
- public static String concatSubUri(String... suburis) {
- String finalUri = "";
-
- for (String suburi : suburis) {
-
- if (suburi != null) {
- // Remove any leading / since we only want to append /
- suburi = suburi.replaceFirst("^/*", "");
-
- // Add a trailing / if one isn't already there
- finalUri += suburi.endsWith("/") ? suburi : suburi + "/";
- }
- }
-
- return finalUri;
- }
-}
diff --git a/src/main/java/org/openecomp/datarouter/util/SearchServiceAgent.java b/src/main/java/org/openecomp/datarouter/util/SearchServiceAgent.java
deleted file mode 100644
index de31597..0000000
--- a/src/main/java/org/openecomp/datarouter/util/SearchServiceAgent.java
+++ /dev/null
@@ -1,366 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 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.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.openecomp.datarouter.util;
-
-import java.io.BufferedReader;
-import java.io.InputStreamReader;
-import java.nio.charset.StandardCharsets;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.UUID;
-
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.MultivaluedMap;
-import javax.ws.rs.core.Response.Status;
-
-import org.eclipse.jetty.util.security.Password;
-import org.onap.aai.cl.api.Logger;
-import org.onap.aai.cl.mdc.MdcContext;
-import org.openecomp.datarouter.logging.DataRouterMsgs;
-import org.openecomp.datarouter.policy.EntityEventPolicy;
-import org.onap.aai.restclient.client.Headers;
-import org.onap.aai.restclient.client.OperationResult;
-import org.onap.aai.restclient.client.RestClient;
-import org.onap.aai.restclient.enums.RestAuthenticationMode;
-import org.onap.aai.restclient.rest.HttpUtil;
-import org.slf4j.MDC;
-
-import com.sun.jersey.core.util.MultivaluedMapImpl;
-
-public class SearchServiceAgent {
-
- private Logger logger;
-
- private RestClient searchClient = null;
- private Map<String, String> indexSchemaMapping = new HashMap<>();
-
- private String searchUrl = null;
- private String documentEndpoint = null;
-
-
- /**
- * Creates a new instance of the search service agent.
- *
- * @param certName - Certificate to use for talking to the Search Service.
- * @param keystore - Keystore to use for talking to the Search Service.
- * @param keystorePwd - Keystore password for talking to the Search Service.
- * @param searchUrl - URL at which the Search Service can be reached.
- * @param documentEndpoint - Endpoint for accessing document resources on the Search Service.
- * @param logger - Logger to use for system logs.
- */
- public SearchServiceAgent(String certName,
- String keystore,
- String keystorePwd,
- String searchUrl,
- String documentEndpoint,
- Logger logger) {
-
- initialize(certName, keystore, keystorePwd, searchUrl, documentEndpoint, logger);
- }
-
-
- /**
- * Performs all one-time initialization required for the search agent.
- *
- * @param certName - Certificate to use for talking to the Search Service.
- * @param keystore - Keystore to use for talking to the Search Service.
- * @param keystorePwd - Keystore password for talking to the Search Service.
- * @param searchUrl - URL at which the Search Service can be reached.
- * @param documentEndpoint - Endpoint for accessing document resources on the Search Service.
- * @param logger - Logger to use for system logs.
- */
- private void initialize(String certName,
- String keystore,
- String keystorePwd,
- String searchUrl,
- String documentEndpoint,
- Logger logger) {
-
- // Create REST client for search service
- searchClient = new RestClient()
- .authenticationMode(RestAuthenticationMode.SSL_CERT)
- .validateServerHostname(false)
- .validateServerCertChain(true)
- .clientCertFile(DataRouterConstants.DR_HOME_AUTH + certName)
- .clientCertPassword(Password.deobfuscate(keystorePwd))
- .trustStore(DataRouterConstants.DR_HOME_AUTH + keystore);
-
- this.searchUrl = searchUrl;
- this.documentEndpoint = documentEndpoint;
-
- this.logger = logger;
- }
-
-
- /**
- * Creates an index through the search db abstraction
- *
- * @param index - The name of the index to be created.
- * @param schemaLocation - The name of the schema file for the index.
- */
- public void createSearchIndex(String index, String schemaLocation) {
-
- // Create a mapping of the index name to schema location
- indexSchemaMapping.put(index, schemaLocation);
-
- // Now, create the index.
- createIndex(index, schemaLocation);
- }
-
-
- /**
- * This method performs the actual work of creating a search index.
- *
- * @param index - The name of the index to be created.
- * @param schemaLocation - The name of the schema file for the index.
- */
- private void createIndex(String index, String schemaLocation) {
-
- logger.debug("Creating search index, index name: = " + index + ", schemaLocation = " + schemaLocation);
-
- MultivaluedMap<String, String> headers = new MultivaluedMapImpl();
- headers.put("Accept", Arrays.asList("application/json"));
- headers.put(Headers.FROM_APP_ID, Arrays.asList("DL"));
- headers.put(Headers.TRANSACTION_ID, Arrays.asList(UUID.randomUUID().toString()));
-
- String url = concatSubUri(searchUrl, index);
- try {
-
- OperationResult result = searchClient.put(url, loadFileData(schemaLocation), headers,
- MediaType.APPLICATION_JSON_TYPE, null);
-
- if (!HttpUtil.isHttpResponseClassSuccess(result.getResultCode())) {
- logger.error(DataRouterMsgs.FAIL_TO_CREATE_SEARCH_INDEX, index, result.getFailureCause());
- } else {
- logger.info(DataRouterMsgs.SEARCH_INDEX_CREATE_SUCCESS, index);
- }
-
- } catch (Exception e) {
- logger.error(DataRouterMsgs.FAIL_TO_CREATE_SEARCH_INDEX, index, e.getLocalizedMessage());
- }
- }
-
-
- /**
- * Retrieves a document from the search service.
- *
- * @param index - The index to retrieve the document from.
- * @param id - The unique identifier for the document.
- *
- * @return - The REST response returned from the Search Service.
- */
- public OperationResult getDocument(String index, String id) {
-
- Map<String, List<String>> headers = new HashMap<>();
- headers.put(Headers.FROM_APP_ID, Arrays.asList("Data Router"));
- headers.put(Headers.TRANSACTION_ID, Arrays.asList(MDC.get(MdcContext.MDC_REQUEST_ID)));
-
- String url = concatSubUri(searchUrl, index, documentEndpoint, id);
- return searchClient.get(url, headers, MediaType.APPLICATION_JSON_TYPE);
- }
-
-
- /**
- * Creates or updates a document in the Search Service.
- *
- * @param index - The index to create or update the document in.
- * @param id - The identifier for the document.
- * @param payload - The document contents.
- * @param headers - HTTP headers.
- */
- public void putDocument(String index, String id, String payload, Map<String, List<String>> headers) {
-
- // Try to post the document to the search service.
- OperationResult result = doDocumentPut(index, id, payload, headers);
-
- // A 404 response from the Search Service may indicate that the index we are writing
- // to does not actually exist. We will try creating it now.
- if(result.getResultCode() == Status.NOT_FOUND.getStatusCode()) {
-
- // Lookup the location of the schema that we want to create.
- String indexSchemaLocation = indexSchemaMapping.get(index);
- if(indexSchemaLocation != null) {
-
- // Try creating the index now...
- logger.info(DataRouterMsgs.CREATE_MISSING_INDEX, index);
- createIndex(index, indexSchemaLocation);
-
- // ...and retry the document post.
- result = doDocumentPut(index, id, payload, headers);
- }
- }
-
- if(!resultSuccessful(result)) {
- logger.error(DataRouterMsgs.FAIL_TO_CREATE_UPDATE_DOC, index, result.getFailureCause());
- }
- }
-
-
- /**
- * This method does the actual work of submitting a document PUT request to the Search Service.
- *
- * @param index - The index to create or update the document in.
- * @param id - The identifier for the document.
- * @param payload - The document contents.
- * @param headers - HTTP headers.
- *
- * @return - The HTTP response returned by the Search Service.
- */
- private OperationResult doDocumentPut(String index, String id, String payload, Map<String, List<String>> headers) {
-
- String url = concatSubUri(searchUrl, index, documentEndpoint, id);
- return searchClient.put(url, payload, headers, MediaType.APPLICATION_JSON_TYPE, MediaType.APPLICATION_JSON_TYPE);
- }
-
-
- /**
- * Creates a document in the Search Service.
- *
- * @param index - The index to create the document in.
- * @param payload - The document contents.
- * @param headers - HTTP headers.
- */
- public void postDocument(String index, String payload, Map<String, List<String>> headers) {
-
- // Try to post the document to the search service.
- OperationResult result = doDocumentPost(index, payload, headers);
-
- // A 404 response from the Search Service may indicate that the index we are writing
- // to does not actually exist. We will try creating it now.
- if(result.getResultCode() == Status.NOT_FOUND.getStatusCode()) {
-
- // Lookup the location of the schema that we want to create.
- String indexSchemaLocation = indexSchemaMapping.get(index);
- if(indexSchemaLocation != null) {
-
- // Try creating the index now...
- logger.info(DataRouterMsgs.CREATE_MISSING_INDEX, index);
- createIndex(index, indexSchemaLocation);
-
- // ...and retry the document post.
- result = doDocumentPost(index, payload, headers);
- }
- }
-
- if(!resultSuccessful(result)) {
- logger.error(DataRouterMsgs.FAIL_TO_CREATE_UPDATE_DOC, index, result.getFailureCause());
- }
- }
-
-
- /**
- * This method does the actual work of submitting a document PUT request to the Search Service.
- *
- * @param index - The index to create or update the document in.
- * @param payload - The document contents.
- * @param headers - HTTP headers.
- *
- * @return - The HTTP response returned by the Search Service.
- */
- private OperationResult doDocumentPost(String index, String payload, Map<String, List<String>> headers) {
-
- String url = concatSubUri(searchUrl, index, documentEndpoint);
- return searchClient.post(url, payload, headers, MediaType.APPLICATION_JSON_TYPE, MediaType.APPLICATION_JSON_TYPE);
- }
-
-
- /**
- * Removes a document from the Search Service.
- *
- * @param index - The index to create the document in.
- * @param id - The identifier for the document.
- * @param payload - The document contents.
- * @param headers - HTTP headers.
- */
- public void deleteDocument(String index, String documentId, Map<String, List<String>> headers) {
-
- String url = concatSubUri(searchUrl, index, documentEndpoint, documentId);
- searchClient.delete(url, headers, null);
- }
-
-
- /**
- * Convenience method to load up all the data from a file into a string
- *
- * @param filename the filename to read from disk
- * @return the data contained within the file
- * @throws Exception
- */
- protected String loadFileData(String filename) throws Exception {
- StringBuilder data = new StringBuilder();
- try {
- BufferedReader in = new BufferedReader(new InputStreamReader(
- EntityEventPolicy.class.getClassLoader().getResourceAsStream("/" + filename),
- StandardCharsets.UTF_8));
- String line;
-
- while ((line = in.readLine()) != null) {
- data.append(line);
- }
- } catch (Exception e) {
- throw new Exception("Failed to read from file = " + filename + ".", e);
- }
-
- return data.toString();
- }
-
-
- /**
- * Helper utility to concatenate substrings of a URI together to form a proper URI.
- *
- * @param suburis the list of substrings to concatenate together
- * @return the concatenated list of substrings
- */
- public static String concatSubUri(String... suburis) {
- String finalUri = "";
-
- for (String suburi : suburis) {
-
- if (suburi != null) {
- // Remove any leading / since we only want to append /
- suburi = suburi.replaceFirst("^/*", "");
-
- // Add a trailing / if one isn't already there
- finalUri += suburi.endsWith("/") ? suburi : suburi + "/";
- }
- }
-
- return finalUri;
- }
-
-
- /**
- * Helper utility to check the response code of an HTTP response.
- *
- * @param aResult - The response that we want to check.
- *
- * @return - true if the response contains a success code,
- * false otherwise.
- */
- private boolean resultSuccessful(OperationResult aResult) {
-
- return (aResult.getResultCode() >= 200) && (aResult.getResultCode() < 300);
- }
-}
diff --git a/src/main/java/org/openecomp/datarouter/util/SearchSuggestionPermutation.java b/src/main/java/org/openecomp/datarouter/util/SearchSuggestionPermutation.java
deleted file mode 100644
index 0a72ce5..0000000
--- a/src/main/java/org/openecomp/datarouter/util/SearchSuggestionPermutation.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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=========================================================
- * <p>
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.openecomp.datarouter.util;
-
-import java.util.ArrayList;
-import java.util.List;
-
-public class SearchSuggestionPermutation {
- /*
- * Will return all the unique combinations of the suggestions provided.
- * The order of the permutation is not taken into account when computing
- * the uniqueness.
- * e.g.: A list of A,B,C,D will return
- * [[A], [A, B, C, D], [A, C, D], [A, D], [B], [B, C, D], [B, D], [C], [C, D], [D]]
- *
- * @param list The list of statuses to create permutations of
- * @return A list which contains a array list of all possible combinations
- */
- public static ArrayList<ArrayList<String>> getUniqueListForSuggestions(
- List<String> originalList) {
- ArrayList<ArrayList<String>> lists = new ArrayList<>();
- if (originalList.isEmpty()) {
- lists.add(new ArrayList<String>());
- return lists;
- }
- List<String> list = new ArrayList<>(originalList);
- String head = list.get(0);
- ArrayList<String> rest = new ArrayList<>(list.subList(1, list.size()));
-
- for (ArrayList<String> activeList : getUniqueListForSuggestions(rest)) {
- ArrayList<String> newList = new ArrayList<>();
- newList.add(head);
- newList.addAll(activeList);
- lists.add(newList);
- lists.add(activeList);
- }
- return lists;
- }
-
- public static ArrayList<ArrayList<String>> getNonEmptyUniqueLists(List<String> list) {
- ArrayList<ArrayList<String>> lists = getUniqueListForSuggestions(list);
- // remove empty list from the power set
- for (ArrayList<String> emptyList : lists) {
- if (emptyList.isEmpty()) {
- lists.remove(emptyList);
- break;
- }
- }
- return lists;
- }
-
- public static List<List<String>> getListPermutations(List<String> list) {
- List<String> inputList = new ArrayList<>();
- inputList.addAll(list);
- if (inputList.isEmpty()) {
- List<List<String>> result = new ArrayList<>();
- result.add(new ArrayList<String>());
- return result;
- }
-
- List<List<String>> listOfLists = new ArrayList<>();
-
- String firstElement = inputList.remove(0);
-
- List<List<String>> recursiveReturn = getListPermutations(inputList);
- for (List<String> li : recursiveReturn) {
-
- for (int index = 0; index <= li.size(); index++) {
- List<String> temp = new ArrayList<>(li);
- temp.add(index, firstElement);
- listOfLists.add(temp);
- }
-
- }
- return listOfLists;
- }
-
-}
diff --git a/src/main/java/org/openecomp/datarouter/util/Version.java b/src/main/java/org/openecomp/datarouter/util/Version.java
deleted file mode 100644
index 7ffce94..0000000
--- a/src/main/java/org/openecomp/datarouter/util/Version.java
+++ /dev/null
@@ -1,27 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 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.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.openecomp.datarouter.util;
-
-public enum Version {
- v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v16, v17, v18, v19, v20;
-} \ No newline at end of file
diff --git a/src/main/java/org/openecomp/datarouter/util/VersionedOxmEntities.java b/src/main/java/org/openecomp/datarouter/util/VersionedOxmEntities.java
deleted file mode 100644
index 1c993bb..0000000
--- a/src/main/java/org/openecomp/datarouter/util/VersionedOxmEntities.java
+++ /dev/null
@@ -1,347 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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=========================================================
- * <p>
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.openecomp.datarouter.util;
-
-import org.eclipse.persistence.dynamic.DynamicType;
-import org.eclipse.persistence.internal.helper.DatabaseField;
-import org.eclipse.persistence.internal.oxm.XPathFragment;
-import org.eclipse.persistence.internal.oxm.mappings.Descriptor;
-import org.eclipse.persistence.jaxb.dynamic.DynamicJAXBContext;
-import org.eclipse.persistence.mappings.DatabaseMapping;
-import org.eclipse.persistence.oxm.XMLField;
-import org.onap.aai.datarouter.entity.OxmEntityDescriptor;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.Vector;
-
-/**
- * Builds up a representation of the versioned entities in a way that they can be cross referenced
- * in a data-driven way
- *
- * @author DAVEA
- */
-public class VersionedOxmEntities {
-
- private static final String REST_ROOT_ENTITY = "inventory";
-
- private HashMap<String, Boolean> crossEntityReferenceContainerLookup = new HashMap<>();
- private HashMap<String, CrossEntityReference> crossEntityReferenceLookup = new HashMap<>();
- private Map<String, DynamicType> entityTypeLookup = new LinkedHashMap<>();
- private Map<String, OxmEntityDescriptor> searchableEntityDescriptors = new HashMap<>();
- private Map<String, OxmEntityDescriptor> suggestableEntityDescriptors = new HashMap<>();
- private Map<String, OxmEntityDescriptor> entityAliasDescriptors = new HashMap<>();
-
-
- public void initialize(DynamicJAXBContext context) {
- parseOxmContext(context);
- buildCrossEntityReferenceCollections(REST_ROOT_ENTITY, new HashSet<String>());
- populateSearchableDescriptors(context);
- }
-
- /**
- * The big goal for these methods is to make the processing as generic and model driven as possible.
- * There are only two exceptions to this rule, at the moment. I needed to hard-coded the top level REST data
- * model entity type, which is "inventory" for now. And as this class is heavily focused and coupled towards
- * building a version specific set of lookup structures for the "crossEntityReference" model attribute, it possesses
- * knowledge of that attribute whether it exists or not in the DynamicJAXBContext we are currently analyzing.
- * <p>
- * This method will build two collections:
- * <p>
- * 1) A list of entity types that can have nested entities containing cross entity reference definitions.
- * The purpose of this collection is a fail-fast test when processing UEB events so we can quickly determine if
- * it is necessary to deeply parse the event looking for cross entity reference attributes which not exist.
- * <p>
- * For example, looking at a service-instance <=> inventory path:
- * <p>
- * inventory (true)
- * -> business (true)
- * -> customers (true)
- * -> customer (true)
- * -> service-subscriptions (true)
- * -> service-subscription (CER defined here in the model) (true)
- * -> service-instances (false)
- * -> service-instance (false)
- * <p>
- * Because service-subscription contains a model definition of CER, in the first collection all the types in the
- * tree will indicate that it possesses one or more contained entity types with a cross-entity-reference definition.
- * <p>
- * 2) A lookup for { entityType => CrossEntityReference } so we can quickly access the model definition of a CER
- * for a specific entity type when we begin extracting parent attributes for transposition into nested child entity
- * types.
- *
- * @param entityType
- * @param checked
- * @return
- */
- protected boolean buildCrossEntityReferenceCollections(String entityType, HashSet<String> checked) {
-
- /*
- * To short-circuit infinite loops, make sure this entityType hasn't
- * already been checked
- */
-
- if (checked.contains(entityType)) {
- return false;
- } else {
- checked.add(entityType);
- }
-
- DynamicType parentType = entityTypeLookup.get(entityType);
- DynamicType childType;
- boolean returnValue = false;
-
- if (parentType == null) {
- return returnValue;
- }
-
- /*
- * Check if current descriptor contains the cross-entity-reference
- * attribute. If it does not walk the entity model looking for nested
- * entity types that may contain the reference.
- */
-
- Map<String, String> properties = parentType.getDescriptor().getProperties();
- if (properties != null) {
- for (Map.Entry<String, String> entry : properties.entrySet()) {
- if ("crossEntityReference".equalsIgnoreCase(entry.getKey())) {
- returnValue = true;
- CrossEntityReference cer = new CrossEntityReference();
- cer.initialize(entry.getValue());
- crossEntityReferenceLookup.put(entityType, cer);
- //System.out.println("entityType = " + entityType + " contains a CER instance = " + returnValue);
- // return true;
- }
- }
- }
-
- Vector<DatabaseField> fields = parentType.getDescriptor().getAllFields();
-
- if (fields != null) {
-
- XMLField xmlField;
- for (DatabaseField f : fields) {
-
- if (f instanceof XMLField) {
- xmlField = (XMLField) f;
- XPathFragment xpathFragment = xmlField.getXPathFragment();
- String entityShortName = xpathFragment.getLocalName();
-
- childType = entityTypeLookup.get(entityShortName);
-
- if (childType != null) {
-
- if (!checked.contains(entityShortName)) {
-
- if (buildCrossEntityReferenceCollections(entityShortName, checked)) {
- returnValue = true;
- }
-
- }
-
- checked.add(entityShortName);
-
- }
-
- }
-
- }
-
- }
-
- crossEntityReferenceContainerLookup.put(entityType, Boolean.valueOf(returnValue));
- return returnValue;
- }
-
- private void populateSearchableDescriptors(DynamicJAXBContext oxmContext) {
- List<Descriptor> descriptorsList = oxmContext.getXMLContext().getDescriptors();
- OxmEntityDescriptor newOxmEntity;
-
- for (Descriptor desc : descriptorsList) {
-
- DynamicType entity = (DynamicType) oxmContext.getDynamicType(desc.getAlias());
-
- //LinkedHashMap<String, String> oxmProperties = new LinkedHashMap<String, String>();
- String primaryKeyAttributeNames = null;
-
- //Not all fields have key attributes
- if (desc.getPrimaryKeyFields() != null) {
- primaryKeyAttributeNames = desc.getPrimaryKeyFields()
- .toString().replaceAll("/text\\(\\)", "").replaceAll("\\[", "").replaceAll("\\]", "");
- }
-
- String entityName = desc.getDefaultRootElement();
-
- Map<String, String> properties = entity.getDescriptor().getProperties();
- if (properties != null) {
- for (Map.Entry<String, String> entry : properties.entrySet()) {
- if ("searchable".equalsIgnoreCase(entry.getKey())) {
-
- /*
- * we can do all the work here, we don't have a create additional collections for
- * subsequent passes
- */
- newOxmEntity = new OxmEntityDescriptor();
- newOxmEntity.setEntityName(entityName);
- newOxmEntity
- .setPrimaryKeyAttributeName(Arrays.asList(primaryKeyAttributeNames.split(",")));
- newOxmEntity.setSearchableAttributes(Arrays.asList(entry.getValue().split(",")));
- searchableEntityDescriptors.put(entityName, newOxmEntity);
- } else if ("containsSuggestibleProps".equalsIgnoreCase(entry.getKey())) {
- newOxmEntity = new OxmEntityDescriptor();
- newOxmEntity.setEntityName(entityName);
- newOxmEntity.setSuggestableEntity(true);
- Vector<DatabaseMapping> descriptorMaps = entity.getDescriptor().getMappings();
- List<String> listOfSuggestableAttributes = new ArrayList<>();
-
- for (DatabaseMapping descMap : descriptorMaps) {
- if (descMap.isAbstractDirectMapping()) {
-
- if (descMap.getProperties().get("suggestibleOnSearch") != null) {
- String suggestableOnSearchString = String.valueOf(
- descMap.getProperties().get("suggestibleOnSearch"));
-
- boolean isSuggestibleOnSearch = Boolean.valueOf(suggestableOnSearchString);
-
- if (isSuggestibleOnSearch) {
- /* Grab attribute types for suggestion */
- String attributeName = descMap.getField().getName()
- .replaceAll("/text\\(\\)", "");
- listOfSuggestableAttributes.add(attributeName);
- }
- }
- }
- }
- newOxmEntity.setSuggestableAttributes(listOfSuggestableAttributes);
- suggestableEntityDescriptors.put(entityName, newOxmEntity);
- } else if ("suggestionAliases".equalsIgnoreCase(entry.getKey())) {
- newOxmEntity = new OxmEntityDescriptor();
- newOxmEntity.setEntityName(entityName);
- newOxmEntity.setAlias(Arrays.asList(entry.getValue().split(",")));
- entityAliasDescriptors.put(entityName, newOxmEntity);
- }
- }
- }
-
- }
-
- }
-
- public Map<String, OxmEntityDescriptor> getSearchableEntityDescriptors() {
- return searchableEntityDescriptors;
- }
-
- public OxmEntityDescriptor getSearchableEntityDescriptor(String entityType) {
- return searchableEntityDescriptors.get(entityType);
- }
-
-
- public HashMap<String, Boolean> getCrossEntityReferenceContainers() {
- return crossEntityReferenceContainerLookup;
- }
-
- public HashMap<String, CrossEntityReference> getCrossEntityReferences() {
- return crossEntityReferenceLookup;
- }
-
-
- private void parseOxmContext(DynamicJAXBContext oxmContext) {
- List<Descriptor> descriptorsList = oxmContext.getXMLContext().getDescriptors();
-
- for (Descriptor desc : descriptorsList) {
-
- DynamicType entity = (DynamicType) oxmContext.getDynamicType(desc.getAlias());
-
- String entityName = desc.getDefaultRootElement();
-
- entityTypeLookup.put(entityName, entity);
-
- }
-
- }
-
- public boolean entityModelContainsCrossEntityReference(String containerEntityType) {
- Boolean v = crossEntityReferenceContainerLookup.get(containerEntityType);
-
- if (v == null) {
- return false;
- }
-
- return v;
- }
-
- public boolean entityContainsCrossEntityReference(String entityType) {
- return crossEntityReferenceLookup.get(entityType) != null;
- }
-
- public CrossEntityReference getCrossEntityReference(String entityType) {
- return crossEntityReferenceLookup.get(entityType);
- }
-
- public Map<String, OxmEntityDescriptor> getSuggestableEntityDescriptors() {
- return suggestableEntityDescriptors;
- }
-
- public void setSuggestableEntityDescriptors(
- Map<String, OxmEntityDescriptor> suggestableEntityDescriptors) {
- this.suggestableEntityDescriptors = suggestableEntityDescriptors;
- }
-
- public Map<String, OxmEntityDescriptor> getEntityAliasDescriptors() {
- return entityAliasDescriptors;
- }
-
- public void setEntityAliasDescriptors(Map<String, OxmEntityDescriptor> entityAliasDescriptors) {
- this.entityAliasDescriptors = entityAliasDescriptors;
- }
-
- public void extractEntities(String entityType, DynamicJAXBContext context, Collection<DynamicType> entities) {
-
-
- }
-
- public String dumpCrossEntityReferenceContainers() {
-
- Set<String> keys = crossEntityReferenceContainerLookup.keySet();
- StringBuilder sb = new StringBuilder(128);
-
- for (String key : keys) {
-
- if (crossEntityReferenceContainerLookup.get(key)) {
- sb.append("\n").append("Entity-Type = '" + key + "' contains a Cross-Entity-Reference.");
- }
- }
-
-
- return sb.toString();
-
- }
-
-}
diff --git a/src/main/java/org/openecomp/datarouter/util/client/NoAuthRestClient.java b/src/main/java/org/openecomp/datarouter/util/client/NoAuthRestClient.java
deleted file mode 100644
index b334226..0000000
--- a/src/main/java/org/openecomp/datarouter/util/client/NoAuthRestClient.java
+++ /dev/null
@@ -1,222 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 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
- * <p>
- * http://www.apache.org/licenses/LICENSE-2.0
- * <p>
- * 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=========================================================
- * <p>
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.openecomp.datarouter.util.client;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import org.apache.camel.Exchange;
-import org.apache.camel.Message;
-import org.onap.aai.cl.api.Logger;
-import org.onap.aai.cl.eelf.LoggerFactory;
-import org.onap.aai.cl.mdc.MdcContext;
-import org.onap.aai.restclient.client.Headers;
-import org.onap.aai.restclient.client.OperationResult;
-import org.onap.aai.restclient.client.RestClient;
-import org.onap.aai.restclient.enums.RestAuthenticationMode;
-import org.onap.aai.restclient.rest.HttpUtil;
-import org.openecomp.datarouter.logging.DataRouterMsgs;
-import org.openecomp.datarouter.util.AaiUiSvcPolicyUtil;
-import org.openecomp.datarouter.util.NodeUtils;
-import org.openecomp.datarouter.util.RouterServiceUtil;
-import org.slf4j.MDC;
-import org.springframework.http.HttpStatus;
-
-import javax.ws.rs.core.MediaType;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-public class NoAuthRestClient implements SvcRoutingRestClient {
-
- private RestClient restClient;
-
- private String host;
- private String port;
- private String originUrl;
- private String targetUri;
- private JsonNode targetPayload;
- private Logger logger;
- private Logger auditLogger;
-
- public NoAuthRestClient(int connectTimeOut, int readTimeOut) {
- LoggerFactory loggerFactoryInstance = LoggerFactory.getInstance();
- logger = loggerFactoryInstance.getLogger(NoAuthRestClient.class.getName());
- auditLogger = loggerFactoryInstance.getAuditLogger(NoAuthRestClient.class.getName());
- restClient = new RestClient().authenticationMode(RestAuthenticationMode.HTTP_NOAUTH)
- .connectTimeoutMs(connectTimeOut).readTimeoutMs(readTimeOut);
- }
-
-
- private OperationResult getResults(String url, JsonNode payload) {
- Map<String, List<String>> headers = new HashMap<>();
- headers.put(Headers.FROM_APP_ID, Arrays.asList("Synapse"));
- headers.put(Headers.TRANSACTION_ID, Arrays.asList(MDC.get(MdcContext.MDC_REQUEST_ID)));
- return this.getRestClient().post(url, payload.asText(),
- headers, MediaType.APPLICATION_JSON_TYPE,
- MediaType.APPLICATION_JSON_TYPE);
- }
-
- public final void handleRequest(String host, String port, Exchange exchange) throws Exception {
- RouterServiceUtil.setMdcContext(exchange);
- Message message = exchange.getIn();
- String body = message.getBody(String.class);
- OperationResult result = new OperationResult();
-
- this.setHost(host);
- this.setPort(port);
-
- this.setOriginUrl(message.getHeader(Exchange.HTTP_URL).toString());
- if (body != null && body.length() != 0) {
- JsonNode node = NodeUtils.convertJsonStrToJsonNode(body);
- this.setTargetPayload(AaiUiSvcPolicyUtil.getOriginPayload(node));
- this.setTargetUri(AaiUiSvcPolicyUtil.getTargetUri(node));
- }
-
- if (this.getTargetPayload() == null || this.getTargetUri() == null) {
- logger.error(DataRouterMsgs.INVALID_ORIGIN_PAYLOAD, body);
- result.setResultCode(HttpStatus.BAD_REQUEST.value());
- result.setFailureCause("Invalid payload");
- }
-
- String targetUrl = "http://" + host + ":" + port + "/" + this.targetUri;
- auditLogger.info(DataRouterMsgs.ROUTING_FROM_TO, this.getOriginUrl(), targetUrl);
- long startTimeInMs = System.currentTimeMillis();
-
- result = this.getResults(targetUrl, targetPayload);
-
- long targetMsOpTime = System.currentTimeMillis() - startTimeInMs;
- auditLogger.info(DataRouterMsgs.OP_TIME, "Target service at " + targetUrl, String.valueOf(targetMsOpTime));
-
- int rc = result.getResultCode();
- String resultStr;
- if (HttpUtil.isHttpResponseClassSuccess(rc)) {
- resultStr = result.getResult();
- } else {
- resultStr = result.getFailureCause();
- }
-
- logger.debug(DataRouterMsgs.ROUTING_RESPONSE, targetUrl, result.toString());
- exchange.getOut().setHeader(Exchange.HTTP_RESPONSE_CODE, rc);
- exchange.getOut().setBody(resultStr);
- }
-
-
- /* (non-Javadoc)
- * @see org.openecomp.datarouter.util.client.SvcRoutingRestClient#getHost()
- */
- @Override
- public String getHost() {
- return host;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.datarouter.util.client.SvcRoutingRestClient#setHost(java.lang.String)
- */
- @Override
- public void setHost(String host) {
- this.host = host;
- }
-
-
- /* (non-Javadoc)
- * @see org.openecomp.datarouter.util.client.SvcRoutingRestClient#getPort()
- */
- @Override
- public String getPort() {
- return port;
- }
-
-
- /* (non-Javadoc)
- * @see org.openecomp.datarouter.util.client.SvcRoutingRestClient#setPort(java.lang.String)
- */
- @Override
- public void setPort(String port) {
- this.port = port;
- }
-
-
- /* (non-Javadoc)
- * @see org.openecomp.datarouter.util.client.SvcRoutingRestClient#getTargetUri()
- */
- @Override
- public String getTargetUri() {
- return targetUri;
- }
-
-
- /* (non-Javadoc)
- * @see org.openecomp.datarouter.util.client.SvcRoutingRestClient#setTargetUri(java.lang.String)
- */
- @Override
- public void setTargetUri(String targetUri) {
- this.targetUri = targetUri;
- }
-
-
- /* (non-Javadoc)
- * @see org.openecomp.datarouter.util.client.SvcRoutingRestClient#getTargetPayload()
- */
- @Override
- public JsonNode getTargetPayload() {
- return targetPayload;
- }
-
-
- /* (non-Javadoc)
- * @see org.openecomp.datarouter.util.client
- * .SvcRoutingRestClient#setTargetPayload(com.fasterxml.jackson.databind.JsonNode)
- */
- @Override
- public void setTargetPayload(JsonNode targetPayload) {
- this.targetPayload = targetPayload;
- }
-
-
- /* (non-Javadoc)
- * @see org.openecomp.datarouter.util.client.SvcRoutingRestClient#getRestClient()
- */
- @Override
- public RestClient getRestClient() {
- return restClient;
- }
-
- /* (non-Javadoc)
- * @see org.openecomp.datarouter.util.client.SvcRoutingRestClient#setRestClient()
- */
- @Override
- public void setRestClient(RestClient client) {
- this.restClient = client;
- }
-
-
- public String getOriginUrl() {
- return originUrl;
- }
-
-
- public void setOriginUrl(String originUrl) {
- this.originUrl = originUrl;
- }
-
-}
diff --git a/src/main/java/org/openecomp/datarouter/util/client/SvcRoutingRestClient.java b/src/main/java/org/openecomp/datarouter/util/client/SvcRoutingRestClient.java
deleted file mode 100644
index aab9605..0000000
--- a/src/main/java/org/openecomp/datarouter/util/client/SvcRoutingRestClient.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/**
- * ============LICENSE_START=======================================================
- * org.onap.aai
- * ================================================================================
- * Copyright © 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright © 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.
- * ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
- */
-package org.openecomp.datarouter.util.client;
-
-import org.onap.aai.restclient.client.RestClient;
-
-import com.fasterxml.jackson.databind.JsonNode;
-
-
-public interface SvcRoutingRestClient {
-
- String getHost();
-
- void setHost(String host);
-
- String getPort();
-
- void setPort(String port);
-
- String getTargetUri();
-
- void setTargetUri(String targetUri);
-
- JsonNode getTargetPayload();
-
- void setTargetPayload(JsonNode targetPayload);
-
- RestClient getRestClient();
-
- void setRestClient(RestClient client);
-
-}