Project

General

Profile

« Previous | Next » 

Revision 2661173a

Added by Andreas Müller almost 4 years ago

cleanup

View differences:

eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationException.java
11 11
/**
12 12
 * @author cmathew
13 13
 * @date 18 Jun 2015
14
 *
15 14
 */
16 15
public class CdmApplicationException extends Exception {
17 16

  
17
    private static final long serialVersionUID = -7968634498906096739L;
18

  
18 19
    public CdmApplicationException(Exception ex) {
19 20
        super(ex);
20 21
    }
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationRemoteConfiguration.java
437 437
        return (IDescriptiveDataSetService) getService(IDescriptiveDataSetService.class, "/remoting/descriptivedataset.service", new AuthenticatingHttpInvokerRequestExecutor());
438 438
    }
439 439

  
440
    /**
441
     * {@inheritDoc}
442
     */
443 440
    @Override
444 441
    public IRegistrationService getRegistrationService() {
445 442
        return (IRegistrationService) getService(IRegistrationService.class, "/remoting/registration.service", new AuthenticatingHttpInvokerRequestExecutor());
446

  
447 443
    }
448 444

  
449 445
    @Override
......
456 452
        return (IPreferenceService) getService(IPreferenceService.class, "/remoting/preference.service", new AuthenticatingHttpInvokerRequestExecutor());
457 453
    }
458 454

  
459

  
460 455
    @Override
461 456
    public IEntityValidationService getEntityValidationService(){
462 457
        return (IEntityValidationService) getService(IEntityValidationService.class, "/remoting/entityvalidation.service", new AuthenticatingHttpInvokerRequestExecutor());
463 458
    }
464 459

  
465

  
466 460
    @Override
467 461
    public IEntityConstraintViolationService getEntityConstraintViolationService(){
468 462
        return (IEntityConstraintViolationService) getService(IEntityConstraintViolationService.class, "/remoting/entityconstraintviolation.service", new AuthenticatingHttpInvokerRequestExecutor());
......
488 482
        return cdmPermissionEvaluator;
489 483
    }
490 484

  
491

  
492 485
    @Override
493 486
    public TransactionStatus startTransaction() throws UnsupportedOperationException {
494 487
        throw new UnsupportedOperationException("startTransaction is not implemented for CdmApplicationRemoteConfiguration");
......
499 492
        throw new UnsupportedOperationException("startTransaction is not implemented for CdmApplicationRemoteConfiguration");
500 493
    }
501 494

  
502

  
503 495
    @Override
504 496
    public void commitTransaction(TransactionStatus txStatus) throws UnsupportedOperationException {
505 497
        throw new UnsupportedOperationException("commitTransaction is not implemented for CdmApplicationRemoteConfiguration");
......
530 522
    public ITestService getTestService() {
531 523
        return (ITestService) getService(ITestService.class, "/remoting/test.service", new AuthenticatingHttpInvokerRequestExecutor());
532 524
    }
533

  
534 525
}
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationRemoteController.java
41 41

  
42 42
    private static final Logger logger = Logger.getLogger(CdmApplicationRemoteController.class);
43 43

  
44

  
45 44
    public static final Resource DEFAULT_REMOTE_APPLICATION_CONTEXT_RESOURCE =
46 45
            new ClassPathResource("/eu/etaxonomy/cdm/remotingApplicationContext.xml");
47 46
    private final Resource applicationContextResource;
48 47
    private final IProgressMonitor progressMonitor;
49 48
    private final ICdmRemoteSource remoteSource;
50 49

  
51

  
52
    /**
53
     * Creates new instance of CdmApplicationRemoteController
54
     *
55
     * @param applicationContextResource
56
     * @param remoteSource
57
     * @param omitTermLoading
58
     * @param progressMonitor
59
     * @param listeners
60
     * @return
61
     */
62 50
//    public static CdmApplicationRemoteController NewInstance(Resource applicationContextResource,
63 51
//            ICdmRemoteSource remoteSource,
64 52
//            IProgressMonitor progressMonitor,
......
70 58
//                listeners);
71 59
//
72 60
//    }
61

  
73 62
    /**
74 63
     * Creates new instance of CdmApplicationRemoteController
75 64
     *
......
102 91
                validateXml,
103 92
                progressMonitor,
104 93
                listeners);
105

  
106 94
    }
107 95

  
108 96
    /**
......
128 116

  
129 117
    }
130 118

  
131

  
132

  
133

  
134 119
    /**
135 120
     * Creates and starts a new spring application context
136 121
     *
......
176 161
        return ((CdmApplicationRemoteConfiguration)configuration).getIOService();
177 162
    }
178 163

  
179

  
180

  
181

  
182 164
    public ITestService getTestService(){
183 165
        return ((CdmApplicationRemoteConfiguration)configuration).getTestService();
184 166
    }
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationState.java
42 42
/**
43 43
 * @author cmathew
44 44
 * @date 17 Jun 2015
45
 *
46 45
 */
47 46
public class CdmApplicationState {
48 47

  
......
111 110
        getInstance().setDataChangeService(dataChangeService);
112 111
    }
113 112

  
114

  
115

  
116 113
    /**
117 114
     * @return the securityContext
118 115
     */
......
151 148
        cdmlibLastModified = null;
152 149
    }
