myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sless...@apache.org
Subject svn commit: r761982 [10/10] - in /myfaces/core/branches/2_0_0/impl/src: main/java/com/ main/java/org/apache/myfaces/application/ main/java/org/apache/myfaces/config/ main/java/org/apache/myfaces/config/impl/digester/ main/java/org/apache/myfaces/config...
Date Sat, 04 Apr 2009 18:45:04 GMT
Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/Classpath.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/Classpath.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/Classpath.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/Classpath.java Sat Apr  4 18:44:59 2009
@@ -0,0 +1,298 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.view.facelets.util;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.JarURLConnection;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLDecoder;
+import java.util.Enumeration;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import java.util.jar.JarEntry;
+import java.util.jar.JarFile;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
+/**
+ * @author Jacob Hookom
+ * @author Roland Huss
+ * @author Ales Justin (ales.justin@jboss.org)
+ * @version $Id: Classpath.java,v 1.10 2008/07/13 19:01:34 rlubke Exp $
+ */
+public final class Classpath
+{
+    private Classpath()
+    {
+    }
+
+    public static URL[] search(String prefix, String suffix) throws IOException
+    {
+        return search(Thread.currentThread().getContextClassLoader(), prefix, suffix);
+    }
+
+    public static URL[] search(ClassLoader loader, String prefix, String suffix) throws IOException
+    {
+        Set<URL> all = new LinkedHashSet<URL>();
+
+        _searchResource(all, loader, prefix, prefix, suffix);
+        _searchResource(all, loader, prefix + "MANIFEST.MF", prefix, suffix);
+
+        URL[] urlArray = (URL[]) all.toArray(new URL[all.size()]);
+
+        return urlArray;
+    }
+
+    private static void _searchResource(Set<URL> result, ClassLoader loader, String resource, String prefix,
+                                        String suffix) throws IOException
+    {
+        for (Enumeration<URL> urls = loader.getResources(resource); urls.hasMoreElements();)
+        {
+            URL url = urls.nextElement();
+            URLConnection conn = url.openConnection();
+            conn.setUseCaches(false);
+            conn.setDefaultUseCaches(false);
+
+            JarFile jar;
+            if (conn instanceof JarURLConnection)
+            {
+                jar = ((JarURLConnection) conn).getJarFile();
+            }
+            else
+            {
+                jar = _getAlternativeJarFile(url);
+            }
+
+            if (jar != null)
+            {
+                _searchJar(loader, result, jar, prefix, suffix);
+            }
+            else
+            {
+                if (!_searchDir(result, new File(URLDecoder.decode(url.getFile(), "UTF-8")), suffix))
+                {
+                    _searchFromURL(result, prefix, suffix, url);
+                }
+            }
+        }
+    }
+
+    private static boolean _searchDir(Set<URL> result, File dir, String suffix) throws IOException
+    {
+        if (dir.exists() && dir.isDirectory())
+        {
+            for (File file : dir.listFiles())
+            {
+                String path = file.getAbsolutePath();
+                if (file.isDirectory())
+                {
+                    _searchDir(result, file, suffix);
+                }
+                else if (path.endsWith(suffix))
+                {
+                    result.add(file.toURI().toURL());
+                }
+            }
+
+            return true;
+        }
+
+        return false;
+    }
+
+    /**
+     * Search from URL. Fall back on prefix tokens if not able to read from original url param.
+     * 
+     * @param result
+     *            the result urls
+     * @param prefix
+     *            the current prefix
+     * @param suffix
+     *            the suffix to match
+     * @param url
+     *            the current url to start search
+     * @throws IOException
+     *             for any error
+     */
+    private static void _searchFromURL(Set<URL> result, String prefix, String suffix, URL url) throws IOException
+    {
+        boolean done = false;
+
+        InputStream is = _getInputStream(url);
+        if (is != null)
+        {
+            try
+            {
+                ZipInputStream zis;
+                if (is instanceof ZipInputStream)
+                {
+                    zis = (ZipInputStream) is;
+                }
+                else
+                {
+                    zis = new ZipInputStream(is);
+                }
+
+                try
+                {
+                    ZipEntry entry = zis.getNextEntry();
+                    // initial entry should not be null
+                    // if we assume this is some inner jar
+                    done = entry != null;
+
+                    while (entry != null)
+                    {
+                        String entryName = entry.getName();
+                        if (entryName.endsWith(suffix))
+                        {
+                            result.add(new URL(url.toExternalForm() + entryName));
+                        }
+
+                        entry = zis.getNextEntry();
+                    }
+                }
+                finally
+                {
+                    zis.close();
+                }
+            }
+            catch (Exception ignore)
+            {
+            }
+        }
+
+        if (!done && prefix.length() > 0)
+        {
+            // we add '/' at the end since join adds it as well
+            String urlString = url.toExternalForm() + "/";
+
+            String[] split = prefix.split("/");
+
+            prefix = _join(split, true);
+
+            String end = _join(split, false);
+
+            url = new URL(urlString.substring(0, urlString.lastIndexOf(end)));
+
+            _searchFromURL(result, prefix, suffix, url);
+        }
+    }
+
+    /**
+     * Join tokens, exlude last if param equals true.
+     * 
+     * @param tokens
+     *            the tokens
+     * @param excludeLast
+     *            do we exclude last token
+     * @return joined tokens
+     */
+    private static String _join(String[] tokens, boolean excludeLast)
+    {
+        StringBuilder join = new StringBuilder();
+        int length = tokens.length - (excludeLast ? 1 : 0);
+        for (int i = 0; i < length; i++)
+        {
+            join.append(tokens[i]).append("/");
+        }
+
+        return join.toString();
+    }
+
+    /**
+     * Open input stream from url. Ignore any errors.
+     * 
+     * @param url
+     *            the url to open
+     * @return input stream or null if not possible
+     */
+    private static InputStream _getInputStream(URL url)
+    {
+        try
+        {
+            return url.openStream();
+        }
+        catch (Throwable t)
+        {
+            return null;
+        }
+    }
+
+    /**
+     * For URLs to JARs that do not use JarURLConnection - allowed by the servlet spec - attempt to produce a JarFile
+     * object all the same. Known servlet engines that function like this include Weblogic and OC4J. This is not a full
+     * solution, since an unpacked WAR or EAR will not have JAR "files" as such.
+     */
+    private static JarFile _getAlternativeJarFile(URL url) throws IOException
+    {
+        String urlFile = url.getFile();
+
+        // Trim off any suffix - which is prefixed by "!/" on Weblogic
+        int separatorIndex = urlFile.indexOf("!/");
+
+        // OK, didn't find that. Try the less safe "!", used on OC4J
+        if (separatorIndex == -1)
+        {
+            separatorIndex = urlFile.indexOf('!');
+        }
+
+        if (separatorIndex != -1)
+        {
+            String jarFileUrl = urlFile.substring(0, separatorIndex);
+            // And trim off any "file:" prefix.
+            if (jarFileUrl.startsWith("file:"))
+            {
+                jarFileUrl = jarFileUrl.substring("file:".length());
+            }
+
+            return new JarFile(jarFileUrl);
+        }
+
+        return null;
+    }
+
+    private static void _searchJar(ClassLoader loader, Set<URL> result, JarFile file, String prefix, String suffix)
+            throws IOException
+    {
+        Enumeration<JarEntry> e = file.entries();
+        while (e.hasMoreElements())
+        {
+            try
+            {
+                String name = e.nextElement().getName();
+                if (name.startsWith(prefix) && name.endsWith(suffix))
+                {
+                    Enumeration<URL> e2 = loader.getResources(name);
+                    while (e2.hasMoreElements())
+                    {
+                        result.add(e2.nextElement());
+                    }
+                }
+            }
+            catch (Throwable t)
+            {
+                // shallow
+            }
+        }
+    }
+
+}

Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/DevTools.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/DevTools.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/DevTools.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/DevTools.java Sat Apr  4 18:44:59 2009
@@ -0,0 +1,379 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.view.facelets.util;
+
+import java.beans.BeanInfo;
+import java.beans.Introspector;
+import java.beans.PropertyDescriptor;
+import java.io.ByteArrayOutputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.io.Writer;
+import java.lang.reflect.Method;
+import java.text.DateFormat;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Date;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.SortedMap;
+import java.util.TreeMap;
+
+import javax.el.Expression;
+import javax.el.ValueExpression;
+import javax.faces.component.UIComponent;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+
+public final class DevTools
+{
+    private final static String TS = "&lt;";
+
+    private static final String DEBUG_TEMPLATE = "META-INF/rsc/facelet-dev-debug.xml";
+    private static final String ERROR_TEMPLATE = "META-INF/rsc/facelet-dev-error.xml";
+    private final static String[] IGNORE = new String[] { "parent", "rendererType" };
+
+
+    private static String[] _debugParts;
+    private static String[] _errorParts;
+
+    private DevTools()
+    {
+    }
+
+    public static void debugHtml(Writer writer, FacesContext faces) throws IOException
+    {
+        _init();
+        
+        Date now = new Date();
+        for (int i = 0; i < _debugParts.length; i++)
+        {
+            if ("message".equals(_debugParts[i]))
+            {
+                writer.write(faces.getViewRoot().getViewId());
+            }
+            else if ("now".equals(_debugParts[i]))
+            {
+                writer.write(DateFormat.getDateTimeInstance().format(now));
+            }
+            else if ("tree".equals(_debugParts[i]))
+            {
+                _writeComponent(writer, faces.getViewRoot());
+            }
+            else if ("vars".equals(_debugParts[i]))
+            {
+                _writeVariables(writer, faces);
+            }
+            else
+            {
+                writer.write(_debugParts[i]);
+            }
+        }
+    }
+
+    public static void debugHtml(Writer writer, FacesContext faces, Exception e) throws IOException
+    {
+        _init();
+        
+        Date now = new Date();
+        for (String part : _errorParts)
+        {
+            if ("message".equals(part))
+            {
+                String msg = e.getMessage();
+                if (msg != null)
+                {
+                    writer.write(msg.replaceAll("<", TS));
+                }
+                else
+                {
+                    writer.write(e.getClass().getName());
+                }
+            }
+            else if ("trace".equals(part))
+            {
+                _writeException(writer, e);
+            }
+            else if ("now".equals(part))
+            {
+                writer.write(DateFormat.getDateTimeInstance().format(now));
+            }
+            else if ("tree".equals(part))
+            {
+                _writeComponent(writer, faces.getViewRoot());
+            }
+            else if ("vars".equals(part))
+            {
+                _writeVariables(writer, faces);
+            }
+            else
+            {
+                writer.write(part);
+            }
+        }
+    }
+
+    private static String _getName(UIComponent c)
+    {
+        String nm = c.getClass().getName();
+        return nm.substring(nm.lastIndexOf('.') + 1);
+    }
+
+    private static void _init() throws IOException
+    {
+        if (_errorParts == null)
+        {
+            _errorParts = _splitTemplate(ERROR_TEMPLATE);
+        }
+
+        if (_debugParts == null)
+        {
+            _debugParts = _splitTemplate(DEBUG_TEMPLATE);
+        }
+    }
+
+    private static boolean _isText(UIComponent c)
+    {
+        return (c.getClass().getName().startsWith("org.apache.myfaces.view.facelets.compiler"));
+    }
+
+    private static String[] _splitTemplate(String rsc) throws IOException
+    {
+        InputStream is = Thread.currentThread().getContextClassLoader().getResourceAsStream(rsc);
+        if (is == null)
+        {
+            throw new FileNotFoundException(rsc);
+        }
+        
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        byte[] buff = new byte[512];
+        int read;
+        while ((read = is.read(buff)) != -1)
+        {
+            baos.write(buff, 0, read);
+        }
+        
+        String str = baos.toString();
+        
+        return str.split("@@");
+    }
+
+    private static void _writeAttributes(Writer writer, UIComponent c)
+    {
+        try
+        {
+            BeanInfo info = Introspector.getBeanInfo(c.getClass());
+            
+            for (PropertyDescriptor descriptor : info.getPropertyDescriptors())
+            {
+                if (descriptor.getWriteMethod() != null && Arrays.binarySearch(IGNORE, descriptor.getName()) < 0)
+                {
+                    Method getter = descriptor.getReadMethod();
+                    try
+                    {
+                        Object value = getter.invoke(c);
+                        if (value != null)
+                        {
+                            if (value instanceof Collection || value instanceof Map || value instanceof Iterator)
+                            {
+                                continue;
+                            }
+                            
+                            writer.write(" ");
+                            writer.write(descriptor.getName());
+                            writer.write("=\"");
+                            
+                            String str;
+                            if (value instanceof Expression)
+                            {
+                                str = ((Expression) value).getExpressionString();
+                            }
+                            else
+                            {
+                                str = value.toString();
+                            }
+                            
+                            writer.write(str.replaceAll("<", TS));
+                            writer.write("\"");
+                        }
+                    }
+                    catch (Exception e)
+                    {
+                        // do nothing
+                    }
+                }
+            }
+
+            ValueExpression binding = c.getValueExpression("binding");
+            if (binding != null)
+            {
+                writer.write(" binding=\"");
+                writer.write(binding.getExpressionString().replaceAll("<", TS));
+                writer.write("\"");
+            }
+        }
+        catch (Exception e)
+        {
+            // do nothing
+        }
+    }
+
+    private static void _writeVariables(Writer writer, FacesContext faces) throws IOException
+    {
+        ExternalContext ctx = faces.getExternalContext();
+        _writeVariables(writer, ctx.getRequestParameterMap(), "Request Parameters");
+        _writeVariables(writer, ctx.getRequestMap(), "Request Attributes");
+        if (ctx.getSession(false) != null)
+        {
+            _writeVariables(writer, ctx.getSessionMap(), "Session Attributes");
+        }
+        
+        _writeVariables(writer, ctx.getApplicationMap(), "Application Attributes");
+    }
+
+    private static void _writeVariables(Writer writer, Map<String, ? extends Object> vars, String caption) throws IOException
+    {
+        writer.write("<table><caption>");
+        writer.write(caption);
+        writer
+                .write("</caption><thead><tr><th style=\"width: 10%; \">Name</th><th style=\"width: 90%; \">Value</th></tr></thead><tbody>");
+        boolean written = false;
+        if (!vars.isEmpty())
+        {
+            SortedMap<String, Object> map = new TreeMap<String, Object>(vars);
+            for (Map.Entry<String, Object> entry : map.entrySet())
+            {
+                String key = entry.getKey();
+                if (key.indexOf('.') == -1)
+                {
+                    writer.write("<tr><td>");
+                    writer.write(key.replaceAll("<", TS));
+                    writer.write("</td><td>");
+                    writer.write(entry.getValue() == null ? "null" : entry.getValue().toString().replaceAll("<", TS));
+                    writer.write("</td></tr>");
+                    written = true;
+                }
+            }
+        }
+        
+        if (!written)
+        {
+            writer.write("<tr><td colspan=\"2\"><em>None</em></td></tr>");
+        }
+        
+        writer.write("</tbody></table>");
+    }
+
+    private static void _writeComponent(Writer writer, UIComponent component) throws IOException
+    {
+        writer.write("<dl><dt");
+        if (_isText(component))
+        {
+            writer.write(" class=\"uicText\"");
+        }
+        writer.write(">");
+
+        Map<String, UIComponent> facets = component.getFacets();
+
+        boolean hasChildren = component.getChildCount() > 0 || !facets.isEmpty();
+
+        _writeStart(writer, component, hasChildren);
+        writer.write("</dt>");
+        if (hasChildren)
+        {
+            if (!facets.isEmpty())
+            {
+                for (Map.Entry<String, UIComponent> entry : facets.entrySet())
+                {
+                    writer.write("<dd class=\"uicFacet\">");
+                    writer.write("<span>");
+                    writer.write(entry.getKey());
+                    writer.write("</span>");
+                    _writeComponent(writer, entry.getValue());
+                    writer.write("</dd>");
+                }
+            }
+            
+            if (component.getChildCount() > 0)
+            {
+                for (UIComponent child : component.getChildren())
+                {
+                    writer.write("<dd>");
+                    _writeComponent(writer, child);
+                    writer.write("</dd>");
+                }
+            }
+            
+            writer.write("<dt>");
+            _writeEnd(writer, component);
+            writer.write("</dt>");
+        }
+        
+        writer.write("</dl>");
+    }
+
+    private static void _writeEnd(Writer writer, UIComponent c) throws IOException
+    {
+        if (!_isText(c))
+        {
+            writer.write(TS);
+            writer.write('/');
+            writer.write(_getName(c));
+            writer.write('>');
+        }
+    }
+
+    private static void _writeException(Writer writer, Exception e) throws IOException
+    {
+        StringWriter str = new StringWriter(256);
+        PrintWriter pstr = new PrintWriter(str);
+        e.printStackTrace(pstr);
+        
+        pstr.close();
+        
+        writer.write(str.toString().replaceAll("<", TS));
+    }
+
+    private static void _writeStart(Writer writer, UIComponent c, boolean children) throws IOException
+    {
+        if (_isText(c))
+        {
+            String str = c.toString().trim();
+            writer.write(str.replaceAll("<", TS));
+        }
+        else
+        {
+            writer.write(TS);
+            writer.write(_getName(c));
+            _writeAttributes(writer, c);
+            if (children)
+            {
+                writer.write('>');
+            }
+            else
+            {
+                writer.write("/>");
+            }
+        }
+    }
+
+}

Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/FastWriter.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/FastWriter.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/FastWriter.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/FastWriter.java Sat Apr  4 18:44:59 2009
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.view.facelets.util;
+
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * @author Jacob Hookom
+ * @version $Id: FastWriter.java,v 1.4 2008/07/13 19:01:34 rlubke Exp $
+ */
+public final class FastWriter extends Writer
+{
+
+    private char[] buff;
+    private int size;
+
+    public FastWriter()
+    {
+        this(1024);
+    }
+
+    public FastWriter(int initialSize)
+    {
+        if (initialSize < 0)
+        {
+            throw new IllegalArgumentException("Initial Size cannot be less than 0");
+        }
+        this.buff = new char[initialSize];
+    }
+
+    public void close() throws IOException
+    {
+        // do nothing
+    }
+
+    public void flush() throws IOException
+    {
+        // do nothing
+    }
+
+    private final void overflow(int len)
+    {
+        if (this.size + len > this.buff.length)
+        {
+            char[] next = new char[(this.size + len) * 2];
+            System.arraycopy(this.buff, 0, next, 0, this.size);
+            this.buff = next;
+        }
+    }
+
+    public void write(char[] cbuf, int off, int len) throws IOException
+    {
+        overflow(len);
+        System.arraycopy(cbuf, off, this.buff, this.size, len);
+        this.size += len;
+    }
+
+    public void write(char[] cbuf) throws IOException
+    {
+        this.write(cbuf, 0, cbuf.length);
+    }
+
+    public void write(int c) throws IOException
+    {
+        this.overflow(1);
+        this.buff[this.size] = (char) c;
+        this.size++;
+    }
+
+    public void write(String str, int off, int len) throws IOException
+    {
+        this.write(str.toCharArray(), off, len);
+    }
+
+    public void write(String str) throws IOException
+    {
+        this.write(str.toCharArray(), 0, str.length());
+    }
+
+    public void reset()
+    {
+        this.size = 0;
+    }
+
+    public String toString()
+    {
+        return new String(this.buff, 0, this.size);
+    }
+}

Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/ParameterCheck.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/ParameterCheck.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/ParameterCheck.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/ParameterCheck.java Sat Apr  4 18:44:59 2009
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.view.facelets.util;
+
+/**
+ * @author Jacob Hookom
+ * @version $Id: ParameterCheck.java,v 1.3 2008/07/13 19:01:34 rlubke Exp $
+ */
+public final class ParameterCheck
+{
+
+    public final static void notNull(String name, Object value) throws NullPointerException
+    {
+        if (value == null)
+        {
+            throw new NullPointerException("Parameter '" + name + "' cannot be null");
+        }
+    }
+
+}

Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/Path.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/Path.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/Path.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/Path.java Sat Apr  4 18:44:59 2009
@@ -0,0 +1,107 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.view.facelets.util;
+
+/**
+ * @author Jacob Hookom
+ * @version $Id: Path.java,v 1.3 2008/07/13 19:01:34 rlubke Exp $
+ */
+public final class Path
+{
+
+    public static final String normalize(String path)
+    {
+        if (path.length() == 0)
+            return path;
+        String n = path;
+        boolean abs = false;
+        while (n.indexOf('\\') >= 0)
+        {
+            n = n.replace('\\', '/');
+        }
+        if (n.charAt(0) != '/')
+        {
+            n = '/' + n;
+            abs = true;
+        }
+        int idx = 0;
+        while (true)
+        {
+            idx = n.indexOf("%20");
+            if (idx == -1)
+            {
+                break;
+            }
+            n = n.substring(0, idx) + " " + n.substring(idx + 3);
+        }
+        while (true)
+        {
+            idx = n.indexOf("/./");
+            if (idx == -1)
+            {
+                break;
+            }
+            n = n.substring(0, idx) + n.substring(idx + 2);
+        }
+        if (abs)
+        {
+            n = n.substring(1);
+        }
+        return n;
+    }
+
+    public static final String relative(String ctx, String path)
+    {
+        if (path.length() == 0)
+        {
+            return context(ctx);
+        }
+        String c = context(normalize(ctx));
+        String p = normalize(path);
+        p = c + p;
+
+        int idx = 0;
+        while (true)
+        {
+            idx = p.indexOf("/../");
+            if (idx == -1)
+            {
+                break;
+            }
+            int s = p.lastIndexOf('/', idx - 3);
+            if (s == -1)
+            {
+                break;
+            }
+            p = p.substring(0, s) + p.substring(idx + 3);
+        }
+        return p;
+    }
+
+    public static final String context(String path)
+    {
+        int idx = path.lastIndexOf('/');
+        if (idx == -1)
+        {
+            return "/";
+        }
+        return path.substring(0, idx + 1);
+    }
+
+}

Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/ReflectionUtil.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/ReflectionUtil.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/ReflectionUtil.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/ReflectionUtil.java Sat Apr  4 18:44:59 2009
@@ -0,0 +1,147 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.view.facelets.util;
+
+import java.lang.reflect.Array;
+import java.util.Arrays;
+
+public class ReflectionUtil
+{
+    protected static final String[] EMPTY_STRING = new String[0];
+
+    protected static final String[] PRIMITIVE_NAMES = new String[] { "boolean", "byte", "char", "double", "float",
+                                                                    "int", "long", "short", "void" };
+
+    protected static final Class<?>[] PRIMITIVES = new Class[] { Boolean.TYPE, Byte.TYPE, Character.TYPE, Double.TYPE,
+                                                                Float.TYPE, Integer.TYPE, Long.TYPE, Short.TYPE,
+                                                                Void.TYPE };
+
+    /**
+     * 
+     */
+    private ReflectionUtil()
+    {
+        super();
+    }
+
+    public static Class<?> forName(String name) throws ClassNotFoundException
+    {
+        if (null == name || "".equals(name))
+        {
+            return null;
+        }
+        
+        Class<?> c = forNamePrimitive(name);
+        if (c == null)
+        {
+            if (name.endsWith("[]"))
+            {
+                String nc = name.substring(0, name.length() - 2);
+                c = Class.forName(nc, false, Thread.currentThread().getContextClassLoader());
+                c = Array.newInstance(c, 0).getClass();
+            }
+            else
+            {
+                c = Class.forName(name, false, Thread.currentThread().getContextClassLoader());
+            }
+        }
+        
+        return c;
+    }
+
+    protected static Class<?> forNamePrimitive(String name)
+    {
+        if (name.length() <= 8)
+        {
+            int p = Arrays.binarySearch(PRIMITIVE_NAMES, name);
+            if (p >= 0)
+            {
+                return PRIMITIVES[p];
+            }
+        }
+        
+        return null;
+    }
+
+    /**
+     * Converts an array of Class names to Class types
+     * 
+     * @param s
+     * @return
+     * @throws ClassNotFoundException
+     */
+    public static Class<?>[] toTypeArray(String[] s) throws ClassNotFoundException
+    {
+        if (s == null)
+        {
+            return null;
+        }
+        
+        Class<?>[] c = new Class[s.length];
+        for (int i = 0; i < s.length; i++)
+        {
+            c[i] = forName(s[i]);
+        }
+        
+        return c;
+    }
+
+    /**
+     * Converts an array of Class types to Class names
+     * 
+     * @param c
+     * @return
+     */
+    public static String[] toTypeNameArray(Class<?>[] c)
+    {
+        if (c == null)
+        {
+            return null;
+        }
+        
+        String[] s = new String[c.length];
+        for (int i = 0; i < c.length; i++)
+        {
+            s[i] = c[i].getName();
+        }
+        
+        return s;
+    }
+
+    protected static final String paramString(Class<?>... types)
+    {
+        if (types != null)
+        {
+            StringBuilder sb = new StringBuilder();
+            for (Class<?> type : types)
+            {
+                sb.append(type.getName()).append(", ");
+            }
+            
+            if (sb.length() > 2)
+            {
+                sb.setLength(sb.length() - 2);
+            }
+            
+            return sb.toString();
+        }
+        
+        return null;
+    }
+}

Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/Resource.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/Resource.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/Resource.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/Resource.java Sat Apr  4 18:44:59 2009
@@ -0,0 +1,165 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.view.facelets.util;
+
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLStreamHandler;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.servlet.ServletContext;
+
+/**
+ * @author Roland Huss
+ * 
+ */
+public final class Resource
+{
+
+    protected final static Logger log = Logger.getLogger("facelets.factory");
+
+    /**
+     * Get an URL of an internal resource. First, {@link javax.faces.context.ExternalContext#getResource(String)} is
+     * checked for an non-null URL return value. In the case of a null return value (as it is the case for Weblogic 8.1
+     * for a packed war), a URL with a special URL handler is constructed, which can be used for <em>opening</em> a
+     * serlvet resource later. Internally, this special URL handler will call
+     * {@link ServletContext#getResourceAsStream(String)} when an inputstream is requested. This works even on Weblogic
+     * 8.1
+     * 
+     * @param ctx
+     *            the faces context from which to retrieve the resource
+     * @param path
+     *            an URL path
+     * 
+     * @return an url representing the URL and on which getInputStream() can be called to get the resource
+     * @throws MalformedURLException
+     */
+    public static URL getResourceUrl(FacesContext ctx, String path) throws MalformedURLException
+    {
+        final ExternalContext externalContext = ctx.getExternalContext();
+        URL url = externalContext.getResource(path);
+        if (log.isLoggable(Level.FINE))
+        {
+            log.fine("Resource-Url from external context: " + url);
+        }
+        if (url == null)
+        {
+            // This might happen on Servlet container which doesnot return
+            // anything
+            // for getResource() (like weblogic 8.1 for packaged wars) we
+            // are trying
+            // to use an own URL protocol in order to use
+            // ServletContext.getResourceAsStream()
+            // when opening the url
+            if (resourceExist(externalContext, path))
+            {
+                url = getUrlForResourceAsStream(externalContext, path);
+            }
+        }
+        return url;
+    }
+
+    // This method could be used above to provide a 'fail fast' if a
+    // resource
+    // doesnt exist. Otherwise, the URL will fail on the first access.
+    private static boolean resourceExist(ExternalContext externalContext, String path)
+    {
+        if ("/".equals(path))
+        {
+            // The root context exists always
+            return true;
+        }
+        Object ctx = externalContext.getContext();
+        if (ctx instanceof ServletContext)
+        {
+            ServletContext servletContext = (ServletContext) ctx;
+            InputStream stream = servletContext.getResourceAsStream(path);
+            if (stream != null)
+            {
+                try
+                {
+                    stream.close();
+                }
+                catch (IOException e)
+                {
+                    // Ignore here, since we donnot wanted to read from this
+                    // resource anyway
+                }
+                return true;
+            }
+        }
+        return false;
+    }
+
+    // Construct URL with special URLStreamHandler for proxying
+    // ServletContext.getResourceAsStream()
+    private static URL getUrlForResourceAsStream(final ExternalContext externalContext, String path)
+            throws MalformedURLException
+    {
+        URLStreamHandler handler = new URLStreamHandler()
+        {
+            protected URLConnection openConnection(URL u) throws IOException
+            {
+                final String file = u.getFile();
+                return new URLConnection(u)
+                {
+                    public void connect() throws IOException
+                    {
+                    }
+
+                    public InputStream getInputStream() throws IOException
+                    {
+                        if (log.isLoggable(Level.FINE))
+                        {
+                            log.fine("Opening internal url to " + file);
+                        }
+                        Object ctx = externalContext.getContext();
+                        // Or maybe fetch the external context afresh ?
+                        // Object ctx =
+                        // FacesContext.getCurrentInstance().getExternalContext().getContext();
+
+                        if (ctx instanceof ServletContext)
+                        {
+                            ServletContext servletContext = (ServletContext) ctx;
+                            InputStream stream = servletContext.getResourceAsStream(file);
+                            if (stream == null)
+                            {
+                                throw new FileNotFoundException("Cannot open resource " + file);
+                            }
+                            return stream;
+                        }
+                        else
+                        {
+                            throw new IOException("Cannot open resource for an context of "
+                                    + (ctx != null ? ctx.getClass() : null));
+                        }
+                    }
+                };
+            }
+        };
+        return new URL("internal", null, 0, path, handler);
+    }
+}

Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/package.html
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/package.html?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/package.html (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/facelets/util/package.html Sat Apr  4 18:44:59 2009
@@ -0,0 +1,23 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<!--
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+
+ $Id: package.html,v 1.3 2008/07/13 19:01:34 rlubke Exp $
+-->
+</head>
+<body bgcolor="white">
+Utility classes for implementation
+</body>
+</html>
\ No newline at end of file

Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/jsp/JspViewDeclarationLanguage.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/jsp/JspViewDeclarationLanguage.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/jsp/JspViewDeclarationLanguage.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/jsp/JspViewDeclarationLanguage.java Sat Apr  4 18:44:59 2009
@@ -0,0 +1,136 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.view.jsp;
+
+import java.beans.BeanInfo;
+import java.io.IOException;
+
+import javax.faces.FacesException;
+import javax.faces.application.Resource;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.FacesContext;
+import javax.faces.view.ViewMetadata;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.myfaces.application.ViewHandlerSupport;
+import org.apache.myfaces.view.ViewDeclarationLanguageBase;
+
+/**
+ * @author Simon Lessard (latest modification by $Author: slessard $)
+ * @version $Revision: 696523 $ $Date: 2009-03-22 13:55:12 -0400 (mer., 17 sept. 2008) $
+ *
+ * @since 2.0
+ */
+public class JspViewDeclarationLanguage extends ViewDeclarationLanguageBase
+{
+    private ViewHandlerSupport _cachedViewHandlerSupport;
+    
+    /**
+     * 
+     */
+    public JspViewDeclarationLanguage()
+    {
+        // TODO: IMPLEMENT HERE
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void buildView(FacesContext context, UIViewRoot view) throws IOException
+    {
+        // TODO: IMPLEMENT HERE
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public BeanInfo getComponentMetadata(FacesContext context, Resource componentResource)
+    {
+        // TODO: IMPLEMENT HERE
+        return null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public Resource getScriptComponentResource(FacesContext context, Resource componentResource)
+    {
+        // TODO: IMPLEMENT HERE
+        return null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ViewMetadata getViewMetadata(FacesContext context, String viewId)
+    {
+        // TODO: IMPLEMENT HERE
+        return null;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public void renderView(FacesContext context, UIViewRoot view) throws IOException
+    {
+        // TODO: IMPLEMENT HERE
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public UIViewRoot restoreView(FacesContext context, String viewId)
+    {
+        // TODO: IMPLEMENT HERE
+        return null;
+    }
+
+    @Override
+    protected String calculateViewId(FacesContext context, String viewId)
+    {
+        if (_cachedViewHandlerSupport == null)
+        {
+            _cachedViewHandlerSupport = null; // TODO: IMPLEMENT HERE
+        }
+        
+        return _cachedViewHandlerSupport.calculateViewId(context, viewId);
+    }
+
+
+    @Override
+    protected void sendSourceNotFound(FacesContext context, String message)
+    {
+        HttpServletResponse response = (HttpServletResponse) context.getExternalContext().getResponse();
+        try
+        {
+            context.responseComplete();
+            response.sendError(HttpServletResponse.SC_NOT_FOUND, message);
+        }
+        catch (IOException ioe)
+        {
+            throw new FacesException(ioe);
+        }
+    }
+}

Added: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/jsp/JspViewDeclarationLanguageStrategy.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/jsp/JspViewDeclarationLanguageStrategy.java?rev=761982&view=auto
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/jsp/JspViewDeclarationLanguageStrategy.java (added)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/view/jsp/JspViewDeclarationLanguageStrategy.java Sat Apr  4 18:44:59 2009
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.view.jsp;
+
+import javax.faces.view.ViewDeclarationLanguage;
+
+import org.apache.myfaces.view.ViewDeclarationLanguageStrategy;
+
+/**
+ * @author Simon Lessard (latest modification by $Author: slessard $)
+ * @version $Revision: 696523 $ $Date: 2009-03-22 13:15:46 -0400 (mer., 17 sept. 2008) $
+ *
+ * @since 2.0
+ */
+public class JspViewDeclarationLanguageStrategy implements ViewDeclarationLanguageStrategy
+{
+    private ViewDeclarationLanguage _language;
+    
+    public JspViewDeclarationLanguageStrategy()
+    {
+        // TODO: IMPLEMENT HERE
+        
+        _language = new JspViewDeclarationLanguage();
+    }
+    
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public ViewDeclarationLanguage getViewDeclarationLanguage()
+    {
+        return _language;
+    }
+
+    /**
+     * {@inheritDoc}
+     */
+    @Override
+    public boolean handles(String viewId)
+    {
+        // TODO: IMPLEMENT HERE
+        return false;
+    }
+}

Modified: myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/webapp/Jsp20FacesInitializer.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/webapp/Jsp20FacesInitializer.java?rev=761982&r1=761981&r2=761982&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/webapp/Jsp20FacesInitializer.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/main/java/org/apache/myfaces/webapp/Jsp20FacesInitializer.java Sat Apr  4 18:44:59 2009
@@ -48,7 +48,7 @@
     /**
      * The ExpressionFactory implementation of the EL-RI.
      */
-    private static final String EL_RI_EXPRESSION_FACTORY_IMPL = "com.sun.el.ExpressionFactoryImpl";
+    private static final String EL_RI_EXPRESSION_FACTORY_IMPL = "com.sun.facelets.el.ExpressionFactoryImpl";
 
     /**
      * Jasper's ExpressionFactory implementation.
@@ -73,7 +73,7 @@
         // the ExpressionFactory implementation to use as there is no JspApplicationContext
         // we could ask for. Having said that, though, the user only has to provide it, if
         // there is no known ExpressionFactory available (i.e. if neither
-        // "com.sun.el.ExpressionFactoryImpl" nor "org.apache.el.ExpressionFactoryImpl"
+        // "com.sun.facelets.el.ExpressionFactoryImpl" nor "org.apache.el.ExpressionFactoryImpl"
         // are available).
         ExpressionFactory expressionFactory = null;
 

Modified: myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/context/ExecutePhaseClientIdsTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/context/ExecutePhaseClientIdsTest.java?rev=761982&r1=761981&r2=761982&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/context/ExecutePhaseClientIdsTest.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/context/ExecutePhaseClientIdsTest.java Sat Apr  4 18:44:59 2009
@@ -16,8 +16,6 @@
 package org.apache.myfaces.context;
 
 import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
 import java.util.Map;
 
 import javax.faces.context.FacesContext;
@@ -51,7 +49,7 @@
         
         PartialViewContext pprContext = context.getPartialViewContext();
 
-        assertTrue(pprContext.getExecutePhaseClientIds().isEmpty());
+        assertTrue(pprContext.getExecuteIds().isEmpty());
     }
 
     /**
@@ -65,7 +63,7 @@
         
         PartialViewContext pprContext = context.getPartialViewContext();
 
-        assertTrue(pprContext.getExecutePhaseClientIds().isEmpty());
+        assertTrue(pprContext.getExecuteIds().isEmpty());
     }
 
     /**
@@ -81,7 +79,7 @@
         
         PartialViewContext pprContext = context.getPartialViewContext();
 
-        assertTrue(pprContext.getExecutePhaseClientIds().isEmpty());
+        assertTrue(pprContext.getExecuteIds().isEmpty());
     }
 
     /**
@@ -97,8 +95,8 @@
         
         PartialViewContext pprContext = context.getPartialViewContext();
 
-        assertTrue("Length must be one",pprContext.getExecutePhaseClientIds().size() == 1);
-        assertTrue("Value match", pprContext.getExecutePhaseClientIds().get(0).equals("view1:panel1:_component1"));
+        assertTrue("Length must be one",pprContext.getExecuteIds().size() == 1);
+        assertTrue("Value match", pprContext.getExecuteIds().iterator().next().equals("view1:panel1:_component1"));
     }
 
     /**
@@ -115,34 +113,13 @@
         
         PartialViewContext pprContext = context.getPartialViewContext();
         
-        assertTrue("Length must be four", pprContext.getExecutePhaseClientIds().size() == 4);
-
-        assertTrue("Value match", pprContext.getExecutePhaseClientIds().get(0).equals("view1:panel1:_component1"));
-        assertTrue("Value match", pprContext.getExecutePhaseClientIds().get(2).equals("component3"));
-
-
-        assertTrue("Value match", pprContext.getExecutePhaseClientIds().get(3).equals("component4"));
-    }
-
-    /**
-     * priority the setter has higer priority
-     * than the request query
-     */
-    public void testSetter1() {
-        List<String> executePhaseClientIds = new LinkedList<String>();
-        executePhaseClientIds.add("component1");
-        executePhaseClientIds.add("component2");
-        String params = " view1:panel1:_component1,view1:panel1:_component2 \n , component3, component4  ";
-        Map<String, String> requestParamMap = new HashMap<String, String>();
-        requestParamMap.put(PartialViewContext.PARTIAL_EXECUTE_PARAM_NAME, params);
-        ContextTestRequestWrapper wrapper = new ContextTestRequestWrapper(request, requestParamMap);
-
-        FacesContext context = new FacesContextImpl(servletContext, wrapper, response);
-        
-        PartialViewContext pprContext = context.getPartialViewContext();
-        
-        pprContext.setExecutePhaseClientIds(executePhaseClientIds);
-        assertTrue(pprContext.getExecutePhaseClientIds().size() == 2);
+        assertTrue("Length must be four", pprContext.getExecuteIds().size() == 4);
 
+        // FIXME: Latest spec uses a Collection so order is not garanteed
+//        assertTrue("Value match", pprContext.getExecuteIds().get(0).equals("view1:panel1:_component1"));
+//        assertTrue("Value match", pprContext.getExecuteIds().get(2).equals("component3"));
+//
+//
+//        assertTrue("Value match", pprContext.getExecuteIds().get(3).equals("component4"));
     }
 }

Modified: myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/context/IsRenderedTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/context/IsRenderedTest.java?rev=761982&r1=761981&r2=761982&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/context/IsRenderedTest.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/context/IsRenderedTest.java Sat Apr  4 18:44:59 2009
@@ -15,8 +15,6 @@
  */
 package org.apache.myfaces.context;
 
-import java.util.HashMap;
-import java.util.Map;
 import javax.faces.context.FacesContext;
 import javax.faces.context.PartialViewContext;
 
@@ -42,70 +40,6 @@
     }
 
     /**
-     * testcase for isExecute non on the faces context
-     * 
-     */
-    public void testIsExecuteNone() {
-        //EXECUTE NONE according to spec only true if:
-        //PARTIAL_EXECUTE_PARAM_NAME is present and has the value of NO_PARTIAL_PHASE_CLIENT_IDS.
-        //otherwise it is false!
-
-        Map<String, String> requestParamMap = new HashMap<String, String>();
-        requestParamMap.put(PartialViewContext.PARTIAL_EXECUTE_PARAM_NAME, 
-                            PartialViewContext.NO_PARTIAL_PHASE_CLIENT_IDS);
-        ContextTestRequestWrapper wrapper = new ContextTestRequestWrapper(request, requestParamMap);
-        FacesContext context = new FacesContextImpl(servletContext, wrapper, response);
-
-        PartialViewContext pprContext = context.getPartialViewContext();
-
-        assertTrue("Execute none set", pprContext.isExecuteNone());
-
-        requestParamMap = new HashMap<String,String>();
-        wrapper = new ContextTestRequestWrapper(request, requestParamMap);
-        context = new FacesContextImpl(servletContext, wrapper, response);
-        assertFalse("Execute none not set", pprContext.isExecuteNone());
-
-        requestParamMap = new HashMap<String,String>();
-        requestParamMap.put(PartialViewContext.PARTIAL_EXECUTE_PARAM_NAME,"pebkac");
-        wrapper = new ContextTestRequestWrapper(request, requestParamMap);
-        context = new FacesContextImpl(servletContext, wrapper, response);
-        assertFalse("Execute none wrong value", pprContext.isExecuteNone());
-    }
-
-    /**
-     * testcase for the isRenderedNone testcase
-     *
-     */
-    public void testIsRenderedNone() {
-
-        //RENDER NONE according to spec only true if:
-        //PARTIAL_RENDER_PARAM_NAME is present and has the value of NO_PARTIAL_PHASE_CLIENT_IDS.
-        //otherwise it is false!
-
-        Map<String, String> requestParamMap = new HashMap<String, String>();
-        requestParamMap.put(PartialViewContext.PARTIAL_RENDER_PARAM_NAME, 
-                            PartialViewContext.NO_PARTIAL_PHASE_CLIENT_IDS);
-        ContextTestRequestWrapper wrapper = new ContextTestRequestWrapper(request, requestParamMap);
-        FacesContext context = new FacesContextImpl(servletContext, wrapper, response);
-        
-        PartialViewContext pprContext = context.getPartialViewContext();
-
-        assertTrue("Render none set", pprContext.isRenderNone());
-
-        requestParamMap = new HashMap<String,String>();
-        wrapper = new ContextTestRequestWrapper(request, requestParamMap);
-        context = new FacesContextImpl(servletContext, wrapper, response);
-        assertFalse("Render none not set", pprContext.isRenderNone());
-
-        requestParamMap = new HashMap<String,String>();
-        requestParamMap.put(PartialViewContext.PARTIAL_RENDER_PARAM_NAME,"pebkac");
-        wrapper = new ContextTestRequestWrapper(request, requestParamMap);
-        context = new FacesContextImpl(servletContext, wrapper, response);
-        assertFalse("Render none wrong value", pprContext.isRenderNone());
-
-    }
-
-    /**
      * tests the basic render all mechanism,
      * no render all due to defaults
      * or a renderAll which

Modified: myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/context/RenderPhaseClientIdsTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/context/RenderPhaseClientIdsTest.java?rev=761982&r1=761981&r2=761982&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/context/RenderPhaseClientIdsTest.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/context/RenderPhaseClientIdsTest.java Sat Apr  4 18:44:59 2009
@@ -16,9 +16,8 @@
 package org.apache.myfaces.context;
 
 import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
 import java.util.Map;
+
 import javax.faces.context.FacesContext;
 import javax.faces.context.PartialViewContext;
 
@@ -53,14 +52,13 @@
         
         PartialViewContext pprContext = context.getPartialViewContext();
 
-        assertTrue(pprContext.getRenderPhaseClientIds().isEmpty());
+        assertTrue(pprContext.getRenderIds().isEmpty());
     }
 
     /**
      * no request param, has to result in an empty list
      */
     public void testRequestParams2() {
-        String empty = "";
         Map<String, String> requestParamMap = new HashMap<String, String>();
         ContextTestRequestWrapper wrapper = new ContextTestRequestWrapper(request, requestParamMap);
 
@@ -68,7 +66,7 @@
         
         PartialViewContext pprContext = context.getPartialViewContext();
 
-        assertTrue(pprContext.getRenderPhaseClientIds().isEmpty());
+        assertTrue(pprContext.getRenderIds().isEmpty());
     }
 
     /**
@@ -84,7 +82,7 @@
         
         PartialViewContext pprContext = context.getPartialViewContext();
 
-        assertTrue(pprContext.getRenderPhaseClientIds().isEmpty());
+        assertTrue(pprContext.getRenderIds().isEmpty());
     }
 
     /**
@@ -100,8 +98,8 @@
         
         PartialViewContext pprContext = context.getPartialViewContext();
 
-        assertTrue("Length must be one",pprContext.getRenderPhaseClientIds().size() == 1);
-        assertTrue("Value match",pprContext.getRenderPhaseClientIds().get(0).equals("view1:panel1:_component1"));
+        assertTrue("Length must be one",pprContext.getRenderIds().size() == 1);
+        assertTrue("Value match",pprContext.getRenderIds().iterator().next().equals("view1:panel1:_component1"));
     }
 
     /**
@@ -118,35 +116,13 @@
         
         PartialViewContext pprContext = context.getPartialViewContext();
 
-        assertTrue("Length must be four",pprContext.getRenderPhaseClientIds().size() == 4);
-
-        assertTrue("Value match",pprContext.getRenderPhaseClientIds().get(0).equals("view1:panel1:_component1"));
-        assertTrue("Value match",pprContext.getRenderPhaseClientIds().get(2).equals("component3"));
-
-
-        assertTrue("Value match",pprContext.getRenderPhaseClientIds().get(3).equals("component4"));
-    }
-
-    /**
-     * priority the setter has higer priority
-     * than the request query
-     */
-    public void testSetter1() {
-        List<String> renderPhaseClientIds = new LinkedList<String>();
-        renderPhaseClientIds.add("component1");
-        renderPhaseClientIds.add("component2");
-        String params = " view1:panel1:_component1,view1:panel1:_component2 \n , component3, component4  ";
-        Map<String, String> requestParamMap = new HashMap<String, String>();
-        requestParamMap.put(PartialViewContext.PARTIAL_RENDER_PARAM_NAME, params);
-        ContextTestRequestWrapper wrapper = new ContextTestRequestWrapper(request, requestParamMap);
-
-        FacesContext context = new FacesContextImpl(servletContext, wrapper, response);
-        
-        PartialViewContext pprContext = context.getPartialViewContext();
-
-        pprContext.setRenderPhaseClientIds(renderPhaseClientIds);
-        assertTrue(pprContext.getRenderPhaseClientIds().size() == 2);
+        assertTrue("Length must be four",pprContext.getRenderIds().size() == 4);
 
+        // FIXME: Latest spec uses a Collection so order is not garanteed
+//        assertTrue("Value match",pprContext.getRenderIds().get(0).equals("view1:panel1:_component1"));
+//        assertTrue("Value match",pprContext.getRenderIds().get(2).equals("component3"));
+//
+//
+//        assertTrue("Value match",pprContext.getRenderIds().get(3).equals("component4"));
     }
-
 }

Modified: myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/context/ResponseWrapperSwitchTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/context/ResponseWrapperSwitchTest.java?rev=761982&r1=761981&r2=761982&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/context/ResponseWrapperSwitchTest.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/context/ResponseWrapperSwitchTest.java Sat Apr  4 18:44:59 2009
@@ -176,7 +176,9 @@
 
     /**
      * Test switch off on the writer api
-     */
+     * 
+     * FIXME: enableResponseWriting no longer exists.
+     *
     public void testSwitchOffWriter() {
         ByteArrayOutputStream ostr = new ByteArrayOutputStream();
         ByteArrayOutputStream ostrWriter = new ByteArrayOutputStream();
@@ -215,14 +217,17 @@
         assertTrue(ostrWriter.toString().trim().equals(""));
 
 
-    }
+    }*/
 
     /**
+     * 
+     * FIXME: enableResponseWriting no longer exists.
+     * 
      * test switch off on the stream api
      * if this works then the stream switch
      * shoud work on the facesContext should work as well!
      * @throws java.io.IOException
-     */
+     *
     public void testSwitchOffOstr() {
         ByteArrayOutputStream ostr = new ByteArrayOutputStream();
         ByteArrayOutputStream ostrWriter = new ByteArrayOutputStream();
@@ -249,5 +254,5 @@
         assertTrue(ostr.toString().trim().equals(""));
 
 
-    }
+    }*/
 }

Modified: myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/lifecycle/RestoreViewExecutorTest.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/lifecycle/RestoreViewExecutorTest.java?rev=761982&r1=761981&r2=761982&view=diff
==============================================================================
--- myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/lifecycle/RestoreViewExecutorTest.java (original)
+++ myfaces/core/branches/2_0_0/impl/src/test/java/org/apache/myfaces/lifecycle/RestoreViewExecutorTest.java Sat Apr  4 18:44:59 2009
@@ -26,8 +26,8 @@
 import javax.faces.application.ViewExpiredException;
 import javax.faces.application.ViewHandler;
 import javax.faces.component.UIViewRoot;
-import javax.faces.event.AfterAddToParentEvent;
 import javax.faces.event.PhaseId;
+import javax.faces.event.PostAddToViewEvent;
 
 import org.apache.myfaces.FacesTestCase;
 import org.apache.myfaces.TestRunner;
@@ -83,13 +83,13 @@
         setupWOExistingViewRoot();
         expect(_restoreViewSupport.isPostback(same(_facesContext))).andReturn(false);
         _facesContext.renderResponse();
-        
+
         UIViewRoot viewRoot = _mocksControl.createMock(UIViewRoot.class);
-        viewRoot.subscribeToEvent(same(AfterAddToParentEvent.class), same(viewRoot));
-        
+        viewRoot.subscribeToEvent(same(PostAddToViewEvent.class), same(viewRoot));
+
         expect(_viewHandler.createView(same(_facesContext), eq("calculatedViewId"))).andReturn(viewRoot);
-        
-        _application.publishEvent(same(AfterAddToParentEvent.class), same(viewRoot));
+
+        _application.publishEvent(same(PostAddToViewEvent.class), same(viewRoot));
         _facesContext.setViewRoot(same(viewRoot));
 
         _mocksControl.replay();



Mime
View raw message