1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.portal.kernel.scripting;
16  
17  import java.util.Map;
18  import java.util.Set;
19  
20  import javax.portlet.PortletConfig;
21  import javax.portlet.PortletContext;
22  import javax.portlet.PortletRequest;
23  import javax.portlet.PortletResponse;
24  
25  /**
26   * <a href="ScriptingUtil.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Alberto Montero
29   * @author Brian Wing Shun Chan
30   */
31  public class ScriptingUtil {
32  
33      public static void clearCache(String language) throws ScriptingException {
34          getScripting().clearCache(language);
35      }
36  
37      public static Map<String, Object> eval(
38              Set<String> allowedClasses, Map<String, Object> inputObjects,
39              Set<String> outputNames, String language, String script)
40          throws ScriptingException {
41  
42          return getScripting().eval(
43              allowedClasses, inputObjects, outputNames, language, script);
44      }
45  
46      public static void exec(
47              Set<String> allowedClasses, Map<String, Object> inputObjects,
48              String language, String script)
49          throws ScriptingException {
50  
51          getScripting().exec(allowedClasses, inputObjects, language, script);
52      }
53  
54      public static Map<String, Object> getPortletObjects(
55          PortletConfig portletConfig, PortletContext portletContext,
56          PortletRequest portletRequest, PortletResponse portletResponse) {
57  
58          return getScripting().getPortletObjects(
59              portletConfig, portletContext, portletRequest, portletResponse);
60      }
61  
62      public static Scripting getScripting() {
63          return _scripting;
64      }
65  
66      public static Set<String> getSupportedLanguages() {
67          return getScripting().getSupportedLanguages();
68      }
69  
70      public void setScripting(Scripting scripting) {
71          _scripting = scripting;
72      }
73  
74      private static Scripting _scripting;
75  
76  }