aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-sdnc-adapter/src/main/java/org
diff options
context:
space:
mode:
Diffstat (limited to 'adapters/mso-sdnc-adapter/src/main/java/org')
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/AsyncConfiguration.java31
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java107
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/ObjectFactory.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/ObjectFactory.java)6
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/RequestHeader.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/RequestHeader.java)2
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java73
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterPortType.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterPortType.java)8
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterRequest.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequest.java)7
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterResponse.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterResponse.java)2
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterService.java)17
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SyncConfiguration.java28
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/WebSecurityConfigImpl.java51
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/CallbackHeader.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeader.java)2
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/ObjectFactory.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/ObjectFactory.java)6
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequest.java)19
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterPortType.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterPortType.java)11
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterService.java)17
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/package-info.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/package-info.java)4
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/exception/SDNCAdapterException.java30
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Constants.java)20
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java102
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/RequestTunables.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunables.java)102
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java84
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCResponse.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCResponse.java)2
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java)108
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Utils.java)15
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/package-info.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/package-info.java)4
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallback.java)42
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java109
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCAdapterUtils.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterUtils.java)19
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java)74
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java)54
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java)143
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SNIROResponse.java)38
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/TypedRequestTunables.java180
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/util/SDNCRequestIdUtil.java (renamed from adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtil.java)2
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java102
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterRestImpl.java191
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/notify/SDNCNotifyResource.java192
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterProperties.java85
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterRest.java239
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCEventParser.java161
-rw-r--r--adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/TypedRequestTunables.java224
42 files changed, 1148 insertions, 1565 deletions
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/AsyncConfiguration.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/AsyncConfiguration.java
new file mode 100644
index 0000000000..db5f682f6b
--- /dev/null
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/AsyncConfiguration.java
@@ -0,0 +1,31 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.sdnc;
+
+import org.springframework.context.annotation.Configuration;
+import org.springframework.scheduling.annotation.EnableAsync;
+
+
+@Configuration
+@EnableAsync
+public class AsyncConfiguration {
+
+}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java
new file mode 100644
index 0000000000..4a50fb32e3
--- /dev/null
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/CXFConfiguration.java
@@ -0,0 +1,107 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.sdnc;
+
+import java.util.Arrays;
+
+import javax.xml.ws.Endpoint;
+
+import org.apache.cxf.Bus;
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.feature.LoggingFeature;
+import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
+import org.apache.cxf.jaxrs.swagger.Swagger2Feature;
+import org.apache.cxf.jaxws.EndpointImpl;
+import org.apache.cxf.transport.servlet.CXFServlet;
+import org.onap.so.adapters.sdnc.sdncrest.SNIROResponse;
+import org.onap.so.logger.MsoLogger;
+import org.onap.so.logging.jaxrs.filter.jersey.JaxRsFilterLogging;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.web.servlet.ServletRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import com.fasterxml.jackson.databind.DeserializationFeature;
+import com.fasterxml.jackson.databind.ObjectMapper;
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+
+
+@Configuration("CXFConfiguration")
+public class CXFConfiguration {
+
+ private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL,CXFConfiguration.class);
+
+ JAXRSServerFactoryBean endpoint;
+
+ @Autowired
+ private Bus bus;
+
+ @Autowired
+ private JaxRsFilterLogging jaxRsFilterLogging;
+
+ @Autowired
+ private SDNCAdapterPortType sdncAdapterPortImpl;
+
+ @Autowired
+ private SNIROResponse sniroResponse;
+
+
+ @Autowired
+ private ObjectMapper mapper;
+ @Bean
+ public Server rsServer() {
+ endpoint = new JAXRSServerFactoryBean();
+ mapper.configure(DeserializationFeature.UNWRAP_ROOT_VALUE, true);
+ endpoint.setBus(bus);
+ endpoint.setServiceBeans(Arrays.<Object>asList(sniroResponse));
+ endpoint.setAddress("/rest");
+ endpoint.setFeatures(Arrays.asList(createSwaggerFeature(), new LoggingFeature()));
+ endpoint.setProviders(Arrays.asList(new JacksonJsonProvider(mapper),jaxRsFilterLogging));
+ return endpoint.create();
+ }
+
+ @Bean
+ public ServletRegistrationBean cxfServlet() {
+ return new ServletRegistrationBean(new CXFServlet(), "/adapters/*");
+ }
+
+ @Bean
+ public Endpoint sndcAdapter() {
+ EndpointImpl endpoint = new EndpointImpl(bus, sdncAdapterPortImpl);
+ endpoint.publish("/SDNCAdapter");
+ return endpoint;
+ }
+
+
+ @Bean
+ public Swagger2Feature createSwaggerFeature() {
+ Swagger2Feature swagger2Feature= new Swagger2Feature();
+ swagger2Feature.setBasePath("/services/rest");
+ swagger2Feature.setPrettyPrint(true);
+ swagger2Feature.setTitle("SO Orchestration Application");
+ swagger2Feature.setContact("The ONAP SO team");
+ swagger2Feature.setDescription("This project is the SO Orchestration Engine");
+ swagger2Feature.setVersion("1.0.0");
+ swagger2Feature.setResourcePackage("org.onap.so.adapters.sdnc");
+ swagger2Feature.setScan(true);
+ return swagger2Feature;
+ }
+}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/ObjectFactory.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/ObjectFactory.java
index ff30e0d241..eab7d5bf6f 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/ObjectFactory.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/ObjectFactory.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.sdnc;
+package org.onap.so.adapters.sdnc;
import javax.xml.bind.annotation.XmlRegistry;
@@ -27,7 +27,7 @@ import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
- * generated in the org.openecomp.mso.adapters.sdnc package.
+ * generated in the org.onap.so.adapters.sdnc package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
@@ -43,7 +43,7 @@ public class ObjectFactory {
/**
- * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.mso.adapters.sdnc
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.onap.so.adapters.sdnc
*
*/
public ObjectFactory() {
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/RequestHeader.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/RequestHeader.java
index f7b5596f16..1f1b85f34b 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/RequestHeader.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/RequestHeader.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.sdnc;
+package org.onap.so.adapters.sdnc;
import javax.xml.bind.annotation.XmlAccessType;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java
new file mode 100644
index 0000000000..3d88a1467a
--- /dev/null
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterApplication.java
@@ -0,0 +1,73 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.sdnc;
+
+import java.util.concurrent.Executor;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.autoconfigure.domain.EntityScan;
+import org.springframework.context.annotation.Bean;
+import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
+import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
+
+@SpringBootApplication(scanBasePackages = { "org.onap" })
+@EnableJpaRepositories({"org.onap.so.db.request.data.repository"})
+@EntityScan({ "org.onap.so.db.request.beans"})
+public class SDNCAdapterApplication {
+
+ @Value("${mso.async.core-pool-size}")
+ private int corePoolSize;
+
+ @Value("${mso.async.max-pool-size}")
+ private int maxPoolSize;
+
+ @Value("${mso.async.queue-capacity}")
+ private int queueCapacity;
+
+ private static final String LOGS_DIR = "logs_dir";
+
+ private static void setLogsDir() {
+ if (System.getProperty(LOGS_DIR) == null) {
+ System.getProperties().setProperty(LOGS_DIR, "./logs/sdnc/");
+ }
+ }
+
+ public static void main(String[] args) {
+ SpringApplication.run(SDNCAdapterApplication.class, args);
+ System.getProperties().setProperty("server.name", "Springboot");
+ setLogsDir();
+ }
+
+ @Bean
+ public Executor asyncExecutor() {
+ ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
+
+ executor.setCorePoolSize(corePoolSize);
+ executor.setMaxPoolSize(maxPoolSize);
+ executor.setQueueCapacity(queueCapacity);
+ executor.setThreadNamePrefix("SDNCAdapter-");
+ executor.initialize();
+ return executor;
+ }
+
+}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterPortType.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterPortType.java
index cd464923fc..66f93ab87f 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterPortType.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterPortType.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.sdnc;
+package org.onap.so.adapters.sdnc;
import javax.jws.WebMethod;
@@ -36,15 +36,15 @@ import javax.xml.bind.annotation.XmlSeeAlso;
*
*/
//BPEL SDNCAdapter SOAP WebService - impl class in impl pkg
-@WebService(targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/wsdl/v1", name = "SDNCAdapterPortType")
+@WebService(targetNamespace = "http://org.onap/workflow/sdnc/adapter/wsdl/v1", name = "SDNCAdapterPortType")
@XmlSeeAlso({ObjectFactory.class})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
public interface SDNCAdapterPortType {
- @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterResponse")
+ @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterResponse")
@WebMethod(operationName = "SDNCAdapter")
public SDNCAdapterResponse sdncAdapter(
- @WebParam(partName = "SDNCAdapterRequest", name = "SDNCAdapterRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1")
+ @WebParam(partName = "SDNCAdapterRequest", name = "SDNCAdapterRequest", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1")
SDNCAdapterRequest sdncAdapterRequest
);
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequest.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterRequest.java
index 02998bf9df..d204f0c2dd 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterRequest.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterRequest.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.sdnc;
+package org.onap.so.adapters.sdnc;
import javax.xml.bind.annotation.XmlAccessType;
@@ -27,10 +27,9 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
+import org.onap.so.adapters.sdnc.impl.Utils;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
-
-import org.openecomp.mso.adapters.sdnc.impl.Utils;
/**
* <p>Java class for anonymous complex type.
*
@@ -41,7 +40,7 @@ import org.openecomp.mso.adapters.sdnc.impl.Utils;
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
- * &lt;element ref="{http://org.openecomp/workflow/sdnc/adapter/schema/v1}RequestHeader"/>
+ * &lt;element ref="{http://org.onap/workflow/sdnc/adapter/schema/v1}RequestHeader"/>
* &lt;element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/>
* &lt;/sequence>
* &lt;/restriction>
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterResponse.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterResponse.java
index 1b2f3b824d..c67fbc0ae0 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterResponse.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterResponse.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.sdnc;
+package org.onap.so.adapters.sdnc;
import javax.xml.bind.annotation.XmlAccessType;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java
index 93d99846ef..a648aa5fd8 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/SDNCAdapterService.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SDNCAdapterService.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.sdnc;
+package org.onap.so.adapters.sdnc;
import java.net.URL;
@@ -29,8 +29,8 @@ import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.logger.MessageEnum;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
/**
* This class was generated by Apache CXF 2.7.11.redhat-3
@@ -41,20 +41,19 @@ import org.openecomp.mso.logger.MessageEnum;
//BPEL SDNCAdapter SOAP WebService
@WebServiceClient(name = "SDNCAdapterService",
wsdlLocation = "main/resources/SDNCAdapter.wsdl",
- targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/wsdl/v1")
+ targetNamespace = "http://org.onap/workflow/sdnc/adapter/wsdl/v1")
public class SDNCAdapterService extends Service {
- private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+ private static MsoLogger logger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, SDNCAdapterService.class);
public static final URL WSDL_LOCATION;
- public static final QName SERVICE = new QName("http://org.openecomp/workflow/sdnc/adapter/wsdl/v1", "SDNCAdapterService");
- public static final QName SDNCAdapterSoapHttpPort = new QName("http://org.openecomp/workflow/sdnc/adapter/wsdl/v1", "SDNCAdapterSoapHttpPort");
+ public static final QName SERVICE = new QName("http://org.onap/workflow/sdnc/adapter/wsdl/v1", "SDNCAdapterService");
+ public static final QName SDNCAdapterSoapHttpPort = new QName("http://org.onap/workflow/sdnc/adapter/wsdl/v1", "SDNCAdapterSoapHttpPort");
static {
URL wsdlUrl = null;
try {
wsdlUrl = Thread.currentThread().getContextClassLoader().getResource("main/resources/SDNCAdapter.wsdl");
-
} catch (Exception e) {
logger.error(MessageEnum.RA_WSDL_NOT_FOUND, "SDNCAdapter.wsdl", "", "", MsoLogger.ErrorCode.DataError, "Exception - WSDL not found", e);
}
@@ -62,7 +61,7 @@ public class SDNCAdapterService extends Service {
logger.error(MessageEnum.RA_WSDL_NOT_FOUND, "SDNCAdapter.wsdl", "", "", MsoLogger.ErrorCode.DataError, "WSDL not found");
} else {
try {
- logger.info(MessageEnum.RA_PRINT_URL, "SDNCAdpater.wsdl", wsdlUrl.toURI().toString(), "", "");
+ logger.info(MessageEnum.RA_PRINT_URL, "SDNCAdpater.wsdl", wsdlUrl.toURI().toString(), "");
} catch (Exception e) {
logger.error(MessageEnum.RA_WSDL_URL_CONVENTION_EXC, "SDNCAdapter.wsdl", "", "", MsoLogger.ErrorCode.DataError, "Exception - print URL", e);
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SyncConfiguration.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SyncConfiguration.java
new file mode 100644
index 0000000000..0755b9ea3f
--- /dev/null
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/SyncConfiguration.java
@@ -0,0 +1,28 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.sdnc;
+
+import org.springframework.context.annotation.Profile;
+
+@Profile("non-async")
+public class SyncConfiguration {
+
+}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/WebSecurityConfigImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/WebSecurityConfigImpl.java
new file mode 100644
index 0000000000..60e37294b1
--- /dev/null
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/WebSecurityConfigImpl.java
@@ -0,0 +1,51 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.sdnc;
+
+import org.onap.so.security.MSOSpringFirewall;
+import org.onap.so.security.WebSecurityConfig;
+import org.springframework.security.config.annotation.web.builders.HttpSecurity;
+import org.springframework.security.config.annotation.web.builders.WebSecurity;
+import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.web.firewall.StrictHttpFirewall;
+import org.springframework.util.StringUtils;
+
+@EnableWebSecurity
+public class WebSecurityConfigImpl extends WebSecurityConfig {
+
+ @Override
+ protected void configure(HttpSecurity http) throws Exception {
+ http.csrf().disable()
+ .authorizeRequests()
+ .antMatchers("/manage/health","/manage/info","/services").permitAll()
+ .antMatchers("/**").hasAnyRole(StringUtils.collectionToDelimitedString(getRoles(),",").toString())
+ .and()
+ .httpBasic();
+ }
+
+ @Override
+ public void configure(WebSecurity web) throws Exception {
+ super.configure(web);
+ StrictHttpFirewall firewall = new MSOSpringFirewall();
+ web.httpFirewall(firewall);
+ }
+
+}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeader.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/CallbackHeader.java
index 2ce452e51c..67f5516daa 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/CallbackHeader.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/CallbackHeader.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.sdnc.client;
+package org.onap.so.adapters.sdnc.client;
import javax.xml.bind.annotation.XmlAccessType;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/ObjectFactory.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/ObjectFactory.java
index 3d4039c702..238b6a7b1c 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/ObjectFactory.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/ObjectFactory.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.sdnc.client;
+package org.onap.so.adapters.sdnc.client;
import javax.xml.bind.annotation.XmlRegistry;
@@ -27,7 +27,7 @@ import javax.xml.bind.annotation.XmlRegistry;
/**
* This object contains factory methods for each
* Java content interface and Java element interface
- * generated in the org.openecomp.mso.adapters.sdnc.client package.
+ * generated in the org.onap.so.adapters.sdnc.client package.
* <p>An ObjectFactory allows you to programatically
* construct new instances of the Java representation
* for XML content. The Java representation of XML
@@ -43,7 +43,7 @@ public class ObjectFactory {
/**
- * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.openecomp.mso.adapters.sdnc.client
+ * Create a new ObjectFactory that can be used to create new instances of schema derived classes for package: org.onap.so.adapters.sdnc.client
*
*/
public ObjectFactory() {
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequest.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java
index 06c2c83f4d..7ec20afffd 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCAdapterCallbackRequest.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCAdapterCallbackRequest.java
@@ -18,20 +18,21 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.sdnc.client;
+package org.onap.so.adapters.sdnc.client;
+import java.io.StringWriter;
+
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.Marshaller;
-import java.io.StringWriter;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.logger.MessageEnum;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
/**
* <p>Java class for anonymous complex type.
*
@@ -42,7 +43,7 @@ import org.openecomp.mso.logger.MessageEnum;
* &lt;complexContent>
* &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* &lt;sequence>
- * &lt;element ref="{http://org.openecomp/workflow/sdnc/adapter/schema/v1}CallbackHeader"/>
+ * &lt;element ref="{http://org.onap/workflow/sdnc/adapter/schema/v1}CallbackHeader"/>
* &lt;element name="RequestData" type="{http://www.w3.org/2001/XMLSchema}anyType"/>
* &lt;/sequence>
* &lt;/restriction>
@@ -66,7 +67,7 @@ public class SDNCAdapterCallbackRequest {
@XmlElement(name = "RequestData")
protected Object requestData;
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, SDNCAdapterCallbackRequest.class);
/**
* Gets the value of the callbackHeader property.
@@ -119,7 +120,7 @@ public class SDNCAdapterCallbackRequest {
@Override
public String toString() {
try {
- JAXBContext ctx = JAXBContext.newInstance("org.openecomp.mso.adapters.sdnc.client");
+ JAXBContext ctx = JAXBContext.newInstance("org.onap.so.adapters.sdnc.client");
Marshaller m = ctx.createMarshaller();
m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
m.setProperty(Marshaller.JAXB_ENCODING, "UTF-8");
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterPortType.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterPortType.java
index 1b717b483a..369610ce0f 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterPortType.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterPortType.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.sdnc.client;
+package org.onap.so.adapters.sdnc.client;
import javax.jws.WebMethod;
@@ -27,7 +27,8 @@ import javax.jws.WebResult;
import javax.jws.WebService;
import javax.jws.soap.SOAPBinding;
import javax.xml.bind.annotation.XmlSeeAlso;
-import org.openecomp.mso.adapters.sdnc.SDNCAdapterResponse;
+
+import org.onap.so.adapters.sdnc.SDNCAdapterResponse;
/**
@@ -37,16 +38,16 @@ import org.openecomp.mso.adapters.sdnc.SDNCAdapterResponse;
*
*/
//SDNCAdapter to BPEL Async response WEB Service
-@WebService(targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", name = "SDNCCallbackAdapterPortType")
+@WebService(targetNamespace = "http://org.onap/workflow/sdnc/adapter/callback/wsdl/v1", name = "SDNCCallbackAdapterPortType")
@XmlSeeAlso({ObjectFactory.class})
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@FunctionalInterface
public interface SDNCCallbackAdapterPortType {
- @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse")
+ @WebResult(name = "SDNCAdapterResponse", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", partName = "SDNCAdapterCallbackResponse")
@WebMethod(operationName = "SDNCAdapterCallback")
public SDNCAdapterResponse sdncAdapterCallback(
- @WebParam(partName = "SDNCAdapterCallbackRequest", name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1")
+ @WebParam(partName = "SDNCAdapterCallbackRequest", name = "SDNCAdapterCallbackRequest", targetNamespace = "http://org.onap/workflow/sdnc/adapter/schema/v1")
SDNCAdapterCallbackRequest sdncAdapterCallbackRequest
);
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterService.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java
index d63e852258..e68bac4178 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/SDNCCallbackAdapterService.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/SDNCCallbackAdapterService.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.sdnc.client;
+package org.onap.so.adapters.sdnc.client;
import java.net.URL;
@@ -28,8 +28,9 @@ import javax.xml.ws.Service;
import javax.xml.ws.WebEndpoint;
import javax.xml.ws.WebServiceClient;
import javax.xml.ws.WebServiceFeature;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
+
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
/**
* This class was generated by Apache CXF 2.7.11.redhat-3
@@ -40,14 +41,14 @@ import org.openecomp.mso.logger.MsoLogger;
//SDNCAdapter to BPEL Async response WEB Service
@WebServiceClient(name = "SDNCCallbackAdapterService",
wsdlLocation = "main/resources/SDNCCallbackAdapter.wsdl",
- targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1")
+ targetNamespace = "http://org.onap/workflow/sdnc/adapter/callback/wsdl/v1")
public class SDNCCallbackAdapterService extends Service {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, SDNCCallbackAdapterService.class);
public static final URL WSDL_LOCATION;
- public static final QName SERVICE = new QName("http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterService");
- public static final QName SDNCCallbackAdapterSoapHttpPort = new QName("http://org.openecomp/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterSoapHttpPort");
+ public static final QName SERVICE = new QName("http://org.onap/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterService");
+ public static final QName SDNCCallbackAdapterSoapHttpPort = new QName("http://org.onap/workflow/sdnc/adapter/callback/wsdl/v1", "SDNCCallbackAdapterSoapHttpPort");
static {
URL wsdlUrl = null;
try {
@@ -59,7 +60,7 @@ public class SDNCCallbackAdapterService extends Service {
msoLogger.error(MessageEnum.RA_WSDL_NOT_FOUND, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "WSDL not found");
} else {
try {
- msoLogger.info(MessageEnum.RA_PRINT_URL, "SDNCCallbackAdapter.wsdl", wsdlUrl.toURI().toString(), "SDNC", "");
+ msoLogger.info(MessageEnum.RA_PRINT_URL, "SDNCCallbackAdapter.wsdl", wsdlUrl.toURI().toString(), "SDNC");
} catch (Exception e) {
msoLogger.error(MessageEnum.RA_WSDL_URL_CONVENTION_EXC, "SDNCCallbackAdapter.wsdl", "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - URL convention problem", e);
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/package-info.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/package-info.java
index fa06b000d6..368c824caa 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/package-info.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/client/package-info.java
@@ -18,6 +18,6 @@
* ============LICENSE_END=========================================================
*/
-@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
-package org.openecomp.mso.adapters.sdnc;
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.onap.so.adapters.sdnc.client;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/exception/SDNCAdapterException.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/exception/SDNCAdapterException.java
new file mode 100644
index 0000000000..e45c4ce569
--- /dev/null
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/exception/SDNCAdapterException.java
@@ -0,0 +1,30 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 - 2018 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.sdnc.exception;
+
+public class SDNCAdapterException extends Exception {
+
+ private static final long serialVersionUID = -7913634772004514998L;
+
+ public SDNCAdapterException(String message) {
+ super(message);
+ }
+}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Constants.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java
index a60f60aab2..d114788267 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Constants.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Constants.java
@@ -7,9 +7,9 @@
* 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.
@@ -18,31 +18,31 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.sdnc.impl;
+package org.onap.so.adapters.sdnc.impl;
public interface Constants {
- public static final String BPEL_REST_URL_PROP = "org.openecomp.mso.adapters.sdnc.rest.bpelurl";
- public static final String BPEL_URL_PROP = "org.openecomp.mso.adapters.sdnc.bpelurl";
+ public static final String BPEL_REST_URL_PROP = "org.onap.so.adapters.sdnc.rest.bpelurl";
+ public static final String BPEL_URL_PROP = "org.onap.so.adapters.sdnc.bpelurl";
public static final String DEFAULT_BPEL_URL = "http://localhost:8080//active-bpel/services/SDNCAdapterCallbackV1";
- public static final String MY_URL_PROP = "org.openecomp.mso.adapters.sdnc.myurl";
+ public static final String MY_URL_PROP = "org.onap.so.adapters.sdnc.myurl";
public static final String DEFAULT_MY_URL = "https://localhost:8443/adapters/rest/SDNCNotify";
- public static final String SDNC_AUTH_PROP = "org.openecomp.mso.adapters.sdnc.sdncauth";
+ public static final String SDNC_AUTH_PROP = "org.onap.so.adapters.sdnc.sdncauth";
public static final String DEFAULT_SDNC_AUTH = "406B2AE613211B6FB52466DE6E1769AC";
public static final String DEFAULT_BPEL_AUTH = "05FDA034C27D1CA51AAB8FAE512EDE45241E16FC8C137D292AA3A964431C82DB";
- public static final String BPEL_AUTH_PROP = "org.openecomp.mso.adapters.sdnc.bpelauth";
+ public static final String BPEL_AUTH_PROP = "org.onap.so.adapters.sdnc.bpelauth";
public static final String SDNC_SVCCFGRESP_ROOT = "input";
public static final String SDNC_REQ_ID = "/svc-request-id";
public static final String SDNC_RESP_CODE = "/response-code";
public static final String SDNC_RESP_MSG = "/response-message";
- public static final String SDNC_CONNECTTIME_PROP = "org.openecomp.mso.adapters.sdnc.sdncconnecttime";
+ public static final String SDNC_CONNECTTIME_PROP = "org.onap.so.adapters.sdnc.sdncconnecttime";
public static final String ENCRYPTION_KEY = "aa3871669d893c7fb8abbcda31b88b4f";
- public static final String REQUEST_TUNABLES = "org.openecomp.mso.adapters.sdnc";
+ public static final String REQUEST_TUNABLES = "org.onap.so.adapters.sdnc";
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java
new file mode 100644
index 0000000000..b456fb2336
--- /dev/null
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/MapRequestTunables.java
@@ -0,0 +1,102 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.sdnc.impl;
+
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+@Component
+public class MapRequestTunables {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,MapRequestTunables.class);
+ public static final String GENERATED_KEY = "Generated key: ";
+
+ @Autowired
+ private Environment env;
+
+ public RequestTunables setTunables(RequestTunables reqTunableOriginal)
+ {
+ RequestTunables reqTunable = new RequestTunables(reqTunableOriginal);
+ String error = null;
+ String key;
+ if ("query".equals(reqTunable.getAction())) { //due to variable format for reqTunable.getOperation() eg services/layer3-service-list/8fe4ba4f-35cf-4d9b-a04a-fd3f5d4c5cc9
+ key = Constants.REQUEST_TUNABLES + "." + reqTunable.getMsoAction() + ".." + reqTunable.getAction();
+ msoLogger.debug(GENERATED_KEY + key);
+ }
+ else if ("put".equals(reqTunable.getAction()) || "restdelete".equals(reqTunable.getAction())) { //due to variable format for reqTunable.getOperation() eg services/layer3-service-list/8fe4ba4f-35cf-4d9b-a04a-fd3f5d4c5cc9
+ key = Constants.REQUEST_TUNABLES + "..." + reqTunable.getAction();
+ msoLogger.debug(GENERATED_KEY + key);
+ } else {
+ key = Constants.REQUEST_TUNABLES + "." + reqTunable.getMsoAction() + "." + reqTunable.getOperation() +"." + reqTunable.getAction();
+ msoLogger.debug(GENERATED_KEY + key);
+ }
+
+ String value;
+ value = env.getProperty(key, "");
+
+ if (value != null && value.length() > 0) {
+
+ String[] parts = value.split("\\|"); //escape pipe
+ if (parts.length < 3) {
+ msoLogger.warn(MessageEnum.RA_SDNC_INVALID_CONFIG, key, value, "SDNC", "", MsoLogger.ErrorCode.DataError, "Invalid config");
+ }
+
+ for (int i = 0; i < parts.length; i++) {
+ if (i == 0) {
+ reqTunable.setReqMethod(parts[i]) ;
+ msoLogger.debug("Request Method is set to: " + reqTunable.getReqMethod());
+ } else if (i == 1) {
+ reqTunable.setTimeout( parts[i]);
+ msoLogger.debug("Timeout is set to: " + reqTunable.getTimeout());
+ } else if (i == 2) {
+ reqTunable.setSdncUrl(env.getProperty(Constants.REQUEST_TUNABLES + "." + parts[i],""));
+ if (reqTunable.getOperation() != null && reqTunable.getSdncUrl() != null) {
+ reqTunable.setSdncUrl(reqTunable.getSdncUrl() + reqTunable.getOperation());
+ }
+ msoLogger.debug("SDNC Url is set to: " + reqTunable.getSdncUrl());
+ } else if (i == 3) {
+ reqTunable.setHeaderName(parts[i]);
+ msoLogger.debug("HeaderName is set to: " + reqTunable.getHeaderName());
+ } else if (i == 4) {
+ reqTunable.setNamespace(parts[i]);
+ msoLogger.debug("NameSpace is set to: " + reqTunable.getNamespace());
+ } else if (i == 5) {
+ reqTunable.setAsyncInd(parts[i]);
+ msoLogger.debug("AsyncInd is set to: " + reqTunable.getAsyncInd());
+ }
+ }
+
+ if (reqTunable.getSdncUrl() == null || reqTunable.getSdncUrl().equals("")) {
+ error = "Invalid configuration, sdncUrl required for:" + key + " value:" + value;
+ }
+ } else {
+ error = "Missing configuration for:" + key;
+ }
+ if (error != null) {
+ msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, key, "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param");
+ }
+ msoLogger.debug ("RequestTunables Key:" + key + " Value:" + value + " Tunables:" + this.toString());
+ return reqTunable;
+ }
+}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/RequestTunables.java
index 830ac7c917..5ed9763b71 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/RequestTunables.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/RequestTunables.java
@@ -18,22 +18,16 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.sdnc.impl;
+package org.onap.so.adapters.sdnc.impl;
-import org.openecomp.mso.logger.MsoAlarmLogger;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.properties.MsoPropertiesException;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-import org.openecomp.mso.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
public class RequestTunables {
- private MsoPropertiesFactory msoPropertiesFactory;
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
- private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
- public static final String MSO_PROP_SDNC_ADAPTER="MSO_PROP_SDNC_ADAPTER";
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,RequestTunables.class);
+
public static final String GENERATED_KEY = "Generated key: ";
//criteria
@@ -52,9 +46,8 @@ public class RequestTunables {
private String sdncaNotificationUrl = null;
- public RequestTunables(String reqId, String msoAction, String operation, String action, MsoPropertiesFactory msoPropFactory) {
+ public RequestTunables(String reqId, String msoAction, String operation, String action) {
super();
- msoPropertiesFactory = msoPropFactory;
if (reqId != null) {
this.reqId = reqId;
}
@@ -68,6 +61,20 @@ public class RequestTunables {
this.action = action;
}
}
+
+ public RequestTunables(RequestTunables original) {
+ this.reqId = original.reqId;
+ this.action = original.action;
+ this.msoAction = original.msoAction;
+ this.operation = original.operation;
+ this.reqMethod = original.reqMethod;
+ this.sdncUrl = original.sdncUrl;
+ this.timeout = original.timeout;
+ this.headerName = original.headerName;
+ this.namespace = original.namespace;
+ this.asyncInd = original.asyncInd;
+ this.sdncaNotificationUrl = original.sdncaNotificationUrl;
+ }
public String getReqId() {
return reqId;
@@ -150,74 +157,5 @@ public class RequestTunables {
+ ", sdncaNotificationUrl=" + sdncaNotificationUrl
+ ", namespace=" + namespace + "]";
}
-
- public void setTunables()
- {
- String error = null;
- String key;
- if ("query".equals(action)) { //due to variable format for operation eg services/layer3-service-list/8fe4ba4f-35cf-4d9b-a04a-fd3f5d4c5cc9
- key = Constants.REQUEST_TUNABLES + "." + msoAction + ".." + action;
- msoLogger.debug(GENERATED_KEY + key);
- }
- else if ("put".equals(action) || "restdelete".equals(action)) { //due to variable format for operation eg services/layer3-service-list/8fe4ba4f-35cf-4d9b-a04a-fd3f5d4c5cc9
- key = Constants.REQUEST_TUNABLES + "..." + action;
- msoLogger.debug(GENERATED_KEY + key);
- } else {
- key = Constants.REQUEST_TUNABLES + "." + msoAction + "." + operation +"." + action;
- msoLogger.debug(GENERATED_KEY + key);
- }
-
- String value;
- try {
- value = msoPropertiesFactory.getMsoJavaProperties(MSO_PROP_SDNC_ADAPTER).getProperty(key, "");
- } catch (MsoPropertiesException e) {
- msoLogger.error (MessageEnum.LOAD_PROPERTIES_FAIL, "Unknown. Mso Properties ID not found in cache: " + MSO_PROP_SDNC_ADAPTER, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e);
- value="";
- }
-
- if (value != null && value.length() > 0) {
-
- String[] parts = value.split("\\|"); //escape pipe
- if (parts.length < 3) {
- msoLogger.warn(MessageEnum.RA_SDNC_INVALID_CONFIG, key, value, "SDNC", "", MsoLogger.ErrorCode.DataError, "Invalid config");
- }
-
- for (int i = 0; i < parts.length; i++) {
- if (i == 0) {
- reqMethod = parts[i];
- msoLogger.debug("Request Method is set to: " + reqMethod);
- } else if (i == 1) {
- timeout = parts[i];
- msoLogger.debug("Timeout is set to: " + timeout);
- } else if (i == 2) {
- sdncUrl = SDNCAdapterPortTypeImpl.getProperty(Constants.REQUEST_TUNABLES + "." + parts[i], "",msoPropertiesFactory);
- if (operation != null && sdncUrl != null) {
- sdncUrl = sdncUrl + operation;
- }
- msoLogger.debug("SDNC Url is set to: " + sdncUrl);
- } else if (i == 3) {
- headerName = parts[i];
- msoLogger.debug("HeaderName is set to: " + headerName);
- } else if (i == 4) {
- namespace = parts[i];
- msoLogger.debug("NameSpace is set to: " + namespace);
- } else if (i == 5) {
- asyncInd = parts[i];
- msoLogger.debug("AsyncInd is set to: " + asyncInd);
- }
- }
-
- if (sdncUrl == null) {
- error = "Invalid configuration, sdncUrl required for:" + key + " value:" + value;
- }
- } else {
- error = "Missing configuration for:" + key;
- }
- if (error != null) {
- msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, key, "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param");
- alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
- }
- msoLogger.debug ("RequestTunables Key:" + key + " Value:" + value + " Tunables:" + this.toString());
- return;
- }
+
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
new file mode 100644
index 0000000000..8000e3ab8e
--- /dev/null
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
@@ -0,0 +1,84 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.sdnc.impl;
+
+import javax.annotation.PostConstruct;
+import javax.jws.WebService;
+import javax.servlet.http.HttpServletResponse;
+
+import org.onap.so.adapters.sdnc.SDNCAdapterPortType;
+import org.onap.so.adapters.sdnc.SDNCAdapterRequest;
+import org.onap.so.adapters.sdnc.SDNCAdapterResponse;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoAlarmLogger;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+
+//BPEL SDNCAdapter SOAP Web Service implementation
+@WebService(serviceName = "SDNCAdapterService", endpointInterface = "org.onap.so.adapters.sdnc.SDNCAdapterPortType", targetNamespace = "http://org.onap/workflow/sdnc/adapter/wsdl/v1")
+@Component
+public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType {
+
+
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCAdapterPortTypeImpl.class);
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
+
+ @Autowired
+ private SDNCRestClient sdncClient;
+
+ @PostConstruct
+ public void init () {
+ msoLogger.info(MessageEnum.RA_INIT_SDNC_ADAPTER, "SDNC", "SDNCAdapterPortType", "");
+ }
+
+ /**
+ * Health Check web method. Does nothing but return to show the adapter is deployed.
+ */
+ @Override
+ public void healthCheck ()
+ {
+ msoLogger.debug("Health check call in SDNC Adapter");
+ }
+
+
+ @Override
+ public SDNCAdapterResponse sdncAdapter(SDNCAdapterRequest bpelRequest) {
+ String bpelReqId = bpelRequest.getRequestHeader().getRequestId();
+ String callbackUrl = bpelRequest.getRequestHeader().getCallbackUrl();
+ try {
+ sdncClient.executeRequest(bpelRequest);
+ }
+ catch (Exception e){
+ String respMsg = "Error sending request to SDNC. Failed to start SDNC Client thread " + e.getMessage();
+ msoLogger.error(MessageEnum.RA_SEND_REQUEST_SDNC_ERR, "SDNC", "", MsoLogger.ErrorCode.DataError, respMsg, e);
+ alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, respMsg);
+ SDNCResponse sdncResp = new SDNCResponse(bpelReqId);
+ sdncResp.setRespCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+ sdncResp.setRespMsg(respMsg);
+ sdncClient.sendRespToBpel(callbackUrl, sdncResp);
+ }
+
+ SDNCAdapterResponse wsResp = new SDNCAdapterResponse();
+ return wsResp;
+ }
+}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCResponse.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCResponse.java
index 9bd850a3b4..c0a737cf78 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCResponse.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCResponse.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.sdnc.impl;
+package org.onap.so.adapters.sdnc.impl;
import java.io.Serializable;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
index 55a2156c50..58feaac0e7 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCRestClient.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/SDNCRestClient.java
@@ -19,7 +19,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.sdnc.impl;
+package org.onap.so.adapters.sdnc.impl;
import java.io.BufferedReader;
@@ -43,98 +43,82 @@ import javax.xml.ws.handler.MessageContext;
import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory;
-
+import org.onap.so.utils.CryptoUtils;
+import org.onap.so.adapters.sdnc.SDNCAdapterRequest;
+import org.onap.so.adapters.sdnc.client.CallbackHeader;
+import org.onap.so.adapters.sdnc.client.SDNCAdapterCallbackRequest;
+import org.onap.so.adapters.sdnc.client.SDNCCallbackAdapterPortType;
+import org.onap.so.adapters.sdnc.client.SDNCCallbackAdapterService;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoAlarmLogger;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Component;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-import org.openecomp.mso.adapters.sdnc.SDNCAdapterRequest;
-import org.openecomp.mso.adapters.sdnc.client.CallbackHeader;
-import org.openecomp.mso.adapters.sdnc.client.SDNCAdapterCallbackRequest;
-import org.openecomp.mso.adapters.sdnc.client.SDNCCallbackAdapterPortType;
-import org.openecomp.mso.adapters.sdnc.client.SDNCCallbackAdapterService;
-import org.openecomp.mso.adapters.sdnc.util.SDNCRequestIdUtil;
-import org.openecomp.mso.logger.MsoAlarmLogger;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-
-//SDNCAdapter to SDNC Rest Client
-public class SDNCRestClient implements Runnable {
-
- private MsoPropertiesFactory msoPropertiesFactory;
-
- private SDNCAdapterRequest bpelRequest;
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
- private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
- public static final String MSO_PROP_SDNC_ADAPTER="MSO_PROP_SDNC_ADAPTER";
+@Component
+public class SDNCRestClient{
- public SDNCRestClient(SDNCAdapterRequest bpelRequest,MsoPropertiesFactory msoPropFactory) {
- this.bpelRequest = bpelRequest;
- msoPropertiesFactory = msoPropFactory;
- }
+ @Autowired
+ private Environment env;
+
+ @Autowired
+ private MapRequestTunables tunablesMapper;
- @Override
- public void run()
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCRestClient.class);
+ private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
+
+ @Async
+ public void executeRequest(SDNCAdapterRequest bpelRequest)
{
+
+ msoLogger.debug("BPEL Request:" + bpelRequest.toString());
String action = bpelRequest.getRequestHeader().getSvcAction();
String operation = bpelRequest.getRequestHeader().getSvcOperation();
String bpelReqId = bpelRequest.getRequestHeader().getRequestId();
String callbackUrl = bpelRequest.getRequestHeader().getCallbackUrl();
- MsoLogger.setLogContext(SDNCRequestIdUtil.getSDNCOriginalRequestId (bpelReqId), bpelRequest.getRequestHeader().getSvcInstanceId());
- MsoLogger.setServiceName("SDNCRestClient");
String sdncReqBody = null;
- msoLogger.debug("BPEL Request:" + bpelRequest.toString());
+
RequestTunables rt = new RequestTunables(bpelReqId,
bpelRequest.getRequestHeader().getMsoAction(),
bpelRequest.getRequestHeader().getSvcOperation(),
- bpelRequest.getRequestHeader().getSvcAction(),msoPropertiesFactory);
- rt.setTunables();
- rt.setSdncaNotificationUrl(SDNCAdapterPortTypeImpl.getProperty(Constants.MY_URL_PROP, Constants.DEFAULT_MY_URL,msoPropertiesFactory));
+ bpelRequest.getRequestHeader().getSvcAction());
+ rt = tunablesMapper.setTunables(rt);
+ rt.setSdncaNotificationUrl(env.getProperty(Constants.MY_URL_PROP));
if ("POST".equals(rt.getReqMethod()))
{
- /* TODO Hibernate
- try {
- RequestsDatabase.updateBpelUrl(bpelReqId, callbackUrl);
- }
- catch (Exception e1)
- {
- logger.error("Failed to update DB ActiveRequests with SDNC_CALLBACK_BPEL_URL. Default CallbackUrl will be used for SDNC async notifications", e1);
- }
- */
-
Node node = (Node) bpelRequest.getRequestData();
Document reqDoc = node.getOwnerDocument();
sdncReqBody = Utils.genSdncReq(reqDoc, rt);
-
}
- //should be more generic if we do RPC then we add the input tags etc, if it is pure REST this is not needed
else if("PUT".equals(rt.getReqMethod())){
Node node = (Node) bpelRequest.getRequestData();
Document reqDoc = node.getOwnerDocument();
sdncReqBody = Utils.genSdncPutReq(reqDoc, rt);
}
long sdncStartTime = System.currentTimeMillis();
- SDNCResponse sdncResp = getSdncResp(sdncReqBody, rt, msoPropertiesFactory);
+ SDNCResponse sdncResp = getSdncResp(sdncReqBody, rt);
msoLogger.recordMetricEvent (sdncStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from SDNC", "SDNC", action + "." + operation, null);
-
msoLogger.debug ("Got the SDNC Response: " + sdncResp.getSdncRespXml());
- msoLogger.debug("Sending reponse to bpel from SDNC rest client");
long bpelStartTime = System.currentTimeMillis();
- sendRespToBpel(callbackUrl, sdncResp,msoPropertiesFactory);
+ sendRespToBpel(callbackUrl, sdncResp);
msoLogger.recordMetricEvent (bpelStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully send reauest to BPEL", "BPMN", callbackUrl, null);
return;
}
- public static SDNCResponse getSdncResp(String sdncReqBody, RequestTunables rt, MsoPropertiesFactory msoPropertiesFactoryp)
+ public SDNCResponse getSdncResp(String sdncReqBody, RequestTunables rt)
{
URL url;
@@ -144,18 +128,18 @@ public class SDNCRestClient implements Runnable {
SDNCResponse sdncResp = new SDNCResponse(rt.getReqId());
StringBuilder response = new StringBuilder();
- msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC, rt.toString(), "SDNC", "");
- msoLogger.debug("SDNC Request Body:\n" + sdncReqBody);
+ msoLogger.info(MessageEnum.RA_SEND_REQUEST_SDNC.name() + ":\n" + rt.toString(), "SDNC", "");
+ msoLogger.trace("SDNC Request Body:\n" + sdncReqBody);
try {
url = new URL(rt.getSdncUrl());
con = (HttpURLConnection) url.openConnection();
- con.setConnectTimeout(Integer.parseInt(SDNCAdapterPortTypeImpl.getProperty(Constants.SDNC_CONNECTTIME_PROP, "2000",msoPropertiesFactoryp)));
+ con.setConnectTimeout(Integer.parseInt(env.getProperty(Constants.SDNC_CONNECTTIME_PROP)));
con.setReadTimeout(Integer.parseInt(rt.getTimeout()));
con.setRequestProperty("Accept", "application/yang.data+xml"); //for response in xml
- String userCredentials = msoPropertiesFactoryp.getMsoJavaProperties(MSO_PROP_SDNC_ADAPTER).getEncryptedProperty(Constants.SDNC_AUTH_PROP, Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY);
+ String userCredentials = CryptoUtils.decryptProperty(env.getProperty(Constants.SDNC_AUTH_PROP), Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY);
String basicAuth = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes());
con.setRequestProperty ("Authorization", basicAuth);
@@ -188,7 +172,7 @@ public class SDNCRestClient implements Runnable {
}
sdncResp.setSdncRespXml(response.toString());
- msoLogger.info(MessageEnum.RA_RESPONSE_FROM_SDNC, sdncResp.toString(), "SDNC", "");
+ msoLogger.info(MessageEnum.RA_RESPONSE_FROM_SDNC.name() + ":\n" + sdncResp.toString(), "SDNC", "");
return(sdncResp);
}
catch (Exception e)
@@ -217,6 +201,8 @@ public class SDNCRestClient implements Runnable {
XPath xpath = xpathFactory.newXPath();
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setFeature (XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ dbf.setFeature("http://xml.org/sax/features/external-general-entities", false);
+ dbf.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
DocumentBuilder db;
Document doc = null;
try { //e2
@@ -278,7 +264,7 @@ public class SDNCRestClient implements Runnable {
}
}
- public static void sendRespToBpel(String bpelUrl, SDNCResponse sdncResp,MsoPropertiesFactory msoPropertiesFactoryp)
+ public void sendRespToBpel(String bpelUrl, SDNCResponse sdncResp)
{
String error;
try
@@ -289,7 +275,7 @@ public class SDNCRestClient implements Runnable {
{
cbReq.setRequestData(sdncResp.getSdncRespXml());
}
- msoLogger.info(MessageEnum.RA_CALLBACK_BPEL, cbReq.toString(), "Camunda", "");
+ msoLogger.info(MessageEnum.RA_CALLBACK_BPEL.name() + ":\n" + cbReq.toString(), "Camunda", "");
URL wsdlUrl = null;
try {
@@ -318,7 +304,7 @@ public class SDNCRestClient implements Runnable {
{
Map<String, Object> reqCtx = bp.getRequestContext();
Map<String, List<String>> headers = new HashMap<>();
- String userCredentials = msoPropertiesFactoryp.getMsoJavaProperties(MSO_PROP_SDNC_ADAPTER).getEncryptedProperty(Constants.BPEL_AUTH_PROP, Constants.DEFAULT_BPEL_AUTH, Constants.ENCRYPTION_KEY);
+ String userCredentials = CryptoUtils.decryptProperty(env.getProperty(Constants.BPEL_AUTH_PROP), Constants.DEFAULT_BPEL_AUTH, Constants.ENCRYPTION_KEY);
String basicAuth = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes());
reqCtx.put(MessageContext.HTTP_REQUEST_HEADERS, headers);
@@ -337,10 +323,10 @@ public class SDNCRestClient implements Runnable {
catch (Exception e)
{
error = "Error sending BpelCallback request" + e.getMessage();
- msoLogger.error(MessageEnum.RA_CALLBACK_BPEL_EXC, "Camunda", "", MsoLogger.ErrorCode.BusinessProcesssError, "Exception sending BpelCallback request", e);
+ msoLogger.error("Error " + MsoLogger.ErrorCode.BusinessProcesssError + " - " + MessageEnum.RA_CALLBACK_BPEL_EXC + " - " + error, e);
alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
}
- msoLogger.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE, "Camunda", "");
+ msoLogger.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE.name(), "Camunda", "");
return;
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Utils.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java
index 6ab9ade143..55af0d7cad 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/Utils.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/impl/Utils.java
@@ -18,11 +18,12 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.sdnc.impl;
+package org.onap.so.adapters.sdnc.impl;
import java.io.StringWriter;
+import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.Transformer;
@@ -30,16 +31,15 @@ import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
-
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.logger.MessageEnum;
public class Utils {
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, Utils.class);
private Utils() {
}
@@ -116,8 +116,7 @@ public class Utils {
//RequestData
NodeList nodes = reqDoc.getDocumentElement().getChildNodes();
-
- Element root = newdoc.createElement(nodes.item(0).getNodeName());
+ Element root = newdoc.createElementNS(nodes.item(0).getNamespaceURI(), nodes.item(0).getNodeName());
newdoc.appendChild(root);
NodeList childNodes = nodes.item(0).getChildNodes();
@@ -181,6 +180,8 @@ public class Utils {
StringWriter sw = new StringWriter();
StreamResult sr = new StreamResult(sw);
TransformerFactory tf = TransformerFactory.newInstance();
+ tf.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD, "");
+ tf.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET, "");
Transformer t = tf.newTransformer();
//t.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "yes");//<?xml version="1.0" encoding="UTF-8"?>
t.transform(ds, sr);
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/package-info.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/package-info.java
index 614bdbb18c..bd1f34eadd 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/client/package-info.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/package-info.java
@@ -18,6 +18,6 @@
* ============LICENSE_END=========================================================
*/
-@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.openecomp/workflow/sdnc/adapter/schema/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
-package org.openecomp.mso.adapters.sdnc.client;
+@javax.xml.bind.annotation.XmlSchema(namespace = "http://org.onap/workflow/sdnc/adapter/schema/v1", elementFormDefault = javax.xml.bind.annotation.XmlNsForm.QUALIFIED)
+package org.onap.so.adapters.sdnc;
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallback.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
index f6708a2586..576d7846cd 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/BPRestCallback.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/BPRestCallback.java
@@ -8,9 +8,9 @@
* 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.
@@ -18,12 +18,11 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.sdnc.sdncrest;
-import org.openecomp.mso.adapters.sdnc.impl.Constants;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoAlarmLogger;
-import org.openecomp.mso.logger.MsoLogger;
+package org.onap.so.adapters.sdnc.sdncrest;
+
+import javax.xml.bind.DatatypeConverter;
+
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
@@ -32,15 +31,25 @@ import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
-
-import javax.xml.bind.DatatypeConverter;
+import org.onap.so.adapters.sdnc.impl.Constants;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoAlarmLogger;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.onap.so.utils.CryptoUtils;
+import org.springframework.core.env.Environment;
/**
* Sends asynchronous messages to the BPMN WorkflowMessage service.
*/
+@Component
public class BPRestCallback {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,BPRestCallback.class);
private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger();
+
+ @Autowired
+ private Environment env;
/**
* Sends a message to the BPMN workflow message service. The URL path is
@@ -87,8 +96,7 @@ public class BPRestCallback {
HttpPost method = null;
HttpResponse httpResponse = null;
- try {
- // TODO: configurable timeout?
+ try {
int timeout = 60 * 1000;
RequestConfig requestConfig = RequestConfig.custom()
@@ -107,11 +115,8 @@ public class BPRestCallback {
boolean error = false;
- try {
- // AAF Integration, disabled for now due to the constrains from other party
- // String userCredentials = CredentialConstants.getDecryptedCredential(Constants.DEFAULT_BPEL_AUTH);
- // Once AAF enabled, the credential shall be get by triggering the CredentialConstants.getDecryptedCredential -- remove line
- String userCredentials = SDNCAdapterProperties.getEncryptedProperty(Constants.BPEL_AUTH_PROP,
+ try {
+ String userCredentials = CryptoUtils.decryptProperty(env.getProperty(Constants.BPEL_AUTH_PROP),
Constants.DEFAULT_BPEL_AUTH, Constants.ENCRYPTION_KEY);
String authorization = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes());
method.setHeader("Authorization", authorization);
@@ -163,8 +168,7 @@ public class BPRestCallback {
LOGGER.debug("Exception:", e);
}
}
-
- LOGGER.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE, "Camunda", "");
+ LOGGER.info(MessageEnum.RA_CALLBACK_BPEL_COMPLETE, "Camunda", "","");
}
}
} \ No newline at end of file
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
new file mode 100644
index 0000000000..8541889d8e
--- /dev/null
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/MapTypedRequestTunablesData.java
@@ -0,0 +1,109 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.sdnc.sdncrest;
+
+import org.onap.so.adapters.sdnc.exception.SDNCAdapterException;
+import org.onap.so.adapters.sdnc.impl.Constants;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoAlarmLogger;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
+@Component
+public class MapTypedRequestTunablesData {
+
+ private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,MapTypedRequestTunablesData.class);
+
+ private static final MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
+
+ @Autowired
+ private Environment env;
+
+
+ public TypedRequestTunables setTunables(TypedRequestTunables reqTunableOriginal) throws SDNCAdapterException {
+ TypedRequestTunables reqTunable = new TypedRequestTunables(reqTunableOriginal);
+
+ String error;
+ String value = env.getProperty(reqTunable.getKey().toLowerCase(), "");
+
+ if ("".equals(value)) {
+ error= "Missing configuration for: " + reqTunable.getKey();
+ msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, reqTunable.getKey(), "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param");
+ alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, reqTunable.getError());
+ throw new SDNCAdapterException(error);
+ }
+
+ String[] parts = value.split("\\|");
+
+ if (parts.length != 5) {
+ error="Invalid configuration for: " + reqTunable.getKey();
+ msoLogger.error(MessageEnum.RA_SDNC_INVALID_CONFIG, reqTunable.getKey(), value, "SDNC", "", MsoLogger.ErrorCode.DataError, "Invalid config");
+ alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, reqTunable.getError());
+ throw new SDNCAdapterException(error);
+ }
+
+ reqTunable.setReqMethod(parts[0]);
+ msoLogger.trace("Request Method is set to: " + reqTunable.getReqMethod());
+
+ reqTunable.setTimeout(parts[1]);
+ msoLogger.trace("Timeout is set to: " + reqTunable.getTimeout());
+
+ String urlPropKey = Constants.REQUEST_TUNABLES + "." + parts[2];
+ reqTunable.setSdncUrl(env.getProperty(urlPropKey, ""));
+
+ if ("".equals(reqTunable.getSdncUrl())) {
+ error="Missing configuration for: " + urlPropKey;
+ msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, urlPropKey, "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param");
+ alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, reqTunable.getError());
+ throw new SDNCAdapterException(error);
+ }
+
+ msoLogger.trace("SDNC Url is set to: " + reqTunable.getSdncUrl());
+
+ reqTunable.setHeaderName(parts[3]);
+ msoLogger.trace("Header Name is set to: " + reqTunable.getHeaderName());
+
+ reqTunable.setNamespace(parts[4]);
+ msoLogger.trace("Namespace is set to: " + reqTunable.getNamespace());
+
+ reqTunable.setMyUrl(env.getProperty(Constants.MY_URL_PROP, ""));
+
+ if ("".equals(reqTunable.getMyUrl())) {
+ error="Missing configuration for: " + Constants.MY_URL_PROP;
+ msoLogger.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.MY_URL_PROP, "SDNC", "",
+ MsoLogger.ErrorCode.DataError, "Missing config param");
+ alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, reqTunable.getError());
+ throw new SDNCAdapterException(error);
+ }
+
+ while (reqTunable.getMyUrl().endsWith("/")) {
+ reqTunable.setMyUrl(reqTunable.getMyUrl().substring(0, reqTunable.getMyUrl().length()-1));
+ }
+
+ reqTunable.setMyUrl(reqTunable.getMyUrl().concat(reqTunable.getMyUrlSuffix()));
+
+ msoLogger.debug(reqTunable.toString());
+ return reqTunable;
+ }
+
+}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterUtils.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCAdapterUtils.java
index 893ff82f11..05e272f867 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterUtils.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCAdapterUtils.java
@@ -8,9 +8,9 @@
* 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.
@@ -18,23 +18,24 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.sdnc.sdncrest;
-import org.springframework.web.util.UriUtils;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
+package org.onap.so.adapters.sdnc.sdncrest;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.List;
-import org.openecomp.mso.logger.MsoLogger;
+
+import org.onap.so.logger.MsoLogger;
+import org.springframework.web.util.UriUtils;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
/**
* Utility methods used by SDNCAdapterRest.
*/
public final class SDNCAdapterUtils {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA, SDNCAdapterUtils.class);
/**
* Instantiation is not allowed.
*/
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
index fa257164cf..6bd7037ca1 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCConnector.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCConnector.java
@@ -8,9 +8,9 @@
* 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.
@@ -18,48 +18,62 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.sdnc.sdncrest;
-
-import org.openecomp.mso.adapters.sdnc.impl.Constants;
-import org.openecomp.mso.adapters.sdncrest.SDNCErrorCommon;
-import org.openecomp.mso.adapters.sdncrest.SDNCResponseCommon;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoAlarmLogger;
-import org.openecomp.mso.logger.MsoLogger;
+
+package org.onap.so.adapters.sdnc.sdncrest;
+
+import java.io.StringReader;
+import java.net.HttpURLConnection;
+import java.net.SocketTimeoutException;
+
+import javax.xml.XMLConstants;
+import javax.xml.bind.DatatypeConverter;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.config.RequestConfig;
-import org.apache.http.client.methods.*;
+import org.apache.http.client.methods.HttpDelete;
+import org.apache.http.client.methods.HttpGet;
+import org.apache.http.client.methods.HttpPost;
+import org.apache.http.client.methods.HttpPut;
+import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.conn.ConnectTimeoutException;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
+import org.onap.so.adapters.sdnc.impl.Constants;
+import org.onap.so.adapters.sdncrest.SDNCErrorCommon;
+import org.onap.so.adapters.sdncrest.SDNCResponseCommon;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoAlarmLogger;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
-
-import javax.xml.XMLConstants;
-import javax.xml.bind.DatatypeConverter;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathExpressionException;
-import javax.xml.xpath.XPathFactory;
-import java.io.StringReader;
-import java.net.HttpURLConnection;
-import java.net.SocketTimeoutException;
+import org.onap.so.utils.CryptoUtils;
+import org.springframework.core.env.Environment;
/**
* Sends requests to SDNC and processes the responses.
*/
+@Component
public abstract class SDNCConnector {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCConnector.class);
private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger();
+
+ @Autowired
+ private Environment env;
public SDNCResponseCommon send(String content, TypedRequestTunables rt) {
- LOGGER.info(MessageEnum.RA_SEND_REQUEST_SDNC, rt.toString(), "SDNC", "");
+ LOGGER.debug("SDNC URL: " + rt.getSdncUrl());
LOGGER.debug("SDNC Request Body:\n" + content);
HttpRequestBase method = null;
@@ -96,13 +110,9 @@ public abstract class SDNCConnector {
method = httpDelete;
}
- // AAF Integration, disabled for now due to the constrains from other party
- // String userCredentials = CredentialConstants.getSecurityProperties().getEncryptedProperty(CredentialConstants.DEFAULT_AUTH, "", CredentialConstants.getEncryptionKey());
- // if (userCredentials == null) {
- // userCredentials = "";
- //}
- String userCredentials = SDNCAdapterProperties.getEncryptedProperty(Constants.SDNC_AUTH_PROP,
- Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY);
+
+ String userCredentials = CryptoUtils.decryptProperty(env.getProperty(Constants.SDNC_AUTH_PROP),
+ Constants.DEFAULT_SDNC_AUTH, Constants.ENCRYPTION_KEY);
String authorization = "Basic " + DatatypeConverter.printBase64Binary(userCredentials.getBytes());
if(null != method) {
method.setHeader("Authorization", authorization);
@@ -259,6 +269,8 @@ public abstract class SDNCConnector {
XPath xpath = xpathFactory.newXPath();
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ documentBuilderFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
+ documentBuilderFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
InputSource source = new InputSource(new StringReader(content));
Document doc = documentBuilderFactory.newDocumentBuilder().parse(source);
NodeList errors = (NodeList) xpath.evaluate("errors/error", doc, XPathConstants.NODESET);
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java
index 10175d83b5..2fd39df4e9 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestConnector.java
@@ -8,9 +8,9 @@
* 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.
@@ -18,38 +18,49 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.sdnc.sdncrest;
-import org.openecomp.mso.adapters.sdncrest.SDNCErrorCommon;
-import org.openecomp.mso.adapters.sdncrest.SDNCResponseCommon;
-import org.openecomp.mso.adapters.sdncrest.SDNCServiceError;
-import org.openecomp.mso.adapters.sdncrest.SDNCServiceResponse;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.InputSource;
+package org.onap.so.adapters.sdnc.sdncrest;
-import javax.xml.XMLConstants;
-import javax.xml.parsers.DocumentBuilderFactory;
+import java.io.IOException;
import java.io.StringReader;
import java.net.HttpURLConnection;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
-import org.openecomp.mso.logger.MsoLogger;
+
+import javax.xml.XMLConstants;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.onap.so.adapters.sdncrest.SDNCErrorCommon;
+import org.onap.so.adapters.sdncrest.SDNCResponseCommon;
+import org.onap.so.adapters.sdncrest.SDNCServiceError;
+import org.onap.so.adapters.sdncrest.SDNCServiceResponse;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.stereotype.Component;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
/**
* SDNCConnector for "agnostic" API services.
*/
+
+@Component
public class SDNCServiceRequestConnector extends SDNCConnector {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA,SDNCServiceRequestConnector.class);
@Override
protected SDNCResponseCommon createResponseFromContent(int statusCode, String statusMessage,
String responseContent, TypedRequestTunables rt) {
try {
return parseResponseContent(responseContent);
} catch (ParseException e) {
- logError(e.getMessage());
+ LOGGER.error(e);
+ return createErrorResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, e.getMessage(), rt);
+ }catch (Exception e) {
+ LOGGER.error(e);
return createErrorResponse(HttpURLConnection.HTTP_INTERNAL_ERROR, e.getMessage(), rt);
}
}
@@ -71,11 +82,13 @@ public class SDNCServiceRequestConnector extends SDNCConnector {
* @throws ParseException on error
*/
public static SDNCResponseCommon parseResponseContent(String responseContent)
- throws ParseException {
- try {
+ throws ParseException,ParserConfigurationException, SAXException, IOException{
+
// Note: this document builder is not namespace-aware, so namespaces are ignored.
DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+ documentBuilderFactory.setFeature("http://xml.org/sax/features/external-general-entities", false);
+ documentBuilderFactory.setFeature("http://xml.org/sax/features/external-parameter-entities", false);
InputSource source = new InputSource(new StringReader(responseContent));
Document doc = documentBuilderFactory.newDocumentBuilder().parse(source);
@@ -189,11 +202,6 @@ public class SDNCServiceRequestConnector extends SDNCConnector {
}
return response;
- } catch (ParseException e) {
- throw e;
- } catch (Exception e) {
- LOGGER.debug("Exception:", e);
- throw new ParseException("Failed to parse SDNC response", 0);
- }
+
}
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
index f3ae6d62f7..270b1bd99c 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SDNCServiceRequestTask.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,18 +17,12 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.sdnc.sdncrest;
-
-import org.openecomp.mso.adapters.sdncrest.SDNCErrorCommon;
-import org.openecomp.mso.adapters.sdncrest.SDNCResponseCommon;
-import org.openecomp.mso.adapters.sdncrest.SDNCServiceError;
-import org.openecomp.mso.adapters.sdncrest.SDNCServiceRequest;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.apache.http.HttpStatus;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
+package org.onap.so.adapters.sdnc.sdncrest;
+
+import java.io.StringWriter;
+
+import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.transform.OutputKeys;
@@ -36,55 +30,60 @@ import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
-import java.io.StringWriter;
-public class SDNCServiceRequestTask implements Runnable {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
-
- private final SDNCServiceRequest request;
- private final String msoRequestId;
- private final String msoServiceInstanceId;
- private final String myUrlSuffix;
-
- public SDNCServiceRequestTask(SDNCServiceRequest request,
- String msoRequestId, String msoServiceInstanceId,
- String myUrlSuffix) {
- this.request = request;
- this.msoRequestId = msoRequestId;
- this.msoServiceInstanceId = msoServiceInstanceId;
- this.myUrlSuffix = myUrlSuffix;
- }
+import org.apache.http.HttpStatus;
+import org.onap.so.adapters.sdnc.exception.SDNCAdapterException;
+import org.onap.so.adapters.sdncrest.RequestInformation;
+import org.onap.so.adapters.sdncrest.SDNCErrorCommon;
+import org.onap.so.adapters.sdncrest.SDNCResponseCommon;
+import org.onap.so.adapters.sdncrest.SDNCServiceError;
+import org.onap.so.adapters.sdncrest.SDNCServiceRequest;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.scheduling.annotation.Async;
+import org.springframework.stereotype.Component;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
- @Override
- public void run()
+@Component
+public class SDNCServiceRequestTask {
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SDNCServiceRequestTask.class);
+
+ @Autowired
+ private SDNCServiceRequestConnector connector;
+
+ @Autowired
+ MapTypedRequestTunablesData mapTunables;
+
+ @Autowired
+ private BPRestCallback bpRestCallback;
+
+ @Async
+ public void runRequest(SDNCServiceRequest request,String msoRequestId,String msoServiceInstanceId,String myUrlSuffix) throws SDNCAdapterException
{
MsoLogger.setLogContext(msoRequestId, msoServiceInstanceId);
MsoLogger.setServiceName(getClass().getSimpleName());
- LOGGER.debug(getClass().getSimpleName() + ".run()"
- + " entered with request: " + request.toJson());
-
- String sdncRequestId = request.getSDNCRequestId();
- String sdncService = request.getSDNCService();
- String sdncOperation = request.getSDNCOperation();
+ String sdncRequestId = request.getSdncRequestId();
+ String sdncService = request.getSdncService();
+ String sdncOperation = request.getSdncOperation();
TypedRequestTunables rt = new TypedRequestTunables(sdncRequestId, myUrlSuffix);
rt.setServiceKey(sdncService, sdncOperation);
-
- if (!rt.setTunables()) {
+ TypedRequestTunables mappedTunables = mapTunables.setTunables(rt);
+ if (!mappedTunables.getError().isEmpty()) {
// Note that the error was logged and alarmed by setTunables()
- SDNCServiceError error = new SDNCServiceError(request.getSDNCRequestId(),
- String.valueOf(HttpStatus.SC_INTERNAL_SERVER_ERROR), rt.getError(), "Y");
- BPRestCallback callback = new BPRestCallback();
- callback.send(request.getBPNotificationUrl(), error.toJson());
+ SDNCServiceError error = new SDNCServiceError(request.getSdncRequestId(),
+ String.valueOf(HttpStatus.SC_INTERNAL_SERVER_ERROR), mappedTunables.getError(), "Y");
+ bpRestCallback.send(request.getBPNotificationUrl(), error.toJson());
return;
}
- String xml = genSdncReq(request, rt);
+ String xml = genSdncReq(request, mappedTunables);
- long sdncStartTime = System.currentTimeMillis();
- SDNCConnector connector = new SDNCServiceRequestConnector();
- SDNCResponseCommon response = connector.send(xml, rt);
+ long sdncStartTime = System.currentTimeMillis();
+ SDNCResponseCommon response = connector.send(xml, mappedTunables);
if (response instanceof SDNCErrorCommon) {
LOGGER.recordMetricEvent(sdncStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
@@ -95,8 +94,7 @@ public class SDNCServiceRequestTask implements Runnable {
}
long bpStartTime = System.currentTimeMillis();
- BPRestCallback callback = new BPRestCallback();
- boolean callbackSuccess = callback.send(request.getBPNotificationUrl(), response.toJson());
+ boolean callbackSuccess = bpRestCallback.send(request.getBPNotificationUrl(), response.toJson());
if (callbackSuccess) {
LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
@@ -136,18 +134,34 @@ public class SDNCServiceRequestTask implements Runnable {
addTextChild(hdr, "svc-request-id", rt.getReqId());
addTextChild(hdr, "svc-notification-url", rt.getMyUrl());
+ RequestInformation requestInfo = request.getRequestInformation();
Element requestInformation = addChild(root, "request-information");
- addTextChild(requestInformation, "request-id", request.getRequestInformation().getRequestId());
- if(request.getRequestInformation().getRequestAction()!= null) {
+ addTextChild(requestInformation, "request-id", requestInfo.getRequestId());
+
+
+ if(requestInfo.getRequestAction()!= null) {
addTextChild(requestInformation, "request-action",
- request.getRequestInformation().getRequestAction());
+ requestInfo.getRequestAction());
}
- if(request.getRequestInformation().getRequestSubAction()!= null) {
+ if(requestInfo.getRequestSubAction()!= null) {
addTextChild(requestInformation, "request-sub-action",
- request.getRequestInformation().getRequestSubAction());
+ requestInfo.getRequestSubAction());
+ }
+ if(requestInfo.getOrderNumber() != null &&
+ !requestInfo.getOrderNumber().isEmpty() ) {
+ addTextChild(requestInformation, "order-number",
+ requestInfo.getOrderNumber());
+ }
+
+ if(requestInfo.getOrderVersion() != null &&
+ !requestInfo.getOrderVersion().isEmpty() ) {
+ addTextChild(requestInformation, "order-version",
+ requestInfo.getOrderVersion());
}
- addTextChild(requestInformation, "source", request.getRequestInformation().getSource());
- addTextChild(requestInformation, "notification-url", request.getRequestInformation().getNotificationUrl());
+
+
+ addTextChild(requestInformation, "source", requestInfo.getSource());
+ addTextChild(requestInformation, "notification-url", requestInfo.getNotificationUrl());
Element serviceInformation = addChild(root, "service-information");
addTextChild(serviceInformation, "service-type", request.getServiceInformation().getServiceType());
@@ -156,20 +170,20 @@ public class SDNCServiceRequestTask implements Runnable {
addTextChild(serviceInformation, "subscriber-global-id", request.getServiceInformation().getSubscriberGlobalId());
Element agnosticServiceInformation = addChild(root, "agnostic-service-information");
- addTextChild(agnosticServiceInformation, "operation", request.getSDNCOperation());
- addTextChild(agnosticServiceInformation, "service", request.getSDNCService());
+ addTextChild(agnosticServiceInformation, "operation", request.getSdncOperation());
+ addTextChild(agnosticServiceInformation, "service", request.getSdncService());
// anydata is mandatory in the SDNC schema, so if the data we got is null,
// set use an empty string instead to ensure we generate an empty element.
- String anydata = request.getSDNCServiceData();
+ String anydata = request.getSdncServiceData();
if (anydata == null) {
anydata = "";
}
// content-type is also mandatory.
- String contentType = request.getSDNCServiceDataType();
+ String contentType = request.getSdncServiceDataType();
if (contentType == null || contentType.isEmpty()) {
if (anydata.isEmpty()) {
@@ -195,7 +209,10 @@ public class SDNCServiceRequestTask implements Runnable {
try {
StringWriter writer = new StringWriter();
- Transformer transformer = TransformerFactory.newInstance().newTransformer();
+ TransformerFactory factory = TransformerFactory.newInstance();
+ factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_DTD,"");
+ factory.setAttribute(XMLConstants.ACCESS_EXTERNAL_STYLESHEET,"");
+ Transformer transformer = factory.newTransformer();
transformer.setOutputProperty(OutputKeys.INDENT, "yes");
transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
transformer.setOutputProperty("{http://xml.apache.org/xslt}indent-amount", "2");
@@ -207,7 +224,7 @@ public class SDNCServiceRequestTask implements Runnable {
return null;
}
- LOGGER.debug("Formatted SDNC service request XML:\n" + xml);
+ LOGGER.trace("Formatted SDNC service request XML:\n" + xml);
return xml;
}
}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SNIROResponse.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
index aa17bac5c7..72a23282d9 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SNIROResponse.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/SNIROResponse.java
@@ -7,9 +7,9 @@
* 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.
@@ -17,27 +17,42 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.sdnc.sdncrest;
-import org.openecomp.mso.adapters.sdnc.impl.Constants;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoAlarmLogger;
-import org.openecomp.mso.logger.MsoLogger;
+package org.onap.so.adapters.sdnc.sdncrest;
import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.*;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
+import org.onap.so.adapters.sdnc.impl.Constants;
+import org.onap.so.logger.MessageEnum;
+import org.onap.so.logger.MsoAlarmLogger;
+import org.onap.so.logger.MsoLogger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.core.env.Environment;
+import org.springframework.stereotype.Component;
+
/**
* A temporary interface to support notifications from SNIRO to BPMN.
* We added this to the SDNC adapter because we didn't have time to
* develop a SNIRO adapter in 1702.
*/
@Path("/")
+@Component
public class SNIROResponse {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA,SNIROResponse.class);
private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger();
+
+ @Autowired
+ private Environment env;
+
+ @Autowired
+ private BPRestCallback callback;
@POST
@Path("/SDNCNotify/SNIROResponse/{correlator}")
@@ -48,9 +63,9 @@ public class SNIROResponse {
long startTime = System.currentTimeMillis();
- String bpUrl = SDNCAdapterProperties.getProperty(Constants.BPEL_REST_URL_PROP, null);
+ String bpUrl = env.getProperty(Constants.BPEL_REST_URL_PROP, "");
- if (bpUrl == null) {
+ if (bpUrl == null || bpUrl.equals("")) {
String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP;
LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.BPEL_REST_URL_PROP, "SDNC", "",
MsoLogger.ErrorCode.DataError, "Missing config param");
@@ -59,7 +74,6 @@ public class SNIROResponse {
}
long bpStartTime = System.currentTimeMillis();
- BPRestCallback callback = new BPRestCallback();
boolean callbackSuccess = callback.send(bpUrl, "SNIROResponse", correlator, content);
if (callbackSuccess) {
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/TypedRequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/TypedRequestTunables.java
new file mode 100644
index 0000000000..6331d6aaae
--- /dev/null
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/sdncrest/TypedRequestTunables.java
@@ -0,0 +1,180 @@
+/*-
+ * ============LICENSE_START=======================================================
+ * ONAP - SO
+ * ================================================================================
+ * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+
+package org.onap.so.adapters.sdnc.sdncrest;
+
+import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.onap.so.adapters.sdnc.impl.Constants;
+import org.onap.so.logger.MsoLogger;
+
+/**
+ * Typed Request Tunables. Each entry is identified by a TYPE in the property name.
+ * Different types can have different keys.
+ * <p>
+ * General format:
+ * <pre>
+ * org.onap.so.adapters.sdnc.TYPE.KEY1[.KEY2...]=METHOD|TIMEOUT|URL|HEADER|NAMESPACE
+ * </pre>
+ * Currently supported type(s): service
+ * <pre>
+ * org.onap.so.adapters.sdnc.service.SERVICE.OPERATION=METHOD|TIMEOUT|URL|HEADER|NAMESPACE
+ * </pre>
+ */
+public class TypedRequestTunables {
+
+ private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA, TypedRequestTunables.class);
+
+ private String reqId;
+ private String myUrlSuffix;
+ private String key = null;
+ private String error = "";
+
+ // tunables (all are required)
+ private String reqMethod = null;
+ private String timeout = null;
+ private String sdncUrl = null;
+ private String headerName = null;
+ private String namespace = null;
+ private String myUrl = null;
+
+ public TypedRequestTunables(TypedRequestTunables reqTunableOriginal) {
+ this.reqId = reqTunableOriginal.getReqId();
+ this.myUrlSuffix = reqTunableOriginal.getMyUrlSuffix();
+ this.key = reqTunableOriginal.getKey();
+ this.error = reqTunableOriginal.getError();
+ this.reqMethod = reqTunableOriginal.getReqMethod();
+ this.timeout = reqTunableOriginal.getTimeout();
+ this.sdncUrl = reqTunableOriginal.getSdncUrl();
+ this.headerName = reqTunableOriginal.getHeaderName();
+ this.namespace = reqTunableOriginal.getNamespace();
+ this.myUrl = reqTunableOriginal.getMyUrl();
+ }
+
+ public TypedRequestTunables(String reqId, String myUrlSuffix) {
+ this.reqId = reqId;
+ this.myUrlSuffix = myUrlSuffix;
+ }
+
+ /**
+ * Sets the key for a service request:
+ * <pre>
+ * org.onap.so.adapters.sdnc.service.SERVICE.OPERATION
+ * </pre>
+ * @param service the sdncService
+ * @param operation the sdncOperation
+ */
+ public void setServiceKey(String service, String operation) {
+ key = Constants.REQUEST_TUNABLES + ".service." + service + "." + operation;
+ LOGGER.debug("Generated " + getClass().getSimpleName() + " key: " + key);
+ }
+
+ /**
+ * Gets the SDNC request ID.
+ */
+ public String getReqId() {
+ return reqId;
+ }
+
+ /**
+ * Gets the generated key.
+ */
+ public String getKey() {
+ return key;
+ }
+
+ /**
+ * Gets the most recent error, or null if there was no error.
+ */
+ public String getError() {
+ return error;
+ }
+
+ public String getReqMethod() {
+ return reqMethod;
+ }
+
+ public String getTimeout() {
+ return timeout;
+ }
+
+ public String getSdncUrl() {
+ return sdncUrl;
+ }
+
+ public String getHeaderName() {
+ return headerName;
+ }
+
+ public String getNamespace() {
+ return namespace;
+ }
+
+ /**
+ * Gets the SDNC adapter notification URL, trimmed of trailing '/' characters.
+ */
+ public String getMyUrl() {
+ return myUrl;
+ }
+
+ public String getMyUrlSuffix() {
+ return myUrlSuffix;
+ }
+
+ public void setKey(String key) {
+ this.key = key;
+ }
+
+ public void setError(String error) {
+ this.error = error;
+ }
+
+ public void setReqMethod(String reqMethod) {
+ this.reqMethod = reqMethod;
+ }
+
+ public void setTimeout(String timeout) {
+ this.timeout = timeout;
+ }
+
+ public void setSdncUrl(String sdncUrl) {
+ this.sdncUrl = sdncUrl;
+ }
+
+ public void setHeaderName(String headerName) {
+ this.headerName = headerName;
+ }
+
+ public void setNamespace(String namespace) {
+ this.namespace = namespace;
+ }
+
+ public void setMyUrl(String myUrl) {
+ this.myUrl = myUrl;
+ }
+
+ @Override
+ public String toString() {
+ return new ToStringBuilder(this).append("reqId", reqId).append("myUrlSuffix", myUrlSuffix).append("key", key)
+ .append("error", error).append("reqMethod", reqMethod).append("timeout", timeout)
+ .append("sdncUrl", sdncUrl).append("headerName", headerName).append("namespace", namespace)
+ .append("myUrl", myUrl).toString();
+ }
+
+}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtil.java b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/util/SDNCRequestIdUtil.java
index f109b43ea2..991126f868 100644
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/util/SDNCRequestIdUtil.java
+++ b/adapters/mso-sdnc-adapter/src/main/java/org/onap/so/adapters/sdnc/util/SDNCRequestIdUtil.java
@@ -18,7 +18,7 @@
* ============LICENSE_END=========================================================
*/
-package org.openecomp.mso.adapters.sdnc.util;
+package org.onap.so.adapters.sdnc.util;
public class SDNCRequestIdUtil {
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
deleted file mode 100644
index c9c75d89fa..0000000000
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterPortTypeImpl.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.adapters.sdnc.impl;
-
-import javax.annotation.PostConstruct;
-import javax.jws.WebService;
-import javax.servlet.http.HttpServletResponse;
-
-import org.openecomp.mso.adapters.sdnc.SDNCAdapterPortType;
-import org.openecomp.mso.adapters.sdnc.SDNCAdapterRequest;
-import org.openecomp.mso.adapters.sdnc.SDNCAdapterResponse;
-import org.openecomp.mso.adapters.sdnc.util.SDNCRequestIdUtil;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoAlarmLogger;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.properties.MsoPropertiesException;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-
-//BPEL SDNCAdapter SOAP Web Service implementation
-@WebService(serviceName = "SDNCAdapterService", endpointInterface = "org.openecomp.mso.adapters.sdnc.SDNCAdapterPortType", targetNamespace = "http://org.openecomp/workflow/sdnc/adapter/wsdl/v1")
-public class SDNCAdapterPortTypeImpl implements SDNCAdapterPortType {
-
- private MsoPropertiesFactory msoPropertiesFactory=new MsoPropertiesFactory();
-
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
- private static MsoAlarmLogger alarmLogger = new MsoAlarmLogger();
- public static final String MSO_PROP_SDNC_ADAPTER="MSO_PROP_SDNC_ADAPTER";
-
- @PostConstruct
- public void init () {
- msoLogger.info(MessageEnum.RA_INIT_SDNC_ADAPTER, "SDNC", "SDNCAdapterPortType");
- }
-
- /**
- * Health Check web method. Does nothing but return to show the adapter is deployed.
- */
- @Override
- public void healthCheck ()
- {
- msoLogger.debug("Health check call in SDNC Adapter");
- }
-
- public static String getProperty(String key, String defaultValue, MsoPropertiesFactory msoPropertiesFactoryp) {
- String value;
- try {
- value = msoPropertiesFactoryp.getMsoJavaProperties(MSO_PROP_SDNC_ADAPTER).getProperty(key, defaultValue);
- } catch (MsoPropertiesException e) {
- msoLogger.error (MessageEnum.NO_PROPERTIES, "Unknown. Mso Properties ID not found in cache: " + MSO_PROP_SDNC_ADAPTER, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e);
- return null;
- }
- msoLogger.debug("Config read for " + MSO_PROP_SDNC_ADAPTER + " - key:" + key + " value:" + value);
- return value;
- }
-
- @Override
- public SDNCAdapterResponse sdncAdapter(SDNCAdapterRequest bpelRequest) {
- String bpelReqId = bpelRequest.getRequestHeader().getRequestId();
- String callbackUrl = bpelRequest.getRequestHeader().getCallbackUrl();
- long startTime = System.currentTimeMillis ();
- MsoLogger.setLogContext(SDNCRequestIdUtil.getSDNCOriginalRequestId (bpelReqId), bpelRequest.getRequestHeader().getSvcInstanceId());
- MsoLogger.setServiceName (bpelRequest.getRequestHeader().getSvcAction());
- msoLogger.info(MessageEnum.RA_RECEIVE_BPEL_REQUEST, bpelReqId, callbackUrl, "SDNC", "");
-
- SDNCRestClient sdncClient = new SDNCRestClient(bpelRequest,msoPropertiesFactory);
- try {
- Thread sdncClientThread = new Thread(sdncClient);
- sdncClientThread.start();
- }
- catch (Exception e){
- String respMsg = "Error sending request to SDNC. Failed to start SDNC Client thread " + e.getMessage();
- msoLogger.error(MessageEnum.RA_SEND_REQUEST_SDNC_ERR, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception sending request to SDNC. Failed to start SDNC Client thread", e);
- alarmLogger.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, respMsg);
- SDNCResponse sdncResp = new SDNCResponse(bpelReqId);
- sdncResp.setRespCode(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
- sdncResp.setRespMsg(respMsg);
- SDNCRestClient.sendRespToBpel(callbackUrl, sdncResp, msoPropertiesFactory);
- }
-
- msoLogger.debug("Sending synchronous response to BPEL");
- SDNCAdapterResponse wsResp = new SDNCAdapterResponse();
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- return wsResp;
- }
-}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterRestImpl.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterRestImpl.java
deleted file mode 100644
index f6a3e36a71..0000000000
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/impl/SDNCAdapterRestImpl.java
+++ /dev/null
@@ -1,191 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.adapters.sdnc.impl;
-
-
-import java.io.StringReader;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import javax.ws.rs.GET;
-import javax.ws.rs.HEAD;
-import javax.ws.rs.POST;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.Path;
-import javax.ws.rs.Produces;
-import javax.ws.rs.QueryParam;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.DefaultValue;
-import javax.ws.rs.core.HttpHeaders;
-import javax.ws.rs.core.Response;
-import javax.xml.XMLConstants;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.openecomp.mso.HealthCheckUtils;
-import org.openecomp.mso.utils.UUIDChecker;
-import org.w3c.dom.Document;
-import org.xml.sax.InputSource;
-
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-import org.openecomp.mso.logger.MessageEnum;
-@Path("/")
-public class SDNCAdapterRestImpl {
-
- private MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
- public static final String MSO_PROP_ADAPTER = "MSO_PROP_SDNC_ADAPTER";
-
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
-
- @Context
- private HttpHeaders headers;
- @Context HttpServletRequest request;
-
- @POST
- @Path("/MSORequest")
- @Consumes("application/xml")
- @Produces("application/xml")
- public Response MSORequest(String reqXML) {
- msoLogger.debug("***Received MSO Rest Request. XML:" + reqXML);
-
- Document reqDoc = null;
- SDNCResponse sdncResp = null;
- RequestTunables rt = null;
- String reqId = "";
- long startTime = System.currentTimeMillis();
- MsoLogger.setServiceName("UNKNOWN");
- String action = "";
- String operation = "";
- try {
-
- reqId = headers.getRequestHeader("mso-request-id").get(0);
- action = headers.getRequestHeader("mso-request-action").get(0);
- operation = headers.getRequestHeader("mso-request-operation").get(0);
-
- MsoLogger.setLogContext(reqId, "");
-
- msoLogger.debug ("Received MSO Rest Request XML: " + reqXML);
- rt = new RequestTunables(reqId, "", operation, action, msoPropertiesFactory);
- rt.setTunables();
-
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
- dbf.setFeature (XMLConstants.FEATURE_SECURE_PROCESSING, true);
- DocumentBuilder db = dbf.newDocumentBuilder();
-
- InputSource source = new InputSource(new StringReader(reqXML));
-
- reqDoc = db.parse(source);
-
- } catch (Exception e) {
- msoLogger.error(MessageEnum.RA_PARSING_REQUEST_ERROR, reqXML, "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - Invalid XML request format", e);
- sdncResp = new SDNCResponse(reqId, HttpServletResponse.SC_BAD_REQUEST, "Invalid XML request format");
- }
-
- if (reqDoc != null) {
- msoLogger.debug("***Getting response from sdnc***");
- long subStartTime = System.currentTimeMillis ();
- sdncResp = SDNCRestClient.getSdncResp(Utils.genSdncReq(reqDoc, rt), rt,msoPropertiesFactory);
- msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully received response from SDNC", "SDNC", action + "." + operation, null);
- }
-
- if (sdncResp == null) {
- msoLogger.debug("An Internal Server error has occurred in SDNC Adapter");
- sdncResp = new SDNCResponse(reqId, HttpServletResponse.SC_INTERNAL_SERVER_ERROR, "MSO - SDNCA Internal Error");
- }
-
- if (sdncResp.getSdncRespXml() == null) {
- sdncResp.setSdncRespXml(Utils.genMsoFailResp(sdncResp));
- }
-
- msoLogger.debug("***Completed MSO Rest Request." + sdncResp.toString());
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- return Response.status(sdncResp.getRespCode()).entity(sdncResp.getSdncRespXml()).build();
- }
-
- @HEAD
- @GET
- @Path("/healthcheck")
- @Produces("text/html")
- public Response healthcheck (@QueryParam("requestId") String requestId) {
- long startTime = System.currentTimeMillis ();
- MsoLogger.setServiceName ("Healthcheck");
- UUIDChecker.verifyOldUUID(requestId, msoLogger);
- HealthCheckUtils healthCheck = new HealthCheckUtils ();
- if (!healthCheck.siteStatusCheck(msoLogger)) {
- return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
- }
-
- if (!healthCheck.configFileCheck(msoLogger, startTime, MSO_PROP_ADAPTER)) {
- return HealthCheckUtils.NOT_STARTED_RESPONSE;
- }
- msoLogger.debug("healthcheck - Successful");
- return HealthCheckUtils.HEALTH_CHECK_RESPONSE;
- }
-
- @HEAD
- @GET
- @Path("/globalhealthcheck")
- @Produces("text/html")
- public Response globalHealthcheck (@DefaultValue("true") @QueryParam("enableBpmn") boolean enableBpmn) {
- long startTime = System.currentTimeMillis ();
- MsoLogger.setServiceName ("GlobalHealthcheck");
- // Generate a Request Id
- String requestId = UUIDChecker.generateUUID(msoLogger);
- HealthCheckUtils healthCheck = new HealthCheckUtils ();
- if (!healthCheck.siteStatusCheck (msoLogger)) {
- return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
- }
-
- if (healthCheck.verifyGlobalHealthCheck(enableBpmn, requestId)) {
- msoLogger.debug("globalHealthcheck - Successful");
- return HealthCheckUtils.HEALTH_CHECK_RESPONSE;
- } else {
- msoLogger.debug("globalHealthcheck - At leaset one of the sub-modules is not available.");
- return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
- }
- }
-
- @HEAD
- @GET
- @Path("/nodehealthcheck")
- @Produces("text/html")
- public Response nodeHealthcheck () {
- long startTime = System.currentTimeMillis ();
- MsoLogger.setServiceName ("NodeHealthcheck");
- // Generate a Request Id
- String requestId = UUIDChecker.generateUUID(msoLogger);
- HealthCheckUtils healthCheck = new HealthCheckUtils ();
- if (!healthCheck.siteStatusCheck (msoLogger)) {
- return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
- }
-
- if (healthCheck.verifyNodeHealthCheck(HealthCheckUtils.NodeType.RA, requestId)) {
- msoLogger.debug("nodeHealthcheck - Successful");
- return HealthCheckUtils.HEALTH_CHECK_RESPONSE;
- } else {
- msoLogger.debug("nodeHealthcheck - At leaset one of the sub-modules is not available.");
- return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
- }
- }
-
-}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/notify/SDNCNotifyResource.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/notify/SDNCNotifyResource.java
deleted file mode 100644
index 871b132d15..0000000000
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/notify/SDNCNotifyResource.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-
-package org.openecomp.mso.adapters.sdnc.notify;
-
-
-import java.io.StringReader;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.Consumes;
-import javax.ws.rs.GET;
-import javax.ws.rs.POST;
-import javax.ws.rs.Path;
-import javax.ws.rs.PathParam;
-import javax.ws.rs.Produces;
-import javax.ws.rs.core.Context;
-import javax.ws.rs.core.Response;
-import javax.xml.XMLConstants;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.ParserConfigurationException;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathConstants;
-import javax.xml.xpath.XPathFactory;
-
-import org.openecomp.mso.utils.UUIDChecker;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-import org.xml.sax.InputSource;
-
-import org.openecomp.mso.adapters.sdnc.impl.Constants;
-import org.openecomp.mso.adapters.sdnc.impl.SDNCAdapterPortTypeImpl;
-import org.openecomp.mso.adapters.sdnc.impl.SDNCResponse;
-import org.openecomp.mso.adapters.sdnc.impl.SDNCRestClient;
-import org.openecomp.mso.adapters.sdnc.util.SDNCRequestIdUtil;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-import org.openecomp.mso.logger.MessageEnum;
-
-//SDNC to SDNC Async Notifcations
-@Path("/")
-public class SDNCNotifyResource {
-
- private MsoPropertiesFactory msoPropertiesFactory=new MsoPropertiesFactory();
-
- private static MsoLogger msoLogger = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
-
- @GET()
- public Response printMessage () {
- long startTime = System.currentTimeMillis ();
- UUIDChecker.generateUUID (msoLogger);
- String result = "SDNCAdapter Rest services";
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- return Response.status (HttpServletResponse.SC_OK).entity (result).build ();
-
- }
-
- @GET()
- @Path("/{param}")
- public Response printMessageParam (@PathParam("param") String msg) {
- long startTime = System.currentTimeMillis ();
- UUIDChecker.generateUUID (msoLogger);
- String result = "SDNCAdapter Rest services : " + msg;
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- return Response.status (HttpServletResponse.SC_OK).entity (result).build ();
-
- }
-
- @POST
- @Path("/SDNCNotify")
- @Consumes("application/xml")
- @Produces("application/xml")
- public Response SDNCNotify (String reqXML, @Context HttpServletRequest request) {
-
- XPathFactory xpathFactory = XPathFactory.newInstance ();
- XPath xpath = xpathFactory.newXPath ();
- long startTime = System.currentTimeMillis ();
-
- msoLogger.info (MessageEnum.RA_RECEIVE_SDNC_NOTIF, reqXML, "SDNC", "SDNCNotify");
-
- InputSource source = new InputSource (new StringReader (reqXML));
-
- DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance ();
-
- DocumentBuilder db;
-
- try {
- dbf.setFeature (XMLConstants.FEATURE_SECURE_PROCESSING, true);
- db = dbf.newDocumentBuilder ();
- } catch (ParserConfigurationException e) {
- msoLogger.error (MessageEnum.RA_PARSING_REQUEST_ERROR, "SDNC", "SDNCNotify", MsoLogger.ErrorCode.SchemaError, "Exception - Invalid XML request format", e);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Invalid XML request format");
- return Response.status (HttpServletResponse.SC_BAD_REQUEST).entity ("Invalid XML request format").build ();
- }
-
- Document doc = null;
- try {
- doc = db.parse (source);
- } catch (Exception e) {
- msoLogger.error (MessageEnum.RA_PARSING_REQUEST_ERROR, "SDNC", "SDNCNotify", MsoLogger.ErrorCode.SchemaError, "Exception - Invalid XML request format", e);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.SchemaError, "Invalid XML request format");
- return Response.status (HttpServletResponse.SC_BAD_REQUEST).entity ("Invalid XML request format").build ();
- }
-
- try {
- NodeList nl = (NodeList) xpath.evaluate (Constants.SDNC_SVCCFGRESP_ROOT, doc, XPathConstants.NODESET);
- if (nl.getLength () <= 0) {
- msoLogger.error (MessageEnum.RA_MISSING_PARAM, Constants.SDNC_SVCCFGRESP_ROOT, "SDNC", "SDNCNotify", MsoLogger.ErrorCode.DataError, "Missing param");
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "Missing" + Constants.SDNC_SVCCFGRESP_ROOT);
- return Response.status (HttpServletResponse.SC_BAD_REQUEST)
- .entity ("Missing " + Constants.SDNC_SVCCFGRESP_ROOT)
- .build ();
- }
- } catch (Exception e) {
- msoLogger.error (MessageEnum.RA_MISSING_PARAM, Constants.SDNC_SVCCFGRESP_ROOT, "SDNC", "SDNCNotify", MsoLogger.ErrorCode.DataError, "Exception - Missing param", e);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "Missing" + Constants.SDNC_SVCCFGRESP_ROOT);
- return Response.status (HttpServletResponse.SC_BAD_REQUEST)
- .entity ("Missing " + Constants.SDNC_SVCCFGRESP_ROOT)
- .build ();
- }
-
- String reqId;
- try {
- reqId = xpath.evaluate (Constants.SDNC_SVCCFGRESP_ROOT + Constants.SDNC_REQ_ID, doc);
- } catch (Exception e) {
- msoLogger.error (MessageEnum.RA_MISSING_PARAM, Constants.SDNC_SVCCFGRESP_ROOT + Constants.SDNC_REQ_ID, "SDNC", "SDNCNotify", MsoLogger.ErrorCode.DataError, "Exception - Missing param", e);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "Missing" + Constants.SDNC_SVCCFGRESP_ROOT + Constants.SDNC_REQ_ID);
- return Response.status (HttpServletResponse.SC_BAD_REQUEST)
- .entity ("Missing " + Constants.SDNC_SVCCFGRESP_ROOT + Constants.SDNC_REQ_ID)
- .build ();
- }
-
- MsoLogger.setLogContext (SDNCRequestIdUtil.getSDNCOriginalRequestId (reqId), "");
-
- String respCode;
- try {
- respCode = xpath.evaluate (Constants.SDNC_SVCCFGRESP_ROOT + Constants.SDNC_RESP_CODE, doc);
- } catch (Exception e) {
- msoLogger.error (MessageEnum.RA_MISSING_PARAM,
- Constants.SDNC_SVCCFGRESP_ROOT + Constants.SDNC_RESP_CODE, "SDNC", "SDNCNotify", MsoLogger.ErrorCode.DataError, "Exception - Missing param",
- e);
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.BadRequest, "Missing" + Constants.SDNC_SVCCFGRESP_ROOT + Constants.SDNC_RESP_CODE);
- return Response.status (HttpServletResponse.SC_BAD_REQUEST)
- .entity ("Missing" + Constants.SDNC_SVCCFGRESP_ROOT + Constants.SDNC_RESP_CODE)
- .build ();
- }
-
- String respMsg = "";
- try {
- respMsg = xpath.evaluate (Constants.SDNC_SVCCFGRESP_ROOT + Constants.SDNC_RESP_MSG, doc);
- } catch (Exception e) {
- msoLogger.error (MessageEnum.RA_MISSING_PARAM, Constants.SDNC_SVCCFGRESP_ROOT + Constants.SDNC_RESP_MSG, "SDNC", "SDNCNotify", MsoLogger.ErrorCode.DataError, "Exception - Missing param", e);
- }
-
- String bpelUrl;
-
- bpelUrl = SDNCAdapterPortTypeImpl.getProperty (Constants.BPEL_URL_PROP, Constants.DEFAULT_BPEL_URL,msoPropertiesFactory);
- if (bpelUrl == null) {
- msoLogger.debug("bpelUrl is NULL:");
- }
-
- SDNCResponse sdncResp = new SDNCResponse (reqId);
- sdncResp.setRespCode (Integer.parseInt (respCode));
- sdncResp.setRespMsg (respMsg);
- sdncResp.setSdncRespXml (reqXML);
- long subStartTime = System.currentTimeMillis ();
- SDNCRestClient.sendRespToBpel (bpelUrl, sdncResp,msoPropertiesFactory);
- msoLogger.recordMetricEvent (subStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successfully send request to BPMN", "BPMN", bpelUrl, null);
-
- msoLogger.recordAuditEvent (startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- return Response.ok ().build ();
- }
-}
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterProperties.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterProperties.java
deleted file mode 100644
index 4d0190243b..0000000000
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterProperties.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.openecomp.mso.adapters.sdnc.sdncrest;
-
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.properties.MsoPropertiesException;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-
-/**
- * Static methods to access SDNC adapter properties.
- */
-public final class SDNCAdapterProperties {
- private static final String MSO_PROPERTIES_ID = "MSO_PROP_SDNC_ADAPTER";
- private static final MsoPropertiesFactory MSO_PROPERTIES_FACTORY = new MsoPropertiesFactory();
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
-
- /**
- * Gets the value of an SDNC adapter property.
- * @param key the property key
- * @param defaultValue the default value to use if the property does not
- * exist or if an error occurs
- */
- public static String getProperty(String key, String defaultValue) {
- MsoJavaProperties properties;
-
- try {
- properties = MSO_PROPERTIES_FACTORY.getMsoJavaProperties(MSO_PROPERTIES_ID);
- } catch (MsoPropertiesException e) {
- LOGGER.error (MessageEnum.NO_PROPERTIES, "Unknown. Mso Properties ID not found in cache: " + MSO_PROPERTIES_ID,
- "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e);
- return defaultValue;
- }
-
- String value = properties.getProperty(key, defaultValue);
- LOGGER.debug("Config read for " + MSO_PROPERTIES_ID + " - key:" + key + " value:" + value);
- return value;
- }
-
- /**
- * Gets the value of an SDNC adapter property.
- * @param key the property key
- * @param defaultValue the default value to use if the property does not
- * exist or if an error occurs
- */
- public static String getEncryptedProperty(String key, String defaultValue, String encryptionKey) {
- MsoJavaProperties properties;
-
- try {
- properties = MSO_PROPERTIES_FACTORY.getMsoJavaProperties(MSO_PROPERTIES_ID);
- } catch (MsoPropertiesException e) {
- LOGGER.error (MessageEnum.NO_PROPERTIES, "Unknown. Mso Properties ID not found in cache: " + MSO_PROPERTIES_ID,
- "SDNC", "", MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e);
- return defaultValue;
- }
-
- String value = properties.getEncryptedProperty(key, defaultValue, encryptionKey);
- LOGGER.debug("Config read for " + MSO_PROPERTIES_ID + " - key:" + key);
- return value;
- }
-
- /**
- * Instantiation is not allowed.
- */
- private SDNCAdapterProperties() {
- }
-} \ No newline at end of file
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterRest.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterRest.java
deleted file mode 100644
index f7a37fc202..0000000000
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCAdapterRest.java
+++ /dev/null
@@ -1,239 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.openecomp.mso.adapters.sdnc.sdncrest;
-
-import org.openecomp.mso.HealthCheckUtils;
-import org.openecomp.mso.adapters.sdnc.impl.Constants;
-import org.openecomp.mso.adapters.sdncrest.SDNCEvent;
-import org.openecomp.mso.adapters.sdncrest.SDNCResponseCommon;
-import org.openecomp.mso.adapters.sdncrest.SDNCServiceError;
-import org.openecomp.mso.adapters.sdncrest.SDNCServiceRequest;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoAlarmLogger;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.utils.UUIDChecker;
-import org.apache.http.HttpStatus;
-
-import javax.servlet.http.HttpServletResponse;
-import javax.ws.rs.*;
-import javax.ws.rs.core.GenericEntity;
-import javax.ws.rs.core.MediaType;
-import javax.ws.rs.core.Response;
-import java.text.ParseException;
-
-/**
- * SDNC REST adapter interface added in 1702 to support the SDNC "agnostic" API.
- */
-@Path("/")
-public class SDNCAdapterRest {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
- private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger();
-
- private static final String MSO_PROPERTIES_ID = "MSO_PROP_SDNC_ADAPTER";
-
- @HEAD
- @GET
- @Path("/v1/sdnc/healthcheck")
- @Produces(MediaType.TEXT_HTML)
- public Response healthcheck(@QueryParam("requestId") String requestId) {
- long startTime = System.currentTimeMillis();
- MsoLogger.setServiceName("Healthcheck");
- UUIDChecker.verifyOldUUID(requestId, LOGGER);
- HealthCheckUtils healthCheck = new HealthCheckUtils();
-
- if (!healthCheck.siteStatusCheck(LOGGER)) {
- return HealthCheckUtils.HEALTH_CHECK_NOK_RESPONSE;
- }
-
- if (!healthCheck.configFileCheck(LOGGER, startTime, MSO_PROPERTIES_ID)) {
- return HealthCheckUtils.NOT_STARTED_RESPONSE;
- }
-
- LOGGER.debug("healthcheck - Successful");
- return HealthCheckUtils.HEALTH_CHECK_RESPONSE;
- }
-
- /**
- * Processes an SDNCServiceRequest (a request for "agnostic" API services) from BP.
- * @param request the request
- * @param msoRequestId the request ID for the top-level MSO flow (used for logging only)
- * @param msoServiceInstanceId the top-level service-instance-id (used for logging only)
- */
- @POST
- @Path("/v1/sdnc/services")
- @Consumes({MediaType.APPLICATION_JSON})
- @Produces({MediaType.APPLICATION_JSON})
- public Response service(
- SDNCServiceRequest request,
- @HeaderParam(value="mso-request-id") String msoRequestId,
- @HeaderParam(value="mso-service-instance-id") String msoServiceInstanceId) {
-
- MsoLogger.setLogContext(msoRequestId, msoServiceInstanceId);
-
- try {
- LOGGER.debug(getClass().getSimpleName() + ".service(request)"
- + " entered with request: " + request.toJson());
-
- SDNCServiceRequestTask task = new SDNCServiceRequestTask(request, msoRequestId,
- msoServiceInstanceId, "/services");
-
- try {
- Thread thread = new Thread(task);
- thread.start();
- } catch (Exception e) {
- String msg = "Failed to start thread to run SDNCServiceTask";
- LOGGER.error(MessageEnum.RA_SEND_REQUEST_SDNC_ERR, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, msg, e);
- ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, msg);
- SDNCServiceError error = new SDNCServiceError(request.getSDNCRequestId(),
- String.valueOf(HttpStatus.SC_INTERNAL_SERVER_ERROR), e.toString(), "Y");
- LOGGER.debug(getClass().getSimpleName() + ".service(request)"
- + " exited with error: " + msg);
- return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
- .entity(new GenericEntity<SDNCServiceError>(error){})
- .build();
- }
-
- // Send sync response to caller
- LOGGER.debug(getClass().getSimpleName() + ".service(request)"
- + " exited successfully");
- return Response.status(HttpStatus.SC_ACCEPTED).build();
- } catch (Exception e) {
- String msg = "Caught " + e.getClass().getSimpleName() + " in 'service' method";
- LOGGER.error(MessageEnum.RA_SEND_REQUEST_SDNC_ERR, "SDNC", "", MsoLogger.ErrorCode.BusinessProcesssError, msg, e);
- LOGGER.debug(getClass().getSimpleName() + ".service(request)"
- + " exited with error: " + msg);
- SDNCServiceError error = new SDNCServiceError(request.getSDNCRequestId(),
- String.valueOf(HttpStatus.SC_INTERNAL_SERVER_ERROR), e.toString(), "Y");
- return Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR)
- .entity(new GenericEntity<SDNCServiceError>(error){})
- .build();
- }
- }
-
- /**
- * Processes a notification from SDNC for "agnostic" API services.
- * Note that the "myurl" configuration property specifies the path
- * up to and including /SDNCNotify. The /services part of the path
- * is added by this class.
- * @param content the notification content
- */
- @POST
- @Path("/SDNCNotify/services")
- @Consumes({MediaType.APPLICATION_XML})
- @Produces({MediaType.APPLICATION_XML})
- public Response serviceNotification(String content) {
- LOGGER.info(MessageEnum.RA_RECEIVE_SDNC_NOTIF, content, "SDNC", "SDNCNotify/services");
-
- long startTime = System.currentTimeMillis();
-
- try {
- // Because the format of a notification is exactly the same as that of
- // a synchronous response, we can use the same code to parse it.
- SDNCResponseCommon response = SDNCServiceRequestConnector.parseResponseContent(content);
-
- String bpUrl = SDNCAdapterProperties.getProperty(Constants.BPEL_REST_URL_PROP, null);
-
- if (bpUrl == null) {
- String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP;
- LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.BPEL_REST_URL_PROP, "SDNC", "",
- MsoLogger.ErrorCode.DataError, "Missing config param");
- ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
- return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(error).build();
- }
-
- long bpStartTime = System.currentTimeMillis();
- BPRestCallback callback = new BPRestCallback();
- boolean callbackSuccess = callback.send(bpUrl, "SDNCAResponse", response.getSDNCRequestId(), response.toJson());
-
- if (callbackSuccess) {
- LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Sent notification", "BPMN", bpUrl, null);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- } else {
- LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
- "Failed to send notification", "BPMN", bpUrl, null);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
- "Failed to send notification");
- }
-
- return Response.ok().build();
- } catch (ParseException e) {
- LOGGER.error(MessageEnum.RA_PARSING_REQUEST_ERROR, "SDNC", "SDNCNotify/services",
- MsoLogger.ErrorCode.SchemaError, e.getMessage());
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.SchemaError, e.getMessage());
- return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(e.getMessage()).build();
- }
- }
-
- /**
- * Processes an event notification from SDNC.
- * Note that the "myurl" configuration property specifies the path
- * up to and including /SDNCNotify. The /activate part of the path
- * is added by this class.
- * @param content the notification content
- */
- @POST
- @Path("/SDNCNotify/event")
- @Consumes({MediaType.APPLICATION_XML})
- @Produces({MediaType.APPLICATION_XML})
- public Response eventNotification(String content) {
- LOGGER.info(MessageEnum.RA_RECEIVE_SDNC_NOTIF, content, "SDNC", "SDNCNotify/event");
-
- long startTime = System.currentTimeMillis();
-
- try {
- SDNCEvent event = SDNCEventParser.parse(content);
-
- String bpUrl = SDNCAdapterProperties.getProperty(Constants.BPEL_REST_URL_PROP, null);
-
- if (bpUrl == null) {
- String error = "Missing configuration for: " + Constants.BPEL_REST_URL_PROP;
- LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.BPEL_REST_URL_PROP, "SDNC", "",
- MsoLogger.ErrorCode.DataError, "Missing config param");
- ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
- return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(error).build();
- }
-
- long bpStartTime = System.currentTimeMillis();
- BPRestCallback callback = new BPRestCallback();
- boolean callbackSuccess = callback.send(bpUrl, "SDNCAEvent", event.getEventCorrelator(), event.toJson());
-
- if (callbackSuccess) {
- LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc,
- "Sent notification", "BPMN", bpUrl, null);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.COMPLETE, MsoLogger.ResponseCode.Suc, "Successful");
- } else {
- LOGGER.recordMetricEvent(bpStartTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
- "Failed to send notification", "BPMN", bpUrl, null);
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR, MsoLogger.ResponseCode.CommunicationError,
- "Failed to send notification");
- }
-
- return Response.ok().build();
- } catch (ParseException e) {
- LOGGER.error(MessageEnum.RA_PARSING_REQUEST_ERROR, "SDNC", "SDNCNotify/event",
- MsoLogger.ErrorCode.SchemaError, e.getMessage());
- LOGGER.recordAuditEvent(startTime, MsoLogger.StatusCode.ERROR,
- MsoLogger.ResponseCode.SchemaError, e.getMessage());
- return Response.status(HttpServletResponse.SC_BAD_REQUEST).entity(e.getMessage()).build();
- }
- }
-} \ No newline at end of file
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCEventParser.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCEventParser.java
deleted file mode 100644
index 2263ab74df..0000000000
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/SDNCEventParser.java
+++ /dev/null
@@ -1,161 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * Copyright (C) 2017 Huawei Technologies Co., Ltd. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.openecomp.mso.adapters.sdnc.sdncrest;
-
-import org.openecomp.mso.adapters.sdncrest.SDNCEvent;
-import org.openecomp.mso.logger.MsoLogger;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.xml.sax.InputSource;
-
-import javax.xml.XMLConstants;
-import javax.xml.parsers.DocumentBuilderFactory;
-import java.io.StringReader;
-import java.text.ParseException;
-
-/**
- * SDNCConnector for "agnostic" API services.
- */
-public class SDNCEventParser {
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger (MsoLogger.Catalog.RA);
-
- // Instantiation is not allowed.
- private SDNCEventParser() {
- }
-
- /**
- * Parses SDNC event XML. If the content can be parsed and contains all required
- * elements, then an object is returned. Otherwise, a ParseException is thrown.
- * This method performs no logging or alarming.
- * @throws ParseException on error
- */
- public static SDNCEvent parse(String content) throws ParseException {
- try {
- // Note: this document builder is not namespace-aware, so namespaces are ignored.
- DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
- documentBuilderFactory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
- InputSource source = new InputSource(new StringReader(content));
- Document doc = documentBuilderFactory.newDocumentBuilder().parse(source);
-
- // Find the configuration-event child under the root element.
- // The root element is expected to be an "output" element, but we don't really care.
-
- Element root = doc.getDocumentElement();
- Element configurationEvent = null;
-
- for (Element child : SDNCAdapterUtils.childElements(root)) {
- if ("configuration-event".equals(child.getNodeName())) {
- configurationEvent = child;
- break;
- }
- }
-
- if (configurationEvent == null) {
- throw new ParseException("No configuration-event element in SDNC event", 0);
- }
-
- // Process the children of configuration-event
-
- String eventType = null;
- String eventCorrelatorType = null;
- String eventCorrelator = null;
- Element eventParameters = null;
-
- for (Element child : SDNCAdapterUtils.childElements(configurationEvent)) {
- if ("event-type".equals(child.getNodeName())) {
- eventType = child.getTextContent();
- } else if ("event-correlator-type".equals(child.getNodeName())) {
- eventCorrelatorType = child.getTextContent();
- } else if ("event-correlator".equals(child.getNodeName())) {
- eventCorrelator = child.getTextContent();
- } else if ("event-parameters".equals(child.getNodeName())) {
- eventParameters = child;
- }
- }
-
- // event-type is mandatory.
-
- if (eventType == null || eventType.isEmpty()) {
- throw new ParseException("No event-type in SDNC event", 0);
- }
-
- // event-correlator-type is mandatory.
-
- if (eventCorrelatorType == null || eventCorrelatorType.isEmpty()) {
- throw new ParseException("No event-correlator-type in SDNC event", 0);
- }
-
- // event-correlator is mandatory.
-
- if (eventCorrelator == null || eventCorrelator.isEmpty()) {
- throw new ParseException("No event-correlator in SDNC event", 0);
- }
-
- // Create an event object.
-
- SDNCEvent event = new SDNCEvent(eventType, eventCorrelatorType, eventCorrelator);
-
- // event-parameters is an optional container element. If present,
- // process its children, adding values to the event object.
-
- if (eventParameters != null) {
- for (Element element : SDNCAdapterUtils.childElements(eventParameters)) {
- if (!"event-parameter".equals(element.getNodeName())) {
- continue;
- }
-
- String tagName = null;
- String tagValue = null;
-
- for (Element child : SDNCAdapterUtils.childElements(element)) {
- if ("tag-name".equals(child.getNodeName())) {
- tagName = child.getTextContent();
- } else if ("tag-value".equals(child.getNodeName())) {
- tagValue = child.getTextContent();
- }
- }
-
- // tag-name is mandatory
-
- if (tagName == null) {
- throw new ParseException("Missing tag-name in SDNC event parameter", 0);
- }
-
- // tag-value is optional. If absent, make it an empty string so we don't
- // end up with null values in the parameter map.
-
- if (tagValue == null) {
- tagValue = "";
- }
-
- event.addParam(tagName, tagValue);
- }
- }
-
- return event;
- } catch (ParseException e) {
- throw e;
- } catch (Exception e) {
- LOGGER.debug("Exception:", e);
- throw new ParseException("Failed to parse SDNC event:", 0 );
- }
- }
-} \ No newline at end of file
diff --git a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/TypedRequestTunables.java b/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/TypedRequestTunables.java
deleted file mode 100644
index 72fca989f6..0000000000
--- a/adapters/mso-sdnc-adapter/src/main/java/org/openecomp/mso/adapters/sdnc/sdncrest/TypedRequestTunables.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/*-
- * ============LICENSE_START=======================================================
- * ONAP - SO
- * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
- * ================================================================================
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- * ============LICENSE_END=========================================================
- */
-package org.openecomp.mso.adapters.sdnc.sdncrest;
-
-import org.openecomp.mso.adapters.sdnc.impl.Constants;
-import org.openecomp.mso.logger.MessageEnum;
-import org.openecomp.mso.logger.MsoAlarmLogger;
-import org.openecomp.mso.logger.MsoLogger;
-import org.openecomp.mso.properties.MsoJavaProperties;
-import org.openecomp.mso.properties.MsoPropertiesException;
-import org.openecomp.mso.properties.MsoPropertiesFactory;
-
-/**
- * Typed Request Tunables. Each entry is identified by a TYPE in the property name.
- * Different types can have different keys.
- * <p>
- * General format:
- * <pre>
- * org.openecomp.mso.adapters.sdnc.TYPE.KEY1[.KEY2...]=METHOD|TIMEOUT|URL|HEADER|NAMESPACE
- * </pre>
- * Currently supported type(s): service
- * <pre>
- * org.openecomp.mso.adapters.sdnc.service.SERVICE.OPERATION=METHOD|TIMEOUT|URL|HEADER|NAMESPACE
- * </pre>
- */
-public class TypedRequestTunables {
-
- private static final String MSO_PROPERTIES_ID = "MSO_PROP_SDNC_ADAPTER";
-
- private static final MsoLogger LOGGER = MsoLogger.getMsoLogger(MsoLogger.Catalog.RA);
- private static final MsoAlarmLogger ALARMLOGGER = new MsoAlarmLogger();
-
- private final MsoPropertiesFactory msoPropertiesFactory = new MsoPropertiesFactory();
-
- private final String reqId;
- private final String myUrlSuffix;
- private String key = null;
- private String error = null;
-
- // tunables (all are required)
- private String reqMethod = null;
- private String timeout = null;
- private String sdncUrl = null;
- private String headerName = null;
- private String namespace = null;
- private String myUrl = null;
-
- public TypedRequestTunables(String reqId, String myUrlSuffix) {
- this.reqId = reqId;
- this.myUrlSuffix = myUrlSuffix;
- }
-
- /**
- * Sets the key for a service request:
- * <pre>
- * org.openecomp.mso.adapters.sdnc.service.SERVICE.OPERATION
- * </pre>
- * @param service the sdncService
- * @param operation the sdncOperation
- */
- public void setServiceKey(String service, String operation) {
- key = Constants.REQUEST_TUNABLES + ".service." + service + "." + operation;
- LOGGER.debug("Generated " + getClass().getSimpleName() + " key: " + key);
- }
-
- /**
- * Gets the SDNC request ID.
- */
- public String getReqId() {
- return reqId;
- }
-
- /**
- * Gets the generated key.
- */
- public String getKey() {
- return key;
- }
-
- /**
- * Gets the most recent error, or null if there was no error.
- */
- public String getError() {
- return error;
- }
-
- public String getReqMethod() {
- return reqMethod;
- }
-
- public String getTimeout() {
- return timeout;
- }
-
- public String getSdncUrl() {
- return sdncUrl;
- }
-
- public String getHeaderName() {
- return headerName;
- }
-
- public String getNamespace() {
- return namespace;
- }
-
- /**
- * Gets the SDNC adapter notification URL, trimmed of trailing '/' characters.
- */
- public String getMyUrl() {
- return myUrl;
- }
-
- /**
- * Returns true if successful. If there is an error, it is logged and alarmed.
- * The error description may be retrieved by calling getError().
- */
- public boolean setTunables() {
- error = null;
- MsoJavaProperties properties;
-
- try {
- properties = msoPropertiesFactory.getMsoJavaProperties(MSO_PROPERTIES_ID);
- } catch (MsoPropertiesException e) {
- error = "Mso Properties ID not found in cache: " + MSO_PROPERTIES_ID;
- LOGGER.error(MessageEnum.LOAD_PROPERTIES_FAIL, "Unknown. " + error, "SDNC", "",
- MsoLogger.ErrorCode.DataError, "Exception - Mso Properties ID not found in cache", e);
- ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
- return false;
- }
-
- String value = properties.getProperty(key, "");
-
- if ("".equals(value)) {
- error = "Missing configuration for: " + key;
- LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, key, "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param");
- ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
- return false;
- }
-
- String[] parts = value.split("\\|");
-
- if (parts.length != 5) {
- error = "Invalid configuration for: " + key;
- LOGGER.error(MessageEnum.RA_SDNC_INVALID_CONFIG, key, value, "SDNC", "", MsoLogger.ErrorCode.DataError, "Invalid config");
- ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
- return false;
- }
-
- reqMethod = parts[0];
- LOGGER.debug("Request Method is set to: " + reqMethod);
-
- timeout = parts[1];
- LOGGER.debug("Timeout is set to: " + timeout);
-
- String urlPropKey = Constants.REQUEST_TUNABLES + "." + parts[2];
- sdncUrl = properties.getProperty(urlPropKey, "");
-
- if ("".equals(sdncUrl)) {
- error = "Missing configuration for: " + urlPropKey;
- LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, urlPropKey, "SDNC", "", MsoLogger.ErrorCode.DataError, "Missing config param");
- ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
- return false;
- }
-
- LOGGER.debug("SDNC Url is set to: " + sdncUrl);
-
- headerName = parts[3];
- LOGGER.debug("Header Name is set to: " + headerName);
-
- namespace = parts[4];
- LOGGER.debug("Namespace is set to: " + namespace);
-
- myUrl = properties.getProperty(Constants.MY_URL_PROP, "");
-
- if ("".equals(myUrl)) {
- error = "Missing configuration for: " + Constants.MY_URL_PROP;
- LOGGER.error(MessageEnum.RA_SDNC_MISS_CONFIG_PARAM, Constants.MY_URL_PROP, "SDNC", "",
- MsoLogger.ErrorCode.DataError, "Missing config param");
- ALARMLOGGER.sendAlarm("MsoInternalError", MsoAlarmLogger.CRITICAL, error);
- return false;
- }
-
- while (myUrl.endsWith("/")) {
- myUrl = myUrl.substring(0, myUrl.length()-1);
- }
-
- myUrl += myUrlSuffix;
-
- LOGGER.debug(toString());
- return true;
- }
-
- @Override
- public String toString() {
- return getClass().getSimpleName() + "["
- + "reqId=" + reqId
- + (key == null ? "" : ", key=" + key)
- + (reqMethod == null ? "" : ", reqMethod=" + reqMethod)
- + (sdncUrl == null ? "" : ", sdncUrl=" + sdncUrl)
- + (timeout == null ? "" : ", timeout=" + timeout)
- + (headerName == null ? "" : ", headerName=" + headerName)
- + (namespace == null ? "" : ", namespace=" + namespace)
- + (myUrl == null ? "" : ", myUrl=" + myUrl)
- + "]";
- }
-}