Revision 98754a9b
Added by Cherian Mathew over 10 years ago
.gitattributes | ||
---|---|---|
321 | 321 |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationRemoteConfiguration.java -text |
322 | 322 |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationRemoteController.java -text |
323 | 323 |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/lazyloading/CdmLazyLoader.java -text |
324 |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/remote/CdmPersistentRemoteSource.java -text |
|
325 |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/remote/CdmRemoteSource.java -text |
|
326 |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/remote/CdmRemoteSourceBase.java -text |
|
327 |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/remote/ICdmRemoteSource.java -text |
|
324 | 328 |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/org/hibernate/collection/internal/AbstractPersistentCollection.java -text |
325 | 329 |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/org/hibernate/proxy/AbstractLazyInitializer.java -text |
326 | 330 |
eu.etaxonomy.taxeditor.cdmlib/src/main/resources/eu/etaxonomy/cdm/config.properties -text |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/remote/CdmPersistentRemoteSource.java | ||
---|---|---|
1 |
package eu.etaxonomy.cdm.remote; |
|
2 |
|
|
3 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
|
4 |
|
|
5 |
public class CdmPersistentRemoteSource extends CdmRemoteSourceBase { |
|
6 |
|
|
7 |
public CdmPersistentRemoteSource NewInstance(String name, String server, int port, String contextPath, NomenclaturalCode nomenclaturalCode) { |
|
8 |
return new CdmPersistentRemoteSource(name, server, port, contextPath, nomenclaturalCode); |
|
9 |
} |
|
10 |
|
|
11 |
private CdmPersistentRemoteSource(String name, String server, int port, String contextPath, NomenclaturalCode nomenclaturalCode) { |
|
12 |
super(name, server, port, contextPath, nomenclaturalCode); |
|
13 |
|
|
14 |
} |
|
15 |
|
|
16 |
} |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/remote/CdmRemoteSource.java | ||
---|---|---|
1 |
package eu.etaxonomy.cdm.remote; |
|
2 |
|
|
3 |
import org.springframework.beans.factory.config.BeanDefinition; |
|
4 |
|
|
5 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
|
6 |
|
|
7 |
public class CdmRemoteSource extends CdmRemoteSourceBase { |
|
8 |
|
|
9 |
|
|
10 |
public static CdmRemoteSource NewInstance(String name, String server, int port, String contextPath, NomenclaturalCode nomenclaturalCode) { |
|
11 |
return new CdmRemoteSource(name, server, port, contextPath, nomenclaturalCode); |
|
12 |
} |
|
13 |
|
|
14 |
private CdmRemoteSource(String name, String server, int port, String contextPath, NomenclaturalCode nomenclaturalCode) { |
|
15 |
super(name, server, port, contextPath, nomenclaturalCode); |
|
16 |
|
|
17 |
} |
|
18 |
|
|
19 |
|
|
20 |
} |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/remote/CdmRemoteSourceBase.java | ||
---|---|---|
1 |
package eu.etaxonomy.cdm.remote; |
|
2 |
|
|
3 |
import org.springframework.remoting.RemoteConnectFailureException; |
|
4 |
import org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean; |
|
5 |
|
|
6 |
import eu.etaxonomy.cdm.api.service.IDatabaseService; |
|
7 |
import eu.etaxonomy.cdm.config.CdmSource; |
|
8 |
import eu.etaxonomy.cdm.config.CdmSourceException; |
|
9 |
import eu.etaxonomy.cdm.model.name.NomenclaturalCode; |
|
10 |
|
|
11 |
public class CdmRemoteSourceBase extends CdmSource implements ICdmRemoteSource { |
|
12 |
|
|
13 |
private String contextPath; |
|
14 |
private String baseUrl; |
|
15 |
|
|
16 |
private IDatabaseService databaseService; |
|
17 |
|
|
18 |
protected CdmRemoteSourceBase(String name, String server, int port, String contextPath, NomenclaturalCode nomenclaturalCode) { |
|
19 |
setName(name); |
|
20 |
setServer(server); |
|
21 |
setPort(port); |
|
22 |
setContextPath(contextPath); |
|
23 |
setNomenclaturalCode(nomenclaturalCode); |
|
24 |
if(contextPath == null || contextPath.equals("")) { |
|
25 |
setBaseUrl("http://" + server + ":" + String.valueOf(port)); |
|
26 |
} else { |
|
27 |
setBaseUrl("http://" + server + ":" + String.valueOf(port) + "/" + contextPath); |
|
28 |
} |
|
29 |
HttpInvokerProxyFactoryBean proxy = new HttpInvokerProxyFactoryBean(); |
|
30 |
proxy.setServiceInterface(IDatabaseService.class); |
|
31 |
proxy.setServiceUrl(getBaseUrl() + "/remoting/database.service"); |
|
32 |
proxy.afterPropertiesSet(); |
|
33 |
databaseService = (IDatabaseService) proxy.getObject(); |
|
34 |
} |
|
35 |
|
|
36 |
@Override |
|
37 |
public String getBaseUrl() { |
|
38 |
return baseUrl; |
|
39 |
} |
|
40 |
|
|
41 |
public void setBaseUrl(String baseUrl) { |
|
42 |
this.baseUrl = baseUrl; |
|
43 |
} |
|
44 |
|
|
45 |
@Override |
|
46 |
public String getContextPath() { |
|
47 |
return contextPath; |
|
48 |
} |
|
49 |
|
|
50 |
public void setContextPath(String contextPath) { |
|
51 |
this.contextPath = contextPath; |
|
52 |
} |
|
53 |
|
|
54 |
@Override |
|
55 |
public String getDbSchemaVersion() throws CdmSourceException { |
|
56 |
return databaseService.getDbSchemaVersion(); |
|
57 |
|
|
58 |
} |
|
59 |
|
|
60 |
@Override |
|
61 |
public boolean isDbEmpty() throws CdmSourceException { |
|
62 |
return databaseService.isDbEmpty(); |
|
63 |
|
|
64 |
} |
|
65 |
|
|
66 |
@Override |
|
67 |
public boolean checkConnection() throws CdmSourceException { |
|
68 |
// assuming that database service works implies |
|
69 |
// the connection is up |
|
70 |
// if no exception is thrown then we assume that the |
|
71 |
// connection is up |
|
72 |
|
|
73 |
databaseService.getDbSchemaVersion(); |
|
74 |
|
|
75 |
return true; |
|
76 |
} |
|
77 |
|
|
78 |
@Override |
|
79 |
public String getConnectionMessage() { |
|
80 |
return "Conncting to Remote CDM Server " + getName(); |
|
81 |
} |
|
82 |
|
|
83 |
} |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/remote/ICdmRemoteSource.java | ||
---|---|---|
1 |
package eu.etaxonomy.cdm.remote; |
|
2 |
|
|
3 |
import org.springframework.beans.factory.config.BeanDefinition; |
|
4 |
|
|
5 |
import eu.etaxonomy.cdm.config.ICdmSource; |
|
6 |
|
|
7 |
public interface ICdmRemoteSource extends ICdmSource { |
|
8 |
|
|
9 |
public String getContextPath(); |
|
10 |
|
|
11 |
public String getBaseUrl(); |
|
12 |
|
|
13 |
} |
Also available in: Unified diff
Adding CDM Remote Source set of classes to allow editor to connect to a remote cdmserver