Project

General

Profile

« Previous | Next » 

Revision ae7e2680

Added by Cherian Mathew almost 9 years ago

ICdmDataChangeService, CdmUIDataChangeService, CdmDataChangeService : added new data change service with different services for the ui and non-ui states
CdmApplicationState, CdmStore : added data change service to app state
CdmChangeEvent, ICdmChangeListener : added change listener and even to fire in case of data changes
ICdmEntitySessionEnabled : extends new change service interface
ICdmEntitySession, CdmEntitySession : removed data change un/registration since this is now handled by the new data change service
BaseRemotingTest, MockCdmEntitySession, *Editor, *ViewPart, *Navigator : refactoring with new change listener
RemotingCdmHandler, RemotingCdmOperation, RemotingCdmUpdateOperation : added new handler / operation architecture base classes
AbstractUtility : added method for running async operation with callback to handler
RemotingChangeAcceptedTaxonToSynonymHandler,RemotingChangeAcceptedTaxonToSynonymOperation : first implementations of new handler / operation architecture
plugin.xml : added standalone and remoting handlers for ChangeAcceptedTaxonToSynonym
*Test : adapted for new handler / operation and change service

View differences:

eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java
9 9

  
10 10
package eu.etaxonomy.taxeditor.store;
11 11

  
12
import java.lang.reflect.InvocationTargetException;
13
import java.lang.reflect.Method;
14
import java.lang.reflect.Type;
15 12
import java.util.EnumSet;
16 13

  
17 14
import org.eclipse.core.runtime.IProgressMonitor;
......
25 22
import org.springframework.security.core.context.SecurityContext;
26 23
import org.springframework.security.core.context.SecurityContextHolder;
27 24

  
25
import eu.etaxonomy.cdm.api.application.CdmApplicationException;
28 26
import eu.etaxonomy.cdm.api.application.CdmApplicationRemoteController;
29 27
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
30 28
import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
......
201 199
	private void close() {
202 200
		isConnected = false;
203 201
		cdmSource = null;
202
		CdmApplicationState.dispose();
204 203
	}
205 204

  
206 205
	static void setInstance(ICdmApplicationConfiguration applicationController,
......
211 210
	private CdmStore(ICdmApplicationConfiguration applicationController,
212 211
			ICdmSource cdmSource) {
213 212
		CdmApplicationState.setCurrentAppConfig(applicationController);
213
		CdmApplicationState.setCurrentDataChangeService(new CdmUIDataChangeService());
214 214
		this.cdmSource = cdmSource;
215 215
		isConnected = true;
216 216
	}
......
301 301
	 * @return the configured implementation of <code>serviceClass</code> or <code>null</code>
302 302
	 */
303 303
	public static <T extends IService> T getService(Class<T> serviceClass) {
304
		ICdmApplicationConfiguration configuration = getCurrentApplicationConfiguration();
305

  
306
		Method[] methods = ICdmApplicationConfiguration.class.getDeclaredMethods();
307

  
308
		T service = null;
309

  
310
		for (Method method : methods) {
311
			Type type = method.getGenericReturnType();
312

  
313
			if (type.equals(serviceClass)) {
314
				try {
315
					service = (T) method.invoke(configuration, null);
316
					break;
317
				} catch (IllegalArgumentException e) {
318
					MessagingUtils.error(CdmStore.class, e);
319
				} catch (IllegalAccessException e) {
320
					MessagingUtils.error(CdmStore.class, e);
321
				} catch (InvocationTargetException e) {
322
					MessagingUtils.error(CdmStore.class, e);
323
				}
324
			}
325
		}
304
	    T service = null;
305
	    try {
306
	        service = CdmApplicationState.getService(serviceClass);
307
	    } catch (CdmApplicationException cae) {
308
	        MessagingUtils.error(CdmStore.class, cae);
309
	    }
326 310

  
327
		return service;
311
	    return service;
328 312
	}
329 313

  
330 314
	/**
......
332 316
	 * As ICommonService is not extending IService we need a specific request here
333 317
	 */
334 318
	public static ICommonService getCommonService() {
335
		ICdmApplicationConfiguration configuration = getCurrentApplicationConfiguration();
336

  
337
		return configuration.getCommonService();
319
		return CdmApplicationState.getCommonService();
338 320

  
339 321
	}
340 322

  

Also available in: Unified diff