Skip to content

Commit

Permalink
TEIIDDES-1518: Fixes for teiid server
Browse files Browse the repository at this point in the history
* TeiidServerEditor
 * SSL checkboxes aligned with other widgets by adding labels to the left
   of box rather than a right label alignment

* VdbDeployer
 * Stop the deploy failed message erroneously being displayed due to the
   wrong string being passed to the hasVdb() method of the teiid server

* TeiidServer
* ExecutionAdmin
 * When a ping is conducted, only disconnect if the ping initiated the
   connect. Otherwise, its annoying to have to reconnect after a ping
  • Loading branch information
Paul Richardson committed Dec 18, 2012
1 parent 7e05075 commit 4584df7
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -244,11 +244,14 @@ private void createAdminSection(Composite parent) {
GridDataFactory.fillDefaults().grab(false, false).span(2, 1).applyTo(adminDescriptionText);

if (ITeiidServerVersion.SEVEN.equals(teiidServer.getServerVersion().getMajor())) {
adminSSLCheckbox = toolkit.createButton(composite, UTIL.getString("serverPageSecureConnAdminLabel"), SWT.CHECK); //$NON-NLS-1$
Label checkboxLabel = toolkit.createLabel(composite, UTIL.getString("serverPageSecureConnAdminLabel")); //$NON-NLS-1$
GridDataFactory.fillDefaults().grab(true, false).applyTo(checkboxLabel);
blueForeground(checkboxLabel);

adminSSLCheckbox = toolkit.createButton(composite, "", SWT.CHECK); //$NON-NLS-1$
adminSSLCheckbox.setSelection(teiidServer.getTeiidAdminInfo().isSecure());
blueForeground(adminSSLCheckbox);
adminSSLCheckbox.addSelectionListener(dirtySelectionListener);
GridDataFactory.fillDefaults().grab(false, false).span(2, 1).applyTo(adminSSLCheckbox);
GridDataFactory.fillDefaults().grab(false, false).applyTo(adminSSLCheckbox);
}

adminPingHyperlink = toolkit.createHyperlink(composite, UTIL.getString("TeiidServerAdminSection.testPingButtonLabel"), SWT.NONE); //$NON-NLS-1$
Expand Down Expand Up @@ -304,11 +307,15 @@ private void createJDBCSection(Composite parent) {
jdbcPort = toolkit.createLabel(composite, teiidServer.getTeiidJdbcInfo().getPort());
blueForeground(jdbcPort);

jdbcSSLCheckbox = toolkit.createButton(composite, UTIL.getString("serverPageSecureConnJDBCLabel"), SWT.CHECK); //$NON-NLS-1$
Label checkboxLabel = toolkit.createLabel(composite, UTIL.getString("serverPageSecureConnJDBCLabel")); //$NON-NLS-1$
GridDataFactory.fillDefaults().grab(true, false).applyTo(checkboxLabel);
blueForeground(checkboxLabel);

jdbcSSLCheckbox = toolkit.createButton(composite, "", SWT.CHECK); //$NON-NLS-1$
jdbcSSLCheckbox.setSelection(teiidServer.getTeiidJdbcInfo().isSecure());
blueForeground(jdbcSSLCheckbox);
jdbcSSLCheckbox.addSelectionListener(dirtySelectionListener);
GridDataFactory.fillDefaults().grab(false, false).span(2, 1).applyTo(jdbcSSLCheckbox);
GridDataFactory.fillDefaults().grab(false, false).applyTo(jdbcSSLCheckbox);

jdbcPingHyperlink = toolkit.createHyperlink(composite, UTIL.getString("TeiidServerJDBCSection.testPingButtonLabel"), SWT.NONE); //$NON-NLS-1$
GridDataFactory.fillDefaults().grab(true, false).applyTo(jdbcPingHyperlink);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ public void run() {
if (this.status == null) {
monitor.subTask(UTIL.getString(PREFIX + "deployVdbTask", getVdbName())); //$NON-NLS-1$
teiidServer.deployVdb(vdb.getFile());
this.status = ((! teiidServer.hasVdb(getVdbName())) ? DeployStatus.DEPLOY_VDB_FAILED : DeployStatus.DEPLOYED_VDB);
this.status = (teiidServer.hasVdb(getVdbName()) ? DeployStatus.DEPLOYED_VDB : DeployStatus.DEPLOY_VDB_FAILED);
}
} catch (Exception e) {
this.status = DeployStatus.EXCEPTION;
Expand All @@ -291,7 +291,7 @@ public void run() {
* @return the name of the VDB being deployed (never <code>null</code>)
*/
public String getVdbName() {
return this.vdb.getFile().getName();
return this.vdb.getName().removeFileExtension().lastSegment();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -399,10 +399,21 @@ public void setCustomLabel( String customLabel ) {
@Override
public IStatus testPing() {
try {
connect();
boolean testCausesConnect = false;

if (admin == null) {
connect();
testCausesConnect = true;
}

ping();
disconnect();
this.admin = null;

// Only disconnect if this test ping caused
// the connect
if (testCausesConnect) {
disconnect();
}

} catch (Exception e) {
String msg = Util.getString("cannotConnectToServer", this); //$NON-NLS-1$
return new Status(IStatus.ERROR, PLUGIN_ID, msg, e);
Expand All @@ -424,10 +435,21 @@ public IStatus testPing() {
@Override
public IStatus testJDBCPing(String host, String port, String username, String password) {
try {
connect();
boolean testCausesConnect = false;

if (admin == null) {
connect();
testCausesConnect = true;
}

admin.ping(PingType.JDBC);
disconnect();
this.admin = null;

// Only disconnect if this test ping caused
// the connect
if (testCausesConnect) {
disconnect();
}

} catch (Exception e) {
String msg = Util.getString("cannotConnectToServer", this); //$NON-NLS-1$
return new Status(IStatus.ERROR, PLUGIN_ID, msg, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,6 @@ private IStatus pingJdbc() {
if( teiidJdbcConnection != null ) {
teiidJdbcConnection.close();
}
admin.close();
}
} catch (Exception ex) {
String msg = NLS.bind(Messages.serverDeployUndeployProblemPingingTeiidJdbc, url);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,6 @@ private IStatus pingJdbc() {
if( teiidJdbcConnection != null ) {
teiidJdbcConnection.close();
}
admin.close();
}
} catch (Exception ex) {
String msg = NLS.bind(Messages.serverDeployUndeployProblemPingingTeiidJdbc, url);
Expand Down

0 comments on commit 4584df7

Please sign in to comment.