[SYNCOPE-808] fixed problems about bundle not found, fixed some editor bugs and added validation - This closes #43 / This closes #27
Project: http://git-wip-us.apache.org/repos/asf/syncope/repo Commit: http://git-wip-us.apache.org/repos/asf/syncope/commit/b03947a3 Tree: http://git-wip-us.apache.org/repos/asf/syncope/tree/b03947a3 Diff: http://git-wip-us.apache.org/repos/asf/syncope/diff/b03947a3 Branch: refs/heads/master Commit: b03947a33a3ee3dced1cac6a863856824a4ae158 Parents: 218674e Author: Andrea Patricelli <andreapatrice...@apache.org> Authored: Thu Apr 20 11:46:12 2017 +0200 Committer: Francesco Chicchiriccò <ilgro...@apache.org> Committed: Thu Apr 20 15:50:44 2017 +0200 ---------------------------------------------------------------------- .../syncope/ide/netbeans/ConnectionParams.java | 122 +++++++++++ .../syncope/ide/netbeans/ResourceConnector.java | 41 ++-- .../syncope/ide/netbeans/UserProperties.java | 79 ------- .../view/ResourceExplorerTopComponent.form | 1 + .../view/ResourceExplorerTopComponent.java | 211 ++++++++++++------- .../ide/netbeans/view/ServerDetailsView.form | 132 +++++++----- .../ide/netbeans/view/ServerDetailsView.java | 175 ++++++++++----- pom.xml | 11 - 8 files changed, 477 insertions(+), 295 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/syncope/blob/b03947a3/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/ConnectionParams.java ---------------------------------------------------------------------- diff --git a/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/ConnectionParams.java b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/ConnectionParams.java new file mode 100644 index 0000000..13bbd69 --- /dev/null +++ b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/ConnectionParams.java @@ -0,0 +1,122 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +package org.apache.syncope.ide.netbeans; + +public final class ConnectionParams { + + private String url; + + private String username; + + private String password; + + public static final class Builder { + + private String scheme; + private String host; + private String port; + + private String username; + + private String password; + + private Builder() { + } + + public Builder scheme(final String value) { + this.scheme = value; + return this; + } + public Builder host(final String value) { + this.host = value; + return this; + } + public Builder port(final String value) { + this.port = value; + return this; + } + + public Builder username(final String value) { + this.username = value; + return this; + } + + public Builder password(final String value) { + this.password = value; + return this; + } + + public ConnectionParams build() { + return new ConnectionParams(scheme + "://" + host + ":" + port + "/syncope/rest", username, password); + } + } + + public static ConnectionParams.Builder builder() { + return new ConnectionParams.Builder(); + } + + private ConnectionParams( + final String url, + final String userName, + final String password) { + this.url = url; + this.username = userName; + this.password = password; + } + + public String getUrl() { + return url; + } + + public void setUrl(final String url) { + this.url = url; + } + + public String getUsername() { + return username; + } + + public void setUsername(final String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(final String password) { + this.password = password; + } + + public ConnectionParams port(final String value) { + this.url = value; + return this; + } + + public ConnectionParams userName(final String value) { + this.username = value; + return this; + } + + public ConnectionParams password(final String value) { + this.password = value; + return this; + } + +} http://git-wip-us.apache.org/repos/asf/syncope/blob/b03947a3/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/ResourceConnector.java ---------------------------------------------------------------------- diff --git a/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/ResourceConnector.java b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/ResourceConnector.java index 133fa8c..e666c4a 100644 --- a/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/ResourceConnector.java +++ b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/ResourceConnector.java @@ -18,13 +18,13 @@ */ package org.apache.syncope.ide.netbeans; -import java.io.BufferedReader; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; import java.io.IOException; +import java.util.prefs.Preferences; +import org.apache.commons.lang3.StringUtils; import org.apache.syncope.ide.netbeans.service.MailTemplateManagerService; import org.apache.syncope.ide.netbeans.service.ReportTemplateManagerService; +import org.apache.syncope.ide.netbeans.view.ResourceExplorerTopComponent; +import org.openide.util.NbPreferences; public final class ResourceConnector { @@ -42,10 +42,11 @@ public final class ResourceConnector { public static MailTemplateManagerService getMailTemplateManagerService() throws IOException { synchronized (MAIL_TEMPLATE_MONITOR) { if (MAIL_TEMPLATE_MANAGER_SERVICE == null) { - UserProperties userProperties = getUserProperties(); + ConnectionParams connParams = getConnectionParams(); MAIL_TEMPLATE_MANAGER_SERVICE = new MailTemplateManagerService( - userProperties.getUrl(), userProperties.getUserName(), - userProperties.getPassword()); + connParams.getUrl(), + connParams.getUsername(), + connParams.getPassword()); } } return MAIL_TEMPLATE_MANAGER_SERVICE; @@ -54,24 +55,26 @@ public final class ResourceConnector { public static ReportTemplateManagerService getReportTemplateManagerService() throws IOException { synchronized (REPORT_TEMPLATE_MONITOR) { if (REPORT_TEMPLATE_MANAGER_SERVICE == null) { - UserProperties userProperties = getUserProperties(); + ConnectionParams connParams = getConnectionParams(); REPORT_TEMPLATE_MANAGER_SERVICE = new ReportTemplateManagerService( - userProperties.getUrl(), userProperties.getUserName(), - userProperties.getPassword()); + connParams.getUrl(), + connParams.getUsername(), + connParams.getPassword()); } } return REPORT_TEMPLATE_MANAGER_SERVICE; } - private static UserProperties getUserProperties() throws FileNotFoundException, IOException { - File file = new File("UserData.txt"); - BufferedReader bufferedReader = new BufferedReader(new FileReader(file)); - String url = bufferedReader.readLine(); - String userName = bufferedReader.readLine(); - String password = bufferedReader.readLine(); - - UserProperties userProperties = new UserProperties(url, userName, password); - return userProperties; + public static ConnectionParams getConnectionParams() { + Preferences prefs = NbPreferences.forModule(ResourceExplorerTopComponent.class); + ConnectionParams connectionParams = ConnectionParams.builder() + .scheme(prefs.get("scheme", "http")) + .host(prefs.get("host", "localhost")) + .port(prefs.get("port", "8080")) + .username(prefs.get("username", StringUtils.EMPTY)) + .password(prefs.get("password", StringUtils.EMPTY)) + .build(); + return connectionParams; } } http://git-wip-us.apache.org/repos/asf/syncope/blob/b03947a3/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/UserProperties.java ---------------------------------------------------------------------- diff --git a/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/UserProperties.java b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/UserProperties.java deleted file mode 100644 index fdff30a..0000000 --- a/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/UserProperties.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -package org.apache.syncope.ide.netbeans; - -public class UserProperties { - - private String url; - - private String userName; - - private String password; - - public UserProperties() { - } - - public UserProperties(final String url, final String userName, final String password) { - this.url = url; - this.userName = userName; - this.password = password; - } - - /** - * @return the userName - */ - public String getUserName() { - return userName; - } - - /** - * @return the password - */ - public String getPassword() { - return password; - } - - /** - * @return the url - */ - public String getUrl() { - return url; - } - - /** - * @param url the url to set - */ - public void setUrl(final String url) { - this.url = url; - } - - /** - * @param userName the userName to set - */ - public void setUserName(final String userName) { - this.userName = userName; - } - - /** - * @param password the password to set - */ - public void setPassword(final String password) { - this.password = password; - } -} http://git-wip-us.apache.org/repos/asf/syncope/blob/b03947a3/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ResourceExplorerTopComponent.form ---------------------------------------------------------------------- diff --git a/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ResourceExplorerTopComponent.form b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ResourceExplorerTopComponent.form index c0b7d26..f7d5783 100644 --- a/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ResourceExplorerTopComponent.form +++ b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ResourceExplorerTopComponent.form @@ -17,6 +17,7 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> + <Form version="1.7" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo"> <AuxValues> <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/> http://git-wip-us.apache.org/repos/asf/syncope/blob/b03947a3/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ResourceExplorerTopComponent.java ---------------------------------------------------------------------- diff --git a/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ResourceExplorerTopComponent.java b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ResourceExplorerTopComponent.java index 65ac347..6305abe 100644 --- a/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ResourceExplorerTopComponent.java +++ b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ResourceExplorerTopComponent.java @@ -22,14 +22,15 @@ import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.beans.PropertyChangeListener; -import java.io.BufferedReader; import java.io.File; -import java.io.FileReader; import java.io.FileWriter; import java.io.IOException; import java.io.InputStream; import java.nio.charset.Charset; import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.util.prefs.Preferences; import javax.swing.Action; import javax.swing.JMenuItem; import javax.swing.JOptionPane; @@ -40,8 +41,11 @@ import javax.swing.text.JTextComponent; import javax.swing.tree.DefaultMutableTreeNode; import javax.swing.tree.DefaultTreeModel; import org.apache.commons.io.IOUtils; +import org.apache.commons.lang3.StringUtils; +import org.apache.syncope.common.lib.SyncopeClientException; import org.apache.syncope.common.lib.to.MailTemplateTO; import org.apache.syncope.common.lib.to.ReportTemplateTO; +import org.apache.syncope.common.lib.types.ClientExceptionType; import org.apache.syncope.common.lib.types.MailTemplateFormat; import org.apache.syncope.common.lib.types.ReportTemplateFormat; import org.apache.syncope.ide.netbeans.PluginConstants; @@ -60,6 +64,7 @@ import org.openide.filesystems.FileUtil; import org.openide.loaders.DataObject; import org.openide.util.Cancellable; import org.openide.util.Exceptions; +import org.openide.util.NbPreferences; import org.openide.util.RequestProcessor; import org.openide.windows.TopComponent; @@ -86,6 +91,8 @@ public final class ResourceExplorerTopComponent extends TopComponent { private static final long serialVersionUID = -1643737786852621861L; + public static final Logger LOG = Logger.getLogger("ResourceExplorerTopComponent"); + private final DefaultTreeModel treeModel; private final DefaultMutableTreeNode root; @@ -196,15 +203,21 @@ public final class ResourceExplorerTopComponent extends TopComponent { @Override public void componentOpened() { - File file = new File("UserData.txt"); - if (!file.exists()) { + // look for connection preferences + Preferences prefs = NbPreferences.forModule(ResourceExplorerTopComponent.class); + if (StringUtils.isBlank(prefs.get("scheme", null)) + || StringUtils.isBlank(prefs.get("host", null)) + || StringUtils.isBlank(prefs.get("port", null)) + || StringUtils.isBlank(prefs.get("username", null)) + || StringUtils.isBlank(prefs.get("password", null))) { new ServerDetailsView(null, true).setVisible(true); } try { mailTemplateManagerService = ResourceConnector.getMailTemplateManagerService(); reportTemplateManagerService = ResourceConnector.getReportTemplateManagerService(); } catch (IOException e) { - JOptionPane.showMessageDialog(null, "Error Occured.", "Error", JOptionPane.ERROR_MESSAGE); + JOptionPane.showMessageDialog(null, e.getMessage(), "Error while retrieving templates", + JOptionPane.ERROR_MESSAGE); new ServerDetailsView(null, true).setVisible(true); } @@ -316,21 +329,23 @@ public final class ResourceExplorerTopComponent extends TopComponent { @Override public void actionPerformed(final ActionEvent evt) { - File file = new File("UserData.txt"); - try { - BufferedReader bf = new BufferedReader(new FileReader(file)); - String host = bf.readLine(); - String userName = bf.readLine(); - String password = bf.readLine(); - ServerDetailsView serverDetails = new ServerDetailsView(null, true); - serverDetails.setDetails(host, userName, password); - serverDetails.setVisible(true); - } catch (IOException e) { - Exceptions.printStackTrace(e); - } + ServerDetailsView serverDetails = new ServerDetailsView(null, true); + // set previous preferences + Preferences prefs = NbPreferences.forModule(ResourceExplorerTopComponent.class); + serverDetails.setDetails(prefs.get("scheme", "http"), + prefs.get("host", "localhost"), + prefs.get("port", "8080"), + prefs.get("username", StringUtils.EMPTY), + prefs.get("password", StringUtils.EMPTY)); + // reset connection preferences + prefs.remove("scheme"); + prefs.remove("host"); + prefs.remove("port"); + prefs.remove("username"); + prefs.remove("password"); + serverDetails.setVisible(true); } }); - menu.show(evt.getComponent(), evt.getX(), evt.getY()); } @@ -431,75 +446,117 @@ public final class ResourceExplorerTopComponent extends TopComponent { String formatStr = (String) JOptionPane.showInputDialog(null, "Select File Format", "File format", JOptionPane.QUESTION_MESSAGE, null, PluginConstants.MAIL_TEMPLATE_FORMATS, MailTemplateFormat.TEXT.name()); - MailTemplateFormat format = MailTemplateFormat.valueOf(formatStr); - - String type = null; - InputStream is = null; - switch (format) { - case HTML: - type = "html"; - is = (InputStream) mailTemplateManagerService.getFormat(name, MailTemplateFormat.HTML); - break; - case TEXT: - type = "txt"; - is = (InputStream) mailTemplateManagerService.getFormat(name, MailTemplateFormat.TEXT); - break; - default: - break; - } - String content = IOUtils.toString(is, encodingPattern); - File directory = new File("Template/Mail"); - if (!directory.exists()) { - directory.mkdirs(); + if (StringUtils.isNotBlank(formatStr)) { + + MailTemplateFormat format = MailTemplateFormat.valueOf(formatStr); + String type = null; + InputStream is = null; + + try { + switch (format) { + case HTML: + type = "html"; + is = (InputStream) mailTemplateManagerService.getFormat(name, MailTemplateFormat.HTML); + break; + case TEXT: + type = "txt"; + is = (InputStream) mailTemplateManagerService.getFormat(name, MailTemplateFormat.TEXT); + break; + default: + LOG.log(Level.SEVERE, String.format("Format [%s] not supported", format)); + break; + } + } catch (SyncopeClientException e) { + LOG.log(Level.SEVERE, + String.format("Unable to get [%s] mail template in [%s] format", name, format), e); + if (ClientExceptionType.NotFound.equals(e.getType())) { + LOG.log(Level.SEVERE, String.format( + "Report template in [%s] format not found, create an empty one", format)); + } else { + JOptionPane.showMessageDialog( + null, String.format("Unable to get [%s] report template in [%s] format", name, format), + "Connection Error", JOptionPane.ERROR_MESSAGE); + } + } catch (Exception e) { + LOG.log(Level.SEVERE, + String.format("Unable to get [%s] mail template in [%s] format", name, format), e); + JOptionPane.showMessageDialog( + null, String.format("Unable to get [%s] mail template in [%s] format", name, format), "Error", + JOptionPane.ERROR_MESSAGE); + } + String content = is == null ? StringUtils.EMPTY : IOUtils.toString(is, encodingPattern); + + File directory = new File("Template/Mail"); + if (!directory.exists()) { + directory.mkdirs(); + } + File file = new File("Template/Mail/" + name + "." + type); + FileWriter fw = new FileWriter(file); + fw.write(content); + fw.flush(); + FileObject fob = FileUtil.toFileObject(file.getAbsoluteFile()); + fob.setAttribute("description", "TEXT"); + DataObject data = DataObject.find(fob); + data.getLookup().lookup(OpenCookie.class).open(); } - File file = new File("Template/Mail/" + name + "." + type); - FileWriter fw = new FileWriter(file); - fw.write(content); - fw.flush(); - FileObject fob = FileUtil.toFileObject(file.getAbsoluteFile()); - fob.setAttribute("description", "TEXT"); - DataObject data = DataObject.find(fob); - data.getLookup().lookup(OpenCookie.class).open(); } private void openReportEditor(final String name) throws IOException { String formatStr = (String) JOptionPane.showInputDialog(null, "Select File Format", "File format", JOptionPane.QUESTION_MESSAGE, null, PluginConstants.REPORT_TEMPLATE_FORMATS, ReportTemplateFormat.FO.name()); - ReportTemplateFormat format = ReportTemplateFormat.valueOf(formatStr); - - String type = null; - InputStream is = null; - switch (format) { - case HTML: - type = "html"; - is = (InputStream) reportTemplateManagerService.getFormat(name, ReportTemplateFormat.HTML); - break; - case CSV: - type = "csv"; - is = (InputStream) reportTemplateManagerService.getFormat(name, ReportTemplateFormat.CSV); - break; - case FO: - type = "fo"; - is = (InputStream) reportTemplateManagerService.getFormat(name, ReportTemplateFormat.FO); - break; - default: - break; - } - String content = IOUtils.toString(is, encodingPattern); + if (StringUtils.isNotBlank(formatStr)) { + ReportTemplateFormat format = ReportTemplateFormat.valueOf(formatStr); + + InputStream is = null; + try { + switch (format) { + case HTML: + is = (InputStream) reportTemplateManagerService.getFormat(name, ReportTemplateFormat.HTML); + break; + case CSV: + is = (InputStream) reportTemplateManagerService.getFormat(name, ReportTemplateFormat.CSV); + break; + case FO: + is = (InputStream) reportTemplateManagerService.getFormat(name, ReportTemplateFormat.FO); + break; + default: + LOG.log(Level.SEVERE, String.format("Format [%s] not supported", format)); + break; + } + } catch (SyncopeClientException e) { + LOG.log(Level.SEVERE, String.format("Unable to get [%s] report template in [%s] format", name, format), + e); + if (ClientExceptionType.NotFound.equals(e.getType())) { + LOG.log(Level.SEVERE, String.format( + "Report template [%s] not found, create an empty one", name)); + } else { + JOptionPane.showMessageDialog( + null, String.format("Unable to get [%s] report template in [%s] format", name, format), + "Connection Error", JOptionPane.ERROR_MESSAGE); + } + } catch (Exception e) { + LOG.log(Level.SEVERE, String.format("Unable to get [%s] report template in [%s] format", name, format), + e); + JOptionPane.showMessageDialog( + null, String.format("Unable to get [%s] report template in [%s] format", name, format), + "Generic Error", JOptionPane.ERROR_MESSAGE); + } + String content = is == null ? StringUtils.EMPTY : IOUtils.toString(is, encodingPattern); - File directory = new File("Template/Report"); - if (!directory.exists()) { - directory.mkdirs(); + File directory = new File("Template/Report"); + if (!directory.exists()) { + directory.mkdirs(); + } + File file = new File("Template/Report/" + name + "." + format.name().toLowerCase()); + FileWriter fw = new FileWriter(file); + fw.write(content); + fw.flush(); + FileObject fob = FileUtil.toFileObject(file.getAbsoluteFile()); + DataObject data = DataObject.find(fob); + data.getLookup().lookup(OpenCookie.class).open(); } - File file = new File("Template/Report/" + name + "." + type); - FileWriter fw = new FileWriter(file); - fw.write(content); - fw.flush(); - FileObject fob = FileUtil.toFileObject(file.getAbsoluteFile()); - DataObject data = DataObject.find(fob); - data.getLookup().lookup(OpenCookie.class).open(); } private void saveContent() { http://git-wip-us.apache.org/repos/asf/syncope/blob/b03947a3/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ServerDetailsView.form ---------------------------------------------------------------------- diff --git a/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ServerDetailsView.form b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ServerDetailsView.form index d6ba1d7..7cb27e1 100644 --- a/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ServerDetailsView.form +++ b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ServerDetailsView.form @@ -17,6 +17,7 @@ KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> + <Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JDialogFormInfo"> <Properties> <Property name="defaultCloseOperation" type="int" value="2"/> @@ -26,11 +27,11 @@ under the License. <SyntheticProperty name="generateCenter" type="boolean" value="false"/> </SyntheticProperties> <AuxValues> - <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="1"/> + <AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_autoSetComponentName" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_generateFQN" type="java.lang.Boolean" value="true"/> <AuxValue name="FormSettings_generateMnemonicsCode" type="java.lang.Boolean" value="true"/> - <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="true"/> + <AuxValue name="FormSettings_i18nAutoMode" type="java.lang.Boolean" value="false"/> <AuxValue name="FormSettings_layoutCodeTarget" type="java.lang.Integer" value="1"/> <AuxValue name="FormSettings_listenerGenerationStyle" type="java.lang.Integer" value="0"/> <AuxValue name="FormSettings_variablesLocal" type="java.lang.Boolean" value="false"/> @@ -41,51 +42,60 @@ under the License. <DimensionLayout dim="0"> <Group type="103" groupAlignment="0" attributes="0"> <Group type="102" attributes="0"> + <EmptySpace min="-2" pref="41" max="-2" attributes="0"/> <Group type="103" groupAlignment="0" attributes="0"> - <Group type="102" attributes="0"> - <EmptySpace min="-2" pref="41" max="-2" attributes="0"/> - <Group type="103" groupAlignment="1" attributes="0"> - <Component id="okButton" min="-2" pref="74" max="-2" attributes="0"/> - <Group type="102" attributes="0"> - <Group type="103" groupAlignment="0" attributes="0"> - <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/> - <Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/> - <Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/> - </Group> - <EmptySpace min="-2" pref="39" max="-2" attributes="0"/> - <Group type="103" groupAlignment="0" max="-2" attributes="0"> - <Component id="userNameTxt" max="32767" attributes="0"/> - <Component id="urlTxt" max="32767" attributes="0"/> - <Component id="passwordTxt" alignment="0" min="-2" pref="155" max="-2" attributes="0"/> - </Group> + <Component id="jLabel4" alignment="0" min="-2" pref="256" max="-2" attributes="0"/> + <Group type="103" groupAlignment="1" attributes="0"> + <Component id="okButton" min="-2" pref="74" max="-2" attributes="0"/> + <Group type="102" alignment="1" attributes="0"> + <Group type="103" groupAlignment="0" attributes="0"> + <Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/> + <Component id="jLabel2" alignment="0" min="-2" max="-2" attributes="0"/> + <Component id="jLabel3" alignment="0" min="-2" max="-2" attributes="0"/> + <Component id="jLabel5" min="-2" max="-2" attributes="0"/> + <Component id="jLabel6" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace min="-2" pref="39" max="-2" attributes="0"/> + <Group type="103" groupAlignment="0" max="-2" attributes="0"> + <Component id="portTxt" max="32767" attributes="0"/> + <Component id="hostTxt" max="32767" attributes="0"/> + <Component id="userNameTxt" max="32767" attributes="0"/> + <Component id="schemeTxt" max="32767" attributes="0"/> + <Component id="passwordTxt" alignment="0" pref="155" max="32767" attributes="0"/> </Group> </Group> </Group> - <Group type="102" alignment="0" attributes="0"> - <EmptySpace min="-2" pref="101" max="-2" attributes="0"/> - <Component id="jLabel4" min="-2" max="-2" attributes="0"/> - </Group> </Group> - <EmptySpace pref="41" max="32767" attributes="0"/> + <EmptySpace pref="40" max="32767" attributes="0"/> </Group> </Group> </DimensionLayout> <DimensionLayout dim="1"> <Group type="103" groupAlignment="0" attributes="0"> <Group type="102" alignment="1" attributes="0"> - <EmptySpace max="-2" attributes="0"/> - <Component id="jLabel4" pref="32" max="32767" attributes="0"/> + <EmptySpace max="32767" attributes="0"/> + <Component id="jLabel4" min="-2" pref="65" max="-2" attributes="0"/> <EmptySpace type="separate" max="-2" attributes="0"/> <Group type="103" groupAlignment="3" attributes="0"> <Component id="jLabel1" alignment="3" min="-2" max="-2" attributes="0"/> - <Component id="urlTxt" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="schemeTxt" alignment="3" min="-2" max="-2" attributes="0"/> </Group> - <EmptySpace type="separate" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="hostTxt" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel6" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> + <Group type="103" groupAlignment="3" attributes="0"> + <Component id="portTxt" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel5" alignment="3" min="-2" max="-2" attributes="0"/> + </Group> + <EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="3" attributes="0"> - <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="userNameTxt" alignment="3" min="-2" max="-2" attributes="0"/> + <Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/> </Group> - <EmptySpace type="separate" max="-2" attributes="0"/> + <EmptySpace max="-2" attributes="0"/> <Group type="103" groupAlignment="3" attributes="0"> <Component id="jLabel3" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="passwordTxt" alignment="3" min="-2" max="-2" attributes="0"/> @@ -100,51 +110,36 @@ under the License. <SubComponents> <Component class="javax.swing.JLabel" name="jLabel1"> <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="org/apache/syncope/ide/netbeans/view/Bundle.properties" key="ServerDetailsView.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor"> + <ComponentRef name="schemeTxt"/> </Property> + <Property name="text" type="java.lang.String" value="Scheme"/> + <Property name="toolTipText" type="java.lang.String" value=""/> </Properties> </Component> <Component class="javax.swing.JLabel" name="jLabel2"> <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="org/apache/syncope/ide/netbeans/view/Bundle.properties" key="ServerDetailsView.jLabel2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> - </Property> + <Property name="text" type="java.lang.String" value="Username"/> </Properties> </Component> <Component class="javax.swing.JLabel" name="jLabel3"> <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="org/apache/syncope/ide/netbeans/view/Bundle.properties" key="ServerDetailsView.jLabel3.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> - </Property> + <Property name="text" type="java.lang.String" value="Password"/> + <Property name="toolTipText" type="java.lang.String" value=""/> </Properties> </Component> - <Component class="javax.swing.JTextField" name="urlTxt"> + <Component class="javax.swing.JTextField" name="schemeTxt"> <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="org/apache/syncope/ide/netbeans/view/Bundle.properties" key="ServerDetailsView.urlTxt.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> - </Property> + <Property name="toolTipText" type="java.lang.String" value=""/> </Properties> </Component> <Component class="javax.swing.JTextField" name="userNameTxt"> - <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="org/apache/syncope/ide/netbeans/view/Bundle.properties" key="ServerDetailsView.userNameTxt.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> - </Property> - </Properties> </Component> <Component class="javax.swing.JPasswordField" name="passwordTxt"> - <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="org/apache/syncope/ide/netbeans/view/Bundle.properties" key="ServerDetailsView.passwordTxt.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> - </Property> - </Properties> </Component> <Component class="javax.swing.JButton" name="okButton"> <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="org/apache/syncope/ide/netbeans/view/Bundle.properties" key="ServerDetailsView.okButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> - </Property> + <Property name="text" type="java.lang.String" value="submit"/> </Properties> <Events> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="okButtonActionPerformed"/> @@ -152,9 +147,34 @@ under the License. </Component> <Component class="javax.swing.JLabel" name="jLabel4"> <Properties> - <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor"> - <ResourceString bundle="org/apache/syncope/ide/netbeans/view/Bundle.properties" key="ServerDetailsView.jLabel4.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/> + <Property name="horizontalAlignment" type="int" value="0"/> + <Property name="text" type="java.lang.String" value="Apache Syncope connection"/> + <Property name="toolTipText" type="java.lang.String" value=""/> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="hostTxt"> + <Properties> + <Property name="toolTipText" type="java.lang.String" value=""/> + </Properties> + </Component> + <Component class="javax.swing.JLabel" name="jLabel5"> + <Properties> + <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor"> + <ComponentRef name="portTxt"/> + </Property> + <Property name="text" type="java.lang.String" value="Port"/> + <Property name="toolTipText" type="java.lang.String" value=""/> + </Properties> + </Component> + <Component class="javax.swing.JTextField" name="portTxt"> + </Component> + <Component class="javax.swing.JLabel" name="jLabel6"> + <Properties> + <Property name="labelFor" type="java.awt.Component" editor="org.netbeans.modules.form.ComponentChooserEditor"> + <ComponentRef name="hostTxt"/> </Property> + <Property name="text" type="java.lang.String" value="Host"/> + <Property name="toolTipText" type="java.lang.String" value=""/> </Properties> </Component> </SubComponents> http://git-wip-us.apache.org/repos/asf/syncope/blob/b03947a3/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ServerDetailsView.java ---------------------------------------------------------------------- diff --git a/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ServerDetailsView.java b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ServerDetailsView.java index 07aedf9..f4177ac 100644 --- a/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ServerDetailsView.java +++ b/ide/netbeans/src/main/java/org/apache/syncope/ide/netbeans/view/ServerDetailsView.java @@ -18,16 +18,22 @@ */ package org.apache.syncope.ide.netbeans.view; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Logger; +import java.util.prefs.Preferences; import javax.swing.JDialog; import javax.swing.JOptionPane; +import javax.swing.JTextField; +import org.apache.commons.lang3.StringUtils; +import org.openide.util.NbPreferences; public class ServerDetailsView extends JDialog { private static final long serialVersionUID = -8693554903195406915L; + public static final Logger LOG = Logger.getLogger("ServerDetailsView"); + /** * Creates new form LoginView */ @@ -50,74 +56,98 @@ public class ServerDetailsView extends JDialog { jLabel1 = new javax.swing.JLabel(); jLabel2 = new javax.swing.JLabel(); jLabel3 = new javax.swing.JLabel(); - urlTxt = new javax.swing.JTextField(); + schemeTxt = new javax.swing.JTextField(); userNameTxt = new javax.swing.JTextField(); passwordTxt = new javax.swing.JPasswordField(); okButton = new javax.swing.JButton(); jLabel4 = new javax.swing.JLabel(); + hostTxt = new javax.swing.JTextField(); + jLabel5 = new javax.swing.JLabel(); + portTxt = new javax.swing.JTextField(); + jLabel6 = new javax.swing.JLabel(); setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(ServerDetailsView.class, "ServerDetailsView.jLabel1.text")); // NOI18N - - org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(ServerDetailsView.class, "ServerDetailsView.jLabel2.text")); // NOI18N - - org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(ServerDetailsView.class, "ServerDetailsView.jLabel3.text")); // NOI18N + jLabel1.setLabelFor(schemeTxt); + org.openide.awt.Mnemonics.setLocalizedText(jLabel1, "Scheme"); + jLabel1.setToolTipText(""); - urlTxt.setText(org.openide.util.NbBundle.getMessage(ServerDetailsView.class, "ServerDetailsView.urlTxt.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jLabel2, "Username"); - userNameTxt.setText(org.openide.util.NbBundle.getMessage(ServerDetailsView.class, "ServerDetailsView.userNameTxt.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jLabel3, "Password"); + jLabel3.setToolTipText(""); - passwordTxt.setText(org.openide.util.NbBundle.getMessage(ServerDetailsView.class, "ServerDetailsView.passwordTxt.text")); // NOI18N + schemeTxt.setToolTipText(""); - org.openide.awt.Mnemonics.setLocalizedText(okButton, org.openide.util.NbBundle.getMessage(ServerDetailsView.class, "ServerDetailsView.okButton.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(okButton, "submit"); okButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { okButtonActionPerformed(evt); } }); - org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(ServerDetailsView.class, "ServerDetailsView.jLabel4.text")); // NOI18N + jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER); + org.openide.awt.Mnemonics.setLocalizedText(jLabel4, "Apache Syncope connection"); + jLabel4.setToolTipText(""); + + hostTxt.setToolTipText(""); + + jLabel5.setLabelFor(portTxt); + org.openide.awt.Mnemonics.setLocalizedText(jLabel5, "Port"); + jLabel5.setToolTipText(""); + + jLabel6.setLabelFor(hostTxt); + org.openide.awt.Mnemonics.setLocalizedText(jLabel6, "Host"); + jLabel6.setToolTipText(""); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); getContentPane().setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() + .addGap(41, 41, 41) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGap(41, 41, 41) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(okButton, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel1) - .addComponent(jLabel2) - .addComponent(jLabel3)) - .addGap(39, 39, 39) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(userNameTxt) - .addComponent(urlTxt) - .addComponent(passwordTxt, javax.swing.GroupLayout.PREFERRED_SIZE, 155, javax.swing.GroupLayout.PREFERRED_SIZE))))) - .addGroup(layout.createSequentialGroup() - .addGap(101, 101, 101) - .addComponent(jLabel4))) - .addContainerGap(41, Short.MAX_VALUE)) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 256, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(okButton, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createSequentialGroup() + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1) + .addComponent(jLabel2) + .addComponent(jLabel3) + .addComponent(jLabel5) + .addComponent(jLabel6)) + .addGap(39, 39, 39) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(portTxt) + .addComponent(hostTxt) + .addComponent(userNameTxt) + .addComponent(schemeTxt) + .addComponent(passwordTxt, javax.swing.GroupLayout.DEFAULT_SIZE, 155, Short.MAX_VALUE))))) + .addContainerGap(40, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addContainerGap() - .addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE, 32, Short.MAX_VALUE) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 65, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel1) - .addComponent(urlTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(18, 18, 18) + .addComponent(schemeTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jLabel2) - .addComponent(userNameTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(18, 18, 18) + .addComponent(hostTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel6)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(portTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel5)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(userNameTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel2)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel3) .addComponent(passwordTxt, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) @@ -131,23 +161,33 @@ public class ServerDetailsView extends JDialog { //CHECKSTYLE:ON private void okButtonActionPerformed(final java.awt.event.ActionEvent evt) { - String url = urlTxt.getText(); - String userName = userNameTxt.getText(); - String password = new String(passwordTxt.getPassword()); - File file = new File("UserData.txt"); - try { - FileWriter fileWriter = new FileWriter(file); - fileWriter.write(url + "\n" + userName + "\n" + password); - fileWriter.flush(); + // validation + List<String> validation = validate(schemeTxt, hostTxt, portTxt, userNameTxt); + if (validation.isEmpty()) { + Preferences prefs = NbPreferences.forModule(ResourceExplorerTopComponent.class); + prefs.put("scheme", schemeTxt.getText()); + prefs.put("host", hostTxt.getText()); + prefs.put("port", portTxt.getText()); + prefs.put("username", userNameTxt.getText()); + prefs.put("password", new String(passwordTxt.getPassword())); + // dismiss panel this.dispose(); - } catch (IOException ex) { - JOptionPane.showMessageDialog(this, "Error while saving Data.", "Error", JOptionPane.ERROR_MESSAGE); + } else { + JOptionPane.showMessageDialog( + null, "Please insert valid " + validation, "Validation Error", JOptionPane.ERROR_MESSAGE); } } - public void setDetails(final String host, final String userName, final String password) { - urlTxt.setText(host); - userNameTxt.setText(userName); + public void setDetails( + final String scheme, + final String host, + final String port, + final String username, + final String password) { + schemeTxt.setText(scheme); + hostTxt.setText(host); + portTxt.setText(port); + userNameTxt.setText(username); passwordTxt.setText(password); } @@ -171,13 +211,42 @@ public class ServerDetailsView extends JDialog { } // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JTextField hostTxt; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; private javax.swing.JLabel jLabel4; + private javax.swing.JLabel jLabel5; + private javax.swing.JLabel jLabel6; private javax.swing.JButton okButton; private javax.swing.JPasswordField passwordTxt; - private javax.swing.JTextField urlTxt; + private javax.swing.JTextField portTxt; + private javax.swing.JTextField schemeTxt; private javax.swing.JTextField userNameTxt; // End of variables declaration//GEN-END:variables + + private List<String> validate( + final JTextField schemeTxt, + final JTextField hostTxt, + final JTextField portTxt, + final JTextField userNameTxt) { + + List<String> res = new ArrayList<>(); + + if (StringUtils.isBlank(schemeTxt.getText()) + || (!StringUtils.equals(schemeTxt.getText(), "http") + && !StringUtils.equals(schemeTxt.getText(), "https"))) { + res.add("scheme"); + } + if (StringUtils.isBlank(hostTxt.getText())) { + res.add("host"); + } + if (StringUtils.isBlank(portTxt.getText()) || !StringUtils.isNumeric(portTxt.getText())) { + res.add("port"); + } + if (StringUtils.isBlank(userNameTxt.getText())) { + res.add("username"); + } + return res; + } } http://git-wip-us.apache.org/repos/asf/syncope/blob/b03947a3/pom.xml ---------------------------------------------------------------------- diff --git a/pom.xml b/pom.xml index ab42f6e..794144e 100644 --- a/pom.xml +++ b/pom.xml @@ -1834,17 +1834,6 @@ under the License. <version>4.1</version> </plugin> - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>nbm-maven-plugin</artifactId> - <version>4.1</version> - </plugin> - - <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>nbm-maven-plugin</artifactId> - <version>4.1</version> - </plugin> </plugins> </pluginManagement>