diff options
Diffstat (limited to 'appc-config/appc-data-services')
6 files changed, 96 insertions, 78 deletions
diff --git a/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/AppcDataServiceActivator.java b/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/AppcDataServiceActivator.java index 698924853..552c1987f 100644 --- a/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/AppcDataServiceActivator.java +++ b/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/AppcDataServiceActivator.java @@ -1,23 +1,26 @@ /*- * ============LICENSE_START======================================================= - * ONAP : APP-C + * ONAP : APPC * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * 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.data.services; import java.util.LinkedList; @@ -56,4 +59,4 @@ public class AppcDataServiceActivator implements BundleActivator { registration = null; } } -} +}
\ No newline at end of file diff --git a/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/AppcDataServiceConstant.java b/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/AppcDataServiceConstant.java index c26a47096..f1c45c57b 100644 --- a/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/AppcDataServiceConstant.java +++ b/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/AppcDataServiceConstant.java @@ -1,23 +1,26 @@ /*- * ============LICENSE_START======================================================= - * ONAP : APP-C + * ONAP : APPC * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * 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.data.services; public class AppcDataServiceConstant { @@ -50,4 +53,4 @@ public class AppcDataServiceConstant { } -} +}
\ No newline at end of file diff --git a/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/db/DGGeneralDBService.java b/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/db/DGGeneralDBService.java index dbb765f61..303c974f9 100644 --- a/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/db/DGGeneralDBService.java +++ b/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/db/DGGeneralDBService.java @@ -1,23 +1,26 @@ /*- * ============LICENSE_START======================================================= - * ONAP : APP-C + * ONAP : APPC * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * 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.data.services.db; import java.util.Set; @@ -442,4 +445,4 @@ public class DGGeneralDBService { return localContext.getAttribute("artifact-content"); } -} +}
\ No newline at end of file diff --git a/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/db/GeneralDataService.java b/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/db/GeneralDataService.java index d0b8726ad..49c8e4732 100644 --- a/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/db/GeneralDataService.java +++ b/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/db/GeneralDataService.java @@ -1,23 +1,26 @@ /*- * ============LICENSE_START======================================================= - * ONAP : APP-C + * ONAP : APPC * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * 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.data.services.db; import java.util.Map; @@ -39,42 +42,42 @@ import com.att.eelf.configuration.EELFManager; public class GeneralDataService { - private static final EELFLogger log = EELFManager.getInstance().getLogger(GeneralDataService.class); - - public void saveTransactionLog(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException - { - SvcLogicContext logger = new SvcLogicContext(); - String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX); - String messageType = inParams.get(AppcDataServiceConstant.INPUT_PARAM_MESSAGE_TYPE); - String message = inParams.get(AppcDataServiceConstant.INPUT_PARAM_MESSAGE); - try - { - - String escapedMessage = EscapeUtils.escapeSql(message); - logger.setAttribute("request-id", ctx.getAttribute("request-id")); - logger.setAttribute("log-message-type", messageType); - logger.setAttribute("log-message", escapedMessage); + private static final EELFLogger log = EELFManager.getInstance().getLogger(GeneralDataService.class); + + public void saveTransactionLog(Map<String, String> inParams, SvcLogicContext ctx) throws SvcLogicException + { + SvcLogicContext logger = new SvcLogicContext(); + String responsePrefix = inParams.get(AppcDataServiceConstant.INPUT_PARAM_RESPONSE_PREFIX); + String messageType = inParams.get(AppcDataServiceConstant.INPUT_PARAM_MESSAGE_TYPE); + String message = inParams.get(AppcDataServiceConstant.INPUT_PARAM_MESSAGE); + try + { + + String escapedMessage = EscapeUtils.escapeSql(message); + logger.setAttribute("request-id", ctx.getAttribute("request-id")); + logger.setAttribute("log-message-type", messageType); + logger.setAttribute("log-message", escapedMessage); - responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : ""; - DGGeneralDBService db = DGGeneralDBService.initialise(); - QueryStatus status = db.saveConfigTransactionLog( logger, responsePrefix); + responsePrefix = StringUtils.isNotBlank(responsePrefix) ? (responsePrefix+".") : ""; + DGGeneralDBService db = DGGeneralDBService.initialise(); + QueryStatus status = db.saveConfigTransactionLog( logger, responsePrefix); - logger.setAttribute("log-message", null); - logger.setAttribute("log-message-type", null); - logger.setAttribute("request-id", null); + logger.setAttribute("log-message", null); + logger.setAttribute("log-message-type", null); + logger.setAttribute("request-id", null); - if (status == QueryStatus.FAILURE) - throw new Exception("Unable to insert into config_transaction_log"); + if (status == QueryStatus.FAILURE) + throw new Exception("Unable to insert into config_transaction_log"); - } - catch (Exception e) - { - ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS, - AppcDataServiceConstant.OUTPUT_STATUS_FAILURE); - ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage()); - throw new SvcLogicException(e.getMessage()); - } - } - -} + } + catch (Exception e) + { + ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_STATUS, + AppcDataServiceConstant.OUTPUT_STATUS_FAILURE); + ctx.setAttribute(responsePrefix + AppcDataServiceConstant.OUTPUT_PARAM_ERROR_MESSAGE, e.getMessage()); + throw new SvcLogicException(e.getMessage()); + } + } + +}
\ No newline at end of file diff --git a/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/node/ConfigResourceNode.java b/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/node/ConfigResourceNode.java index 30fcbbdcc..e22567336 100644 --- a/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/node/ConfigResourceNode.java +++ b/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/node/ConfigResourceNode.java @@ -1,9 +1,11 @@ /*- * ============LICENSE_START======================================================= - * ONAP : APP-C + * ONAP : APPC * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * 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 @@ -15,9 +17,10 @@ * 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.data.services.node; import java.util.ArrayList; @@ -788,4 +791,4 @@ public class ConfigResourceNode implements SvcLogicJavaPlugin { } return capabilityCheckNeeded; } -} +}
\ No newline at end of file diff --git a/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/utils/EscapeUtils.java b/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/utils/EscapeUtils.java index 56e776c7c..6df4e1bad 100644 --- a/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/utils/EscapeUtils.java +++ b/appc-config/appc-data-services/provider/src/main/java/org/onap/appc/data/services/utils/EscapeUtils.java @@ -1,39 +1,42 @@ /*- * ============LICENSE_START======================================================= - * ONAP : APP-C + * ONAP : APPC * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved. + * 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.data.services.utils; import org.apache.commons.lang3.StringUtils; public class EscapeUtils { - public EscapeUtils() { - // TODO Auto-generated constructor stub - } + public EscapeUtils() { + // TODO Auto-generated constructor stub + } - public static String escapeSql(String str) { - if (str == null) { - return null; - } - String searchList[] = new String[]{"'","\\"}; - String replacementList[] = new String[]{ "''","\\\\"}; - return StringUtils.replaceEach(str,searchList, replacementList); - } -} + public static String escapeSql(String str) { + if (str == null) { + return null; + } + String searchList[] = new String[]{"'","\\"}; + String replacementList[] = new String[]{ "''","\\\\"}; + return StringUtils.replaceEach(str,searchList, replacementList); + } +}
\ No newline at end of file |