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

Last change on this file since 3536 was 3536, checked in by Martin Svensson, 16 years ago

References #625. This will correct the issue related to #657

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