153 150

  
154

  
155 151
    /**
156 152
     * Generic method that will scan the getters of {@link ICdmRepository} for the given service
157 153
     * interface. If a matching getter is found the according service implementation is returned by
......
185 181
                }
186 182
            }
187 183
        }
188

  
189 184
        return service;
190 185
    }
191 186

  
192

  
193 187
    /**
194 188
     * @see #getService(Class)
195 189
     * As ICommonService is not extending IService we need a specific request here
......
198 192
        ICdmRepository configuration = getCurrentAppConfig();
199 193

  
200 194
        return configuration.getCommonService();
201

  
202 195
    }
203 196

  
204 197
    public static IIOService getIOService() {
205 198
        ICdmRepository configuration = getCurrentAppConfig();
206 199

  
207 200
        return ((CdmApplicationRemoteController)configuration).getIOService();
208

  
209 201
    }
210 202

  
211 203
    public static ILongRunningTasksService getLongRunningTasksService() {
212 204
        ICdmRepository configuration = getCurrentAppConfig();
213 205

  
214 206
        return ((CdmApplicationRemoteController)configuration).getLongRunningTasksService();
215

  
216 207
    }
217 208

  
218 209

  
......
221 212
        ICdmRepository configuration = getCurrentAppConfig();
222 213

  
223 214
        return ((CdmApplicationRemoteController)configuration).getTestService();
224

  
225 215
    }
226 216

  
227 217
    public static ICachedCommonService getCachedCommonService() {
228 218
        ICdmRepository configuration = getCurrentAppConfig();
229 219

  
230 220
        return ((CdmApplicationRemoteController)configuration).getCachedCommonService();
231

  
232 221
    }
233 222

  
234 223
    public static CdmServiceCacher getCdmServiceCacher() {
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmChangeEvent.java
16 16
/**
17 17
 * @author cmathew
18 18
 * @date 7 Apr 2015
19
 *
20 19
 */
