Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.myfaces.orchestra.conversation.spring
Class SpringConversationScope

    java.lang.Object
      org.apache.myfaces.orchestra.conversation.spring.AbstractSpringOrchestraScope
          org.apache.myfaces.orchestra.conversation.spring.SpringConversationScope

All Implemented Interfaces:
  ConversationFactory, org.springframework.beans.factory.BeanFactoryAware, org.springframework.beans.factory.config.Scope, org.springframework.context.ApplicationContextAware

    public class SpringConversationScope

extends AbstractSpringOrchestraScope

Handles creation and lookup of any bean whose bean-definition specifies a scope that maps to an instance of this type.

A scope bean handles Spring-specific callbacks in order to locate or create any beans whose definition specifies that scope. A scope can also be thought of as a "conversation template", as this object is responsible for creating a conversation when one is needed but does not yet exist.

## Example

A sample configuration for a conversation scope with persistence:

     <bean class="org.springframework.beans.factory.config.CustomScopeConfigurer">
       <property name="scopes">
         <map>
           <entry key="conversation.manual">
             <bean class="org.apache.myfaces.orchestra.conversation.spring.SpringConversationScope">
               <property name="advices">
                 <list>
                   <ref bean="persistentContextConversationInterceptor" />
                 </list>
               </property>
             </bean>
           </entry>
         </map>
       </property>
     </bean>

     <bean id="persistentContextConversationInterceptor"
        class="org.apache.myfaces.orchestra.conversation.spring.PersistenceContextConversationInterceptor">
       <property name="persistenceContextFactory" ref="yourPersistentContextFactory" />
     </bean>

## Conversation properties

The following properties can be defined on a scope and then apply to any conversation that is created to hold a bean of this scope:

- lifetime: may be "manual" or "access". If not specified, then defaults to "manual".
- timeout: a time period (in minutes) after which inactive conversations are terminated. If not specified, then inactive conversations are never automatically terminated.

## Other Notes

If the bean definition does not specify a conversation name, then the bean name is used as the conversation name.

As shown above, a list of AOP Advices can be specified for the scope, in which case each of the advices gets configured for any bean declared with this scope.

Field Summary
`static java.lang.String` | `LIFETIME_ACCESS`
`static java.lang.String` | `LIFETIME_FLASH` Deprecated. Use LIFETIME_ACCESS instead.
`static java.lang.String` | `LIFETIME_MANUAL`

Constructor Summary
`SpringConversationScope()`

Method Summary
`Conversation` | `createConversation(ConversationContext context, java.lang.String name)` Implementation of ConversationFactory interface.
`java.lang.String` | `getLifetime()` See `setLifetime(java.lang.String)`.
`java.lang.Integer` | `getTimeout()` See `setTimeout(java.lang.Integer)`.
`protected void` | `initAspects(Conversation conversation)` Add aspects to a newly-created conversation.
`protected void` | `notifyAccessConversation(Conversation conversation)` Mark the specified conversation as having been accessed.
`void` | `setLifetime(java.lang.String lifetime)` Must be one of "manual" or "access".
`void` | `setTimeout(java.lang.Integer timeout)` The timeout in minutes when the conversation will end.

Methods inherited from class org.apache.myfaces.orchestra.conversation.spring.AbstractSpringOrchestraScope
`assertSameScope, buildBeanName, defineBeanPostProcessors, get, getAdvices, getApplicationContext, getConversationForBean, getConversationId, getConversationNameForBean, getExplicitConversationName, getProxy, getRealBean, registerDestructionCallback, remove, setAdvices, setApplicationContext, setAutoProxy, setBeanFactory`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### LIFETIME_FLASH

    public static final java.lang.String LIFETIME_FLASH

  Deprecated. Use LIFETIME_ACCESS instead.
  See Also:
    Constant Field Values

### LIFETIME_ACCESS

    public static final java.lang.String LIFETIME_ACCESS

See Also:
  Constant Field Values

### LIFETIME_MANUAL

    public static final java.lang.String LIFETIME_MANUAL

See Also:
  Constant Field Values

Constructor Detail

### SpringConversationScope

    public SpringConversationScope()

Method Detail

### getTimeout

    public java.lang.Integer getTimeout()

  See `setTimeout(java.lang.Integer)`.

### setTimeout

    public void setTimeout(java.lang.Integer timeout)

  The timeout in minutes when the conversation will end. See `ConversationTimeoutableAspect.timeout` for the default timeout.

### getLifetime

    public java.lang.String getLifetime()

  See `setLifetime(java.lang.String)`.

### setLifetime

    public void setLifetime(java.lang.String lifetime)

  Must be one of "manual" or "access".

  Defaults to "manual".

  Note that "flash" is also supported as an alias for "access", for reasons of backwards compatibility with release 1.0.

### createConversation

    public Conversation createConversation(ConversationContext context,
                                           java.lang.String name)

  Implementation of ConversationFactory interface.

### initAspects

    protected void initAspects(Conversation conversation)

  Add aspects to a newly-created conversation.

  Subclasses are expected to call super.initAspects, then make zero or more calls to conversation.addAspect.

### notifyAccessConversation

    protected void notifyAccessConversation(Conversation conversation)

  Mark the specified conversation as having been accessed.

  This affects conversation timeouts, and the removal of access-scoped conversations.

  Overrides:
    `notifyAccessConversation` in class `AbstractSpringOrchestraScope`

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2009 The Apache Software Foundation. All Rights Reserved.