Author: adietish
Date: 2011-10-04 08:21:36 -0400 (Tue, 04 Oct 2011)
New Revision: 35321
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPageModel.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/CredentialsWizardPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/CredentialsWizardPageModel.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/NewDomainWizardPageModel.java
Removed:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerWizardPage.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractOpenshiftWizardPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractSkippingWizard.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/NewDomainWizardPage.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizard.java
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizardModel.java
Log:
[JBIDE-9793] now skipping domain page if domain is already present
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractOpenshiftWizardPage.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractOpenshiftWizardPage.java 2011-10-04
11:47:23 UTC (rev 35320)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractOpenshiftWizardPage.java 2011-10-04
12:21:36 UTC (rev 35321)
@@ -28,13 +28,10 @@
*/
public abstract class AbstractOpenshiftWizardPage extends WizardPage {
- protected ServerAdapterWizardModel model;
private DataBindingContext dbc;
- protected AbstractOpenshiftWizardPage(String title, String description, String pageName,
IWizard wizard,
- ServerAdapterWizardModel model) {
+ protected AbstractOpenshiftWizardPage(String title, String description, String pageName,
IWizard wizard) {
super(pageName);
- this.model = model;
setWizard(wizard);
setTitle(title);
setDescription(description);
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractSkippingWizard.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractSkippingWizard.java 2011-10-04
11:47:23 UTC (rev 35320)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/AbstractSkippingWizard.java 2011-10-04
12:21:36 UTC (rev 35321)
@@ -31,7 +31,6 @@
break;
}
}
-
return nextPage;
}
@@ -47,7 +46,6 @@
break;
}
}
-
return previousPage;
}
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPage.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPage.java 2011-10-04
11:47:23 UTC (rev 35320)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPage.java 2011-10-04
12:21:36 UTC (rev 35321)
@@ -33,7 +33,6 @@
import org.eclipse.swt.widgets.Table;
import org.eclipse.ui.PlatformUI;
import org.jboss.ide.eclipse.as.openshift.core.IApplication;
-import org.jboss.ide.eclipse.as.openshift.core.IUser;
import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
import org.jboss.ide.eclipse.as.openshift.ui.internal.OpenshiftUIActivator;
import org.jboss.tools.common.ui.WizardUtils;
@@ -44,10 +43,12 @@
public class ApplicationWizardPage extends AbstractOpenshiftWizardPage {
private TableViewer viewer;
+ private ApplicationWizardPageModel model;
- protected ApplicationWizardPage(IWizard wizard, ServerAdapterWizardModel model) {
+ protected ApplicationWizardPage(IWizard wizard, ServerAdapterWizardModel wizardModel) {
super("Application selection", "Please select an Openshift Express
application to use",
- "Application selection", wizard, model);
+ "Application selection", wizard);
+ this.model = new ApplicationWizardPageModel(wizardModel);
}
@Override
@@ -97,11 +98,7 @@
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
- IUser user = model.getUser();
- if (user == null) {
- return Status.OK_STATUS;
- }
- bindApplications(user.getApplications(), viewer);
+ bindApplications(model.getApplications(), viewer);
return Status.OK_STATUS;
} catch (OpenshiftException e) {
return new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID,
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPageModel.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPageModel.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPageModel.java 2011-10-04
12:21:36 UTC (rev 35321)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.ui.internal.wizard;
+
+import java.util.Collection;
+
+import org.jboss.ide.eclipse.as.openshift.core.IApplication;
+import org.jboss.ide.eclipse.as.openshift.core.IUser;
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+
+/**
+ * @author André Dietisheim
+ *
+ */
+public class ApplicationWizardPageModel {
+
+ private ServerAdapterWizardModel wizardModel;
+
+ public ApplicationWizardPageModel(ServerAdapterWizardModel wizardModel) {
+ this.wizardModel = wizardModel;
+ }
+
+ public Collection<IApplication> getApplications() throws OpenshiftException {
+ IUser user = wizardModel.getUser();
+ return user.getApplications();
+ }
+
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ApplicationWizardPageModel.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Copied:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/CredentialsWizardPage.java
(from rev 35313,
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerWizardPage.java)
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/CredentialsWizardPage.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/CredentialsWizardPage.java 2011-10-04
12:21:36 UTC (rev 35321)
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.ui.internal.wizard;
+
+import org.eclipse.core.databinding.Binding;
+import org.eclipse.core.databinding.DataBindingContext;
+import org.eclipse.core.databinding.UpdateValueStrategy;
+import org.eclipse.core.databinding.beans.BeanProperties;
+import org.eclipse.core.databinding.observable.value.WritableValue;
+import org.eclipse.core.databinding.validation.IValidator;
+import org.eclipse.core.databinding.validation.ValidationStatus;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Link;
+import org.eclipse.swt.widgets.Text;
+import org.jboss.ide.eclipse.as.openshift.ui.internal.OpenshiftUIActivator;
+import org.jboss.tools.common.ui.BrowserUtil;
+import org.jboss.tools.common.ui.WizardUtils;
+import org.jboss.tools.common.ui.databinding.DataBindingUtils;
+
+/**
+ * @author André Dietisheim
+ */
+public class CredentialsWizardPage extends AbstractOpenshiftWizardPage {
+
+ protected static final String OPENSHIFT_EXPRESS_SIGNUP_URL =
"https://openshift.redhat.com/app/user/new/express"; //$NON-NLS-1$
+
+ private Button validateButton;
+
+ private CredentialsWizardPageModel model;
+
+ public CredentialsWizardPage(IWizard wizard, ServerAdapterWizardModel wizardModel) {
+ super("Server connetion", "Please provide the credentails of your user
account on Openshift Express",
+ "Server Connection", wizard);
+ this.model = new CredentialsWizardPageModel(wizardModel);
+ }
+
+ protected void doCreateControls(Composite container, DataBindingContext dbc) {
+ GridLayoutFactory.fillDefaults().numColumns(3).margins(10, 10).applyTo(container);
+
+ Link signupLink = new Link(container, SWT.WRAP);
+ signupLink.setText("If you have no user account on Openshit Express yet, please
sign up <a>here</a>.");
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(3, 1).hint(SWT.DEFAULT,
30).applyTo(signupLink);
+ signupLink.addSelectionListener(onSignupLinkClicked());
+
+ // Label serverUrlLabel = new Label(container, SWT.NONE);
+ // serverUrlLabel.setText("Server URL");
+ // GridDataFactory.fillDefaults().align(SWT.LEFT,
+ // SWT.CENTER).applyTo(serverUrlLabel);
+ // Text serverUrlText = new Text(container, SWT.BORDER);
+ // GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
+ // false).span(2, 1).applyTo(serverUrlText);
+ // dbc.bindValue(
+ // WidgetProperties.text(SWT.Modify).observe(serverUrlText),
+ // BeanProperties.value(
+ // ServerAdapterWizardModel.class,
+ // ServerAdapterWizardModel.PROPERTY_SERVER_URL).observe(model),
+ // new UpdateValueStrategy()
+ // .setAfterGetValidator(new
+ // MandatoryStringValidator("You have to provide a value for the server
url."))
+ // .setBeforeSetValidator(new SimpleUrlStringValidator())
+ // .setConverter(new TrimTrailingSlashConverter()),
+ // null);
+
+ Label rhLoginLabel = new Label(container, SWT.NONE);
+ rhLoginLabel.setText("&Username");
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(rhLoginLabel);
+ Text rhLoginText = new Text(container, SWT.BORDER);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2,
1).applyTo(rhLoginText);
+ Binding rhLoginBining = DataBindingUtils.bindMandatoryTextField(
+ rhLoginText, "Username", CredentialsWizardPageModel.PROPERTY_RHLOGIN,
model, dbc);
+
+ Label passwordLabel = new Label(container, SWT.NONE);
+ passwordLabel.setText("&Password");
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(passwordLabel);
+ Text passwordText = new Text(container, SWT.BORDER | SWT.PASSWORD);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2,
1).applyTo(passwordText);
+ Binding passwordBinding = DataBindingUtils.bindMandatoryTextField(
+ passwordText, "Password", CredentialsWizardPageModel.PROPERTY_PASSWORD,
model, dbc);
+
+ Label spacerLabel = new Label(container, SWT.None);
+ GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(2,
1).applyTo(spacerLabel);
+
+ // Label credentialsValidatyLabel = new Label(container, SWT.None);
+ // GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).hint(64,
+ // 64).applyTo(credentialsValidatyLabel);
+
+ this.validateButton = new Button(container, SWT.NONE);
+ validateButton.setText("&Validate");
+ GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).indent(0, 10).hint(100,
34).applyTo(validateButton);
+ DataBindingUtils.bindButtonEnablementToValidationStatus(
+ validateButton,
+ dbc,
+ rhLoginBining, passwordBinding);
+ validateButton.addSelectionListener(onValidate(dbc));
+ dbc.bindValue(
+ new WritableValue(null, IStatus.class),
+ BeanProperties.value(CredentialsWizardPageModel.PROPERTY_CREDENTIALS_VALIDITY).observe(model),
+ new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
+ new UpdateValueStrategy().setAfterGetValidator(
+ new CredentialsStatusValidator()));
+ }
+
+ protected SelectionAdapter onValidate(final DataBindingContext dbc) {
+ return new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ WizardUtils.runInWizard(
+ new Job("Testing user credentials") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ model.validateCredentials();
+ return Status.OK_STATUS;
+ }
+ }, getWizard().getContainer(), dbc);
+ } catch (Exception ex) {
+ // ignore
+ }
+ };
+ };
+ }
+
+ protected SelectionAdapter onSignupLinkClicked() {
+ return new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ BrowserUtil.checkedCreateInternalBrowser(OPENSHIFT_EXPRESS_SIGNUP_URL,
OPENSHIFT_EXPRESS_SIGNUP_URL,
+ OpenshiftUIActivator.PLUGIN_ID, OpenshiftUIActivator.getDefault().getLog());
+ getWizard().getContainer().getShell().close();
+ }
+ };
+ }
+
+ private static class CredentialsStatusValidator implements IValidator {
+ public IStatus validate(Object value) {
+ if (value instanceof IStatus) {
+ int currentSeverity = ((IStatus) value).getSeverity();
+ if (currentSeverity < IStatus.ERROR) {
+ return ValidationStatus.ok();
+ }
+ } else if (value == null) {
+ return ValidationStatus.info("You have to validate your credentials");
+ }
+ return ValidationStatus.error("The given credentials are not valid");
+ }
+ }
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/CredentialsWizardPage.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/CredentialsWizardPageModel.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/CredentialsWizardPageModel.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/CredentialsWizardPageModel.java 2011-10-04
12:21:36 UTC (rev 35321)
@@ -0,0 +1,139 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.ui.internal.wizard;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftService;
+import org.jboss.ide.eclipse.as.openshift.core.IUser;
+import org.jboss.ide.eclipse.as.openshift.core.NotFoundOpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+import org.jboss.ide.eclipse.as.openshift.core.User;
+import org.jboss.ide.eclipse.as.openshift.core.UserConfiguration;
+import org.jboss.ide.eclipse.as.openshift.ui.internal.OpenshiftUIActivator;
+import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
+import org.jboss.tools.common.ui.preferencevalue.StringPreferenceValue;
+
+/**
+ * @author André Dietisheim
+ */
+public class CredentialsWizardPageModel extends ObservableUIPojo {
+
+ private static final String RHLOGIN_PREFS_KEY =
"org.jboss.ide.eclipse.as.openshift.ui.internal.wizard.CredentialsWizardModel_RHLOGIN";
+
+ public static final String PROPERTY_SERVER_URL = "serverUrl";
+ public static final String PROPERTY_RHLOGIN = "rhLogin";
+ public static final String PROPERTY_PASSWORD = "password";
+ public static final String PROPERTY_CREDENTIALS_VALIDITY =
"credentialsValidity";
+
+ private String serverUrl;
+ private String rhLogin;
+ private String password;
+ private IStatus credentialsValidity;
+ private IUser user;
+ private StringPreferenceValue rhLoginPreferenceValue;
+
+ private ServerAdapterWizardModel wizardModel;
+
+ public CredentialsWizardPageModel(ServerAdapterWizardModel model) {
+ this.wizardModel = model;
+ this.serverUrl = IOpenshiftService.BASE_URL;
+ this.rhLoginPreferenceValue = new StringPreferenceValue(RHLOGIN_PREFS_KEY,
OpenshiftUIActivator.PLUGIN_ID);
+ this.rhLogin = initRhLogin();
+ resetCredentialsStatus();
+ }
+
+ protected String initRhLogin() {
+ String rhLogin = null;
+ rhLogin = rhLoginPreferenceValue.get();
+ if (rhLogin == null) {
+ rhLogin = getUserConfiguration();
+ }
+ return rhLogin;
+ }
+
+ protected String getUserConfiguration() {
+ String configuredUsername = null;
+ try {
+ configuredUsername = new UserConfiguration().getRhlogin();
+ } catch (Exception e) {
+ // do nothing
+ }
+ return configuredUsername;
+ }
+
+ public String getServerUrl() {
+ return serverUrl;
+ }
+
+ public void setServerUrl(String serverUrl) {
+ firePropertyChange(PROPERTY_SERVER_URL, this.serverUrl, this.serverUrl = serverUrl);
+ }
+
+ public String getRhLogin() {
+ return rhLogin;
+ }
+
+ public void setRhLogin(String rhLogin) {
+ if (rhLogin != null
+ && !rhLogin.equals(this.rhLogin)) {
+ rhLoginPreferenceValue.store(rhLogin);
+ firePropertyChange(PROPERTY_RHLOGIN, this.rhLogin, this.rhLogin = rhLogin);
+ resetCredentialsStatus();
+ }
+ }
+
+ public String getPassword() {
+ return password;
+ }
+
+ public void setPassword(String password) {
+ if (password != null
+ && !password.equals(this.password)) {
+ firePropertyChange(PROPERTY_PASSWORD, this.password, this.password = password);
+ resetCredentialsStatus();
+ }
+ }
+
+ private void resetCredentialsStatus() {
+ setCredentialsStatus(null);
+ }
+
+ private void setCredentialsStatus(IStatus status) {
+ firePropertyChange(PROPERTY_CREDENTIALS_VALIDITY, this.credentialsValidity,
+ this.credentialsValidity = status);
+ }
+
+ public IStatus getCredentialsValidity() {
+ return credentialsValidity;
+ }
+
+ public void validateCredentials() {
+ IStatus status = new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID, "Your
credentails are not valid.");
+ try {
+ this.user = new User(getRhLogin(), getPassword());
+ if (user.isValid()) {
+ status = Status.OK_STATUS;
+ }
+ } catch (NotFoundOpenshiftException e) {
+ // valid user without domain
+ status = Status.OK_STATUS;
+ } catch (OpenshiftException e) {
+ this.user = null;
+ }
+ wizardModel.setUser(user);
+ setCredentialsStatus(status);
+ }
+
+ public IUser getUser() {
+ return user;
+ }
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/CredentialsWizardPageModel.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/NewDomainWizardPage.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/NewDomainWizardPage.java 2011-10-04
11:47:23 UTC (rev 35320)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/NewDomainWizardPage.java 2011-10-04
12:21:36 UTC (rev 35321)
@@ -11,6 +11,8 @@
package org.jboss.ide.eclipse.as.openshift.ui.internal.wizard;
import java.io.File;
+import java.util.concurrent.ArrayBlockingQueue;
+import java.util.concurrent.BlockingQueue;
import org.eclipse.core.databinding.DataBindingContext;
import org.eclipse.core.databinding.ValidationStatusProvider;
@@ -52,10 +54,12 @@
private static final String FILTEREXPRESSION_PUBLIC_SSH_KEY = "*.pub";
private static final String FILTERNAME_PUBLIC_SSH_KEY = "Public ssh key file
(*.pub)";
- public NewDomainWizardPage(IWizard wizard, ServerAdapterWizardModel model) {
+ private NewDomainWizardPageModel model;
+
+ public NewDomainWizardPage(IWizard wizard, ServerAdapterWizardModel wizardModel) {
super("New Domain", "Please create a new domain",
- "new Domain", wizard, model);
- this.model = model;
+ "new Domain", wizard);
+ this.model = new NewDomainWizardPageModel(wizardModel);
}
protected void doCreateControls(Composite container, DataBindingContext dbc) {
@@ -67,14 +71,14 @@
Text namespaceText = new Text(container, SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2,
1).applyTo(namespaceText);
DataBindingUtils.bindMandatoryTextField(namespaceText, "Domain name",
- ServerAdapterWizardModel.PROPERTY_NAMESPACE, model, dbc);
+ NewDomainWizardPageModel.PROPERTY_NAMESPACE, model, dbc);
Label sshKeyLabel = new Label(container, SWT.NONE);
sshKeyLabel.setText("SSH Key");
GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(sshKeyLabel);
Text sshKeyText = new Text(container, SWT.READ_ONLY | SWT.BORDER);
GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
false).applyTo(sshKeyText);
- DataBindingUtils.bindMandatoryTextField(sshKeyText, "SSH Key",
ServerAdapterWizardModel.PROPERTY_SSHKEY, model,
+ DataBindingUtils.bindMandatoryTextField(sshKeyText, "SSH Key",
NewDomainWizardPageModel.PROPERTY_SSHKEY, model,
dbc);
Button browseSShKeyButton = new Button(container, SWT.PUSH);
browseSShKeyButton.setText("Browse");
@@ -167,7 +171,11 @@
@Override
public boolean isSkip() {
- final boolean[] isSkip = new boolean[] { false };
+ if (!model.hasUser()) {
+ return false;
+ }
+
+ final BlockingQueue<Boolean> queue = new ArrayBlockingQueue<Boolean>(1);
try {
WizardUtils.runInWizard(
new Job("Checking presence of domain") {
@@ -175,17 +183,18 @@
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
- isSkip[0] = model.hasDomain();
- } catch (OpenshiftException e) {
+ queue.offer(model.hasDomain());
+ } catch (Exception e) {
+ queue.offer(false);
return new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID,
"Could not get domain", e);
- }
+ }
return Status.OK_STATUS;
}
}, getWizard().getContainer(), getDatabindingContext());
} catch (Exception ex) {
// ignore
}
- return isSkip[0];
+ return queue.poll();
}
}
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/NewDomainWizardPageModel.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/NewDomainWizardPageModel.java
(rev 0)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/NewDomainWizardPageModel.java 2011-10-04
12:21:36 UTC (rev 35321)
@@ -0,0 +1,87 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.ide.eclipse.as.openshift.ui.internal.wizard;
+
+import org.jboss.ide.eclipse.as.openshift.core.IDomain;
+import org.jboss.ide.eclipse.as.openshift.core.ISSHPublicKey;
+import org.jboss.ide.eclipse.as.openshift.core.IUser;
+import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
+import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
+
+/**
+ * @author André Dietisheim
+ */
+public class NewDomainWizardPageModel extends ObservableUIPojo {
+
+ public static final String PROPERTY_NAMESPACE = "namespace";
+ public static final String PROPERTY_SSHKEY = "sshKey";
+
+ private String namespace;
+ private IDomain domain;
+ private String sshKey;
+ private ServerAdapterWizardModel wizardModel;
+
+ public NewDomainWizardPageModel(ServerAdapterWizardModel wizardModel) {
+ this.wizardModel = wizardModel;
+ }
+
+ public String getNamespace() {
+ return this.namespace;
+ }
+
+ public void createDomain() throws OpenshiftException {
+ IUser user = wizardModel.getUser();
+ this.domain = user.createDomain(namespace, loadSshKey());
+ }
+
+ public String getSshKey() {
+ return sshKey;
+ }
+
+ public void setSshKey(String sshKey) {
+ firePropertyChange(PROPERTY_SSHKEY, this.sshKey, this.sshKey = sshKey);
+ }
+
+ private ISSHPublicKey loadSshKey() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public void setNamespace(String namespace) throws OpenshiftException {
+ firePropertyChange(PROPERTY_NAMESPACE, this.namespace, this.namespace = namespace);
+ }
+
+ public boolean hasDomain() throws OpenshiftException {
+ if (!hasUser()) {
+ return false;
+ }
+ return getUser().hasDomain();
+ }
+
+ public void loadDomain() throws OpenshiftException {
+ if (!hasUser()) {
+ return;
+ }
+ IDomain domain = getUser().getDomain();
+ if (domain != null) {
+ this.domain = domain;
+ setNamespace(domain.getNamespace());
+ }
+ }
+
+ public boolean hasUser() {
+ return wizardModel.getUser() != null;
+ }
+
+ public IUser getUser() {
+ return wizardModel.getUser();
+ }
+}
Property changes on:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/NewDomainWizardPageModel.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizard.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizard.java 2011-10-04
11:47:23 UTC (rev 35320)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizard.java 2011-10-04
12:21:36 UTC (rev 35321)
@@ -35,7 +35,7 @@
@Override
public void addPages() {
ServerAdapterWizardModel model = new ServerAdapterWizardModel();
- addPage(new ServerWizardPage(this, model));
+ addPage(new CredentialsWizardPage(this, model));
addPage(new NewDomainWizardPage(this, model));
addPage(new ApplicationWizardPage(this, model));
}
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizardModel.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizardModel.java 2011-10-04
11:47:23 UTC (rev 35320)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerAdapterWizardModel.java 2011-10-04
12:21:36 UTC (rev 35321)
@@ -10,170 +10,21 @@
******************************************************************************/
package org.jboss.ide.eclipse.as.openshift.ui.internal.wizard;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.jboss.ide.eclipse.as.openshift.core.IDomain;
-import org.jboss.ide.eclipse.as.openshift.core.IOpenshiftService;
-import org.jboss.ide.eclipse.as.openshift.core.ISSHPublicKey;
import org.jboss.ide.eclipse.as.openshift.core.IUser;
-import org.jboss.ide.eclipse.as.openshift.core.NotFoundOpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.OpenshiftException;
-import org.jboss.ide.eclipse.as.openshift.core.User;
-import org.jboss.ide.eclipse.as.openshift.core.UserConfiguration;
-import org.jboss.ide.eclipse.as.openshift.ui.internal.OpenshiftUIActivator;
import org.jboss.tools.common.ui.databinding.ObservableUIPojo;
-import org.jboss.tools.common.ui.preferencevalue.StringPreferenceValue;
/**
* @author André Dietisheim
*/
public class ServerAdapterWizardModel extends ObservableUIPojo {
- private static final String RHLOGIN_PREFS_KEY =
"org.jboss.ide.eclipse.as.openshift.ui.internal.wizard.ServerAdapterWizardModel_RHLOGIN";
-
- public static final String PROPERTY_SERVER_URL = "serverUrl";
- public static final String PROPERTY_RHLOGIN = "rhLogin";
- public static final String PROPERTY_PASSWORD = "password";
- public static final String PROPERTY_CREDENTIALS_VALIDITY =
"credentialsValidity";
- public static final String PROPERTY_NAMESPACE = "namespace";
- public static final String PROPERTY_SSHKEY = "sshKey";
-
- private String serverUrl;
- private String rhLogin;
- private String password;
- private IStatus credentialsValidity;
private IUser user;
- private String namespace;
- private StringPreferenceValue rhLoginPreferenceValue;
- private IDomain domain;
- private String sshKey;
- public ServerAdapterWizardModel() {
- this.serverUrl = IOpenshiftService.BASE_URL;
- this.rhLoginPreferenceValue = new StringPreferenceValue(RHLOGIN_PREFS_KEY,
OpenshiftUIActivator.PLUGIN_ID);
- this.rhLogin = initRhLogin();
- resetCredentialsStatus();
+ public void setUser(IUser user) {
+ this.user = user;
}
-
- protected String initRhLogin() {
- String rhLogin = null;
- rhLogin = rhLoginPreferenceValue.get();
- if (rhLogin == null) {
- rhLogin = getUserConfiguration();
- }
- return rhLogin;
- }
-
- protected String getUserConfiguration() {
- String configuredUsername = null;
- try {
- configuredUsername = new UserConfiguration().getRhlogin();
- } catch (Exception e) {
- // do nothing
- }
- return configuredUsername;
- }
-
- public String getServerUrl() {
- return serverUrl;
- }
-
- public void setServerUrl(String serverUrl) {
- firePropertyChange(PROPERTY_SERVER_URL, this.serverUrl, this.serverUrl = serverUrl);
- }
-
- public String getRhLogin() {
- return rhLogin;
- }
-
- public void setRhLogin(String rhLogin) {
- if (rhLogin != null
- && !rhLogin.equals(this.rhLogin)) {
- rhLoginPreferenceValue.store(rhLogin);
- firePropertyChange(PROPERTY_RHLOGIN, this.rhLogin, this.rhLogin = rhLogin);
- resetCredentialsStatus();
- }
- }
-
- public String getPassword() {
- return password;
- }
-
- public void setPassword(String password) {
- if (password != null
- && !password.equals(this.password)) {
- firePropertyChange(PROPERTY_PASSWORD, this.password, this.password = password);
- resetCredentialsStatus();
- }
- }
-
- private void resetCredentialsStatus() {
- setCredentialsStatus(null);
- }
-
- private void setCredentialsStatus(IStatus status) {
- firePropertyChange(PROPERTY_CREDENTIALS_VALIDITY, this.credentialsValidity,
- this.credentialsValidity = status);
- }
-
- public IStatus getCredentialsValidity() {
- return credentialsValidity;
- }
-
- public void validateCredentials() {
- IStatus status = new Status(IStatus.ERROR, OpenshiftUIActivator.PLUGIN_ID, "Your
credentails are not valid.");
- try {
- this.user = new User(getRhLogin(), getPassword());
- if (user.isValid()) {
- status = Status.OK_STATUS;
- }
- } catch (NotFoundOpenshiftException e) {
- // valid user without domain
- status = Status.OK_STATUS;
- } catch (OpenshiftException e) {
- this.user = null;
- }
- setCredentialsStatus(status);
- }
-
+
public IUser getUser() {
return user;
}
-
- public String getNamespace() {
- return this.namespace;
- }
-
- public void createDomain() throws OpenshiftException {
- this.domain = getUser().createDomain(namespace, loadSshKey());
- }
-
- public String getSshKey() {
- return sshKey;
- }
-
- public void setSshKey(String sshKey) {
- firePropertyChange(PROPERTY_SSHKEY, this.sshKey, this.sshKey = sshKey);
- }
-
- private ISSHPublicKey loadSshKey() {
- // TODO Auto-generated method stub
- return null;
- }
-
- public void setNamespace(String namespace) throws OpenshiftException {
- firePropertyChange(PROPERTY_NAMESPACE, this.namespace, this.namespace = namespace);
- }
-
- public boolean hasDomain() throws OpenshiftException {
- return getUser().hasDomain();
- }
-
- public void loadDomain() throws OpenshiftException {
- IDomain domain = getUser().getDomain();
- if (domain != null) {
- this.domain = domain;
- setNamespace(domain.getNamespace());
- }
- }
}
Deleted:
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerWizardPage.java
===================================================================
---
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerWizardPage.java 2011-10-04
11:47:23 UTC (rev 35320)
+++
trunk/as/plugins/org.jboss.ide.eclipse.as.openshift.ui/src/org/jboss/ide/eclipse/as/openshift/ui/internal/wizard/ServerWizardPage.java 2011-10-04
12:21:36 UTC (rev 35321)
@@ -1,168 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.ide.eclipse.as.openshift.ui.internal.wizard;
-
-import org.eclipse.core.databinding.Binding;
-import org.eclipse.core.databinding.DataBindingContext;
-import org.eclipse.core.databinding.UpdateValueStrategy;
-import org.eclipse.core.databinding.beans.BeanProperties;
-import org.eclipse.core.databinding.observable.value.WritableValue;
-import org.eclipse.core.databinding.validation.IValidator;
-import org.eclipse.core.databinding.validation.ValidationStatus;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.layout.GridDataFactory;
-import org.eclipse.jface.layout.GridLayoutFactory;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Link;
-import org.eclipse.swt.widgets.Text;
-import org.jboss.ide.eclipse.as.openshift.ui.internal.OpenshiftUIActivator;
-import org.jboss.tools.common.ui.BrowserUtil;
-import org.jboss.tools.common.ui.WizardUtils;
-import org.jboss.tools.common.ui.databinding.DataBindingUtils;
-
-/**
- * @author André Dietisheim
- */
-public class ServerWizardPage extends AbstractOpenshiftWizardPage {
-
- protected static final String OPENSHIFT_EXPRESS_SIGNUP_URL =
"https://openshift.redhat.com/app/user/new/express"; //$NON-NLS-1$
-
- private Button validateButton;
-
- public ServerWizardPage(IWizard wizard, ServerAdapterWizardModel model) {
- super("Server connetion", "Please provide the credentails of your user
account on Openshift Express",
- "Server Connection", wizard, model);
- this.model = model;
- }
-
- protected void doCreateControls(Composite container, DataBindingContext dbc) {
- GridLayoutFactory.fillDefaults().numColumns(3).margins(10, 10).applyTo(container);
-
- Link signupLink = new Link(container, SWT.WRAP);
- signupLink.setText("If you have no user account on Openshit Express yet, please
sign up <a>here</a>.");
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(3, 1).hint(SWT.DEFAULT,
30).applyTo(signupLink);
- signupLink.addSelectionListener(onSignupLinkClicked());
-
- // Label serverUrlLabel = new Label(container, SWT.NONE);
- // serverUrlLabel.setText("Server URL");
- // GridDataFactory.fillDefaults().align(SWT.LEFT,
- // SWT.CENTER).applyTo(serverUrlLabel);
- // Text serverUrlText = new Text(container, SWT.BORDER);
- // GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true,
- // false).span(2, 1).applyTo(serverUrlText);
- // dbc.bindValue(
- // WidgetProperties.text(SWT.Modify).observe(serverUrlText),
- // BeanProperties.value(
- // ServerAdapterWizardModel.class,
- // ServerAdapterWizardModel.PROPERTY_SERVER_URL).observe(model),
- // new UpdateValueStrategy()
- // .setAfterGetValidator(new
- // MandatoryStringValidator("You have to provide a value for the server
url."))
- // .setBeforeSetValidator(new SimpleUrlStringValidator())
- // .setConverter(new TrimTrailingSlashConverter()),
- // null);
-
- Label rhLoginLabel = new Label(container, SWT.NONE);
- rhLoginLabel.setText("&Username");
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(rhLoginLabel);
- Text rhLoginText = new Text(container, SWT.BORDER);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2,
1).applyTo(rhLoginText);
- Binding rhLoginBining = DataBindingUtils.bindMandatoryTextField(
- rhLoginText, "Username", ServerAdapterWizardModel.PROPERTY_RHLOGIN, model,
dbc);
-
- Label passwordLabel = new Label(container, SWT.NONE);
- passwordLabel.setText("&Password");
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).applyTo(passwordLabel);
- Text passwordText = new Text(container, SWT.BORDER | SWT.PASSWORD);
- GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).grab(true, false).span(2,
1).applyTo(passwordText);
- Binding passwordBinding = DataBindingUtils.bindMandatoryTextField(
- passwordText, "Password", ServerAdapterWizardModel.PROPERTY_PASSWORD,
model, dbc);
-
- Label spacerLabel = new Label(container, SWT.None);
- GridDataFactory.fillDefaults().align(SWT.LEFT, SWT.CENTER).span(2,
1).applyTo(spacerLabel);
-
- // Label credentialsValidatyLabel = new Label(container, SWT.None);
- // GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).hint(64,
- // 64).applyTo(credentialsValidatyLabel);
-
- this.validateButton = new Button(container, SWT.NONE);
- validateButton.setText("&Validate");
- GridDataFactory.fillDefaults().align(SWT.RIGHT, SWT.CENTER).indent(0, 10).hint(100,
34).applyTo(validateButton);
- DataBindingUtils.bindButtonEnablementToValidationStatus(
- validateButton,
- dbc,
- rhLoginBining, passwordBinding);
- validateButton.addSelectionListener(onValidate(dbc));
- dbc.bindValue(
- new WritableValue(null, IStatus.class),
- BeanProperties.value(ServerAdapterWizardModel.PROPERTY_CREDENTIALS_VALIDITY).observe(model),
- new UpdateValueStrategy(UpdateValueStrategy.POLICY_NEVER),
- new UpdateValueStrategy().setAfterGetValidator(
- new CredentialsStatusValidator()));
- }
-
- protected SelectionAdapter onValidate(final DataBindingContext dbc) {
- return new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- WizardUtils.runInWizard(
- new Job("Testing user credentials") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- model.validateCredentials();
- return Status.OK_STATUS;
- }
- }, getWizard().getContainer(), dbc);
- } catch (Exception ex) {
- // ignore
- }
- };
- };
- }
-
- protected SelectionAdapter onSignupLinkClicked() {
- return new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- BrowserUtil.checkedCreateInternalBrowser(OPENSHIFT_EXPRESS_SIGNUP_URL,
OPENSHIFT_EXPRESS_SIGNUP_URL,
- OpenshiftUIActivator.PLUGIN_ID, OpenshiftUIActivator.getDefault().getLog());
- getWizard().getContainer().getShell().close();
- }
- };
- }
-
- private static class CredentialsStatusValidator implements IValidator {
- public IStatus validate(Object value) {
- if (value instanceof IStatus) {
- int currentSeverity = ((IStatus) value).getSeverity();
- if (currentSeverity < IStatus.ERROR) {
- return ValidationStatus.ok();
- }
- } else if (value == null) {
- return ValidationStatus.info("You have to validate your credentials");
- }
- return ValidationStatus.error("The given credentials are not valid");
- }
- }
-}