21 20
public class CdmChangeEvent {
22 21

  
......
28 27

  
29 28
    private final Action action;
30 29
    private final Set<CdmBase> changedObjects;
31
    private final Class sourceType;
32
    private Class entityType;
30
    private final Class<?> sourceType;
31
    private Class<?> entityType;
33 32
    private Object source;
34 33

  
35
    public CdmChangeEvent(Action action, Set<CdmBase> changedObjects, Class sourceType) {
34
    public CdmChangeEvent(Action action, Set<CdmBase> changedObjects, Class<?> sourceType) {
36 35
        this.action = action;
37 36
        this.changedObjects = changedObjects;
38 37
        this.sourceType = sourceType;
39 38
    }
40 39

  
41
    public CdmChangeEvent(Action action, CdmBase changedObject, Class sourceType) {
40
    public CdmChangeEvent(Action action, CdmBase changedObject, Class<?> sourceType) {
42 41
        this.action = action;
43 42
        changedObjects = new HashSet<CdmBase>();
44 43
        changedObjects.add(changedObject);
......
55 54
        this.source = source;
56 55
    }
57 56

  
58
    /**
59
     * @return the action
60
     */
61 57
    public Action getAction() {
62 58
        return action;
63 59
    }
64 60

  
65
    /**
66
     * @return the changedObjects
67
     */
68 61
    public Set<? extends CdmBase> getChangedObjects() {
69 62
        return changedObjects;
70 63
    }
71 64

  
72
    /**
73
     * @return the sourceType
74
     */
75
    public Class getSourceType() {
65
    public Class<?> getSourceType() {
76 66
        return sourceType;
77 67
    }
78 68

  
79

  
80
    /**
81
     * @return the source
82
     */
83 69
    public Object getSource() {
84 70
        return source;
85 71
    }
86 72

  
87
    public Class getEntityType() {
73
    public Class<?> getEntityType() {
88 74
        return entityType;
89 75
    }
90 76

  
91 77
    public boolean hasChanges() {
92 78
        return changedObjects != null && !changedObjects.isEmpty();
93 79
    }
94

  
95 80
}
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmDataChangeService.java
16 16
/**
17 17
 * @author cmathew
18 18
 * @date 18 Jun 2015
19
 *
20 19
 */
21 20
public class CdmDataChangeService implements ICdmDataChangeService {
22 21

  
......
29 28
        currentEvents = new ArrayList<CdmChangeEvent>();
30 29
    }
31 30

  
32
    /* (non-Javadoc)
33
     * @see eu.etaxonomy.taxeditor.store.ICdmDataChangeService#register(eu.etaxonomy.cdm.api.application.ICdmChangeListener)
34
     */
35 31
    @Override
36 32
    public void register(ICdmChangeListener listener) {
37 33
        listeners.add(listener);
38 34
    }
39 35

  
40
    /* (non-Javadoc)
41
     * @see eu.etaxonomy.cdm.api.application.ICdmDataChangeService#unregister(eu.etaxonomy.cdm.api.application.ICdmChangeListener)
42
     */
43 36
    @Override
44 37
    public void unregister(ICdmChangeListener listener) {
45 38
        listeners.remove(listener);
46 39
    }
47 40

  
48
    /* (non-Javadoc)
49
     * @see eu.etaxonomy.taxeditor.store.ICdmDataChangeService#addEvent(eu.etaxonomy.cdm.api.application.CdmChangeEvent)
50
     */
51 41
    @Override
52 42
    public void addEvent(CdmChangeEvent event) {
53 43
        currentEvents.add(event);
54 44
    }
55 45

  
56
    /* (non-Javadoc)
57
     * @see eu.etaxonomy.taxeditor.store.ICdmDataChangeService#fireCurrentChangeEvents(boolean)
58
     */
59 46
    @Override
60 47
    public void fireCurrentChangeEvents(boolean async) {
61 48
        try {
......
67 54
        }
68 55
    }
69 56

  
70

  
71

  
72
    /* (non-Javadoc)
73
     * @see eu.etaxonomy.taxeditor.store.ICdmDataChangeService#fireChangeEvent(eu.etaxonomy.cdm.api.application.CdmChangeEvent, boolean)
74
     */
75 57
    @Override
76 58
    public void fireChangeEvent(final CdmChangeEvent event, boolean async) {
77 59

  
......
80 62
        }
81 63
    }
82 64

  
83
    /* (non-Javadoc)
84
     * @see eu.etaxonomy.taxeditor.store.ICdmDataChangeService#clear()
85
     */
86 65
    @Override
87 66
    public void clear() {
88 67
        listeners.clear();
89 68
        currentEvents.clear();
90 69
    }
91

  
92

  
93 70
}
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/ICdmChangeListener.java
11 11
/**
12 12
 * @author cmathew
13 13
 * @date 7 Apr 2015
14
 *
15 14
 */
16 15
public interface ICdmChangeListener {
17 16

  
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/ICdmDataChangeService.java
12 12
/**
13 13
 * @author cmathew
14 14
 * @date 18 Jun 2015
15
 *
16 15
 */
17 16
public interface ICdmDataChangeService {
18 17

  
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/cache/CdmServiceCacher.java
36 36
@Component //FIXME This indicates that the CdmServiceCacher is initialized as Spring Component but it seems only to be instantiated directly
37 37
public class CdmServiceCacher extends CdmCacher implements ICdmEntitySessionManagerObserver {
38 38

  
39

  
40 39
    private ICdmEntitySessionManager cdmEntitySessionManager;
41 40

  
42 41
    private CdmTransientEntityCacher cdmTransientEntityCacher;
......
83 82

  
84 83
        cacheConfig.setDiskStoreConfiguration(diskStoreConfiguration);
85 84
        addCacheManager(cacheConfig.cacheManager());
86

  
87 85
    }
88 86

  
89

  
90 87
    @Override
91 88
    protected CacheConfiguration getDefaultCacheConfiguration() {
92 89
        // For a better understanding on how to size caches, refer to
......
101 98
        	.statistics(true)
102 99
        	.sizeOfPolicy(sizeOfConfig)
103 100
        	.overflowToOffHeap(false);
104

  
105 101
    }
106 102

  
107 103
    @Override
......
119 115
        return false;
120 116
    }
121 117

  
122

  
123 118
    public void setCdmEntitySessionManager(ICdmEntitySessionManager cdmEntitySessionManager) {
124 119
        this.cdmEntitySessionManager = cdmEntitySessionManager;
125 120
        if(cdmEntitySessionManager != null) {
......
127 122
        }
128 123
    }
129 124

  
130

  
131 125
    public CdmTransientEntityCacher getCurrentCacher() {
132 126
        ICdmEntitySession cdmEntitySession = cdmEntitySessionManager.getActiveSession();
133 127
        if(cdmEntitySession != null && cdmEntitySession instanceof CdmEntitySession) {
......
147 141
        if(!isCachable(cdmBase) && cdmTransientEntityCacher != null) {
148 142
            CdmEntityCacheKey<T> key = CdmTransientEntityCacher.generateKey(cdmBase);
149 143
            cachedCdmEntity = cdmTransientEntityCacher.getFromCache(key);
150

  
151 144
        }
152 145
        if(cachedCdmEntity == null) {
153 146
            cachedCdmEntity = super.getFromCache(cdmBase);
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/lazyloading/CdmLazyLoader.java
35 35
@Configurable(autowire = Autowire.BY_TYPE)
36 36
public class CdmLazyLoader {
37 37

  
38

  
39
	private final Set classes = new HashSet();
38
	private final Set classes = new HashSet<>();
40 39

  
41 40
	public static boolean enableWeaving = true;
42
	private static Set<String> classesToIgnore = new HashSet<String>();
41
	private static Set<String> classesToIgnore = new HashSet<>();
43 42

  
44 43

  
45 44
	@Autowired
......
48 47
	public CdmLazyLoader() {
49 48
		//classesToIgnore.add("eu.etaxonomy.cdm.model.term.TermVocabulary");
50 49
		//classesToIgnore.add("eu.etaxonomy.cdm.model.term.OrderedTermVocabulary");
51

  
52 50
	}
53 51

  
54 52
	/**
55 53
	 *  Point cut for the 'initialize' method of the AbstractLazyInitializer.
56
	 *
57 54
	 */
58 55
	@Pointcut("execution(* org.hibernate.proxy.AbstractLazyInitializer.initialize())")
59 56
	public void possibleEntityLazyInitializationException() {
60 57
	}
61 58

  
62

  
63 59
	/**
64 60
	 *  'Around' advice for the initialization of CDM Entity Objects
65 61
	 *
......
83 79

  
84 80
	/**
85 81
	 *  Point cut for the 'initialize' method of the AbstractPersistentCollection.
86
	 *
87 82
	 */
88 83
	@Pointcut("execution(protected final void org.hibernate.collection.internal.AbstractPersistentCollection.initialize(..))")
89 84
	public void possibleCollectionLazyInitializationException() {
......
128 123
			}
129 124
		}
130 125
		return pjp.proceed();
131

  
132 126
	}
133 127

  
134 128
	private CollectionField getCollectionField(PersistentCollection pc) {
......
183 177
			return this.fieldName;
184 178
		}
185 179
	}
186

  
187 180
}
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/CdmEagerLoadingException.java
1 1
package eu.etaxonomy.taxeditor.remoting;
2 2

  
3 3
public class CdmEagerLoadingException extends RuntimeException {
4
	
5
	public CdmEagerLoadingException(Throwable t) {
4

  
5
    private static final long serialVersionUID = -3994961114337636890L;
6

  
7
    public CdmEagerLoadingException(Throwable t) {
6 8
		super(t);
7 9
	}
8
	
10

  
9 11
	public CdmEagerLoadingException(String message) {
10 12
		super(message);
11 13
	}
12

  
13 14
}
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/CdmRemotingException.java
2 2

  
3 3
public class CdmRemotingException extends RuntimeException {
4 4

  
5
	/**
6
	 *
7
	 */
8 5
	private static final long serialVersionUID = -560332689478356360L;
9 6

  
10 7
	public CdmRemotingException(String message) {
......
14 11
	public CdmRemotingException(Exception exception) {
15 12
	    super(exception);
16 13
	}
17

  
18 14
}
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/RemoteExecutionTimestampsUtil.java
11 11
/**
12 12
 * @author a.kohlbecker
13 13
 * @since Jan 17, 2020
14
 *
15 14
 */
16 15
public class RemoteExecutionTimestampsUtil {
17 16

  
......
48 47
    static public void setLastServiceMethod(String lastMethod) {
49 48
        lastServiceMethod = lastMethod;
50 49
    }
51

  
52 50
}
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/ConversationalTransientEntityCacher.java
22 22
/**
23 23
 * @author k.luther
24 24
 * @date 15.03.2018
25
 *
26 25
 */
27 26
public class ConversationalTransientEntityCacher extends CdmTransientEntityCacher {
28 27

  
29
    /**
30
     * @param sessionOwner
31
     */
32 28
    public ConversationalTransientEntityCacher(Object sessionOwner) {
33 29
        super(sessionOwner);
34

  
35 30
    }
36 31
    private CdmBase load(CdmEntityIdentifier cei, boolean update) {
37 32
        return CdmApplicationState.getCommonService().findWithUpdate(cei.getCdmClass(), cei.getId());
38 33
    }
39 34

  
40

  
41 35
    public UpdateResult load(UpdateResult result, boolean update) {
42 36
        // probably a good time to broadcast to other sessions
43 37

  
......
65 59
            if(exists(new CdmEntityCacheKey<>(cei.getCdmClass(), cei.getId()))) {
66 60
                reloadedObjects.add(load(cei, update));
67 61
            }
68

  
69 62
        }
70 63
        updatedObjects.clear();
71 64
        result.addUpdatedObjects(reloadedObjects);
72 65
        return result;
73 66
    }
74

  
75 67
}
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/server/CDMServerException.java
11 11
/**
12 12
 * @author cmathew
13 13
 * @date 23 Sep 2014
14
 *
15 14
 */
16 15
public class CDMServerException extends Exception {
17 16

  
17
    private static final long serialVersionUID = -7024801695206657419L;
18

  
18 19
    public CDMServerException(String message) {
19 20
        super(message);
20 21
    }
......
26 27
    public CDMServerException(String message,Exception e) {
27 28
        super(message,e);
28 29
    }
29

  
30 30
}
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/server/CDMServerUtils.java
21 21
/**
22 22
 * @author cmathew
23 23
 * @date 11 Nov 2015
24
 *
25 24
 */
26 25
public class CDMServerUtils {
27 26

  
28

  
29 27
    public static String convertEditorToServerConfig() {
30 28
        StringBuilder configStringBuilder = new StringBuilder();
31 29
        configStringBuilder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?> " + System.lineSeparator());
......
86 84
        }
87 85
        return managedConfigFile;
88 86
    }
89

  
90 87
}
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmPersistentRemoteSource.java
32 32

  
33 33
/**
34 34
 * Class representing a CDM remote source which can be persisted to a source config file
35
 *
36 35
 */
37 36
public class CdmPersistentRemoteSource extends CdmRemoteSourceBase implements ICdmPersistentSource{
38 37
	@SuppressWarnings("unused")
......
60 59
		} else {
61 60
			throw new CdmRemoteSourceException("Remote source '" + remoteSource + "' does not exist in sources setting file");
62 61
		}
63

  
64 62
	}
65 63

  
66 64
	/**S
......
151 149

  
152 150

  
153 151
		Properties props = cdmSourceProperties;
154
		Enumeration e = props.propertyNames();
152
		Enumeration<?> e = props.propertyNames();
155 153

  
156 154
		while (e.hasMoreElements()) {
157 155
			String key = (String) e.nextElement();
......
165 163
				XmlHelp.prettyFormat );
166 164

  
167 165
		return NewInstance(strRemoteSourceName) ;
168

  
169 166
	}
170 167

  
171 168
	/**
......
224 221
			return super.toString();
225 222
		}
226 223
	}
227

  
228 224
}
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmRemoteSource.java
8 8
*/
9 9
package eu.etaxonomy.taxeditor.remoting.source;
10 10

  
11

  
12 11
/**
13 12
 * Class representing a CDM remote source
14
 *
15 13
 */
16 14
public class CdmRemoteSource extends CdmRemoteSourceBase {
17 15

  
18 16
	/**
19 17
	 * Creates a new instance of CdmRemoteSource
20
	 *
21
	 * @param name
22
	 * @param server
23
	 * @param port
24
	 * @param contextPath
25
	 * @param nomenclaturalCode
26
	 * @return
27 18
	 */
28 19
	public static CdmRemoteSource NewInstance() {
29 20
		return new CdmRemoteSource(DEFAULT_NAME, DEFAULT_SERVER, DEFAULT_PORT, DEFAULT_CONTEXT_PATH);
......
36 27
	 * @param server
37 28
	 * @param port
38 29
	 * @param contextPath
39
	 * @param nomenclaturalCode
40 30
	 * @return
41 31
	 */
42 32
	public static CdmRemoteSource NewInstance(String name, String server, int port, String contextPath) {
......
50 40
	 * @param server
51 41
	 * @param port
52 42
	 * @param contextPath
53
	 * @param nomenclaturalCode
54 43
	 */
55 44
	private CdmRemoteSource(String name, String server, int port, String contextPath) {
56 45
		super(name, server, port, contextPath);
57

  
58 46
	}
59

  
60

  
61 47
}
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmRemoteSourceBase.java
23 23
 * Base class representing a CDM remote source.
24 24
 * This class handles all the configuration relating to the remoting aspect of
25 25
 * a CDM source.
26
 *
27 26
 */
28 27
public class CdmRemoteSourceBase extends CdmSource implements ICdmRemoteSource {
29 28

  
......
38 37

  
39 38
	/**
40 39
	 * Constructs a CdmRemoteSourceBase object with default values.
41
	 *
42 40
	 */
43 41
	protected CdmRemoteSourceBase() {
44 42
		setName(DEFAULT_NAME);
......
100 98
	@Override
101 99
	public String getDbSchemaVersion() throws CdmSourceException {
102 100
		return metadataService.getDbSchemaVersion();
103

  
104 101
	}
105 102

  
106 103
	@Override
107 104
	public boolean isDbEmpty() throws CdmSourceException {
108 105
		return metadataService.isDbEmpty();
109

  
110 106
	}
111 107

  
112 108
	@Override
......
126 122
		return "Connecting to Remote CDM Instance " + getName() + ":" + getPort() + "/" + getContextPath();
127 123
	}
128 124

  
129

  
130 125
	@Override
131 126
	public Map<CdmMetaDataPropertyName, String> getMetaDataMap() throws CdmSourceException {
132 127
		return metadataService.getCdmMetadataMap();
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmRemoteSourceException.java
1 1
/**
2
 * 
3
 */
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
*/
4 9
package eu.etaxonomy.taxeditor.remoting.source;
5 10

  
6
/**
7
 * 
8
 *
9
 */
10 11
public class CdmRemoteSourceException extends Exception {
11
	
12
	public CdmRemoteSourceException(String message) {
12

  
13
    private static final long serialVersionUID = -6381037924316526887L;
14

  
15
    public CdmRemoteSourceException(String message) {
13 16
		super(message);
14 17
	}
15 18

  
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmServerInfo.java
50 50
/**
51 51
 * @author cmathew
52 52
 * @date 20 Jan 2015
53
 *
54 53
 */
55 54
public class CdmServerInfo {
55

  
56 56
    public static final Logger logger = Logger.getLogger(CdmServerInfo.class);
57 57

  
58 58
    private final static String CDMSERVER_PREFIX = "cdmserver/";
......
99 99
        instances = new ArrayList<>();
100 100
    }
101 101

  
102

  
103 102
    public CdmInstanceInfo addInstance(String name, String basePath) {
104 103
        String _basePath = basePath;
105 104
        if(isLocalhostMgd()) {
......
108 107
        CdmInstanceInfo cii = new CdmInstanceInfo(name, _basePath);
109 108
        instances.add(cii);
110 109
        return cii;
111

  
112 110
    }
113 111

  
114 112
    public boolean isLocalhost() {
......
158 156
        }
159 157
    }
160 158

  
161

  
162
    /**
163
     * @return
164
     */
165 159
    String guessProtocol() {
166 160
        return port == 443 ? "https" : "http";
167 161
    }
......
287 281
        return true;
288 282
    }
289 283

  
290

  
291 284
    public boolean pingInstance(CdmInstanceInfo instance, int port) throws CDMServerException  {
292 285
        ICdmRemoteSource crs = getCdmRemoteSource(instance, port);
293 286
        try {
......
332 325
        }
333 326
    }
334 327

  
335

  
336
    /**
337
     * @param serverVersion
338
     * @param editorVersion
339
     * @throws CdmSourceException
340
     */
341 328
    public static int compareCdmlibServicesVersion(String serverVersion, String serverCdmlibLastModified) throws CdmSourceException {
342 329

  
343 330
        String editorVersion = CdmApplicationState.getCdmlibVersion();
......
403 390
        return serverInfoList;
404 391
    }
405 392

  
406

  
407
    /**
408
     * @param file
409
     * @throws IOException
410
     * @throws FileNotFoundException
411
     * @throws JsonMappingException
412
     * @throws JsonParseException
413
     */
414 393
    private static List<CdmServerInfoConfig>  loadFromConfigFile(File file) {
415 394

  
416 395
        List<CdmServerInfoConfig> serverList = null;
......
440 419

  
441 420
    }
442 421

  
443

  
444
    /**
445
     *
446
     */
447 422
    private static List<CdmServerInfoConfig> createDefaultServerConfigList() {
448 423

  
449
        List<CdmServerInfoConfig> serverInfoList = new ArrayList<CdmServerInfoConfig>();
424
        List<CdmServerInfoConfig> serverInfoList = new ArrayList<>();
450 425
        serverInfoList.add(new CdmServerInfoConfig(NAME_PRODUCTION, SERVER_PRODUCTION, 80, "", false));
451 426
        serverInfoList.add(new CdmServerInfoConfig(NAME_DEMO_1, SERVER_DEMO_1, 80, CDMSERVER_PREFIX, false));
452 427
        serverInfoList.add(new CdmServerInfoConfig(NAME_LOCALHOST, SERVER_LOCALHOST, 8080, CDMSERVER_PREFIX, true));
......
461 436
        return server;
462 437
    }
463 438

  
464

  
465 439
    public int getPort() {
466 440
        return port;
467 441
    }
......
513 487
         */
514 488
        private final String basePath;
515 489

  
516

  
517 490
        public CdmInstanceInfo(String name, String basePath) {
518 491
            this.name = name;
519 492
            this.basePath = basePath;
520 493
        }
521 494

  
522

  
523 495
        public String getName() {
524 496
            return name;
525 497
        }
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmServerInfoConfig.java
13 13
 * @date  Feb 10, 2016
14 14
 */
15 15
public class CdmServerInfoConfig {
16
    /**
17
     *
18
     */
16

  
19 17
    private String name;
20
    /**
21
     *
22
     */
23 18
    private String server;
24
    /**
25
     *
26
     */
27 19
    private int port;
28
    /**
29
     *
30
     */
31 20
    private String prefix;
32
    /**
33
     *
34
     */
35 21
    private boolean ignoreCdmLibVersion;
36 22

  
37
    /**
38
     *
39
     */
40 23
    public CdmServerInfoConfig(String name, String server, int port, String prefix, boolean ignoreCdmLibVersion) {
41 24
        this.name = name;
42 25
        this.server = server;
......
49 32

  
50 33
    }
51 34

  
52
    /**
53
     * @return the name
54
     */
55 35
    public String getName() {
56 36
        return name;
57 37
    }
58 38

  
59
    /**
60
     * @param name the name to set
61
     */
62 39
    public void setName(String name) {
63 40
        this.name = name;
64 41
    }
65 42

  
66
    /**
67
     * @return the server
68
     */
69 43
    public String getServer() {
70 44
        return server;
71 45
    }
72 46

  
73
    /**
74
     * @param server the server to set
75
     */
76 47
    public void setServer(String server) {
77 48
        this.server = server;
78 49
    }
79 50

  
80
    /**
81
     * @return the port
82
     */
83 51
    public int getPort() {
84 52
        return port;
85 53
    }
86 54

  
87
    /**
88
     * @param port the port to set
89
     */
90 55
    public void setPort(int port) {
91 56
        this.port = port;
92 57
    }
93 58

  
94
    /**
95
     * @return the prefix
96
     */
97 59
    public String getPrefix() {
98 60
        return prefix;
99 61
    }
100 62

  
101
    /**
102
     * @param prefix the prefix to set
103
     */
104 63
    public void setPrefix(String prefix) {
105 64
        this.prefix = prefix;
106 65
    }
107 66

  
108
    /**
109
     * @return the ignoreCdmLibVersion
110
     */
111 67
    public boolean isIgnoreCdmLibVersion() {
112 68
        return ignoreCdmLibVersion;
113 69
    }
114 70

  
115
    /**
116
     * @param ignoreCdmLibVersion the ignoreCdmLibVersion to set
117
     */
118 71
    public void setIgnoreCdmLibVersion(boolean ignoreCdmLibVersion) {
119 72
        this.ignoreCdmLibVersion = ignoreCdmLibVersion;
120 73
    }
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/ICdmRemoteSource.java
1 1
/**
2 2
* Copyright (C) 2014 EDIT
3
* European Distributed Institute of Taxonomy 
3
* European Distributed Institute of Taxonomy
4 4
* http://www.e-taxonomy.eu
5
* 
5
*
6 6
* The contents of this file are subject to the Mozilla Public License Version 1.1
7 7
* See LICENSE.TXT at the top of this package for the full license terms.
8 8
*/
......
12 12

  
13 13
/**
14 14
 * Interface representing a CDM remote source
15
 *
16 15
 */
17 16
public interface ICdmRemoteSource extends ICdmSource {
18
	
17

  
19 18
	/**
20 19
	 * Gets the context path.
21
	 * e.g. for 'http://127.0.0.1:8080/col/remoting/common.service', the 
20
	 * e.g. for 'http://127.0.0.1:8080/col/remoting/common.service', the
22 21
	 * context path would be 'col'
23 22
	 */
24 23
	public String getContextPath();
25
	
24

  
26 25
	/**
27
	 * Gets the base url for the http-invoker services as listed in 
26
	 * Gets the base url for the http-invoker services as listed in
28 27
	 * httpInvokerServicesClients.xml.
29
	 * e.g. for 'http://127.0.0.1:8080/col/remoting/common.service', the 
28
	 * e.g. for 'http://127.0.0.1:8080/col/remoting/common.service', the
30 29
	 * base url would be 'http://127.0.0.1:8080/col'
31 30
	 */
32
	public String getBaseUrl();	
31
	public String getBaseUrl();
33 32

  
34 33
}
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/AuthenticatingHttpInvokerRequestExecutor.java
20 20
/**
21 21
 * @author cmathew
22 22
 * @date 27 Jan 2015
23
 *
24 23
 */
25 24
public class AuthenticatingHttpInvokerRequestExecutor extends TimestampingHttpInvokerRequestExecutor {
26 25

  
......
40 39
        }
41 40
        return postMethod;
42 41
    }
43

  
44 42
}
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/CachedCommonServiceImpl.java
25 25
@Component
26 26
public class CachedCommonServiceImpl implements ICachedCommonService {
27 27

  
28

  
29 28
    private static boolean cacheEnabled = true;
30 29

  
31 30
    public static boolean isCacheEnabled() {
......
45 44
        return cdmEntity;
46 45
    }
47 46

  
48

  
49 47
    private List<String> getPropertyPaths(Object obj) {
50 48
        List<String> propertyPaths = null;
51 49
        ICdmEntitySession cdmEntitySession =
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/CdmServiceInterceptorException.java
1 1
package eu.etaxonomy.taxeditor.service;
2 2

  
3 3
public class CdmServiceInterceptorException extends RuntimeException {
4
	
5
	public CdmServiceInterceptorException(String message) {
4

  
5
    private static final long serialVersionUID = 4413915923638221536L;
6

  
7
    public CdmServiceInterceptorException(String message) {
6 8
		super(message);
7 9
	}
8
	
10

  
9 11
	public CdmServiceInterceptorException(Exception ex) {
10 12
		super(ex);
11 13
	}
12

  
13 14
}
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/ICachedCommonService.java
15 15
/**
16 16
 * @author cmathew
17 17
 * @date 14 Oct 2014
18
 *
19 18
 */
20 19
public interface ICachedCommonService {
21 20

  
22 21
    public CdmBase find(Class<? extends CdmBase> clazz, int id);
23 22

  
24

  
25 23
    /**
26 24
     * Initializes a collection or map.
27 25
     *
......
80 78
     * @return true if the value object exists in the collection, false o/w
81 79
     */
82 80
    public boolean containsValue(UUID ownerUuid, String fieldName, Object element);
83

  
84

  
85

  
86

  
87 81
}
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/IRemoteInvocationTermCacher.java
14 14
/**
15 15
 * @author a.kohlbecker
16 16
 * @since Feb 4, 2020
17
 *
18 17
 */
19 18
public interface IRemoteInvocationTermCacher {
20 19

  
21
    /**
22
     * @param ri
23
     * @param rir
24
     */
25
    void cacheTerms(RemoteInvocation ri, RemoteInvocationResult rir);
20
    public void cacheTerms(RemoteInvocation ri, RemoteInvocationResult rir);
26 21

  
27
    /**
28
     * @param ri
29
     * @return
30
     */
31
    RemoteInvocationResult termsFromCache(RemoteInvocation ri);
22
    public RemoteInvocationResult termsFromCache(RemoteInvocation ri);
32 23

  
33 24
}
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/RemoteInvocationTermCacher.java
16 16

  
17 17

  
18 18
public class RemoteInvocationTermCacher implements IRemoteInvocationTermCacher {
19

  
19 20
    private static final Logger logger = Logger.getLogger(RemoteInvocationTermCacher.class);
20 21

  
21 22
	private static Map<TermType, RemoteInvocationResult> termTypeMap = new HashMap<>();
......
40 41
	                    }
41 42
	                    termTypeMap.put((TermType)ri.getArguments()[0], rir);
42 43
	                }
43

  
44 44
	            }
45 45
	        }
46 46
	    } else {
......
52 52
	public  RemoteInvocationResult termsFromCache(RemoteInvocation ri) {
53 53
		return termTypeMap.get(ri.getArguments()[0]);
54 54
	}
55

  
56 55
}
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/service/TimestampingHttpInvokerRequestExecutor.java
59 59
        super(createDefaultHttpClient());
60 60
    }
61 61

  
62

  
63 62
    @Override
64 63
    protected HttpResponse executeHttpPost(HttpInvokerClientConfiguration config, HttpClient httpClient,
65 64
            HttpPost httpPost) throws IOException {
66 65

  
67

  
68 66
        setExecutionRequestClientTimestamp(httpPost.getURI());
69 67

  
70 68
        HttpResponse respone = super.executeHttpPost(config, httpClient, httpPost);
......
108 106
                .setConnectionReuseStrategy(new NoConnectionReuseStrategy()) // see #8812
109 107
                .build();
110 108
    }
111

  
112 109
}
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/CdmClientSessionException.java
2 2

  
3 3
public class CdmClientSessionException extends RuntimeException {
4 4

  
5
	public CdmClientSessionException(String message) {
5
    private static final long serialVersionUID = -6738096254429238266L;
6

  
7
    public CdmClientSessionException(String message) {
6 8
		super(message);
7 9
	}
8 10
}
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/CdmEntitySession.java
28 28
import eu.etaxonomy.taxeditor.remoting.cache.ConversationalTransientEntityCacher;
29 29
import net.sf.ehcache.statistics.LiveCacheStatistics;
30 30

  
31

  
32 31
/**
33 32
 * NOTE : It would be nice to have this class performing merge / delete operations
34 33
 * using services, but this is only possible if we can 'intelligently'
35 34
 * get from a model class to the corresponding service class
36
 * 
35
 *
37 36
 * @author cmathew
38 37
 * @date 20 Oct 2014
39 38
 */
......
49 48

  
50 49
    private List<ICdmEntitySessionEnabled> changeObservers;
51 50

  
52

  
53 51
    public CdmEntitySession(ICdmEntitySessionEnabled sessionOwner, CdmEntitySessionManager cdmEntitySessionManager) {
54 52
        this.sessionOwner = sessionOwner;
55 53
        this.cdmEntitySessionManager = cdmEntitySessionManager;
......
64 62
        cdmEntitySessionManager.addToOwnerSessionMap(sessionOwner, this);
65 63
    }
66 64

  
67

  
68 65
    @Override
69 66
    public  <O extends Object> O load(O obj, boolean update) {
70 67
        return cdmTransientEntityCacher.load(obj, update);
71 68
    }
72 69

  
73

  
74 70
    @Override
75 71
    public  <T extends CdmBase> T load(T cdmBase, boolean update) {
76 72
        return cdmTransientEntityCacher.load(cdmBase, update);
......
151 147
        //		}
152 148
    }
153 149

  
154

  
155 150
    @Override
156 151
    public void bind() {
157 152
        logger.info("Binding session with owner " + sessionOwner.toString());
......
159 154
            init(sessionOwner, cdmEntitySessionManager);
160 155
        }
161 156
        cdmEntitySessionManager.bind(sessionOwner);
162

  
163 157
    }
164 158

  
165 159
    @Override
......
168 162
        cdmTransientEntityCacher.dispose();
169 163
        changeObservers.clear();
170 164
        cdmEntitySessionManager.remove(sessionOwner);
171

  
172 165
    }
173 166

  
174 167
//    @Override
......
194 187
        return load(cdmBase, false);
195 188
    }
196 189

  
197

  
198 190
    /**
199 191
     * Returns the cdm entity specified by the <code>uuid</code>,
200 192
     * recursively initializes all bean properties given in the
......
266 258
    public void addNewCdmEntity(CdmBase newEntity) {
267 259
        cdmTransientEntityCacher.addNewEntity(newEntity);
268 260
    }
269

  
270 261
}
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/CdmEntitySessionManager.java
26 26
/**
27 27
 * @author cmathew
28 28
 * @date 16 Oct 2014
29
 *
30 29
 */
31 30
@Component
32 31
public class CdmEntitySessionManager implements ICdmEntitySessionManager {
33 32
    private static final Logger logger = Logger.getLogger(CdmEntitySessionManager.class);
34 33

  
35
    private final Map<ICdmEntitySessionEnabled, ICdmEntitySession> ownerSessionMap =
36
            new HashMap<ICdmEntitySessionEnabled, ICdmEntitySession>();
34
    private final Map<ICdmEntitySessionEnabled, ICdmEntitySession> ownerSessionMap = new HashMap<>();
37 35

  
38
    private final List<ICdmEntitySessionManagerObserver> sessionObservers = new ArrayList<ICdmEntitySessionManagerObserver>();
36
    private final List<ICdmEntitySessionManagerObserver> sessionObservers = new ArrayList<>();
39 37

  
40 38
    //private ICdmEntitySession activeSession;
41 39

  
42
    private final InheritableThreadLocal<ICdmEntitySession> tlActiveSession = new InheritableThreadLocal<ICdmEntitySession>();
40
    private final InheritableThreadLocal<ICdmEntitySession> tlActiveSession = new InheritableThreadLocal<>();
43 41

  
44 42
    private  NullSession nullSession;
45 43

  
......
80 78
        return tlActiveSession.get();
81 79
    }
82 80

  
83

  
84 81
    private void setActiveSession(ICdmEntitySession activeSession) {
85 82
       this. tlActiveSession.set(activeSession);
86 83
        notifyObservers();
......
103 100
        }
104 101

  
105 102
        setActiveSession(session);
106

  
107 103
    }
