diff options
author | 2018-02-20 18:03:30 +0200 | |
---|---|---|
committer | 2018-02-27 14:47:52 +0200 | |
commit | efedea1c5d80532f5b1180d57c8dafce5dcb302a (patch) | |
tree | c4bdefe8758b01f31c9e91a9ded0ab989daeb5e2 /epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java | |
parent | b94bd70f1595fad9546c3506393613f68504f495 (diff) |
org.onap migration
Change-Id: I5e2d01a6da21d4003c910b5fe0702b35c2089a77
Issue-ID: VID-86
Signed-off-by: Ofir Sonsino <os0695@intl.att.com>
Diffstat (limited to 'epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java')
-rw-r--r-- | epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java | 208 |
1 files changed, 98 insertions, 110 deletions
diff --git a/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java b/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java index 1583bc92d..2d222f0dc 100644 --- a/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java +++ b/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppConfig.java @@ -1,41 +1,57 @@ -/*- - * ================================================================================ - * 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. +/* + * ============LICENSE_START========================================== + * ONAP Portal SDK + * =================================================================== + * Copyright © 2017 AT&T Intellectual Property. All rights reserved. + * =================================================================== + * + * Unless otherwise specified, all software contained herein is licensed + * under the Apache License, Version 2.0 (the "License"); + * you may not use this software except in compliance with the License. * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * + * + * http://www.apache.org/licenses/LICENSE-2.0 + * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * 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. - * ================================================================================ + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * 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============================================ + * + * ECOMP is a trademark and service mark of AT&T Intellectual Property. */ package org.onap.portalapp.conf; import java.util.ArrayList; import java.util.List; -import javax.annotation.PostConstruct; + import javax.sql.DataSource; import org.onap.portalapp.login.LoginStrategyImpl; import org.onap.portalapp.scheduler.RegistryAdapter; -import org.openecomp.portalsdk.core.auth.LoginStrategy; -import org.openecomp.portalsdk.core.conf.AppConfig; -import org.openecomp.portalsdk.core.conf.Configurable; -import org.openecomp.portalsdk.core.lm.FusionLicenseManager; -import org.openecomp.portalsdk.core.lm.FusionLicenseManagerUtils; -//import org.openecomp.portalsdk.core.lm.LicenseableClassImpl; -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.onap.portalsdk.core.auth.LoginStrategy; +import org.onap.portalsdk.core.conf.AppConfig; +import org.onap.portalsdk.core.conf.Configurable; +import org.onap.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.onap.portalsdk.core.objectcache.AbstractCacheManager; +import org.onap.portalsdk.core.service.DataAccessService; +import org.onap.portalsdk.core.util.CacheManager; +import org.onap.portalsdk.core.util.SystemProperties; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; @@ -44,11 +60,6 @@ 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.context.support.PropertySourcesPlaceholderConfigurer; -import org.springframework.core.io.Resource; -import org.springframework.jdbc.datasource.init.DataSourceInitializer; -import org.springframework.jdbc.datasource.init.DatabasePopulator; -import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableScheduling; import org.springframework.scheduling.quartz.SchedulerFactoryBean; @@ -56,15 +67,18 @@ 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; -import org.openecomp.portalsdk.core.service.DataAccessService; -import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; +import org.springframework.core.io.Resource; +import org.springframework.jdbc.datasource.init.DataSourceInitializer; +import org.springframework.jdbc.datasource.init.DatabasePopulator; +import org.springframework.jdbc.datasource.init.ResourceDatabasePopulator; + /** - * ECOMP Portal SDK sample application. ECOMP Portal SDK core AppConfig class to + * ONAP Portal SDK sample application. Extends core AppConfig class to * reuse interceptors, view resolvers and other features defined there. */ @Configuration @EnableWebMvc -@ComponentScan(basePackages = {"org.openecomp", "org.onap"}) +@ComponentScan(basePackages = {"org.onap"}) @PropertySource(value = { "${container.classpath:}/WEB-INF/conf/app/test.properties" }, ignoreResourceNotFound = true) @Profile("src") @EnableAsync @@ -72,47 +86,47 @@ import org.openecomp.portalsdk.core.logging.logic.EELFLoggerDelegate; public class ExternalAppConfig extends AppConfig implements Configurable { private RegistryAdapter schedulerRegistryAdapter; - /** The Constant LOG. */ - private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(ExternalAppConfig.class); - - /** The vid schema script. */ - @Value("classpath:vid-schema.sql") - private Resource vidSchemaScript; - - /** The vid data script. */ - @Value("classpath:vid-data.sql") - private Resource vidDataScript; - - /** - * The Class InnerConfiguration. - */ + /** The Constant LOG. */ + private static final EELFLoggerDelegate LOG = EELFLoggerDelegate.getLogger(ExternalAppConfig.class); + + /** The vid schema script. */ + @Value("classpath:vid-schema.sql") + private Resource vidSchemaScript; + + /** The vid data script. */ + @Value("classpath:vid-data.sql") + private Resource vidDataScript; + + /** + * The Class InnerConfiguration. + */ @Configuration @Import(SystemProperties.class) static class InnerConfiguration { } /** - * View resolver. - * - * @return the view resolver - * @see org.openecomp.portalsdk.core.conf.AppConfig#viewResolver() + * @see org.onap.portalsdk.core.conf.AppConfig#viewResolver() */ + @Override public ViewResolver viewResolver() { return super.viewResolver(); } /** - * @see org.openecomp.portalsdk.core.conf.AppConfig#addResourceHandlers(ResourceHandlerRegistry) + * @see org.onap.portalsdk.core.conf.AppConfig#addResourceHandlers(ResourceHandlerRegistry) * * @param registry */ + @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { super.addResourceHandlers(registry); } /** - * @see org.openecomp.portalsdk.core.conf.AppConfig#dataAccessService() + * @see org.onap.portalsdk.core.conf.AppConfig#dataAccessService() */ + @Override public DataAccessService dataAccessService() { // Echo the JDBC URL to assist developers when starting the app. System.out.println("ExternalAppConfig: " + SystemProperties.DB_CONNECTIONURL + " is " @@ -126,8 +140,9 @@ public class ExternalAppConfig extends AppConfig implements Configurable { * * @return List of String, size 1 */ + @Override public List<String> addTileDefinitions() { - List<String> definitions = new ArrayList<String>(); + List<String> definitions = new ArrayList<>(); definitions.add("/WEB-INF/defs/definitions.xml"); return definitions; } @@ -154,30 +169,6 @@ public class ExternalAppConfig extends AppConfig implements Configurable { return new CacheManager(); } - - - - /** - * Creates and returns a new instance of a {@link FusionLicenseManager}. - * - * @return New instance of {@link FusionLicenseManager}. - */ -// @Bean -// public FusionLicenseManager fusionLicenseManager() { -// return new FusionLicenseManagerImpl(); -// } - - /** - * Creates and returns a new instance of a - * {@link FusionLicenseManagerUtils}. - * - * @return New instance of {@link FusionLicenseManagerUtils}. - */ -// @Bean -// public FusionLicenseManagerUtils fusionLicenseManagerUtils() { -// return new FusionLicenseManagerUtils(); -// } - /** * Creates and returns a new instance of a {@link SchedulerFactoryBean} and * populates it with triggers. @@ -195,36 +186,38 @@ public class ExternalAppConfig extends AppConfig implements Configurable { return scheduler; } - /** - * Data source initializer. - * - * @param dataSource the data source - * @return the data source initializer - */ - @Bean - public DataSourceInitializer dataSourceInitializer(DataSource dataSource) { - - LOG.info("Initializing VID data source"); - - final DataSourceInitializer initializer = new DataSourceInitializer(); - initializer.setDataSource(dataSource); - initializer.setDatabasePopulator(databasePopulator()); - return initializer; - } /** - * Database populator. - * - * @return the database populator - */ - public DatabasePopulator databasePopulator() { - LOG.info("Populating VID data source"); - - final ResourceDatabasePopulator populator = new ResourceDatabasePopulator(); - populator.addScript(vidSchemaScript); - populator.addScript(vidDataScript); - return populator; - } + * Data source initializer. + * + * @param dataSource the data source + * @return the data source initializer + */ + @Bean + public DataSourceInitializer dataSourceInitializer(DataSource dataSource) { + + LOG.info("Initializing VID data source"); + + final DataSourceInitializer initializer = new DataSourceInitializer(); + initializer.setDataSource(dataSource); + initializer.setDatabasePopulator(databasePopulator()); + return initializer; + } + + /** + * Database populator. + * + * @return the database populator + */ + public DatabasePopulator databasePopulator() { + LOG.info("Populating VID data source"); + + final ResourceDatabasePopulator populator = new ResourceDatabasePopulator(); + populator.addScript(vidSchemaScript); + populator.addScript(vidDataScript); + return populator; + } + /** * Sets the scheduler registry adapter. @@ -236,13 +229,8 @@ public class ExternalAppConfig extends AppConfig implements Configurable { this.schedulerRegistryAdapter = schedulerRegistryAdapter; } - /** - * Creates the LoginStrategy - * @return instance of LoginStrategy - */ @Bean public LoginStrategy loginStrategy() { - return new LoginStrategyImpl(); } } |