4327 |
03 Jun 08 |
martin |
1 |
<%-- $Id$ |
4327 |
03 Jun 08 |
martin |
2 |
------------------------------------------------------------------ |
4327 |
03 Jun 08 |
martin |
Copyright (C) 2008 Martin Svensson |
4327 |
03 Jun 08 |
martin |
4 |
|
4327 |
03 Jun 08 |
martin |
5 |
This file is part of BASE - BioArray Software Environment. |
4327 |
03 Jun 08 |
martin |
6 |
Available at http://base.thep.lu.se/ |
4327 |
03 Jun 08 |
martin |
7 |
|
4327 |
03 Jun 08 |
martin |
8 |
BASE is free software; you can redistribute it and/or |
4327 |
03 Jun 08 |
martin |
9 |
modify it under the terms of the GNU General Public License |
4476 |
05 Sep 08 |
jari |
10 |
as published by the Free Software Foundation; either version 3 |
4327 |
03 Jun 08 |
martin |
11 |
of the License, or (at your option) any later version. |
4327 |
03 Jun 08 |
martin |
12 |
|
4327 |
03 Jun 08 |
martin |
13 |
BASE is distributed in the hope that it will be useful, |
4327 |
03 Jun 08 |
martin |
14 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
4327 |
03 Jun 08 |
martin |
15 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
4327 |
03 Jun 08 |
martin |
16 |
GNU General Public License for more details. |
4327 |
03 Jun 08 |
martin |
17 |
|
4327 |
03 Jun 08 |
martin |
18 |
You should have received a copy of the GNU General Public License |
4510 |
11 Sep 08 |
jari |
19 |
along with BASE. If not, see <http://www.gnu.org/licenses/>. |
4327 |
03 Jun 08 |
martin |
20 |
------------------------------------------------------------------ |
4327 |
03 Jun 08 |
martin |
21 |
|
4327 |
03 Jun 08 |
martin |
22 |
This page get the progress of an export plugin |
4327 |
03 Jun 08 |
martin |
23 |
when downloading the export file immediately. |
4327 |
03 Jun 08 |
martin |
24 |
|
4327 |
03 Jun 08 |
martin |
25 |
@author Martin |
4327 |
03 Jun 08 |
martin |
26 |
@version 2.8 |
4327 |
03 Jun 08 |
martin |
27 |
--%> |
6372 |
06 Dec 13 |
nicklas |
28 |
<%@ page pageEncoding="UTF-8" session="false" contentType="application/json" |
4327 |
03 Jun 08 |
martin |
29 |
import="net.sf.basedb.core.SessionControl" |
4327 |
03 Jun 08 |
martin |
30 |
import="net.sf.basedb.clients.web.Base" |
4330 |
10 Jun 08 |
martin |
31 |
import="net.sf.basedb.clients.web.util.SimpleSignalProgressReporter" |
4327 |
03 Jun 08 |
martin |
32 |
import="net.sf.basedb.util.Values" |
6372 |
06 Dec 13 |
nicklas |
33 |
import="net.sf.basedb.util.error.ThrowableUtil" |
6372 |
06 Dec 13 |
nicklas |
34 |
import="org.json.simple.JSONObject" |
4327 |
03 Jun 08 |
martin |
35 |
%> |
4327 |
03 Jun 08 |
martin |
36 |
<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %> |
4327 |
03 Jun 08 |
martin |
37 |
<% |
4327 |
03 Jun 08 |
martin |
38 |
final SessionControl sc = Base.getExistingSessionControl(pageContext, true); |
6372 |
06 Dec 13 |
nicklas |
39 |
JSONObject json = new JSONObject(); |
6372 |
06 Dec 13 |
nicklas |
40 |
json.put("status", "ok"); |
6372 |
06 Dec 13 |
nicklas |
41 |
try |
4327 |
03 Jun 08 |
martin |
42 |
{ |
7605 |
26 Feb 19 |
nicklas |
43 |
SimpleSignalProgressReporter progress = sc.getSessionSetting("plugin.configure.progress.reporter"); |
6372 |
06 Dec 13 |
nicklas |
44 |
//Return the progress information |
6372 |
06 Dec 13 |
nicklas |
45 |
if (progress != null) |
4342 |
17 Jun 08 |
martin |
46 |
{ |
6372 |
06 Dec 13 |
nicklas |
47 |
json.put("percent", progress.getPercent()); |
6372 |
06 Dec 13 |
nicklas |
48 |
json.put("message", progress.getMessage()); |
6372 |
06 Dec 13 |
nicklas |
49 |
if (progress.getPercent() == 100) |
6372 |
06 Dec 13 |
nicklas |
50 |
{ |
6372 |
06 Dec 13 |
nicklas |
51 |
sc.setSessionSetting("plugin.configure.progress.reporter", null); |
6372 |
06 Dec 13 |
nicklas |
52 |
} |
4342 |
17 Jun 08 |
martin |
53 |
} |
4327 |
03 Jun 08 |
martin |
54 |
} |
6372 |
06 Dec 13 |
nicklas |
55 |
catch (Throwable t) |
6372 |
06 Dec 13 |
nicklas |
56 |
{ |
6372 |
06 Dec 13 |
nicklas |
57 |
t.printStackTrace(); |
6372 |
06 Dec 13 |
nicklas |
58 |
json.clear(); |
6372 |
06 Dec 13 |
nicklas |
59 |
json.put("status", "error"); |
6372 |
06 Dec 13 |
nicklas |
60 |
json.put("message", t.getMessage()); |
6372 |
06 Dec 13 |
nicklas |
61 |
json.put("stacktrace", ThrowableUtil.stackTraceToString(t)); |
6372 |
06 Dec 13 |
nicklas |
62 |
} |
6372 |
06 Dec 13 |
nicklas |
63 |
finally |
6372 |
06 Dec 13 |
nicklas |
64 |
{ |
6372 |
06 Dec 13 |
nicklas |
65 |
json.writeJSONString(out); |
6372 |
06 Dec 13 |
nicklas |
66 |
out.flush(); |
6372 |
06 Dec 13 |
nicklas |
67 |
} |
6372 |
06 Dec 13 |
nicklas |
68 |
%> |