[tranche] r287 committed - Added retry upload option.

3 views
Skip to first unread message

tra...@googlecode.com

unread,
Aug 12, 2010, 4:19:30 PM8/12/10
to tranche-d...@googlegroups.com
Revision: 287
Author: augman85
Date: Thu Aug 12 13:18:51 2010
Log: Added retry upload option.
http://code.google.com/p/tranche/source/detail?r=287

Modified:
/subprojects/GUI/src/org/tranche/gui/add/UploadSummary.java
/subprojects/GUI/src/org/tranche/gui/add/UploadsTable.java
/subprojects/GUI/src/org/tranche/gui/advanced/LeftPanel.java
/subprojects/GUI/src/org/tranche/gui/advanced/UploadsPanel.java

=======================================
--- /subprojects/GUI/src/org/tranche/gui/add/UploadSummary.java Tue Apr 27
10:26:55 2010
+++ /subprojects/GUI/src/org/tranche/gui/add/UploadSummary.java Thu Aug 12
13:18:51 2010
@@ -230,6 +230,35 @@
addFileTool.addListener(progressBar);
deserialize(in);
}
+
+ public UploadSummary(UploadSummary summary) throws Exception {
+ // parameters
+ timeStarted = summary.getTimeStarted();
+ addFileTool = new AddFileTool();
+ progressBar = new AddFileToolProgressBar(addFileTool);
+ addFileTool.addListener(progressBar);
+ addFileTool.setFile(summary.getAddFileTool().getFile());
+ addFileTool.setTitle(summary.getAddFileTool().getTitle());
+
addFileTool.setDescription(summary.getAddFileTool().getDescription());
+
addFileTool.setUserCertificate(summary.getAddFileTool().getUserCertificate());
+
addFileTool.setUserPrivateKey(summary.getAddFileTool().getUserPrivateKey());
+
addFileTool.setPassphrase(summary.getAddFileTool().getPassphrase());
+ addFileTool.setCompress(summary.getAddFileTool().isCompress());
+ addFileTool.setDataOnly(summary.getAddFileTool().isDataOnly());
+
addFileTool.setExplodeBeforeUpload(summary.getAddFileTool().isExplodeBeforeUpload());
+
addFileTool.setShowMetaDataIfEncrypted(summary.getAddFileTool().isShowMetaDataIfEncrypted());
+
addFileTool.setUseUnspecifiedServers(summary.getAddFileTool().isUsingUnspecifiedServers());
+
addFileTool.setThreadCount(summary.getAddFileTool().getThreadCount());
+
addFileTool.addConfirmationEmails(summary.getAddFileTool().getConfirmationEmails());
+
addFileTool.addServersToUse(summary.getAddFileTool().getServersToUse());
+
addFileTool.addStickyServers(summary.getAddFileTool().getStickyServers());
+ for (MetaDataAnnotation mda :
summary.getAddFileTool().getMetaDataAnnotations()) {
+ addFileTool.addMetaDataAnnotation(mda);
+ }
+ if (summary.getAddFileTool().getLicense() != null) {
+ addFileTool.setLicense(summary.getAddFileTool().getLicense());
+ }
+ }

