source: trunk/www/common/plugin/index.jsp @ 3592

Last change on this file since 3592 was 3592, checked in by Nicklas Nordborg, 16 years ago

Fixes #687: Make it possible for other plug-ins than the FormulaFilter? to be launched by the 'Filter bioassayset' button

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 22.3 KB
Line 
1<%-- $Id: index.jsp 3592 2007-07-23 12:57:39Z nicklas $
2  ------------------------------------------------------------------
3  Copyright (C) Authors contributing to this file.
4
5  This file is part of BASE - BioArray Software Environment.
6  Available at http://base.thep.lu.se/
7
8  BASE is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License
10  as published by the Free Software Foundation; either version 2
11  of the License, or (at your option) any later version.
12
13  BASE is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  GNU General Public License for more details.
17
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 59 Temple Place - Suite 330,
21  Boston, MA  02111-1307, USA.
22  ------------------------------------------------------------------
23
24  @author Nicklas
25  @version 2.0
26--%>
27<%@ page session="false"
28  import="net.sf.basedb.core.SessionControl"
29  import="net.sf.basedb.core.DbControl"
30  import="net.sf.basedb.core.BasicItem"
31  import="net.sf.basedb.core.Item"
32  import="net.sf.basedb.core.ItemContext"
33  import="net.sf.basedb.core.ItemQuery"
34  import="net.sf.basedb.core.PluginDefinition"
35  import="net.sf.basedb.core.PluginConfiguration"
36  import="net.sf.basedb.core.PluginParameter"
37  import="net.sf.basedb.core.ParameterType"
38  import="net.sf.basedb.core.StringParameterType"
39  import="net.sf.basedb.core.IntegerParameterType"
40  import="net.sf.basedb.core.LongParameterType"
41  import="net.sf.basedb.core.FloatParameterType"
42  import="net.sf.basedb.core.DoubleParameterType"
43  import="net.sf.basedb.core.ItemParameterType"
44  import="net.sf.basedb.core.DateParameterType"
45  import="net.sf.basedb.core.BooleanParameterType"
46  import="net.sf.basedb.core.FileParameterType"
47  import="net.sf.basedb.core.PathParameterType"
48  import="net.sf.basedb.core.File"
49  import="net.sf.basedb.core.Path"
50  import="net.sf.basedb.core.Job"
51  import="net.sf.basedb.core.Type"
52  import="net.sf.basedb.core.BaseException"
53  import="net.sf.basedb.core.PermissionDeniedException"
54  import="net.sf.basedb.core.PluginConfigurationRequest"
55  import="net.sf.basedb.core.PluginExecutionRequest"
56  import="net.sf.basedb.core.PluginResponse"
57  import="net.sf.basedb.core.Include"
58  import="net.sf.basedb.core.query.Hql"
59  import="net.sf.basedb.core.query.Expressions"
60  import="net.sf.basedb.core.query.Restrictions"
61  import="net.sf.basedb.core.query.Orders"
62  import="net.sf.basedb.core.plugin.Plugin"
63  import="net.sf.basedb.core.plugin.Response"
64  import="net.sf.basedb.core.plugin.GuiContext"
65  import="net.sf.basedb.core.plugin.InteractivePlugin"
66  import="net.sf.basedb.core.plugin.ExportOutputStream"
67  import="net.sf.basedb.clients.web.Base"
68  import="net.sf.basedb.clients.web.WebException"
69  import="net.sf.basedb.clients.web.DuplicateWizardException"
70  import="net.sf.basedb.util.Values"
71  import="net.sf.basedb.util.ContextUtil"
72  import="net.sf.basedb.util.ContextUtil.ContextResult"
73  import="net.sf.basedb.clients.web.formatter.FormatterFactory"
74  import="net.sf.basedb.clients.web.util.HTML"
75  import="net.sf.basedb.clients.web.util.ServletExportOutputStream"
76  import="java.util.List"
77  import="java.util.LinkedList"
78  import="java.util.Arrays"
79  import="java.util.Map"
80  import="java.util.HashMap"
81  import="java.util.LinkedHashMap"
82  import="java.util.Set"
83  import="java.util.HashSet"
84  import="java.io.PrintWriter"
85%>
86<%@ taglib prefix="base" uri="/WEB-INF/base.tld" %>
87<%@ taglib prefix="t" uri="/WEB-INF/tab.tld" %>
88
89<%!
90private static String getJspPage(PluginConfigurationRequest request, PluginDefinition plugin, String defaultPage)
91{
92  String jspPage = request.getRequestInformation().getJspPage();
93  if (jspPage == null)
94  {
95    jspPage = defaultPage;
96  }
97  else
98  {
99    String className = plugin.getClassName();
100    int lastDot = className.lastIndexOf('.');
101    String packageName = lastDot == -1 ? "" : className.substring(0, lastDot+1);
102    jspPage = "/plugins/"+packageName.replace('.', '/')+jspPage;
103  }
104  jspPage += "?requestId="+System.identityHashCode(request);
105  return jspPage;
106}
107%>
108
109<%
110final String root = request.getContextPath()+"/";
111final SessionControl sc = Base.getExistingSessionControl(pageContext, true);
112final String ID = sc.getId();
113final String cmd = request.getParameter("cmd");
114final boolean warnIfOpen = Values.getBoolean(request.getParameter("warnIfOpen"), true);
115final boolean anotherIsOpen = sc.getSessionSetting("plugin.configure.plugin") != null;
116
117DbControl dc = null;
118String forward = null;
119String message = null;
120String redirect = null;
121try
122{
123
124  if ("SelectPlugin".equals(cmd))
125  {
126    Item itemType = Item.valueOf(request.getParameter("item_type"));
127    String subContext = Values.getString(request.getParameter("subcontext"), "");
128    GuiContext.Type contextType = GuiContext.Type.valueOf(request.getParameter("context_type"));
129    GuiContext context = new GuiContext(itemType, contextType, subContext);
130    Plugin.MainType mainType = Plugin.MainType.valueOf(request.getParameter("main_type"));
131    String pluginType = request.getParameter("plugin_type");
132
133    ItemQuery<PluginDefinition> pluginQuery = PluginDefinition.getQuery(context, pluginType);
134    pluginQuery.restrict(
135      Restrictions.eq(
136        Hql.property("mainType"),
137        Expressions.integer(mainType.getValue())
138      )
139    );
140    pluginQuery.order(Orders.asc(Hql.property("name")));
141    pluginQuery.include(Include.MINE, Include.SHARED, Include.IN_PROJECT, Include.OTHERS);
142   
143    ItemQuery<PluginConfiguration> configQuery = PluginConfiguration.getQuery();
144    configQuery.restrict(
145        Restrictions.eq(
146          Hql.property("pluginDefinition"),
147          Expressions.parameter("plugin")
148        )
149      );
150    configQuery.order(Orders.asc(Hql.property("name")));
151    configQuery.include(Include.MINE, Include.SHARED, Include.IN_PROJECT, Include.OTHERS);
152   
153    dc = sc.newDbControl();
154    Object currentItem = null;
155    if (contextType == GuiContext.Type.ITEM)
156    {
157      currentItem = itemType.getById(dc, sc.getCurrentContext(itemType).getId());
158    }
159    List<ContextResult> contextResult = ContextUtil.checkContext(dc, pluginQuery, configQuery, context, currentItem);
160    dc.close();
161
162    boolean showWarnings = Values.getBoolean(sc.getUserClientSetting("plugins.showWarnings"), false);
163    int totalPlugins = ContextUtil.countUsuablePlugins(contextResult);
164    Set<String> contextMessages = ContextUtil.getContextMessages(contextResult, showWarnings, true);
165   
166    if (totalPlugins == 0)
167    {
168      String msg = "No plugins can be used in this context, for the following reasons:<br><ul><li>";
169      if (contextMessages.size() == 0)
170      {
171        msg += "Could not find any plugins that you have permission to use</ul>";
172      }
173      else
174      {
175        msg += Values.getString(contextMessages, "<li>", true) + "</ul>";
176      }
177      throw new WebException("popup", "No usable plugins found", msg);
178    }
179    sc.setSessionSetting("MESSAGES", contextMessages);
180    sc.setSessionSetting("PLUGINS", contextResult);
181    if (totalPlugins == 1 && contextMessages.size() == 0 && !(warnIfOpen && anotherIsOpen))
182    {
183      // Only one plug-in, that can be used, exists, find it in contextResult and
184      //go directly to parameter input page
185      int i = 0;
186      PluginDefinition thePlugin = null;
187      PluginConfiguration theConfig = null;
188      while (i < contextResult.size() && thePlugin == null)
189      {
190        if (contextResult.get(i).isInContext())
191        {
192          thePlugin = contextResult.get(i).getPluginDefinition();
193          theConfig = contextResult.get(i).getPluginConfiguration();
194        }
195        i++;
196      }
197      int pluginDefinitionId = thePlugin.getId();
198      int pluginConfigurationId = theConfig == null ? 0 : theConfig.getId();
199      forward = "index.jsp?cmd=NewJob"+
200        "&plugindefinition_id="+pluginDefinitionId+
201        "&pluginconfiguration_id="+pluginConfigurationId;
202    }
203    else
204    {
205      forward = "select_plugin.jsp";
206    }
207  }
208  else if ("ConfigurePlugin".equals(cmd))
209  {
210    if (warnIfOpen && anotherIsOpen) 
211    {
212      throw new DuplicateWizardException();
213    }
214    int pluginConfigurationId = Values.getInt(request.getParameter("pluginconfiguration_id"));
215   
216    dc = sc.newDbControl();
217    PluginConfiguration pluginConfig = PluginConfiguration.getById(dc, pluginConfigurationId);
218    PluginDefinition plugin = pluginConfig.getPluginDefinition();
219   
220    if (!plugin.supportsConfigurations())
221    {
222      throw new WebException("popup", "Configurations are not supported",
223        "The plugin {1} doesn't support configurations.", HTML.encodeTags(plugin.getName()));
224    }
225    PluginConfigurationRequest pcRequest = pluginConfig.configure();
226   
227    sc.setSessionSetting("plugin.configure.request", pcRequest);
228    sc.setSessionSetting("plugin.configure.job", null);
229    sc.setSessionSetting("plugin.configure.plugin", plugin);
230    sc.setSessionSetting("plugin.configure.config", pluginConfig);
231    sc.setSessionSetting("plugin.configure.errors.message", null);
232    sc.setSessionSetting("plugin.configure.errors.list", null);
233    forward = getJspPage(pcRequest, plugin, "configure.jsp");
234  }
235
236  else if ("NewJob".equals(cmd))
237  {
238    if (warnIfOpen && anotherIsOpen) 
239    {
240      throw new DuplicateWizardException();
241    }
242    String pluginClass = request.getParameter("plugin_class");
243    int pluginDefinitionId = Values.getInt(request.getParameter("plugindefinition_id"));
244    int pluginConfigurationId = Values.getInt(request.getParameter("pluginconfiguration_id"));
245    Item itemType = Item.valueOf(request.getParameter("item_type"));
246    String subContext = Values.getString(request.getParameter("subcontext"), "");
247    ItemContext currentContext = sc.getCurrentContext(itemType, subContext);
248    GuiContext.Type contextType = GuiContext.Type.valueOf(request.getParameter("context_type"));
249    GuiContext context = new GuiContext(itemType, contextType, subContext);
250   
251    dc = sc.newDbControl();
252    PluginDefinition plugin = pluginClass == null ? 
253      PluginDefinition.getById(dc, pluginDefinitionId) : PluginDefinition.getByClassName(dc, pluginClass);
254    PluginConfiguration pluginConfig = pluginConfigurationId == 0 ? null : PluginConfiguration.getById(dc, pluginConfigurationId);
255    Job job = Job.getNew(dc, plugin, pluginConfig);
256    String jobName = Values.getStringOrNull(request.getParameter("job_name"));
257    job.setName(jobName == null ? "Run plugin: " + plugin.getName() : jobName);
258    job.setDescription(request.getParameter("job_description"));
259   
260    PluginConfigurationRequest pcRequest = job.configure(context);
261    sc.setSessionSetting("plugin.configure.request", pcRequest);
262    sc.setSessionSetting("plugin.configure.job", job);
263    sc.setSessionSetting("plugin.configure.plugin", plugin);
264    sc.setSessionSetting("plugin.configure.config", pluginConfig);
265    sc.setSessionSetting("plugin.configure.errors.message", null);
266    sc.setSessionSetting("plugin.configure.errors.list", null);
267    sc.setSessionSetting("plugin.configure.currentContext", currentContext);
268    forward = getJspPage(pcRequest, plugin, "configure.jsp");
269  }
270 
271  else if ("CopyJob".equals(cmd))
272  {
273    dc = sc.newDbControl();
274    int jobId = Values.getInt(request.getParameter("job_id"));
275    Job copyFrom = Job.getById(dc, jobId);
276    PluginDefinition plugin = copyFrom.getPluginDefinition();
277    PluginConfiguration pluginConfig = copyFrom.getPluginConfiguration();
278   
279    Job job = Job.getNew(dc, plugin, pluginConfig);
280    job.copyParametersFrom(copyFrom);
281   
282    Item itemType = Item.valueOf(request.getParameter("item_type"));
283    String subContext = Values.getString(request.getParameter("subcontext"), "");
284    ItemContext currentContext = sc.getCurrentContext(itemType, subContext);
285    GuiContext.Type contextType = GuiContext.Type.valueOf(request.getParameter("context_type"));
286    GuiContext context = new GuiContext(itemType, contextType, subContext);
287   
288    PluginConfigurationRequest pcRequest = job.configure(context);
289    sc.setSessionSetting("plugin.configure.request", pcRequest);
290    sc.setSessionSetting("plugin.configure.job", job);
291    sc.setSessionSetting("plugin.configure.plugin", plugin);
292    sc.setSessionSetting("plugin.configure.config", pluginConfig);
293    sc.setSessionSetting("plugin.configure.errors.message", null);
294    sc.setSessionSetting("plugin.configure.errors.list", null);
295    sc.setSessionSetting("plugin.configure.currentContext", currentContext);
296    forward = getJspPage(pcRequest, plugin, "configure.jsp");
297  }
298 
299  else if ("ConfigureJob".equals(cmd))
300  {
301    dc = sc.newDbControl();
302
303    int jobId = Values.getInt(request.getParameter("job_id"));
304    Job job = Job.getById(dc, jobId);
305   
306    // TODO - This is not meaningful unless we can get a context
307    //int pluginDefinitionId = Values.getInt(request.getParameter("plugindefinition_id"));
308    //int pluginConfigurationId = Values.getInt(request.getParameter("pluginconfiguration_id"));
309   
310    //Item itemType = Item.valueOf(request.getParameter("item_type"));
311    //String subContext = Values.getString(request.getParameter("subcontext"), "");
312    //GuiContext.Type contextType = GuiContext.Type.valueOf(request.getParameter("context_type"));
313    //GuiContext context = new GuiContext(itemType, contextType, subContext);
314   
315    PluginDefinition plugin = job.getPluginDefinition();
316    PluginConfiguration pluginConfig = job.getPluginConfiguration();
317   
318    PluginConfigurationRequest pcRequest = job.configure(null);
319    sc.setSessionSetting("plugin.configure.request", pcRequest);
320    sc.setSessionSetting("plugin.configure.job", job);
321    sc.setSessionSetting("plugin.configure.plugin", plugin);
322    sc.setSessionSetting("plugin.configure.config", pluginConfig);
323    sc.setSessionSetting("plugin.configure.errors.message", null);
324    sc.setSessionSetting("plugin.configure.errors.list", null);
325    forward = getJspPage(pcRequest, plugin, "configure.jsp");
326  }
327
328  else if ("SetParameters".equals(cmd))
329  {
330    int maxRecent = Base.getMaxRecent(sc);
331    PluginConfigurationRequest pcRequest = (PluginConfigurationRequest)sc.getSessionSetting("plugin.configure.request");   
332    String requestId = request.getParameter("requestId");
333    if (requestId != null && !requestId.equals(Integer.toString(System.identityHashCode(pcRequest))))
334    {
335      throw new WebException("popup", "Invalid request ID", "Data in your configuration wizard has become corrupted. Please re-start and try again.");
336    }
337    List<PluginParameter<?>> parameters =  pcRequest.getRequestInformation().getParameters();
338    List<Throwable> parseErrors = new LinkedList<Throwable>();
339    ItemContext currentContext = (ItemContext)sc.getSessionSetting("plugin.configure.currentContext");
340    // Clear old errors
341    sc.setSessionSetting("plugin.configure.errors.message", null);
342    sc.setSessionSetting("plugin.configure.errors.list", null);
343    if (parameters != null && parameters.size() > 0)
344    {
345      for (PluginParameter<?> param : parameters)
346      {
347        ParameterType pType = param.getParameterType();
348        if (pType != null)
349        {
350          String[] sValues = request.getParameterValues("parameter:"+param.getName());
351          Object[] oValues = null;
352          try
353          {
354            if (sValues != null)
355            {
356              if (pType instanceof StringParameterType)
357              {
358                oValues = sValues;
359              }
360              else if (pType instanceof IntegerParameterType)
361              {
362                oValues = Values.getInt(sValues);
363              }
364              else if (pType instanceof LongParameterType)
365              {
366                oValues = Values.getLong(sValues);
367              }
368              else if (pType instanceof FloatParameterType)
369              {
370                oValues = Values.getFloat(sValues);
371              }
372              else if (pType instanceof DoubleParameterType)
373              {
374                oValues = Values.getDouble(sValues);
375              }
376              else if (pType instanceof BooleanParameterType)
377              {
378                oValues = Type.BOOLEAN.parseStrings(sValues);
379              }
380              else if (pType instanceof DateParameterType)
381              {
382                oValues = Values.getDate(sValues, FormatterFactory.getDateFormatter(sc));
383              }
384              else if (pType instanceof ItemParameterType)
385              {
386                Integer[] itemId = Values.getInt(sValues);
387                oValues = new Object[itemId.length];
388                Item iType = Item.fromItemClass(pType.getParameterClass());
389                dc = sc.newDbControl();
390                for (int i = 0; i < itemId.length; ++i)
391                {
392                  Integer id = itemId[i];
393                  if (id != null && id != 0)
394                  {
395                    BasicItem item = iType.getById(dc, id);
396                    oValues[i] = item;
397                    if (currentContext != null) 
398                    {
399                      currentContext.setRecent(item, maxRecent);
400                    }
401                  }
402                }
403                dc.close();
404              }
405              else if (pType instanceof FileParameterType)
406              {
407                oValues = new Object[sValues.length];
408                dc = sc.newDbControl();
409                for (int i = 0; i < sValues.length; ++i)
410                {
411                  File file = File.getByPath(dc, new Path(sValues[i], Path.Type.FILE), false);
412                  oValues[i] = file;
413                  if (currentContext != null) 
414                  {
415                    currentContext.setRecent(file, maxRecent);
416                  }
417                }
418                dc.close();
419              }
420              else if (pType instanceof PathParameterType)
421              {
422                oValues = sValues;
423              }
424            }
425          }
426          catch (Throwable t)
427          {
428            parseErrors.add(t);
429          }
430          pcRequest.setParameterValues(param.getName(), oValues == null ? null : Arrays.asList(oValues));
431        }
432      }
433    }
434    PluginResponse pluginResponse = null;
435    Response.Status status = null;
436    if (parseErrors.size() == 0)
437    {
438      pluginResponse = pcRequest.invoke();
439      status = pluginResponse.getStatus();
440    }
441    else
442    {
443      status = Response.Status.ERROR;
444    }
445    if (status == Response.Status.DONE || status == Response.Status.EXECUTE_IMMEDIATELY)
446    {
447      Job job = (Job)sc.getSessionSetting("plugin.configure.job");
448      if (job != null)
449      {
450        sc.setSessionSetting("plugin.configure.response", pluginResponse);
451        forward = "finish_job.jsp";
452      }
453      else
454      {
455        dc = sc.newDbControl();
456        pluginResponse.saveParameters(dc);
457        dc.commit();
458        sc.setSessionSetting("plugin.configure.request", null);
459        sc.setSessionSetting("plugin.configure.plugin", null);
460        sc.setSessionSetting("plugin.configure.config", null);
461        sc.setSessionSetting("plugin.configure.currentContext", null);
462        message = "Plugin configured";
463      }
464    }
465    else if (status == Response.Status.CONTINUE)
466    {
467      pcRequest = pluginResponse.getNextRequest();
468      sc.setSessionSetting("plugin.configure.request", pcRequest);
469      PluginDefinition plugin = (PluginDefinition)sc.getSessionSetting("plugin.configure.plugin");
470      forward = getJspPage(pcRequest, plugin, "configure.jsp");
471    }
472    else if (status == Response.Status.ERROR)
473    {
474      PluginDefinition plugin = (PluginDefinition)sc.getSessionSetting("plugin.configure.plugin");
475      if (parseErrors.size() > 0)
476      {
477        sc.setSessionSetting("plugin.configure.errors.message", 
478          parseErrors.size() + " parameter value(s) are invalid");
479        sc.setSessionSetting("plugin.configure.errors.list", parseErrors);
480      }
481      else
482      {
483        sc.setSessionSetting("plugin.configure.errors.message", pluginResponse.getMessage());
484        sc.setSessionSetting("plugin.configure.errors.list", pluginResponse.getErrorList());
485      }
486      forward = getJspPage(pcRequest, plugin, "configure.jsp");
487    }
488    else if (status == Response.Status.DOWNLOAD_IMMEDIATELY)
489    {
490      sc.setSessionSetting("plugin.configure.response", pluginResponse);
491      forward = "download_immediately.jsp";
492    }
493    else
494    {
495      throw new WebException("popup", "Unknown response from plugin", status.toString());
496    }
497  }
498  else if ("FinishNewJob".equals(cmd))
499  {
500    dc = sc.newDbControl();
501    Job job = (Job)sc.getSessionSetting("plugin.configure.job");
502    PluginResponse pluginResponse = (PluginResponse)sc.getSessionSetting("plugin.configure.response");
503
504    job.setName(Values.getStringOrNull(request.getParameter("name")));
505    job.setDescription(Values.getStringOrNull(request.getParameter("description")));
506    job.setSendMessage(Values.getBoolean(request.getParameter("send_message")));
507    job.setRemoveJobWhenFinished(Values.getBoolean(request.getParameter("remove_job")));
508    dc.saveItem(job);
509    if (pluginResponse != null) pluginResponse.saveParameters(dc);
510    dc.commit();
511    redirect = "../../views/jobs/index.jsp?ID="+ID+"&cmd=ViewItem&item_id="+job.getId();
512    sc.setSessionSetting("plugin.configure.job", null);
513    sc.setSessionSetting("plugin.configure.request", null);
514    sc.setSessionSetting("plugin.configure.response", null);
515    sc.setSessionSetting("plugin.configure.plugin", null);
516    sc.setSessionSetting("plugin.configure.config", null);
517    sc.setSessionSetting("plugin.configure.currentContext", null);
518    if (pluginResponse != null && pluginResponse.getStatus() == Response.Status.EXECUTE_IMMEDIATELY)
519    {
520      PluginExecutionRequest executionRequest = pluginResponse.getExecutionRequest(null);
521      Thread t = new Thread(executionRequest);
522      t.setPriority(Thread.currentThread().getPriority() - 1);
523      t.start();
524    }
525  }
526  else if ("ExportImmediately".equals(cmd))
527  {
528    PluginResponse pluginResponse = (PluginResponse)sc.getSessionSetting("plugin.configure.response");
529    ExportOutputStream exportStream = new ServletExportOutputStream(response);
530    try
531    {
532      pluginResponse.downloadImmediately(exportStream, null);
533    }
534    catch (Throwable t)
535    {
536      PrintWriter pw = new PrintWriter(exportStream, true);
537      t.printStackTrace(pw);
538      pw.flush();
539      pw.close();
540    }
541    exportStream.flush();
542    exportStream.close();
543    sc.setSessionSetting("plugin.configure.job", null);
544    sc.setSessionSetting("plugin.configure.request", null);
545    sc.setSessionSetting("plugin.configure.response", null);
546    sc.setSessionSetting("plugin.configure.plugin", null);
547    sc.setSessionSetting("plugin.configure.config", null);
548    sc.setSessionSetting("plugin.configure.errors.message", null);
549    sc.setSessionSetting("plugin.configure.errors.list", null);
550    sc.setSessionSetting("plugin.configure.currentContext", null);
551    return;
552  }
553  else if ("CancelWizard".equals(cmd))
554  {
555    PluginConfigurationRequest pcRequest = 
556      (PluginConfigurationRequest)sc.setSessionSetting("plugin.configure.request", null);
557    if (pcRequest != null) pcRequest.done();
558    sc.setSessionSetting("plugin.configure.response", null);
559    sc.setSessionSetting("plugin.configure.plugin", null);
560    sc.setSessionSetting("plugin.configure.config", null);
561    sc.setSessionSetting("plugin.configure.job", null);
562    sc.setSessionSetting("plugin.configure.errors.message", null);
563    sc.setSessionSetting("plugin.configure.errors.list", null);
564    sc.setSessionSetting("plugin.configure.currentContext", null); 
565    redirect = root + "common/close_popup.jsp?refresh_opener=0&wait=0";
566  }
567  else
568  {
569    throw new WebException("popup", "Invalid command", "The command {1} is not recognised as a valid command.", cmd);
570  }
571}
572finally
573{
574  if (dc != null) dc.close();
575}
576
577if (forward != null)
578{
579  pageContext.forward(forward);
580}
581else if (redirect != null)
582{
583  response.sendRedirect(redirect);
584}
585else if (message == null)
586{
587  response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&wait=0");
588}
589else
590{
591  response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&message="+HTML.urlEncode(message));
592}
593%>
Note: See TracBrowser for help on using the repository browser.