Project

General

Profile

« Previous | Next » 

Revision e6b01164

Added by Andreas Kohlbecker about 7 years ago

ref

View differences:

ide/eclipse/Jetty Launcher/cdm-vaadin - run.launch
46 46
<booleanAttribute key="net.sourceforge.eclipsejetty.launcher.threadPool.limit.enabled" value="false"/>
47 47
<stringAttribute key="net.sourceforge.eclipsejetty.launcher.webappdir" value="src/main/webapp"/>
48 48
<stringAttribute key="net.sourceforge.eclipsejetty.launcher.websocket.enabled" value="false"/>
49
<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
50
<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
51
<listEntry value="org.eclipse.debug.ui.launchGroup.run"/>
52
</listAttribute>
49 53
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
50 54
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="net.sourceforge.eclipsejetty.launcher.JettyLaunchClassPathProvider"/>
51 55
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="net.sourceforge.eclipsejetty.starter.embedded.JettyEmbeddedLauncherMain"/>
52 56
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="cdm-vaadin"/>
53
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dlog4j.configDebug=true&#10;-Dlog4j.configuration=file:///${system_property:user.home}/.cdmLibrary/log4j.properties"/>
57
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-Dlog4j.configDebug=false&#10;-Dlog4j.configuration=file:///${system_property:user.home}/.cdmLibrary/log4j.properties"/>
54 58
</launchConfiguration>
src/main/java/eu/etaxonomy/cdm/addon/config/CdmVaadinConfiguration.java
1
/**
2
* Copyright (C) 2017 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.addon.config;
10

  
11
import org.apache.log4j.Logger;
12
import org.springframework.context.annotation.ComponentScan;
13
import org.springframework.context.annotation.Configuration;
14

  
15
import com.vaadin.spring.annotation.EnableVaadin;
16

  
17
/**
18
 *
19
 * @author a.kohlbecker
20
 * @since Feb 8, 2017
21
 *
22
 */
23
@Configuration
24
@ComponentScan(basePackages={"eu.etaxonomy.cdm.vaadin"})
25
@EnableVaadin   // this imports VaadinConfiguration
26
public class CdmVaadinConfiguration {
27

  
28
    public static final Logger logger = Logger.getLogger(CdmVaadinConfiguration.class);
29

  
30
//    @Configuration
31
//    @EnableVaadin
32
//    @Order(value=1)
33
//    public static class CdmVaadinEnabler {
34
//
35
//        public CdmVaadinEnabler() {
36
//            logger.debug("CdmVaadinConfiguration enabled");
37
//        }
38
//
39
//    }
40
//
41
//    @Configuration
42
//    @ComponentScan(basePackages={"eu.etaxonomy.cdm.vaadin"})
43
//    @Order(value=2)
44
//    public static class CdmVaadinScanner {
45
//
46
//        public CdmVaadinScanner() {
47
//            logger.debug("CdmVaadinScanner enabled");
48
//        }
49
//
50
//    }
51

  
52

  
53

  
54
    public CdmVaadinConfiguration() {
55
        logger.debug("CdmVaadinConfiguration enabled");
56
    }
57

  
58
}
src/main/java/eu/etaxonomy/cdm/addon/config/README
1
The package eu.etaxonomy.cdm.addon.config is an extension point where
2
addon-modules can place their Spring configuration classes. 
3
A component scan defined in cdmlib-remote-webapp will find them:
4
  
5
  <context:component-scan base-package="eu/etaxonomy/cdm/addon/config" />
6
  
src/main/java/eu/etaxonomy/cdm/vaadin/conf/CdmVaadinConfiguration.java
1
/**
2
* Copyright (C) 2017 EDIT
3
* European Distributed Institute of Taxonomy
4
* http://www.e-taxonomy.eu
5
*
6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7
* See LICENSE.TXT at the top of this package for the full license terms.
8
*/
9
package eu.etaxonomy.cdm.vaadin.conf;
10

  
11
import org.apache.log4j.Logger;
12
import org.springframework.context.annotation.Configuration;
13

  
14
import com.vaadin.spring.annotation.EnableVaadin;
15

  
16
/**
17
 *
18
 * @author a.kohlbecker
19
 * @since Feb 8, 2017
20
 *
21
 */
