Project

General

Profile

« Previous | Next » 

Revision d0fbe90d

Added by Cherian Mathew about 10 years ago

comments and javadoc

View differences:

eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationRemoteController.java
1
/**
2
* Copyright (C) 2014 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

  
10

  
1 11
package eu.etaxonomy.cdm.api.application;
2 12

  
3 13
import java.util.List;
......
17 27
import eu.etaxonomy.cdm.common.monitor.SubProgressMonitor;
18 28
import eu.etaxonomy.cdm.remote.ICdmRemoteSource;
19 29

  
30
/**
31
 * CDM Application Controller class for remoting clients
32
 * FIXME:Remoting extending {@link CdmApplicationController} is a temporary workaround.
33
 * The {@link CdmApplicationController} should be split into a CdmApplicationControllerBase
34
 * class with {@link CdmApplicationController} and this class as subclasses
35
 *
36
 */
20 37
public class CdmApplicationRemoteController  extends CdmApplicationController {
21 38
	
22 39
    private static final Logger logger = Logger.getLogger(CdmApplicationRemoteController.class);
......
25 42
    private final Resource applicationContextResource;
26 43
    private final IProgressMonitor progressMonitor;
27 44
    
45
    /**
46
     * Creates new instance of CdmApplicationRemoteController
47
     * 
48
     * @param applicationContextResource
49
     * @param remoteSource
50
     * @param omitTermLoading
51
     * @param progressMonitor
52
     * @param listeners
53
     * @return
54
     */
28 55
    public static CdmApplicationRemoteController NewInstance(Resource applicationContextResource, 
29 56
			ICdmRemoteSource remoteSource, 				
30 57
			boolean omitTermLoading, 
......
38 65
    	
39 66
    }
40 67
    
68
	/**
69
	 * Constructs CdmApplicationRemoteController
70
	 * 
71
	 * @param applicationContextResource
72
	 * @param remoteSource
73
	 * @param omitTermLoading
74
	 * @param progressMonitor
75
	 * @param listeners
76
	 */
41 77
	private CdmApplicationRemoteController(Resource applicationContextResource, 
42 78
				ICdmRemoteSource remoteSource, 				
43 79
				boolean omitTermLoading, 
......
52 88
	}
53 89
	
54 90
    /**
91
     * Returns classpath resource for application context config file
92
     * 
55 93
     * @return
56 94
     */
57 95
    protected static ClassPathResource getClasspathResource() {
58 96
        return new ClassPathResource(DEFAULT_APPLICATION_CONTEXT_RESOURCE);
59 97
    }
98
    
99
    
60 100
    /**
61
     * Sets the application context to a new spring ApplicationContext by using the according data source and initializes the Controller.
62
     * @param dataSource
101
     * Creates and starts a new spring application context
102
     * 
103
     * @param remoteSource object for connecting to an http-invoker server
104
     * @param omitTermLoading
105
     * @param listeners
106
     * @return
63 107
     */
64 108
    protected boolean setNewRemoteSource(ICdmRemoteSource remoteSource, 
65 109
    		boolean omitTermLoading, 
......
82 126
        pspc.setProperties(properties);
83 127
        applicationContext.addBeanFactoryPostProcessor(pspc);
84 128
        progressMonitor.worked(1);
85
        
86
//        BeanDefinition remoteSourceBean = remoteSource.getRemoteSourceBean();
87
//        remoteSourceBean.setAttribute("isLazy", false);
88
//        applicationContext.registerBeanDefinition("dataSource", remoteSourceBean);
89

  
90 129

  
91 130
        XmlBeanDefinitionReader xmlReader = new XmlBeanDefinitionReader(applicationContext);
92 131
        progressMonitor.subTask("Registering resources.");
......
119 158
        return true;
120 159
    }
121 160
    
161
    /* (non-Javadoc)
162
     * @see eu.etaxonomy.cdm.api.application.CdmApplicationController#init()
163
     */
122 164
    @Override
123
    protected void init(){
124
        logger.debug("Init " +  this.getClass().getName() + " ... ");
125
        if (logger.isDebugEnabled()){for (String beanName : applicationContext.getBeanDefinitionNames()){ logger.debug(beanName);}}
126
        //TODO delete next row (was just for testing)
127
        if (logger.isInfoEnabled()){
128
            logger.info("Registered Beans: ");
129
            String[] beanNames = applicationContext.getBeanDefinitionNames();
130
            for (String beanName : beanNames){
131
                logger.info(beanName);
132
            }
133
        }
165
    protected void init(){    
134 166
        configuration = (ICdmApplicationConfiguration)applicationContext.getBean("cdmApplicationRemoteConfiguration");
135 167

  
136 168
    }

Also available in: Unified diff