108 104

  
109 105
    @Override
......
159 155
        return tlActiveSession.get().load(cdmBaseList, update);
160 156
    }
161 157

  
162

  
163
    /* (non-Javadoc)
164
     * @see eu.etaxonomy.taxeditor.session.ICdmEntitySessionManager#dispose(eu.etaxonomy.taxeditor.session.ISessionEventListener)
165
     */
166 158
    void remove(ICdmEntitySessionEnabled owner) {
167 159
        ICdmEntitySession session = ownerSessionMap.get(owner);
168 160
        if(session == null) {
......
186 178
        if(nullSession != null && nullSession.getOwner() == owner) {
187 179
            nullSession = null;
188 180
        }
189

  
190 181
    }
191 182

  
192

  
193 183
    @Override
194 184
    public void disposeAll() {
195 185
        Set<ICdmEntitySessionEnabled> owners =
......
200 190
                session.dispose();
201 191
            }
202 192
        }
203

  
204 193
    }
205 194

  
206 195
    void addToOwnerSessionMap(ICdmEntitySessionEnabled owner, ICdmEntitySession session) {
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/DefaultNewEntityListener.java
18 18
/**
19 19
 * @author cmathew
20 20
 * @date 30 Sep 2015
21
 *
22 21
 */
23 22
public class DefaultNewEntityListener implements NewEntityListener {
24 23

  
......
34 33
            }
35 34
        }