public void showReportGUI(Component relativeTo) {
if (reportGUI == null) {
@@ -530,6 +559,15 @@
// notify
setStatus(STATUS_STOPPED);
}
+
+ public void retry() throws Exception {
+ // only failed
+ if (!isFinished() || !getStatus().equals(STATUS_FAILED)) {
+ return;
+ }
+ // start a new equivalent upload
+ UploadPool.set(new UploadSummary(this));
+ }

public void serialize(OutputStream out) throws Exception {
RemoteUtil.writeInt(version, out);
=======================================
--- /subprojects/GUI/src/org/tranche/gui/add/UploadsTable.java Wed Jan 20
09:48:24 2010
+++ /subprojects/GUI/src/org/tranche/gui/add/UploadsTable.java Thu Aug 12
13:18:51 2010
@@ -30,6 +30,7 @@
import javax.swing.event.PopupMenuEvent;
import javax.swing.event.PopupMenuListener;
import javax.swing.table.TableCellRenderer;
+import org.tranche.gui.ErrorFrame;
import org.tranche.gui.GenericPopupListener;
import org.tranche.gui.GenericTable;
import org.tranche.gui.Styles;
@@ -120,6 +121,7 @@
private JMenuItem stopMenuItem = new JMenuItem("Stop");
private JMenuItem removeMenuItem = new JMenuItem("Remove");
private JMenuItem showErrorsMenuItem = new JMenuItem("Show
Errors");
+ private JMenuItem retryMenuItem = new JMenuItem("Retry");
private JMenuItem monitorMenuItem = new JMenuItem("Monitor");
private JMenuItem emailReceiptMenuItem = new JMenuItem("Email
Receipt");

@@ -234,6 +236,28 @@

us.showErrorFrame(GUIUtil.getAdvancedGUI());
}
}
+ };
+ t.setDaemon(true);
+ t.start();
+ }
+ });
+ retryMenuItem.addActionListener(new ActionListener() {
+
+ public void actionPerformed(ActionEvent e) {
+ Thread t = new Thread("Retry") {
+
+ @Override
+ public void run() {
+ for (UploadSummary us : getSelected()) {
+ try {
+ if (us.isFinished() &&
us.getStatus().equals(UploadSummary.STATUS_FAILED)) {
+ us.retry();
+ }
+ } catch (Exception e) {
+ new ErrorFrame().show(e,
GUIUtil.getAdvancedGUI());
+ }
+ }
+ }
};
t.setDaemon(true);
t.start();
@@ -302,6 +326,7 @@
showHashMenuItem.setEnabled(rows.length == 1 &&
model.getRow(rows[0]).getReport().getHash() != null);

copyHashMenuItem.setEnabled(showHashMenuItem.isEnabled());
showErrorsMenuItem.setEnabled(failed);
+ retryMenuItem.setEnabled(failed);
monitorMenuItem.setEnabled(rows.length > 0);

emailReceiptMenuItem.setEnabled(showHashMenuItem.isEnabled());
} catch (Exception ee) {
@@ -322,6 +347,7 @@
add(stopMenuItem);
add(removeMenuItem);
add(showErrorsMenuItem);
+ add(retryMenuItem);
add(monitorMenuItem);
add(emailReceiptMenuItem);
}
=======================================
--- /subprojects/GUI/src/org/tranche/gui/advanced/LeftPanel.java Wed Jan 20
09:48:24 2010
+++ /subprojects/GUI/src/org/tranche/gui/advanced/LeftPanel.java Thu Aug 12
13:18:51 2010
@@ -151,72 +151,6 @@
add(contextMenu, gbc);
}

-// // Separator
-// {
-// gbc.fill = GridBagConstraints.BOTH;
-// gbc.insets = new Insets(0, 0, 10, 0);
-// gbc.weightx = 1;
-// gbc.weighty = 0;
-// JSeparator separator = new JSeparator();
-// separator.setForeground(Color.DARK_GRAY);
-// add(separator, gbc);
-// }
-//
-// // add the rss feed panel
-// {
-// final XHTMLPanel panel = new XHTMLPanel();
-//
-// // Remove mouse listeners, crush default link action
-// for (MouseListener nextListener : panel.getMouseListeners())
{
-// panel.removeMouseListener(nextListener);
-// }
-//
-// panel.addMouseListener(new LinkListener(panel) {
-//
-// public void linkClicked(String uri) {
-// GUIUtil.displayURL(uri);
-// }
-// });
-//
-//
-// // spawn a thread to do this in the background
-// LazyLoadable ll = new LazyLoadable() {
-//
-// public void lazyLoad() {
-// try {
-// SharedContext sharedContext =
panel.getSharedContext();
-// sharedContext.setTextRenderer(new
Java2DTextRenderer());
-//
sharedContext.getTextRenderer().setSmoothingLevel(TextRenderer.HIGH);
-//
-// // Render rss, fallback on description
-// final String DEV_RSS
= "http://dev.proteomecommons.org/tranche/website/newsfeed.xml", WWW_RSS
= "http://tranche.proteomecommons.org/newsfeed.xml", LOCAL_INTRO
= "/org/tranche/gui/image/intro.xhtml";
-//
-// boolean loaded = false;
-//
-// // First, try www server
-// try {
-//
panel.setDocument(RSSRenderUtil.RSSToHTMLPreview(new
URL(WWW_RSS).openConnection().getInputStream(),
RSSRenderUtil.NUM_ENTRIES_TO_RENDER), WWW_RSS);
-// loaded = true;
-// } catch (Exception e) {
-// // No thanks
-// }
-//
-// // Next, fall back to dev server
-// try {
-// if (!loaded) {
-//
panel.setDocument(RSSRenderUtil.RSSToHTMLPreview(new
URL(DEV_RSS).openConnection().getInputStream(),
RSSRenderUtil.NUM_ENTRIES_TO_RENDER), DEV_RSS);
-// loaded = true;
-// }
-// } catch (Exception e) {
-// // No thanks
-// }
-// } catch (Exception e) {
-// // noop
-// }
-// }
-// };
-// LazyLoadAllSlowStuffAfterGUIRenders.add(ll);
-//
// put in some padding
gbc.fill = GridBagConstraints.BOTH;
gbc.insets = new Insets(0, 10, 10, 30);
=======================================
--- /subprojects/GUI/src/org/tranche/gui/advanced/UploadsPanel.java Wed Jan
20 09:48:24 2010
+++ /subprojects/GUI/src/org/tranche/gui/advanced/UploadsPanel.java Thu Aug
12 13:18:51 2010
@@ -25,6 +25,7 @@
import javax.swing.JPanel;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
+import org.tranche.gui.ErrorFrame;
import org.tranche.gui.GenericScrollPane;
import org.tranche.gui.Styles;
import org.tranche.gui.add.UploadPool;
@@ -99,6 +100,7 @@
private JButton removeMenuItem =
LeftMenu.createLeftMenuButton("Remove");
private JButton monitorMenuItem =
LeftMenu.createLeftMenuButton("Monitor");
private JButton showErrorsMenuItem =
LeftMenu.createLeftMenuButton("Show Errors");
+ private JButton retryMenuItem =
LeftMenu.createLeftMenuButton("Retry");
private JButton saveReceiptMenuItem =
LeftMenu.createLeftMenuButton("Save Receipt");
private JButton emailReceiptMenuItem =
LeftMenu.createLeftMenuButton("Email Receipt");

@@ -255,6 +257,31 @@
});
addButton(showErrorsMenuItem);

