diff options
Diffstat (limited to 'sparkybe-onap-application/src')
11 files changed, 187 insertions, 113 deletions
diff --git a/sparkybe-onap-application/src/main/docker/Dockerfile b/sparkybe-onap-application/src/main/docker/Dockerfile index 52e3e84..3f05ff9 100644 --- a/sparkybe-onap-application/src/main/docker/Dockerfile +++ b/sparkybe-onap-application/src/main/docker/Dockerfile @@ -16,18 +16,21 @@ RUN export JAVA_HOME # Build up the deployment folder structure RUN mkdir -p $MICRO_HOME RUN mkdir -p $BIN_HOME +RUN mkdir -p $MICRO_HOME/config/ RUN mkdir -p $MICRO_HOME/lib/ RUN mkdir -p $MICRO_HOME/static/ ADD *.jar $MICRO_HOME/lib/ ADD scripts/* $MICRO_HOME/bin/ COPY static/ $MICRO_HOME/static/ +COPY config/ $MICRO_HOME/config/ COPY oxm $MICRO_HOME/oxm/ RUN chmod 755 $MICRO_HOME/bin/* RUN chmod 755 $MICRO_HOME/lib/* RUN chmod 755 $MICRO_HOME/static/* +RUN chmod 755 $MICRO_HOME/config/* RUN ln -s /logs $MICRO_HOME/logs 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 2334297..9958d72 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 @@ -20,101 +20,19 @@ */ package org.onap.aai.sparky; -import javax.servlet.Filter; - -import org.apache.camel.component.servlet.CamelHttpTransportServlet; import org.onap.aai.sparky.config.PropertyPasswordConfiguration; -import org.onap.aai.sparky.security.filter.LoginFilter; -import org.openecomp.portalsdk.core.onboarding.crossapi.PortalRestAPIProxy; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.web.servlet.FilterRegistrationBean; -import org.springframework.boot.web.servlet.ServletRegistrationBean; -import org.springframework.context.annotation.Bean; @SpringBootApplication public class Application { - private static final String SPARKY_SSL_ENABLED_PROPERTY = "sparky.ssl.enabled"; - private static final String SPARKY_PORTAL_ENABLED_PROPERTY = "sparky.portal.enabled"; - private static final String SPARKY_SSL_ENABLED_ENV = "SPARKY_SSL_ENABLED"; - private static final String SPARKY_PORTAL_ENABLED_ENV = "SPARKY_PORTAL_ENABLED"; - - private Filter loginFilter = new LoginFilter(); - public static void main(String[] args) { - setDefaultProperties(); SpringApplication app = new SpringApplication(Application.class); app.addInitializers(new PropertyPasswordConfiguration()); app.run(args); } - - protected static void setDefaultProperties() { - - /* - * By default we want ssl and portal integration, however it is possible to turn these off with - * properties for local development and interop in some situations. - */ - - if (System.getenv(SPARKY_SSL_ENABLED_ENV) == null) { - System.setProperty(SPARKY_SSL_ENABLED_PROPERTY, "true"); - } else { - System.setProperty(SPARKY_SSL_ENABLED_PROPERTY, System.getenv(SPARKY_SSL_ENABLED_ENV)); - } - - boolean sslEnabled = Boolean.parseBoolean(System.getProperty(SPARKY_SSL_ENABLED_PROPERTY)); - - if (sslEnabled) { - System.setProperty("server.ssl.key-store-password", System.getenv("KEYSTORE_PASSWORD")); - System.setProperty("server.ssl.key-password", System.getenv("KEYSTORE_ALIAS_PASSWORD")); - } - - if (System.getenv(SPARKY_PORTAL_ENABLED_ENV) == null) { - System.setProperty(SPARKY_PORTAL_ENABLED_PROPERTY, "true"); - } else { - System.setProperty(SPARKY_PORTAL_ENABLED_PROPERTY, System.getenv(SPARKY_PORTAL_ENABLED_ENV)); - } - } - - /* - * This initialization code enabled access to aai-ui-proxy-processor - */ - @Bean - ServletRegistrationBean servletRegistrationBean() { - final ServletRegistrationBean servlet = - new ServletRegistrationBean(new CamelHttpTransportServlet(), "/rest/*"); - servlet.setName("CamelServlet"); - return servlet; - } - - /** - * bind LoginFilter - */ - @Bean - @ConditionalOnProperty(value = "sparky.portal.enabled", havingValue = "true") - public FilterRegistrationBean loginFilterRegistrationBean() { - FilterRegistrationBean registration = new FilterRegistrationBean(); - - registration.setFilter(loginFilter); - registration.addUrlPatterns("/*"); - - return registration; - } - - /** - * Bind the Portal API Proxy - */ - @Bean - @ConditionalOnProperty(value = "sparky.portal.enabled", havingValue = "true") - public ServletRegistrationBean portalApiProxy() { - - final ServletRegistrationBean servlet = - new ServletRegistrationBean(new PortalRestAPIProxy(), "/api/v2/*"); - servlet.setName("PortalRestApiProxy"); - return servlet; - } - + } diff --git a/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/aai/FrontEndLayoutApi.java b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/aai/FrontEndLayoutApi.java index 0590cd6..ab74074 100644 --- a/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/aai/FrontEndLayoutApi.java +++ b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/aai/FrontEndLayoutApi.java @@ -31,9 +31,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; @RestController public class FrontEndLayoutApi { - public FrontEndLayoutApi() { - } @RequestMapping(value = "/layouts", method = {RequestMethod.GET}) 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/camel/FilterAggregationRouter.java index c216ddd..634dcc5 100644 --- 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/camel/FilterAggregationRouter.java @@ -1,6 +1,6 @@ /** * ============LICENSE_START======================================================= - * org.onap.aai + * SPARKY (AAI UI service) * ================================================================================ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. * Copyright © 2017-2018 Amdocs @@ -18,15 +18,20 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.onap.aai.sparky.config; +package org.onap.aai.sparky.camel; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; +import org.apache.camel.spring.SpringRouteBuilder; +import org.springframework.stereotype.Component; -@Configuration -@ConditionalOnProperty(value="sparky.ssl.enabled", havingValue = "true") -@PropertySource("file:${CONFIG_HOME}/sparky-ssl-config.properties") -public class SparkySslConfigLoader { +@Component +public class FilterAggregationRouter extends SpringRouteBuilder { + + @Override + public void configure() throws Exception { + + rest().post("/search/filterAggregation") + .to("bean:aggregateSummaryProcessor?method=getFilteredAggregation"); + + } } 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/camel/FilterRequestRouter.java index f6b739c..849f013 100644 --- 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/camel/FilterRequestRouter.java @@ -1,6 +1,6 @@ /** * ============LICENSE_START======================================================= - * org.onap.aai + * SPARKY (AAI UI service) * ================================================================================ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. * Copyright © 2017-2018 Amdocs @@ -18,15 +18,20 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.onap.aai.sparky.config; +package org.onap.aai.sparky.camel; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; +import org.apache.camel.spring.SpringRouteBuilder; +import org.springframework.stereotype.Component; -@Configuration -@ConditionalOnProperty(value="sparky.ssl.enabled", havingValue = "false") -@PropertySource("file:${CONFIG_HOME}/sparky-http-config.properties") -public class SparkyHttpConfigLoader { +@Component +public class FilterRequestRouter extends SpringRouteBuilder { + + @Override + public void configure() throws Exception { + + rest().post("/search/unifiedFilterRequest") + .to("bean:filterProcessor?method=getFiltersWithValues"); + + } } diff --git a/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/SparkyConfigLoader.java b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/camel/GlobalSearchRouter.java index 5124ce7..ea87254 100644 --- a/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/SparkyConfigLoader.java +++ b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/camel/GlobalSearchRouter.java @@ -1,6 +1,6 @@ /** * ============LICENSE_START======================================================= - * org.onap.aai + * SPARKY (AAI UI service) * ================================================================================ * Copyright © 2017-2018 AT&T Intellectual Property. All rights reserved. * Copyright © 2017-2018 Amdocs @@ -18,14 +18,19 @@ * limitations under the License. * ============LICENSE_END========================================================= */ -package org.onap.aai.sparky.config; +package org.onap.aai.sparky.camel; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; +import org.apache.camel.spring.SpringRouteBuilder; +import org.springframework.stereotype.Component; + +@Component +public class GlobalSearchRouter extends SpringRouteBuilder { + + @Override + public void configure() throws Exception { + + rest().post("/search/querysearch").to("bean:unifiedSearchProcessor?method=search"); + + } -@Configuration -@PropertySource("file:${CONFIG_HOME}/sparky-application.properties") -public class SparkyConfigLoader { - - } diff --git a/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/camel/SubscriptionRouter.java b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/camel/SubscriptionRouter.java new file mode 100644 index 0000000..4a28e30 --- /dev/null +++ b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/camel/SubscriptionRouter.java @@ -0,0 +1,37 @@ +/** + * ============LICENSE_START======================================================= + * SPARKY (AAI UI service) + * ================================================================================ + * 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.camel; + +import org.apache.camel.spring.SpringRouteBuilder; +import org.springframework.stereotype.Component; + +@Component +public class SubscriptionRouter extends SpringRouteBuilder { + + @Override + public void configure() throws Exception { + + rest().get("/subscription/getsubscription") + .to("bean:subscriptionServiceProcessor?method=getSubscription"); + + } + +} diff --git a/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/camel/ViewInspectRouter.java b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/camel/ViewInspectRouter.java new file mode 100644 index 0000000..ee2ae04 --- /dev/null +++ b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/camel/ViewInspectRouter.java @@ -0,0 +1,37 @@ +/** + * ============LICENSE_START======================================================= + * SPARKY (AAI UI service) + * ================================================================================ + * 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.camel; + +import org.apache.camel.spring.SpringRouteBuilder; +import org.springframework.stereotype.Component; + +@Component +public class ViewInspectRouter extends SpringRouteBuilder { + + @Override + public void configure() throws Exception { + + rest().post("/visualization/prepareVisualization").route() + .to("bean:schemaVisualizationProcessor?method=processVisualizationRequest"); + + } + +} diff --git a/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/CamelConfiguration.java b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/CamelConfiguration.java new file mode 100644 index 0000000..8f433db --- /dev/null +++ b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/config/CamelConfiguration.java @@ -0,0 +1,19 @@ +package org.onap.aai.sparky.config; + +import org.apache.camel.component.servlet.CamelHttpTransportServlet; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.stereotype.Component; + +@Component +public class CamelConfiguration { + + @Bean + ServletRegistrationBean servletRegistrationBean() { + final ServletRegistrationBean servlet = + new ServletRegistrationBean(new CamelHttpTransportServlet(), "/rest/*", "/services/*"); + servlet.setName("CamelServlet"); + return servlet; + } + +}
\ No newline at end of file diff --git a/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/portal/PortalBean.java b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/portal/PortalBean.java new file mode 100644 index 0000000..86f019e --- /dev/null +++ b/sparkybe-onap-application/src/main/java/org/onap/aai/sparky/portal/PortalBean.java @@ -0,0 +1,41 @@ +package org.onap.aai.sparky.portal; + +import javax.servlet.Filter; + +import org.onap.aai.sparky.security.filter.LoginFilter; +import org.openecomp.portalsdk.core.onboarding.crossapi.PortalRestAPIProxy; +import org.springframework.boot.web.servlet.FilterRegistrationBean; +import org.springframework.boot.web.servlet.ServletRegistrationBean; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Profile; +import org.springframework.stereotype.Component; + +@Component +@Profile("portal") +public class PortalBean { + + private Filter loginFilter = new LoginFilter(); + + /** + * bind LoginFilter + */ + @Bean + public FilterRegistrationBean loginFilterRegistrationBean() { + FilterRegistrationBean registration = new FilterRegistrationBean(); + + registration.setFilter(loginFilter); + registration.addUrlPatterns("/*"); + + return registration; + } + + @Bean + public ServletRegistrationBean portalApiProxy() { + + final ServletRegistrationBean servlet = + new ServletRegistrationBean(new PortalRestAPIProxy(), "/api/v2/*"); + servlet.setName("PortalRestApiProxy"); + return servlet; + } + +}
\ No newline at end of file diff --git a/sparkybe-onap-application/src/main/scripts/start.sh b/sparkybe-onap-application/src/main/scripts/start.sh index a8eba46..c16c9b2 100644 --- a/sparkybe-onap-application/src/main/scripts/start.sh +++ b/sparkybe-onap-application/src/main/scripts/start.sh @@ -1,11 +1,17 @@ #!/bin/sh APP_HOME="/opt/app/sparky" -CONFIG_HOME=${APP_HOME}/appconfig +CONFIG_HOME=${APP_HOME}/config PROPS="-DAPP_HOME=${APP_HOME} -DCONFIG_HOME=${CONFIG_HOME} -Dlogging.config=${CONFIG_HOME}/logging/logback.xml" set -x jar ufv ${APP_HOME}/lib/sparkybe-onap-application*.jar -C ${CONFIG_HOME}/portal/ BOOT-INF/classes/portal.properties + +# +# change the working directory so that Spring-Boot will pick up the config folder from the right path +# +cd $APP_HOME + java -Xms1024m -Xmx4096m $PROPS -jar ${APP_HOME}/lib/sparkybe-onap-application*.jar |