You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by lu...@apache.org on 2013/02/08 00:49:35 UTC

svn commit: r1443795 - in /myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow: ./ builder/

Author: lu4242
Date: Thu Feb  7 23:49:35 2013
New Revision: 1443795

URL: http://svn.apache.org/r1443795
Log:
MYFACES-3691 Implement Faces Flows (FlowBuilder support)

Added:
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/   (with props)
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowCallNodeImpl.java   (with props)
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowHandlerFactoryImpl.java   (with props)
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowHandlerImpl.java   (with props)
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowImpl.java   (with props)
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowNodeImpl.java   (with props)
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/Freezable.java   (with props)
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/MethodCallNodeImpl.java   (with props)
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/ParameterImpl.java   (with props)
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/ReturnNodeImpl.java   (with props)
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/SwitchCaseImpl.java   (with props)
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/SwitchNodeImpl.java   (with props)
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/ViewNodeImpl.java   (with props)
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/   (with props)
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/FlowBuilderImpl.java   (with props)
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/FlowCallBuilderImpl.java   (with props)
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/MethodCallBuilderImpl.java   (with props)
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/ReturnBuilderImpl.java   (with props)
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/SwitchBuilderImpl.java   (with props)
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/SwitchCaseBuilderImpl.java   (with props)
    myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/ViewBuilderImpl.java   (with props)

Propchange: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/
------------------------------------------------------------------------------
    bugtraq:number = true

Added: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowCallNodeImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowCallNodeImpl.java?rev=1443795&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowCallNodeImpl.java (added)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowCallNodeImpl.java Thu Feb  7 23:49:35 2013
@@ -0,0 +1,119 @@
+/*
+ * 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.flow;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+import javax.faces.context.FacesContext;
+import javax.faces.flow.FlowCallNode;
+import javax.faces.flow.Parameter;
+
+/**
+ *
+ * @since 2.2
+ * @author Leonardo Uribe
+ */
+public class FlowCallNodeImpl extends FlowCallNode implements Freezable
+{
+    private String _id;
+    private String _calledFlowId;
+    private String _calledFlowDocumentId;
+    
+    private Map<String, Parameter> _outboundParametersMap;
+    private Map<String, Parameter>_unmodifiableOutboundParametersMap;
+    
+    private boolean _initialized;
+
+    public FlowCallNodeImpl(String id)
+    {
+        this._id = id;
+        _outboundParametersMap = new HashMap<String, Parameter>();
+        _unmodifiableOutboundParametersMap = Collections.unmodifiableMap(_outboundParametersMap);
+    }
+    
+    @Override
+    public Map<String, Parameter> getOutboundParameters()
+    {
+        return _unmodifiableOutboundParametersMap;
+    }
+    
+    public void putOutboundParameter(String key, Parameter value)
+    {
+        checkInitialized();
+        _outboundParametersMap.put(key, value);
+    }
+
+    @Override
+    public String getCalledFlowDocumentId(FacesContext context)
+    {
+        return _calledFlowDocumentId;
+    }
+
+    @Override
+    public String getCalledFlowId(FacesContext context)
+    {
+        return _calledFlowId;
+    }
+
+    @Override
+    public String getId()
+    {
+        return _id;
+    }
+
+    public void setId(String id)
+    {
+        checkInitialized();
+        this._id = id;
+    }
+
+    public void setCalledFlowId(String calledFlowId)
+    {
+        checkInitialized();
+        this._calledFlowId = calledFlowId;
+    }
+
+    public void setCalledFlowDocumentId(String calledFlowDocumentId)
+    {
+        checkInitialized();
+        this._calledFlowDocumentId = calledFlowDocumentId;
+    }
+    
+    public void freeze()
+    {
+        _initialized = true;
+        
+        for (Map.Entry<String, Parameter> entry : _outboundParametersMap.entrySet())
+        {
+            if (entry.getValue() instanceof Freezable)
+            {
+                ((Freezable)entry.getValue()).freeze();
+            }
+        }
+    }
+    
+    private void checkInitialized() throws IllegalStateException
+    {
+        if (_initialized)
+        {
+            throw new IllegalStateException("Flow is inmutable once initialized");
+        }
+    }
+}

Propchange: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowCallNodeImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowHandlerFactoryImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowHandlerFactoryImpl.java?rev=1443795&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowHandlerFactoryImpl.java (added)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowHandlerFactoryImpl.java Thu Feb  7 23:49:35 2013
@@ -0,0 +1,39 @@
+/*
+ * 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.flow;
+
+import javax.faces.context.FacesContext;
+import javax.faces.flow.FlowHandler;
+import javax.faces.flow.FlowHandlerFactory;
+
+/**
+ *
+ * @since 2.2
+ * @author Leonardo Uribe
+ */
+public class FlowHandlerFactoryImpl extends FlowHandlerFactory
+{
+
+    @Override
+    public FlowHandler createFlowHandler(FacesContext context)
+    {
+        return new FlowHandlerImpl();
+    }
+    
+}