36 35
    }
37

  
38 36
}
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/session/ICdmEntitySession.java
82 82
//     */
83 83
//    public <T extends ICdmBase> void update(T cdmBase, CdmBase affectedObject);
84 84

  
85
    /**
86
     *
87
     */
88 85
    public <T extends CdmBase> void update();
89 86

  
90

  
91
    /**
92
     * @param obj
93
     * @return
94
     */
95 87
    public List<String> getPropertyPaths(Object obj);
96 88

  
97 89
    public void addNewCdmEntity(CdmBase newEntity);
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/preference/CdmStorePropertyTester.java
57 57

  
58 58
    private boolean isRemoting() {
59 59
        return CdmStore.getCurrentSessionManager().isRemoting();
60

  
61 60
    }
62

  
63

  
64 61
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/BigDecimalWithLabelElement.java
25 25
    public BigDecimalWithLabelElement(CdmFormFactory toolkit, ICdmFormElement parentElement, String labelString,
26 26
            Number initialNumber, int style) {
27 27
        super(toolkit, parentElement, labelString, initialNumber, style);
28

  
29 28
    }
30 29

  
31 30
    private BigDecimal start;
......
82 81
            return null;
83 82
        }
84 83
    }
85

  
86 84
}
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/element/FloatWithLabelElement.java
71 71
        this.end = end;
72 72
    }
73 73

  
74

  
75 74
    public void setLimits(int numberOfDigits, Integer start, Integer end){
76 75
        setLimits(numberOfDigits, start.floatValue(), end.floatValue());
77 76
    }
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff