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

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

References #625. Use correct plugin configuration.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Date Id
File size: 22.3 KB
Line 
1<%-- $Id: index.jsp 3559 2007-07-16 07:55:14Z 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
132    ItemQuery<PluginDefinition> pluginQuery = PluginDefinition.getQuery(context, null);
133    pluginQuery.restrict(
134      Restrictions.eq(
135        Hql.property("mainType"),
136        Expressions.integer(mainType.getValue())
137      )
138    );
139    pluginQuery.order(Orders.asc(Hql.property("name")));
140    pluginQuery.include(Include.MINE, Include.SHARED, Include.IN_PROJECT, Include.OTHERS);
141   
142    ItemQuery<PluginConfiguration> configQuery = PluginConfiguration.getQuery();
143    configQuery.restrict(
144        Restrictions.eq(
145          Hql.property("pluginDefinition"),
146          Expressions.parameter("plugin")
147        )
148      );
149    configQuery.order(Orders.asc(Hql.property("name")));
150    configQuery.include(Include.MINE, Include.SHARED, Include.IN_PROJECT, Include.OTHERS);
151   
152    dc = sc.newDbControl();
153    Object currentItem = null;
154    if (contextType == GuiContext.Type.ITEM)
155    {
156      currentItem = itemType.getById(dc, sc.getCurrentContext(itemType).getId());
157    }
158    List<ContextResult> contextResult = ContextUtil.checkContext(dc, pluginQuery, configQuery, context, currentItem);
159    dc.close();
160
161    boolean showWarnings = Values.getBoolean(sc.getUserClientSetting("plugins.showWarnings"), false);
162    int totalPlugins = ContextUtil.countUsuablePlugins(contextResult);
163    Set<String> contextMessages = ContextUtil.getContextMessages(contextResult, showWarnings, true);
164   
165    if (totalPlugins == 0)
166    {
167      String msg = "No plugins can be used in this context, for the following reasons:<br><ul><li>";
168      if (contextMessages.size() == 0)
169      {
170        msg += "Could not find any plugins that you have permission to use</ul>";
171      }
172      else
173      {
174        msg += Values.getString(contextMessages, "<li>", true) + "</ul>";
175      }
176      throw new WebException("popup", "No usable plugins found", msg);
177    }
178    sc.setSessionSetting("MESSAGES", contextMessages);
179    sc.setSessionSetting("PLUGINS", contextResult);
180    if (totalPlugins == 1 && contextMessages.size() == 0 && !(warnIfOpen && anotherIsOpen))
181    {
182      // Only one plug-in, that can be used, exists, find it in contextResult and
183      //go directly to parameter input page
184      int i = 0;
185      PluginDefinition thePlugin = null;
186      PluginConfiguration theConfig = null;
187      while (i < contextResult.size() && thePlugin == null)
188      {
189        if (contextResult.get(i).isInContext())
190        {
191          thePlugin = contextResult.get(i).getPluginDefinition();
192          theConfig = contextResult.get(i).getPluginConfiguration();
193        }
194        i++;
195      }
196      int pluginDefinitionId = thePlugin.getId();
197      int pluginConfigurationId = theConfig == null ? 0 : theConfig.getId();
198      forward = "index.jsp?cmd=NewJob"+
199        "&plugindefinition_id="+pluginDefinitionId+
200        "&pluginconfiguration_id="+pluginConfigurationId;
201    }
202    else
203    {
204      forward = "select_plugin.jsp";
205    }
206  }
207  else if ("ConfigurePlugin".equals(cmd))
208  {
209    if (warnIfOpen && anotherIsOpen) 
210    {
211      throw new DuplicateWizardException();
212    }
213    int pluginConfigurationId = Values.getInt(request.getParameter("pluginconfiguration_id"));
214   
215    dc = sc.newDbControl();
216    PluginConfiguration pluginConfig = PluginConfiguration.getById(dc, pluginConfigurationId);
217    PluginDefinition plugin = pluginConfig.getPluginDefinition();
218   
219    if (!plugin.supportsConfigurations())
220    {
221      throw new WebException("popup", "Configurations are not supported",
222        "The plugin {1} doesn't support configurations.", HTML.encodeTags(plugin.getName()));
223    }
224    PluginConfigurationRequest pcRequest = pluginConfig.configure();
225   
226    sc.setSessionSetting("plugin.configure.request", pcRequest);
227    sc.setSessionSetting("plugin.configure.job", null);
228    sc.setSessionSetting("plugin.configure.plugin", plugin);
229    sc.setSessionSetting("plugin.configure.config", pluginConfig);
230    sc.setSessionSetting("plugin.configure.errors.message", null);
231    sc.setSessionSetting("plugin.configure.errors.list", null);
232    forward = getJspPage(pcRequest, plugin, "configure.jsp");
233  }
234
235  else if ("NewJob".equals(cmd))
236  {
237    if (warnIfOpen && anotherIsOpen) 
238    {
239      throw new DuplicateWizardException();
240    }
241    String pluginClass = request.getParameter("plugin_class");
242    int pluginDefinitionId = Values.getInt(request.getParameter("plugindefinition_id"));
243    int pluginConfigurationId = Values.getInt(request.getParameter("pluginconfiguration_id"));
244    Item itemType = Item.valueOf(request.getParameter("item_type"));
245    String subContext = Values.getString(request.getParameter("subcontext"), "");
246    ItemContext currentContext = sc.getCurrentContext(itemType, subContext);
247    GuiContext.Type contextType = GuiContext.Type.valueOf(request.getParameter("context_type"));
248    GuiContext context = new GuiContext(itemType, contextType, subContext);
249   
250    dc = sc.newDbControl();
251    PluginDefinition plugin = pluginClass == null ? 
252      PluginDefinition.getById(dc, pluginDefinitionId) : PluginDefinition.getByClassName(dc, pluginClass);
253    PluginConfiguration pluginConfig = pluginConfigurationId == 0 ? null : PluginConfiguration.getById(dc, pluginConfigurationId);
254    Job job = Job.getNew(dc, plugin, pluginConfig);
255    String jobName = Values.getStringOrNull(request.getParameter("job_name"));
256    job.setName(jobName == null ? "Run plugin: " + plugin.getName() : jobName);
257    job.setDescription(request.getParameter("job_description"));
258   
259    PluginConfigurationRequest pcRequest = job.configure(context);
260    sc.setSessionSetting("plugin.configure.request", pcRequest);
261    sc.setSessionSetting("plugin.configure.job", job);
262    sc.setSessionSetting("plugin.configure.plugin", plugin);
263    sc.setSessionSetting("plugin.configure.config", pluginConfig);
264    sc.setSessionSetting("plugin.configure.errors.message", null);
265    sc.setSessionSetting("plugin.configure.errors.list", null);
266    sc.setSessionSetting("plugin.configure.currentContext", currentContext);
267    forward = getJspPage(pcRequest, plugin, "configure.jsp");
268  }
269 
270  else if ("CopyJob".equals(cmd))
271  {
272    dc = sc.newDbControl();
273    int jobId = Values.getInt(request.getParameter("job_id"));
274    Job copyFrom = Job.getById(dc, jobId);
275    PluginDefinition plugin = copyFrom.getPluginDefinition();
276    PluginConfiguration pluginConfig = copyFrom.getPluginConfiguration();
277   
278    Job job = Job.getNew(dc, plugin, pluginConfig);
279    job.copyParametersFrom(copyFrom);
280   
281    Item itemType = Item.valueOf(request.getParameter("item_type"));
282    String subContext = Values.getString(request.getParameter("subcontext"), "");
283    ItemContext currentContext = sc.getCurrentContext(itemType, subContext);
284    GuiContext.Type contextType = GuiContext.Type.valueOf(request.getParameter("context_type"));
285    GuiContext context = new GuiContext(itemType, contextType, subContext);
286   
287    PluginConfigurationRequest pcRequest = job.configure(context);
288    sc.setSessionSetting("plugin.configure.request", pcRequest);
289    sc.setSessionSetting("plugin.configure.job", job);
290    sc.setSessionSetting("plugin.configure.plugin", plugin);
291    sc.setSessionSetting("plugin.configure.config", pluginConfig);
292    sc.setSessionSetting("plugin.configure.errors.message", null);
293    sc.setSessionSetting("plugin.configure.errors.list", null);
294    sc.setSessionSetting("plugin.configure.currentContext", currentContext);
295    forward = getJspPage(pcRequest, plugin, "configure.jsp");
296  }
297 
298  else if ("ConfigureJob".equals(cmd))
299  {
300    dc = sc.newDbControl();
301
302    int jobId = Values.getInt(request.getParameter("job_id"));
303    Job job = Job.getById(dc, jobId);
304   
305    // TODO - This is not meaningful unless we can get a context
306    //int pluginDefinitionId = Values.getInt(request.getParameter("plugindefinition_id"));
307    //int pluginConfigurationId = Values.getInt(request.getParameter("pluginconfiguration_id"));
308   
309    //Item itemType = Item.valueOf(request.getParameter("item_type"));
310    //String subContext = Values.getString(request.getParameter("subcontext"), "");
311    //GuiContext.Type contextType = GuiContext.Type.valueOf(request.getParameter("context_type"));
312    //GuiContext context = new GuiContext(itemType, contextType, subContext);
313   
314    PluginDefinition plugin = job.getPluginDefinition();
315    PluginConfiguration pluginConfig = job.getPluginConfiguration();
316   
317    PluginConfigurationRequest pcRequest = job.configure(null);
318    sc.setSessionSetting("plugin.configure.request", pcRequest);
319    sc.setSessionSetting("plugin.configure.job", job);
320    sc.setSessionSetting("plugin.configure.plugin", plugin);
321    sc.setSessionSetting("plugin.configure.config", pluginConfig);
322    sc.setSessionSetting("plugin.configure.errors.message", null);
323    sc.setSessionSetting("plugin.configure.errors.list", null);
324    forward = getJspPage(pcRequest, plugin, "configure.jsp");
325  }
326
327  else if ("SetParameters".equals(cmd))
328  {
329    int maxRecent = Base.getMaxRecent(sc);
330    PluginConfigurationRequest pcRequest = (PluginConfigurationRequest)sc.getSessionSetting("plugin.configure.request");
331    int requestId = Values.getInt(request.getParameter("requestId"), System.identityHashCode(pcRequest));
332    if (requestId != System.identityHashCode(pcRequest))
333    {
334      throw new WebException("popup", "Invalid request ID", "Data in your configuration wizard has become corrupted. Please re-start and try again.");
335    }
336    List<PluginParameter<?>> parameters =  pcRequest.getRequestInformation().getParameters();
337    List<Throwable> parseErrors = new LinkedList<Throwable>();
338    ItemContext currentContext = (ItemContext)sc.getSessionSetting("plugin.configure.currentContext");
339    // Clear old errors
340    sc.setSessionSetting("plugin.configure.errors.message", null);
341    sc.setSessionSetting("plugin.configure.errors.list", null);
342    if (parameters != null && parameters.size() > 0)
343    {
344      for (PluginParameter<?> param : parameters)
345      {
346        ParameterType pType = param.getParameterType();
347        if (pType != null)
348        {
349          String[] sValues = request.getParameterValues("parameter:"+param.getName());
350          Object[] oValues = null;
351          try
352          {
353            if (sValues != null)
354            {
355              if (pType instanceof StringParameterType)
356              {
357                oValues = sValues;
358              }
359              else if (pType instanceof IntegerParameterType)
360              {
361                oValues = Values.getInt(sValues);
362              }
363              else if (pType instanceof LongParameterType)
364              {
365                oValues = Values.getLong(sValues);
366              }
367              else if (pType instanceof FloatParameterType)
368              {
369                oValues = Values.getFloat(sValues);
370              }
371              else if (pType instanceof DoubleParameterType)
372              {
373                oValues = Values.getDouble(sValues);
374              }
375              else if (pType instanceof BooleanParameterType)
376              {
377                oValues = Type.BOOLEAN.parseStrings(sValues);
378              }
379              else if (pType instanceof DateParameterType)
380              {
381                oValues = Values.getDate(sValues, FormatterFactory.getDateFormatter(sc));
382              }
383              else if (pType instanceof ItemParameterType)
384              {
385                Integer[] itemId = Values.getInt(sValues);
386                oValues = new Object[itemId.length];
387                Item iType = Item.fromItemClass(pType.getParameterClass());
388                dc = sc.newDbControl();
389                for (int i = 0; i < itemId.length; ++i)
390                {
391                  Integer id = itemId[i];
392                  if (id != null && id != 0)
393                  {
394                    BasicItem item = iType.getById(dc, id);
395                    oValues[i] = item;
396                    if (currentContext != null) 
397                    {
398                      currentContext.setRecent(item, maxRecent);
399                    }
400                  }
401                }
402                dc.close();
403              }
404              else if (pType instanceof FileParameterType)
405              {
406                oValues = new Object[sValues.length];
407                dc = sc.newDbControl();
408                for (int i = 0; i < sValues.length; ++i)
409                {
410                  File file = File.getByPath(dc, new Path(sValues[i], Path.Type.FILE), false);
411                  oValues[i] = file;
412                  if (currentContext != null) 
413                  {
414                    currentContext.setRecent(file, maxRecent);
415                  }
416                }
417                dc.close();
418              }
419              else if (pType instanceof PathParameterType)
420              {
421                oValues = sValues;
422              }
423            }
424          }
425          catch (Throwable t)
426          {
427            parseErrors.add(t);
428          }
429          pcRequest.setParameterValues(param.getName(), oValues == null ? null : Arrays.asList(oValues));
430        }
431      }
432    }
433    PluginResponse pluginResponse = null;
434    Response.Status status = null;
435    if (parseErrors.size() == 0)
436    {
437      pluginResponse = pcRequest.invoke();
438      status = pluginResponse.getStatus();
439    }
440    else
441    {
442      status = Response.Status.ERROR;
443    }
444    if (status == Response.Status.DONE || status == Response.Status.EXECUTE_IMMEDIATELY)
445    {
446      Job job = (Job)sc.getSessionSetting("plugin.configure.job");
447      if (job != null)
448      {
449        sc.setSessionSetting("plugin.configure.response", pluginResponse);
450        forward = "finish_job.jsp";
451      }
452      else
453      {
454        dc = sc.newDbControl();
455        pluginResponse.saveParameters(dc);
456        dc.commit();
457        sc.setSessionSetting("plugin.configure.request", null);
458        sc.setSessionSetting("plugin.configure.plugin", null);
459        sc.setSessionSetting("plugin.configure.config", null);
460        sc.setSessionSetting("plugin.configure.currentContext", null);
461        message = "Plugin configured";
462      }
463    }
464    else if (status == Response.Status.CONTINUE)
465    {
466      pcRequest = pluginResponse.getNextRequest();
467      sc.setSessionSetting("plugin.configure.request", pcRequest);
468      PluginDefinition plugin = (PluginDefinition)sc.getSessionSetting("plugin.configure.plugin");
469      forward = getJspPage(pcRequest, plugin, "configure.jsp");
470    }
471    else if (status == Response.Status.ERROR)
472    {
473      PluginDefinition plugin = (PluginDefinition)sc.getSessionSetting("plugin.configure.plugin");
474      if (parseErrors.size() > 0)
475      {
476        sc.setSessionSetting("plugin.configure.errors.message", 
477          parseErrors.size() + " parameter value(s) are invalid");
478        sc.setSessionSetting("plugin.configure.errors.list", parseErrors);
479      }
480      else
481      {
482        sc.setSessionSetting("plugin.configure.errors.message", pluginResponse.getMessage());
483        sc.setSessionSetting("plugin.configure.errors.list", pluginResponse.getErrorList());
484      }
485      forward = getJspPage(pcRequest, plugin, "configure.jsp");
486    }
487    else if (status == Response.Status.DOWNLOAD_IMMEDIATELY)
488    {
489      sc.setSessionSetting("plugin.configure.response", pluginResponse);
490      forward = "download_immediately.jsp";
491    }
492    else
493    {
494      throw new WebException("popup", "Unknown response from plugin", status.toString());
495    }
496  }
497  else if ("FinishNewJob".equals(cmd))
498  {
499    dc = sc.newDbControl();
500    Job job = (Job)sc.getSessionSetting("plugin.configure.job");
501    PluginResponse pluginResponse = (PluginResponse)sc.getSessionSetting("plugin.configure.response");
502
503    job.setName(Values.getStringOrNull(request.getParameter("name")));
504    job.setDescription(Values.getStringOrNull(request.getParameter("description")));
505    job.setSendMessage(Values.getBoolean(request.getParameter("send_message")));
506    job.setRemoveJobWhenFinished(Values.getBoolean(request.getParameter("remove_job")));
507    dc.saveItem(job);
508    if (pluginResponse != null) pluginResponse.saveParameters(dc);
509    dc.commit();
510    redirect = "../../views/jobs/index.jsp?ID="+ID+"&cmd=ViewItem&item_id="+job.getId();
511    sc.setSessionSetting("plugin.configure.job", null);
512    sc.setSessionSetting("plugin.configure.request", null);
513    sc.setSessionSetting("plugin.configure.response", null);
514    sc.setSessionSetting("plugin.configure.plugin", null);
515    sc.setSessionSetting("plugin.configure.config", null);
516    sc.setSessionSetting("plugin.configure.currentContext", null);
517    if (pluginResponse != null && pluginResponse.getStatus() == Response.Status.EXECUTE_IMMEDIATELY)
518    {
519      PluginExecutionRequest executionRequest = pluginResponse.getExecutionRequest(null);
520      Thread t = new Thread(executionRequest);
521      t.setPriority(Thread.currentThread().getPriority() - 1);
522      t.start();
523    }
524  }
525  else if ("ExportImmediately".equals(cmd))
526  {
527    PluginResponse pluginResponse = (PluginResponse)sc.getSessionSetting("plugin.configure.response");
528    ExportOutputStream exportStream = new ServletExportOutputStream(response);
529    try
530    {
531      pluginResponse.downloadImmediately(exportStream, null);
532    }
533    catch (Throwable t)
534    {
535      PrintWriter pw = new PrintWriter(exportStream, true);
536      t.printStackTrace(pw);
537      pw.flush();
538      pw.close();
539    }
540    exportStream.flush();
541    exportStream.close();
542    sc.setSessionSetting("plugin.configure.job", null);
543    sc.setSessionSetting("plugin.configure.request", null);
544    sc.setSessionSetting("plugin.configure.response", null);
545    sc.setSessionSetting("plugin.configure.plugin", null);
546    sc.setSessionSetting("plugin.configure.config", null);
547    sc.setSessionSetting("plugin.configure.errors.message", null);
548    sc.setSessionSetting("plugin.configure.errors.list", null);
549    sc.setSessionSetting("plugin.configure.currentContext", null);
550    return;
551  }
552  else if ("CancelWizard".equals(cmd))
553  {
554    PluginConfigurationRequest pcRequest = 
555      (PluginConfigurationRequest)sc.setSessionSetting("plugin.configure.request", null);
556    if (pcRequest != null) pcRequest.done();
557    sc.setSessionSetting("plugin.configure.response", null);
558    sc.setSessionSetting("plugin.configure.plugin", null);
559    sc.setSessionSetting("plugin.configure.config", null);
560    sc.setSessionSetting("plugin.configure.job", null);
561    sc.setSessionSetting("plugin.configure.errors.message", null);
562    sc.setSessionSetting("plugin.configure.errors.list", null);
563    sc.setSessionSetting("plugin.configure.currentContext", null); 
564    redirect = root + "common/close_popup.jsp?refresh_opener=0&wait=0";
565  }
566  else
567  {
568    throw new WebException("popup", "Invalid command", "The command {1} is not recognised as a valid command.", cmd);
569  }
570}
571finally
572{
573  if (dc != null) dc.close();
574}
575
576if (forward != null)
577{
578  pageContext.forward(forward);
579}
580else if (redirect != null)
581{
582  response.sendRedirect(redirect);
583}
584else if (message == null)
585{
586  response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&wait=0");
587}
588else
589{
590  response.sendRedirect(root + "common/close_popup.jsp?refresh_opener=1&message="+HTML.urlEncode(message));
591}
592%>
Note: See TracBrowser for help on using the repository browser.