Propchange: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowHandlerFactoryImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowHandlerImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowHandlerImpl.java?rev=1443795&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowHandlerImpl.java (added)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowHandlerImpl.java Thu Feb  7 23:49:35 2013
@@ -0,0 +1,70 @@
+/*
+ * 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.flow;
+
+import java.util.Map;
+import javax.faces.context.FacesContext;
+import javax.faces.flow.Flow;
+import javax.faces.flow.FlowCallNode;
+import javax.faces.flow.FlowHandler;
+
+/**
+ *
+ * @since 2.2
+ * @author Leonardo Uribe
+ */
+public class FlowHandlerImpl extends FlowHandler
+{
+
+    @Override
+    public Map<Object, Object> getCurrentFlowScope()
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Flow getFlow(FacesContext context, String definingDocumentId, String id)
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void addFlow(FacesContext context, Flow toAdd)
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public Flow getCurrentFlow(FacesContext context)
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public void transition(FacesContext context, Flow sourceFlow, Flow targetFlow, FlowCallNode outboundCallNode)
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    @Override
+    public boolean isActive(FacesContext context, String definingDocument, String id)
+    {
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+}

Propchange: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowHandlerImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowImpl.java?rev=1443795&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowImpl.java (added)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowImpl.java Thu Feb  7 23:49:35 2013
@@ -0,0 +1,313 @@
+/*
+ * 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.flow;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import javax.el.MethodExpression;
+import javax.faces.flow.Flow;
+import javax.faces.flow.FlowCallNode;
+import javax.faces.flow.FlowNode;
+import javax.faces.flow.MethodCallNode;
+import javax.faces.flow.Parameter;
+import javax.faces.flow.ReturnNode;
+import javax.faces.flow.SwitchNode;
+import javax.faces.flow.ViewNode;
+import javax.faces.lifecycle.ClientWindow;
+
+/**
+ *
+ * @since 2.2
+ * @author Leonardo Uribe
+ */
+public class FlowImpl extends Flow implements Freezable
+{
+    private MethodExpression _initializer;
+    private MethodExpression _finalizer;
+    private String _startNodeId;
+    private String _id;
+    private String _definingDocumentId;
+    
+    // The idea is use a normal HashMap, since there will not be modifications
+    // after initialization ( all setters must call checkInitialized() )
+    private Map<String, Parameter> _inboundParametersMap;
+    private Map<String, FlowCallNode> _flowCallsMap;
+    private List<MethodCallNode> _methodCallsList;
+    private Map<String, ReturnNode> _returnsMap;
+    private Map<String, SwitchNode> _switchesMap;
+    private List<ViewNode> _viewsList;
+    
+    // Note this class should be thread safe and inmutable once
+    // the flow is initialized or placed into service by the runtime.
+    private Map<String, Parameter> _unmodifiableInboundParametersMap;
+    private Map<String, FlowCallNode> _unmodifiableFlowCallsMap;
+    private List<MethodCallNode> _unmodifiableMethodCallsList;
+    private Map<String, ReturnNode> _unmodifiableReturnsMap;
+    private Map<String, SwitchNode> _unmodifiableSwitchesMap;
+    private List<ViewNode> _unmodifiableViewsList;
+    
+    // No need to make it volatile, because FlowImpl instances are
+    // created and initialized only at application startup, by a single
+    // thread.
+    private boolean _initialized;
+    
+    public FlowImpl()
+    {
+        _inboundParametersMap = new HashMap<String, Parameter>();
+        _flowCallsMap = new HashMap<String, FlowCallNode>();
+        _methodCallsList = new ArrayList<MethodCallNode>();
+        _returnsMap = new HashMap<String, ReturnNode>();
+        _switchesMap = new HashMap<String, SwitchNode>();
+        _viewsList = new ArrayList<ViewNode>();
+        
+        // Collections.unmodifiableMap(...) uses delegation pattern, so as long
+        // as we don't modify _inboundParametersMap in the wrong time, it
+        // will be thread safe and inmutable.
+        _unmodifiableInboundParametersMap = Collections.unmodifiableMap(_inboundParametersMap);
+        _unmodifiableFlowCallsMap = Collections.unmodifiableMap(_flowCallsMap);
+        _unmodifiableMethodCallsList = Collections.unmodifiableList(_methodCallsList);
+        _unmodifiableReturnsMap = Collections.unmodifiableMap(_returnsMap);
+        _unmodifiableSwitchesMap = Collections.unmodifiableMap(_switchesMap);
+        _unmodifiableViewsList = Collections.unmodifiableList(_viewsList);
+
+    }
+    
+    public void freeze()
+    {
+        _initialized = true;
+        
+        for (Map.Entry<String, Parameter> entry : _inboundParametersMap.entrySet())
+        {
+            if (entry.getValue() instanceof Freezable)
+            {
+                ((Freezable)entry.getValue()).freeze();
+            }
+        }
+            
+        for (Map.Entry<String, FlowCallNode> entry : _flowCallsMap.entrySet())
+        {
+            if (entry.getValue() instanceof Freezable)
+            {
+                ((Freezable)entry.getValue()).freeze();
+            }
+        }
+
+        for (MethodCallNode value : _methodCallsList)
+        {
+            if (value instanceof Freezable)
+            {
+                ((Freezable)value).freeze();
+            }
+        }
+
+        for (Map.Entry<String, ReturnNode> entry : _returnsMap.entrySet())
+        {
+            if (entry.getValue() instanceof Freezable)
+            {
+                ((Freezable)entry.getValue()).freeze();
+            }
+        }
+
+        for (Map.Entry<String, SwitchNode> entry : _switchesMap.entrySet())
+        {
+            if (entry.getValue() instanceof Freezable)
+            {
+                ((Freezable)entry.getValue()).freeze();
+            }
+        }
+        
+        for (ViewNode value : _viewsList)
+        {
+            if (value instanceof Freezable)
+            {
+                ((Freezable)value).freeze();
+            }
+        }
+    }
+
+    @Override
+    public String getClientWindowFlowId(ClientWindow curWindow)
+    {
+        String id = getId();
+        // Faces Flow relies on ClientWindow feature, so it should be enabled,
+        // and the expected id cannot be null.
+        String windowId = curWindow.getId();
+        StringBuilder sb = new StringBuilder( id.length() + 1 + windowId.length() );
+        sb.append(windowId).append('_').append(id);
+        return sb.toString();
+    }
+
+    @Override
+    public String getDefiningDocumentId()
+    {
+        return _definingDocumentId;
+    }
+    
+    public void setDefiningDocumentId(String definingDocumentId)
+    {
+        checkInitialized();
+        _definingDocumentId = definingDocumentId;
+    }
+
+    @Override
+    public String getId()
+    {
+        return _id;
+    }
+    
+    public void setId(String id)
+    {
+        checkInitialized();
+        _id = id;
+    }
+
+    @Override
+    public MethodExpression getInitializer()
+    {
+        return _initializer;
+    }
+    
+    public void setInitializer(MethodExpression initializer)
+    {
+        checkInitialized();
+        _initializer = initializer;
+    }
+
+    @Override
+    public MethodExpression getFinalizer()
+    {
+        return _finalizer;
+    }
+    
+    public void setFinalizer(MethodExpression finalizer)
+    {
+        checkInitialized();
+        _finalizer = finalizer;
+    }
+
+    @Override
+    public String getStartNodeId()
+    {
+        return _startNodeId;
+    }
+    
+    public void setStartNodeId(String startNodeId)
+    {
+        checkInitialized();
+        _startNodeId = startNodeId;
+    }
+    
+    @Override
+    public Map<String, Parameter> getInboundParameters()
+    {
+        return _unmodifiableInboundParametersMap;
+    }
+    
+    public void putInboundParameter(String key, Parameter value)
+    {
+        checkInitialized();
+        _inboundParametersMap.put(key, value);
+    }
+    
+    @Override
+    public Map<String, FlowCallNode> getFlowCalls()
+    {
+        return _unmodifiableFlowCallsMap;
+    }
+    
+    public void putFlowCall(String key, FlowCallNode value)
+    {
+        checkInitialized();
+        _flowCallsMap.put(key, value);
+    }
+
+    @Override
+    public List<MethodCallNode> getMethodCalls()
+    {
+        return _unmodifiableMethodCallsList;
+    }
+
+    public void addMethodCall(MethodCallNode value)
+    {
+        checkInitialized();
+        _methodCallsList.add(value);
+    }
+
+    @Override
+    public Map<String, ReturnNode> getReturns()
+    {
+        return _unmodifiableReturnsMap;
+    }
+    
+    public void putReturn(String key, ReturnNode value)
+    {
+        checkInitialized();
+        _returnsMap.put(key, value);
+    }
+
+    @Override
+    public Map<String, SwitchNode> getSwitches()
+    {
+        return _unmodifiableSwitchesMap;
+    }
+    
+    public void putSwitch(String key, SwitchNode value)
+    {
+        checkInitialized();
+        _switchesMap.put(key, value);
+    }
+
+    @Override
+    public List<ViewNode> getViews()
+    {
+        return _unmodifiableViewsList;
+    }
+    
+    public void addView(ViewNode value)
+    {
+        checkInitialized();
+        _viewsList.add(value);
+    }
+
+    @Override
+    public FlowCallNode getFlowCall(Flow targetFlow)
+    {
+        //TODO: Implement me!
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+    
+    @Override
+    public FlowNode getNode(String nodeId)
+    {
+        //TODO: Implement me!
+        throw new UnsupportedOperationException("Not supported yet.");
+    }
+
+    private void checkInitialized() throws IllegalStateException
+    {
+        if (_initialized)
+        {
+            throw new IllegalStateException("Flow is inmutable once initialized");
+        }
+    }
+    
+}

Propchange: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowNodeImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowNodeImpl.java?rev=1443795&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowNodeImpl.java (added)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowNodeImpl.java Thu Feb  7 23:49:35 2013
@@ -0,0 +1,63 @@
+/*
+ * 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.flow;
+
+import javax.faces.flow.FlowNode;
+
+/**
+ *
+ * @since 2.2
+ * @author Leonardo Uribe
+ */
+public class FlowNodeImpl extends FlowNode implements Freezable
+{
+    private String _id;
+    
+    private boolean _initialized;
+
+    public FlowNodeImpl(String id)
+    {
+        this._id = id;
+    }
+
+    @Override
+    public String getId()
+    {
+        return _id;
+    }
+
+    public void setId(String id)
+    {
+        checkInitialized();
+        this._id = id;
+    }
+
+    public void freeze()
+    {
+        _initialized = true;
+    }
+    
+    private void checkInitialized() throws IllegalStateException
+    {
+        if (_initialized)
+        {
+            throw new IllegalStateException("Flow is inmutable once initialized");
+        }
+    }
+}

Propchange: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/FlowNodeImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/Freezable.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/Freezable.java?rev=1443795&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/Freezable.java (added)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/Freezable.java Thu Feb  7 23:49:35 2013
@@ -0,0 +1,33 @@
+/*
+ * 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.flow;
+
+/**
+ * Objects of classes implementing this class can be made inmutable calling
+ * freeze() method.
+ * 
+ * @author Leonardo Uribe
+ */
+public interface Freezable
+{
+    /**
+     * Call this method when the object will be made available to the runtime
+     */
+    public void freeze();
+}

Propchange: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/Freezable.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/MethodCallNodeImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/MethodCallNodeImpl.java?rev=1443795&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/MethodCallNodeImpl.java (added)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/MethodCallNodeImpl.java Thu Feb  7 23:49:35 2013
@@ -0,0 +1,120 @@
+/*
+ * 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.flow;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+import javax.faces.flow.MethodCallNode;
+import javax.faces.flow.Parameter;
+
+/**
+ *
+ * @since 2.2
+ * @author Leonardo Uribe
+ */
+public class MethodCallNodeImpl extends MethodCallNode implements Freezable
+{
+    private String _id;
+    private MethodExpression _methodExpression;
+    private ValueExpression _outcome;
+    
+    private List<Parameter> _parameters;
+    private List<Parameter> _unmodifiableParameters;
+    
+    private boolean _initialized;
+    
+    public MethodCallNodeImpl(String methodCallNodeId)
+    {
+        this._id = methodCallNodeId;
+        _parameters = new ArrayList<Parameter>();
+        _unmodifiableParameters = Collections.unmodifiableList(_parameters);
+    }
+
+    @Override
+    public MethodExpression getMethodExpression()
+    {
+        return _methodExpression;
+    }
+
+    @Override
+    public ValueExpression getOutcome()
+    {
+        return _outcome;
+    }
+
+    @Override
+    public List<Parameter> getParameters()
+    {
+        return _unmodifiableParameters;
+    }
+    
+    public void addParameter(Parameter parameter)
+    {
+        checkInitialized();
+        _parameters.add(parameter);
+    }
+
+    @Override
+    public String getId()
+    {
+        return _id;
+    }
+    
+    public void freeze()
+    {
+        _initialized = true;
+        
+        for (Parameter value : _parameters)
+        {
+            if (value instanceof Freezable)
+            {
+                ((Freezable)value).freeze();
+            }
+        }
+    }
+    
+    private void checkInitialized() throws IllegalStateException
+    {
+        if (_initialized)
+        {
+            throw new IllegalStateException("Flow is inmutable once initialized");
+        }
+    }
+
+    public void setMethodExpression(MethodExpression methodExpression)
+    {
+        checkInitialized();
+        this._methodExpression = methodExpression;
+    }
+
+    public void setOutcome(ValueExpression outcome)
+    {
+        checkInitialized();
+        this._outcome = outcome;
+    }
+
+    public void setId(String id)
+    {
+        checkInitialized();
+        this._id = id;
+    }
+}

Propchange: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/MethodCallNodeImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/ParameterImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/ParameterImpl.java?rev=1443795&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/ParameterImpl.java (added)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/ParameterImpl.java Thu Feb  7 23:49:35 2013
@@ -0,0 +1,78 @@
+/*
+ * 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.flow;
+
+import javax.el.ValueExpression;
+import javax.faces.flow.Parameter;
+
+/**
+ *
+ * @since 2.2
+ * @author Leonardo Uribe
+ */
+public class ParameterImpl extends Parameter implements Freezable
+{
+    private String _name;
+    private ValueExpression _value;
+
+    private boolean _initialized;
+    
+    public ParameterImpl(String name, ValueExpression value)
+    {
+        this._name = name;
+        this._value = value;
+    }
+
+    @Override
+    public String getName()
+    {
+        return _name;
+    }
+
+    @Override
+    public ValueExpression getValue()
+    {
+        return _value;
+    }
+    
+    public void freeze()
+    {
+        _initialized = true;
+    }
+    
+    private void checkInitialized() throws IllegalStateException
+    {
+        if (_initialized)
+        {
+            throw new IllegalStateException("Flow is inmutable once initialized");
+        }
+    }
+
+    public void setName(String name)
+    {
+        checkInitialized();
+        this._name = name;
+    }
+
+    public void setValue(ValueExpression value)
+    {
+        checkInitialized();
+        this._value = value;
+    }
+}
\ No newline at end of file

Propchange: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/ParameterImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/ReturnNodeImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/ReturnNodeImpl.java?rev=1443795&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/ReturnNodeImpl.java (added)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/ReturnNodeImpl.java Thu Feb  7 23:49:35 2013
@@ -0,0 +1,91 @@
+/*
+ * 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.flow;
+
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+import javax.faces.flow.ReturnNode;
+
+/**
+ *
+ * @since 2.2
+ * @author Leonardo Uribe
+ */
+public class ReturnNodeImpl extends ReturnNode implements Freezable
+{
+    private String _fromOutcome;
+    private ValueExpression _fromOutcomeEL;
+    private String _id;
+
+    private boolean _initialized;
+
+    public ReturnNodeImpl(String returnNodeId)
+    {
+        this._id = returnNodeId;
+    }
+    
+    @Override
+    public String getFromOutcome(FacesContext context)
+    {
+        if (_fromOutcomeEL != null)
+        {
+            return (String) _fromOutcomeEL.getValue(context.getELContext());
+        }
+        return _fromOutcome;
+    }
+
+    @Override
+    public String getId()
+    {
+        return _id;
+    }
+    
+    public void freeze()
+    {
+        _initialized = true;
+    }
+    
+    private void checkInitialized() throws IllegalStateException
+    {
+        if (_initialized)
+        {
+            throw new IllegalStateException("Flow is inmutable once initialized");
+        }
+    }
+
+    public void setFromOutcome(String fromOutcome)
+    {
+        checkInitialized();
+        this._fromOutcome = fromOutcome;
+        this._fromOutcomeEL = null;
+    }
+    
+    public void setFromOutcome(ValueExpression fromOutcome)
+    {
+        checkInitialized();
+        this._fromOutcomeEL = fromOutcome;
+        this._fromOutcome = null;
+    }
+
+    public void setId(String id)
+    {
+        checkInitialized();
+        this._id = id;
+    }
+}

Propchange: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/ReturnNodeImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/SwitchCaseImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/SwitchCaseImpl.java?rev=1443795&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/SwitchCaseImpl.java (added)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/SwitchCaseImpl.java Thu Feb  7 23:49:35 2013
@@ -0,0 +1,92 @@
+/*
+ * 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.flow;
+
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+import javax.faces.flow.SwitchCase;
+
+/**
+ *
+ * @since 2.2
+ * @author Leonardo Uribe
+ */
+public class SwitchCaseImpl extends SwitchCase implements Freezable
+{
+    private String _fromOutcome;
+    
+    private Boolean _condition;
+    private ValueExpression _conditionEL;
+
+    private boolean _initialized;
+
+    @Override
+    public String getFromOutcome()
+    {
+        return _fromOutcome;
+    }
+
+    @Override
+    public Boolean getCondition(FacesContext context)
+    {
+        if (_condition != null)
+        {
+            Object value = _conditionEL.getValue(context.getELContext());
+            if (value instanceof String)
+            {
+                return Boolean.valueOf((String) value);
+            }
+            return (Boolean) value;
+        }
+        return _condition;
+    }
+    
+    public void freeze()
+    {
+        _initialized = true;
+    }
+    
+    private void checkInitialized() throws IllegalStateException
+    {
+        if (_initialized)
+        {
+            throw new IllegalStateException("Flow is inmutable once initialized");
+        }
+    }
+
+    public void setFromOutcome(String fromOutcome)
+    {
+        checkInitialized();
+        this._fromOutcome = fromOutcome;
+    }
+
+    public void setCondition(Boolean condition)
+    {
+        checkInitialized();
+        this._condition = condition;
+        this._conditionEL = null;
+    }
+
+    public void setCondition(ValueExpression conditionEL)
+    {
+        checkInitialized();
+        this._conditionEL = conditionEL;
+        this._condition = null;
+    }
+}

Propchange: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/SwitchCaseImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/SwitchNodeImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/SwitchNodeImpl.java?rev=1443795&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/SwitchNodeImpl.java (added)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/SwitchNodeImpl.java Thu Feb  7 23:49:35 2013
@@ -0,0 +1,120 @@
+/*
+ * 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.flow;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+import javax.faces.flow.SwitchCase;
+import javax.faces.flow.SwitchNode;
+
+/**
+ *
+ * @since 2.2
+ * @author Leonardo Uribe
+ */
+public class SwitchNodeImpl extends SwitchNode implements Freezable
+{
+    private String _defaultOutcome;
+    private ValueExpression _defaultOutcomeEL;
+    private String _id;
+    
+    private List<SwitchCase> _cases;
+    private List<SwitchCase> _unmodifiableCases;
+
+    private boolean _initialized;
+
+    public SwitchNodeImpl(String switchNodeId)
+    {
+        this._id = switchNodeId;
+        _cases = new ArrayList<SwitchCase>();
+        _unmodifiableCases = Collections.unmodifiableList(_cases);
+    }
+    
+    @Override
+    public List<SwitchCase> getCases()
+    {
+        return _unmodifiableCases;
+    }
+    
+    public void addCase(SwitchCase switchCase)
+    {
+        checkInitialized();
+        _cases.add(switchCase);
+    }
+
+    @Override
+    public String getDefaultOutcome(FacesContext context)
+    {
+        if (_defaultOutcomeEL != null)
+        {
+            return (String) _defaultOutcomeEL.getValue(context.getELContext());
+        }
+        return _defaultOutcome;
+    }
+
+    @Override
+    public String getId()
+    {
+        return _id;
+    }
+
+    public void freeze()
+    {
+        _initialized = true;
+        
+        for (SwitchCase switchCase : _cases)
+        {
+            if (switchCase instanceof Freezable)
+            {
+                ((Freezable)switchCase).freeze();
+            }
+        }
+    }
+    
+    private void checkInitialized() throws IllegalStateException
+    {
+        if (_initialized)
+        {
+            throw new IllegalStateException("Flow is inmutable once initialized");
+        }
+    }
+    
+    public void setDefaultOutcome(String defaultOutcome)
+    {
+        checkInitialized();
+        this._defaultOutcome = defaultOutcome;
+        this._defaultOutcomeEL = null;
+    }
+    
+    public void setDefaultOutcome(ValueExpression defaultOutcome)
+    {
+        checkInitialized();
+        this._defaultOutcomeEL = defaultOutcome;
+        this._defaultOutcome = null;
+    }
+
+    public void setId(String id)
+    {
+        checkInitialized();
+        this._id = id;
+    }
+}

Propchange: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/SwitchNodeImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/ViewNodeImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/ViewNodeImpl.java?rev=1443795&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/ViewNodeImpl.java (added)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/ViewNodeImpl.java Thu Feb  7 23:49:35 2013
@@ -0,0 +1,77 @@
+/*
+ * 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.flow;
+
+import javax.faces.flow.ViewNode;
+
+/**
+ *
+ * @since 2.2
+ * @author Leonardo Uribe
+ */
+public class ViewNodeImpl extends ViewNode implements Freezable
+{
+    private String _vdlDocumentId;
+    private String _id;
+
+    private boolean _initialized;
+
+    public ViewNodeImpl(String id, String vdlDocumentId)
+    {
+        this._vdlDocumentId = vdlDocumentId;
+        this._id = id;
+    }
+    
+    @Override
+    public String getVdlDocumentId()
+    {
+        return _vdlDocumentId;
+    }
+
+    @Override
+    public String getId()
+    {
+        return _id;
+    }
+
+    public void freeze()
+    {
+        _initialized = true;
+    }
+    
+    private void checkInitialized() throws IllegalStateException
+    {
+        if (_initialized)
+        {
+            throw new IllegalStateException("Flow is inmutable once initialized");
+        }
+    }
+
+    public void setVdlDocumentId(String vdlDocumentId)
+    {
+        checkInitialized();
+        this._vdlDocumentId = vdlDocumentId;
+    }
+
+    public void setId(String id)
+    {
+        checkInitialized();
+        this._id = id;
+    }
+}

Propchange: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/ViewNodeImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/
------------------------------------------------------------------------------
    bugtraq:number = true

Added: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/FlowBuilderImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/FlowBuilderImpl.java?rev=1443795&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/FlowBuilderImpl.java (added)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/FlowBuilderImpl.java Thu Feb  7 23:49:35 2013
@@ -0,0 +1,189 @@
+/*
+ * 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.flow.builder;
+
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+import javax.faces.context.FacesContext;
+import javax.faces.flow.Flow;
+import javax.faces.flow.builder.FlowBuilder;
+import javax.faces.flow.builder.FlowCallBuilder;
+import javax.faces.flow.builder.MethodCallBuilder;
+import javax.faces.flow.builder.ReturnBuilder;
+import javax.faces.flow.builder.SwitchBuilder;
+import javax.faces.flow.builder.ViewBuilder;
+import org.apache.myfaces.flow.FlowImpl;
+import org.apache.myfaces.flow.ParameterImpl;
+
+/**
+ *
+ * @since 2.2
+ * @author Leonardo Uribe
+ */
+public class FlowBuilderImpl extends FlowBuilder
+{
+
+    private static final Class[] EMPTY_PARAMS = new Class[]
+    {
+    };
+    private FlowImpl _facesFlow;
+    private FacesContext _facesContext;
+
+    public FlowBuilderImpl()
+    {
+        _facesFlow = new FlowImpl();
+    }
+
+    public FlowBuilderImpl(FacesContext context)
+    {
+        super();
+        _facesContext = context;
+    }
+
+    @Override
+    public FlowBuilder id(String definingDocumentId, String id)
+    {
+        _facesFlow.setDefiningDocumentId(definingDocumentId);
+        _facesFlow.setId(id);
+        return this;
+    }
+
+    @Override
+    public ViewBuilder viewNode(String viewNodeId, String vdlDocumentId)
+    {
+        return new ViewBuilderImpl(_facesFlow, viewNodeId, vdlDocumentId);
+    }
+
+    @Override
+    public SwitchBuilder switchNode(String switchNodeId)
+    {
+        return new SwitchBuilderImpl(this, _facesFlow, switchNodeId);
+    }
+
+    @Override
+    public ReturnBuilder returnNode(String returnNodeId)
+    {
+        return new ReturnBuilderImpl(_facesFlow, returnNodeId);
+    }
+
+    @Override
+    public MethodCallBuilder methodCallNode(String methodCallNodeId)
+    {
+        return new MethodCallBuilderImpl(this, _facesFlow, methodCallNodeId);
+    }
+
+    @Override
+    public FlowCallBuilder flowCallNode(String flowCallNodeId)
+    {
+        return new FlowCallBuilderImpl(this, _facesFlow, flowCallNodeId);
+    }
+
+    @Override
+    public FlowBuilder initializer(MethodExpression methodExpression)
+    {
+        _facesFlow.setInitializer(methodExpression);
+        return this;
+    }
+
+    @Override
+    public FlowBuilder initializer(String methodExpression)
+    {
+        FacesContext facesContext = getFacesContext();
+        _facesFlow.setInitializer(
+            getFacesContext().getApplication().getExpressionFactory().createMethodExpression(
+            facesContext.getELContext(), methodExpression, null, EMPTY_PARAMS));
+        return this;
+    }
+
+    @Override
+    public FlowBuilder finalizer(MethodExpression methodExpression)
+    {
+        _facesFlow.setFinalizer(methodExpression);
+        return this;
+    }
+
+    @Override
+    public FlowBuilder finalizer(String methodExpression)
+    {
+        FacesContext facesContext = getFacesContext();
+        _facesFlow.setFinalizer(
+            facesContext.getApplication().getExpressionFactory().createMethodExpression(
+            facesContext.getELContext(), methodExpression, null, EMPTY_PARAMS));
+        return this;
+    }
+
+    @Override
+    public FlowBuilder inboundParameter(String name, ValueExpression value)
+    {
+        _facesFlow.putInboundParameter(name, new ParameterImpl(name, value));
+        return this;
+    }
+
+    @Override
+    public FlowBuilder inboundParameter(String name, String value)
+    {
+        FacesContext facesContext = getFacesContext();
+        _facesFlow.putInboundParameter(name, new ParameterImpl(name,
+            facesContext.getApplication().getExpressionFactory()
+            .createValueExpression(facesContext.getELContext(), value, Object.class)));
+        return this;
+    }
+
+    @Override
+    public Flow getFlow()
+    {
+        _facesContext = null;
+        return _facesFlow;
+    }
+
+    /**
+     * The idea is grab FacesContext just once and then when the flow is returned clear the variable.
+     *
+     * @return
+     */
+    FacesContext getFacesContext()
+    {
+        if (_facesContext == null)
+        {
+            _facesContext = FacesContext.getCurrentInstance();
+        }
+        return _facesContext;
+    }
+    
+    public MethodExpression createMethodExpression(String methodExpression)
+    {
+        FacesContext facesContext = getFacesContext();
+        return facesContext.getApplication().getExpressionFactory().createMethodExpression(
+            facesContext.getELContext(), methodExpression, null, EMPTY_PARAMS);
+    }
+    
+    public MethodExpression createMethodExpression(String methodExpression, Class[] paramTypes)
+    {
+        FacesContext facesContext = getFacesContext();
+        return facesContext.getApplication().getExpressionFactory().createMethodExpression(
+            facesContext.getELContext(), methodExpression, null, paramTypes);
+    }
+    
+    public ValueExpression createValueExpression(String value)
+    {
+        FacesContext facesContext = getFacesContext();
+        return facesContext.getApplication().getExpressionFactory()
+            .createValueExpression(facesContext.getELContext(), value, Object.class); 
+    }
+}

Propchange: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/FlowBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/FlowCallBuilderImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/FlowCallBuilderImpl.java?rev=1443795&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/FlowCallBuilderImpl.java (added)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/FlowCallBuilderImpl.java Thu Feb  7 23:49:35 2013
@@ -0,0 +1,76 @@
+/*
+ * 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.flow.builder;
+
+import javax.el.ValueExpression;
+import javax.faces.flow.builder.FlowCallBuilder;
+import org.apache.myfaces.flow.FlowCallNodeImpl;
+import org.apache.myfaces.flow.FlowImpl;
+import org.apache.myfaces.flow.ParameterImpl;
+
+/**
+ *
+ * @since 2.2
+ * @author Leonardo Uribe
+ */
+public class FlowCallBuilderImpl extends FlowCallBuilder
+{
+    private FlowBuilderImpl _flowBuilder;
+    private FlowImpl _facesFlow;
+    private FlowCallNodeImpl _flowCallNode;
+
+    public FlowCallBuilderImpl(FlowBuilderImpl flowBuilder, FlowImpl facesFlow, String flowCallNodeId)
+    {
+        this._flowBuilder = flowBuilder;
+        this._facesFlow = facesFlow;
+        this._flowCallNode = new FlowCallNodeImpl(flowCallNodeId);
+        this._facesFlow.putFlowCall(flowCallNodeId, _flowCallNode);
+    }
+
+    @Override
+    public FlowCallBuilder flowReference(String flowDocumentId, String flowId)
+    {
+        this._flowCallNode.setCalledFlowDocumentId(flowDocumentId);
+        this._flowCallNode.setCalledFlowId(flowId);
+        return this;
+    }
+
+    @Override
+    public FlowCallBuilder outboundParameter(String name, ValueExpression value)
+    {
+        this._flowCallNode.putOutboundParameter(name, new ParameterImpl(name, value));
+        return this;
+    }
+
+    @Override
+    public FlowCallBuilder outboundParameter(String name, String value)
+    {
+        this._flowCallNode.putOutboundParameter(name, new ParameterImpl(name, 
+            this._flowBuilder.createValueExpression(value)));
+        return this;
+    }
+
+    @Override
+    public FlowCallBuilder markAsStartNode()
+    {
+        _facesFlow.setStartNodeId(_flowCallNode.getId());
+        return this;
+    }
+    
+}

Propchange: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/FlowCallBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/MethodCallBuilderImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/MethodCallBuilderImpl.java?rev=1443795&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/MethodCallBuilderImpl.java (added)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/MethodCallBuilderImpl.java Thu Feb  7 23:49:35 2013
@@ -0,0 +1,102 @@
+/*
+ * 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.flow.builder;
+
+import java.util.List;
+import javax.el.MethodExpression;
+import javax.el.ValueExpression;
+import javax.faces.flow.Parameter;
+import javax.faces.flow.builder.MethodCallBuilder;
+import org.apache.myfaces.flow.FlowImpl;
+import org.apache.myfaces.flow.MethodCallNodeImpl;
+
+/**
+ *
+ * @since 2.2
+ * @author Leonardo Uribe
+ */
+public class MethodCallBuilderImpl extends MethodCallBuilder
+{
+    private FlowImpl _facesFlow;
+    private MethodCallNodeImpl _methodCallNode;
+    private FlowBuilderImpl _flowBuilder;
+
+    public MethodCallBuilderImpl(FlowBuilderImpl flowBuilder, FlowImpl facesFlow, String methodCallNodeId)
+    {
+        this._facesFlow = facesFlow;
+        this._methodCallNode = new MethodCallNodeImpl(methodCallNodeId);
+        this._facesFlow.addMethodCall(_methodCallNode);
+    }
+
+    @Override
+    public MethodCallBuilder expression(MethodExpression me)
+    {
+        this._methodCallNode.setMethodExpression(me);
+        return this;
+    }
+
+    @Override
+    public MethodCallBuilder expression(String methodExpression)
+    {
+        this._methodCallNode.setMethodExpression(
+            _flowBuilder.createMethodExpression(methodExpression));
+        return this;
+    }
+
+    @Override
+    public MethodCallBuilder expression(String methodExpression, Class[] paramTypes)
+    {
+        this._methodCallNode.setMethodExpression(
+            _flowBuilder.createMethodExpression(methodExpression, paramTypes));
+        return this;
+    }
+
+    @Override
+    public MethodCallBuilder parameters(List<Parameter> parameters)
+    {
+        for (Parameter p : parameters)
+        {
+            this._methodCallNode.addParameter(p);
+        }
+        return this;
+    }
+
+    @Override
+    public MethodCallBuilder defaultOutcome(String outcome)
+    {
+        this._methodCallNode.setOutcome(
+            this._flowBuilder.createValueExpression(outcome));
+        return this;
+    }
+
+    @Override
+    public MethodCallBuilder defaultOutcome(ValueExpression outcome)
+    {
+        this._methodCallNode.setOutcome(outcome);
+        return this;
+    }
+
+    @Override
+    public MethodCallBuilder markAsStartNode()
+    {
+        _facesFlow.setStartNodeId(_methodCallNode.getId());
+        return this;
+    }
+    
+}

Propchange: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/MethodCallBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/ReturnBuilderImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/ReturnBuilderImpl.java?rev=1443795&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/ReturnBuilderImpl.java (added)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/ReturnBuilderImpl.java Thu Feb  7 23:49:35 2013
@@ -0,0 +1,64 @@
+/*
+ * 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.flow.builder;
+
+import javax.el.ValueExpression;
+import javax.faces.flow.builder.ReturnBuilder;
+import org.apache.myfaces.flow.FlowImpl;
+import org.apache.myfaces.flow.ReturnNodeImpl;
+
+/**
+ *
+ * @since 2.2
+ * @author Leonardo Uribe
+ */
+public class ReturnBuilderImpl extends ReturnBuilder
+{
+    private FlowImpl _facesFlow;
+    private ReturnNodeImpl _returnNode;
+
+    public ReturnBuilderImpl(FlowImpl facesFlow, String returnNodeId)
+    {
+        this._facesFlow = facesFlow;
+        this._returnNode = new ReturnNodeImpl(returnNodeId);
+        this._facesFlow.putReturn(returnNodeId, _returnNode);
+    }
+
+    @Override
+    public ReturnBuilder fromOutcome(String outcome)
+    {
+        this._returnNode.setFromOutcome(outcome);
+        return this;
+    }
+
+    @Override
+    public ReturnBuilder fromOutcome(ValueExpression outcome)
+    {
+        this._returnNode.setFromOutcome(outcome);
+        return this;
+    }
+
+    @Override
+    public ReturnBuilder markAsStartNode()
+    {
+        _facesFlow.setStartNodeId(_returnNode.getId());
+        return this;
+    }
+    
+}

Propchange: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/ReturnBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/SwitchBuilderImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/SwitchBuilderImpl.java?rev=1443795&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/SwitchBuilderImpl.java (added)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/SwitchBuilderImpl.java Thu Feb  7 23:49:35 2013
@@ -0,0 +1,75 @@
+/*
+ * 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.flow.builder;
+
+import javax.el.ValueExpression;
+import javax.faces.flow.builder.SwitchBuilder;
+import javax.faces.flow.builder.SwitchCaseBuilder;
+import org.apache.myfaces.flow.FlowImpl;
+import org.apache.myfaces.flow.SwitchNodeImpl;
+
+/**
+ *
+ * @since 2.2
+ * @author Leonardo Uribe
+ */
+public class SwitchBuilderImpl extends SwitchBuilder
+{
+    private FlowBuilderImpl _flowBuilder;
+    private FlowImpl _facesFlow;
+    private SwitchNodeImpl _switchNodeImpl;
+    private SwitchCaseBuilderImpl _lastSwitchCaseBuilderImpl;
+
+    public SwitchBuilderImpl(FlowBuilderImpl flowBuilder, FlowImpl facesFlow, String switchNodeId)
+    {
+        this._flowBuilder = flowBuilder;
+        this._facesFlow = facesFlow;
+        this._switchNodeImpl = new SwitchNodeImpl(switchNodeId);
+        this._facesFlow.putSwitch(switchNodeId, _switchNodeImpl);
+    }
+
+    @Override
+    public SwitchCaseBuilder switchCase()
+    {
+        this._lastSwitchCaseBuilderImpl = new SwitchCaseBuilderImpl(
+            this._flowBuilder, this._facesFlow, this, this._switchNodeImpl);
+        return this._lastSwitchCaseBuilderImpl.switchCase();
+    }
+
+    @Override
+    public SwitchCaseBuilder defaultOutcome(String outcome)
+    {
+        this._switchNodeImpl.setDefaultOutcome(outcome);
+        return _lastSwitchCaseBuilderImpl;
+    }
+
+    @Override
+    public SwitchCaseBuilder defaultOutcome(ValueExpression outcome)
+    {
+        this._switchNodeImpl.setDefaultOutcome(outcome);
+        return _lastSwitchCaseBuilderImpl;
+    }
+
+    @Override
+    public SwitchBuilder markAsStartNode()
+    {
+        _facesFlow.setStartNodeId(_switchNodeImpl.getId());
+        return this;
+    }    
+}

Propchange: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/SwitchBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/SwitchCaseBuilderImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/SwitchCaseBuilderImpl.java?rev=1443795&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/SwitchCaseBuilderImpl.java (added)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/SwitchCaseBuilderImpl.java Thu Feb  7 23:49:35 2013
@@ -0,0 +1,77 @@
+/*
+ * 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.flow.builder;
+
+import javax.el.ValueExpression;
+import javax.faces.flow.builder.SwitchCaseBuilder;
+import org.apache.myfaces.flow.FlowImpl;
+import org.apache.myfaces.flow.SwitchCaseImpl;
+import org.apache.myfaces.flow.SwitchNodeImpl;
+
+/**
+ *
+ * @since 2.2
+ * @author Leonardo Uribe
+ */
+public class SwitchCaseBuilderImpl extends SwitchCaseBuilder
+{
+    private FlowBuilderImpl _flowBuilder;
+    private FlowImpl _facesFlow;
+    private SwitchBuilderImpl _switchBuilderImpl;
+    private SwitchNodeImpl _switchNodeImpl;
+    private SwitchCaseImpl _switchCase;
+
+    public SwitchCaseBuilderImpl(FlowBuilderImpl flowBuilder, FlowImpl facesFlow, 
+        SwitchBuilderImpl switchBuilderImpl, SwitchNodeImpl switchNode)
+    {
+        this._flowBuilder = flowBuilder;
+        this._facesFlow = facesFlow;
+        this._switchBuilderImpl = switchBuilderImpl;
+        this._switchNodeImpl = switchNode;
+        this._switchCase = new SwitchCaseImpl();
+    }
+    
+    @Override
+    public SwitchCaseBuilder condition(String expression)
+    {
+        this._switchCase.setCondition(Boolean.valueOf(expression));
+        return this;
+    }
+
+    @Override
+    public SwitchCaseBuilder condition(ValueExpression expression)
+    {
+        this._switchCase.setCondition(expression);
+        return this;
+    }
+
+    @Override
+    public SwitchCaseBuilder fromOutcome(String outcome)
+    {
+        this._switchCase.setFromOutcome(outcome);
+        return this;
+    }
+
+    @Override
+    public SwitchCaseBuilder switchCase()
+    {
+        this._switchNodeImpl.addCase(this._switchCase);
+        return this;
+    }
+}

Propchange: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/SwitchCaseBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/ViewBuilderImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/ViewBuilderImpl.java?rev=1443795&view=auto
==============================================================================
--- myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/ViewBuilderImpl.java (added)
+++ myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/ViewBuilderImpl.java Thu Feb  7 23:49:35 2013
@@ -0,0 +1,49 @@
+/*
+ * 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.flow.builder;
+
+import javax.faces.flow.builder.ViewBuilder;
+import org.apache.myfaces.flow.FlowImpl;
+import org.apache.myfaces.flow.ViewNodeImpl;
+
+/**
+ *
+ * @since 2.2
+ * @author Leonardo Uribe
+ */
+public class ViewBuilderImpl extends ViewBuilder
+{
+    private FlowImpl _facesFlow;
+    private ViewNodeImpl _viewNode;
+    
+    public ViewBuilderImpl(FlowImpl facesFlow, String viewNodeId, String vdlDocumentId)
+    {
+        _facesFlow = facesFlow;
+        _viewNode = new ViewNodeImpl(viewNodeId, vdlDocumentId);
+        _facesFlow.addView(_viewNode);
+    }
+
+    @Override
+    public ViewBuilder markAsStartNode()
+    {
+        _facesFlow.setStartNodeId(_viewNode.getId());
+        return this;
+    }
+    
+}

Propchange: myfaces/core/branches/2.2.x/impl/src/main/java/org/apache/myfaces/flow/builder/ViewBuilderImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native