summaryrefslogtreecommitdiffstats
path: root/sparkybe-onap-application/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'sparkybe-onap-application/src/main/java')
-rw-r--r--sparkybe-onap-application/src/main/java/org/onap/aai/sparky/Application.java142
-rw-r--r--sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/SparkyConfigLoader.java (renamed from sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/PropertyConfigLoader.java)7
-rw-r--r--sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/SparkyHttpConfigLoader.java32
-rw-r--r--sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/SparkySpringXmlConfiguration.java19
-rw-r--r--sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/SparkySslConfigLoader.java32
5 files changed, 94 insertions, 138 deletions
diff --git a/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/Application.java b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/Application.java
index 548a48b..1077642 100644
--- a/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/Application.java
+++ b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/Application.java
@@ -18,97 +18,32 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-/**
- * This copy of Woodstox XML processor is licensed under the
- * Apache (Software) License, version 2.0 ("the License").
- * See the License for details about distribution rights, and the
- * specific rights regarding derivate works.
- *
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/
- *
- * A copy is also included in the downloadable source code package
- * containing Woodstox, in file "ASL2.0", under the same directory
- * as this file.
- */
package org.onap.aai.sparky;
-import org.apache.camel.builder.RouteBuilder;
+import javax.servlet.Filter;
+
+import org.onap.aai.sparky.security.filter.LoginFilter;
+
import org.apache.camel.component.servlet.CamelHttpTransportServlet;
-import org.apache.camel.model.rest.RestBindingMode;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletRegistrationBean;
-import org.springframework.boot.web.support.SpringBootServletInitializer;
-import org.springframework.context.ApplicationContext;
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
-import org.springframework.stereotype.Component;
@SpringBootApplication
-public class Application /*extends SpringBootServletInitializer */ {
-
- private @Autowired AutowireCapableBeanFactory beanFactory;
-
- public static void main(String[] args) {
+public class Application {
- ApplicationContext applicationContext = SpringApplication.run(Application.class, args);
-
- /*for (String name : applicationContext.getBeanDefinitionNames()) {
- System.out.println(name);
- }*/
+ private Filter loginFilter = new LoginFilter();
+ public static void main(String[] args) {
+ SpringApplication.run(Application.class, args);
}
-
- /* @Component
- class RestApi extends RouteBuilder {
-
- @Override
- public void configure() {
-
- //restConfiguration().component("restlet").contextPath("/rs").bindingMode(RestBindingMode.json);
-
- /*rest("/books").description("Books REST service")
- .get("/").description("The list of all the books")
- .route().routeId("books-api")
- .bean(Database.class, "findBooks")
- .endRest()
- .get("order/{id}").description("Details of an order by id")
- .route().routeId("order-api")
- .bean(Database.class, "findOrder(${header.id})");*/
- /* }
- }*/
-
-
- /*
- * TODO: we need to figure out the initialization required for our restlets
- */
-
- /*@Bean
- public ServletRegistrationBean restletBootstrapInitialization() {
-
- SpringServerServlet serverServlet = new SpringServerServlet();
- ServletRegistrationBean regBean = new ServletRegistrationBean( serverServlet, "/rest/*");
-
-
- Map<String,String> params = new HashMap<String,String>();
-
- params.put("org.restlet.component", "restletComponent");
-
- regBean.setInitParameters(params);
-
- return regBean;
- }*/
-
-
-
/*
* This initialization code enabled access to aai-ui-proxy-processor
*/
-
@Bean
ServletRegistrationBean servletRegistrationBean() {
final ServletRegistrationBean servlet =
@@ -117,51 +52,20 @@ public class Application /*extends SpringBootServletInitializer */ {
return servlet;
}
- /* @Bean
- public EmbeddedServletContainerFactory servletContainerFactory() {
- return new TomcatEmbeddedServletContainerFactory() {
-
- /*
- * Stackoverflow solution for adding a WAR into our embedded tomcat runtime
- * https://stackoverflow.com/questions/31374726/spring-boot-how-to-add-another-war-files-to-the-embedded-tomcat
- */
-
-
- /* @Override
- protected TomcatEmbeddedServletContainer getTomcatEmbeddedServletContainer(Tomcat tomcat) {
- // Ensure that the webapps directory exists
- System.out.println("catalina base = " + tomcat.getServer().getCatalinaBase());
- new File(tomcat.getServer().getCatalinaBase(), "webapps").mkdirs();
-
- try {
- Context context = tomcat.addWebapp("/services/aai/webapp", "X:\\2018_dev\\OSEAAI\\NUC-7257-spring-boot-conversion\\onap_sparky-be\\src\\main\\resources\\extApps\\aai.war");
+ /**
+ * bind LoginFilter
+ */
+ @Bean
+ @ConditionalOnProperty(value = "sparky.portal.enabled", havingValue = "true")
+ public FilterRegistrationBean loginFilterRegistrationBean() {
+ FilterRegistrationBean registration = new FilterRegistrationBean();
+
+ registration.setFilter(loginFilter);
+ registration.addUrlPatterns("/*");
+
+ return registration;
+ }
- // Allow the webapp to load classes from your fat jar
- context.setParentClassLoader(getClass().getClassLoader());
- } catch (ServletException ex) {
- throw new IllegalStateException("Failed to add webapp", ex);
- }
- return super.getTomcatEmbeddedServletContainer(tomcat);
- }
- };
- }*/
- /**
- * bind LoginFilter
- */
-
- /*@Bean
- public FilterRegistrationBean myFilter() {
- FilterRegistrationBean registration = new FilterRegistrationBean();
- Filter myFilter = new LoginFilter();
- beanFactory.autowireBean(myFilter);
- registration.setFilter(myFilter);
- registration.addUrlPatterns("/*");
- return registration;
- }*/
-
-
-
-
}
diff --git a/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/PropertyConfigLoader.java b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/SparkyConfigLoader.java
index dfc4b2b..5124ce7 100644
--- a/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/PropertyConfigLoader.java
+++ b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/SparkyConfigLoader.java
@@ -24,7 +24,8 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.PropertySource;
@Configuration
-@PropertySource("file:${CONFIG_HOME}/config/sparky-application.properties")
-public class PropertyConfigLoader {
-
+@PropertySource("file:${CONFIG_HOME}/sparky-application.properties")
+public class SparkyConfigLoader {
+
+
}
diff --git a/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/SparkyHttpConfigLoader.java b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/SparkyHttpConfigLoader.java
new file mode 100644
index 0000000..4c1d541
--- /dev/null
+++ b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/SparkyHttpConfigLoader.java
@@ -0,0 +1,32 @@
+/**
+ * ============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.aai.sparky.config;
+
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+
+@Configuration
+@ConditionalOnProperty(value="sparky.ssl.enabled", havingValue = "true")
+@PropertySource("file:${CONFIG_HOME}/sparky-ssl-config.properties")
+public class SparkyHttpConfigLoader {
+
+}
diff --git a/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/SparkySpringXmlConfiguration.java b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/SparkySpringXmlConfiguration.java
index 79656d5..dbbe61d 100644
--- a/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/SparkySpringXmlConfiguration.java
+++ b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/SparkySpringXmlConfiguration.java
@@ -18,25 +18,12 @@
* limitations under the License.
* ============LICENSE_END=========================================================
*/
-/**
- * This copy of Woodstox XML processor is licensed under the
- * Apache (Software) License, version 2.0 ("the License").
- * See the License for details about distribution rights, and the
- * specific rights regarding derivate works.
- *
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/
- *
- * A copy is also included in the downloadable source code package
- * containing Woodstox, in file "ASL2.0", under the same directory
- * as this file.
- */
+
package org.onap.aai.sparky.config;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;
@Configuration
-@ImportResource({"file:${CONFIG_HOME}/dynamic/spring-beans/*.xml"})
-public class SparkySpringXmlConfiguration {}
+@ImportResource({"file:${CONFIG_HOME}/spring-beans/*.xml"})
+public class SparkySpringXmlConfiguration {} \ No newline at end of file
diff --git a/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/SparkySslConfigLoader.java b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/SparkySslConfigLoader.java
new file mode 100644
index 0000000..c493f64
--- /dev/null
+++ b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/SparkySslConfigLoader.java
@@ -0,0 +1,32 @@
+/**
+ * ============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.aai.sparky.config;
+
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
+import org.springframework.context.annotation.Configuration;
+import org.springframework.context.annotation.PropertySource;
+
+@Configuration
+@ConditionalOnProperty(value="sparky.ssl.enabled", havingValue = "false")
+@PropertySource("file:${CONFIG_HOME}/sparky-http-config.properties")
+public class SparkySslConfigLoader {
+
+}