Skip to content

Commit

Permalink
TEIIDDES-1518: Add admin username and password to 772 client properti…
Browse files Browse the repository at this point in the history
…es editor

* TeiidServerEditor
 * Since the admin is fully configurable in a 7.7.2 server, fields are
   needed on the editor to allow them to be modified.
 * Port controls are text or label depending on server version
 * Editor closes on application exit
 * Editor is closed if the server is deleted

* ServerPage
 * Remove the ssl settings from this wizard since they can be modified
   when the editor is displayed after the wizard has finished. Keeps the
   wizard tidy.
  • Loading branch information
Paul Richardson committed Dec 18, 2012
1 parent 0ceb18a commit 01e64ce
Show file tree
Hide file tree
Showing 3 changed files with 165 additions and 73 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -628,6 +628,9 @@ TeiidServerOverviewSection.editHyperlinkLabel=Edit
TeiidServerAdminSection.title=Administration Connection
TeiidServerAdminSection.description=<form><p>Administration is performed via the <a href="">jboss</a> management configuration</p></form>
TeiidServerAdminSection.testPingButtonLabel=Test Administration Connection
TeiidServerAdminSection.userNameLabel=User name
TeiidServerAdminSection.passwordLabel=Password
TeiidServerAdminSection.portLabel=Port

TeiidServerJDBCSection.title=JDBC Connection
TeiidServerJDBCSection.description=Properties for teiid JDBC
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@
import org.eclipse.swt.events.FocusAdapter;
import org.eclipse.swt.events.FocusEvent;
import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Group;
Expand All @@ -41,12 +38,10 @@
import org.teiid.designer.runtime.TeiidServerFactory.ServerOptions;
import org.teiid.designer.runtime.TeiidServerManager;
import org.teiid.designer.runtime.adapter.TeiidServerAdapterFactory;
import org.teiid.designer.runtime.spi.ITeiidAdminInfo;
import org.teiid.designer.runtime.spi.ITeiidJdbcInfo;
import org.teiid.designer.runtime.spi.ITeiidServer;
import org.teiid.designer.runtime.ui.DqpUiConstants;
import org.teiid.designer.runtime.ui.DqpUiPlugin;
import org.teiid.designer.runtime.version.spi.ITeiidServerVersion;
import org.teiid.designer.ui.common.util.WidgetFactory;


Expand Down Expand Up @@ -85,10 +80,6 @@ public final class ServerPage extends WizardPage {
private Text jdbcPasswordText;

private Text jdbcURLText;

private Button adminSSLButton;

private Button jdbcSSLButton;

private IServerLifecycleListener serverLifecycleListener = new IServerLifecycleListener() {

Expand Down Expand Up @@ -258,39 +249,6 @@ public void focusLost(FocusEvent e) {
}

}

private void constructSecureConnectionPanel(Composite parent) {
Group teiidSSLGroup = WidgetFactory.createGroup(parent, UTIL.getString("serverPageSecureConnectionInfoLabel")); //$NON-NLS-1$);
GridDataFactory.fillDefaults().applyTo(teiidSSLGroup);
GridLayoutFactory.fillDefaults().numColumns(2).margins(10, 5).applyTo(teiidSSLGroup);

{ // admin ssl
adminSSLButton = new Button(teiidSSLGroup, SWT.CHECK);
adminSSLButton.setText(UTIL.getString("serverPageSecureConnAdminLabel")); //$NON-NLS-1$
GridDataFactory.swtDefaults().grab(true, false).align(SWT.CENTER, SWT.CENTER).applyTo(adminSSLButton);
adminSSLButton.setToolTipText(UTIL.getString("serverPageSecureConnAdminLabel")); //$NON-NLS-1$
adminSSLButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handlePropertiesModified();
}
});
}

{ // jdbc ssl
jdbcSSLButton = new Button(teiidSSLGroup, SWT.CHECK);
jdbcSSLButton.setText(UTIL.getString("serverPageSecureConnJDBCLabel")); //$NON-NLS-1$
GridDataFactory.swtDefaults().grab(true, false).align(SWT.CENTER, SWT.CENTER).applyTo(jdbcSSLButton);
jdbcSSLButton.setToolTipText(UTIL.getString("serverPageSecureConnJDBCLabel")); //$NON-NLS-1$
jdbcSSLButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
handlePropertiesModified();
}
});
}

}

/**
* {@inheritDoc}
Expand All @@ -308,7 +266,6 @@ public void createControl( Composite parent ) {
// Add display name component
constructDisplayNamePanel(pnlMain);
constructIServerCreationPanel(pnlMain);
constructSecureConnectionPanel(pnlMain);
constructTeiidJdbcConnectionPanel(pnlMain);

setControl(pnlMain);
Expand Down Expand Up @@ -360,17 +317,6 @@ public void run() {

jbossServerNameText.setText(server.getName());

if (ITeiidServerVersion.SEVEN.equals(teiidServer.getServerVersion().getMajor())) {
ITeiidAdminInfo teiidAdminInfo = teiidServer.getTeiidAdminInfo();
adminSSLButton.setSelection(teiidAdminInfo.isSecure());
adminSSLButton.setEnabled(true);
}
else {
// Not a 7.x server so disable the button
adminSSLButton.setSelection(false);
adminSSLButton.setEnabled(false);
}

ITeiidJdbcInfo teiidJdbcInfo = teiidServer.getTeiidJdbcInfo();

if (ITeiidJdbcInfo.DEFAULT_JDBC_USERNAME.equals(jdbcUsernameText.getText()))
Expand All @@ -379,8 +325,6 @@ public void run() {
if (ITeiidJdbcInfo.DEFAULT_JDBC_PASSWORD.equals(jdbcPasswordText.getText()))
jdbcPasswordText.setText(teiidJdbcInfo.getPassword());

jdbcSSLButton.setSelection(teiidJdbcInfo.isSecure());

jdbcURLText.setText(teiidJdbcInfo.getUrl());

String displayName = displayNameText.getText();
Expand All @@ -400,14 +344,10 @@ public void run() {
private void handlePropertiesModified() {
if (teiidServer != null) {
teiidServer.setCustomLabel(displayNameText.getText());

ITeiidAdminInfo teiidAdminInfo = teiidServer.getTeiidAdminInfo();
teiidAdminInfo.setSecure(adminSSLButton.getSelection());

ITeiidJdbcInfo teiidJdbcInfo = teiidServer.getTeiidJdbcInfo();
teiidJdbcInfo.setUsername(jdbcUsernameText.getText());
teiidJdbcInfo.setPassword(jdbcPasswordText.getText());
teiidJdbcInfo.setSecure(jdbcSSLButton.getSelection());

jdbcURLText.setText(teiidJdbcInfo.getUrl());
}
Expand Down

0 comments on commit 01e64ce

Please sign in to comment.