Revision 7a96337f
Added by Cherian Mathew about 7 years ago
.gitignore | ||
---|---|---|
37 | 37 |
eu.etaxonomy.taxeditor.store/hibernate.log |
38 | 38 |
eu.etaxonomy.taxeditor.store/target |
39 | 39 |
eu.etaxonomy.taxeditor.test/screenshots/*.jpeg |
40 |
eu.etaxonomy.taxeditor.test/src/test/resources/.cdm-server-ehcache |
|
41 |
eu.etaxonomy.taxeditor.test/src/test/resources/.cdmLibrary/remote-webapp |
|
40 | 42 |
eu.etaxonomy.taxeditor.test/target |
41 | 43 |
eu.etaxonomy.taxeditor/.settings |
42 | 44 |
eu.etaxonomy.taxeditor/target |
eu.etaxonomy.taxeditor.application/.classpath | ||
---|---|---|
4 | 4 |
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> |
5 | 5 |
<classpathentry including="**/*.java" kind="src" path="src/main/java"/> |
6 | 6 |
<classpathentry kind="src" path="src/test/java"/> |
7 |
<classpathentry kind="src" path="src/main/resources/"/> |
|
7 | 8 |
<classpathentry kind="output" path="target/classes"/> |
8 | 9 |
</classpath> |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/cdm/api/application/CdmApplicationState.java | ||
---|---|---|
246 | 246 |
URL fileURL = bundle.getEntry(jar); |
247 | 247 |
File file = null; |
248 | 248 |
try { |
249 |
String urlString = FileLocator.resolve(fileURL).toExternalForm().replace(" ", "%20");;
|
|
249 |
String urlString = FileLocator.resolve(fileURL).toExternalForm().replace(" ", "%20"); |
|
250 | 250 |
file = new File(new URI(urlString)); |
251 | 251 |
JarFile jarFile = new JarFile(file); |
252 | 252 |
Manifest manifest = jarFile.getManifest(); |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/cache/CdmTransientEntityCacher.java | ||
---|---|---|
73 | 73 |
|
74 | 74 |
cache = new Cache(getEntityCacheConfiguration(cacheId)); |
75 | 75 |
|
76 |
CacheManager.create().removeCache(cache.getName()); |
|
76 | 77 |
CacheManager.create().addCache(cache); |
77 | 78 |
|
78 | 79 |
this.cdmEntitySessionManager = cdmEntitySessionManager; |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/server/CDMServerUtils.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2015 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
10 |
package eu.etaxonomy.taxeditor.remoting.server; |
|
11 |
|
|
12 |
import java.io.File; |
|
13 |
import java.io.IOException; |
|
14 |
|
|
15 |
import org.apache.commons.io.FileUtils; |
|
16 |
import org.apache.commons.lang.StringEscapeUtils; |
|
17 |
|
|
18 |
import eu.etaxonomy.cdm.api.application.CdmApplicationUtils; |
|
19 |
import eu.etaxonomy.cdm.config.CdmPersistentXMLSource.CdmSourceProperties; |
|
20 |
import eu.etaxonomy.cdm.database.CdmPersistentDataSource; |
|
21 |
|
|
22 |
/** |
|
23 |
* @author cmathew |
|
24 |
* @date 11 Nov 2015 |
|
25 |
* |
|
26 |
*/ |
|
27 |
public class CDMServerUtils { |
|
28 |
|
|
29 |
|
|
30 |
public static String convertEditorToServerConfig() { |
|
31 |
StringBuilder configStringBuilder = new StringBuilder(); |
|
32 |
configStringBuilder.append("<?xml version=\"1.0\" encoding=\"UTF-8\"?> " + System.lineSeparator()); |
|
33 |
configStringBuilder.append("<!-- DO NOT EDIT THIS FILE MANUALLY. -->"); |
|
34 |
configStringBuilder.append("<!-- It is created by the Taxonomic Editor for launching a managed CDM Server. -->"); |
|
35 |
configStringBuilder.append("<beans xmlns=\"http://www.springframework.org/schema/beans\"" + System.lineSeparator()); |
|
36 |
configStringBuilder.append(" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + System.lineSeparator()); |
|
37 |
configStringBuilder.append(" xmlns:tx=\"http://www.springframework.org/schema/tx\"" + System.lineSeparator()); |
|
38 |
configStringBuilder.append(" xmlns:context=\"http://www.springframework.org/schema/context\"" + System.lineSeparator()); |
|
39 |
configStringBuilder.append(" xsi:schemaLocation=\"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd" + System.lineSeparator()); |
|
40 |
configStringBuilder.append(" http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd" + System.lineSeparator()); |
|
41 |
configStringBuilder.append(" http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd" + System.lineSeparator()); |
|
42 |
configStringBuilder.append("\">" + System.lineSeparator()); |
|
43 |
configStringBuilder.append(" <bean id=\"dataSourceProperties\" class=\"eu.etaxonomy.cdm.remote.config.DataSourceProperties\">" + System.lineSeparator()); |
|
44 |
configStringBuilder.append(" <property name=\"propsMap\">" + System.lineSeparator()); |
|
45 |
configStringBuilder.append(" <map/>" + System.lineSeparator()); |
|
46 |
configStringBuilder.append(" </property>" + System.lineSeparator()); |
|
47 |
configStringBuilder.append(" </bean>" + System.lineSeparator()); |
|
48 |
|
|
49 |
for(CdmPersistentDataSource dataSource : CdmPersistentDataSource.getAllDataSources()) { |
|
50 |
String beanId = dataSource.getName(); |
|
51 |
String user = dataSource.getUsername(); |
|
52 |
String password = dataSource.getPassword(); |
|
53 |
String driverClass = dataSource.getCdmSourceProperty(CdmSourceProperties.DRIVER_CLASS); |
|
54 |
String jdbcUrl = StringEscapeUtils.escapeXml(dataSource.getCdmSourceProperty(CdmSourceProperties.URL)); |
|
55 |
configStringBuilder.append(" <bean id=\"" + beanId + "\" lazy-init=\"true\" class=\"com.mchange.v2.c3p0.ComboPooledDataSource\">" + System.lineSeparator()); |
|
56 |
configStringBuilder.append(" <property name=\"driverClass\" value=\"" + driverClass + "\"/>" + System.lineSeparator()); |
|
57 |
configStringBuilder.append(" <property name=\"user\" value=\"" + user + "\"/>" + System.lineSeparator()); |
|
58 |
configStringBuilder.append(" <property name=\"password\" value=\"" + password + "\"/>" + System.lineSeparator()); |
|
59 |
configStringBuilder.append(" <property name=\"jdbcUrl\" value=\"" + jdbcUrl + "\"/>" + System.lineSeparator()); |
|
60 |
configStringBuilder.append(" </bean>" + System.lineSeparator()); |
|
61 |
|
|
62 |
} |
|
63 |
configStringBuilder.append("</beans>" + System.lineSeparator()); |
|
64 |
|
|
65 |
return configStringBuilder.toString(); |
|
66 |
} |
|
67 |
|
|
68 |
public static File writeManagedServerConfig(String config, String fileName) throws IOException { |
|
69 |
File managedConfigFile = new File(CdmApplicationUtils.getWritableResourceDir(), fileName); |
|
70 |
if(managedConfigFile.exists()) { |
|
71 |
managedConfigFile.delete(); |
|
72 |
} |
|
73 |
if(managedConfigFile.createNewFile()) { |
|
74 |
FileUtils.writeStringToFile(managedConfigFile, config); |
|
75 |
} |
|
76 |
return managedConfigFile; |
|
77 |
} |
|
78 |
|
|
79 |
} |
eu.etaxonomy.taxeditor.cdmlib/src/main/java/eu/etaxonomy/taxeditor/remoting/source/CdmServerInfo.java | ||
---|---|---|
73 | 73 |
private final static int PORT_LOCALHOST_DEV = 8080; |
74 | 74 |
private final static String BASEPATH_LOCALHOST_DEV = ""; |
75 | 75 |
|
76 |
public final static int NULL_PORT = -1; |
|
77 |
public final static String NULL_PORT_STRING = "N/A"; |
|
78 |
|
|
79 |
|
|
76 | 80 |
private final String name; |
77 | 81 |
private final String server; |
78 |
private final int port;
|
|
82 |
private int port; |
|
79 | 83 |
private final List<CdmInstanceInfo> instances; |
80 | 84 |
|
81 | 85 |
private static List<CdmServerInfo> cdmServerInfoList; |
... | ... | |
94 | 98 |
|
95 | 99 |
|
96 | 100 |
public CdmInstanceInfo addInstance(String name, String basePath) { |
97 |
CdmInstanceInfo cii = new CdmInstanceInfo(name, basePath); |
|
101 |
String _basePath = basePath; |
|
102 |
if(isLocalhostMgd()) { |
|
103 |
_basePath = ""; |
|
104 |
} |
|
105 |
CdmInstanceInfo cii = new CdmInstanceInfo(name, _basePath); |
|
98 | 106 |
instances.add(cii); |
99 | 107 |
return cii; |
100 | 108 |
|
... | ... | |
212 | 220 |
} |
213 | 221 |
|
214 | 222 |
public void addInstancesFromDataSourcesConfig() { |
215 |
|
|
216 | 223 |
for(ICdmDataSource dataSource : CdmPersistentDataSource.getAllDataSources()){ |
217 |
logger.warn("Adding local instance " + dataSource.getName());
|
|
224 |
logger.info("Adding local instance " + dataSource.getName());
|
|
218 | 225 |
addInstance(dataSource.getName(), dataSource.getName()); |
219 | 226 |
} |
220 |
|
|
221 | 227 |
} |
222 | 228 |
|
223 | 229 |
public String toString(String instanceName, int port) { |
... | ... | |
249 | 255 |
} |
250 | 256 |
|
251 | 257 |
public boolean pingServer() { |
258 |
if(isLocalhostMgd()) { |
|
259 |
return true; |
|
260 |
} |
|
252 | 261 |
try { |
253 | 262 |
Socket s = new Socket(server, port); |
254 | 263 |
logger.info("[CDM-Server] Available @ " + server + ":" + port ); |
... | ... | |
365 | 374 |
cdmServerInfoList.add(new CdmServerInfo(NAME_DEMO_2, SERVER_DEMO_2, 80)); |
366 | 375 |
cdmServerInfoList.add(new CdmServerInfo(NAME_TEST, SERVER_TEST, 80)); |
367 | 376 |
cdmServerInfoList.add(new CdmServerInfo(NAME_LOCALHOST, SERVER_LOCALHOST, 8080)); |
368 |
cdmServerInfoList.add(new CdmServerInfo(NAME_LOCALHOST_MGD, SERVER_LOCALHOST,8080));
|
|
377 |
cdmServerInfoList.add(new CdmServerInfo(NAME_LOCALHOST_MGD, SERVER_LOCALHOST,NULL_PORT));
|
|
369 | 378 |
} |
370 | 379 |
return cdmServerInfoList; |
371 | 380 |
} |
... | ... | |
383 | 392 |
return port; |
384 | 393 |
} |
385 | 394 |
|
395 |
public void setPort(int port) { |
|
396 |
this.port = port; |
|
397 |
} |
|
386 | 398 |
|
387 | 399 |
public List<CdmInstanceInfo> getInstances() throws CDMServerException { |
388 | 400 |
if(instances.isEmpty()) { |
... | ... | |
417 | 429 |
/** |
418 | 430 |
* The full path of the instance including the the prefix (if any). |
419 | 431 |
* E.g. for an EDIT instance this would be something like "cdmserver/remoting" |
420 |
* For a managed local server this would simply be "remoting"
|
|
432 |
* For a managed local server this would simply be "" |
|
421 | 433 |
*/ |
422 | 434 |
private final String basePath; |
423 | 435 |
|
eu.etaxonomy.taxeditor.cdmlib/src/main/resources/etc/jetty/.svnignore | ||
---|---|---|
1 |
cdmlib-remote-webapp.war |
eu.etaxonomy.taxeditor.store/META-INF/MANIFEST.MF | ||
---|---|---|
68 | 68 |
org.eclipse.core.databinding.observable, |
69 | 69 |
org.eclipse.core.databinding.property, |
70 | 70 |
org.eclipse.jface.databinding |
71 |
Import-Package: org.eclipse.core.commands, |
|
71 |
Import-Package: eu.etaxonomy.taxeditor.webapp, |
|
72 |
org.eclipse.core.commands, |
|
72 | 73 |
org.eclipse.core.commands.operations, |
73 | 74 |
org.eclipse.core.expressions, |
74 | 75 |
org.eclipse.core.runtime, |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/store/CdmStore.java | ||
---|---|---|
50 | 50 |
import eu.etaxonomy.taxeditor.ui.dialog.RemotingLoginDialog; |
51 | 51 |
import eu.etaxonomy.taxeditor.util.ProgressMonitorClientManager; |
52 | 52 |
import eu.etaxonomy.taxeditor.view.datasource.CdmDataSourceViewPart; |
53 |
import eu.etaxonomy.taxeditor.webapp.CDMServer; |
|
53 | 54 |
|
54 | 55 |
/** |
55 | 56 |
* This implementation of ICdmDataRepository depends on hibernate sessions to |
... | ... | |
90 | 91 |
|
91 | 92 |
private static CdmStoreConnector job; |
92 | 93 |
|
94 |
private static CDMServer managedServer; |
|
95 |
|
|
93 | 96 |
private Language language; |
94 | 97 |
|
95 | 98 |
private ICdmSource cdmSource; |
... | ... | |
594 | 597 |
return cdmSource; |
595 | 598 |
} |
596 | 599 |
|
600 |
|
|
601 |
public static void setManagedServer(CDMServer server) { |
|
602 |
managedServer = server; |
|
603 |
} |
|
604 |
|
|
605 |
public static CDMServer getManagedServer() { |
|
606 |
return managedServer; |
|
607 |
} |
|
608 |
|
|
597 | 609 |
} |
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/RemotingLoginDialog.java | ||
---|---|---|
9 | 9 |
*/ |
10 | 10 |
package eu.etaxonomy.taxeditor.ui.dialog; |
11 | 11 |
|
12 |
import java.io.File; |
|
13 |
import java.io.IOException; |
|
12 | 14 |
import java.text.SimpleDateFormat; |
13 | 15 |
import java.util.Date; |
14 | 16 |
import java.util.HashMap; |
... | ... | |
43 | 45 |
import org.eclipse.ui.forms.events.ExpansionEvent; |
44 | 46 |
import org.eclipse.ui.forms.events.IExpansionListener; |
45 | 47 |
import org.eclipse.ui.forms.widgets.ExpandableComposite; |
48 |
import org.eclipse.ui.progress.IProgressConstants; |
|
46 | 49 |
import org.eclipse.wb.swt.SWTResourceManager; |
47 | 50 |
import org.osgi.service.prefs.BackingStoreException; |
48 | 51 |
import org.osgi.service.prefs.Preferences; |
... | ... | |
53 | 56 |
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys; |
54 | 57 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil; |
55 | 58 |
import eu.etaxonomy.taxeditor.remoting.server.CDMServerException; |
59 |
import eu.etaxonomy.taxeditor.remoting.server.CDMServerUtils; |
|
56 | 60 |
import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteSource; |
57 | 61 |
import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfo; |
58 | 62 |
import eu.etaxonomy.taxeditor.remoting.source.CdmServerInfo.CdmInstanceInfo; |
59 | 63 |
import eu.etaxonomy.taxeditor.remoting.source.ICdmRemoteSource; |
60 | 64 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
65 |
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin; |
|
66 |
import eu.etaxonomy.taxeditor.webapp.CDMEmbeddedServerException; |
|
67 |
import eu.etaxonomy.taxeditor.webapp.CDMServer; |
|
68 |
import eu.etaxonomy.taxeditor.webapp.ICDMServerError; |
|
69 |
|
|
61 | 70 |
|
62 | 71 |
/** |
63 | 72 |
* @author cmathew |
64 | 73 |
* @date 20 Jan 2015 |
65 | 74 |
* |
66 | 75 |
*/ |
67 |
public class RemotingLoginDialog extends Dialog { |
|
76 |
public class RemotingLoginDialog extends Dialog implements ICDMServerError {
|
|
68 | 77 |
|
69 | 78 |
protected Object result; |
70 | 79 |
protected Shell shlConnect; |
... | ... | |
78 | 87 |
|
79 | 88 |
private final static String STATUS_AVAILABLE = "Available"; |
80 | 89 |
private final static String STATUS_NOT_AVAILABLE = "Not Available"; |
90 |
private final static String STATUS_STARTED = "Started"; |
|
91 |
private final static String STATUS_NOT_STARTED = "Not Started"; |
|
81 | 92 |
private final static String STATUS_RETRIEVING = "Retrieving ..."; |
82 | 93 |
private final static String STATUS_CHECKING_AVAILABILITY = "Checking ..."; |
83 | 94 |
private final static String STATUS_NO_INSTANCES = "No Instances Found"; |
... | ... | |
98 | 109 |
private final static String LAST_SERVER_KEY = "lastServerKey"; |
99 | 110 |
private final static String LAST_INSTANCE_KEY = "lastInstanceKey"; |
100 | 111 |
|
112 |
private final static String REFRESH_LABEL = "Refresh"; |
|
101 | 113 |
|
102 | 114 |
private Composite remotingComposite; |
103 | 115 |
private CdmServerInfo selectedCsii; |
104 | 116 |
private CdmInstanceInfo selectedCdmInstance; |
105 | 117 |
private Button btnCdmServerRefresh; |
118 |
private Button btnCdmInstanceRefresh; |
|
119 |
private Button btnStopServer; |
|
106 | 120 |
private Composite loginComposite; |
107 | 121 |
private Label lblLogin; |
108 | 122 |
private Text txtLogin; |
... | ... | |
133 | 147 |
private boolean autoConnect = false; |
134 | 148 |
private boolean loadLoginPrefs = true; |
135 | 149 |
private boolean isDevRemoteSource = false; |
136 |
|
|
150 |
private Job serverJob; |
|
137 | 151 |
/** |
138 | 152 |
* Create the dialog. |
139 | 153 |
* @param parent |
... | ... | |
166 | 180 |
* @return the result |
167 | 181 |
*/ |
168 | 182 |
public Object open() { |
169 |
// ICdmRemoteSource devRemoteSource = CdmServerInfo.getDevServerRemoteSource(); |
|
170 |
// if(devRemoteSource != null) { |
|
171 |
// connect(devRemoteSource); |
|
172 |
// } else { |
|
183 |
|
|
173 | 184 |
createContents(); |
174 | 185 |
if(serverName == null && instanceName == null) { |
175 | 186 |
readPrefLastServerInstance(); |
... | ... | |
189 | 200 |
display.sleep(); |
190 | 201 |
} |
191 | 202 |
} |
192 |
//} |
|
203 |
|
|
193 | 204 |
return result; |
194 | 205 |
} |
195 | 206 |
|
... | ... | |
258 | 269 |
comboCdmInstance.addSelectionListener(new SelectionAdapter() { |
259 | 270 |
@Override |
260 | 271 |
public void widgetSelected(SelectionEvent e) { |
261 |
updateSelectedCdmInstance(); |
|
262 |
checkSelectedCdmInstance(); |
|
272 |
refreshCdmInstance(); |
|
263 | 273 |
} |
264 | 274 |
}); |
265 | 275 |
GridData gd_comboCdmInstance = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1); |
... | ... | |
274 | 284 |
gd_txtCdmInstanceStatus.widthHint = 100; |
275 | 285 |
txtCdmInstanceStatus.setLayoutData(gd_txtCdmInstanceStatus); |
276 | 286 |
|
277 |
Button btnCdmInstanceRefresh = new Button(cdmServerComposite, SWT.FLAT);
|
|
287 |
btnCdmInstanceRefresh = new Button(cdmServerComposite, SWT.FLAT); |
|
278 | 288 |
btnCdmInstanceRefresh.addSelectionListener(new SelectionAdapter() { |
279 | 289 |
@Override |
280 | 290 |
public void widgetSelected(SelectionEvent e) { |
... | ... | |
328 | 338 |
btnConnect.addMouseListener(new MouseAdapter() { |
329 | 339 |
@Override |
330 | 340 |
public void mouseUp(MouseEvent e) { |
331 |
connect(); |
|
341 |
if(selectedCsii.isLocalhostMgd() && !isSelectedCdmInstanceRunningInManagedServer()) { |
|
342 |
startManagedServer(); |
|
343 |
} else { |
|
344 |
connect(); |
|
345 |
} |
|
332 | 346 |
} |
333 | 347 |
}); |
334 | 348 |
btnConnect.setText("Connect"); |
... | ... | |
404 | 418 |
txtServerVersion = new Text(compAdvanced, SWT.BORDER); |
405 | 419 |
txtServerVersion.setEditable(false); |
406 | 420 |
txtServerVersion.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); |
407 |
new Label(compAdvanced, SWT.NONE); |
|
408 |
new Label(compAdvanced, SWT.NONE); |
|
421 |
btnStopServer = new Button(compAdvanced, SWT.FLAT); |
|
422 |
btnStopServer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1)); |
|
423 |
btnStopServer.addMouseListener(new MouseAdapter() { |
|
424 |
@Override |
|
425 |
public void mouseUp(MouseEvent e) { |
|
426 |
stopManagedServer(); |
|
427 |
} |
|
428 |
}); |
|
429 |
btnStopServer.setText("Stop Managed Server"); |
|
409 | 430 |
|
410 | 431 |
lblEditorVersion = new Label(compAdvanced, SWT.CENTER); |
411 | 432 |
lblEditorVersion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); |
... | ... | |
504 | 525 |
private void updatePort() { |
505 | 526 |
txtPort.setText(""); |
506 | 527 |
if(selectedCsii != null) { |
507 |
txtPort.setText(String.valueOf(selectedCsii.getPort())); |
|
528 |
int port = selectedCsii.getPort(); |
|
529 |
if(port == CdmServerInfo.NULL_PORT) { |
|
530 |
txtPort.setText(CdmServerInfo.NULL_PORT_STRING); |
|
531 |
} else { |
|
532 |
txtPort.setText(String.valueOf(port)); |
|
533 |
} |
|
508 | 534 |
} |
509 | 535 |
} |
510 | 536 |
|
511 | 537 |
private int getPort() { |
512 |
int port = 0;
|
|
538 |
int port = CdmServerInfo.NULL_PORT;
|
|
513 | 539 |
try { |
514 | 540 |
port = Integer.valueOf(txtPort.getText()); |
515 | 541 |
} catch (NumberFormatException nfe) { |
516 |
setMessage("Port should be an integer"); |
|
542 |
if(!CdmServerInfo.NULL_PORT_STRING.equals(txtPort.getText())) { |
|
543 |
setMessage("Port should be an integer"); |
|
544 |
} |
|
517 | 545 |
} |
518 | 546 |
return port; |
519 | 547 |
} |
... | ... | |
531 | 559 |
if(selectedCsii.pingServer()) { |
532 | 560 |
txtCdmServerStatus.setText(STATUS_AVAILABLE); |
533 | 561 |
populateCdmInstanceCombo(true); |
534 |
txtServerVersion.setText(selectedCsii.getCdmlibServicesVersion()); |
|
535 |
txtServerVersion.setToolTipText(generateLastModifiedTooltip(selectedCsii.getCdmlibLastModified())); |
|
536 |
|
|
562 |
String serverVersionTimestamp = generateLastModifiedTooltip(selectedCsii.getCdmlibLastModified()); |
|
563 |
txtServerVersion.setText(selectedCsii.getCdmlibServicesVersion() + ":" + serverVersionTimestamp); |
|
537 | 564 |
} else { |
538 | 565 |
txtCdmServerStatus.setText(STATUS_NOT_AVAILABLE); |
539 | 566 |
comboCdmInstance.removeAll(); |
... | ... | |
549 | 576 |
txtCdmInstanceStatus.setText(STATUS_RETRIEVING); |
550 | 577 |
txtCdmInstanceStatus.setToolTipText(""); |
551 | 578 |
|
552 |
Job job = new Job("Retrieve Server Instances") {
|
|
579 |
serverJob = new Job("Retrieve Server Instances") {
|
|
553 | 580 |
@Override |
554 | 581 |
protected IStatus run(IProgressMonitor monitor) { |
555 | 582 |
try { |
... | ... | |
575 | 602 |
} else { |
576 | 603 |
comboCdmInstance.select(instanceIndex); |
577 | 604 |
} |
578 |
updateSelectedCdmInstance(); |
|
579 |
checkSelectedCdmInstance(); |
|
605 |
refreshCdmInstance(); |
|
580 | 606 |
comboCdmInstance.setEnabled(true); |
581 | 607 |
if(autoConnect) { |
582 | 608 |
connect(); |
... | ... | |
607 | 633 |
|
608 | 634 |
if(txtCdmServerStatus.getText().equals(STATUS_AVAILABLE) && !isDevRemoteSource) { |
609 | 635 |
// Start the Job |
610 |
job.schedule();
|
|
636 |
serverJob.schedule();
|
|
611 | 637 |
} |
612 | 638 |
|
639 |
|
|
613 | 640 |
} |
614 | 641 |
|
615 | 642 |
private void refreshCdmInstance() { |
... | ... | |
617 | 644 |
clearOnInstanceChange(); |
618 | 645 |
updateSelectedCdmInstance(); |
619 | 646 |
checkSelectedCdmInstance(); |
647 |
updateManagedServerControls(); |
|
620 | 648 |
} |
621 | 649 |
|
622 | 650 |
private void updateSelectedCdmInstance() { |
623 | 651 |
int selIndex = comboCdmInstance.getSelectionIndex(); |
624 | 652 |
if(selIndex != -1) { |
625 | 653 |
selectedCdmInstance = selectedCsii.getInstanceFromName(comboCdmInstance.getItem(selIndex)); |
654 |
|
|
626 | 655 |
if(loadLoginPrefs && !isDevRemoteSource) { |
627 | 656 |
readPrefCredentials(); |
628 | 657 |
} |
629 | 658 |
} |
630 | 659 |
} |
631 | 660 |
|
661 |
private void updateManagedServerControls() { |
|
662 |
if(selectedCsii.isLocalhostMgd()) { |
|
663 |
if(isSelectedCdmInstanceRunningInManagedServer()) { |
|
664 |
txtCdmInstanceStatus.setText(STATUS_STARTED); |
|
665 |
} else { |
|
666 |
txtCdmInstanceStatus.setText(STATUS_NOT_STARTED); |
|
667 |
} |
|
668 |
btnConnect.setEnabled(true); |
|
669 |
selectedCsii.setPort(getManagedServerPort()); |
|
670 |
updatePort(); |
|
671 |
} |
|
672 |
|
|
673 |
|
|
674 |
if(isManagedServerRunning()) { |
|
675 |
btnStopServer.setEnabled(true); |
|
676 |
} else { |
|
677 |
btnStopServer.setEnabled(false); |
|
678 |
} |
|
679 |
} |
|
680 |
|
|
681 |
private boolean isManagedServerRunning() { |
|
682 |
return CdmStore.getManagedServer() != null && CdmStore.getManagedServer().isAlive(); |
|
683 |
} |
|
684 |
|
|
685 |
private boolean isSelectedCdmInstanceRunningInManagedServer() { |
|
686 |
return CdmStore.getManagedServer() != null && |
|
687 |
CdmStore.getManagedServer().isAlive() && |
|
688 |
selectedCsii.isLocalhostMgd() && |
|
689 |
CdmStore.getManagedServer().getDataSourceName().equals(selectedCdmInstance.getName()); |
|
690 |
} |
|
691 |
|
|
692 |
private boolean isActiveCdmInstanceRunningInManagedServer() { |
|
693 |
return CdmStore.getManagedServer() != null && |
|
694 |
CdmStore.getManagedServer().isAlive() && |
|
695 |
CdmStore.isActive() && |
|
696 |
CdmServerInfo.NAME_LOCALHOST_MGD.equals(CdmStore.getActiveCdmSource().getName()); |
|
697 |
} |
|
698 |
|
|
699 |
|
|
700 |
private void startManagedServer() { |
|
701 |
if(isManagedServerRunning()) { |
|
702 |
if(CdmStore.getManagedServer().getDataSourceName().equals(selectedCdmInstance.getName())) { |
|
703 |
return; |
|
704 |
} else { |
|
705 |
Display.getDefault().syncExec(new Runnable() { |
|
706 |
@Override |
|
707 |
public void run() { |
|
708 |
stopManagedServer(); |
|
709 |
} |
|
710 |
}); |
|
711 |
} |
|
712 |
} |
|
713 |
|
|
714 |
|
|
715 |
Job job = new Job("Managed CDM Server Launch") { |
|
716 |
|
|
717 |
@Override |
|
718 |
public IStatus run(IProgressMonitor monitor) { |
|
719 |
String mgdServerConfigFileName = "mgd.datasources.xml"; |
|
720 |
String config = CDMServerUtils.convertEditorToServerConfig(); |
|
721 |
File managedServerConfigFile; |
|
722 |
int maxUnits = 50; |
|
723 |
monitor.beginTask("Launching Managed CDM Server", maxUnits); |
|
724 |
try { |
|
725 |
monitor.subTask("Generating datasources config file for " + selectedCdmInstance.getName()); |
|
726 |
managedServerConfigFile = CDMServerUtils.writeManagedServerConfig(config, mgdServerConfigFileName); |
|
727 |
monitor.worked(1); |
|
728 |
CdmStore.setManagedServer(new CDMServer(selectedCdmInstance.getName(), managedServerConfigFile)); |
|
729 |
monitor.subTask("Starting Managed CDM Server. This may take a while."); |
|
730 |
CdmStore.getManagedServer().start(false, RemotingLoginDialog.this); |
|
731 |
int serverUnits = 0; |
|
732 |
|
|
733 |
// the following loop is a 'fake' progress monitoring where the progress |
|
734 |
// bar is advanced by one unit every second until maxUnits -2 |
|
735 |
while(!CdmStore.getManagedServer().isStarted()) { |
|
736 |
if(serverUnits < maxUnits - 2) { |
|
737 |
try { |
|
738 |
Thread.sleep(1000); |
|
739 |
} catch (InterruptedException e) { |
|
740 |
} |
|
741 |
monitor.worked(1); |
|
742 |
serverUnits++; |
|
743 |
} |
|
744 |
} |
|
745 |
Display.getDefault().asyncExec(new Runnable() { |
|
746 |
@Override |
|
747 |
public void run() { |
|
748 |
hide(false); |
|
749 |
updateManagedServerControls(); |
|
750 |
connect(); |
|
751 |
} |
|
752 |
}); |
|
753 |
} catch (IOException ioe) { |
|
754 |
MessagingUtils.errorDialog("Error generating server config file", |
|
755 |
this, |
|
756 |
ioe.getMessage(), |
|
757 |
TaxeditorStorePlugin.PLUGIN_ID, |
|
758 |
ioe, |
|
759 |
true); |
|
760 |
} catch (CDMEmbeddedServerException cse) { |
|
761 |
MessagingUtils.errorDialog("Error starting managed server", |
|
762 |
this, |
|
763 |
cse.getMessage(), |
|
764 |
TaxeditorStorePlugin.PLUGIN_ID, |
|
765 |
cse, |
|
766 |
true); |
|
767 |
} finally { |
|
768 |
monitor.done(); |
|
769 |
} |
|
770 |
return Status.OK_STATUS; |
|
771 |
} |
|
772 |
}; |
|
773 |
|
|
774 |
// configure the job |
|
775 |
job.setProperty(IProgressConstants.KEEP_PROPERTY, true); |
|
776 |
job.setUser(true); |
|
777 |
// schedule job |
|
778 |
hide(true); |
|
779 |
job.schedule(); |
|
780 |
} |
|
781 |
|
|
782 |
private void stopManagedServer() { |
|
783 |
try { |
|
784 |
CdmStore.getManagedServer().stop(); |
|
785 |
} catch (Exception e) { |
|
786 |
MessagingUtils.errorDialog("Error stopping managed server", |
|
787 |
this, |
|
788 |
"Could not stop managed server running at port " + CdmStore.getManagedServer().getPort() + ". Please stop it manually", |
|
789 |
TaxeditorStorePlugin.PLUGIN_ID, |
|
790 |
e, |
|
791 |
true); |
|
792 |
} |
|
793 |
CdmStore.setManagedServer(null); |
|
794 |
updateManagedServerControls(); |
|
795 |
} |
|
796 |
|
|
797 |
private int getManagedServerPort() { |
|
798 |
return CdmStore.getManagedServer() == null ? CdmServerInfo.NULL_PORT : CdmStore.getManagedServer().getPort(); |
|
799 |
} |
|
800 |
|
|
632 | 801 |
private void checkSelectedCdmInstance() { |
633 | 802 |
boolean available = false; |
634 | 803 |
String status = STATUS_NOT_AVAILABLE; |
... | ... | |
676 | 845 |
setMessage(message); |
677 | 846 |
} |
678 | 847 |
} |
679 |
|
|
680 | 848 |
} |
681 |
|
|
682 | 849 |
} |
683 | 850 |
|
684 | 851 |
private void connect() { |
... | ... | |
845 | 1012 |
} |
846 | 1013 |
|
847 | 1014 |
private String generateLastModifiedTooltip(String cdmlibLastModified) { |
848 |
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd 'at' HH:mm:ss z"); |
|
1015 |
if(StringUtils.isBlank(cdmlibLastModified)) { |
|
1016 |
return ""; |
|
1017 |
} |
|
1018 |
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd.HH.mm.z"); |
|
849 | 1019 |
Date cdmlibLastModifiedDate; |
850 | 1020 |
String cdmlibLastModifiedTimestamp = ""; |
851 | 1021 |
|
852 | 1022 |
cdmlibLastModifiedDate = new Date(Long.valueOf(cdmlibLastModified)); |
853 | 1023 |
cdmlibLastModifiedTimestamp = sdf.format(cdmlibLastModifiedDate); |
854 | 1024 |
|
855 |
return "last modified : " + cdmlibLastModifiedTimestamp;
|
|
1025 |
return cdmlibLastModifiedTimestamp; |
|
856 | 1026 |
} |
857 | 1027 |
|
858 | 1028 |
private void setEditorInfo() { |
859 | 1029 |
txtEditorCDMVersion.setText(CdmMetaData.getDbSchemaVersion()); |
860 |
txtEditorVersion.setText(CdmApplicationState.getCdmlibVersion());
|
|
861 |
txtEditorVersion.setToolTipText(generateLastModifiedTooltip(CdmApplicationState.getCdmlibLastModified()));
|
|
1030 |
String editorVersionTimestamp = generateLastModifiedTooltip(CdmApplicationState.getCdmlibLastModified());
|
|
1031 |
txtEditorVersion.setText(CdmApplicationState.getCdmlibVersion() + ":" + editorVersionTimestamp);
|
|
862 | 1032 |
} |
863 | 1033 |
|
864 | 1034 |
private void clearOnServerChange() { |
... | ... | |
876 | 1046 |
txtServerCDMVersion.setText(""); |
877 | 1047 |
} |
878 | 1048 |
|
879 |
private void updateOnServerChange(String serverVersion, String serverVersionTooltip) { |
|
1049 |
/** |
|
1050 |
* {@inheritDoc} |
|
1051 |
*/ |
|
1052 |
@Override |
|
1053 |
public void handleError(final Throwable t) { |
|
1054 |
|
|
1055 |
Display.getDefault().syncExec(new Runnable() { |
|
1056 |
@Override |
|
1057 |
public void run() { |
|
1058 |
serverJob.cancel(); |
|
880 | 1059 |
|
1060 |
String title = "CDM Server launch error"; |
|
1061 |
String message = t.getMessage(); |
|
1062 |
|
|
1063 |
|
|
1064 |
MessagingUtils.errorDialog(title, |
|
1065 |
this, |
|
1066 |
message, |
|
1067 |
TaxeditorStorePlugin.PLUGIN_ID, |
|
1068 |
t, |
|
1069 |
true); |
|
1070 |
} |
|
1071 |
}); |
|
881 | 1072 |
} |
882 | 1073 |
|
1074 |
|
|
883 | 1075 |
} |
eu.etaxonomy.taxeditor.test/META-INF/MANIFEST.MF | ||
---|---|---|
21 | 21 |
org.apache.log4j, |
22 | 22 |
org.hamcrest, |
23 | 23 |
org.eclipse.swtbot.eclipse.core, |
24 |
org.eclipse.swtbot.eclipse.finder |
|
24 |
org.eclipse.swtbot.eclipse.finder, |
|
25 |
eu.etaxonomy.taxeditor.webapp;bundle-version="3.12.0" |
|
25 | 26 |
Eclipse-RegisterBuddy: org.apache.log4j, org.eclipse.swtbot.swt.finder |
26 | 27 |
Bundle-ClassPath: ., |
27 | 28 |
lib/byte-buddy-0.5.1.jar, |
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/BaseRemotingTest.java | ||
---|---|---|
8 | 8 |
*/ |
9 | 9 |
package eu.etaxonomy.taxeditor.httpinvoker; |
10 | 10 |
|
11 |
import java.io.File; |
|
12 |
import java.io.FileInputStream; |
|
13 |
import java.io.InputStream; |
|
14 | 11 |
import java.lang.reflect.Field; |
15 |
import java.net.URL; |
|
16 | 12 |
import java.util.Map; |
17 |
import java.util.Properties; |
|
18 | 13 |
|
19 | 14 |
import net.sf.ehcache.CacheManager; |
20 | 15 |
|
21 | 16 |
import org.apache.log4j.Logger; |
22 |
import org.eclipse.core.runtime.FileLocator; |
|
23 |
import org.eclipse.core.runtime.Platform; |
|
24 | 17 |
import org.junit.Assert; |
25 | 18 |
import org.junit.BeforeClass; |
26 |
import org.osgi.framework.Bundle; |
|
27 |
import org.springframework.core.io.ClassPathResource; |
|
28 |
import org.springframework.core.io.Resource; |
|
29 | 19 |
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; |
30 | 20 |
import org.springframework.security.core.Authentication; |
31 | 21 |
import org.springframework.security.core.context.SecurityContextHolder; |
... | ... | |
63 | 53 |
public abstract class BaseRemotingTest extends ThreadedTest { |
64 | 54 |
private static final Logger logger = Logger.getLogger(BaseRemotingTest.class); |
65 | 55 |
|
66 |
|
|
67 |
public static final Resource SERVER_PROPERTIES_FILE = |
|
68 |
new ClassPathResource("server.properties"); |
|
69 |
|
|
70 | 56 |
private static ICdmRemoteSource cdmRemoteSource; |
71 | 57 |
private static CdmPersistentRemoteSource remotePersistentSource; |
72 |
|
|
73 |
public static boolean useManagedServer = true; |
|
74 |
|
|
75 |
|
|
76 | 58 |
protected static ICdmEntitySessionManager cdmEntitySessionManager; |
77 | 59 |
|
78 |
private final static String DEFAULT_USER = "admin"; |
|
79 |
private final static String DEFAULT_PASSWORD = "00000"; |
|
80 |
|
|
81 |
private static String userHomeKey = "user.home"; |
|
82 |
|
|
83 |
private static String user = DEFAULT_USER; |
|
84 |
private static String password = DEFAULT_PASSWORD; |
|
85 |
|
|
86 |
|
|
87 |
protected static CDMServer cdmServer; |
|
88 |
|
|
89 | 60 |
@BeforeClass |
90 | 61 |
public static void initializeBaseRemotingTest() { |
91 | 62 |
|
92 | 63 |
DatabaseUnitils.disableConstraints(); |
93 | 64 |
|
94 | 65 |
try { |
95 |
String userHomeDirPath; |
|
96 |
Bundle bundle = Platform.getBundle("eu.etaxonomy.taxeditor.test"); |
|
97 |
|
|
98 |
URL userHomeDirURL = bundle.getEntry("src/test/resources"); |
|
99 |
File userHomeDir = new File(FileLocator.resolve(userHomeDirURL).toURI()); |
|
100 |
userHomeDirPath = userHomeDir.getAbsolutePath(); |
|
101 |
|
|
102 |
URL serverPropertiesURL = bundle.getEntry("src/test/resources/server.properties"); |
|
103 |
File serverPropertiesFile = new File(FileLocator.resolve(serverPropertiesURL).toURI()); |
|
104 |
InputStream inputStream = new FileInputStream(serverPropertiesFile); |
|
105 |
|
|
106 |
Properties prop = new Properties(); |
|
107 |
if (inputStream != null) { |
|
108 |
prop.load(inputStream); |
|
109 |
inputStream.close(); |
|
110 |
} |
|
111 |
|
|
112 |
logger.info("Setting user.home to " + userHomeDirPath); |
|
113 |
System.setProperty(userHomeKey, userHomeDirPath); |
|
114 |
|
|
115 |
|
|
116 |
cdmServer = new CDMServer("cdmTest", serverPropertiesURL); |
|
117 |
|
|
118 |
|
|
119 |
if(prop.getProperty("user") != null) { |
|
120 |
user = prop.getProperty("user"); |
|
121 |
} |
|
122 |
|
|
123 |
if(prop.getProperty("password") != null) { |
|
124 |
password = prop.getProperty("password"); |
|
125 |
} |
|
126 |
|
|
127 |
initializeController(cdmServer.getName(), |
|
128 |
cdmServer.getHost(), |
|
129 |
cdmServer.getPort(), |
|
130 |
cdmServer.getContextPath(), |
|
66 |
initializeController(sourceName, |
|
67 |
host, |
|
68 |
httpPort, |
|
69 |
contextPath, |
|
131 | 70 |
NomenclaturalCode.ICNAFP, |
132 | 71 |
user, |
133 | 72 |
password); |
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CDMServer.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2014 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
10 |
package eu.etaxonomy.taxeditor.httpinvoker; |
|
11 |
|
|
12 |
import java.io.BufferedReader; |
|
13 |
import java.io.File; |
|
14 |
import java.io.FileInputStream; |
|
15 |
import java.io.FileNotFoundException; |
|
16 |
import java.io.IOException; |
|
17 |
import java.io.InputStream; |
|
18 |
import java.io.InputStreamReader; |
|
19 |
import java.net.URISyntaxException; |
|
20 |
import java.net.URL; |
|
21 |
import java.util.Properties; |
|
22 |
|
|
23 |
import javax.management.InstanceNotFoundException; |
|
24 |
import javax.management.MBeanException; |
|
25 |
import javax.management.MBeanServerConnection; |
|
26 |
import javax.management.MalformedObjectNameException; |
|
27 |
import javax.management.ObjectName; |
|
28 |
import javax.management.ReflectionException; |
|
29 |
import javax.management.remote.JMXConnector; |
|
30 |
import javax.management.remote.JMXConnectorFactory; |
|
31 |
import javax.management.remote.JMXServiceURL; |
|
32 |
import javax.sql.DataSource; |
|
33 |
|
|
34 |
import org.apache.log4j.Logger; |
|
35 |
import org.eclipse.core.runtime.FileLocator; |
|
36 |
import org.springframework.core.io.ClassPathResource; |
|
37 |
import org.springframework.core.io.Resource; |
|
38 |
import org.unitils.database.annotations.TestDataSource; |
|
39 |
|
|
40 |
import eu.etaxonomy.cdm.database.CdmPersistentDataSource; |
|
41 |
import eu.etaxonomy.cdm.database.ICdmDataSource; |
|
42 |
import eu.etaxonomy.taxeditor.remoting.server.CDMServerException; |
|
43 |
import eu.etaxonomy.taxeditor.remoting.source.CdmRemoteSourceBase; |
|
44 |
|
|
45 |
/** |
|
46 |
* |
|
47 |
* (Singleton) Server instance which manages a compatible cdmlib-webapp-war. |
|
48 |
* This is done by launching a jetty instance (using jetty-runner) as an |
|
49 |
* executed process. The choice of the external process over a more |
|
50 |
* preferable 'embedded jetty' instance is due to problems arising from the |
|
51 |
* class loading of classes (e.g. from hibernate core) which are needed |
|
52 |
* for both the webapp as well as the remoting client. |
|
53 |
* |
|
54 |
* @author cmathew |
|
55 |
* @date 23 Sep 2014 |
|
56 |
* |
|
57 |
*/ |
|
58 |
|
|
59 |
public class CDMServer { |
|
60 |
|
|
61 |
public static final Logger logger = Logger.getLogger(CDMServer.class); |
|
62 |
|
|
63 |
@TestDataSource |
|
64 |
protected DataSource dataSource; |
|
65 |
|
|
66 |
private final String name = "default"; |
|
67 |
private final String host = "127.0.0.1"; |
|
68 |
private int httpPort = 9090; |
|
69 |
private int stopPort = 9191; |
|
70 |
private String stopKey = "jetty-cdm-server"; |
|
71 |
private final String contextPath = ""; |
|
72 |
|
|
73 |
public static final Resource DEFAULT_CDM_WEBAPP_RESOURCE = |
|
74 |
new ClassPathResource("/etc/jetty/cdmlib-remote-webapp.war"); |
|
75 |
|
|
76 |
public static final Resource DEFAULT_DATASOURCE_FILE = |
|
77 |
new ClassPathResource("datasources.xml"); |
|
78 |
|
|
79 |
public static final Resource DEFAULT_JETTY_RUNNER_RESOURCE = |
|
80 |
new ClassPathResource("/etc/jetty/jetty-runner-9.2.3.v20140905.jar"); |
|
81 |
|
|
82 |
public static final Resource DEFAULT_JETTY_RESOURCE = |
|
83 |
new ClassPathResource("/etc/jetty/start-9.2.3.v20140905.jar"); |
|
84 |
|
|
85 |
private static CDMServer cdmServer = null; |
|
86 |
private static CDMServerException cdmse = null; |
|
87 |
|
|
88 |
private boolean serverAlreadyRunning = false; |
|
89 |
|
|
90 |
private File dataSourcesFile; |
|
91 |
private final String dataSourceName; |
|
92 |
|
|
93 |
public CDMServer(String dataSourceName, URL serverPropertiesURL) throws CDMServerException { |
|
94 |
this.dataSourceName = dataSourceName; |
|
95 |
Properties prop = new Properties(); |
|
96 |
|
|
97 |
try { |
|
98 |
File serverPropertiesFile = new File(FileLocator.resolve(serverPropertiesURL).toURI()); |
|
99 |
InputStream inputStream = new FileInputStream(serverPropertiesFile); |
|
100 |
|
|
101 |
prop.load(inputStream); |
|
102 |
inputStream.close(); |
|
103 |
|
|
104 |
} catch (FileNotFoundException e) { |
|
105 |
throw new CDMServerException(e); |
|
106 |
} catch (URISyntaxException e) { |
|
107 |
throw new CDMServerException(e); |
|
108 |
} catch (IOException e) { |
|
109 |
throw new CDMServerException(e); |
|
110 |
} |
|
111 |
|
|
112 |
|
|
113 |
|
|
114 |
if(prop.getProperty("httpPort") != null) { |
|
115 |
setHttpPort(Integer.valueOf(prop.getProperty("httpPort"))); |
|
116 |
} |
|
117 |
|
|
118 |
if(prop.getProperty("stopPort") != null) { |
|
119 |
setStopPort(Integer.valueOf(prop.getProperty("stopPort"))); |
|
120 |
} |
|
121 |
|
|
122 |
if(prop.getProperty("stopKey") != null) { |
|
123 |
setStopKey(prop.getProperty("stopKey")); |
|
124 |
} |
|
125 |
|
|
126 |
} |
|
127 |
|
|
128 |
|
|
129 |
|
|
130 |
public String getName() { |
|
131 |
return name; |
|
132 |
} |
|
133 |
|
|
134 |
public String getHost() { |
|
135 |
return host; |
|
136 |
} |
|
137 |
|
|
138 |
public int getPort() { |
|
139 |
return httpPort; |
|
140 |
} |
|
141 |
|
|
142 |
public String getContextPath() { |
|
143 |
return contextPath; |
|
144 |
} |
|
145 |
|
|
146 |
public void setHttpPort(int port) { |
|
147 |
this.httpPort = port; |
|
148 |
} |
|
149 |
|
|
150 |
public void setStopPort(int stopPort) { |
|
151 |
this.stopPort = stopPort; |
|
152 |
} |
|
153 |
|
|
154 |
public void setStopKey(String stopKey) { |
|
155 |
this.stopKey = stopKey; |
|
156 |
} |
|
157 |
|
|
158 |
|
|
159 |
public static boolean isRunningInEclipse() { |
|
160 |
return (System.getProperty("sun.java.command") != null && |
|
161 |
System.getProperty("sun.java.command").startsWith("org.eclipse.jdt.internal.junit.runner.RemoteTestRunner")); |
|
162 |
} |
|
163 |
|
|
164 |
private String getVMArgs() throws IOException { |
|
165 |
StringBuilder sb = new StringBuilder(); |
|
166 |
sb.append(" -Dspring.profiles.active=remoting"); |
|
167 |
sb.append(" -Dcdm.beanDefinitionFile=" + DEFAULT_DATASOURCE_FILE.getFile().getAbsolutePath()); |
|
168 |
sb.append(" -Dcdm.datasource=cdmTest"); |
|
169 |
return sb.toString(); |
|
170 |
} |
|
171 |
|
|
172 |
private String getStartServerArgs() throws IOException { |
|
173 |
StringBuilder sb = new StringBuilder(); |
|
174 |
sb.append(" --port " + httpPort); |
|
175 |
return sb.toString(); |
|
176 |
} |
|
177 |
|
|
178 |
private String getStopServerSettings() { |
|
179 |
StringBuilder sb = new StringBuilder(); |
|
180 |
sb.append(" --stop-port "); |
|
181 |
sb.append(stopPort); |
|
182 |
sb.append(" --stop-key "); |
|
183 |
sb.append(stopKey); |
|
184 |
return sb.toString(); |
|
185 |
} |
|
186 |
|
|
187 |
private String getStopServerArgs() { |
|
188 |
StringBuilder sb = new StringBuilder(); |
|
189 |
sb.append(" STOP.PORT="); |
|
190 |
sb.append(stopPort); |
|
191 |
sb.append(" STOP.KEY="); |
|
192 |
sb.append(stopKey); |
|
193 |
return sb.toString(); |
|
194 |
} |
|
195 |
|
|
196 |
|
|
197 |
public void start() throws CDMServerException { |
|
198 |
|
|
199 |
/** |
|
200 |
* First check if the CDM server responds to a service request, which implies that |
|
201 |
* the server has started properly. If no response is received then check if the |
|
202 |
* server is listening on specific host / port, which implies that the server |
|
203 |
* has started but incorrectly, in which case we try to force stop it (if we can) |
|
204 |
* and start a new server. |
|
205 |
*/ |
|
206 |
if(isStarted(1)) { |
|
207 |
logger.info("[CDM-Server] Server already running @ " + host + ":" + httpPort ); |
|
208 |
serverAlreadyRunning = true; |
|
209 |
return; |
|
210 |
} |
|
211 |
|
|
212 |
Thread t = new Thread() { |
|
213 |
@Override |
|
214 |
public void run() { |
|
215 |
|
|
216 |
StringBuffer output = new StringBuffer(); |
|
217 |
try{ |
|
218 |
Process p; |
|
219 |
String command = "java " |
|
220 |
+ getVMArgs() |
|
221 |
+ " -jar " |
|
222 |
+ DEFAULT_JETTY_RUNNER_RESOURCE.getFile().getAbsolutePath() |
|
223 |
+ getStartServerArgs() |
|
224 |
+ getStopServerSettings() |
|
225 |
+ " " |
|
226 |
+ DEFAULT_CDM_WEBAPP_RESOURCE.getFile().getAbsolutePath(); |
|
227 |
logger.info("[CDM-Server] Starting server with Command : " + command); |
|
228 |
p = Runtime.getRuntime().exec(command); |
|
229 |
|
|
230 |
BufferedReader inpReader = |
|
231 |
new BufferedReader(new InputStreamReader(p.getInputStream())); |
|
232 |
|
|
233 |
BufferedReader errReader = |
|
234 |
new BufferedReader(new InputStreamReader(p.getErrorStream())); |
|
235 |
|
|
236 |
String line = ""; |
|
237 |
while ((line = inpReader.readLine())!= null) { |
|
238 |
logger.info("[CDM-Server Start] : " + line); |
|
239 |
} |
|
240 |
|
|
241 |
while ((line = errReader.readLine())!= null) { |
|
242 |
logger.info("[CDM-Server Start] : " + line); |
|
243 |
} |
|
244 |
|
|
245 |
} catch (Exception e) { |
|
246 |
e.printStackTrace(); |
|
247 |
cdmse = new CDMServerException(e); |
|
248 |
} |
|
249 |
} |
|
250 |
}; |
|
251 |
|
|
252 |
t.setDaemon(true); |
|
253 |
cdmse = null; |
|
254 |
t.start(); |
|
255 |
|
|
256 |
if(isStarted(50)) { |
|
257 |
logger.info("[CDM-Server] Server running @ " + host + ":" + httpPort ); |
|
258 |
} else { |
|
259 |
logger.info("[CDM-Server] Server not started within given interval"); |
|
260 |
// making sure to kill server if it is not started correctly |
|
261 |
try { |
|
262 |
stop(true); |
|
263 |
} catch (Exception e) { |
|
264 |
throw new CDMServerException("CDM Server could not be stopped : " + e.getMessage()); |
|
265 |
} |
|
266 |
throw new CDMServerException("CDM Server not started : "); |
|
267 |
} |
|
268 |
|
|
269 |
} |
|
270 |
|
|
271 |
|
|
272 |
public boolean isStarted(int checkingIntervals) throws CDMServerException { |
|
273 |
CdmRemoteSourceBase crsb = new CdmRemoteSourceBase("local-cdm-server", |
|
274 |
host, |
|
275 |
httpPort, |
|
276 |
contextPath, |
|
277 |
null); |
|
278 |
int intervalsCount = 0; |
|
279 |
do { |
|
280 |
try { |
|
281 |
if(cdmse != null) { |
|
282 |
return false; |
|
283 |
} |
|
284 |
boolean check = crsb.checkConnection(); |
|
285 |
if(check) { |
|
286 |
logger.info("[CDM-Server] Running @ " + host + ":" + httpPort ); |
|
287 |
return true; |
|
288 |
} |
|
289 |
} catch (Exception e) { |
|
290 |
|
|
291 |
} |
|
292 |
try { |
|
293 |
Thread.sleep(1000); |
|
294 |
} catch (InterruptedException ie) { |
|
295 |
throw new CDMServerException("Error checking CDM Server status", ie); |
|
296 |
} |
|
297 |
intervalsCount++; |
|
298 |
} while (intervalsCount < checkingIntervals); |
|
299 |
return false; |
|
300 |
} |
|
301 |
|
|
302 |
public void stop() throws Exception { |
|
303 |
stop(false); |
|
304 |
} |
|
305 |
|
|
306 |
public void stop(boolean force) throws Exception { |
|
307 |
|
|
308 |
if(!force) { |
|
309 |
if(!cdmServer.isStarted(1)) { |
|
310 |
logger.info("[CDM-Server] Server already stopped @ " + host + ":" + httpPort ); |
|
311 |
return; |
|
312 |
} |
|
313 |
} |
|
314 |
|
|
315 |
if(serverAlreadyRunning) { |
|
316 |
return; |
|
317 |
} |
|
318 |
Thread t = new Thread() { |
|
319 |
@Override |
|
320 |
public void run() { |
|
321 |
StringBuffer output = new StringBuffer(); |
|
322 |
try{ |
|
323 |
Process p; |
|
324 |
String command = "java -jar " + DEFAULT_JETTY_RESOURCE.getFile().getAbsolutePath() |
|
325 |
+ getStopServerArgs() + " --stop "; |
|
326 |
logger.info("[CDM-Server] Stop Command : " + command); |
|
327 |
p = Runtime.getRuntime().exec(command); |
|
328 |
|
|
329 |
BufferedReader inpReader = |
|
330 |
new BufferedReader(new InputStreamReader(p.getInputStream())); |
|
331 |
|
|
332 |
BufferedReader errReader = |
|
333 |
new BufferedReader(new InputStreamReader(p.getErrorStream())); |
|
334 |
|
|
335 |
String line = ""; |
|
336 |
while ((line = inpReader.readLine())!= null) { |
|
337 |
logger.info("[CDM-Server Stop] : " + line); |
|
338 |
} |
|
339 |
|
|
340 |
while ((line = errReader.readLine())!= null) { |
|
341 |
logger.info("[CDM-Server Stop] : " + line); |
|
342 |
} |
|
343 |
logger.info("CDM-Server Stopped : "); |
|
344 |
} catch (Exception e) { |
|
345 |
logger.info("[CDM-Server] Could not stop @ " + host + ":" + httpPort + ". Please kill it manually"); |
|
346 |
|
|
347 |
} |
|
348 |
|
|
349 |
} |
|
350 |
}; |
|
351 |
|
|
352 |
t.setDaemon(true); |
|
353 |
t.start(); |
|
354 |
|
|
355 |
} |
|
356 |
|
|
357 |
public static void stopServerViaJMX(int jmxPort) throws CDMServerException { |
|
358 |
String JMX_URL = "service:jmx:rmi:///jndi/rmi://localhost:" + jmxPort + "/jmxrmi"; |
|
359 |
logger.warn("Shutting down Jetty instance ... "); |
|
360 |
|
|
361 |
try { |
|
362 |
JMXConnector connector = JMXConnectorFactory.connect(new JMXServiceURL(JMX_URL), null); |
|
363 |
connector.connect(null); |
|
364 |
MBeanServerConnection connection = connector.getMBeanServerConnection(); |
|
365 |
ObjectName objectName = new ObjectName("org.eclipse.jetty.server:type=server,id=0"); |
|
366 |
connection.invoke(objectName, "stop", null, null); |
|
367 |
logger.warn("Shutdown command sent"); |
|
368 |
} catch (InstanceNotFoundException e) { |
|
369 |
throw new CDMServerException(e); |
|
370 |
} catch (MBeanException e) { |
|
371 |
throw new CDMServerException(e); |
|
372 |
} catch (ReflectionException e) { |
|
373 |
throw new CDMServerException(e); |
|
374 |
} catch (IOException e) { |
|
375 |
throw new CDMServerException(e); |
|
376 |
} catch (MalformedObjectNameException e) { |
|
377 |
throw new CDMServerException(e); |
|
378 |
} |
|
379 |
} |
|
380 |
|
|
381 |
public void convertEditorToServerConfig() { |
|
382 |
String xmlString = "<?xml version=\"1.0\" encoding=\"UTF-8\"?> " + System.lineSeparator() + |
|
383 |
"<beans xmlns=\"http://www.springframework.org/schema/beans\"" + System.lineSeparator() + |
|
384 |
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"" + System.lineSeparator() + |
|
385 |
"xmlns:tx=\"http://www.springframework.org/schema/tx\"" + System.lineSeparator() + |
|
386 |
"xmlns:context=\"http://www.springframework.org/schema/context\"" + System.lineSeparator() + |
|
387 |
"xsi:schemaLocation=\"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd" + System.lineSeparator() + |
|
388 |
"http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd" + System.lineSeparator() + |
|
389 |
"http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd" + System.lineSeparator() + |
|
390 |
">" + System.lineSeparator() + |
|
391 |
"<bean id=\"dataSourceProperties\" class=\"eu.etaxonomy.cdm.remote.config.DataSourceProperties\">" + System.lineSeparator() + |
|
392 |
" <property name=\"propsMap\">" + System.lineSeparator() + |
|
393 |
" <map/>" + System.lineSeparator() + |
|
394 |
" </property>" + System.lineSeparator() + |
|
395 |
"</bean>"; |
|
396 |
|
|
397 |
for(ICdmDataSource dataSource : CdmPersistentDataSource.getAllDataSources()) { |
|
398 |
|
|
399 |
} |
|
400 |
} |
|
401 |
} |
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CdmRemoteSourceTest.java | ||
---|---|---|
26 | 26 |
public void whenConnectingToInactiveServerThenFailToConnect() { |
27 | 27 |
|
28 | 28 |
// check if non-active server throws the right exception |
29 |
CdmRemoteSource inactiveCrs = CdmRemoteSource.NewInstance(cdmServer.getName(),
|
|
30 |
cdmServer.getHost(),
|
|
29 |
CdmRemoteSource inactiveCrs = CdmRemoteSource.NewInstance(sourceName,
|
|
30 |
host,
|
|
31 | 31 |
808080, |
32 |
cdmServer.getContextPath(),
|
|
32 |
contextPath,
|
|
33 | 33 |
NomenclaturalCode.ICNAFP); |
34 | 34 |
try { |
35 | 35 |
inactiveCrs.getDbSchemaVersion(); |
... | ... | |
68 | 68 |
@Test |
69 | 69 |
public void whenConnectingToAnActiveServerThenConnectSuccessfully() { |
70 | 70 |
// check if active server throws the right exception |
71 |
CdmRemoteSource activeCrs = CdmRemoteSource.NewInstance(cdmServer.getName(),
|
|
72 |
cdmServer.getHost(),
|
|
73 |
cdmServer.getPort(),
|
|
74 |
cdmServer.getContextPath(),
|
|
71 |
CdmRemoteSource activeCrs = CdmRemoteSource.NewInstance(sourceName,
|
|
72 |
host,
|
|
73 |
httpPort,
|
|
74 |
contextPath,
|
|
75 | 75 |
NomenclaturalCode.ICNAFP); |
76 | 76 |
String dbSchemaVersion = ""; |
77 | 77 |
try { |
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/CdmServerTest.java | ||
---|---|---|
9 | 9 |
*/ |
10 | 10 |
package eu.etaxonomy.taxeditor.httpinvoker; |
11 | 11 |
|
12 |
import java.io.File; |
|
13 |
import java.io.IOException; |
|
14 |
import java.net.URISyntaxException; |
|
12 | 15 |
import java.net.URL; |
13 | 16 |
|
14 | 17 |
import org.apache.log4j.Logger; |
18 |
import org.eclipse.core.runtime.FileLocator; |
|
15 | 19 |
import org.eclipse.core.runtime.Platform; |
16 | 20 |
import org.junit.Assert; |
17 |
import org.junit.Ignore; |
|
18 | 21 |
import org.junit.Test; |
19 | 22 |
import org.osgi.framework.Bundle; |
20 |
import org.unitils.UnitilsJUnit4; |
|
21 | 23 |
|
22 |
import eu.etaxonomy.taxeditor.remoting.server.CDMServerException; |
|
24 |
import eu.etaxonomy.taxeditor.remoting.server.CDMServerUtils; |
|
25 |
import eu.etaxonomy.taxeditor.webapp.CDMEmbeddedServerException; |
|
26 |
import eu.etaxonomy.taxeditor.webapp.CDMServer; |
|
27 |
import eu.etaxonomy.taxeditor.webapp.ICDMServerError; |
|
28 |
|
|
23 | 29 |
|
24 | 30 |
/** |
25 | 31 |
* @author cmathew |
26 | 32 |
* @date 6 Oct 2014 |
27 | 33 |
* |
28 | 34 |
*/ |
29 |
public class CdmServerTest extends UnitilsJUnit4 {
|
|
35 |
public class CdmServerTest extends TestConfig {
|
|
30 | 36 |
private static final Logger logger = Logger.getLogger(CdmServerTest.class); |
31 | 37 |
|
32 |
@Ignore // this should be targetting integration or production |
|
38 |
|
|
39 |
|
|
33 | 40 |
@Test |
34 |
public void startCdmServer() throws CDMServerException { |
|
41 |
public void generateConfigFile() throws IOException { |
|
42 |
String mgdServerConfigFileName = "test.mgd.datasources.xml"; |
|
43 |
String config = CDMServerUtils.convertEditorToServerConfig(); |
|
44 |
CDMServerUtils.writeManagedServerConfig(config, mgdServerConfigFileName); |
|
45 |
} |
|
46 |
|
|
47 |
@Test |
|
48 |
public void manageCdmServer() throws IOException, URISyntaxException, CDMEmbeddedServerException { |
|
35 | 49 |
Bundle bundle = Platform.getBundle("eu.etaxonomy.taxeditor.test"); |
36 |
URL serverPropertiesURL = bundle.getEntry("src/test/resources/server.properties"); |
|
37 |
CDMServer cdmServer = new CDMServer("cdmTest", serverPropertiesURL); |
|
38 |
cdmServer .start(); |
|
50 |
URL mgdDatasourcesConfigURL = bundle.getEntry("src/test/resources/.cdmLibrary/writableResources/mgd.datasources.xml"); |
|
51 |
File mgdDatasourcesConfigFile = new File(FileLocator.resolve(mgdDatasourcesConfigURL).toURI()); |
|
52 |
CDMServer cdmServer = new CDMServer("cdmTest", mgdDatasourcesConfigFile); |
|
53 |
cdmServer.start(new ICDMServerError() { |
|
54 |
@Override |
|
55 |
public void handleError(Throwable t) { |
|
56 |
Assert.fail("Error starting server. Reason : " + t.getMessage()); |
|
57 |
} |
|
58 |
}); |
|
39 | 59 |
try { |
40 |
cdmServer.stop(true);
|
|
60 |
cdmServer.stop(); |
|
41 | 61 |
} catch (Exception e) { |
42 | 62 |
e.printStackTrace(); |
43 |
Assert.fail("Server could not be stopped. Reason : " + e.getMessage());
|
|
63 |
Assert.fail("Error stopping server. Reason : " + e.getMessage());
|
|
44 | 64 |
} |
45 | 65 |
} |
46 |
|
|
47 | 66 |
} |
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/TestConfig.java | ||
---|---|---|
1 |
// $Id$ |
|
2 |
/** |
|
3 |
* Copyright (C) 2015 EDIT |
|
4 |
* European Distributed Institute of Taxonomy |
|
5 |
* http://www.e-taxonomy.eu |
|
6 |
* |
|
7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
|
8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
|
9 |
*/ |
|
10 |
package eu.etaxonomy.taxeditor.httpinvoker; |
|
11 |
|
|
12 |
import java.io.File; |
|
13 |
import java.io.FileInputStream; |
|
14 |
import java.io.InputStream; |
|
15 |
import java.net.URL; |
|
16 |
import java.util.Properties; |
|
17 |
|
|
18 |
import org.apache.log4j.Logger; |
|
19 |
import org.eclipse.core.runtime.FileLocator; |
|
20 |
import org.eclipse.core.runtime.Platform; |
|
21 |
import org.junit.BeforeClass; |
|
22 |
import org.osgi.framework.Bundle; |
|
23 |
import org.unitils.UnitilsJUnit4; |
|
24 |
|
|
25 |
/** |
|
26 |
* @author cmathew |
|
27 |
* @date 11 Nov 2015 |
|
28 |
* |
|
29 |
*/ |
|
30 |
public class TestConfig extends UnitilsJUnit4 { |
|
31 |
|
|
32 |
private static final Logger logger = Logger.getLogger(TestConfig.class); |
|
33 |
|
|
34 |
private final static String DEFAULT_USER = "admin"; |
|
35 |
private final static String DEFAULT_PASSWORD = "00000"; |
|
36 |
private final static int DEFAULT_HTTP_PORT = 9090; |
|
37 |
private final static String DEFAULT_CONTEXT_PATH = ""; |
|
38 |
private final static String DEFAULT_SOURCE_NAME = "default"; |
|
39 |
private final static String DEFAULT_HOST = "localhost"; |
|
40 |
|
|
41 |
private static String userHomeKey = "user.home"; |
|
42 |
|
|
43 |
protected static String user = DEFAULT_USER; |
|
44 |
protected static String password = DEFAULT_PASSWORD; |
|
45 |
protected static int httpPort = DEFAULT_HTTP_PORT; |
|
46 |
protected static String contextPath = DEFAULT_CONTEXT_PATH; |
|
47 |
protected static String sourceName = DEFAULT_SOURCE_NAME; |
|
48 |
protected static String host = DEFAULT_HOST; |
|
49 |
|
|
50 |
@BeforeClass |
|
51 |
public static void initializeTestConfig() { |
|
52 |
try { |
|
53 |
String userHomeDirPath; |
|
54 |
Bundle bundle = Platform.getBundle("eu.etaxonomy.taxeditor.test"); |
|
55 |
|
|
56 |
URL userHomeDirURL = bundle.getEntry("src/test/resources"); |
|
57 |
File userHomeDir = new File(FileLocator.resolve(userHomeDirURL).toURI()); |
|
58 |
userHomeDirPath = userHomeDir.getAbsolutePath(); |
|
59 |
|
|
60 |
URL serverPropertiesURL = bundle.getEntry("src/test/resources/server.properties"); |
|
61 |
File serverPropertiesFile = new File(FileLocator.resolve(serverPropertiesURL).toURI()); |
|
62 |
InputStream inputStream = new FileInputStream(serverPropertiesFile); |
|
63 |
|
|
64 |
Properties prop = new Properties(); |
|
65 |
|
|
66 |
prop.load(inputStream); |
|
67 |
inputStream.close(); |
|
68 |
|
|
69 |
|
|
70 |
logger.warn("Setting user.home to " + userHomeDirPath); |
|
71 |
System.setProperty(userHomeKey, userHomeDirPath); |
|
72 |
|
|
73 |
|
|
74 |
if(prop.getProperty("user") != null) { |
|
75 |
user = prop.getProperty("user"); |
|
76 |
} |
|
77 |
|
|
78 |
if(prop.getProperty("password") != null) { |
|
79 |
password = prop.getProperty("password"); |
|
80 |
} |
|
81 |
|
|
82 |
if(prop.getProperty("httpPort") != null) { |
|
83 |
httpPort = Integer.valueOf(prop.getProperty("httpPort")); |
|
84 |
} |
|
85 |
|
|
86 |
if(prop.getProperty("contextPath") != null) { |
|
87 |
contextPath = prop.getProperty("contextPath"); |
|
88 |
} |
|
89 |
|
|
90 |
} catch (Exception e) { |
|
91 |
e.printStackTrace(); |
|
92 |
// Assert.fail("Server failed to start. Reason : " + e.getMessage()); |
|
93 |
} |
|
94 |
} |
|
95 |
|
|
96 |
} |
eu.etaxonomy.taxeditor.test/src/test/java/eu/etaxonomy/taxeditor/httpinvoker/ThreadedTest.java | ||
---|---|---|
13 | 13 |
import java.util.Set; |
14 | 14 |
|
15 | 15 |
import org.junit.After; |
16 |
import org.unitils.UnitilsJUnit4; |
Also available in: Unified diff
#4073 Add new project for lanuching embedded jetty server using cdmlib webapp
#4073 Add jetty server dependencies
#4073 Add stop start possibility for server
#4073 Add functionality to control managed server in login dialog
#4073 Add start / stop methods for managed server
#4073 Simplify manged server ui
#4073 Fix incorrect stop behaviour, Add mysql jdbc connector jar
#4073 Add webapp to editor project and fix file location issue
#4073 Add error callback for CDM Server start