Revision aaa98ab4
Added by Cherian Mathew about 10 years ago
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationRemoteController.java | ||
---|---|---|
14 | 14 |
import java.util.Properties; |
15 | 15 |
|
16 | 16 |
import org.apache.log4j.Logger; |
17 |
import org.hibernate.collection.internal.AbstractPersistentCollection; |
|
18 |
import org.hibernate.proxy.AbstractLazyInitializer; |
|
17 | 19 |
import org.springframework.beans.MutablePropertyValues; |
18 | 20 |
import org.springframework.beans.factory.config.BeanDefinition; |
19 | 21 |
import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; |
... | ... | |
29 | 31 |
|
30 | 32 |
/** |
31 | 33 |
* CDM Application Controller class for remoting clients |
34 |
* |
|
32 | 35 |
* FIXME:Remoting extending {@link CdmApplicationController} is a temporary workaround. |
33 | 36 |
* The {@link CdmApplicationController} should be split into a CdmApplicationControllerBase |
34 | 37 |
* class with {@link CdmApplicationController} and this class as subclasses |
... | ... | |
38 | 41 |
|
39 | 42 |
private static final Logger logger = Logger.getLogger(CdmApplicationRemoteController.class); |
40 | 43 |
|
41 |
public static final String DEFAULT_APPLICATION_CONTEXT_RESOURCE = "/eu/etaxonomy/cdm/remoteApplicationContext.xml"; |
|
44 |
public static final Resource DEFAULT_REMOTE_APPLICATION_CONTEXT_RESOURCE = |
|
45 |
new ClassPathResource("/eu/etaxonomy/cdm/remotingApplicationContext.xml"); |
|
42 | 46 |
private final Resource applicationContextResource; |
43 | 47 |
private final IProgressMonitor progressMonitor; |
44 | 48 |
|
... | ... | |
63 | 67 |
progressMonitor, |
64 | 68 |
listeners); |
65 | 69 |
|
70 |
} |
|
71 |
/** |
|
72 |
* Creates new instance of CdmApplicationRemoteController |
|
73 |
* |
|
74 |
* @param applicationContextResource |
|
75 |
* @param remoteSource |
|
76 |
* @param omitTermLoading |
|
77 |
* @param progressMonitor |
|
78 |
* @param listeners |
|
79 |
* @return |
|
80 |
*/ |
|
81 |
public static CdmApplicationRemoteController NewInstance(ICdmRemoteSource remoteSource, |
|
82 |
boolean omitTermLoading, |
|
83 |
IProgressMonitor progressMonitor, |
|
84 |
List<ApplicationListener> listeners) { |
|
85 |
|
|
86 |
return new CdmApplicationRemoteController(DEFAULT_REMOTE_APPLICATION_CONTEXT_RESOURCE, |
|
87 |
remoteSource, |
|
88 |
omitTermLoading, |
|
89 |
progressMonitor, |
|
90 |
listeners); |
|
91 |
|
|
66 | 92 |
} |
67 | 93 |
|
68 | 94 |
/** |
... | ... | |
80 | 106 |
IProgressMonitor progressMonitor, |
81 | 107 |
List<ApplicationListener> listeners){ |
82 | 108 |
logger.info("Start CdmApplicationRemoteController with remote source: " + remoteSource.getName()); |
83 |
this.applicationContextResource = applicationContextResource != null ? applicationContextResource : getClasspathResource(); |
|
109 |
this.applicationContextResource = |
|
110 |
applicationContextResource != null ? applicationContextResource : DEFAULT_REMOTE_APPLICATION_CONTEXT_RESOURCE; |
|
84 | 111 |
this.progressMonitor = progressMonitor != null ? progressMonitor : new NullProgressMonitor(); |
85 | 112 |
|
86 | 113 |
setNewRemoteSource(remoteSource, omitTermLoading, listeners); |
87 | 114 |
|
88 | 115 |
} |
89 | 116 |
|
90 |
/** |
|
91 |
* Returns classpath resource for application context config file |
|
92 |
* |
|
93 |
* @return |
|
94 |
*/ |
|
95 |
protected static ClassPathResource getClasspathResource() { |
|
96 |
return new ClassPathResource(DEFAULT_APPLICATION_CONTEXT_RESOURCE); |
|
97 |
} |
|
117 |
|
|
98 | 118 |
|
99 | 119 |
|
100 | 120 |
/** |
... | ... | |
164 | 184 |
@Override |
165 | 185 |
protected void init(){ |
166 | 186 |
configuration = (ICdmApplicationConfiguration)applicationContext.getBean("cdmApplicationRemoteConfiguration"); |
187 |
AbstractLazyInitializer.setConfiguration(this); |
|
188 |
AbstractPersistentCollection.setConfiguration(this); |
|
167 | 189 |
|
168 | 190 |
} |
169 | 191 |
|
Also available in: Unified diff
CdmApplicationRemoteController : directly loads CdmApplicationRemoteConfiguration bean and sets configuration in hibernate classes
CdmApplicationRemoteConfiguration : no longer need the bean name hack due to update in CdmApplicationRemoteController