diff --git a/wise-webapp/db/wisemapping.properties b/wise-webapp/db/wisemapping.properties new file mode 100644 index 00000000..69efbd3e --- /dev/null +++ b/wise-webapp/db/wisemapping.properties @@ -0,0 +1,5 @@ +#HSQL Database Engine 2.7.1 +#Fri Nov 24 19:26:20 PST 2023 +modified=yes +tx_timestamp=458 +version=2.7.1 diff --git a/wise-webapp/db/wisemapping.script b/wise-webapp/db/wisemapping.script new file mode 100644 index 00000000..691beff2 --- /dev/null +++ b/wise-webapp/db/wisemapping.script @@ -0,0 +1,46 @@ +SET DATABASE UNIQUE NAME HSQLDB8C04588647 +SET DATABASE DEFAULT RESULT MEMORY ROWS 0 +SET DATABASE EVENT LOG LEVEL 0 +SET DATABASE TRANSACTION CONTROL LOCKS +SET DATABASE DEFAULT ISOLATION LEVEL READ COMMITTED +SET DATABASE TRANSACTION ROLLBACK ON CONFLICT TRUE +SET DATABASE TEXT TABLE DEFAULTS '' +SET DATABASE SQL NAMES FALSE +SET DATABASE SQL RESTRICT EXEC FALSE +SET DATABASE SQL REFERENCES FALSE +SET DATABASE SQL SIZE TRUE +SET DATABASE SQL TYPES FALSE +SET DATABASE SQL TDC DELETE TRUE +SET DATABASE SQL TDC UPDATE TRUE +SET DATABASE SQL SYS INDEX NAMES TRUE +SET DATABASE SQL CONCAT NULLS TRUE +SET DATABASE SQL UNIQUE NULLS TRUE +SET DATABASE SQL CONVERT TRUNCATE TRUE +SET DATABASE SQL AVG SCALE 0 +SET DATABASE SQL DOUBLE NAN TRUE +SET FILES WRITE DELAY 500 MILLIS +SET FILES BACKUP INCREMENT TRUE +SET FILES CACHE SIZE 10000 +SET FILES CACHE ROWS 50000 +SET FILES SCALE 32 +SET FILES LOB SCALE 32 +SET FILES DEFRAG 0 +SET FILES NIO TRUE +SET FILES NIO SIZE 256 +SET FILES LOG TRUE +SET FILES LOG SIZE 50 +SET FILES CHECK 458 +SET DATABASE COLLATION "SQL_TEXT" PAD SPACE +CREATE USER SA PASSWORD DIGEST 'd41d8cd98f00b204e9800998ecf8427e' +ALTER USER SA SET LOCAL TRUE +CREATE SCHEMA PUBLIC AUTHORIZATION DBA +ALTER SEQUENCE SYSTEM_LOBS.LOB_ID RESTART WITH 1 +SET DATABASE DEFAULT INITIAL SCHEMA PUBLIC +GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.CARDINAL_NUMBER TO PUBLIC +GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.YES_OR_NO TO PUBLIC +GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.CHARACTER_DATA TO PUBLIC +GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.SQL_IDENTIFIER TO PUBLIC +GRANT USAGE ON DOMAIN INFORMATION_SCHEMA.TIME_STAMP TO PUBLIC +GRANT DBA TO SA +SET SCHEMA SYSTEM_LOBS +INSERT INTO BLOCKS VALUES(0,2147483647,0) diff --git a/wise-webapp/pom.xml b/wise-webapp/pom.xml index 9a5d45b0..3e42f21d 100644 --- a/wise-webapp/pom.xml +++ b/wise-webapp/pom.xml @@ -2,19 +2,22 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> 4.0.0 wise-webapp - war WiseMapping Webapp http://www.wisemapping.org + 5.1.0-SNAPSHOT + - org.wisemapping - wisemapping - ../pom.xml - 5.1.0-SNAPSHOT + org.springframework.boot + spring-boot-starter-parent + 3.1.2 - 6.0.14 - 6.1.5 + 5.1.0-SNAPSHOT + 17 + 17 + 6.0.11 + 6.1.2 6.0.2 @@ -31,6 +34,27 @@ 1.7 compile + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-tomcat + + + org.springframework.boot + spring-boot-starter-security + + + org.springframework.boot + spring-boot-starter-data-jpa + + + org.springframework.boot + spring-boot-starter-mail + + org.testng testng @@ -43,55 +67,42 @@ 12.0 compile - - org.springframework - spring-webmvc - ${org.springframework.version} - compile - - - org.springframework - spring-messaging - ${org.springframework.version} - - - org.springframework - spring-websocket - ${org.springframework.version} - + + + + + + + + + + org.postgresql postgresql 42.5.4 - - org.springframework - spring-beans - ${org.springframework.version} - compile - - - org.springframework - spring-tx - ${org.springframework.version} - compile - + + + + + + + + + + + + org.springframework.security spring-security-taglibs ${spring-security-taglibs.version} - - - org.hibernate - hibernate-core - 6.1.7.Final - - jakarta.xml.bind jakarta.xml.bind-api - 4.0.1 + 4.0.0 @@ -100,78 +111,6 @@ hibernate-validator 8.0.1.Final - - - org.springframework - spring-orm - ${org.springframework.version} - compile - - - org.springframework - spring-context - ${org.springframework.version} - compile - - - org.springframework - spring-web - ${org.springframework.version} - compile - - - org.springframework - spring-oxm - ${org.springframework.version} - compile - - - org.springframework - spring-context-support - ${org.springframework.version} - compile - - - org.springframework.data - spring-data-jpa - 3.1.0 - - - org.springframework - spring-test - 6.0.6 - test - - - - org.springframework - spring-aop - ${org.springframework.version} - - - org.springframework.security - spring-security-web - ${org.springframework.addons} - compile - - - org.springframework.security - spring-security-core - ${org.springframework.addons} - compile - - - org.springframework - spring-jdbc - ${org.springframework.version} - runtime - - - aopalliance - aopalliance - 1.0 - compile - jakarta.mail jakarta.mail-api @@ -280,10 +219,9 @@ org.hsqldb hsqldb - 2.7.1 + 2.7.2 - drop-schemas @@ -395,6 +333,8 @@ + + org.apache.maven.plugins maven-surefire-plugin diff --git a/wise-webapp/src/main/java/com/wisemapping/config/Application.java b/wise-webapp/src/main/java/com/wisemapping/config/Application.java index 54b02bda..76759277 100644 --- a/wise-webapp/src/main/java/com/wisemapping/config/Application.java +++ b/wise-webapp/src/main/java/com/wisemapping/config/Application.java @@ -1,11 +1,12 @@ package com.wisemapping.config; -import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.ImportResource; -import org.springframework.transaction.TransactionManager; +import org.springframework.data.jpa.repository.config.EnableJpaRepositories; import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.web.servlet.HandlerExceptionResolver; import org.springframework.web.servlet.ViewResolver; @@ -18,11 +19,18 @@ import org.springframework.web.servlet.view.JstlView; @Configuration @EnableTransactionManagement @ComponentScan +@SpringBootApplication +@EnableJpaRepositories("com.wisemapping.model") @ImportResource("classpath:spring/wisemapping-common.xml") public class Application { + + public static void main(String[] args) { + SpringApplication.run(Application.class, args); + } + @Bean HandlerExceptionResolver errorHandler() { - final SimpleMappingExceptionResolver result = new SimpleMappingExceptionResolver(); + final SimpleMappingExceptionResolver result = new SimpleMappingExceptionResolver(); //mapping status code with view response. result.addStatusCode("reactInclude", 403); @@ -34,7 +42,7 @@ public class Application { } @Bean - public ViewResolver viewResolver(){ + public ViewResolver viewResolver() { InternalResourceViewResolver resolver = new InternalResourceViewResolver(); resolver.setPrefix("/WEB-INF/views/"); resolver.setSuffix(".jsp"); diff --git a/wise-webapp/src/main/java/com/wisemapping/config/HibernateConfig.java b/wise-webapp/src/main/java/com/wisemapping/config/HibernateConfig.java index 401f7f0a..1caa213b 100644 --- a/wise-webapp/src/main/java/com/wisemapping/config/HibernateConfig.java +++ b/wise-webapp/src/main/java/com/wisemapping/config/HibernateConfig.java @@ -1,8 +1,6 @@ package com.wisemapping.config; import org.apache.commons.dbcp2.BasicDataSource; -import org.hibernate.SessionFactory; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; @@ -17,72 +15,72 @@ import java.util.Properties; @EnableTransactionManagement public class HibernateConfig { - @Value("${database.hibernate.dialect}") - private String dbDialect; +// @Value("${database.hibernate.dialect}") +// private String dbDialect; +// +// @Value("${database.driver}") +// private String dbDriver; +// +// @Value("${database.url}") +// private String dbUrl; +// +// @Value("${database.username}") +// private String dbUsername; +// @Value("${database.password}") +// private String dbPassword; +// +// @Value("${database.validation.enabled:true}") +// private boolean dbSetOnBorrow; +// +// @Value("${database.validation.query:SELECT 1}") +// private String dbValQuery; - @Value("${database.driver}") - private String dbDriver; - - @Value("${database.url}") - private String dbUrl; - - @Value("${database.username}") - private String dbUsername; - @Value("${database.password}") - private String dbPassword; - - @Value("${database.validation.enabled:true}") - private boolean dbSetOnBorrow; - - @Value("${database.validation.query:SELECT 1}") - private String dbValQuery; - - @Bean - public LocalSessionFactoryBean sessionFactory() { - final LocalSessionFactoryBean result = new LocalSessionFactoryBean(); - result.setPackagesToScan("com.wisemapping.model"); - result.setDataSource(dataSource()); - result.setHibernateProperties(hibernateProperties()); - - return result; - } - - - @Bean - public HibernateTransactionManager hibernateTransactionManager() { - final HibernateTransactionManager result = new HibernateTransactionManager(); - result.setNestedTransactionAllowed(true); - // @Todo: Am I creatting two instances ??? - result.setSessionFactory(sessionFactory().getObject()); - return result; - } - - private Properties hibernateProperties() { - final Properties result = new Properties(); - result.setProperty("hibernate.dialect", dbDialect); - result.setProperty("hibernate.default_batch_fetch_size", "200"); - result.setProperty("hibernate.nestedTransactionAllowed", "true"); - result.setProperty("hibernate.auto_quote_keyword", "true"); - - return result; - } - - @Bean - public DataSource dataSource() { - final BasicDataSource result = new BasicDataSource(); - result.setDriverClassName(dbDriver); - result.setUrl(dbUrl); - result.setUsername(dbUsername); - result.setPassword(dbPassword); - result.setTestOnBorrow(dbSetOnBorrow); - - result.setDefaultQueryTimeout(15); - result.setMaxTotal(100); - result.setMaxIdle(30); - result.setInitialSize(5); - result.setMaxWaitMillis(10000); - result.setValidationQuery(dbValQuery); - - return result; - } +// @Bean +// public LocalSessionFactoryBean sessionFactory() { +// final LocalSessionFactoryBean result = new LocalSessionFactoryBean(); +// result.setPackagesToScan("com.wisemapping.model"); +// result.setDataSource(dataSource()); +// result.setHibernateProperties(hibernateProperties()); +// +// return result; +// } +// +// +// @Bean +// public HibernateTransactionManager hibernateTransactionManager() { +// final HibernateTransactionManager result = new HibernateTransactionManager(); +// result.setNestedTransactionAllowed(true); +// // @Todo: Am I creatting two instances ??? +// result.setSessionFactory(sessionFactory().getObject()); +// return result; +// } +// +// private Properties hibernateProperties() { +// final Properties result = new Properties(); +// result.setProperty("hibernate.dialect", dbDialect); +// result.setProperty("hibernate.default_batch_fetch_size", "200"); +// result.setProperty("hibernate.nestedTransactionAllowed", "true"); +// result.setProperty("hibernate.auto_quote_keyword", "true"); +// +// return result; +// } +// +// @Bean +// public DataSource dataSource() { +// final BasicDataSource result = new BasicDataSource(); +// result.setDriverClassName(dbDriver); +// result.setUrl(dbUrl); +// result.setUsername(dbUsername); +// result.setPassword(dbPassword); +// result.setTestOnBorrow(dbSetOnBorrow); +// +// result.setDefaultQueryTimeout(15); +// result.setMaxTotal(100); +// result.setMaxIdle(30); +// result.setInitialSize(5); +// result.setMaxWaitMillis(10000); +// result.setValidationQuery(dbValQuery); +// +// return result; +// } } diff --git a/wise-webapp/src/main/java/com/wisemapping/dao/UserManagerImpl.java b/wise-webapp/src/main/java/com/wisemapping/dao/UserManagerImpl.java index d47bc41b..78c013b6 100644 --- a/wise-webapp/src/main/java/com/wisemapping/dao/UserManagerImpl.java +++ b/wise-webapp/src/main/java/com/wisemapping/dao/UserManagerImpl.java @@ -39,7 +39,7 @@ import java.util.concurrent.CopyOnWriteArraySet; @Repository public class UserManagerImpl implements UserManager { - @Autowired +// @Autowired private SessionFactory sessionFactory; @Autowired diff --git a/wise-webapp/src/main/java/com/wisemapping/filter/RequestPropertiesInterceptor.java b/wise-webapp/src/main/java/com/wisemapping/filter/RequestPropertiesInterceptor.java index ddc03d1b..00c5d1cb 100644 --- a/wise-webapp/src/main/java/com/wisemapping/filter/RequestPropertiesInterceptor.java +++ b/wise-webapp/src/main/java/com/wisemapping/filter/RequestPropertiesInterceptor.java @@ -48,7 +48,7 @@ public class RequestPropertiesInterceptor implements HandlerInterceptor { @Value("${site.homepage}") private String siteHomepage; - @Value("${site.baseurl}") + @Value("${site.baseurl:}") private String siteUrl; @Value("${security.type}") @@ -75,7 +75,7 @@ public class RequestPropertiesInterceptor implements HandlerInterceptor { request.setAttribute("security.type", securityType); // If the property could not be resolved, try to infer one from the request... - if ("${site.baseurl}".equals(siteUrl)) { + if (siteUrl.isBlank()) { siteUrl = request.getRequestURL().toString().replace(request.getRequestURI(), request.getContextPath()); } request.setAttribute("site.baseurl", siteUrl); diff --git a/wise-webapp/src/main/java/com/wisemapping/service/MailerService.java b/wise-webapp/src/main/java/com/wisemapping/service/MailerService.java index fabd6385..93c512d2 100644 --- a/wise-webapp/src/main/java/com/wisemapping/service/MailerService.java +++ b/wise-webapp/src/main/java/com/wisemapping/service/MailerService.java @@ -50,7 +50,7 @@ public final class MailerService { @Value("${mail.supportEmail}") private String supportEmail; - @Value("${mail.errorReporterEmail}") + @Value("${mail.errorReporterEmail:}") private String errorReporterEmail; //~ Methods .............................................................................................. diff --git a/wise-webapp/src/main/java/com/wisemapping/service/google/GoogleService.java b/wise-webapp/src/main/java/com/wisemapping/service/google/GoogleService.java index 0978a311..8bbb6267 100644 --- a/wise-webapp/src/main/java/com/wisemapping/service/google/GoogleService.java +++ b/wise-webapp/src/main/java/com/wisemapping/service/google/GoogleService.java @@ -34,15 +34,15 @@ import com.wisemapping.service.google.http.HttpInvokerException; public class GoogleService { @Autowired private HttpInvoker httpInvoker; - @Value("${security.oauth2.google.confirmUrl}") + @Value("${security.oauth2.google.confirmUrl:}") private String optinConfirmUrl; - @Value("${security.oauth2.google.userinfoUrl}") + @Value("${security.oauth2.google.userinfoUrl:}") private String accountBasicDataUrl; - @Value("${security.oauth2.google.clientId}") + @Value("${security.oauth2.google.clientId:}") private String clientId; - @Value("${security.oauth2.google.clientSecret}") + @Value("${security.oauth2.google.clientSecret:}") private String clientSecret; - @Value("${security.oauth2.google.callbackUrl}") + @Value("${security.oauth2.google.callbackUrl:}") private String callbackUrl; public void setHttpInvoker(HttpInvoker httpInvoker) { diff --git a/wise-webapp/src/main/java/com/wisemapping/webmvc/MvcLoginController.java b/wise-webapp/src/main/java/com/wisemapping/webmvc/MvcLoginController.java index 2e972b5e..b21c279c 100644 --- a/wise-webapp/src/main/java/com/wisemapping/webmvc/MvcLoginController.java +++ b/wise-webapp/src/main/java/com/wisemapping/webmvc/MvcLoginController.java @@ -31,7 +31,7 @@ import org.springframework.web.servlet.ModelAndView; @PreAuthorize("permitAll()") public class MvcLoginController { - @Value("${database.driver}") +// @Value("${database.driver}") private String driver; @RequestMapping(value = "login", method = RequestMethod.GET) diff --git a/wise-webapp/src/main/webapp/WEB-INF/app.properties b/wise-webapp/src/main/resources/application.properties similarity index 84% rename from wise-webapp/src/main/webapp/WEB-INF/app.properties rename to wise-webapp/src/main/resources/application.properties index 0046539e..c787ae43 100755 --- a/wise-webapp/src/main/webapp/WEB-INF/app.properties +++ b/wise-webapp/src/main/resources/application.properties @@ -22,15 +22,16 @@ #database.validation.enabled=false -# HSQL Configuration properties -database.url=jdbc:hsqldb:file:${database.base.url}/db/wisemapping -database.driver=org.hsqldb.jdbc.JDBCDriver -database.hibernate.dialect=org.hibernate.dialect.HSQLDialect - -database.username=sa -database.password= -database.validation.enabled=false -database.validation.query= +##database.base.url=/Users/veigap/repos/wisemapping-open-source/wise-webapp +### HSQL Configuration properties +##database.url=jdbc:hsqldb:file:${database.base.url}/db/wisemapping +##database.driver=org.hsqldb.jdbc.JDBCDriver +##database.hibernate.dialect=org.hibernate.dialect.HSQLDialect +# +#database.username=sa +#database.password= +#database.validation.enabled=false +#database.validation.query= ################################################################################## # Mail configuration. Must be configured to enable user registration confirmation. @@ -149,7 +150,9 @@ security.oauth2.google.confirmUrl=https://oauth2.googleapis.com/token # Google service for get user data (name, email, etc) security.oauth2.google.userinfoUrl=https://www.googleapis.com/oauth2/v3/userinfo # Url for starting auth process with google -security.oauth2.google.url=https://accounts.google.com/o/oauth2/v2/auth?redirect_uri=${security.oauth2.google.callbackUrl}&prompt=consent&response_type=code&client_id=${security.oauth2.google.clientId}&scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.profile%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fuserinfo.email&access_type=offline&state=wisemapping&include_granted_scopes=true + +@Todo +security.oauth2.google.url=https//review @@ -161,3 +164,21 @@ security.oauth2.google.url=https://accounts.google.com/o/oauth2/v2/auth?redirect # Coma separated list of domains and emails ban #accounts.exclusion.domain= + +####################################################################################### +# Spring related configurations +####################################################################################### +spring.main.allow-circular-references=true + +database.base.url=/Users/veigap/repos/wisemapping-open-source/wise-webapp +spring.datasource.url=jdbc:hsqldb:file:${database.base.url}/db/wisemapping +spring.datasource.username=sa +spring.datasource.password= +spring.datasource.driver-class-name = org.hsqldb.jdbc.JDBCDriver +spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.HSQLDialect +spring.jpa.open-in-view=true +spring.h2.console.enabled=true +spring.h2.console.path=/h2-ui + + + diff --git a/wise-webapp/src/main/resources/spring/wisemapping-common.xml b/wise-webapp/src/main/resources/spring/wisemapping-common.xml index ef3b1361..c7c41d44 100644 --- a/wise-webapp/src/main/resources/spring/wisemapping-common.xml +++ b/wise-webapp/src/main/resources/spring/wisemapping-common.xml @@ -1,13 +1,10 @@ + http://www.springframework.org/schema/beans/spring-beans.xsd"> - + diff --git a/wise-webapp/src/main/resources/spring/wisemapping-rest.xml b/wise-webapp/src/main/resources/spring/wisemapping-rest.xml index 5c2da2db..fa3b1967 100644 --- a/wise-webapp/src/main/resources/spring/wisemapping-rest.xml +++ b/wise-webapp/src/main/resources/spring/wisemapping-rest.xml @@ -50,12 +50,12 @@ - - - - - messages - - - + + + + + + + + \ No newline at end of file diff --git a/wise-webapp/src/main/resources/spring/wisemapping-servlet.xml b/wise-webapp/src/main/resources/spring/wisemapping-servlet.xml index e194f74b..1c93d70d 100644 --- a/wise-webapp/src/main/resources/spring/wisemapping-servlet.xml +++ b/wise-webapp/src/main/resources/spring/wisemapping-servlet.xml @@ -19,16 +19,16 @@ - - + + + - - - - - messages - - - + + + + + + + +