You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by im...@apache.org on 2007/05/25 21:22:18 UTC
svn commit: r541752 - in /myfaces/orchestra/trunk/core/src/site: site.xml
xdoc/about.xml xdoc/conversationManagement.xml xdoc/dynaForm.xml
xdoc/installation.xml xdoc/usage.xml
Author: imario
Date: Fri May 25 12:22:17 2007
New Revision: 541752
URL: http://svn.apache.org/viewvc?view=rev&rev=541752
Log:
cleanup
Added:
myfaces/orchestra/trunk/core/src/site/xdoc/dynaForm.xml
- copied, changed from r541692, myfaces/orchestra/trunk/core/src/site/xdoc/usage.xml
Removed:
myfaces/orchestra/trunk/core/src/site/xdoc/conversationManagement.xml
Modified:
myfaces/orchestra/trunk/core/src/site/site.xml
myfaces/orchestra/trunk/core/src/site/xdoc/about.xml
myfaces/orchestra/trunk/core/src/site/xdoc/installation.xml
myfaces/orchestra/trunk/core/src/site/xdoc/usage.xml
Modified: myfaces/orchestra/trunk/core/src/site/site.xml
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/site/site.xml?view=diff&rev=541752&r1=541751&r2=541752
==============================================================================
--- myfaces/orchestra/trunk/core/src/site/site.xml (original)
+++ myfaces/orchestra/trunk/core/src/site/site.xml Fri May 25 12:22:17 2007
@@ -37,10 +37,11 @@
<menu name="MyFaces Orchestra">
<item name="About" href="about.html"/>
<item name="Installation" href="installation.html"/>
- <item name="Alternative Configuration" href="alternative-configuration.html"/>
- <item name="Management" href="conversationManagement.html"/>
+ <item name="Conversation API Usage" href="usage.html"/>
<item name="Best Practice" href="bestPractice.html"/>
+ <item name="Dynamic Forms" href="dynaForm.html"/>
<item name="TODO" href="todo.html"/>
+
</menu>
${reports}
Modified: myfaces/orchestra/trunk/core/src/site/xdoc/about.xml
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/site/xdoc/about.xml?view=diff&rev=541752&r1=541751&r2=541752
==============================================================================
--- myfaces/orchestra/trunk/core/src/site/xdoc/about.xml (original)
+++ myfaces/orchestra/trunk/core/src/site/xdoc/about.xml Fri May 25 12:22:17 2007
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE document PUBLIC "-//Apache Software Foundation//DTD XDOC 1.0//EN"
+ "http://www.apache.org/dtd/xdoc.dtd">
<document>
<properties>
<title>About Apache MyFaces Orchestra</title>
@@ -201,4 +202,4 @@
</subsection>
</section>
</body>
-</document>
\ No newline at end of file
+</document>
Copied: myfaces/orchestra/trunk/core/src/site/xdoc/dynaForm.xml (from r541692, myfaces/orchestra/trunk/core/src/site/xdoc/usage.xml)
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/site/xdoc/dynaForm.xml?view=diff&rev=541752&p1=myfaces/orchestra/trunk/core/src/site/xdoc/usage.xml&r1=541692&p2=myfaces/orchestra/trunk/core/src/site/xdoc/dynaForm.xml&r2=541752
==============================================================================
--- myfaces/orchestra/trunk/core/src/site/xdoc/usage.xml (original)
+++ myfaces/orchestra/trunk/core/src/site/xdoc/dynaForm.xml Fri May 25 12:22:17 2007
@@ -3,140 +3,21 @@
"http://www.apache.org/dtd/xdoc.dtd">
<document>
<properties>
- <title>Usage</title>
+ <title>Dynamic Forms</title>
</properties>
<body>
- <section name="Usage">
+ <section name="Dynamic Forms">
<p>
- Once you have configured the system as described in
- the installation document you can start using the new scope.
+ This is a core15 feature.
</p>
-
- <p>
- One more prerequisite: instead of configuring your beans in the faces-config.xml
- configuration do this in your spring configuration now. You can
- take over all your beans into the Spring configuration, Spring also provides
- a session and a request scope.
- </p>
-
<p>
- With this in place, we'll start evaluating the Orchestra-relevant use-cases now - so we'll
- together look at what you will want to do with Orchestra.
+ The MyFaces Orchestra JSF tag called <code>dynaForm</code> enables you to dynamically create
+ forms or lists - editable or just displayable - based on the annotation of your beans.
</p>
-
- <subsection name="Starting a conversation">
- In the beginning, we'll want to start a conversation. Doing that is a no-brainer in Orchestra - if
- you've declared the relevant managed beans as in the following example:
- <code><pre><bean name="userInfo"
- class="my.app.pck.backings.UserInfo"
- scope="conversation"
- autowire="byName">
- <aop:scoped-proxy />
- </bean></pre></code>
- <p>
- We've learned about this syntax in the small example in the introduction - a short repetition:
- <br/>
- First, the scope-attribute of the bean-element will be defining the name of the scope -
- usually "conversation".
- <br/>
- Second, it is very important to use the
- <b>
- <code><aop:scoped-proxy /></code>
- </b>
- child-element. Bear with us - we'll explain to you why that is right now.
- <br/>
- Using the <code><aop:scoped-proxy /></code>
- ensures that you will never have a reference to
- the real instance of your bean, but to a proxy to it. There is no difference
- in the way how you work with this instance in your code, but if you
- end a conversation and restart it, you'll appreciate the difference: the proxy will make
- sure that your application will see the new instance.
- </p>
- <p>The
- <code>autowire="byName"</code>
- Setting this property is fully optional. However, it
- lowers the amount of configuration required. With this property set, Spring will scan your
- bean configuration. Whenever it finds a bean with the same name as the property, it
- will inject an instance of this bean configuration into this property.
- </p>
- <p>For example, if you configure a bean named
- <code>userInfoDao</code>
- and your bean has a
- <code>setUserInfoDao()</code>
- method Spring will inject an instance of this DAO into your bean.
- </p>
- </subsection>
-
- <subsection name="Closing a conversation">
<p>
- Closing a conversation is straightforward as well.
- All that needs to be done is to call:
- <pre>
- <code>Conversation.getCurrentInstance().invalidate()</code>
- </pre>
- from within the conversation-scoped bean. With this call, the conversation will cease to exist
- and the bean will be cleared from the conversation.
+ ... more to come ...
</p>
- </subsection>
-
- <subsection name="Restart a conversation">
- <p>
- At times, you do not only want to close a conversation, but you also want to restart it
- immediately. For this, use the following call:
- <code>Object yourBackingBean = ConversationUtils.invalidateAndRestart(Conversation.getCurrentInstance())</code>
- With the returned object, you can do configuration and initialization work.
- </p>
- </subsection>
-
- <subsection name="Ensure a conversation is running">
- <p>
- If you have a conversation running over a multitude of pages,
- you might want to check if the conversation has been initialized before you reach the page.
- For doing this, you can call the method:
-
- <code>ConversationUtils.ensureConversationRedirect(conversationName, redirectToJsp)</code>
-
- before the conversation is first accessed on this page, as in an initialization or
- prerender-method.
- </p>
- </subsection>
-
- <subsection name="End a conversation by name">
-<code>ConversationUtils.invalidateIfExists(conversationName)</code>
- </subsection>
-
- <subsection name="JPA Transaction">
- <b>Note</b>
- :
- Once again I would like to stress that Apache MyFaces Orchestra does not rely
- on annotations, the JPA thing was just the one we build the examples with,
- thats why we describe it at first.
- <p>Every method in your conversation
- bean is able to issue a database request or to call e.g. a DAO which will
- do it. Its ensured that during the whole lifetime of this conversation
- bean all database code will see the same entity manager.
- </p>
- <p>Methods
- which change data has to be annotated with the
- <code>@Transactional</code>
- annotation.
- </p>
- <p>Which means, that every changed/inserted/deleted entity
- will be flushed to the database and committed.
- </p>
- <p>Thats an important
- thing to understand. You
- <b>can</b>
- change an entity whenever you want,
- but it will only be flushed after such an annotated method has been
- invoked.
- </p>
-
-
- </subsection>
-
-
</section>
</body>
</document>
Modified: myfaces/orchestra/trunk/core/src/site/xdoc/installation.xml
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/site/xdoc/installation.xml?view=diff&rev=541752&r1=541751&r2=541752
==============================================================================
--- myfaces/orchestra/trunk/core/src/site/xdoc/installation.xml (original)
+++ myfaces/orchestra/trunk/core/src/site/xdoc/installation.xml Fri May 25 12:22:17 2007
@@ -245,6 +245,12 @@
JSF page backing bean will look the same, just that you put it into the
conversation scope now.
</subsection>
+
+ </section>
+ <section name="User provided configurations">
+ <ul>
+ <li><a href="alternative-configuration.html">A spring configuration using toplink and load time weaving with tomcat</a></li>
+ </ul>
</section>
</body>
</document>
Modified: myfaces/orchestra/trunk/core/src/site/xdoc/usage.xml
URL: http://svn.apache.org/viewvc/myfaces/orchestra/trunk/core/src/site/xdoc/usage.xml?view=diff&rev=541752&r1=541751&r2=541752
==============================================================================
--- myfaces/orchestra/trunk/core/src/site/xdoc/usage.xml (original)
+++ myfaces/orchestra/trunk/core/src/site/xdoc/usage.xml Fri May 25 12:22:17 2007
@@ -84,7 +84,15 @@
<p>
At times, you do not only want to close a conversation, but you also want to restart it
immediately. For this, use the following call:
- <code>Object yourBackingBean = ConversationUtils.invalidateAndRestart(Conversation.getCurrentInstance())</code>
+ <pre>
+public void invalidateAndRestart()
+{
+ YouBean bean = (YourBean)
+ ConversationUtils.invalidateAndRestart(Conversation.getCurrentInstance());
+ bean.setUser(createdUser.getId());
+}
+ </pre>
+
With the returned object, you can do configuration and initialization work.
</p>
</subsection>
@@ -136,6 +144,61 @@
</subsection>
+ <subsection name="Access a conversation">
+
+ <p>
+ From within a conversation scoped bean you can use
+
+ <code>Conversation.getCurrentInstance()</code>
+
+ or the ConversationManager API if you are outside of a conversation or would like to access another
+ conversation
+
+ <code>ConversationManager.getConversation(conversationName)</code>
+ </p>
+
+ </subsection>
+
+ <subsection name="Add beans to a conversation">
+ As e.g a http session or the request map, internally the conversation is also just a map
+ of beans.
+ <br/>
+ Using the spring configuration you're able to add just one bean, the conversation scoped
+ bean to the conversation with the same name as the bean.
+ <br/>
+ But there are ways to add other objects using the Conversation API.
+
+ <p>
+ Once you have access to the conversation object you can do:
+
+ <ul>
+ <li>conversation.setAttribute(key, value)</li>
+ <li>conversation.hasAttribute(key)</li>
+ <li>conversation.getAttribute(key)</li>
+ <li>conversation.removeAttribute(key)</li>
+ </ul>
+ </p>
+
+ <p>
+ Any bean implementing the <code>ConversationBindingListener</code> interface
+ will receive the <code>valueBound()/valueUnbound()</code>.
+
+ <ul>
+ <li>valueBound()<br/>
+ Will be invoked AFTER the bean has been added to the conversation map.
+ </li>
+
+ <li>valueUnbound()<br/>
+ Will be invoked AFTER the bean has been removed from the conversation map.<br/>
+ This will haben if you call <code>removeAttribute(key)</code> or if the
+ conversation ends, either manually or autmoatically due to a timeout.
+ </li>
+ </ul>
+
+ <b>Notice:</b> In <code>valueUnbound()</code> you can't assume that a faces context
+ will be available.
+ </p>
+ </subsection>
</section>
</body>