From 6beb446925c967aca92f5513adf36c5db77c00d6 Mon Sep 17 00:00:00 2001 From: TATTAVARADA Date: Thu, 27 Apr 2017 07:53:18 -0400 Subject: [PORTAL-7] Rebase This rebasing includes common libraries and common overlays projects abstraction of components Change-Id: Ia1efa4deacdc5701e6205104ac021a6c80ed60ba Signed-off-by: st782s --- .../portalapp/conf/ExternalAppConfig.java | 188 --------------------- .../portalapp/conf/ExternalAppInitializer.java | 60 ------- .../portalapp/conf/HibernateMappingLocations.java | 37 ---- .../controller/AngularSinglePageController.java | 48 ------ .../portalapp/controller/CallflowController.java | 44 ----- .../controller/ElasticSearchController.java | 128 -------------- .../portalapp/controller/LeafletMapContoller.java | 43 ----- .../portalapp/controller/PostDroolsController.java | 138 --------------- .../controller/UserProfileController.java | 72 -------- .../portalapp/controller/WelcomeController.java | 43 ----- .../java/org/openecomp/portalapp/model/Result.java | 37 ---- .../org/openecomp/portalapp/scheduler/LogJob.java | 47 ------ .../openecomp/portalapp/scheduler/LogRegistry.java | 57 ------- .../openecomp/portalapp/scheduler/Register.java | 82 --------- .../portalapp/scheduler/RegistryAdapter.java | 108 ------------ .../portalapp/service/AdminAuthExtension.java | 34 ---- .../portalapp/uebhandler/InitUebHandler.java | 73 -------- .../portalapp/uebhandler/MainUebHandler.java | 104 ------------ .../uebhandler/WidgetNotificationHandler.java | 46 ----- .../portalapp/util/CustomLoggingFilter.java | 54 ------ 20 files changed, 1443 deletions(-) delete mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppConfig.java delete mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppInitializer.java delete mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/HibernateMappingLocations.java delete mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/AngularSinglePageController.java delete mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/CallflowController.java delete mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/ElasticSearchController.java delete mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/LeafletMapContoller.java delete mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/PostDroolsController.java delete mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/UserProfileController.java delete mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/WelcomeController.java delete mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/model/Result.java delete mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogJob.java delete mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogRegistry.java delete mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/Register.java delete mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/RegistryAdapter.java delete mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java delete mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/InitUebHandler.java delete mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/MainUebHandler.java delete mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/WidgetNotificationHandler.java delete mode 100644 ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/util/CustomLoggingFilter.java (limited to 'ecomp-sdk/sdk-app/src/main/java/org') diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppConfig.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppConfig.java deleted file mode 100644 index ff9f0f1a..00000000 --- a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppConfig.java +++ /dev/null @@ -1,188 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * 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. - * ================================================================================ - */ -package org.openecomp.portalapp.conf; - -import java.util.ArrayList; -import java.util.List; - -import org.openecomp.portalapp.scheduler.RegistryAdapter; -import org.openecomp.portalapp.uebhandler.InitUebHandler; -import org.openecomp.portalapp.uebhandler.MainUebHandler; -import org.openecomp.portalapp.uebhandler.WidgetNotificationHandler; -import org.openecomp.portalsdk.core.conf.AppConfig; -import org.openecomp.portalsdk.core.conf.Configurable; -import org.openecomp.portalsdk.core.objectcache.AbstractCacheManager; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.util.CacheManager; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; -import org.springframework.context.annotation.Profile; -import org.springframework.context.annotation.PropertySource; -import org.springframework.scheduling.annotation.EnableAsync; -import org.springframework.scheduling.annotation.EnableScheduling; -import org.springframework.scheduling.quartz.SchedulerFactoryBean; -import org.springframework.web.servlet.ViewResolver; -import org.springframework.web.servlet.config.annotation.EnableWebMvc; -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; -import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; - -/** - * Configures Spring features in the ECOMP Portal SDK sample application. - * Subclasses the ECOMP Portal SDK core AppConfig class to reuse interceptors, - * view resolvers and other features defined there. - */ -@Configuration -@EnableWebMvc -@ComponentScan(basePackages = "org.openecomp") -@PropertySource(value = { "${container.classpath:}/WEB-INF/conf/app/test.properties" }, ignoreResourceNotFound = true) -@Profile("src") -@EnableAsync -@EnableScheduling -public class ExternalAppConfig extends AppConfig implements Configurable { - - private RegistryAdapter schedulerRegistryAdapter; - - @Configuration - @Import(SystemProperties.class) - static class InnerConfiguration { - } - - /** - * @see org.openecomp.portalsdk.core.conf.AppConfig#viewResolver() - */ - public ViewResolver viewResolver() { - return super.viewResolver(); - } - - /** - * @see org.openecomp.portalsdk.core.conf.AppConfig#addResourceHandlers(ResourceHandlerRegistry) - * - * @param registry - */ - public void addResourceHandlers(ResourceHandlerRegistry registry) { - super.addResourceHandlers(registry); - } - - /** - * @see org.openecomp.portalsdk.core.conf.AppConfig#dataAccessService() - */ - public DataAccessService dataAccessService() { - return super.dataAccessService(); - } - - /** - * Creates a new list with a single entry that is the external app - * definitions.xml path. - * - * @return List of String, size 1 - */ - public List addTileDefinitions() { - List definitions = new ArrayList(); - definitions.add("/WEB-INF/defs/definitions.xml"); - return definitions; - } - - /** - * Adds request interceptors to the specified registry by calling - * {@link AppConfig#addInterceptors(InterceptorRegistry)}, but excludes - * certain paths from the session timeout interceptor. - */ - @Override - public void addInterceptors(InterceptorRegistry registry) { - super.setExcludeUrlPathsForSessionTimeout("/login_external", "*/login_external.htm", "login", "/login.htm", - "/api*","/single_signon.htm","/single_signon"); - super.addInterceptors(registry); - } - - /** - * Creates and returns a new instance of a {@link CacheManager} class. - * - * @return New instance of {@link CacheManager} - */ - @Bean - public AbstractCacheManager cacheManager() { - return new CacheManager(); - } - - /** - * Creates and returns a new instance of a {@link MainUebHandler}. - * - * @return New instance of {@link MainUebHandler}. - */ - @Bean - public MainUebHandler mainUebHandler() { - - return new MainUebHandler(); - } - - /** - * Creates and returns a new instance of a {@link InitUebHandler}. - * - * @return New instance of {@link InitUebHandler}. - */ - @Bean - public InitUebHandler initUebHandler() { - - return new InitUebHandler(); - } - - /** - * Creates and returns a new instance of a {@link WidgetNotificationHandler} - * . - * - * @return New instance of {@link WidgetNotificationHandler}. - */ - @Bean - public WidgetNotificationHandler widgetNotificationHandler() { - return new WidgetNotificationHandler(); - } - - /** - * Creates and returns a new instance of a {@link SchedulerFactoryBean} and - * populates it with triggers. - * - * @return New instance of {@link SchedulerFactoryBean} - * @throws Exception - */ - // @Bean // ANNOTATION COMMENTED OUT - // APPLICATIONS REQUIRING QUARTZ SHOULD RESTORE ANNOTATION - public SchedulerFactoryBean schedulerFactoryBean() throws Exception { - SchedulerFactoryBean scheduler = new SchedulerFactoryBean(); - scheduler.setTriggers(schedulerRegistryAdapter.getTriggers()); - scheduler.setConfigLocation(appApplicationContext.getResource("WEB-INF/conf/quartz.properties")); - scheduler.setDataSource(dataSource()); - return scheduler; - } - - - /** - * Sets the scheduler registry adapter. - * - * @param schedulerRegistryAdapter - */ - @Autowired - public void setSchedulerRegistryAdapter(final RegistryAdapter schedulerRegistryAdapter) { - this.schedulerRegistryAdapter = schedulerRegistryAdapter; - } -} diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppInitializer.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppInitializer.java deleted file mode 100644 index dfdfcade..00000000 --- a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/ExternalAppInitializer.java +++ /dev/null @@ -1,60 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * 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. - * ================================================================================ - */ -package org.openecomp.portalapp.conf; - -import java.util.Arrays; - -import org.openecomp.portalsdk.core.conf.AppInitializer; - -public class ExternalAppInitializer extends AppInitializer{ - - - @Override - protected Class[] getRootConfigClasses() { - return super.getRootConfigClasses(); - } - - @Override - protected Class[] getServletConfigClasses() { -// Class[] configClasses = super.getServletConfigClasses(); -// Class[] additionalConfigClasses = Arrays.copyOf(configClasses, configClasses.length); -// addConfigClass(additionalConfigClasses, ExternalAppConfig.class); -// return additionalConfigClasses; -// - return new Class[] {ExternalAppConfig.class}; - } - - static Class[] addConfigClass(Class[] a, Class e) { - a = Arrays.copyOf(a, a.length + 1); - a[a.length - 1] = e; - return a; - } - - /* - * URL request will direct to the Spring dispatcher for processing - */ - @Override - protected String[] getServletMappings() { - return super.getServletMappings(); - } - -} - - diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/HibernateMappingLocations.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/HibernateMappingLocations.java deleted file mode 100644 index 3e1d89d2..00000000 --- a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/conf/HibernateMappingLocations.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * 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. - * ================================================================================ - */ -package org.openecomp.portalapp.conf; - -import org.openecomp.portalsdk.core.conf.HibernateMappingLocatable; -import org.springframework.context.annotation.Profile; -import org.springframework.core.io.ClassPathResource; -import org.springframework.core.io.Resource; -import org.springframework.stereotype.Component; - -@Component -@Profile("src") -public class HibernateMappingLocations implements HibernateMappingLocatable { - - public Resource[] getMappingLocations() { - return new Resource[]{new ClassPathResource("../fusion/orm/Fusion.hbm.xml"), new ClassPathResource("../fusion/orm/Workflow.hbm.xml"), new ClassPathResource("../fusion/orm/RNoteBookIntegration.hbm.xml")}; - } - - -} diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/AngularSinglePageController.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/AngularSinglePageController.java deleted file mode 100644 index e654a51c..00000000 --- a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/AngularSinglePageController.java +++ /dev/null @@ -1,48 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * 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. - * ================================================================================ - */ -package org.openecomp.portalapp.controller; - -import java.util.HashMap; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import org.openecomp.portalsdk.core.controller.RestrictedBaseController; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; - -/** - * Controller for a single-page application sample. The view is restricted to - * authenticated users. The named view resolves to page singlePageSample.html, - * which uses Angular. - */ -@Controller -@RequestMapping("/") -public class AngularSinglePageController extends RestrictedBaseController { - - @RequestMapping(value = { "/singlePageSample" }, method = RequestMethod.GET) - public ModelAndView view(HttpServletRequest request) { - Map model = new HashMap(); - return new ModelAndView("single_page_sample", "model", model); - } - -} diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/CallflowController.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/CallflowController.java deleted file mode 100644 index a3d1be5f..00000000 --- a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/CallflowController.java +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * 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. - * ================================================================================ - */ -package org.openecomp.portalapp.controller; - -import org.openecomp.portalsdk.core.controller.RestrictedBaseController; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; - -/** - * Controller for a message sequence chart view. The view is restricted to - * authenticated users. The view name defaults to the request name with no - * suffix, "callflow", which resolves to page details.jsp. That page is an - * iframe around page details.html. - */ -@Controller -@RequestMapping("/") -public class CallflowController extends RestrictedBaseController { - - @RequestMapping(value = { "/callflow" }, method = RequestMethod.GET) - public ModelAndView plot() { - final String defaultViewName = null; - return new ModelAndView(defaultViewName); - } - -} diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/ElasticSearchController.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/ElasticSearchController.java deleted file mode 100644 index 69ff63db..00000000 --- a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/ElasticSearchController.java +++ /dev/null @@ -1,128 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * 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. - * ================================================================================ - */ -package org.openecomp.portalapp.controller; - -import java.io.IOException; - -import org.json.JSONObject; -import org.openecomp.portalapp.model.Result; -import org.openecomp.portalsdk.core.controller.RestrictedBaseController; -import org.springframework.http.HttpStatus; -import org.springframework.http.MediaType; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.servlet.ModelAndView; - -import io.searchbox.client.JestClient; -import io.searchbox.client.JestClientFactory; -import io.searchbox.client.config.HttpClientConfig; -import io.searchbox.core.Search; -import io.searchbox.core.SearchResult; -import io.searchbox.core.Suggest; -import io.searchbox.core.SuggestResult; -import io.searchbox.params.Parameters; - -/** - * Controller for views that demonstrate Elastic Search features. - */ -@RestController -public class ElasticSearchController extends RestrictedBaseController{ - - @RequestMapping(value = {"/es_search_demo" }, method = RequestMethod.GET) - public ModelAndView search() { - return new ModelAndView("es_search_demo"); - } - - @RequestMapping(value = {"/es_suggest_demo" }, method = RequestMethod.GET) - public ModelAndView suggest() { - return new ModelAndView("es_suggest_demo"); - } - - @RequestMapping(value="/es_suggest/{task}",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity doSuggest(@PathVariable("task") String task) throws IOException { - JSONObject obj = new JSONObject(task); - String searchTerm = obj.getString("data"); - String searchSize = obj.getString("size"); - String searchFuzzy = obj.getString("fuzzy"); - String resultName = obj.getString("resultname"); - - JestClientFactory factory = new JestClientFactory(); - factory.setHttpClientConfig(new HttpClientConfig - .Builder("http://todo_elastic_search_server") - .multiThreaded(true) - .build()); - JestClient client = factory.getObject(); - - - Suggest suggest = new Suggest.Builder("{\n" - +"\"" + resultName +"\" : {\n" - +"\"text\" : \""+ searchTerm +"\",\n" - +"\"completion\" : {\n" - +"\"field\" : \"suggest\",\n" - +"\"size\" : " + searchSize + ",\n" - +"\"fuzzy\" : \"" + searchFuzzy + "\"\n" - +"}\n" - +"}\n" - +"}").addIndex("customer").build(); - - SuggestResult result = client.execute(suggest); - System.err.println(result.getJsonObject().toString()); - return new ResponseEntity(new Result(result.getJsonObject().toString()),HttpStatus.OK); - } - - @RequestMapping(value="/es_search/{task}",method = RequestMethod.GET, produces = MediaType.APPLICATION_JSON_VALUE) - public ResponseEntity doSearch(@PathVariable("task") String task) throws IOException { - JSONObject obj = new JSONObject(task); - String searchTerm = obj.getString("data"); - String searchSize = obj.getString("size"); - // String searchFuzzy = obj.getString("fuzzy"); - - JestClientFactory factory = new JestClientFactory(); - factory.setHttpClientConfig(new HttpClientConfig - .Builder("http://todo_elastic_search_server") - .multiThreaded(true) - .build()); - JestClient client = factory.getObject(); - - Search search = new Search.Builder("{\n" - +"\"query\" : {\n" - +"\"query_string\" : {\n" - +"\"query\" : \"name:"+ searchTerm +"\"\n" - +"}\n" - +"}\n" - +"}").addIndex("customer").setParameter(Parameters.SIZE,Integer.valueOf(searchSize)).build(); - - SearchResult result = client.execute(search); - System.err.println(result.getJsonObject().toString()); - return new ResponseEntity(new Result(result.getJsonObject().toString()),HttpStatus.OK); - } - - public ResponseEntity sendResult(Result result) { - return new ResponseEntity(result, HttpStatus.OK); - } - - @Override - public boolean isRESTfulCall() { - return true; - } -} diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/LeafletMapContoller.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/LeafletMapContoller.java deleted file mode 100644 index 4c603fe1..00000000 --- a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/LeafletMapContoller.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * 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. - * ================================================================================ - */ -package org.openecomp.portalapp.controller; - -import org.openecomp.portalsdk.core.controller.RestrictedBaseController; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; - -/** - * Controller for geographic map view. The view is restricted to authenticated - * users. The view name defaults to the request name with no suffix, - * "leafletMap", which resolves to page leafletMap.jsp. - */ -@Controller -@RequestMapping("/") -public class LeafletMapContoller extends RestrictedBaseController { - - @RequestMapping(value = { "/leafletMap" }, method = RequestMethod.GET) - public ModelAndView plot() { - final String defaultViewName = null; - return new ModelAndView(defaultViewName); - } - -} diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/PostDroolsController.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/PostDroolsController.java deleted file mode 100644 index 2729e873..00000000 --- a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/PostDroolsController.java +++ /dev/null @@ -1,138 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * 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. - * ================================================================================ - */ -package org.openecomp.portalapp.controller; - -import java.io.IOException; -import java.io.PrintWriter; -import java.util.List; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import org.json.JSONObject; -import org.openecomp.portalsdk.core.command.PostDroolsBean; -import org.openecomp.portalsdk.core.controller.RestrictedBaseController; -import org.openecomp.portalsdk.core.service.PostDroolsService; -import org.openecomp.portalsdk.core.web.support.JsonMessage; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; - -import com.fasterxml.jackson.core.JsonGenerationException; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; - -@Controller -@RequestMapping("/") -public class PostDroolsController extends RestrictedBaseController{ - - @Autowired - private PostDroolsService postDroolsService; - - @RequestMapping(value = {"/drools" }, method = RequestMethod.GET) - public ModelAndView drools(HttpServletRequest request) { - - return new ModelAndView(getViewName()); - } - - - @RequestMapping(value = {"/getDrools" }, method = RequestMethod.GET) - public void getDrools(HttpServletRequest request, HttpServletResponse response) { - // Map model = new HashMap(); - - ObjectMapper mapper = new ObjectMapper(); - try { - List beanList = postDroolsService.fetchDroolBeans(); - JsonMessage msg = new JsonMessage(mapper.writeValueAsString(beanList)); - JSONObject j = new JSONObject(msg); - response.getWriter().write(j.toString()); - - } catch (JsonGenerationException e) { - e.printStackTrace(); - } catch (JsonMappingException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @RequestMapping(value = {"/getDroolDetails" }, method = RequestMethod.GET) - public void getDroolDetails(HttpServletRequest request, HttpServletResponse response) { - - ObjectMapper mapper = new ObjectMapper(); - try { - - PostDroolsBean postDroolsBean = new PostDroolsBean(); - String selectedFile = request.getParameter("selectedFile"); - postDroolsBean.setDroolsFile(selectedFile);//sample populated - //postDroolsBean.setSelectedRules("[\"NJ\",\"NY\",\"KY\"]"); - postDroolsBean.setClassName(postDroolsService.retrieveClass(selectedFile)); - - JsonMessage msg = new JsonMessage(mapper.writeValueAsString(postDroolsBean)); - JSONObject j = new JSONObject(msg); - response.getWriter().write(j.toString()); - - } catch (JsonGenerationException e) { - e.printStackTrace(); - } catch (JsonMappingException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } catch (Exception e) { - e.printStackTrace(); - } - } - - @RequestMapping(value = {"/post_drools/execute" }, method = RequestMethod.POST) - public ModelAndView search(HttpServletRequest request, - HttpServletResponse response) throws Exception { - try { - ObjectMapper mapper = new ObjectMapper(); - mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - JsonNode root = mapper.readTree(request.getReader()); - PostDroolsBean postDroolsBean = mapper.readValue(root.get("postDroolsBean").toString(), PostDroolsBean.class); - - String resultsString = postDroolsService.execute(postDroolsBean.getDroolsFile(), postDroolsBean.getClassName(), postDroolsBean.getSelectedRules()); - - response.setCharacterEncoding("UTF-8"); - response.setContentType("application / json"); - request.setCharacterEncoding("UTF-8"); - - PrintWriter out = response.getWriter(); - //String responseString = mapper.writeValueAsString(resultsString); - JSONObject j = new JSONObject("{resultsString: "+resultsString+"}"); - - out.write(j.toString()); - } catch (Exception e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - - return null; - } - - -} diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/UserProfileController.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/UserProfileController.java deleted file mode 100644 index 2f4ea93d..00000000 --- a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/UserProfileController.java +++ /dev/null @@ -1,72 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * 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. - * ================================================================================ - */ -package org.openecomp.portalapp.controller; - -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import org.openecomp.portalsdk.core.controller.RestrictedBaseController; -import org.openecomp.portalsdk.core.domain.Profile; -import org.openecomp.portalsdk.core.service.ProfileService; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; - -import com.fasterxml.jackson.core.JsonGenerationException; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; - -/** - * Controller for user profile view. The view is restricted to authenticated - * users. The view name resolves to page user_profile.jsp which uses Angular. - */ - -@Controller -@RequestMapping("/") -public class UserProfileController extends RestrictedBaseController { - - @Autowired - ProfileService service; - - @RequestMapping(value = { "/user_profile" }, method = RequestMethod.GET) - public ModelAndView ProfileSearch(HttpServletRequest request) { - Map model = new HashMap(); - ObjectMapper mapper = new ObjectMapper(); - List profileList = service.findAll(); - try { - model.put("customerInfo", mapper.writeValueAsString(profileList)); - } catch (JsonGenerationException e) { - e.printStackTrace(); - } catch (JsonMappingException e) { - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - - return new ModelAndView("user_profile", "model", model); - } - -} diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/WelcomeController.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/WelcomeController.java deleted file mode 100644 index 06853f0e..00000000 --- a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/controller/WelcomeController.java +++ /dev/null @@ -1,43 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * 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. - * ================================================================================ - */ -package org.openecomp.portalapp.controller; - -import javax.servlet.http.HttpServletRequest; - -import org.openecomp.portalsdk.core.controller.RestrictedBaseController; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.servlet.ModelAndView; - -/** - * Controller for welcome view. The view is restricted to authenticated users. - * The view name defaults to the request name with no suffix, "welcome", which - * resolves to page welcome.jsp. - */ -@Controller -@RequestMapping("/") -public class WelcomeController extends RestrictedBaseController { - @RequestMapping(value = { "/welcome" }, method = RequestMethod.GET) - public ModelAndView welcome(HttpServletRequest request) { - final String defaultViewName = null; - return new ModelAndView(defaultViewName); - } -} diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/model/Result.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/model/Result.java deleted file mode 100644 index 5e09cb2c..00000000 --- a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/model/Result.java +++ /dev/null @@ -1,37 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * 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. - * ================================================================================ - */ -package org.openecomp.portalapp.model; - -public class Result { - private String result; - - public Result(String result) { - this.result = result; - } - - public String getResult() { - return result; - } - - public void setResult(String result) { - this.result = result; - } - -} diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogJob.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogJob.java deleted file mode 100644 index b308efbb..00000000 --- a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogJob.java +++ /dev/null @@ -1,47 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * 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. - * ================================================================================ - */ -package org.openecomp.portalapp.scheduler; - -import org.openecomp.portalapp.conf.ExternalAppConfig; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.quartz.DisallowConcurrentExecution; -import org.quartz.JobExecutionContext; -import org.quartz.JobExecutionException; -import org.quartz.PersistJobDataAfterExecution; -import org.springframework.scheduling.quartz.QuartzJobBean; - -@PersistJobDataAfterExecution -@DisallowConcurrentExecution -public class LogJob extends QuartzJobBean { - - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(ExternalAppConfig.class); - - - @Override - protected void executeInternal(JobExecutionContext ctx) - throws JobExecutionException { - // JobDataMap dataMap = ctx.getJobDetail().getJobDataMap(); - //int cnt = dataMap.getInt(""); - // JobKey jobKey = ctx.getJobDetail().getKey(); - logger.info(EELFLoggerDelegate.debugLogger, (Runtime.getRuntime().maxMemory() + " " + Runtime.getRuntime().maxMemory())); - - } - -} diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogRegistry.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogRegistry.java deleted file mode 100644 index dce9e26b..00000000 --- a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/LogRegistry.java +++ /dev/null @@ -1,57 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * 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. - * ================================================================================ - */ -package org.openecomp.portalapp.scheduler; - -import java.text.ParseException; -import java.util.HashMap; -import java.util.Map; - -import org.openecomp.portalsdk.core.scheduler.CronRegistry; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.springframework.context.annotation.DependsOn; -import org.springframework.scheduling.quartz.CronTriggerFactoryBean; -import org.springframework.scheduling.quartz.JobDetailFactoryBean; -import org.springframework.stereotype.Component; - -@Component -@DependsOn({ "systemProperties" }) -public class LogRegistry extends CronRegistry { - - private static final String groupName = "AppGroup"; - private static final String jobName = "LogJob"; - private static final String triggerName = "LogTrigger"; - - // @Autowired - // private SystemProperties systemProperties; - - // @Bean - public JobDetailFactoryBean jobDetailFactoryBean() { - Map map = new HashMap(); - map.put("units", "bytes"); - return jobDetailFactoryBean(groupName, jobName, LogJob.class, map); - } - - // @Bean - public CronTriggerFactoryBean cronTriggerFactoryBean() throws ParseException { - // "0 * * * * ? * - return cronTriggerFactoryBean(groupName, triggerName, SystemProperties.getProperty(SystemProperties.LOG_CRON)); - } - -} diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/Register.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/Register.java deleted file mode 100644 index 3a29520e..00000000 --- a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/Register.java +++ /dev/null @@ -1,82 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * 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. - * ================================================================================ - */ -package org.openecomp.portalapp.scheduler; - -import java.util.ArrayList; -import java.util.List; - -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.scheduler.Registerable; -import org.openecomp.portalsdk.core.util.SystemProperties; -import org.quartz.Trigger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.DependsOn; -import org.springframework.stereotype.Component; - -@Component -@DependsOn({"logRegistry", "systemProperties"}) -public class Register implements Registerable { - - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(Register.class); - - - private List scheduleTriggers = new ArrayList(); - Trigger trigger[] = new Trigger[1]; - - - @Autowired - private LogRegistry logRegistry; - - - - @Override - public Trigger[] getTriggers() { - return getScheduleTriggers().toArray(trigger); - } - - @Override - public void registerTriggers() { - // if the property value is not available; the cron will not be added and can be ignored. its safe to ignore the exceptions - try { - if(SystemProperties.getProperty(SystemProperties.LOG_CRON) != null) - getScheduleTriggers().add(logRegistry.getTrigger()); - - } catch(IllegalStateException ies) { - logger.info(EELFLoggerDelegate.debugLogger, ("Log Cron not available")); - } - - - } - - - public List getScheduleTriggers() { - return scheduleTriggers; - } - - public void setScheduleTriggers(List scheduleTriggers) { - this.scheduleTriggers = scheduleTriggers; - } - - - - - - -} diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/RegistryAdapter.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/RegistryAdapter.java deleted file mode 100644 index 1bc43fee..00000000 --- a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/scheduler/RegistryAdapter.java +++ /dev/null @@ -1,108 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * 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. - * ================================================================================ - */ -package org.openecomp.portalapp.scheduler; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.openecomp.portalsdk.core.scheduler.Registerable; -import org.openecomp.portalsdk.workflow.services.WorkflowScheduleService; -import org.quartz.Trigger; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.quartz.SchedulerFactoryBean; -import org.springframework.stereotype.Component; - -/** - * TODO REFACTOR - * moved from org.openecomp.portalsdk.core.scheduler - * to org.openecomp.portalapp.scheduler - * - */ -@Component -public class RegistryAdapter { - - @Autowired - private Registerable registry; - - @Autowired - private WorkflowScheduleService workflowScheduleService; - - private SchedulerFactoryBean schedulerBean; - - Trigger trigger[] = new Trigger[1]; - - public Trigger[] getTriggers() { - - registry.registerTriggers(); - - List allTriggers = new ArrayList(); - - List coreTriggers = addCoreTriggers(); - final Trigger[] extTriggerArray = registry.getTriggers(); - - allTriggers.addAll(Arrays.asList(extTriggerArray)); - allTriggers.addAll(coreTriggers); - - return allTriggers.toArray(trigger); - - - } - - - public List addCoreTriggers() { - //On startup of the application after crash recovery, invoke workflow schedule trigger - List triggers = getWorkflowScheduleService().triggerWorkflowScheduling(); - return triggers; - } - - - public void setSchedulerBean(SchedulerFactoryBean _schedulerBean) { - schedulerBean = _schedulerBean; - - } - - public SchedulerFactoryBean getSchedulerBean() { - return schedulerBean; - - } - - - public Registerable getRegistry() { - return registry; - } - - - public void setRegistry(Registerable registry) { - this.registry = registry; - } - - - public WorkflowScheduleService getWorkflowScheduleService() { - return workflowScheduleService; - } - - - public void setWorkflowScheduleService( - WorkflowScheduleService workflowScheduleService) { - this.workflowScheduleService = workflowScheduleService; - } - -} diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java deleted file mode 100644 index c4a36c61..00000000 --- a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/service/AdminAuthExtension.java +++ /dev/null @@ -1,34 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * 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. - * ================================================================================ - */ -package org.openecomp.portalapp.service; - -import org.openecomp.portalsdk.core.domain.User; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -@Service("adminAuthExtension") -@Transactional -public class AdminAuthExtension { - - public void saveUserExtension(User user){ - //app's developer implement their own logic here, like updating app's related tables - } - -} diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/InitUebHandler.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/InitUebHandler.java deleted file mode 100644 index c052187a..00000000 --- a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/InitUebHandler.java +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * 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. - * ================================================================================ - */ -package org.openecomp.portalapp.uebhandler; - -import java.util.concurrent.ConcurrentLinkedQueue; - -import javax.annotation.PostConstruct; - -import org.openecomp.portalsdk.core.logging.format.AlarmSeverityEnum; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiConstants; -import org.openecomp.portalsdk.core.onboarding.crossapi.PortalApiProperties; -import org.openecomp.portalsdk.core.onboarding.ueb.UebManager; -import org.openecomp.portalsdk.core.onboarding.ueb.UebMsg; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Configuration; - -// -// Adding this class for the sole purpose of insuring that the MainUebHandler really -// honors @Async and kicks off a thread. For more info google @Async and read about -// @Async only working if called from different class. -// -@Configuration -public class InitUebHandler { - - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(InitUebHandler.class); - - - @Autowired - MainUebHandler mainUebHandler; - - public InitUebHandler() { - - } - - @PostConstruct - public void initUeb() { - - try { - String enableListenerThread = PortalApiProperties.getProperty(PortalApiConstants.UEB_LISTENERS_ENABLE); - if (enableListenerThread.equalsIgnoreCase("true")) { - ConcurrentLinkedQueue inboxQueue = new ConcurrentLinkedQueue(); - UebManager.getInstance().initListener(inboxQueue); - mainUebHandler.runHandler(inboxQueue); - logger.info(EELFLoggerDelegate.debugLogger, ("Returned from initiating mainUebHandler...")); - } - else { - logger.info(EELFLoggerDelegate.debugLogger, ("Not starting UEB listening thread because ueb_listeners_enable is not set to true in the properties file.")); - } - } - catch (Exception e) { - logger.error(EELFLoggerDelegate.debugLogger, ("Not starting UEB listening thread because property could not be read " + PortalApiConstants.UEB_LISTENERS_ENABLE),AlarmSeverityEnum.MAJOR); - } - - } -} diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/MainUebHandler.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/MainUebHandler.java deleted file mode 100644 index 7ff07dd4..00000000 --- a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/MainUebHandler.java +++ /dev/null @@ -1,104 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * 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. - * ================================================================================ - */ -package org.openecomp.portalapp.uebhandler; - -import java.util.concurrent.ConcurrentLinkedQueue; - -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.onboarding.ueb.UebMsg; -import org.openecomp.portalsdk.core.onboarding.ueb.UebMsgTypes; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Component; - -//------------------------------------------------------------------------- -// Listens for received UEB messages and handles the messages -// -// Note: To implement a synchronous reply call getMsgId on the request -// and putMsgId on the reply (echoing the request MsgId). -// -//------------------------------------------------------------------------- -@Component("MainUebHandler") -public class MainUebHandler { - - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(MainUebHandler.class); - - - ConcurrentLinkedQueue inboxQueue = null; - - @Autowired - WidgetNotificationHandler widgetNotificationHandler; - - @Async - public void runHandler(ConcurrentLinkedQueue queue) { - inboxQueue = queue; - - logger.info(EELFLoggerDelegate.debugLogger, ("==> MainUebHandler started")); - - while (true) { - UebMsg msg = null; - while ((msg = inboxQueue.poll()) != null) { - if (msg.getMsgType() != null) { - logger.debug(EELFLoggerDelegate.debugLogger, ("<== Received UEB message : " + msg.toString())); - - switch (msg.getMsgType()) { - /* - * Add your own defined handler objects, use @Component for - * the class. See WidgetNotificationHandler as an example. - * - * Use @Async on methods for performance - * - * For syncronous replies use UebManager publishReply and - * echo back the msgId in your response ie - * msg.putMsgId(requestMsg.getMsgId()) - * - * case UebMsgTypes.UEB_MSG_TYPE_XYZ: { - * XYZHandler.handleMsg(msg); break; } - */ - case UebMsgTypes.UEB_MSG_TYPE_WIDGET_NOTIFICATION: { - widgetNotificationHandler.handleWidgetNotification(msg); - break; - } - default: { - - logger.info(EELFLoggerDelegate.debugLogger, ("Unknown message type [" + msg.getMsgType() + "] from " + msg.getSourceTopicName())); - - break; - } - } - } - } - - if (Thread.interrupted()) { - - logger.info(EELFLoggerDelegate.debugLogger, ("==> UebMainHandler exiting")); - - break; - } - - try { - Thread.sleep(10); - } catch (InterruptedException e) { - logger.info(EELFLoggerDelegate.debugLogger, ("UebMainHandler interrupted during sleep" + e.getMessage())); - - } - } - } -} diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/WidgetNotificationHandler.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/WidgetNotificationHandler.java deleted file mode 100644 index dd2213da..00000000 --- a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/uebhandler/WidgetNotificationHandler.java +++ /dev/null @@ -1,46 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * 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. - * ================================================================================ - */ -package org.openecomp.portalapp.uebhandler; - -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; -import org.openecomp.portalsdk.core.onboarding.ueb.UebMsg; -import org.springframework.scheduling.annotation.Async; -import org.springframework.stereotype.Component; - -@Component -public class WidgetNotificationHandler { - - EELFLoggerDelegate logger = EELFLoggerDelegate.getLogger(WidgetNotificationHandler.class); - - - public WidgetNotificationHandler() { - } - - @Async - public void handleWidgetNotification(UebMsg requestMsg) { - logger.debug(EELFLoggerDelegate.debugLogger, ("handleWidgetNotification received notification: " + requestMsg.toString())); - /* - * Here the notification msg can be handled - * - * requestMsg.getPayload() - returns string that contains the - * Application defined content - */ - } -} diff --git a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/util/CustomLoggingFilter.java b/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/util/CustomLoggingFilter.java deleted file mode 100644 index 48c51195..00000000 --- a/ecomp-sdk/sdk-app/src/main/java/org/openecomp/portalapp/util/CustomLoggingFilter.java +++ /dev/null @@ -1,54 +0,0 @@ -/*- - * ================================================================================ - * eCOMP Portal SDK - * ================================================================================ - * Copyright (C) 2017 AT&T Intellectual Property - * ================================================================================ - * 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. - * ================================================================================ - */ -package org.openecomp.portalapp.util; - -import ch.qos.logback.classic.Level; -import ch.qos.logback.classic.spi.ILoggingEvent; -import ch.qos.logback.core.filter.Filter; -import ch.qos.logback.core.spi.FilterReply; - -/** - * Custom Filter class bind with logback.xml - * configuration file to strip out certain log messages - * coming out of special packages or classes. - * - */ -public class CustomLoggingFilter extends Filter { - - /** - * Custom Filter is added to strip out the continuous U-EB logging messages - * But make sure we log the ERROR & WARNING Level messages. - */ - @Override - public FilterReply decide(ILoggingEvent event) { - try { - if ((event.getLevel() != Level.ERROR || event.getLevel() != Level.WARN) && - (event.getThreadName().equalsIgnoreCase("UEBConsumerThread")) && - (event.getLoggerName().contains("org.openecomp.nsa") || event.getLoggerName().contains("org.apache.http")) - ) { - return FilterReply.DENY; - } else { - return FilterReply.NEUTRAL; - } - } catch(Exception e) { - return FilterReply.NEUTRAL; - } - } -} -- cgit 1.2.3-korg