aboutsummaryrefslogtreecommitdiffstats
path: root/champ-service/src/main/java
diff options
context:
space:
mode:
authorMichael Arrastia <MArrasti@amdocs.com>2018-05-01 14:55:56 +0100
committerMichael Arrastia <MArrasti@amdocs.com>2018-05-01 14:55:56 +0100
commitc5331e6fe565e7d0a22d1752e8f793d55dbe7c2e (patch)
treee0ceba06087abacc484350c46027c74e0f8f6e86 /champ-service/src/main/java
parente0549f46142bcc54cc3d3c04a465e5e6c54ba90c (diff)
Replace AJSC with Spring Boot 1.5.12.RELEASE
Updates include: Remove AJSC references Use PropertiesLoader (loader.path) to allow loading external janus or titan deps Fix dependency conflicts between janus/titan deps and Spring Boot deps Use Jetty container Use Jersey registration of Champ REST interface Change-Id: Ic33b886b0b039cce0366c0f0910cc5a3fe5bfd9b Issue-ID: AAI-1041 Signed-off-by: Michael Arrastia <MArrasti@amdocs.com>
Diffstat (limited to 'champ-service/src/main/java')
-rw-r--r--champ-service/src/main/java/org/onap/champ/ChampApplication.java46
-rw-r--r--champ-service/src/main/java/org/onap/champ/ChampRESTAPI.java7
-rw-r--r--champ-service/src/main/java/org/onap/champ/JerseyConfig.java35
3 files changed, 83 insertions, 5 deletions
diff --git a/champ-service/src/main/java/org/onap/champ/ChampApplication.java b/champ-service/src/main/java/org/onap/champ/ChampApplication.java
new file mode 100644
index 0000000..bc74469
--- /dev/null
+++ b/champ-service/src/main/java/org/onap/champ/ChampApplication.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.champ;
+
+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;
+
+@SpringBootApplication
+@ImportResource({"file:${SERVICE_BEANS}/*.xml"})
+public class ChampApplication extends SpringBootServletInitializer {
+
+ public static void main(String[] args) {
+ String keyStorePassword = System.getProperty("KEY_STORE_PASSWORD");
+ if (keyStorePassword == null || keyStorePassword.isEmpty()) {
+ throw new RuntimeException("Environment property KEY_STORE_PASSWORD not set");
+ }
+
+ Map<String, Object> props = new HashMap<>();
+ props.put("server.ssl.key-store-password", Password.deobfuscate(keyStorePassword));
+ new ChampApplication().configure(new SpringApplicationBuilder(ChampApplication.class).properties(props))
+ .run(args);
+ }
+}
diff --git a/champ-service/src/main/java/org/onap/champ/ChampRESTAPI.java b/champ-service/src/main/java/org/onap/champ/ChampRESTAPI.java
index b75ba53..1a68027 100644
--- a/champ-service/src/main/java/org/onap/champ/ChampRESTAPI.java
+++ b/champ-service/src/main/java/org/onap/champ/ChampRESTAPI.java
@@ -27,7 +27,6 @@ import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Timer;
-
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
@@ -44,7 +43,6 @@ 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.json.JSONException;
import org.json.JSONObject;
import org.onap.aai.champcore.ChampTransaction;
@@ -67,12 +65,11 @@ import org.onap.champ.service.logging.ChampMsgs;
import org.onap.champ.service.logging.LoggingUtil;
import org.onap.champ.util.ChampProperties;
import org.onap.champ.util.ChampServiceConstants;
-
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
-@Path(value = "/")
+@Path(value = "/services/champ-service/v1/")
public class ChampRESTAPI {
private ObjectMapper mapper;
@@ -88,7 +85,7 @@ public class ChampRESTAPI {
public ChampRESTAPI(ChampDataService champDataService, ChampAsyncRequestProcessor champAsyncRequestProcessor) {
this.champDataService = champDataService;
- // Async request handling is optional.
+ // Async request handling is optional.
if (champAsyncRequestProcessor != null) {
timer = new Timer("ChampAsyncRequestProcessor-1");
timer.schedule(champAsyncRequestProcessor, champAsyncRequestProcessor.getRequestPollingTimeSeconds(),
diff --git a/champ-service/src/main/java/org/onap/champ/JerseyConfig.java b/champ-service/src/main/java/org/onap/champ/JerseyConfig.java
new file mode 100644
index 0000000..f72a2e4
--- /dev/null
+++ b/champ-service/src/main/java/org/onap/champ/JerseyConfig.java
@@ -0,0 +1,35 @@
+/**
+ * ============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.champ;
+
+import org.glassfish.jersey.server.ResourceConfig;
+import org.springframework.stereotype.Component;
+
+/**
+ * Registers Crud Rest interface as JAX-RS endpoints.
+ */
+@Component
+public class JerseyConfig extends ResourceConfig {
+
+ public JerseyConfig(ChampRESTAPI champRestApi) {
+ register(champRestApi);
+ }
+}