57 |
57 |
import eu.etaxonomy.cdm.api.application.CdmApplicationState;
|
58 |
58 |
import eu.etaxonomy.cdm.api.service.IUserService;
|
59 |
59 |
import eu.etaxonomy.cdm.model.metadata.CdmMetaData;
|
|
60 |
import eu.etaxonomy.taxeditor.Messages;
|
60 |
61 |
import eu.etaxonomy.taxeditor.model.MessagingUtils;
|
61 |
62 |
import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
|
62 |
63 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
|
... | ... | |
81 |
82 |
*/
|
82 |
83 |
public class RemotingLoginDialog extends Dialog implements ICDMServerError {
|
83 |
84 |
|
84 |
|
protected Object result;
|
|
85 |
private static final String UBUNTU = "Ubuntu"; //$NON-NLS-1$
|
|
86 |
protected Object result;
|
85 |
87 |
protected Shell shlConnect;
|
86 |
88 |
private Text txtCdmServerStatus;
|
87 |
89 |
private Text txtCdmInstanceStatus;
|
... | ... | |
91 |
93 |
|
92 |
94 |
private final Map<String, CdmServerInfo> csiiMap = new HashMap<String, CdmServerInfo>();
|
93 |
95 |
|
94 |
|
private final static String STATUS_AVAILABLE = "Available";
|
95 |
|
private final static String STATUS_NOT_AVAILABLE = "Not Available";
|
96 |
|
private final static String STATUS_STARTED = "Started";
|
97 |
|
private final static String STATUS_NOT_STARTED = "Not Started";
|
98 |
|
private final static String STATUS_RETRIEVING = "Retrieving ...";
|
99 |
|
private final static String STATUS_CHECKING_AVAILABILITY = "Checking ...";
|
100 |
|
private final static String STATUS_NO_INSTANCES = "No Instances Found";
|
101 |
|
private final static String STATUS_ERROR = "Error";
|
102 |
|
private final static String STATUS_REMOTING_NOT_ACTIVATED = "Remoting not activated";
|
103 |
|
private final static String STATUS_NOT_COMPATIBLE = "Not Compatible";
|
|
96 |
private final static String STATUS_AVAILABLE = ""; //$NON-NLS-1$
|
|
97 |
private final static String STATUS_NOT_AVAILABLE = ""; //$NON-NLS-1$
|
|
98 |
private final static String STATUS_STARTED = ""; //$NON-NLS-1$
|
|
99 |
private final static String STATUS_NOT_STARTED = ""; //$NON-NLS-1$
|
|
100 |
private final static String STATUS_RETRIEVING = ""; //$NON-NLS-1$
|
|
101 |
private final static String STATUS_CHECKING_AVAILABILITY = ""; //$NON-NLS-1$
|
|
102 |
private final static String STATUS_NO_INSTANCES = ""; //$NON-NLS-1$
|
|
103 |
private final static String STATUS_ERROR = ""; //$NON-NLS-1$
|
|
104 |
private final static String STATUS_REMOTING_NOT_ACTIVATED = ""; //$NON-NLS-1$
|
|
105 |
private final static String STATUS_NOT_COMPATIBLE = ""; //$NON-NLS-1$
|
104 |
106 |
|
105 |
|
private final static String MESG_COMPATIBLE_EDITOR_OLD = "Please update the Taxonomic Editor (Help->Check for Updates) or choose a compatible cdm-server";
|
106 |
|
private final static String MESG_COMPATIBLE_SERVER_OLD = "Please choose a compatible cdm-server or update the chosen cdm-server";
|
|
107 |
private final static String MESG_COMPATIBLE_EDITOR_OLD = ""; //$NON-NLS-1$
|
|
108 |
private final static String MESG_COMPATIBLE_SERVER_OLD = ""; //$NON-NLS-1$
|
107 |
109 |
|
108 |
|
private final static String STORE_PREFERENCES_NODE = "eu.etaxonomy.taxeditor.store";
|
|
110 |
private final static String STORE_PREFERENCES_NODE = "eu.etaxonomy.taxeditor.store"; //$NON-NLS-1$
|
109 |
111 |
|
110 |
|
private final static String LOGIN_NODE = "login";
|
111 |
|
private final static String USERNAME_SUFFIX = "_username";
|
112 |
|
private final static String PASSWORD_SUFFIX = "_password";
|
|
112 |
private final static String LOGIN_NODE = "login"; //$NON-NLS-1$
|
|
113 |
private final static String USERNAME_SUFFIX = "_username"; //$NON-NLS-1$
|
|
114 |
private final static String PASSWORD_SUFFIX = "_password"; //$NON-NLS-1$
|
113 |
115 |
|
114 |
|
private final static String LAST_SERVER_INSTANCE_NODE = "lastServerInstance";
|
115 |
|
private final static String LAST_SERVER_KEY = "lastServerKey";
|
116 |
|
private final static String LAST_INSTANCE_KEY = "lastInstanceKey";
|
|
116 |
private final static String LAST_SERVER_INSTANCE_NODE = "lastServerInstance"; //$NON-NLS-1$
|
|
117 |
private final static String LAST_SERVER_KEY = "lastServerKey"; //$NON-NLS-1$
|
|
118 |
private final static String LAST_INSTANCE_KEY = "lastInstanceKey"; //$NON-NLS-1$
|
117 |
119 |
|
118 |
|
private final static String REFRESH_LABEL = "Refresh";
|
|
120 |
private final static String REFRESH_LABEL = ""; //$NON-NLS-1$
|
119 |
121 |
|
120 |
122 |
private Composite remotingComposite;
|
121 |
123 |
private CdmServerInfo selectedCsii;
|
... | ... | |
161 |
163 |
*/
|
162 |
164 |
public RemotingLoginDialog(Shell parent, int style) {
|
163 |
165 |
super(parent, style);
|
164 |
|
setText("Login");
|
|
166 |
setText(""); //$NON-NLS-1$
|
165 |
167 |
}
|
166 |
168 |
|
167 |
169 |
public Object open(CdmRemoteSource source, boolean loadLoginPrefs, boolean autoConnect) {
|
168 |
170 |
this.loadLoginPrefs = loadLoginPrefs;
|
169 |
171 |
this.serverName = source.getName();
|
170 |
172 |
String contextPath = source.getContextPath();
|
171 |
|
this.instanceName = contextPath.substring(contextPath.lastIndexOf("/") + 1);
|
|
173 |
this.instanceName = contextPath.substring(contextPath.lastIndexOf("/") + 1); //$NON-NLS-1$
|
172 |
174 |
return open(serverName, instanceName, loadLoginPrefs, autoConnect);
|
173 |
175 |
}
|
174 |
176 |
|
... | ... | |
217 |
219 |
shlConnect = new Shell(getParent(), SWT.DIALOG_TRIM);
|
218 |
220 |
shlConnect.setMinimumSize(new Point(MIN_WIDTH, MIN_HEIGHT));
|
219 |
221 |
shlConnect.setSize(MIN_WIDTH, MIN_HEIGHT);
|
220 |
|
shlConnect.setText("Connect");
|
|
222 |
shlConnect.setText(""); //$NON-NLS-1$
|
221 |
223 |
shlConnect.setLayout(new FillLayout(SWT.HORIZONTAL));
|
222 |
224 |
|
223 |
225 |
remotingComposite = new Composite(shlConnect, SWT.NONE);
|
... | ... | |
230 |
232 |
cdmServerComposite.setLayout(new GridLayout(4, false));
|
231 |
233 |
|
232 |
234 |
Label lblCdmServer = new Label(cdmServerComposite, SWT.NONE);
|
233 |
|
lblCdmServer.setText("CDM Server : ");
|
234 |
|
lblCdmServer.setFont(SWTResourceManager.getFont("Ubuntu", 9, SWT.NORMAL));
|
|
235 |
lblCdmServer.setText(""); //$NON-NLS-1$
|
|
236 |
lblCdmServer.setFont(SWTResourceManager.getFont(UBUNTU, 9, SWT.NORMAL));
|
235 |
237 |
lblCdmServer.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
236 |
238 |
|
237 |
239 |
comboCdmServer = new Combo(cdmServerComposite, SWT.READ_ONLY);
|
... | ... | |
262 |
264 |
}
|
263 |
265 |
});
|
264 |
266 |
btnCdmServerRefresh.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
|
265 |
|
btnCdmServerRefresh.setText("Refresh");
|
|
267 |
btnCdmServerRefresh.setText(""); //$NON-NLS-1$
|
266 |
268 |
|
267 |
269 |
Label lblCdmInstance = new Label(cdmServerComposite, SWT.NONE);
|
268 |
270 |
GridData gd_lblCdmInstance = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
|
269 |
271 |
gd_lblCdmInstance.heightHint = 30;
|
270 |
272 |
lblCdmInstance.setLayoutData(gd_lblCdmInstance);
|
271 |
|
lblCdmInstance.setText("CDM Instance : ");
|
272 |
|
lblCdmInstance.setFont(SWTResourceManager.getFont("Ubuntu", 9, SWT.NORMAL));
|
|
273 |
lblCdmInstance.setText(""); //$NON-NLS-1$
|
|
274 |
lblCdmInstance.setFont(SWTResourceManager.getFont(UBUNTU, 9, SWT.NORMAL));
|
273 |
275 |
|
274 |
276 |
comboCdmInstance = new Combo(cdmServerComposite, SWT.READ_ONLY);
|
275 |
277 |
comboCdmInstance.addSelectionListener(new SelectionAdapter() {
|
... | ... | |
301 |
303 |
gd_btnCdmInstanceRefresh.widthHint = 110;
|
302 |
304 |
gd_btnCdmInstanceRefresh.heightHint = 30;
|
303 |
305 |
btnCdmInstanceRefresh.setLayoutData(gd_btnCdmInstanceRefresh);
|
304 |
|
btnCdmInstanceRefresh.setText("Refresh");
|
|
306 |
btnCdmInstanceRefresh.setText(""); //$NON-NLS-1$
|
305 |
307 |
|
306 |
308 |
loginComposite = new Composite(remotingComposite, SWT.NONE);
|
307 |
309 |
GridData gd_loginComposite = new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1);
|
... | ... | |
316 |
318 |
GridData gd_lblLogin = new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1);
|
317 |
319 |
gd_lblLogin.widthHint = 50;
|
318 |
320 |
lblLogin.setLayoutData(gd_lblLogin);
|
319 |
|
lblLogin.setText("Login : ");
|
320 |
|
lblLogin.setFont(SWTResourceManager.getFont("Ubuntu", 9, SWT.NORMAL));
|
|
321 |
lblLogin.setText(""); //$NON-NLS-1$
|
|
322 |
lblLogin.setFont(SWTResourceManager.getFont(UBUNTU, 9, SWT.NORMAL));
|
321 |
323 |
|
322 |
324 |
txtLogin = new Text(loginComposite, SWT.BORDER);
|
323 |
325 |
GridData gd_txtLogin = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
|
... | ... | |
328 |
330 |
|
329 |
331 |
lblPassword = new Label(loginComposite, SWT.CENTER);
|
330 |
332 |
lblPassword.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
331 |
|
lblPassword.setText("Password : ");
|
332 |
|
lblPassword.setFont(SWTResourceManager.getFont("Ubuntu", 9, SWT.NORMAL));
|
|
333 |
lblPassword.setText(""); //$NON-NLS-1$
|
|
334 |
lblPassword.setFont(SWTResourceManager.getFont(UBUNTU, 9, SWT.NORMAL));
|
333 |
335 |
|
334 |
336 |
txtPassword = new Text(loginComposite, SWT.BORDER | SWT.PASSWORD);
|
335 |
337 |
GridData gd_txtPassword = new GridData(SWT.FILL, SWT.FILL, true, false, 1, 1);
|
... | ... | |
351 |
353 |
}
|
352 |
354 |
}
|
353 |
355 |
});
|
354 |
|
btnConnect.setText("Connect");
|
|
356 |
btnConnect.setText(""); //$NON-NLS-1$
|
355 |
357 |
|
356 |
358 |
btnRememberMe = new Button(loginComposite, SWT.CHECK);
|
357 |
359 |
btnRememberMe.setSelection(true);
|
358 |
360 |
GridData gd_btnRememberMe = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
|
359 |
361 |
gd_btnRememberMe.widthHint = 107;
|
360 |
362 |
btnRememberMe.setLayoutData(gd_btnRememberMe);
|
361 |
|
btnRememberMe.setText("Remember Me");
|
|
363 |
btnRememberMe.setText(""); //$NON-NLS-1$
|
362 |
364 |
new Label(loginComposite, SWT.NONE);
|
363 |
365 |
new Label(loginComposite, SWT.NONE);
|
364 |
366 |
new Label(loginComposite, SWT.NONE);
|
... | ... | |
367 |
369 |
styledTxtMessage = new StyledText(remotingComposite, SWT.NONE);
|
368 |
370 |
styledTxtMessage.setBackground(SWTResourceManager.getColor(SWT.COLOR_INFO_BACKGROUND));
|
369 |
371 |
styledTxtMessage.setForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_RED));
|
370 |
|
styledTxtMessage.setFont(SWTResourceManager.getFont("Ubuntu", 12, SWT.BOLD));
|
|
372 |
styledTxtMessage.setFont(SWTResourceManager.getFont(UBUNTU, 12, SWT.BOLD));
|
371 |
373 |
styledTxtMessage.setSelectionBackground(SWTResourceManager.getColor(SWT.COLOR_LIST_SELECTION_TEXT));
|
372 |
374 |
styledTxtMessage.setSelectionForeground(SWTResourceManager.getColor(SWT.COLOR_DARK_RED));
|
373 |
375 |
styledTxtMessage.setDoubleClickEnabled(false);
|
... | ... | |
397 |
399 |
public void expansionStateChanging(ExpansionEvent e) {
|
398 |
400 |
}
|
399 |
401 |
});
|
400 |
|
xpndblcmpstAdvanced.setText("advanced");
|
|
402 |
xpndblcmpstAdvanced.setText(""); //$NON-NLS-1$
|
401 |
403 |
xpndblcmpstAdvanced.setExpanded(true);
|
402 |
404 |
|
403 |
405 |
compAdvanced = new Composite(xpndblcmpstAdvanced, SWT.NONE);
|
... | ... | |
407 |
409 |
lblPort = new Label(compAdvanced, SWT.CENTER);
|
408 |
410 |
lblPort.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
409 |
411 |
lblPort.setSize(0, 0);
|
410 |
|
lblPort.setText("Port : ");
|
411 |
|
lblPort.setFont(SWTResourceManager.getFont("Ubuntu", 9, SWT.NORMAL));
|
|
412 |
lblPort.setText(""); //$NON-NLS-1$
|
|
413 |
lblPort.setFont(SWTResourceManager.getFont(UBUNTU, 9, SWT.NORMAL));
|
412 |
414 |
|
413 |
415 |
txtPort = new Text(compAdvanced, SWT.BORDER);
|
414 |
416 |
GridData gd_txtPort = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
|
... | ... | |
418 |
420 |
|
419 |
421 |
lblServerVersion = new Label(compAdvanced, SWT.CENTER);
|
420 |
422 |
lblServerVersion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
421 |
|
lblServerVersion.setText("Server Cdmlib Version :");
|
422 |
|
lblServerVersion.setFont(SWTResourceManager.getFont("Ubuntu", 9, SWT.NORMAL));
|
|
423 |
lblServerVersion.setText(""); //$NON-NLS-1$
|
|
424 |
lblServerVersion.setFont(SWTResourceManager.getFont(UBUNTU, 9, SWT.NORMAL));
|
423 |
425 |
|
424 |
426 |
txtServerVersion = new Text(compAdvanced, SWT.BORDER);
|
425 |
427 |
txtServerVersion.setEditable(false);
|
... | ... | |
432 |
434 |
stopManagedServer();
|
433 |
435 |
}
|
434 |
436 |
});
|
435 |
|
btnStopServer.setText("Stop Managed Server");
|
|
437 |
btnStopServer.setText(""); //$NON-NLS-1$
|
436 |
438 |
|
437 |
439 |
lblEditorVersion = new Label(compAdvanced, SWT.CENTER);
|
438 |
440 |
lblEditorVersion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
439 |
|
lblEditorVersion.setText("Editor Cdmlib Version :");
|
440 |
|
lblEditorVersion.setFont(SWTResourceManager.getFont("Ubuntu", 9, SWT.NORMAL));
|
|
441 |
lblEditorVersion.setText(""); //$NON-NLS-1$
|
|
442 |
lblEditorVersion.setFont(SWTResourceManager.getFont(UBUNTU, 9, SWT.NORMAL));
|
441 |
443 |
|
442 |
444 |
txtEditorVersion = new Text(compAdvanced, SWT.BORDER);
|
443 |
445 |
txtEditorVersion.setEditable(false);
|
... | ... | |
447 |
449 |
|
448 |
450 |
lblServerCDMVersion = new Label(compAdvanced, SWT.CENTER);
|
449 |
451 |
lblServerCDMVersion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
450 |
|
lblServerCDMVersion.setText("Server CDM Version :");
|
451 |
|
lblServerCDMVersion.setFont(SWTResourceManager.getFont("Ubuntu", 9, SWT.NORMAL));
|
|
452 |
lblServerCDMVersion.setText(""); //$NON-NLS-1$
|
|
453 |
lblServerCDMVersion.setFont(SWTResourceManager.getFont(UBUNTU, 9, SWT.NORMAL));
|
452 |
454 |
|
453 |
455 |
txtServerCDMVersion = new Text(compAdvanced, SWT.BORDER);
|
454 |
456 |
txtServerCDMVersion.setEditable(false);
|
... | ... | |
458 |
460 |
|
459 |
461 |
lblEditorCDMVersion = new Label(compAdvanced, SWT.CENTER);
|
460 |
462 |
lblEditorCDMVersion.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
|
461 |
|
lblEditorCDMVersion.setText("Editor CDM Version :");
|
462 |
|
lblEditorCDMVersion.setFont(SWTResourceManager.getFont("Ubuntu", 9, SWT.NORMAL));
|
|
463 |
lblEditorCDMVersion.setText(""); //$NON-NLS-1$
|
|
464 |
lblEditorCDMVersion.setFont(SWTResourceManager.getFont(UBUNTU, 9, SWT.NORMAL));
|
463 |
465 |
|
464 |
466 |
txtEditorCDMVersion = new Text(compAdvanced, SWT.BORDER);
|
465 |
467 |
txtEditorCDMVersion.setEditable(false);
|
... | ... | |
470 |
472 |
|
471 |
473 |
|
472 |
474 |
private void populateCdmServerCombo() {
|
473 |
|
Job job = new Job("Retrieve Server Instances") {
|
|
475 |
Job job = new Job("") { //$NON-NLS-1$
|
474 |
476 |
@Override
|
475 |
477 |
protected IStatus run(IProgressMonitor monitor) {
|
476 |
478 |
Display.getDefault().syncExec(new Runnable() {
|
... | ... | |
493 |
495 |
CdmRemoteSource devRemoteSource = CdmServerInfo.getDevServerRemoteSource();
|
494 |
496 |
if(devRemoteSource != null) {
|
495 |
497 |
isDevRemoteSource = true;
|
496 |
|
String username = System.getProperty("cdm.server.dev.username");
|
497 |
|
String password = System.getProperty("cdm.server.dev.password");
|
|
498 |
String username = System.getProperty("cdm.server.dev.username"); //$NON-NLS-1$
|
|
499 |
String password = System.getProperty("cdm.server.dev.password"); //$NON-NLS-1$
|
498 |
500 |
if(username != null && !username.isEmpty() && password != null && !password.isEmpty()) {
|
499 |
501 |
txtLogin.setText(username);
|
500 |
502 |
txtPassword.setText(password);
|
... | ... | |
534 |
536 |
}
|
535 |
537 |
|
536 |
538 |
private void updatePort() {
|
537 |
|
txtPort.setText("");
|
|
539 |
txtPort.setText(""); //$NON-NLS-1$
|
538 |
540 |
if(selectedCsii != null) {
|
539 |
541 |
int port = selectedCsii.getPort();
|
540 |
542 |
if(port == CdmServerInfo.NULL_PORT) {
|
... | ... | |
551 |
553 |
port = Integer.valueOf(txtPort.getText());
|
552 |
554 |
} catch (NumberFormatException nfe) {
|
553 |
555 |
if(!CdmServerInfo.NULL_PORT_STRING.equals(txtPort.getText())) {
|
554 |
|
setMessage("Port should be an integer");
|
|
556 |
setMessage(""); //$NON-NLS-1$
|
555 |
557 |
}
|
556 |
558 |
}
|
557 |
559 |
return port;
|
... | ... | |
567 |
569 |
txtCdmServerStatus.setText(STATUS_AVAILABLE);
|
568 |
570 |
populateCdmInstanceCombo(true);
|
569 |
571 |
String serverVersionTimestamp = generateLastModifiedTooltip(selectedCsii.getCdmlibLastModified());
|
570 |
|
txtServerVersion.setText(selectedCsii.getCdmlibServicesVersion() + ":" + serverVersionTimestamp);
|
|
572 |
txtServerVersion.setText(selectedCsii.getCdmlibServicesVersion() + ":" + serverVersionTimestamp); //$NON-NLS-1$
|
571 |
573 |
} else {
|
572 |
574 |
txtCdmServerStatus.setText(STATUS_NOT_AVAILABLE);
|
573 |
575 |
comboCdmInstance.removeAll();
|
574 |
|
disableCdmInstanceControls("", "");
|
|
576 |
disableCdmInstanceControls("", ""); //$NON-NLS-1$ //$NON-NLS-2$
|
575 |
577 |
}
|
576 |
578 |
}
|
577 |
579 |
updatePort();
|
... | ... | |
583 |
585 |
comboCdmInstance.setEnabled(false);
|
584 |
586 |
btnConnect.setEnabled(false);
|
585 |
587 |
txtCdmInstanceStatus.setText(STATUS_RETRIEVING);
|
586 |
|
txtCdmInstanceStatus.setToolTipText("");
|
|
588 |
txtCdmInstanceStatus.setToolTipText(""); //$NON-NLS-1$
|
587 |
589 |
|
588 |
|
serverJob = new Job("Retrieve Server Instances") {
|
|
590 |
serverJob = new Job("") { //$NON-NLS-1$
|
589 |
591 |
@Override
|
590 |
592 |
protected IStatus run(IProgressMonitor monitor) {
|
591 |
593 |
try {
|
... | ... | |
715 |
717 |
}
|
716 |
718 |
|
717 |
719 |
|
718 |
|
Job job = new Job("Managed CDM Server Launch") {
|
|
720 |
Job job = new Job(Messages.RemotingLoginDialog_JOB_SERVER_LAUNCH) {
|
719 |
721 |
|
720 |
722 |
@Override
|
721 |
723 |
public IStatus run(IProgressMonitor monitor) {
|
722 |
|
String mgdServerConfigFileName = "mgd.datasources.xml";
|
|
724 |
String mgdServerConfigFileName = "mgd.datasources.xml"; //$NON-NLS-1$
|
723 |
725 |
String config = CDMServerUtils.convertEditorToServerConfig();
|
724 |
726 |
File managedServerConfigFile;
|
725 |
727 |
int maxUnits = 50;
|
726 |
|
monitor.beginTask("Launching Managed CDM Server", maxUnits);
|
|
728 |
monitor.beginTask(Messages.RemotingLoginDialog_TASK_LAUNCHING_SERVER, maxUnits);
|
727 |
729 |
try {
|
728 |
|
monitor.subTask("Generating datasources config file for " + selectedCdmInstance.getName());
|
|
730 |
monitor.subTask(String.format(Messages.RemotingLoginDialog_GENERATING_CONFIG_FILE, selectedCdmInstance.getName()));
|
729 |
731 |
managedServerConfigFile = CDMServerUtils.writeManagedServerConfig(config, mgdServerConfigFileName);
|
730 |
732 |
monitor.worked(1);
|
731 |
733 |
CdmStore.setManagedServer(new CDMServer(selectedCdmInstance.getName(), managedServerConfigFile));
|
732 |
|
monitor.subTask("Starting Managed CDM Server. This may take a while.");
|
|
734 |
monitor.subTask(Messages.RemotingLoginDialog_STARTING_MGD_SERVER);
|
733 |
735 |
CdmStore.getManagedServer().start(false, RemotingLoginDialog.this);
|
734 |
736 |
int serverUnits = 0;
|
735 |
737 |
|
... | ... | |
754 |
756 |
}
|
755 |
757 |
});
|
756 |
758 |
} catch (IOException ioe) {
|
757 |
|
MessagingUtils.errorDialog("Error generating server config file",
|
|
759 |
MessagingUtils.errorDialog(Messages.RemotingLoginDialog_ERROR_GENERATING_CONFIG_FILE,
|
758 |
760 |
this,
|
759 |
761 |
ioe.getMessage(),
|
760 |
762 |
TaxeditorStorePlugin.PLUGIN_ID,
|
761 |
763 |
ioe,
|
762 |
764 |
true);
|
763 |
765 |
} catch (CDMEmbeddedServerException cse) {
|
764 |
|
MessagingUtils.errorDialog("Error starting managed server",
|
|
766 |
MessagingUtils.errorDialog(Messages.RemotingLoginDialog_ERROR_STARTING_SERVER,
|
765 |
767 |
this,
|
766 |
768 |
cse.getMessage(),
|
767 |
769 |
TaxeditorStorePlugin.PLUGIN_ID,
|
... | ... | |
786 |
788 |
try {
|
787 |
789 |
CdmStore.getManagedServer().stop();
|
788 |
790 |
} catch (Exception e) {
|
789 |
|
MessagingUtils.errorDialog("Error stopping managed server",
|
|
791 |
MessagingUtils.errorDialog(Messages.RemotingLoginDialog_ERROR_STOPPING_SERVER,
|
790 |
792 |
this,
|
791 |
|
"Could not stop managed server running at port " + CdmStore.getManagedServer().getPort() + ". Please stop it manually",
|
|
793 |
String.format(Messages.RemotingLoginDialog_COULD_NOT_STOP_SERVER, CdmStore.getManagedServer().getPort()),
|
792 |
794 |
TaxeditorStorePlugin.PLUGIN_ID,
|
793 |
795 |
e,
|
794 |
796 |
true);
|
... | ... | |
836 |
838 |
} else {
|
837 |
839 |
status = STATUS_AVAILABLE;
|
838 |
840 |
available = true;
|
839 |
|
message = "";
|
|
841 |
message = ""; //$NON-NLS-1$
|
840 |
842 |
}
|
841 |
843 |
}
|
842 |
844 |
} catch (Exception e) {
|
... | ... | |
909 |
911 |
String username, password;
|
910 |
912 |
IEclipsePreferences preferences = ConfigurationScope.INSTANCE.getNode(STORE_PREFERENCES_NODE);
|
911 |
913 |
Preferences credentialsPrefs = preferences.node(LOGIN_NODE);
|
912 |
|
username = credentialsPrefs.get(getUsernamePrefKey(), "");
|
|
914 |
username = credentialsPrefs.get(getUsernamePrefKey(), ""); //$NON-NLS-1$
|
913 |
915 |
txtLogin.setText(username);
|
914 |
|
password = credentialsPrefs.get(getPasswordPrefKey(),"");
|
|
916 |
password = credentialsPrefs.get(getPasswordPrefKey(),""); //$NON-NLS-1$
|
915 |
917 |
txtPassword.setText(password);
|
916 |
918 |
if(username.isEmpty() || password.isEmpty()) {
|
917 |
919 |
autoConnect = false;
|
... | ... | |
927 |
929 |
}
|
928 |
930 |
|
929 |
931 |
private void emptyCredentials() {
|
930 |
|
txtLogin.setText("");
|
931 |
|
txtPassword.setText("");
|
|
932 |
txtLogin.setText(""); //$NON-NLS-1$
|
|
933 |
txtPassword.setText(""); //$NON-NLS-1$
|
932 |
934 |
}
|
933 |
935 |
|
934 |
936 |
private String getUsernamePrefKey() {
|
... | ... | |
941 |
943 |
|
942 |
944 |
private boolean validateLogin(ICdmRemoteSource remoteSource) {
|
943 |
945 |
if(getUsername() == null || getUsername().isEmpty()) {
|
944 |
|
setMessage("User login cannot be empty");
|
|
946 |
setMessage(""); //$NON-NLS-1$
|
945 |
947 |
return false;
|
946 |
948 |
}
|
947 |
949 |
if(getPassword() == null || getPassword().isEmpty()) {
|
948 |
|
setMessage("Password cannot be empty");
|
|
950 |
setMessage(""); //$NON-NLS-1$
|
949 |
951 |
return false;
|
950 |
952 |
}
|
951 |
953 |
|
... | ... | |
979 |
981 |
if(message != null && !message.isEmpty()) {
|
980 |
982 |
if(message.length() > 60) {
|
981 |
983 |
styledTxtMessage.setToolTipText(message);
|
982 |
|
message = message.substring(0, 60) + "...";
|
|
984 |
message = message.substring(0, 60) + "..."; //$NON-NLS-1$
|
983 |
985 |
}
|
984 |
986 |
styledTxtMessage.setText(message);
|
985 |
987 |
styledTxtMessage.setVisible(true);
|
... | ... | |
987 |
989 |
shlConnect.setSize(MIN_WIDTH, getHeightWithoutMessage() + MESSAGE_HEIGHT);
|
988 |
990 |
shlConnect.setMinimumSize(MIN_WIDTH, getHeightWithoutMessage() + MESSAGE_HEIGHT);
|
989 |
991 |
} else {
|
990 |
|
styledTxtMessage.setText("");
|
|
992 |
styledTxtMessage.setText(""); //$NON-NLS-1$
|
991 |
993 |
styledTxtMessage.setVisible(false);
|
992 |
994 |
((GridData)styledTxtMessage.getLayoutData()).exclude = true;
|
993 |
995 |
shlConnect.setSize(MIN_WIDTH, getHeightWithoutMessage());
|
... | ... | |
1033 |
1035 |
|
1034 |
1036 |
private String generateLastModifiedTooltip(String cdmlibLastModified) {
|
1035 |
1037 |
if(StringUtils.isBlank(cdmlibLastModified)) {
|
1036 |
|
return "";
|
|
1038 |
return ""; //$NON-NLS-1$
|
1037 |
1039 |
}
|
1038 |
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd.HH.mm.z");
|
|
1040 |
SimpleDateFormat sdf = new SimpleDateFormat("yyyy.MM.dd.HH.mm.z"); //$NON-NLS-1$
|
1039 |
1041 |
Date cdmlibLastModifiedDate;
|
1040 |
|
String cdmlibLastModifiedTimestamp = "";
|
|
1042 |
String cdmlibLastModifiedTimestamp = ""; //$NON-NLS-1$
|
1041 |
1043 |
|
1042 |
1044 |
cdmlibLastModifiedDate = new Date(Long.valueOf(cdmlibLastModified));
|
1043 |
1045 |
cdmlibLastModifiedTimestamp = sdf.format(cdmlibLastModifiedDate);
|
... | ... | |
1048 |
1050 |
private void setEditorInfo() {
|
1049 |
1051 |
txtEditorCDMVersion.setText(CdmMetaData.getDbSchemaVersion());
|
1050 |
1052 |
String editorVersionTimestamp = generateLastModifiedTooltip(CdmApplicationState.getCdmlibLastModified());
|
1051 |
|
txtEditorVersion.setText(CdmApplicationState.getCdmlibVersion() + ":" + editorVersionTimestamp);
|
|
1053 |
txtEditorVersion.setText(CdmApplicationState.getCdmlibVersion() + ":" + editorVersionTimestamp); //$NON-NLS-1$
|
1052 |
1054 |
}
|
1053 |
1055 |
|
1054 |
1056 |
private void clearOnServerChange() {
|
1055 |
|
setMessage("");
|
1056 |
|
txtServerCDMVersion.setText("");
|
1057 |
|
txtServerVersion.setText("");
|
1058 |
|
txtServerVersion.setToolTipText("");
|
1059 |
|
txtServerCDMVersion.setText("");
|
|
1057 |
setMessage(""); //$NON-NLS-1$
|
|
1058 |
txtServerCDMVersion.setText(""); //$NON-NLS-1$
|
|
1059 |
txtServerVersion.setText(""); //$NON-NLS-1$
|
|
1060 |
txtServerVersion.setToolTipText(""); //$NON-NLS-1$
|
|
1061 |
txtServerCDMVersion.setText(""); //$NON-NLS-1$
|
1060 |
1062 |
comboCdmInstance.removeAll();
|
1061 |
|
txtCdmInstanceStatus.setText("");
|
|
1063 |
txtCdmInstanceStatus.setText(""); //$NON-NLS-1$
|
1062 |
1064 |
txtPort.setEditable(false);
|
1063 |
1065 |
txtPort.setEnabled(false);
|
1064 |
1066 |
}
|
1065 |
1067 |
|
1066 |
1068 |
private void clearOnInstanceChange() {
|
1067 |
|
setMessage("");
|
1068 |
|
txtServerCDMVersion.setText("");
|
|
1069 |
setMessage(""); //$NON-NLS-1$
|
|
1070 |
txtServerCDMVersion.setText(""); //$NON-NLS-1$
|
1069 |
1071 |
}
|
1070 |
1072 |
|
1071 |
1073 |
/**
|
... | ... | |
1079 |
1081 |
public void run() {
|
1080 |
1082 |
serverJob.cancel();
|
1081 |
1083 |
|
1082 |
|
String title = "CDM Server launch error";
|
|
1084 |
String title = ""; //$NON-NLS-1$
|
1083 |
1085 |
String message = t.getMessage();
|
1084 |
1086 |
|
1085 |
1087 |
|
I18n for RemoteLoginDialog #5146