aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/org/onap
diff options
context:
space:
mode:
authorRavi Geda <gravik@amdocs.com>2018-04-30 16:54:51 +0100
committerRavi Geda <gravik@amdocs.com>2018-05-01 12:59:23 +0100
commit92927f8985ae5f381143b8b295df2f466e4349ae (patch)
tree4fa5f38af258a4098f94cf10b22fd9ec5c545db9 /src/main/java/org/onap
parent0bcc113d91c67424fd07cc4837bca50bba3dda60 (diff)
Migrate to Spring Boot
Convert from AJSC to Spring Boot micro service Change-Id: I17bed6d10a00b35dbc63f5dd2b93642b1b3eb7a5 Issue-ID: AAI-1040 Signed-off-by: Ravi Geda <gravik@amdocs.com>
Diffstat (limited to 'src/main/java/org/onap')
-rw-r--r--src/main/java/org/onap/crud/CrudApplication.java46
-rw-r--r--src/main/java/org/onap/crud/config/JerseyConfig.java39
-rw-r--r--src/main/java/org/onap/crud/event/envelope/GraphEventEnvelope.java11
-rw-r--r--src/main/java/org/onap/crud/event/envelope/GraphEventHeader.java11
-rw-r--r--src/main/java/org/onap/crud/event/response/GraphEventResponseHandler.java11
-rw-r--r--src/main/java/org/onap/crud/event/response/GraphEventResponseMessage.java11
-rw-r--r--src/main/java/org/onap/crud/service/CrudRestService.java30
-rw-r--r--src/main/java/org/onap/crud/service/JaxrsEchoService.java11
8 files changed, 121 insertions, 49 deletions
diff --git a/src/main/java/org/onap/crud/CrudApplication.java b/src/main/java/org/onap/crud/CrudApplication.java
new file mode 100644
index 0000000..d1446ba
--- /dev/null
+++ b/src/main/java/org/onap/crud/CrudApplication.java
@@ -0,0 +1,46 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 Amdocs
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.crud;
+
+import java.util.HashMap;
+import java.util.Map;
+import org.eclipse.jetty.util.security.Password;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.builder.SpringApplicationBuilder;
+import org.springframework.boot.web.support.SpringBootServletInitializer;
+import org.springframework.context.annotation.ImportResource;
+
+/**
+ * Crud application class - SpringApplication.run
+ */
+@SpringBootApplication
+@ImportResource({"file:${SERVICE_BEANS}/*.xml"})
+public class CrudApplication extends SpringBootServletInitializer{// NOSONAR
+ public static void main(String[] args) {// NOSONAR
+ String keyStorePassword = System.getProperty("KEY_STORE_PASSWORD");
+ if(keyStorePassword==null || keyStorePassword.isEmpty()){
+ throw new RuntimeException("Env property KEY_STORE_PASSWORD not set");
+ }
+ Map<String, Object> props = new HashMap<>();
+ props.put("server.ssl.key-store-password", Password.deobfuscate(keyStorePassword));
+ new CrudApplication().configure(new SpringApplicationBuilder(CrudApplication.class).properties(props)).run(args);
+ }
+}
diff --git a/src/main/java/org/onap/crud/config/JerseyConfig.java b/src/main/java/org/onap/crud/config/JerseyConfig.java
new file mode 100644
index 0000000..654ff81
--- /dev/null
+++ b/src/main/java/org/onap/crud/config/JerseyConfig.java
@@ -0,0 +1,39 @@
+/**
+ * ============LICENSE_START=======================================================
+ * org.onap.aai
+ * ================================================================================
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 Amdocs
+ * ================================================================================
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ * ============LICENSE_END=========================================================
+ */
+package org.onap.crud.config;
+
+import org.glassfish.jersey.server.ResourceConfig;
+import org.onap.crud.service.CrudRestService;
+import org.onap.crud.service.JaxrsEchoService;
+import org.springframework.stereotype.Component;
+
+/**
+ * Registers Crud Rest interface as JAX-RS endpoints.
+ */
+@Component
+public class JerseyConfig extends ResourceConfig {
+
+ public JerseyConfig(CrudRestService crudRestService, JaxrsEchoService jaxrsEchoService) {
+ register(crudRestService);
+ register(jaxrsEchoService);
+ }
+
+}
diff --git a/src/main/java/org/onap/crud/event/envelope/GraphEventEnvelope.java b/src/main/java/org/onap/crud/event/envelope/GraphEventEnvelope.java
index 13370a2..d793930 100644
--- a/src/main/java/org/onap/crud/event/envelope/GraphEventEnvelope.java
+++ b/src/main/java/org/onap/crud/event/envelope/GraphEventEnvelope.java
@@ -1,16 +1,15 @@
/**
* ============LICENSE_START=======================================================
- * Gizmo
+ * org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property.
- * Copyright © 2017 Amdocs
- * All rights reserved.
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 Amdocs
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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,
@@ -18,8 +17,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.crud.event.envelope;
diff --git a/src/main/java/org/onap/crud/event/envelope/GraphEventHeader.java b/src/main/java/org/onap/crud/event/envelope/GraphEventHeader.java
index f70127d..4f914cf 100644
--- a/src/main/java/org/onap/crud/event/envelope/GraphEventHeader.java
+++ b/src/main/java/org/onap/crud/event/envelope/GraphEventHeader.java
@@ -1,16 +1,15 @@
/**
* ============LICENSE_START=======================================================
- * Gizmo
+ * org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property.
- * Copyright © 2017 Amdocs
- * All rights reserved.
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 Amdocs
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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,
@@ -18,8 +17,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.crud.event.envelope;
diff --git a/src/main/java/org/onap/crud/event/response/GraphEventResponseHandler.java b/src/main/java/org/onap/crud/event/response/GraphEventResponseHandler.java
index 1fa056e..8146aa3 100644
--- a/src/main/java/org/onap/crud/event/response/GraphEventResponseHandler.java
+++ b/src/main/java/org/onap/crud/event/response/GraphEventResponseHandler.java
@@ -1,16 +1,15 @@
/**
* ============LICENSE_START=======================================================
- * Gizmo
+ * org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property.
- * Copyright © 2017 Amdocs
- * All rights reserved.
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 Amdocs
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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,
@@ -18,8 +17,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.crud.event.response;
diff --git a/src/main/java/org/onap/crud/event/response/GraphEventResponseMessage.java b/src/main/java/org/onap/crud/event/response/GraphEventResponseMessage.java
index 5e4c6bd..1b7c390 100644
--- a/src/main/java/org/onap/crud/event/response/GraphEventResponseMessage.java
+++ b/src/main/java/org/onap/crud/event/response/GraphEventResponseMessage.java
@@ -1,16 +1,15 @@
/**
* ============LICENSE_START=======================================================
- * Gizmo
+ * org.onap.aai
* ================================================================================
- * Copyright © 2017 AT&T Intellectual Property.
- * Copyright © 2017 Amdocs
- * All rights reserved.
+ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved.
+ * Copyright © 2017-2018 Amdocs
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * 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,
@@ -18,8 +17,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
* ============LICENSE_END=========================================================
- *
- * ECOMP is a trademark and service mark of AT&T Intellectual Property.
*/
package org.onap.crud.event.response;
diff --git a/src/main/java/org/onap/crud/service/CrudRestService.java b/src/main/java/org/onap/crud/service/CrudRestService.java
index 2af205a..b9062b0 100644
--- a/src/main/java/org/onap/crud/service/CrudRestService.java
+++ b/src/main/java/org/onap/crud/service/CrudRestService.java
@@ -20,20 +20,6 @@
*/
package org.onap.crud.service;
-import com.google.gson.JsonElement;
-
-import org.apache.cxf.jaxrs.ext.PATCH;
-import org.onap.aai.cl.api.Logger;
-import org.onap.aai.cl.eelf.LoggerFactory;
-import org.onap.aaiauth.auth.Auth;
-import org.onap.crud.exception.CrudException;
-import org.onap.crud.logging.CrudServiceMsgs;
-import org.onap.crud.logging.LoggingUtil;
-import org.onap.crud.util.CrudProperties;
-import org.onap.crud.util.CrudServiceConstants;
-import org.onap.crud.util.CrudServiceUtil;
-import org.slf4j.MDC;
-
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.HashMap;
@@ -57,7 +43,20 @@ import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriInfo;
+import org.apache.cxf.jaxrs.ext.PATCH;
+import org.onap.aai.cl.api.Logger;
+import org.onap.aai.cl.eelf.LoggerFactory;
+import org.onap.aaiauth.auth.Auth;
+import org.onap.crud.exception.CrudException;
+import org.onap.crud.logging.CrudServiceMsgs;
+import org.onap.crud.logging.LoggingUtil;
+import org.onap.crud.util.CrudProperties;
+import org.onap.crud.util.CrudServiceConstants;
+import org.onap.crud.util.CrudServiceUtil;
+import org.slf4j.MDC;
+import com.google.gson.JsonElement;
+@Path("/services/inventory")
public class CrudRestService {
private AbstractGraphDataService graphDataService;
@@ -72,14 +71,13 @@ public class CrudRestService {
this.graphDataService = graphDataService;
this.auth = new Auth(CrudServiceConstants.CRD_AUTH_FILE);
}
-
+
// For unit testing
public CrudRestService(AbstractGraphDataService graphDataService, Auth auth) throws Exception {
this.graphDataService = graphDataService;
this.auth = auth;
}
-
public enum Action {
POST, GET, PUT, DELETE, PATCH
}
diff --git a/src/main/java/org/onap/crud/service/JaxrsEchoService.java b/src/main/java/org/onap/crud/service/JaxrsEchoService.java
index 1c1e54b..dc01435 100644
--- a/src/main/java/org/onap/crud/service/JaxrsEchoService.java
+++ b/src/main/java/org/onap/crud/service/JaxrsEchoService.java
@@ -20,10 +20,6 @@
*/
package org.onap.crud.service;
-import org.onap.aai.cl.api.Logger;
-import org.onap.aai.cl.eelf.LoggerFactory;
-import org.onap.crud.logging.LoggingUtil;
-
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
@@ -34,8 +30,13 @@ import javax.ws.rs.core.HttpHeaders;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.Status;
import javax.ws.rs.core.UriInfo;
+import org.onap.aai.cl.api.Logger;
+import org.onap.aai.cl.eelf.LoggerFactory;
+import org.onap.crud.logging.LoggingUtil;
+import org.springframework.stereotype.Component;
-
+@Component
+@Path("/services/gizmo/v1/echo-service/")
public class JaxrsEchoService {
private static Logger logger = LoggerFactory.getInstance()