From efedea1c5d80532f5b1180d57c8dafce5dcb302a Mon Sep 17 00:00:00 2001 From: Ofir Sonsino Date: Tue, 20 Feb 2018 18:03:30 +0200 Subject: org.onap migration Change-Id: I5e2d01a6da21d4003c910b5fe0702b35c2089a77 Issue-ID: VID-86 Signed-off-by: Ofir Sonsino --- .../org/onap/portalapp/conf/ExternalAppConfig.java | 208 ++++++++++----------- .../portalapp/conf/ExternalAppInitializer.java | 44 +++-- .../portalapp/conf/HibernateMappingLocations.java | 59 +++--- 3 files changed, 161 insertions(+), 150 deletions(-) (limited to 'epsdk-app-onap/src/main/java/org/onap/portalapp/conf') 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 addTileDefinitions() { - List definitions = new ArrayList(); + List 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(); } } diff --git a/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppInitializer.java b/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppInitializer.java index 347bb51e1..c8fbc4347 100644 --- a/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppInitializer.java +++ b/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/ExternalAppInitializer.java @@ -1,25 +1,43 @@ -/*- - * ================================================================================ - * 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 org.openecomp.portalsdk.core.conf.AppInitializer; +import org.onap.portalsdk.core.conf.AppInitializer; public class ExternalAppInitializer extends AppInitializer { diff --git a/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/HibernateMappingLocations.java b/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/HibernateMappingLocations.java index 3116346ee..0c91ff0a0 100644 --- a/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/HibernateMappingLocations.java +++ b/epsdk-app-onap/src/main/java/org/onap/portalapp/conf/HibernateMappingLocations.java @@ -1,41 +1,52 @@ -/*- - * ================================================================================ - * 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 org.onap.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; -import org.openecomp.portalsdk.core.conf.HibernateMappingLocatable; - @Component @Profile("src") public class HibernateMappingLocations implements HibernateMappingLocatable { - /* - * (non-Javadoc) - * - * @see org.openecomp.portalsdk.core.conf.HibernateMappingLocatable# - * getMappingLocations() - */ @Override public Resource[] getMappingLocations() { return new Resource[] { new ClassPathResource("../fusion/orm/Fusion.hbm.xml"), @@ -43,15 +54,9 @@ public class HibernateMappingLocations implements HibernateMappingLocatable { new ClassPathResource("../fusion/orm/RNoteBookIntegration.hbm.xml") }; } - /* - * (non-Javadoc) - * - * @see org.openecomp.portalsdk.core.conf.HibernateMappingLocatable# - * getPackagesToScan() - */ @Override public String[] getPackagesToScan() { - return new String[] { "org.openecomp", "org.onap" }; + return new String[] { "org.onap" }; } } -- cgit 1.2.3-korg