+ retryMenuItem.setToolTipText("Starts a new instance of a
failed upload.");
+ retryMenuItem.addActionListener(new ActionListener() {
+
+ public void actionPerformed(ActionEvent e) {
+ Thread t = new Thread("Retry") {
+
+ @Override
+ public void run() {
+ for (UploadSummary us : table.getSelected()) {
+ try {
+ if (us.isFinished() &&
us.getStatus().equals(UploadSummary.STATUS_FAILED)) {
+ us.retry();
+ }
+ } catch (Exception e) {
+ new ErrorFrame().show(e,
GUIUtil.getAdvancedGUI());
+ }
+ }
+ }
+ };
+ t.setDaemon(true);
+ t.start();
+ }
+ });
+ addButton(retryMenuItem);
+
saveReceiptMenuItem.setToolTipText("Save a receipt for this
upload.");
saveReceiptMenuItem.addActionListener(new ActionListener() {

@@ -297,10 +324,11 @@
resumeMenuItem.setEnabled(false);
stopMenuItem.setEnabled(false);
removeMenuItem.setEnabled(false);
- showErrorsMenuItem.setEnabled(false);
showHashMenuItem.setEnabled(false);
copyHashMenuItem.setEnabled(false);
monitorMenuItem.setEnabled(false);
+ showErrorsMenuItem.setEnabled(false);
+ retryMenuItem.setEnabled(false);
saveReceiptMenuItem.setEnabled(false);
emailReceiptMenuItem.setEnabled(false);
}
@@ -341,6 +369,7 @@
showHashMenuItem.setEnabled(rows.length == 1 &&
table.getUploadsTableModel().getRow(rows[0]).getReport().getHash() != null);
copyHashMenuItem.setEnabled(showHashMenuItem.isEnabled());
showErrorsMenuItem.setEnabled(failed);
+ retryMenuItem.setEnabled(failed);

saveReceiptMenuItem.setEnabled(showHashMenuItem.isEnabled());

emailReceiptMenuItem.setEnabled(showHashMenuItem.isEnabled());
} catch (Exception e) {

Reply all
Reply to author
Forward
0 new messages