22
@Configuration
23
@EnableVaadin   // this imports VaadinConfiguration
24
public class CdmVaadinConfiguration {
25

  
26

  
27
    public static final Logger logger = Logger.getLogger(CdmVaadinConfiguration.class);
28

  
29
    public CdmVaadinConfiguration() {
30
        logger.debug("CdmVaadinConfiguration enabled");
31
    }
32

  
33
}
src/main/java/eu/etaxonomy/cdm/vaadin/container/TaxonNodeContainer.java
4 4
import java.util.HashMap;
5 5
import java.util.Map;
6 6

  
7
import org.springframework.beans.factory.annotation.Autowired;
8

  
7 9
import com.vaadin.data.Item;
8 10
import com.vaadin.data.util.HierarchicalContainer;
9 11

  
12
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
10 13
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
11 14
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
12
import eu.etaxonomy.cdm.vaadin.util.CdmSpringContextHelper;
13 15

  
14 16
public class TaxonNodeContainer extends HierarchicalContainer {
15 17

  
16 18
	private static final long serialVersionUID = 102401340698963360L;
19

  
17 20
	public static final String LABEL = "titleCache";
21

  
18 22
	private Map<Object, Object> itemCache = new HashMap<>();
19 23

  
24
	@Autowired
25
	private ITaxonNodeService taxonNodeService;
20 26
	/**
21 27
     * Creates a new taxon node container
22 28
	 * @param roots the root elements of the table
......
49 55
     */
50 56
    public void addChildItems(UuidAndTitleCache<TaxonNode> parent) {
51 57
        if(itemCache.get(parent.getId()).equals(Boolean.FALSE)){
52
            Collection<UuidAndTitleCache<TaxonNode>> children = CdmSpringContextHelper.getTaxonNodeService().listChildNodesAsUuidAndTitleCache(parent);
58
            Collection<UuidAndTitleCache<TaxonNode>> children = taxonNodeService.listChildNodesAsUuidAndTitleCache(parent);
53 59
            setChildrenAllowed(parent, !children.isEmpty());
54 60
            for (UuidAndTitleCache<TaxonNode> child : children) {
55 61
                Item childItem = addItem(child);
56 62
                if(childItem!=null){
57 63
                    setParent(child, parent);
58 64
                }
59
                Collection<UuidAndTitleCache<TaxonNode>> grandChildren = CdmSpringContextHelper.getTaxonNodeService().listChildNodesAsUuidAndTitleCache(child);
65
                Collection<UuidAndTitleCache<TaxonNode>> grandChildren = taxonNodeService.listChildNodesAsUuidAndTitleCache(child);
60 66
                setChildrenAllowed(child, !grandChildren.isEmpty());
61 67
            }
62 68
            itemCache.put(parent.getId(), true);
src/main/java/eu/etaxonomy/cdm/vaadin/presenter/AuthenticationPresenter.java
14 14
import eu.etaxonomy.cdm.vaadin.util.CdmVaadinSessionUtilities;
15 15
import eu.etaxonomy.cdm.vaadin.view.IAuthenticationComponent;
16 16

  
17

  
18

  
19 17
public class AuthenticationPresenter implements IAuthenticationComponent.AuthenticationComponentListener{
20 18

  
21 19
    @Override
src/main/java/eu/etaxonomy/cdm/vaadin/ui/ConceptRelationshipUI.java
29 29
 *
30 30
 */
31 31
@Theme("edit")
32
@SpringUI(path="/app/concept")
32
@SpringUI(path="concept")
33 33
@Widgetset("eu.etaxonomy.cdm.vaadin.AppWidgetSet")
34 34
public class ConceptRelationshipUI extends AbstractAuthenticatedUI {
35 35

  
......
39 39

  
40 40
    private final static Logger logger = Logger.getLogger(ConceptRelationshipUI.class);
41 41

  
42
    @WebServlet(value = {"/*"}, asyncSupported = true)
42
    @WebServlet(value = {"/app/*"}, asyncSupported = true)
43 43
    public static class Servlet extends SpringVaadinServlet {
44 44
    }
45 45

  
src/main/java/eu/etaxonomy/cdm/vaadin/ui/ConceptRelationshipUIRedirect.java
25 25
 *
26 26
 */
27 27
@Theme("edit")
28
// @SpringUI(path="/app/concept") // not needed since this UI is used in the context of ConceptRelationshipUI
28
// @SpringUI(path="concept") // not needed since this UI is used in the context of ConceptRelationshipUI
29 29
@Widgetset("eu.etaxonomy.cdm.vaadin.AppWidgetSet")
30 30
public class ConceptRelationshipUIRedirect extends AbstractAuthenticatedUI {
31 31

  
......
36 36
    private final static Logger logger = Logger.getLogger(ConceptRelationshipUIRedirect.class);
37 37

  
38 38
// not needed since this UI is used in the context of ConceptRelationshipUI
39
//    @WebServlet(value = {"/*"}, asyncSupported = true)
39
//    @WebServlet(value = {"/app/*"}, asyncSupported = true)
40 40
//    public static class Servlet extends SpringVaadinServlet {
41 41
//    }
42 42

  
src/main/java/eu/etaxonomy/cdm/vaadin/ui/DbStatusUI.java
17 17

  
18 18
@Theme("macosx")
19 19
@Title("CDM Board")
20
@SpringUI(path="/app/distribution")
20
@SpringUI(path="distribution")
21 21
@Widgetset("eu.etaxonomy.cdm.vaadin.AppWidgetSet")
22 22
@SuppressWarnings("serial")
23 23
public class DbStatusUI extends AbstractAuthenticatedUI{
......
26 26

  
27 27
	private static final String FIRST_VIEW = "firstView";
28 28

  
29
	@WebServlet(urlPatterns = {"/*"}, name="DbStatusUIServlet", asyncSupported = true)
29
	@WebServlet(urlPatterns = {"/app/*"}, name="DbStatusUIServlet", asyncSupported = true)
30 30
	public static class Servlet extends CdmVaadinConversationalServlet {
31 31
	}
32 32

  
src/main/java/eu/etaxonomy/cdm/vaadin/ui/DbStatusUIRedirect.java
11 11

  
12 12
@Theme("edit")
13 13
@Title("CDM Board")
14
// @SpringUI(path="/app/distribution") // not needed since this UI is used in the context of DbStatusUI
14
// @SpringUI(path="distribution") // not needed since this UI is used in the context of DbStatusUI
15 15
@Widgetset("eu.etaxonomy.cdm.vaadin.AppWidgetSet")
16 16
@SuppressWarnings("serial")
17 17
public class DbStatusUIRedirect extends AbstractAuthenticatedUI{
......
19 19
	private static final String FIRST_VIEW = "firstView";
20 20

  
21 21
// not needed since this UI is used in the context of DbStatusUI
22
//	@WebServlet(value = {"/*"}, asyncSupported = true)
22
//	@WebServlet(value = {"/app/*"}, asyncSupported = true)
23 23
//	public static class Servlet extends CdmVaadinConversationalServlet {
24 24
//	}
25 25

  
src/main/java/eu/etaxonomy/cdm/vaadin/ui/StatusEditorUI.java
29 29
 *
30 30
 */
31 31
@Theme("edit")
32
@SpringUI(path="/app/editstatus")
32
@SpringUI(path="editstatus")
33 33
@Widgetset("eu.etaxonomy.cdm.vaadin.AppWidgetSet")
34 34
public class StatusEditorUI extends AbstractAuthenticatedUI {
35 35

  
......
44 44
     * @WebServlets is mapped to the root path. It is sufficient to configure one of the
45 45
     * servlets with this path see BookOfVaadin 5.9.5. Servlet Mapping with URL Patterns
46 46
     */
47
    @WebServlet(value = {"/*", "/VAADIN/*"}, asyncSupported = true)
47
    @WebServlet(value = {"/app/*", "/VAADIN/*"}, asyncSupported = true)
48 48
    public static class Servlet extends SpringVaadinServlet {
49 49
    }
50 50

  
src/main/java/eu/etaxonomy/cdm/vaadin/util/CdmSpringContextHelper.java
34 34
 * been written to retrieve the beans given the bean name.
35 35
 *
36 36
 * @author c.mathew
37
 * @deprecated no longer needed since vaadin-spring is being used
37
 *
38
 * TODO This class may no longer needed in a couple of cases since vaadin-spring
39
 * is being used and spring beans can be injected now.
40
 *
38 41
 */
39
@Deprecated
40 42
public class CdmSpringContextHelper {
41 43

  
42 44
    private final ApplicationContext context;
src/main/webapp/WEB-INF/applicationContext.xml
8 8
    http://www.springframework.org/schema/tx   http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
9 9
    ">
10 10

  
11
   <context:annotation-config/>
11
  <!-- 
12
    NOTE: 
13
    For a detailed overview on the spring MVC and application context configuration and 
14
    bootstrapping of this web application see: 
15
    http://dev.e-taxonomy.eu/trac/wiki/cdmlib-remote-webappConfigurationAndBootstrapping
16
  -->
12 17
   
13
   <bean class="eu.etaxonomy.cdm.vaadin.conf.CdmVaadinConfiguration" />
14
   <context:component-scan base-package="eu/etaxonomy/cdm/vaadin" />
18
   <context:annotation-config />
19
   
20
    <!--  
21
        find the eu.etaxonomy.cdm.remote.config.CdmVaadinConfiguration
22
    -->
23
   <context:component-scan base-package="eu/etaxonomy/cdm/addon/config" />
15 24
    
16 25
   <!-- include default application context and customization -->
17
    <import resource="classpath:/eu/etaxonomy/cdm/defaultApplicationContext.xml"/>
18
    <bean id="persistentTermInitializer" class="eu.etaxonomy.cdm.database.PersistentTermInitializer">
26
   <import resource="classpath:/eu/etaxonomy/cdm/defaultApplicationContext.xml"/>
27
   
28
   <bean id="persistentTermInitializer" class="eu.etaxonomy.cdm.database.PersistentTermInitializer">
19 29
       <property name="omit" value="false" />
20
    </bean>
30
   </bean>
21 31
   <context:component-scan base-package="eu/etaxonomy/cdm/ext" />
22 32

  
23
<!--    <import resource="classpath:/eu/etaxonomy/cdm/remote-security.xml"/> -->
33
    <import resource="classpath:/eu/etaxonomy/cdm/remote.xml"/>
24 34
    <context:component-scan base-package="eu/etaxonomy/cdm/io">
25 35
        <context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.io\.pesi.*" />
26 36
        <context:exclude-filter type="regex" expression="eu\.etaxonomy\.cdm\.io\.faunaEuropaea.*" />
......
39 49
    </bean>
40 50

  
41 51
    <!-- enable the configuration of transactional behavior based on annotations -->
42
    <tx:annotation-driven transaction-manager="transactionManager"/>
43

  
44

  
52
    <tx:annotation-driven transaction-manager="transactionManager" />
53
  	
54
  	<!-- import additional beans into the root context (this is in cdmlib-remote-webapp) -->
55
  	<!-- <import resource="applicationContext.views.xml" />  -->
56
  
45 57
    <!-- import configuration of the datasource bean -->
46 58
    <import resource="datasources/configurable.xml" />
47 59
    
48
  <!--   
49
    <bean class="eu.etaxonomy.cdm.opt.config.LoggingConfigurer">
50
    </bean>
51
 -->
60
    <!-- bootstrap the Web Configuration -->
61
  	<bean class="eu.etaxonomy.cdm.remote.config.MultiWebSecurityConfiguration" />
62
 
63
    <bean class="eu.etaxonomy.cdm.opt.config.LoggingConfigurer" />
64

  
65
    <bean class="eu.etaxonomy.cdm.opt.config.EhCacheDiskStoreConfiguration" />
52 66
 
53
  <bean id="serializableFactory" class="org.springmodules.cache.serializable.XStreamSerializableFactory"/>
67
    <bean id="serializableFactory" class="org.springmodules.cache.serializable.XStreamSerializableFactory" />
54 68

  
55
  <bean id="cacheProviderFacade" class="org.springmodules.cache.provider.ehcache.EhCacheFacade">
56
      <property name="cacheManager" ref="cacheManager" />
57
      <property name="serializableFactory" ref="serializableFactory"/>
58
  </bean>
69
    <bean id="cacheProviderFacade" class="org.springmodules.cache.provider.ehcache.EhCacheFacade">
70
        <!-- 
71
            the cacheManager is provided by the eu.etaxonomy.cdm.api.config.EhCacheConfiguration
72
            in cdmlib-services
73
        -->
74
        <property name="cacheManager" ref="cacheManager" />
75
        <property name="serializableFactory" ref="serializableFactory"/>
76
    </bean>
59 77

  
60 78
</beans>
src/main/webapp/WEB-INF/cdm-vaadin-servlet.xml
8 8
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
9 9
    ">
10 10

  
11
  <!-- 
12
    Initialize SpringMVCConfig and its dependency SpringSwaggerConfig.
13
    All further component scans are defined in this mvc configuration class 
14
  <context:component-scan base-package="eu/etaxonomy/cdm/remote/config" />
15
  <context:component-scan base-package="eu/etaxonomy/cdm/vaadin" />
16
  -->
17
  
11 18
</beans>
src/main/webapp/WEB-INF/web.xml
4 4
      xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
5 5
      version="3.0"> 
6 6

  
7
  <!-- 
8
       NOTE: For a detailed overview on the spring MVC and application context 
9
       configuration and bootstrapping of this web application 
10
       see: http://dev.e-taxonomy.eu/trac/wiki/cdmlib-remote-webappConfigurationAndBootstrapping 
11
  -->
12

  
7 13
    <description>cdmlib-vaadin web-application instance</description>
8 14
    <display-name>cdmlib-vaadin</display-name>
9 15

  
......
50 56
      <filter-name>charsetFilter</filter-name>
51 57
      <url-pattern>/*</url-pattern>
52 58
    </filter-mapping>
53
    
59
  
60
    <!-- Remoting Security -->
61

  
62
    <filter>
63
      <filter-name>springSecurityFilterChain</filter-name>
64
      <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
65
    </filter>
66
    <filter-mapping>
67
      <filter-name>springSecurityFilterChain</filter-name>
68
      <url-pattern>/*</url-pattern>
69
    </filter-mapping>
70
  
54 71
    <!-- 
55 72
      The production mode is disabled per default.
56 73
      
src/test/java/eu/etaxonomy/cdm/vaadin/ui/CheckTestUI.java
14 14
import com.vaadin.ui.VerticalLayout;
15 15

  
16 16
@Theme("edit")
17
@SpringUI(path="/app-test/*")
17
@SpringUI(path="")
18 18
@Widgetset("eu.etaxonomy.cdm.vaadin.AppWidgetSet")
19 19
@SuppressWarnings("serial")
20 20
public class CheckTestUI extends UI {
21 21

  
22 22

  
23
    @WebServlet(value = {"/*", "/VAADIN/*"}, asyncSupported = true)
23
    @WebServlet(value = {"/app-test/*", "/VAADIN/*"}, asyncSupported = true)
24 24
    public static class Servlet extends SpringVaadinServlet {
25 25
    }
26 26

  
src/test/java/eu/etaxonomy/cdm/vaadin/ui/D3CTreeUI.java
28 28
 *
29 29
 */
30 30
@Theme("edit")
31
@SpringUI(path="/app-test/d3ctree")
31
@SpringUI(path="d3ctree")
32 32
@Widgetset("eu.etaxonomy.cdm.vaadin.AppWidgetSet")
33 33
public class D3CTreeUI extends UI {
34 34

  
35 35
    private final static Logger logger =
36 36
            Logger.getLogger(D3CTreeUI.class.getName());
37 37

  
38
    @WebServlet(value = {"/*"}, asyncSupported = true)
38
    @WebServlet(value = {"/app-test/*"}, asyncSupported = true)
39 39
    public static class Servlet extends SpringVaadinServlet {
40 40

  
41 41
    }
src/test/java/eu/etaxonomy/cdm/vaadin/ui/NavigatorTestUI.java
15 15
import eu.etaxonomy.cdm.vaadin.view.NaviTestView;
16 16

  
17 17
@Theme("edit")
18
@SpringUI(path="/app-test/navi")
18
@SpringUI(path="navi")
19 19
@Widgetset("eu.etaxonomy.cdm.vaadin.AppWidgetSet")
20 20
public class NavigatorTestUI extends AbstractAuthenticatedUI {
21 21

  
......
27 27
	private final static Logger logger =
28 28
			Logger.getLogger(NavigatorTestUI.class.getName());
29 29

  
30
	@WebServlet(value = {"/*"}, asyncSupported = true)
30
	@WebServlet(value = {"/app-test/*"}, asyncSupported = true)
31 31
	public static class Servlet extends CdmVaadinConversationalServlet {
32 32

  
33 33
	}
src/test/resources/webapp/WEB-INF/applicationContext.xml
11 11

  
12 12
    <context:property-override location="classpath:override.properties"/>
13 13
    
14
    <bean class="eu.etaxonomy.cdm.vaadin.conf.CdmVaadinConfiguration" />
15
    <context:component-scan base-package="eu/etaxonomy/cdm/vaadin" />
14
    <context:component-scan base-package="eu/etaxonomy/cdm/api/config" />
16 15

  
17 16
    <context:component-scan base-package="eu/etaxonomy/cdm/api/service">
18
    </context:component-scan>
19
        <context:component-scan base-package="eu/etaxonomy/cdm/api/config">
20 17
    </context:component-scan>
21 18
    
22 19
    <context:component-scan base-package="eu/etaxonomy/cdm/api/application">

Also available in: Unified diff