summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMike Conway <mikeconway@Mike-Conways-MacBook-Pro.local>2011-07-18 13:16:14 (GMT)
committer Mike Conway <mikeconway@Mike-Conways-MacBook-Pro.local>2011-07-18 13:16:14 (GMT)
commitaafc22813bc2dd8f93b3bdf6661074ada138eab0 (patch)
tree135949c7557fc6261a82acdb6df69436192f7ff1
parentbb23c9762a9047a61adc9d5f7832feaad07a640b (diff)
downloadQCG-Data-aafc22813bc2dd8f93b3bdf6661074ada138eab0.zip
QCG-Data-aafc22813bc2dd8f93b3bdf6661074ada138eab0.tar.gz
QCG-Data-aafc22813bc2dd8f93b3bdf6661074ada138eab0.tar.bz2
attempts to save initial synch, still lots of defaults to help in initial tests
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationService.java10
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationServiceImpl.java28
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/SetupWizard.form63
-rw-r--r--idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/SetupWizard.java68
-rw-r--r--idrop-swing/src/main/resources/org/irods/jargon/idrop/desktop/systraygui/viscomponents/Bundle.properties2
5 files changed, 141 insertions, 30 deletions
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationService.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationService.java
index 9a462d5..ad13d69 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationService.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationService.java
@@ -8,6 +8,8 @@ import java.util.Properties;
import org.irods.jargon.core.connection.IRODSAccount;
import org.irods.jargon.idrop.exceptions.IdropException;
+import org.irods.jargon.transfer.dao.domain.Synchronization;
+import org.irods.jargon.transfer.engine.synch.ConflictingSynchException;
/**
*
@@ -57,4 +59,12 @@ public interface IdropConfigurationService {
void saveLogin(final IRODSAccount irodsAccount) throws IdropException;
void removeConfigProperty(final String key) throws IdropException;
+
+ /**
+ * Create a new synchronization configuration, checking for conflicts and properly configuring both local and iRODS configuration
+ * @param synchConfiguration {@link Synchronization}
+ * @throws IdropException
+ * @throws ConflictingSynchException
+ */
+ void createNewSynchronization(final Synchronization synchConfiguration) throws IdropException, ConflictingSynchException;
}
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationServiceImpl.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationServiceImpl.java
index d29bf55..daae8df 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationServiceImpl.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/services/IdropConfigurationServiceImpl.java
@@ -16,7 +16,12 @@ import org.irods.jargon.idrop.exceptions.IdropException;
import org.irods.jargon.transfer.TransferEngineException;
import org.irods.jargon.transfer.TransferServiceFactoryImpl;
import org.irods.jargon.transfer.dao.domain.ConfigurationProperty;
+import org.irods.jargon.transfer.dao.domain.SynchConfiguration;
+import org.irods.jargon.transfer.dao.domain.Synchronization;
import org.irods.jargon.transfer.engine.ConfigurationService;
+import org.irods.jargon.transfer.engine.synch.ConflictingSynchException;
+import org.irods.jargon.transfer.engine.synch.SynchException;
+import org.irods.jargon.transfer.engine.synch.SynchManagerService;
import org.openide.util.Exceptions;
import org.slf4j.LoggerFactory;
@@ -277,5 +282,26 @@ public class IdropConfigurationServiceImpl implements IdropConfigurationService
log.error("exception removing config property");
}
}
-
+
+ @Override
+ public void createNewSynchronization(final Synchronization synchConfiguration) throws IdropException, ConflictingSynchException {
+ log.info("saveSynchronization()");
+ if (synchConfiguration == null) {
+ throw new IllegalArgumentException("null synchConfiguration");
+ }
+ log.info("synchConfiguration:{}", synchConfiguration);
+ SynchManagerService synchManagerService = idropCore.getTransferManager().getTransferServiceFactory().instanceSynchManagerService();
+ try {
+ synchManagerService.createNewSynchConfiguration(synchConfiguration);
+ } catch (ConflictingSynchException cse) {
+ log.error("synch configuration is conflicting:{}", synchConfiguration, cse);
+ throw cse;
+ } catch (SynchException ex) {
+ log.error("error creating synch", ex);
+ throw new IdropException("error creating synch", ex);
+ }
+
+ log.info("synch saved");
+
+ }
}
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/SetupWizard.form b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/SetupWizard.form
index 44696ad..fe61f4c 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/SetupWizard.form
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/SetupWizard.form
@@ -116,14 +116,6 @@
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="panelTabSeeSysTrayAnswer">
- <Properties>
- <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
- <Dimension value="null"/>
- </Property>
- <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
- <Dimension value="null"/>
- </Property>
- </Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="South"/>
@@ -273,14 +265,6 @@
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="pnlLocalSynch">
- <Properties>
- <Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
- <Dimension value="null"/>
- </Property>
- <Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
- <Dimension value="null"/>
- </Property>
- </Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="0" gridWidth="9" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="10" insetsBottom="0" insetsRight="10" anchor="17" weightX="0.0" weightY="0.0"/>
@@ -350,7 +334,6 @@
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="bnGroupSynchType"/>
</Property>
- <Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/irods/jargon/idrop/desktop/systraygui/viscomponents/Bundle.properties" key="SetupWizard.radioBackup.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
@@ -380,10 +363,54 @@
</Component>
</SubComponents>
</Container>
+ <Container class="javax.swing.JPanel" name="pnlSynchFrequency">
+ <Properties>
+ <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
+ <Border info="org.netbeans.modules.form.compat2.border.LineBorderInfo">
+ <LineBorder/>
+ </Border>
+ </Property>
+ </Properties>
+ <Constraints>
+ <Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
+ <GridBagConstraints gridX="0" gridY="3" gridWidth="9" gridHeight="2" fill="1" ipadX="0" ipadY="0" insetsTop="20" insetsLeft="20" insetsBottom="20" insetsRight="20" anchor="10" weightX="0.0" weightY="0.0"/>
+ </Constraint>
+ </Constraints>
+
+ <Layout class="org.netbeans.modules.form.compat2.layouts.DesignGridLayout">
+ <Property name="columns" type="int" value="1"/>
+ <Property name="rows" type="int" value="0"/>
+ </Layout>
+ <SubComponents>
+ <Component class="javax.swing.JLabel" name="jLabel5">
+ <Properties>
+ <Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/irods/jargon/idrop/desktop/systraygui/viscomponents/Bundle.properties" key="SetupWizard.jLabel5.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ </Component>
+ <Component class="javax.swing.JComboBox" name="jcomboSynchFrequency">
+ <Properties>
+ <Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.editors2.ComboBoxModelEditor">
+ <StringArray count="5">
+ <StringItem index="0" value="Hourly"/>
+ <StringItem index="1" value="Weekly"/>
+ <StringItem index="2" value="Daily"/>
+ <StringItem index="3" value="Every 15 Minutes"/>
+ <StringItem index="4" value=" "/>
+ </StringArray>
+ </Property>
+ <Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
+ <ResourceString bundle="org/irods/jargon/idrop/desktop/systraygui/viscomponents/Bundle.properties" key="SetupWizard.jcomboSynchFrequency.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
+ </Property>
+ </Properties>
+ </Component>
+ </SubComponents>
+ </Container>
<Container class="javax.swing.JPanel" name="pnlIrodsSynch">
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
- <GridBagConstraints gridX="0" gridY="3" gridWidth="9" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="10" insetsBottom="0" insetsRight="10" anchor="17" weightX="0.0" weightY="0.0"/>
+ <GridBagConstraints gridX="0" gridY="5" gridWidth="9" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="10" insetsBottom="0" insetsRight="10" anchor="17" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
diff --git a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/SetupWizard.java b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/SetupWizard.java
index 9a79c68..847e217 100644
--- a/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/SetupWizard.java
+++ b/idrop-swing/src/main/java/org/irods/jargon/idrop/desktop/systraygui/viscomponents/SetupWizard.java
@@ -8,6 +8,7 @@ package org.irods.jargon.idrop.desktop.systraygui.viscomponents;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Toolkit;
+import java.util.Date;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.event.ChangeEvent;
@@ -19,12 +20,18 @@ import org.irods.jargon.idrop.desktop.systraygui.services.IdropConfigurationServ
import org.irods.jargon.idrop.exceptions.IdropException;
import org.irods.jargon.idrop.exceptions.IdropRuntimeException;
import org.irods.jargon.idrop.finder.IRODSFinderDialog;
+import org.irods.jargon.transfer.dao.domain.FrequencyType;
+import org.irods.jargon.transfer.dao.domain.Synchronization;
+import org.irods.jargon.transfer.dao.domain.SynchronizationType;
+import org.irods.jargon.transfer.engine.synch.ConflictingSynchException;
import org.openide.util.Exceptions;
import org.slf4j.LoggerFactory;
/**
- *
+ * Initial setup of iDrop and synchronization as part of first load
* @author mikeconway
+ * d.setLocationRelativeTo(null);
+
*/
public class SetupWizard extends javax.swing.JDialog {
@@ -98,6 +105,9 @@ public class SetupWizard extends javax.swing.JDialog {
radioBackup = new javax.swing.JRadioButton();
radioFeed = new javax.swing.JRadioButton();
radioSynch = new javax.swing.JRadioButton();
+ pnlSynchFrequency = new javax.swing.JPanel();
+ jLabel5 = new javax.swing.JLabel();
+ jcomboSynchFrequency = new javax.swing.JComboBox();
pnlIrodsSynch = new javax.swing.JPanel();
txtIrodsPath = new javax.swing.JTextField();
btnChooseIrodsSynch = new javax.swing.JButton();
@@ -110,7 +120,7 @@ public class SetupWizard extends javax.swing.JDialog {
setTitle(org.openide.util.NbBundle.getMessage(SetupWizard.class, "SetupWizard.title")); // NOI18N
panelTop.setBackground(new java.awt.Color(102, 102, 102));
- panelTop.setFont(new java.awt.Font("Lucida Grande", 0, 12)); // NOI18N
+ panelTop.setFont(new java.awt.Font("Lucida Grande", 0, 12));
lblWelcome.setFont(new java.awt.Font("Lucida Grande", 0, 18));
lblWelcome.setText(org.openide.util.NbBundle.getMessage(SetupWizard.class, "SetupWizard.lblWelcome.text")); // NOI18N
@@ -135,9 +145,6 @@ public class SetupWizard extends javax.swing.JDialog {
panelTabSeeSysTray.add(panelTabSeeSysTrayQuestion, java.awt.BorderLayout.NORTH);
- panelTabSeeSysTrayAnswer.setMinimumSize(null);
- panelTabSeeSysTrayAnswer.setPreferredSize(null);
-
btnSeeSystemTrayYes.setMnemonic('y');
btnSeeSystemTrayYes.setToolTipText(org.openide.util.NbBundle.getMessage(SetupWizard.class, "SetupWizard.btnSeeSystemTrayYes.toolTipText")); // NOI18N
btnSeeSystemTrayYes.setLabel(org.openide.util.NbBundle.getMessage(SetupWizard.class, "SetupWizard.btnSeeSystemTrayYes.label")); // NOI18N
@@ -191,9 +198,6 @@ public class SetupWizard extends javax.swing.JDialog {
pnlSynchData.setLayout(new java.awt.GridBagLayout());
- pnlLocalSynch.setMinimumSize(null);
- pnlLocalSynch.setPreferredSize(null);
-
txtLocalPath.setColumns(80);
txtLocalPath.setText(org.openide.util.NbBundle.getMessage(SetupWizard.class, "SetupWizard.txtLocalPath.text")); // NOI18N
txtLocalPath.setToolTipText(org.openide.util.NbBundle.getMessage(SetupWizard.class, "SetupWizard.txtLocalPath.toolTipText")); // NOI18N
@@ -230,7 +234,6 @@ public class SetupWizard extends javax.swing.JDialog {
pnlSynchMode.add(jLabel1);
bnGroupSynchType.add(radioBackup);
- radioBackup.setSelected(true);
radioBackup.setText(org.openide.util.NbBundle.getMessage(SetupWizard.class, "SetupWizard.radioBackup.text")); // NOI18N
pnlSynchMode.add(radioBackup);
@@ -253,6 +256,25 @@ public class SetupWizard extends javax.swing.JDialog {
gridBagConstraints.insets = new java.awt.Insets(20, 20, 20, 20);
pnlSynchData.add(pnlSynchMode, gridBagConstraints);
+ pnlSynchFrequency.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(0, 0, 0)));
+ pnlSynchFrequency.setLayout(new java.awt.GridLayout(0, 1));
+
+ jLabel5.setText(org.openide.util.NbBundle.getMessage(SetupWizard.class, "SetupWizard.jLabel5.text")); // NOI18N
+ pnlSynchFrequency.add(jLabel5);
+
+ jcomboSynchFrequency.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Hourly", "Weekly", "Daily", "Every 15 Minutes", " " }));
+ jcomboSynchFrequency.setToolTipText(org.openide.util.NbBundle.getMessage(SetupWizard.class, "SetupWizard.jcomboSynchFrequency.toolTipText")); // NOI18N
+ pnlSynchFrequency.add(jcomboSynchFrequency);
+
+ gridBagConstraints = new java.awt.GridBagConstraints();
+ gridBagConstraints.gridx = 0;
+ gridBagConstraints.gridy = 3;
+ gridBagConstraints.gridwidth = 9;
+ gridBagConstraints.gridheight = 2;
+ gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
+ gridBagConstraints.insets = new java.awt.Insets(20, 20, 20, 20);
+ pnlSynchData.add(pnlSynchFrequency, gridBagConstraints);
+
txtIrodsPath.setColumns(80);
txtIrodsPath.setText(org.openide.util.NbBundle.getMessage(SetupWizard.class, "SetupWizard.txtIrodsPath.text")); // NOI18N
txtIrodsPath.setToolTipText(org.openide.util.NbBundle.getMessage(SetupWizard.class, "SetupWizard.txtIrodsPath.toolTipText")); // NOI18N
@@ -275,7 +297,7 @@ public class SetupWizard extends javax.swing.JDialog {
gridBagConstraints = new java.awt.GridBagConstraints();
gridBagConstraints.gridx = 0;
- gridBagConstraints.gridy = 3;
+ gridBagConstraints.gridy = 5;
gridBagConstraints.gridwidth = 9;
gridBagConstraints.fill = java.awt.GridBagConstraints.BOTH;
gridBagConstraints.anchor = java.awt.GridBagConstraints.WEST;
@@ -494,6 +516,8 @@ public class SetupWizard extends javax.swing.JDialog {
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
+ private javax.swing.JLabel jLabel5;
+ private javax.swing.JComboBox jcomboSynchFrequency;
private javax.swing.JLabel lblDeviceName;
private javax.swing.JLabel lblWelcome;
private javax.swing.JPanel panelTabNameDevice;
@@ -509,6 +533,7 @@ public class SetupWizard extends javax.swing.JDialog {
private javax.swing.JPanel pnlIrodsSynch;
private javax.swing.JPanel pnlLocalSynch;
private javax.swing.JPanel pnlSynchData;
+ private javax.swing.JPanel pnlSynchFrequency;
private javax.swing.JPanel pnlSynchMode;
private javax.swing.JPanel pnlWizardToolbar;
private javax.swing.JRadioButton radioBackup;
@@ -540,7 +565,28 @@ public class SetupWizard extends javax.swing.JDialog {
}
} else {
log.info("saving synch data");
- advanceTab();
+ Synchronization synchronization = new Synchronization();
+ synchronization.setCreatedAt(new Date());
+ synchronization.setDefaultResourceName(idropCore.getIrodsAccount().getDefaultStorageResource());
+ synchronization.setFrequencyType(FrequencyType.EVERY_HOUR); // FIXME: create code to set this viz the combo
+ synchronization.setIrodsHostName(idropCore.getIrodsAccount().getHost());
+ synchronization.setIrodsPassword(idropCore.getIrodsAccount().getPassword()); // FIXME: obfuscate
+ synchronization.setIrodsPort(idropCore.getIrodsAccount().getPort());
+ synchronization.setIrodsSynchDirectory(txtIrodsPath.getText());
+ synchronization.setLocalSynchDirectory(txtLocalPath.getText());
+ synchronization.setIrodsUserName(idropCore.getIrodsAccount().getUserName());
+ synchronization.setIrodsZone(idropCore.getIrodsAccount().getZone());
+ synchronization.setName("Default");
+ synchronization.setSynchronizationMode(SynchronizationType.ONE_WAY_LOCAL_TO_IRODS); // FIXME: set properly from radio
+ try {
+ this.idropConfigurationService.createNewSynchronization(synchronization);
+ advanceTab();
+ } catch (IdropException ex) {
+ MessageManager.showError(this, ex.getMessage(), SETUP_ERROR_TITLE);
+ } catch (ConflictingSynchException ex) {
+ MessageManager.showError(this, ex.getMessage(), SETUP_ERROR_TITLE);
+ }
+
}
}
}
diff --git a/idrop-swing/src/main/resources/org/irods/jargon/idrop/desktop/systraygui/viscomponents/Bundle.properties b/idrop-swing/src/main/resources/org/irods/jargon/idrop/desktop/systraygui/viscomponents/Bundle.properties
index c9aea0f..336e8cb 100644
--- a/idrop-swing/src/main/resources/org/irods/jargon/idrop/desktop/systraygui/viscomponents/Bundle.properties
+++ b/idrop-swing/src/main/resources/org/irods/jargon/idrop/desktop/systraygui/viscomponents/Bundle.properties
@@ -31,3 +31,5 @@ SetupWizard.btnForward.toolTipText=Go to previous screen
SetupWizard.jLabel2.text=<html><h2>Welcome to iDrop. <p/>This setup wizard will help configure iDrop for your use, </h2><p/>\n<h3>iDrop should be represented by a check mark item in your system tray<p/>If you cannot see the check box, hit 'No', <p/>Otherwise, hit 'Yes', or 'Forward'</h3></html>
SetupWizard.jLabel3.text=<html><h2>You need to name this device, please enter a device name and hit 'Forward'</h2></html>
SetupWizard.jLabel4.text=<html><h2>Synch Setup</h2><p/><h3>iDrop can link local folders to folders on iRODS and do synchronization<p/>You may\nset up a synch now, or do this later in the preferences panels. <p/>Hit 'Forward' to skip or save.</h3></html>
+SetupWizard.jLabel5.text=Select a synchronization frequency
+SetupWizard.jcomboSynchFrequency.toolTipText=Determine how often the synch process runs