001    /**
002     * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
003     *
004     * The contents of this file are subject to the terms of the Liferay Enterprise
005     * Subscription License ("License"). You may not use this file except in
006     * compliance with the License. You can obtain a copy of the License by
007     * contacting Liferay, Inc. See the License for the specific language governing
008     * permissions and limitations under the License, including but not limited to
009     * distribution rights of the Software.
010     *
011     *
012     *
013     */
014    
015    package com.liferay.portal.kernel.scripting;
016    
017    import java.util.Map;
018    import java.util.Set;
019    
020    import javax.portlet.PortletConfig;
021    import javax.portlet.PortletContext;
022    import javax.portlet.PortletRequest;
023    import javax.portlet.PortletResponse;
024    
025    /**
026     * @author Alberto Montero
027     * @author Brian Wing Shun Chan
028     */
029    public class ScriptingUtil {
030    
031            public static void clearCache(String language) throws ScriptingException {
032                    getScripting().clearCache(language);
033            }
034    
035            public static Map<String, Object> eval(
036                            Set<String> allowedClasses, Map<String, Object> inputObjects,
037                            Set<String> outputNames, String language, String script)
038                    throws ScriptingException {
039    
040                    return getScripting().eval(
041                            allowedClasses, inputObjects, outputNames, language, script);
042            }
043    
044            public static void exec(
045                            Set<String> allowedClasses, Map<String, Object> inputObjects,
046                            String language, String script)
047                    throws ScriptingException {
048    
049                    getScripting().exec(allowedClasses, inputObjects, language, script);
050            }
051    
052            public static Map<String, Object> getPortletObjects(
053                    PortletConfig portletConfig, PortletContext portletContext,
054                    PortletRequest portletRequest, PortletResponse portletResponse) {
055    
056                    return getScripting().getPortletObjects(
057                            portletConfig, portletContext, portletRequest, portletResponse);
058            }
059    
060            public static Scripting getScripting() {
061                    return _scripting;
062            }
063    
064            public static Set<String> getSupportedLanguages() {
065                    return getScripting().getSupportedLanguages();
066            }
067    
068            public void setScripting(Scripting scripting) {
069                    _scripting = scripting;
070            }
071    
072            private static Scripting _scripting;
073    
074    }