- * something = 1
- * somethingelse = 2
- * test = ${something}/${somethingelse}
- *
- *
- * - * And if you override something to XX, then test will become XX/2 - *
- * - * - * @author marko - * - */ -public class CascadingPropertyLoader extends PropertyPlaceholderConfigurer implements InitializingBean { - - private Properties properties; - - public void afterPropertiesSet() throws Exception { - this.properties = mergeProperties(); - - // Convert the merged properties, if necessary. - convertProperties(this.properties); - - logger.debug("Properties: " + properties); - } - - @Override - protected void processProperties(final ConfigurableListableBeanFactory beanFactoryToProcess, final Properties props) throws BeansException { - super.processProperties(beanFactoryToProcess, props); - } - - public Properties getProperties() { - return properties; - } - - public void setProperties(final Properties properties) { - super.setProperties(properties); - - this.properties = properties; - } -} - diff --git a/src/main/java/eu/dnetlib/repo/manager/config/Config.java b/src/main/java/eu/dnetlib/repo/manager/config/Config.java index cbef70b..6bbf3f9 100644 --- a/src/main/java/eu/dnetlib/repo/manager/config/Config.java +++ b/src/main/java/eu/dnetlib/repo/manager/config/Config.java @@ -20,10 +20,10 @@ import org.springframework.context.annotation.*; @Configuration public class Config { - @Value("${ISLookUpService.url}") + @Value("${services.provide.iSLookUpService.url}") private String lookupURL; - @Value("${ValidatorService.url}") + @Value("${services.provide.validatorService.url}") private String validatorUrl; @Bean(name="vocabularyLoader") diff --git a/src/main/java/eu/dnetlib/repo/manager/config/DatasourceConfiguration.java b/src/main/java/eu/dnetlib/repo/manager/config/DatasourceConfiguration.java index 09a38a8..192606f 100644 --- a/src/main/java/eu/dnetlib/repo/manager/config/DatasourceConfiguration.java +++ b/src/main/java/eu/dnetlib/repo/manager/config/DatasourceConfiguration.java @@ -14,16 +14,16 @@ public class DatasourceConfiguration { private static Logger LOGGER = Logger.getLogger(DatasourceConfiguration.class); - @Value("${services.repomanager.db.driverClassName}") + @Value("${services.provide.db.driverClassName}") private String driverClassname; - @Value("${services.repomanager.db.url}") + @Value("${services.provide.db.url}") private String URL; - @Value("${services.repomanager.db.username}") + @Value("${services.provide.db.username}") private String username; - @Value("${services.repomanager.db.password}") + @Value("${services.provide.db.password}") private String password; @Bean diff --git a/src/main/java/eu/dnetlib/repo/manager/config/FrontEndLinkURIAuthenticationSuccessHandler.java b/src/main/java/eu/dnetlib/repo/manager/config/FrontEndLinkURIAuthenticationSuccessHandler.java index fc1ec49..99fbf7e 100644 --- a/src/main/java/eu/dnetlib/repo/manager/config/FrontEndLinkURIAuthenticationSuccessHandler.java +++ b/src/main/java/eu/dnetlib/repo/manager/config/FrontEndLinkURIAuthenticationSuccessHandler.java @@ -30,8 +30,8 @@ public class FrontEndLinkURIAuthenticationSuccessHandler implements Authenticati } - @Value("${aai.mode}") - private String aai_mode; + @Value("${services.provide.aai.oidc.domain}") + private String domain; @Override public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication) throws IOException, ServletException { @@ -47,8 +47,7 @@ public class FrontEndLinkURIAuthenticationSuccessHandler implements Authenticati } else { accessToken.setMaxAge(3600); } - if (aai_mode.equalsIgnoreCase("production") || aai_mode.equalsIgnoreCase("beta")) - accessToken.setDomain(".openaire.eu"); + accessToken.setDomain(domain); accessToken.setPath("/"); response.addCookie(accessToken); diff --git a/src/main/java/eu/dnetlib/repo/manager/config/MailConfig.java b/src/main/java/eu/dnetlib/repo/manager/config/MailConfig.java index 560d2b6..a979861 100644 --- a/src/main/java/eu/dnetlib/repo/manager/config/MailConfig.java +++ b/src/main/java/eu/dnetlib/repo/manager/config/MailConfig.java @@ -8,31 +8,31 @@ import org.springframework.context.annotation.Configuration; @Configuration public class MailConfig { - @Value("${services.repomanager.mail.host}") + @Value("${services.provide.mail.host}") private String host; - @Value("${services.repomanager.mail.port}") + @Value("${services.provide.mail.port}") private int port; - @Value("${services.repomanager.mail.authenticate}") + @Value("${services.provide.mail.authenticate}") private boolean authenticate; - @Value("${services.repomanager.mail.username}") + @Value("${services.provide.mail.username}") private String username; - @Value("${services.repomanager.mail.password}") + @Value("${services.provide.mail.password}") private String password; - @Value("${services.repomanager.mail.from}") + @Value("${services.provide.mail.from}") private String from; - @Value("${services.repomanager.mail.replyTo}") + @Value("${services.provide.mail.replyTo}") private String replyTo; - @Value("${services.repomanager.mail.mode}") + @Value("${services.provide.mail.mode}") private String mode; - @Value("${services.repomanager.mail.debug}") + @Value("${services.provide.mail.debug}") private boolean debug; @Bean diff --git a/src/main/java/eu/dnetlib/repo/manager/config/OpenAIREAuthoritiesMapper.java b/src/main/java/eu/dnetlib/repo/manager/config/OpenAIREAuthoritiesMapper.java index 91bd1ce..57e9a17 100644 --- a/src/main/java/eu/dnetlib/repo/manager/config/OpenAIREAuthoritiesMapper.java +++ b/src/main/java/eu/dnetlib/repo/manager/config/OpenAIREAuthoritiesMapper.java @@ -20,7 +20,7 @@ public class OpenAIREAuthoritiesMapper implements OIDCAuthoritiesMapper { private static final Logger logger = Logger.getLogger(OpenAIREAuthoritiesMapper.class); - @Value("${services.repo-manager.adminEmail}") + @Value("${services.provide.adminEmail}") String adminEmail; @Override diff --git a/src/main/java/eu/dnetlib/repo/manager/config/RedisConfiguration.java b/src/main/java/eu/dnetlib/repo/manager/config/RedisConfiguration.java index 5a3ea0a..660a607 100644 --- a/src/main/java/eu/dnetlib/repo/manager/config/RedisConfiguration.java +++ b/src/main/java/eu/dnetlib/repo/manager/config/RedisConfiguration.java @@ -15,7 +15,6 @@ import javax.annotation.PostConstruct; @Configuration @EnableRedisHttpSession -@PropertySource(value = {"classpath:application.properties"} ) @ComponentScan(basePackages = { "org.eurocris.openaire.cris.validator.service", "eu.dnetlib.repo.manager.*"}) @@ -23,17 +22,17 @@ public class RedisConfiguration { private static Logger LOGGER = Logger.getLogger(RedisConfiguration.class); - @Value("${redis.host}") + @Value("${services.provide.redis.host}") private String host; - @Value("${redis.port:6379}") + @Value("${services.provide.redis.port:6379}") private String port; - @Value("${redis.password}") + @Value("${services.provide.redis.password}") private String password; - @Value("${aai.mode}") - private String aai_mode; + @Value("${services.provide.aai.oidc.domain}") + private String domain; @PostConstruct private void init(){ @@ -56,9 +55,7 @@ public class RedisConfiguration { DefaultCookieSerializer serializer = new DefaultCookieSerializer(); serializer.setCookieName("openAIRESession"); serializer.setCookiePath("/"); - if(aai_mode.equalsIgnoreCase("production") || aai_mode.equalsIgnoreCase("beta")) - serializer.setDomainName(".openaire.eu"); -// serializer.setDomainName(".athenarc.gr"); + serializer.setDomainName(domain); LOGGER.info("Serializer : " + serializer); return serializer; } diff --git a/src/main/java/eu/dnetlib/repo/manager/config/RepoManagerContextLoaderListener.java b/src/main/java/eu/dnetlib/repo/manager/config/RepoManagerContextLoaderListener.java deleted file mode 100644 index ed14f18..0000000 --- a/src/main/java/eu/dnetlib/repo/manager/config/RepoManagerContextLoaderListener.java +++ /dev/null @@ -1,109 +0,0 @@ -package eu.dnetlib.repo.manager.config; - -import org.apache.commons.lang.ArrayUtils; -import org.apache.log4j.Logger; -import org.springframework.beans.BeansException; -import org.springframework.context.support.ClassPathXmlApplicationContext; -import org.springframework.web.context.ContextLoaderListener; -import org.springframework.web.context.WebApplicationContext; -import org.springframework.web.context.support.XmlWebApplicationContext; - -import javax.servlet.ServletContext; -import java.util.Properties; - -public class RepoManagerContextLoaderListener extends ContextLoaderListener { - private static Logger logger = Logger.getLogger(RepoManagerContextLoaderListener.class); - - - public RepoManagerContextLoaderListener() { - super(); - } - - public RepoManagerContextLoaderListener(WebApplicationContext context) { - super(context); - } - - @Override - protected WebApplicationContext createWebApplicationContext( - ServletContext servletContext) - throws BeansException { - logger.debug("Creating web application context"); - Properties props = this.loadProperties(); - String repoMode = props.getProperty("services.validator.mode.repo"); - String userMode = props.getProperty("services.validator.mode.user"); - Boolean standaloneMode = Boolean.parseBoolean(props.getProperty("services.validator.mode.standalone")); - - logger.info("User mode: " + userMode); - logger.info("Repo mode: " + repoMode); - logger.info("Standalone mode: " + standaloneMode); -// logger.info("Dnet workflow enabled: " + repoMode); - XmlWebApplicationContext ctx = new XmlWebApplicationContext(); - - ctx.setServletContext(servletContext); - - String userApiContext = null; - if (userMode.equalsIgnoreCase("local")) - userApiContext = "eu/dnetlib/validator/web/api/impls/users/springContext-validator-user-local.xml"; - else if (userMode.equalsIgnoreCase("ldap")) - userApiContext = "eu/dnetlib/users/springContext-users-ldap.xml"; - - String[] springContextCore = new String[] { - "classpath:META-INF/cxf/cxf.xml", - "classpath:META-INF/cxf/cxf-extension-soap.xml", - "classpath:META-INF/cxf/cxf-extension-jaxws.xml", - "classpath:META-INF/cxf/cxf-servlet.xml", - "classpath*:/cxf.xml", - "classpath*:/eu/dnetlib/repos/ehcacher/springContext-repos-ehcacher.xml", - "classpath*:/eu/dnetlib/clients/ws/springContext-locatorFactory.xml", - "classpath*:/eu/dnetlib/soap/cxf/applicationContext-eprbuilders.xml", -// "classpath*:/eu/dnetlib/validator/web/actions/springContext-validator-struts.xml", -// "classpath*:/eu/dnetlib/validator/web/actions/springContext-validator-emailer.xml", -// "classpath*:/eu/dnetlib/validator/web/config/springContext-validator.xml", - "classpath*:/eu/dnetlib/repo/manager/server/config/springContext-repo-manager-config.xml", -// "classpath*:/eu/dnetlib/validator/commons/dao/springContext-*.xml", - "classpath*:/eu/dnetlib/repos/springContext-repos-" + repoMode + ".xml", - "classpath*:/" + userApiContext - }; - - - String[] springContextForStandalone = new String[] { - }; - - String[] springContextForIS = new String[] { - "classpath*:/gr/uoa/di/driver/util/springContext-locators.xml", - "classpath*:/gr/uoa/di/driver/app/springContext-lookupFactory.xml", - "classpath*:/gr/uoa/di/driver/app/springContext-lookupClients.xml", - "classpath*:/eu/dnetlib/enabling/hcm/springContext-hcmService.xml", - "classpath*:/gr/uoa/di/driver/app/springContext-commons.xml", - "classpath*:/gr/uoa/di/driver/app/springContext-registrator.xml" - }; - - if (standaloneMode) { - logger.debug("Loading contexts for standalone mode"); - ctx.setConfigLocations((String[])ArrayUtils.addAll(springContextCore,springContextForStandalone)); - } else { - logger.debug("Loading contexts for dnet"); - ctx.setConfigLocations((String[])ArrayUtils.addAll(springContextCore,springContextForIS)); - } - - ctx.refresh(); - - logger.debug("done"); - - return ctx; - } - - private Properties loadProperties() { - ClassPathXmlApplicationContext ctx = new ClassPathXmlApplicationContext(new String[] { - "classpath*:/eu/dnetlib/repo/manager/server/config/springContext-repo-manager-config.xml" - }); - - CascadingPropertyLoader pLoader = (CascadingPropertyLoader) ctx.getBean("propertyLoader"); - Properties props = pLoader.getProperties(); - - ctx.destroy(); - ctx.close(); - return props; - } - -} diff --git a/src/main/java/eu/dnetlib/repo/manager/controllers/UserRoleController.java b/src/main/java/eu/dnetlib/repo/manager/controllers/UserRoleController.java index dfed035..eb8bfcf 100644 --- a/src/main/java/eu/dnetlib/repo/manager/controllers/UserRoleController.java +++ b/src/main/java/eu/dnetlib/repo/manager/controllers/UserRoleController.java @@ -18,9 +18,9 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; import java.util.Collection; -@RestController -@RequestMapping(value = "/role-management") -@Api(description = "Role Management", value = "role-management") +//@RestController +//@RequestMapping(value = "/role-management") +//@Api(description = "Role Management", value = "role-management") public class UserRoleController { private final AaiRegistryService aaiRegistryService; diff --git a/src/main/java/eu/dnetlib/repo/manager/service/BrokerServiceImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/BrokerServiceImpl.java index c455e26..e3e5a7c 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/BrokerServiceImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/BrokerServiceImpl.java @@ -33,11 +33,11 @@ public class BrokerServiceImpl implements BrokerService { @Autowired private RepositoryServiceImpl repoAPI; - @Value("${services.broker.url}:${services.broker.port}/${services.broker.api}${services.broker.openaire}") + @Value("${services.provide.broker.url}:${services.provide.broker.port}/${services.provide.broker.api}${services.provide.broker.openaire}") private String openairePath; - @Value("${services.broker.url}:${services.broker.port}/${services.broker.api}") + @Value("${services.provide.broker.url}:${services.provide.broker.port}/${services.provide.broker.api}") private String apiPath; - @Value("${topic_types.url}") + @Value("${services.provide.topic_types.url}") private String topicsURL; private static final org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger diff --git a/src/main/java/eu/dnetlib/repo/manager/service/EmailUtilsImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/EmailUtilsImpl.java index 14bced3..bb62b33 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/EmailUtilsImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/EmailUtilsImpl.java @@ -26,16 +26,16 @@ public class EmailUtilsImpl implements EmailUtils { private final MailLibrary mailLibrary; private final RepositoryService repositoryService; - @Value("${services.repomanager.baseUrl}") + @Value("${services.provide.baseUrl}") private String baseUrl; - @Value("${services.repomanager.usagestats.adminEmail}") + @Value("${services.provide.usagestats.adminEmail}") private String usageStatsAdminEmail; - @Value("${services.repomanager.provide.adminEmail}") + @Value("${services.provide.adminEmail}") private String provideAdminEmail; - @Value("${validator.results.url}") + @Value("${services.provide.validator.results.url}") private String valBaseUrl; @Autowired diff --git a/src/main/java/eu/dnetlib/repo/manager/service/PiWikServiceImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/PiWikServiceImpl.java index 986765d..f8bcd45 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/PiWikServiceImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/PiWikServiceImpl.java @@ -36,7 +36,7 @@ public class PiWikServiceImpl implements PiWikService { private DataSource dataSource; - @Value("${services.repomanager.analyticsURL}") + @Value("${services.provide.analyticsURL}") private String analyticsURL; diff --git a/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java index 36192d2..909c612 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/RepositoryServiceImpl.java @@ -19,7 +19,6 @@ import eu.dnetlib.repo.manager.service.security.RoleMappingService; import eu.dnetlib.repo.manager.utils.Converter; import gr.uoa.di.driver.enabling.vocabulary.VocabularyLoader; import org.apache.commons.codec.digest.DigestUtils; -import org.apache.http.entity.ContentType; import org.apache.log4j.Logger; import org.json.JSONArray; import org.json.JSONException; @@ -34,7 +33,6 @@ import org.springframework.http.converter.json.MappingJackson2HttpMessageConvert import org.springframework.security.core.Authentication; import org.springframework.security.core.context.SecurityContextHolder; import org.springframework.stereotype.Service; -import org.springframework.util.MimeType; import org.springframework.web.client.HttpClientErrorException; import org.springframework.web.client.RestTemplate; import org.springframework.web.util.UriComponents; @@ -62,16 +60,16 @@ public class RepositoryServiceImpl implements RepositoryService { private final EmailUtils emailUtils; private final ValidatorService validatorService; - @Value("${api.baseAddress}") + @Value("${services.provide.clients.dsm}") private String baseAddress; - @Value("${services.repo-manager.adminEmail}") + @Value("${services.provide.adminEmail}") private String adminEmail; - @Value("${services.repomanager.usageStatisticsDiagramsBaseURL}") + @Value("${services.provide.usageStatisticsDiagramsBaseURL}") private String usageStatisticsDiagramsBaseURL; - @Value("${services.repomanager.usageStatisticsNumbersBaseURL}") + @Value("${services.provide.usageStatisticsNumbersBaseURL}") private String usageStatisticsNumbersBaseURL; diff --git a/src/main/java/eu/dnetlib/repo/manager/service/StatsServiceImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/StatsServiceImpl.java index 845ed10..235e9e3 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/StatsServiceImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/StatsServiceImpl.java @@ -15,11 +15,11 @@ public class StatsServiceImpl implements StatsService { @Autowired RestTemplate restTemplate; - @Value("${search.api.baseAddress}") + @Value("${services.provide.clients.search}") private String baseAddress; - @Value("${search.api.usagestats}") + @Value("${services.provide.clients.usagestats}") private String usagestatsBaseAddress; - @Value("${search.api.usageEvents}") + @Value("${services.provide.clients.usageEvents}") private String usagestatsEvents; @Override diff --git a/src/main/java/eu/dnetlib/repo/manager/service/SushiliteServiceImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/SushiliteServiceImpl.java index c7b0a0a..90bb074 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/SushiliteServiceImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/SushiliteServiceImpl.java @@ -19,7 +19,7 @@ import java.util.List; public class SushiliteServiceImpl implements SushiliteService { - @Value("${services.repomanager.usagestats.sushiliteEndpoint}") + @Value("${services.provide.usagestats.sushiliteEndpoint}") private String usagestatsSushiliteEndpoint; private static final org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger.getLogger(SushiliteServiceImpl.class); diff --git a/src/main/java/eu/dnetlib/repo/manager/service/UserServiceImpl.java b/src/main/java/eu/dnetlib/repo/manager/service/UserServiceImpl.java index 8e736ab..0d3a6fd 100644 --- a/src/main/java/eu/dnetlib/repo/manager/service/UserServiceImpl.java +++ b/src/main/java/eu/dnetlib/repo/manager/service/UserServiceImpl.java @@ -19,9 +19,6 @@ public class UserServiceImpl implements UserService { private static final org.apache.log4j.Logger LOGGER = org.apache.log4j.Logger .getLogger(UserServiceImpl.class); - @Value("${oidc.issuer}") - private String oidc_issuer; - @Override public ResponseEntity