summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgosiaw <magnolia1973@gazeta.pl>2013-11-13 09:45:47 (GMT)
committer gosiaw <magnolia1973@gazeta.pl>2013-11-13 09:45:47 (GMT)
commit94685e444301e7e64d8989438a0e2631779e34e6 (patch)
tree0581e3943f9ffe89d7964a558e33e1f722971772
parentfcabde3691ce42e6eb8ad58873dc79a979c3ab8e (diff)
downloadQCG-Data-94685e444301e7e64d8989438a0e2631779e34e6.zip
QCG-Data-94685e444301e7e64d8989438a0e2631779e34e6.tar.gz
QCG-Data-94685e444301e7e64d8989438a0e2631779e34e6.tar.bz2
Handling KeyFS panel added
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/gdrop/GDropGridAccount.java4
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/gdrop/GDropIRODSAccount.java21
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/gdrop/GDropLoginDialog.java269
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/Version.java2
4 files changed, 214 insertions, 82 deletions
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/gdrop/GDropGridAccount.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/gdrop/GDropGridAccount.java
index a2c7e50..0572312 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/gdrop/GDropGridAccount.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/gdrop/GDropGridAccount.java
@@ -44,6 +44,10 @@ public class GDropGridAccount extends GridAccount {
// Set standard auth scheme by default
this.gDropAuthScheme = gDropAuthScheme.STANDARD;
this.setAuthScheme(AuthScheme.STANDARD);
+
+ this.plgridUserName = null;
+ this.plgridPassword = null;
+ this.keyPassword = null;
}
public GDropAuthScheme getGDropAuthScheme() {
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/gdrop/GDropIRODSAccount.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/gdrop/GDropIRODSAccount.java
index c19ec1e..22088aa 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/gdrop/GDropIRODSAccount.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/gdrop/GDropIRODSAccount.java
@@ -14,9 +14,22 @@ import org.irods.jargon.core.exception.JargonException;
public class GDropIRODSAccount extends IRODSAccount {
private GDropAuthScheme authScheme;
private String comment;
+ private final String plgridUserName;
+ private final String plgridPassword;
+ private final String keyPassword;
public GDropIRODSAccount(String host, int port, String userName, String password, String homeDirectory, String zone, String defaultStorageResource) {
super(host, port, userName, password, homeDirectory, zone, defaultStorageResource);
+ this.plgridUserName = null;
+ this.plgridPassword = null;
+ this.keyPassword = null;
+ }
+
+ public GDropIRODSAccount(String host, int port, String userName, String plgridUserName, String plgridPassword, String keyPassword, String homeDirectory, String zone, String defaultStorageResource) {
+ super(host, port, userName, null, homeDirectory, zone, defaultStorageResource);
+ this.plgridUserName = plgridUserName;
+ this.plgridPassword = plgridPassword;
+ this.keyPassword = keyPassword;
}
public GDropAuthScheme getGDropAuthenticationScheme() {
@@ -32,12 +45,18 @@ public class GDropIRODSAccount extends IRODSAccount {
instance.setGDropAuthenticationScheme(GDropAuthScheme.STANDARD);
return instance;
}
-
+
public static GDropIRODSAccount instance(String host, int port, String userName, String password, String homeDirectory, String zone, String defaultStorageResource, GDropAuthScheme authenticationScheme) throws JargonException {
GDropIRODSAccount instance = GDropIRODSAccount.instance(host, port, userName, password, homeDirectory, zone, defaultStorageResource);
instance.setGDropAuthenticationScheme(authenticationScheme);
return instance;
}
+
+ public static GDropIRODSAccount instance(String host, int port, String userName, String plgridUserName, String plgridPassword, String keyPassword, String homeDirectory, String zone, String defaultStorageResource) throws JargonException {
+ GDropIRODSAccount instance = new GDropIRODSAccount(host, port, userName, plgridUserName, plgridPassword, keyPassword, homeDirectory, zone, defaultStorageResource);
+ instance.setGDropAuthenticationScheme(GDropAuthScheme.KEYFS);
+ return instance;
+ }
void setComment(String comment) {
this.comment = comment;
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/gdrop/GDropLoginDialog.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/gdrop/GDropLoginDialog.java
index 44e2911..6efb59b 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/gdrop/GDropLoginDialog.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/gdrop/GDropLoginDialog.java
@@ -668,8 +668,9 @@ public class GDropLoginDialog extends javax.swing.JDialog {
}//GEN-LAST:event_btnCancelActionPerformed
private void btnOKActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOKActionPerformed
+ GDropAuthScheme authScheme = getSelectedAuthScheme();
- GDropIRODSAccount gridInfo = createIRODSAccountFromForm();
+ GDropIRODSAccount gridInfo = createIRODSAccountFromForm(authScheme);
if (gridInfo != null) {
GridAccountService gridAccountService = idropCore.getConveyorService().getGridAccountService();
@@ -810,12 +811,12 @@ public class GDropLoginDialog extends javax.swing.JDialog {
private javax.swing.JTextField txtplgridUsername;
// End of variables declaration//GEN-END:variables
- private void populateGridAccountInfo(GDropAuthScheme gdropAuthScheme) {
- if (gdropAuthScheme == GDropAuthScheme.STANDARD) {
+ private void populateGridAccountInfo(int index) {
+ if (index == STANDARD) {
populateStandardGridAccountInfo();
- } else if (gdropAuthScheme == GDropAuthScheme.GSI) {
+ } else if (index == GSI) {
populateGSIGridAccountInfo();
- } else if (gdropAuthScheme == GDropAuthScheme.KEYFS) {
+ } else if (index == KEYFS) {
populateKeyFSGridAccountInfo();
}
}
@@ -823,103 +824,42 @@ public class GDropLoginDialog extends javax.swing.JDialog {
private void initAuthSchemesCombo() {
cbAuthScheme.setModel(new DefaultComboBoxModel(GDropAuthScheme.values()));
// also select correct auth scheme for this grid
- cbAuthScheme.setSelectedItem(gridAccount.getGDropAuthScheme());
+ cbAuthScheme.setSelectedItem(STANDARD);
cbAuthSchemeGSI.setModel(new DefaultComboBoxModel(GDropAuthScheme.values()));
// also select correct auth scheme for this grid
- cbAuthSchemeGSI.setSelectedItem(GDropAuthScheme.GSI);
+ cbAuthSchemeGSI.setSelectedItem(GSI);
cbAuthSchemeKeyFS.setModel(new DefaultComboBoxModel(GDropAuthScheme.values()));
// also select correct auth scheme for this grid
- cbAuthSchemeKeyFS.setSelectedItem(GDropAuthScheme.KEYFS);
+ cbAuthSchemeKeyFS.setSelectedItem(KEYFS);
}
- private GDropIRODSAccount createIRODSAccountFromForm() {
- GDropIRODSAccount acct = null;
-
- String host = this.gridAccount.getHost();
- String strPort = txtPort.getText().trim();
- int port=0;
- if ((strPort != null) && (!strPort.isEmpty())) {
- port = Integer.valueOf(strPort).intValue();
- }
- String zone = this.gridAccount.getZone();
-// String user = this.gridAccount.getUserName();
- String user = txtUsername.getText().trim();
- String password = txtPassword.getText().trim();
- String verifyPassword = txtVerifyPassword.getText().trim();
- String defaultResc = txtDefaultResource.getText().trim();
- String initialPath = txtInitialPath.getText().trim();
- if ((txtInitialPath.getText() == null) || (txtInitialPath.getText().isEmpty())) {
- StringBuilder homeBuilder = new StringBuilder();
- homeBuilder.append("/");
- homeBuilder.append(zone);
- homeBuilder.append("/home/");
- homeBuilder.append(user);
- initialPath = homeBuilder.toString();
- }
-
- // check to make sure passwords match
- if (! password.equals(verifyPassword)) {
- JOptionPane.showMessageDialog(
- this,
- "Passwords do not match. Please try again.",
- "Edit Grid Account", JOptionPane.ERROR_MESSAGE);
- return acct;
- }
-
- GridAccountService gridAccountService = idropCore.getConveyorService().getGridAccountService();
-
- // need to do this to retrieve plain text password
- IRODSAccount irodAccountForPswd = null;
-
- // not needed if collecting password from form
-// try {
-// irodAccountForPswd = gridAccountService.irodsAccountForGridAccount(gridAccount);
-// } catch (ConveyorExecutionException ex) {
-// Logger.getLogger(EditGridInfoDialog.class.getName()).log(
-// Level.SEVERE, null, ex);
-// JOptionPane.showMessageDialog(
-// this,
-// "Update of grid account failed. Could not store password.",
-// "Edit Grid Account", JOptionPane.ERROR_MESSAGE);
-// }
-
- try {
- acct = GDropIRODSAccount.instance(host, port, user, password, initialPath, zone, defaultResc);
- } catch (JargonException ex) {
- JOptionPane.showMessageDialog(
- this,
- "Please enter grid account information. Host, port, zone, and user name are required.",
- "Edit Grid Account", JOptionPane.ERROR_MESSAGE);
- return acct;
- } catch (IllegalArgumentException ex) {
- JOptionPane.showMessageDialog(
- this,
- "Please enter grid account information. Host, port, zone, and user name are required.",
- "Edit Grid Account", JOptionPane.ERROR_MESSAGE);
- return acct;
- }
-
- // now add authorization scheme to gridaccount
- GDropAuthScheme scheme = (GDropAuthScheme) cbAuthScheme.getSelectedItem();
- if (scheme != null) {
- acct.setGDropAuthenticationScheme(scheme);
+ private GDropIRODSAccount createIRODSAccountFromForm(GDropAuthScheme gdropAuthScheme) {
+ if (gdropAuthScheme == GDropAuthScheme.STANDARD) {
+ return createIRODSAccountFromStandardForm();
+ } else if (gdropAuthScheme == GDropAuthScheme.GSI) {
+ return createIRODSAccountFromGSIForm();
+ } else if (gdropAuthScheme == GDropAuthScheme.KEYFS) {
+ return createIRODSAccountFromKeyFSForm();
}
- return acct;
+ return null;
}
private void applyMode(GDropAuthScheme gDropAuthScheme) {
if (gDropAuthScheme == GDropAuthScheme.STANDARD) {
+ cbAuthScheme.setSelectedIndex(STANDARD);
pnlStandardLogin.setVisible(true);
pnlGSILogin.setVisible(false);
pnlKeyFSLogin.setVisible(false);
} else if (gDropAuthScheme == GDropAuthScheme.GSI) {
+ cbAuthSchemeGSI.setSelectedIndex(GSI);
pnlStandardLogin.setVisible(false);
pnlGSILogin.setVisible(true);
pnlKeyFSLogin.setVisible(false);
} else if (gDropAuthScheme == GDropAuthScheme.KEYFS) {
+ cbAuthSchemeKeyFS.setSelectedIndex(KEYFS);
pnlStandardLogin.setVisible(false);
pnlGSILogin.setVisible(false);
pnlKeyFSLogin.setVisible(true);
@@ -1091,4 +1031,173 @@ public class GDropLoginDialog extends javax.swing.JDialog {
txtComment2.setText(comment);
}
}
+
+ private GDropIRODSAccount createIRODSAccountFromStandardForm() {
+ GDropIRODSAccount acct = null;
+
+ String host = this.gridAccount.getHost();
+ String strPort = txtPort.getText().trim();
+ int port=0;
+ if ((strPort != null) && (!strPort.isEmpty())) {
+ port = Integer.valueOf(strPort).intValue();
+ }
+ String zone = this.gridAccount.getZone();
+// String user = this.gridAccount.getUserName();
+ String user = txtUsername.getText().trim();
+ String password = txtPassword.getText().trim();
+ String verifyPassword = txtVerifyPassword.getText().trim();
+ String defaultResc = txtDefaultResource.getText().trim();
+ String initialPath = txtInitialPath.getText().trim();
+ if ((txtInitialPath.getText() == null) || (txtInitialPath.getText().isEmpty())) {
+ StringBuilder homeBuilder = new StringBuilder();
+ homeBuilder.append("/");
+ homeBuilder.append(zone);
+ homeBuilder.append("/home/");
+ homeBuilder.append(user);
+ initialPath = homeBuilder.toString();
+ }
+
+ // check to make sure passwords match
+ if (! password.equals(verifyPassword)) {
+ JOptionPane.showMessageDialog(
+ this,
+ "Passwords do not match. Please try again.",
+ "Edit Grid Account", JOptionPane.ERROR_MESSAGE);
+ return acct;
+ }
+
+ GridAccountService gridAccountService = idropCore.getConveyorService().getGridAccountService();
+
+ // need to do this to retrieve plain text password
+ IRODSAccount irodAccountForPswd = null;
+
+ // not needed if collecting password from form
+// try {
+// irodAccountForPswd = gridAccountService.irodsAccountForGridAccount(gridAccount);
+// } catch (ConveyorExecutionException ex) {
+// Logger.getLogger(EditGridInfoDialog.class.getName()).log(
+// Level.SEVERE, null, ex);
+// JOptionPane.showMessageDialog(
+// this,
+// "Update of grid account failed. Could not store password.",
+// "Edit Grid Account", JOptionPane.ERROR_MESSAGE);
+// }
+
+ try {
+ acct = GDropIRODSAccount.instance(host, port, user, password, initialPath, zone, defaultResc);
+ } catch (JargonException ex) {
+ JOptionPane.showMessageDialog(
+ this,
+ "Please enter grid account information. Host, port, zone, and user name are required.",
+ "Edit Grid Account", JOptionPane.ERROR_MESSAGE);
+ return acct;
+ } catch (IllegalArgumentException ex) {
+ JOptionPane.showMessageDialog(
+ this,
+ "Please enter grid account information. Host, port, zone, and user name are required.",
+ "Edit Grid Account", JOptionPane.ERROR_MESSAGE);
+ return acct;
+ }
+
+ // now add authorization scheme to gridaccount
+ GDropAuthScheme scheme = (GDropAuthScheme) cbAuthScheme.getSelectedItem();
+ if (scheme != null) {
+ acct.setGDropAuthenticationScheme(scheme);
+ }
+
+ return acct;
+ }
+
+ private GDropIRODSAccount createIRODSAccountFromGSIForm() {
+ return null;
+ }
+
+ private GDropIRODSAccount createIRODSAccountFromKeyFSForm() {
+ GDropIRODSAccount acct = null;
+
+ String host = this.gridAccount.getHost();
+ String strPort = txtPort.getText().trim();
+ int port=0;
+ if ((strPort != null) && (!strPort.isEmpty())) {
+ port = Integer.valueOf(strPort).intValue();
+ }
+ String zone = this.gridAccount.getZone();
+// String user = this.gridAccount.getUserName();
+ String user = txtUsername.getText().trim();
+ String plgridUser = txtplgridUsername.getText().trim();
+ String plgridPassword = txtPlgridPassword.getText().trim();
+ String keyPassword = txtKeyPassword.getText().trim();
+ String defaultResc = txtDefaultResource.getText().trim();
+ String initialPath = txtInitialPath.getText().trim();
+ if ((txtInitialPath.getText() == null) || (txtInitialPath.getText().isEmpty())) {
+ StringBuilder homeBuilder = new StringBuilder();
+ homeBuilder.append("/");
+ homeBuilder.append(zone);
+ homeBuilder.append("/home/");
+ homeBuilder.append(user);
+ initialPath = homeBuilder.toString();
+ }
+
+
+ GridAccountService gridAccountService = idropCore.getConveyorService().getGridAccountService();
+
+ // need to do this to retrieve plain text password
+ IRODSAccount irodAccountForPswd = null;
+
+ // not needed if collecting password from form
+// try {
+// irodAccountForPswd = gridAccountService.irodsAccountForGridAccount(gridAccount);
+// } catch (ConveyorExecutionException ex) {
+// Logger.getLogger(EditGridInfoDialog.class.getName()).log(
+// Level.SEVERE, null, ex);
+// JOptionPane.showMessageDialog(
+// this,
+// "Update of grid account failed. Could not store password.",
+// "Edit Grid Account", JOptionPane.ERROR_MESSAGE);
+// }
+
+ try {
+ acct = GDropIRODSAccount.instance(host, port, user, plgridUser, plgridPassword, keyPassword, initialPath, zone, defaultResc);
+ } catch (JargonException ex) {
+ JOptionPane.showMessageDialog(
+ this,
+ "Please enter grid account information. Host, port, zone, and user name are required.",
+ "Edit Grid Account", JOptionPane.ERROR_MESSAGE);
+ return acct;
+ } catch (IllegalArgumentException ex) {
+ JOptionPane.showMessageDialog(
+ this,
+ "Please enter grid account information. Host, port, zone, and user name are required.",
+ "Edit Grid Account", JOptionPane.ERROR_MESSAGE);
+ return acct;
+ }
+
+ // now add authorization scheme to gridaccount
+ GDropAuthScheme scheme = (GDropAuthScheme) cbAuthScheme.getSelectedItem();
+ if (scheme != null) {
+ acct.setGDropAuthenticationScheme(scheme);
+ }
+
+ return acct;
+ }
+
+ private void populateGridAccountInfo(GDropAuthScheme gDropAuthScheme) {
+ if (gDropAuthScheme == GDropAuthScheme.STANDARD) {
+ populateStandardGridAccountInfo();
+ } else if (gDropAuthScheme == GDropAuthScheme.GSI) {
+ populateGSIGridAccountInfo();
+ } else if (gDropAuthScheme == GDropAuthScheme.KEYFS) {
+ populateKeyFSGridAccountInfo();
+ }
+ }
+
+ private GDropAuthScheme getSelectedAuthScheme() {
+ if (pnlStandardLogin.isVisible()) {
+ return GDropAuthScheme.STANDARD;
+ } else if (pnlGSILogin.isVisible()) {
+ return GDropAuthScheme.GSI;
+ } else {
+ return GDropAuthScheme.KEYFS;
+ }
+ }
}
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/Version.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/Version.java
index d06132e..4982856 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/Version.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/utils/Version.java
@@ -1,5 +1,5 @@
package org.irods.jargon.idrop.desktop.systraygui.utils;
public final class Version {
public static String VERSION="b964-SNAPSHOT";
- public static String BUILD_TIME="20131108-1257";
+ public static String BUILD_TIME="20131113-1028";
}