You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by gp...@apache.org on 2010/07/11 00:46:49 UTC
svn commit: r962936 [1/3] - in /myfaces/extensions/cdi/trunk:
core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/config/
core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/
core/api/src/main/java/org/apa...
Author: gpetracek
Date: Sat Jul 10 22:46:47 2010
New Revision: 962936
URL: http://svn.apache.org/viewvc?rev=962936&view=rev
Log:
[intermediate result] initial draft for EXTCDI-1, EXTCDI-2 and EXTCDI-3 (for jsf 1.2)
Added:
myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/BeanAccessedEvent.java
myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/BeanNotFoundException.java
myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationEvent.java
myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/UnscopeBeanEvent.java
myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/WindowContext.java
- copied, changed from r962434, myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationContext.java
myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/WindowContextConfig.java
- copied, changed from r962434, myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationContextConfig.java
myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/access/ViewAccessScoped.java
- copied, changed from r962434, myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/access/AccessScoped.java
myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/ViewAccess.java
myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/Window.java
- copied, changed from r962434, myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/window/WindowScoped.java
myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/AbstractConversationContextAdapter.java
- copied, changed from r962434, myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/grouped/AbstractGroupedConversationContextAdapter.java
myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/ConversationBeanEntry.java
myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/
- copied from r962434, myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/grouped/spi/
myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/BeanEntry.java
myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/EditableConversation.java
myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/WindowContextManager.java
- copied, changed from r962434, myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/grouped/spi/ConversationManager.java
myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/
myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/
myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean1.java
myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean2.java
myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean3.java
myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean4.java
myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationGroup1.java
myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/helloMyFacesCodi1.jsp
myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/helloMyFacesCodi2.jsp
myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/helloMyFacesCodi3.jsp
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/request/AbstractRequestTypeResolver.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/request/RequestTypeResolver.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/config/DefaultWindowContextConfig.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/request/DefaultRequestTypeResolver.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/AccessScopeAwareNavigationHandler.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/BeanStorage.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/CodiRenderKitFactory.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/CodiResponseStateManager.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/DefaultConversation.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/DefaultWindowContextManager.java
- copied, changed from r962434, myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/DefaultConversationManager.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/InterceptedRenderKit.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/InterceptedResponseWriter.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/RedirectedConversationAwareExternalContext.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/WindowContextIdHolderComponent.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/grouped/JsfWindowContext.java
- copied, changed from r962434, myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/grouped/JsfConversationContext.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/util/ConversationUtils.java
Removed:
myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationContext.java
myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationContextConfig.java
myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/access/AccessScoped.java
myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/DefaultGroup.java
myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/grouped/AbstractGroupedConversationContextAdapter.java
myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/grouped/spi/
myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/ConversationManager.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/DefaultConversationManager.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/grouped/JsfConversationContext.java
Modified:
myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/config/AttributeAware.java
myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/Conversation.java
myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/ConversationGroup.java
myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/window/WindowScoped.java
myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/ConversationContextFactory.java
myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/ConversationFactory.java
myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/utils/CodiUtils.java
myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/WEB-INF/faces-config.xml
myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/helloMyFacesCodi.jsp
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/ConfigParameter.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/config/faces-config.xml
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/config/javax.enterprise.inject.spi.Extension
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/request/CodiFacesContextWrapper.java
myfaces/extensions/cdi/trunk/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/grouped/GroupedConversationContextAdapter.java
Modified: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/config/AttributeAware.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/config/AttributeAware.java?rev=962936&r1=962935&r2=962936&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/config/AttributeAware.java (original)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/config/AttributeAware.java Sat Jul 10 22:46:47 2010
@@ -18,10 +18,12 @@
*/
package org.apache.myfaces.extensions.cdi.core.api.config;
+import java.io.Serializable;
+
/**
* @author Gerhard Petracek
*/
-public interface AttributeAware
+public interface AttributeAware extends Serializable
{
boolean setAttribute(String name, Object value);
Added: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/BeanAccessedEvent.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/BeanAccessedEvent.java?rev=962936&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/BeanAccessedEvent.java (added)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/BeanAccessedEvent.java Sat Jul 10 22:46:47 2010
@@ -0,0 +1,32 @@
+/*
+ * 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.extensions.cdi.core.api.scope.conversation;
+
+import java.io.Serializable;
+
+/**
+ * @author Gerhard Petracek
+ */
+public final class BeanAccessedEvent extends ConversationEvent
+{
+ public BeanAccessedEvent(Serializable bean)
+ {
+ super(bean);
+ }
+}
Added: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/BeanNotFoundException.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/BeanNotFoundException.java?rev=962936&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/BeanNotFoundException.java (added)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/BeanNotFoundException.java Sat Jul 10 22:46:47 2010
@@ -0,0 +1,35 @@
+/*
+ * 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.extensions.cdi.core.api.scope.conversation;
+
+import javax.enterprise.inject.spi.Bean;
+
+/**
+ * @author Gerhard Petracek
+ */
+@Deprecated
+public class BeanNotFoundException extends IllegalStateException
+{
+ private static final long serialVersionUID = -3071556589834210682L;
+
+ public <T> BeanNotFoundException(Bean<T> foundBean)
+ {
+ super("No bean found for class " + foundBean.getBeanClass());
+ }
+}
Modified: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/Conversation.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/Conversation.java?rev=962936&r1=962935&r2=962936&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/Conversation.java (original)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/Conversation.java Sat Jul 10 22:46:47 2010
@@ -22,13 +22,23 @@ import java.io.Serializable;
/**
* A conversation is started automatically with the first access
- *
+ *
* @author Gerhard Petracek
*/
public interface Conversation extends Serializable
{
+ //TODO move down
+ boolean isActive();
+
+ //TODO move down
+ void deactivate();
+
void end();
void restart();
+
+ //Map<Class, Serializable> getBeans();
+
+ <T> T getBean(Class<T> key);
}
Added: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationEvent.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationEvent.java?rev=962936&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationEvent.java (added)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationEvent.java Sat Jul 10 22:46:47 2010
@@ -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.extensions.cdi.core.api.scope.conversation;
+
+import java.io.Serializable;
+
+/**
+ * @author Gerhard Petracek
+ */
+public abstract class ConversationEvent
+{
+ private final Serializable bean;
+
+ public ConversationEvent(Serializable bean)
+ {
+ this.bean = bean;
+ }
+
+ public final Serializable getBean()
+ {
+ return bean;
+ }
+}
Added: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/UnscopeBeanEvent.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/UnscopeBeanEvent.java?rev=962936&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/UnscopeBeanEvent.java (added)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/UnscopeBeanEvent.java Sat Jul 10 22:46:47 2010
@@ -0,0 +1,32 @@
+/*
+ * 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.extensions.cdi.core.api.scope.conversation;
+
+import java.io.Serializable;
+
+/**
+ * @author Gerhard Petracek
+ */
+public final class UnscopeBeanEvent extends ConversationEvent
+{
+ public UnscopeBeanEvent(Serializable bean)
+ {
+ super(bean);
+ }
+}
Copied: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/WindowContext.java (from r962434, myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationContext.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/WindowContext.java?p2=myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/WindowContext.java&p1=myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationContext.java&r1=962434&r2=962936&rev=962936&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationContext.java (original)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/WindowContext.java Sat Jul 10 22:46:47 2010
@@ -26,29 +26,38 @@ import java.util.Map;
/**
* @author Gerhard Petracek
*/
-public interface ConversationContext extends AttributeAware, Serializable
+public interface WindowContext extends AttributeAware, Serializable
{
+ String CURRENT_WINDOW_CONTEXT_BEAN_NAME = "currentWindowContext";
+
/**
* @return the id of the conversation (unique for each window/tab)
*/
Long getId();
/**
- * invalidate conversations immediately
+ * TODO add: endContext to reset the window scope
+ * invalidate all conversations immediately
*/
- void invalidate();
+ void endConversations();
/**
* @param conversationGroup group of the conversation in question
- * @return an existing conversation - null otherwise
+ * @return a new conversation for the given group
*/
- Conversation getConversation(Class conversationGroup);
+ Conversation createConversation(Class conversationGroup);
/**
* @param conversationGroup group of the conversation in question
* @return a new conversation for the given group
*/
- Conversation createConversation(Class conversationGroup);
+ Conversation getConversation(Class conversationGroup);
+
+ /**
+ * @param conversationGroup group of the conversation in question
+ * @return the removed conversation - null otherwise
+ */
+ Conversation endConversation(Class conversationGroup);
/**
* @return all active conversations of the current context
@@ -58,5 +67,8 @@ public interface ConversationContext ext
/**
* @return configuration of the current context
*/
- ConversationContextConfig getConfig();
+ WindowContextConfig getConfig();
+
+ //TODO move down
+ void cleanup();
}
Copied: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/WindowContextConfig.java (from r962434, myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationContextConfig.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/WindowContextConfig.java?p2=myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/WindowContextConfig.java&p1=myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationContextConfig.java&r1=962434&r2=962936&rev=962936&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/ConversationContextConfig.java (original)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/WindowContextConfig.java Sat Jul 10 22:46:47 2010
@@ -18,10 +18,20 @@
*/
package org.apache.myfaces.extensions.cdi.core.api.scope.conversation;
+import org.apache.myfaces.extensions.cdi.core.api.config.AbstractCodiConfig;
+
/**
* @author Gerhard Petracek
*/
-public interface ConversationContextConfig
+public abstract class WindowContextConfig extends AbstractCodiConfig
{
- Long getTimeout();
+ //TODO
+
+ //deactivate it for higher security
+
+ public abstract boolean isGetRequestParameterSupported();
+
+ public abstract int getWindowContextTimeoutInMinutes();
+
+ public abstract int getConversationTimeoutInMinutes();
}
Copied: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/access/ViewAccessScoped.java (from r962434, myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/access/AccessScoped.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/access/ViewAccessScoped.java?p2=myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/access/ViewAccessScoped.java&p1=myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/access/AccessScoped.java&r1=962434&r2=962936&rev=962936&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/access/AccessScoped.java (original)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/access/ViewAccessScoped.java Sat Jul 10 22:46:47 2010
@@ -31,10 +31,11 @@ import static java.lang.annotation.Reten
/**
* @author Gerhard Petracek
*/
-@Target({METHOD,TYPE,FIELD})
+@Target({METHOD, TYPE, FIELD})
@Retention(RUNTIME)
@NormalScope
@Inherited
-public @interface AccessScoped
+@Deprecated
+public @interface ViewAccessScoped
{
}
Modified: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/ConversationGroup.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/ConversationGroup.java?rev=962936&r1=962935&r2=962936&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/ConversationGroup.java (original)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/ConversationGroup.java Sat Jul 10 22:46:47 2010
@@ -20,19 +20,18 @@ package org.apache.myfaces.extensions.cd
import java.lang.annotation.Retention;
import java.lang.annotation.Target;
-import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.ElementType.FIELD;
-import static java.lang.annotation.ElementType.PARAMETER;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
/**
+ * TODO refactor it
+ *
* @author Gerhard Petracek
*/
-@Target({PARAMETER,TYPE,FIELD,METHOD})
+@Target({TYPE})
@Retention(RUNTIME)
public @interface ConversationGroup
{
- Class value() default DefaultGroup.class;
+ Class value();
}
\ No newline at end of file
Added: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/ViewAccess.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/ViewAccess.java?rev=962936&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/ViewAccess.java (added)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/ViewAccess.java Sat Jul 10 22:46:47 2010
@@ -0,0 +1,34 @@
+/*
+ * 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.extensions.cdi.core.api.scope.conversation.grouped;
+
+import static java.lang.annotation.ElementType.TYPE;
+import java.lang.annotation.Retention;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
+
+
+/**
+ * @author Gerhard Petracek
+ */
+@Target({TYPE})
+@Retention(RUNTIME)
+public @interface ViewAccess
+{
+}
\ No newline at end of file
Copied: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/Window.java (from r962434, myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/window/WindowScoped.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/Window.java?p2=myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/Window.java&p1=myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/window/WindowScoped.java&r1=962434&r2=962936&rev=962936&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/window/WindowScoped.java (original)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/Window.java Sat Jul 10 22:46:47 2010
@@ -16,25 +16,19 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.myfaces.extensions.cdi.core.api.scope.conversation.window;
+package org.apache.myfaces.extensions.cdi.core.api.scope.conversation.grouped;
-import javax.enterprise.context.NormalScope;
-import java.lang.annotation.Inherited;
-import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-import static java.lang.annotation.ElementType.METHOD;
import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.ElementType.FIELD;
+import java.lang.annotation.Retention;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
/**
* @author Gerhard Petracek
*/
-@Target({METHOD,TYPE,FIELD})
+@Target({TYPE})
@Retention(RUNTIME)
-@NormalScope
-@Inherited
-public @interface WindowScoped
+public @interface Window
{
-}
+}
\ No newline at end of file
Modified: myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/window/WindowScoped.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/window/WindowScoped.java?rev=962936&r1=962935&r2=962936&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/window/WindowScoped.java (original)
+++ myfaces/extensions/cdi/trunk/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/window/WindowScoped.java Sat Jul 10 22:46:47 2010
@@ -19,22 +19,22 @@
package org.apache.myfaces.extensions.cdi.core.api.scope.conversation.window;
import javax.enterprise.context.NormalScope;
+import static java.lang.annotation.ElementType.TYPE;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
-import java.lang.annotation.Target;
-import static java.lang.annotation.ElementType.METHOD;
-import static java.lang.annotation.ElementType.TYPE;
-import static java.lang.annotation.ElementType.FIELD;
import static java.lang.annotation.RetentionPolicy.RUNTIME;
+import java.lang.annotation.Target;
/**
* @author Gerhard Petracek
*/
-@Target({METHOD,TYPE,FIELD})
+@Target({TYPE})
@Retention(RUNTIME)
@NormalScope
@Inherited
+
+@Deprecated
public @interface WindowScoped
{
}
Copied: myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/AbstractConversationContextAdapter.java (from r962434, myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/grouped/AbstractGroupedConversationContextAdapter.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/AbstractConversationContextAdapter.java?p2=myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/AbstractConversationContextAdapter.java&p1=myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/grouped/AbstractGroupedConversationContextAdapter.java&r1=962434&r2=962936&rev=962936&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/grouped/AbstractGroupedConversationContextAdapter.java (original)
+++ myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/AbstractConversationContextAdapter.java Sat Jul 10 22:46:47 2010
@@ -16,27 +16,31 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.grouped;
+package org.apache.myfaces.extensions.cdi.core.impl.scope.conversation;
+import org.apache.myfaces.extensions.cdi.core.api.manager.BeanManagerProvider;
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.BeanAccessedEvent;
import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.grouped.ConversationScoped;
-import org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.grouped.spi.ConversationManager;
+import org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi.BeanEntry;
+import org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi.WindowContextManager;
+import org.apache.myfaces.extensions.cdi.core.impl.utils.CodiUtils;
-import javax.enterprise.inject.spi.BeanManager;
-import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.context.spi.Context;
import javax.enterprise.context.spi.Contextual;
import javax.enterprise.context.spi.CreationalContext;
-import javax.enterprise.context.spi.Context;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import java.io.Serializable;
import java.lang.annotation.Annotation;
-import java.util.Set;
/**
* @author Gerhard Petracek
*/
-public abstract class AbstractGroupedConversationContextAdapter implements Context
+public abstract class AbstractConversationContextAdapter implements Context
{
protected BeanManager beanManager;
- public AbstractGroupedConversationContextAdapter(BeanManager beanManager)
+ public AbstractConversationContextAdapter(BeanManager beanManager)
{
this.beanManager = beanManager;
}
@@ -50,7 +54,7 @@ public abstract class AbstractGroupedCon
}
/**
- * @param component descriptor of the bean
+ * @param component descriptor of the bean
* @param creationalContext context for creating a bean
* @return a scoped bean-instance
*/
@@ -58,11 +62,15 @@ public abstract class AbstractGroupedCon
{
if (component instanceof Bean)
{
- ConversationManager conversationManager = resolveConversationManager();
+ WindowContextManager conversationManager = resolveConversationManager();
+
+ Bean<T> bean = ((Bean<T>) component);
+
+ BeanEntry<T> beanEntry = new ConversationBeanEntry<T>(creationalContext, bean);
- T beanInstance = component.create(creationalContext);
- scopeBeanInstance((Bean<T>)component, beanInstance, conversationManager);
- return beanInstance;
+ scopeBeanEntry(conversationManager, beanEntry);
+
+ return beanEntry.getBeanInstance();
}
Class invalidComponentClass = component.create(creationalContext).getClass();
@@ -72,69 +80,63 @@ public abstract class AbstractGroupedCon
/**
* @param component descriptor of the bean
* @return an instance of the requested bean if it already exists in the current
- * {@link org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationContext}
- * null otherwise
+ * {@link org.apache.myfaces.extensions.cdi.core.api.scope.conversation.WindowContext}
+ * null otherwise
*/
public <T> T get(Contextual<T> component)
{
if (component instanceof Bean)
{
- Bean<T> foundBean = ((Bean<T>) component);
- ConversationManager conversationManager = resolveConversationManager();
+ Bean<T> bean = ((Bean<T>) component);
+ WindowContextManager conversationManager = resolveConversationManager();
+
+ T foundBeanInstance = resolveBeanInstance(conversationManager, bean);
+
+ if (foundBeanInstance != null)
+ {
+ BeanManagerProvider.getInstance().getBeanManager()
+ .fireEvent(new BeanAccessedEvent((Serializable) foundBeanInstance));
+ }
- return resolveBeanInstance(foundBean, conversationManager);
+ return foundBeanInstance;
}
- return null;
+ throw new IllegalStateException(component.getClass() + " is no valid conversation scoped bean");
}
/**
- * @return an instance of a custom (the default) {@link ConversationManager}
+ * @return an instance of a custom (the default)
+ * {@link org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi.WindowContextManager}
*/
- private ConversationManager resolveConversationManager()
+ private WindowContextManager resolveConversationManager()
{
- Bean<ConversationManager> conversationManagerBean = resolveConversationManagerBean();
- return conversationManagerBean.create(getConversationManagerCreationalContextFor(conversationManagerBean));
- }
+ Bean<WindowContextManager> conversationManagerBean = resolveConversationManagerBean();
+ return CodiUtils.getOrCreateScopedInstanceOfBean(conversationManagerBean);
- private CreationalContext<ConversationManager> getConversationManagerCreationalContextFor(
- Bean<ConversationManager> conversationManagerBean)
- {
- return this.beanManager.createCreationalContext(conversationManagerBean);
+ //TODO cleanup:
+ //return (ConversationManager)this.beanManager.getReference(
+ //conversationManagerBean, ConversationManager.class,
+ //getConversationManagerCreationalContextFor(conversationManagerBean));
}
- protected abstract Bean<ConversationManager> resolveConversationManagerBean();
+ protected abstract Bean<WindowContextManager> resolveConversationManagerBean();
/**
- * @return the descriptor of the default {@link ConversationManager}
- */
- protected Set<Bean<?>> getDefaultConversationManager()
- {
- return this.beanManager.getBeans(ConversationManager.class);
- }
-
- /**
- * @param beanDescriptor descriptor of the requested bean
- * @param conversationManager the current {@link ConversationManager}
+ * @param conversationManager the current
+ * {@link org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi.WindowContextManager}
+ * @param beanDescriptor descriptor of the requested bean
* @return the instance of the requested bean if it exists in the current
- * {@link org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationContext}
- * null otherwise
+ * {@link org.apache.myfaces.extensions.cdi.core.api.scope.conversation.WindowContext}
+ * null otherwise
*/
- private <T> T resolveBeanInstance(Bean<T> beanDescriptor, ConversationManager conversationManager)
- {
- //TODO
- return null;
- }
+ protected abstract <T> T resolveBeanInstance(WindowContextManager conversationManager, Bean<T> beanDescriptor);
/**
* Store the given bean in the
- * {@link org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationContext}
+ * {@link org.apache.myfaces.extensions.cdi.core.api.scope.conversation.WindowContext}
*
- * @param beanDescriptor descriptor of the current bean
- * @param beanInstance bean to save in the current conversation
- * @param conversationManager current {@link ConversationManager}
+ * @param conversationManager current
+ * {@link org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi.WindowContextManager}
+ * @param beanEntry current bean-entry
*/
- private <T> void scopeBeanInstance(Bean<T> beanDescriptor, T beanInstance, ConversationManager conversationManager)
- {
- //TODO
- }
+ protected abstract <T> void scopeBeanEntry(WindowContextManager conversationManager, BeanEntry<T> beanEntry);
}
Added: myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/ConversationBeanEntry.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/ConversationBeanEntry.java?rev=962936&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/ConversationBeanEntry.java (added)
+++ myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/ConversationBeanEntry.java Sat Jul 10 22:46:47 2010
@@ -0,0 +1,66 @@
+/*
+ * 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.extensions.cdi.core.impl.scope.conversation;
+
+import org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi.BeanEntry;
+import static org.apache.myfaces.extensions.cdi.core.impl.utils.CodiUtils.createNewInstanceOfBean;
+
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+
+/**
+ * @author Gerhard Petracek
+ */
+class ConversationBeanEntry<T> implements BeanEntry<T>
+{
+ private static final long serialVersionUID = -4756851133555458294L;
+
+ private Bean<T> bean;
+
+ private T currentBeanInstance;
+
+ ConversationBeanEntry(CreationalContext<T> creationalContext, Bean<T> bean)
+ {
+ this.bean = bean;
+ this.currentBeanInstance = createNewInstanceOfBean(bean, creationalContext);
+ }
+
+ public Bean<T> getBean()
+ {
+ return this.bean;
+ }
+
+ public T getBeanInstance()
+ {
+ if (this.currentBeanInstance == null)
+ {
+ this.currentBeanInstance = createNewInstanceOfBean(this.bean);
+ }
+ return this.currentBeanInstance;
+ }
+
+ public T resetBeanInstance()
+ {
+ T oldBeanInstance = this.currentBeanInstance;
+
+ this.currentBeanInstance = null;
+
+ return oldBeanInstance;
+ }
+}
Added: myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/BeanEntry.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/BeanEntry.java?rev=962936&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/BeanEntry.java (added)
+++ myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/BeanEntry.java Sat Jul 10 22:46:47 2010
@@ -0,0 +1,37 @@
+/*
+ * 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.extensions.cdi.core.impl.scope.conversation.spi;
+
+import javax.enterprise.inject.spi.Bean;
+import java.io.Serializable;
+
+/**
+ * @author Gerhard Petracek
+ */
+public interface BeanEntry<T> extends Serializable
+{
+ Bean getBean();
+
+ T getBeanInstance();
+
+ /**
+ * @return the old instance
+ */
+ T resetBeanInstance();
+}
Modified: myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/ConversationContextFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/ConversationContextFactory.java?rev=962936&r1=962434&r2=962936&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/ConversationContextFactory.java (original)
+++ myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/ConversationContextFactory.java Sat Jul 10 22:46:47 2010
@@ -16,18 +16,20 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.grouped.spi;
+package org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi;
-import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationContext;
-import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationContextConfig;
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.WindowContext;
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.WindowContextConfig;
/**
* TODO
+ *
* @author Gerhard Petracek
*/
+@Deprecated
public interface ConversationContextFactory
{
- ConversationContext createConversationContext(long id);
-
- ConversationContext createConversationContext(long id, ConversationContextConfig config);
+ WindowContext createConversationContext(long id);
+
+ WindowContext createConversationContext(long id, WindowContextConfig config);
}
Modified: myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/ConversationFactory.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/ConversationFactory.java?rev=962936&r1=962434&r2=962936&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/ConversationFactory.java (original)
+++ myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/ConversationFactory.java Sat Jul 10 22:46:47 2010
@@ -16,16 +16,18 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.grouped.spi;
+package org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi;
-import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationContext;
import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.Conversation;
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.WindowContext;
/**
* TODO
+ *
* @author Gerhard Petracek
*/
+@Deprecated
public interface ConversationFactory
{
- Conversation createConversation(ConversationContext context, Class conversationGroup);
+ Conversation createConversation(WindowContext context, Class conversationGroup);
}
Added: myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/EditableConversation.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/EditableConversation.java?rev=962936&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/EditableConversation.java (added)
+++ myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/EditableConversation.java Sat Jul 10 22:46:47 2010
@@ -0,0 +1,27 @@
+/*
+ * 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.extensions.cdi.core.impl.scope.conversation.spi;
+
+/**
+ * @author Gerhard Petracek
+ */
+public interface EditableConversation
+{
+ <T> void addBean(Class<?> beanClass, BeanEntry<T> beanInstance);
+}
Copied: myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/WindowContextManager.java (from r962434, myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/grouped/spi/ConversationManager.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/WindowContextManager.java?p2=myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/WindowContextManager.java&p1=myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/grouped/spi/ConversationManager.java&r1=962434&r2=962936&rev=962936&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/grouped/spi/ConversationManager.java (original)
+++ myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/spi/WindowContextManager.java Sat Jul 10 22:46:47 2010
@@ -16,26 +16,45 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.grouped.spi;
+package org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.spi;
-import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationContext;
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.WindowContext;
+
+import java.io.Serializable;
/**
* @author Gerhard Petracek
*/
-public interface ConversationManager
+public interface WindowContextManager extends Serializable
{
- String CONVERSATION_CONTEXT_ID_PARAMETER_KEY = "codiConversationContext";
+ String WINDOW_CONTEXT_ID_PARAMETER_KEY = "windowContextId";
+
+ WindowContext getCurrentWindowContext();
+
+ WindowContext getWindowContext(long windowContextId);
+
+ @Deprecated
+ void activateWindowContext(long windowContextId);
+
+ @Deprecated
+ void activateWindowContext(WindowContext windowContext);
+
+ void resetCurrentWindowContext();
+
+ void resetWindowContext(long id);
+
+ void resetWindowContext(WindowContext windowContext);
- ConversationContext getCurrentConversationContext();
+ //TODO
+ void resetConversations();
- void activateConversationContext(ConversationContext conversationContext);
+ void resetConversations(long windowContextId);
- void resetCurrentConversationContext();
+ void resetConversations(WindowContext windowContext);
- void resetConversationContext(ConversationContext conversationContext);
+ void removeCurrentWindowContext();
- void removeCurrentConversationContext();
+ void removeWindowContext(long id);
- void removeConversationContext(ConversationContext conversationContext);
+ void removeWindowContext(WindowContext windowContext);
}
Modified: myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/utils/CodiUtils.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/utils/CodiUtils.java?rev=962936&r1=962935&r2=962936&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/utils/CodiUtils.java (original)
+++ myfaces/extensions/cdi/trunk/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/utils/CodiUtils.java Sat Jul 10 22:46:47 2010
@@ -18,22 +18,59 @@
*/
package org.apache.myfaces.extensions.cdi.core.impl.utils;
+import org.apache.myfaces.extensions.cdi.core.api.manager.BeanManagerProvider;
import org.apache.myfaces.extensions.cdi.core.api.util.ClassUtils;
+import javax.enterprise.context.spi.Context;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
/**
* This is a collection of a few useful static helper functions.
- *
+ * <p/>
* <a href="mailto:struberg@yahoo.de">Mark Struberg</a>
*/
public class CodiUtils
{
-
public static final String CODI_PROPERTIES = "/META-INF/extcdi/extcdi.properties";
+ public static <T> T createNewInstanceOfBean(Bean<T> bean)
+ {
+ BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();
+
+ CreationalContext<T> creationalContext = getCreationalContextFor(beanManager, bean);
+
+ return createNewInstanceOfBean(bean, creationalContext);
+ }
+
+ public static <T> T createNewInstanceOfBean(Bean<T> bean, CreationalContext<T> creationalContext)
+ {
+ return bean.create(creationalContext);
+ }
+
+ public static <T> T getOrCreateScopedInstanceOfBean(Bean<T> bean)
+ {
+ BeanManager beanManager = BeanManagerProvider.getInstance().getBeanManager();
+ Context context = beanManager.getContext(bean.getScope());
+
+ T result = context.get(bean);
+
+ if (result == null)
+ {
+ result = context.get(bean, getCreationalContextFor(beanManager, bean));
+ }
+ return result;
+ }
+
+ private static <T> CreationalContext<T> getCreationalContextFor(BeanManager beanManager, Bean<T> bean)
+ {
+ return beanManager.createCreationalContext(bean);
+ }
+
/**
* Load Properties from a configuration file with the given resourceName.
*
@@ -57,6 +94,7 @@ public class CodiUtils
/**
* Lookup the given property from the default CODI properties file.
+ *
* @param propertyName
* @return the value of the property or <code>null</code> it it doesn't exist.
* @throws IOException
Added: myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean1.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean1.java?rev=962936&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean1.java (added)
+++ myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean1.java Sat Jul 10 22:46:47 2010
@@ -0,0 +1,51 @@
+/*
+ * 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.blank.conversation.grouped;
+
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.grouped.ConversationScoped;
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.grouped.ConversationGroup;
+
+import javax.inject.Named;
+import javax.annotation.PostConstruct;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author Gerhard Petracek
+ */
+@Named
+@ConversationScoped
+@ConversationGroup(ConversationGroup1.class)
+public class ConversationDemoBean1 implements Serializable
+{
+ private String value = "Hello grouped conversation1! ";
+ private Date createdAt;
+ private static final long serialVersionUID = -4238520498463300564L;
+
+ @PostConstruct
+ public void init()
+ {
+ this.createdAt = new Date();
+ }
+
+ public String getValue()
+ {
+ return value + createdAt.toLocaleString();
+ }
+}
Added: myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean2.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean2.java?rev=962936&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean2.java (added)
+++ myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean2.java Sat Jul 10 22:46:47 2010
@@ -0,0 +1,51 @@
+/*
+ * 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.blank.conversation.grouped;
+
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.grouped.ConversationScoped;
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.grouped.ConversationGroup;
+
+import javax.inject.Named;
+import javax.annotation.PostConstruct;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author Gerhard Petracek
+ */
+@Named
+@ConversationScoped
+@ConversationGroup(ConversationGroup1.class)
+public class ConversationDemoBean2 implements Serializable
+{
+ private String value = "Hello grouped conversation2! ";
+ private Date createdAt;
+ private static final long serialVersionUID = -4238520498463300564L;
+
+ @PostConstruct
+ public void init()
+ {
+ this.createdAt = new Date();
+ }
+
+ public String getValue()
+ {
+ return value + createdAt.toLocaleString();
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean3.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean3.java?rev=962936&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean3.java (added)
+++ myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean3.java Sat Jul 10 22:46:47 2010
@@ -0,0 +1,51 @@
+/*
+ * 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.blank.conversation.grouped;
+
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.grouped.ConversationScoped;
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.grouped.Window;
+
+import javax.inject.Named;
+import javax.annotation.PostConstruct;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author Gerhard Petracek
+ */
+@Named
+@Window
+@ConversationScoped
+public class ConversationDemoBean3 implements Serializable
+{
+ private String value = "Hello window conversation! ";
+ private Date createdAt;
+ private static final long serialVersionUID = -4238520498463300564L;
+
+ @PostConstruct
+ public void init()
+ {
+ this.createdAt = new Date();
+ }
+
+ public String getValue()
+ {
+ return value + createdAt.toLocaleString();
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean4.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean4.java?rev=962936&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean4.java (added)
+++ myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationDemoBean4.java Sat Jul 10 22:46:47 2010
@@ -0,0 +1,51 @@
+/*
+ * 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.blank.conversation.grouped;
+
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.grouped.ConversationScoped;
+import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.grouped.ViewAccess;
+
+import javax.inject.Named;
+import javax.annotation.PostConstruct;
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * @author Gerhard Petracek
+ */
+@Named
+@ViewAccess
+@ConversationScoped
+public class ConversationDemoBean4 implements Serializable
+{
+ private String value = "Hello view access scoped! ";
+ private Date createdAt;
+ private static final long serialVersionUID = -4238520498463300564L;
+
+ @PostConstruct
+ public void init()
+ {
+ this.createdAt = new Date();
+ }
+
+ public String getValue()
+ {
+ return value + createdAt.toLocaleString();
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationGroup1.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationGroup1.java?rev=962936&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationGroup1.java (added)
+++ myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/java/org/apache/myfaces/blank/conversation/grouped/ConversationGroup1.java Sat Jul 10 22:46:47 2010
@@ -0,0 +1,26 @@
+/*
+ * 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.blank.conversation.grouped;
+
+/**
+ * @author Gerhard Petracek
+ */
+interface ConversationGroup1
+{
+}
Modified: myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/WEB-INF/faces-config.xml?rev=962936&r1=962935&r2=962936&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/WEB-INF/faces-config.xml Sat Jul 10 22:46:47 2010
@@ -39,4 +39,36 @@
<var>c002</var>
</resource-bundle>
</application>
+
+
+ <navigation-rule>
+ <from-view-id>*</from-view-id>
+ <navigation-case>
+ <from-outcome>home</from-outcome>
+ <to-view-id>/helloMyFacesCodi.jsp</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+
+ <navigation-rule>
+ <from-view-id>/helloMyFacesCodi.jsp</from-view-id>
+ <navigation-case>
+ <from-outcome>next</from-outcome>
+ <to-view-id>/helloMyFacesCodi1.jsp</to-view-id>
+ <redirect/>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/helloMyFacesCodi1.jsp</from-view-id>
+ <navigation-case>
+ <from-outcome>next</from-outcome>
+ <to-view-id>/helloMyFacesCodi2.jsp</to-view-id>
+ </navigation-case>
+ </navigation-rule>
+ <navigation-rule>
+ <from-view-id>/helloMyFacesCodi2.jsp</from-view-id>
+ <navigation-case>
+ <from-outcome>next</from-outcome>
+ <to-view-id>/helloMyFacesCodi3.jsp</to-view-id>
+ </navigation-case>
+ </navigation-rule>
</faces-config>
\ No newline at end of file
Modified: myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/helloMyFacesCodi.jsp
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/helloMyFacesCodi.jsp?rev=962936&r1=962935&r2=962936&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/helloMyFacesCodi.jsp (original)
+++ myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/helloMyFacesCodi.jsp Sat Jul 10 22:46:47 2010
@@ -47,6 +47,18 @@
</h:panelGrid>
</h:form>
+ <h:form id="conversationForm">
+ <h:commandLink value="next" action="next"/>
+ </h:form>
+
+ <h:panelGrid>
+ <h:outputText value="#{conversationDemoBean1.value}"/>
+ <h:outputText value="#{conversationDemoBean2.value}"/>
+ <h:outputText value="#{conversationDemoBean3.value}"/>
+ <h:outputText value="#{conversationDemoBean4.value}"/>
+ <h:outputText value="#{currentWindowContext.id}"/>
+ </h:panelGrid>
+
<h:messages globalOnly="true" infoStyle="color: blue;" warnStyle="color: orange;" errorStyle="color: red;" fatalStyle="color:darkred;"/>
</f:view>
</body>
Added: myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/helloMyFacesCodi1.jsp
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/helloMyFacesCodi1.jsp?rev=962936&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/helloMyFacesCodi1.jsp (added)
+++ myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/helloMyFacesCodi1.jsp Sat Jul 10 22:46:47 2010
@@ -0,0 +1,41 @@
+<%--
+ * 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.
+--%>
+
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<html>
+ <head>
+ <title>Hello World</title>
+ </head>
+ <body>
+ <f:view>
+ <h:form>
+ <h:commandLink value="next" action="next"/>
+ </h:form>
+
+ <h:panelGrid>
+ <h:outputText value="#{conversationDemoBean1.value}"/>
+ <h:outputText value="#{conversationDemoBean2.value}"/>
+ <h:outputText value="#{conversationDemoBean3.value}"/>
+ <h:outputText value="#{conversationDemoBean4.value}"/>
+ <h:outputText value="#{currentWindowContext.id}"/>
+ </h:panelGrid>
+
+ <h:messages globalOnly="true" infoStyle="color: blue;" warnStyle="color: orange;" errorStyle="color: red;" fatalStyle="color:darkred;"/>
+ </f:view>
+ </body>
+</html>
Added: myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/helloMyFacesCodi2.jsp
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/helloMyFacesCodi2.jsp?rev=962936&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/helloMyFacesCodi2.jsp (added)
+++ myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/helloMyFacesCodi2.jsp Sat Jul 10 22:46:47 2010
@@ -0,0 +1,41 @@
+<%--
+ * 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.
+--%>
+
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<html>
+ <head>
+ <title>Hello World</title>
+ </head>
+ <body>
+ <f:view>
+ <h:panelGrid>
+ <h:outputText value="#{conversationDemoBean1.value}"/>
+ <h:outputText value="#{conversationDemoBean2.value}"/>
+ <h:outputText value="#{conversationDemoBean3.value}"/>
+ <h:outputText value="#{conversationDemoBean4.value}"/>
+ <h:outputText value="#{currentWindowContext.id}"/>
+ </h:panelGrid>
+
+ <h:form>
+ <h:commandLink value="next 2" action="next"/>
+ </h:form>
+
+ <h:messages globalOnly="true" infoStyle="color: blue;" warnStyle="color: orange;" errorStyle="color: red;" fatalStyle="color:darkred;"/>
+ </f:view>
+ </body>
+</html>
Added: myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/helloMyFacesCodi3.jsp
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/helloMyFacesCodi3.jsp?rev=962936&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/helloMyFacesCodi3.jsp (added)
+++ myfaces/extensions/cdi/trunk/examples/jsf-examples/hello_myfaces-codi_jsf12/src/main/webapp/helloMyFacesCodi3.jsp Sat Jul 10 22:46:47 2010
@@ -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.
+--%>
+
+<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
+<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
+<html>
+ <head>
+ <title>Hello World</title>
+ </head>
+ <body>
+ <f:view>
+ <h:form>
+ <h:commandLink value="back to start" action="home"/>
+ </h:form>
+
+ <h:messages globalOnly="true" infoStyle="color: blue;" warnStyle="color: orange;" errorStyle="color: red;" fatalStyle="color:darkred;"/>
+ </f:view>
+ </body>
+</html>
Modified: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/ConfigParameter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/ConfigParameter.java?rev=962936&r1=962935&r2=962936&view=diff
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/ConfigParameter.java (original)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/ConfigParameter.java Sat Jul 10 22:46:47 2010
@@ -25,7 +25,23 @@ import org.apache.myfaces.extensions.cdi
*/
public interface ConfigParameter
{
- static final String TRANSACTION_TOKEN_ENABLED = CoreCodiConfigParameter.BASE_NAME + "TRANSACTION_TOKEN_ENABLED";
+ static final String TRANSACTION_TOKEN_ENABLED =
+ CoreCodiConfigParameter.BASE_NAME + "TRANSACTION_TOKEN_ENABLED";
static final Boolean TRANSACTION_TOKEN_ENABLED_DEFAULT = Boolean.FALSE;
+
+ static final String GET_REQUEST_PARAMETER_ENABLED =
+ CoreCodiConfigParameter.BASE_NAME + "GET_REQUEST_PARAMETER_ENABLED";
+
+ static final boolean GET_REQUEST_PARAMETER_ENABLED_DEFAULT = true;
+
+ static final String GROUPED_CONVERSATION_TIMEOUT =
+ CoreCodiConfigParameter.BASE_NAME + "GROUPED_CONVERSATION_TIMEOUT";
+
+ static final int GROUPED_CONVERSATION_TIMEOUT_DEFAULT = 2;
+
+ static final String WINDOW_CONTEXT_TIMEOUT =
+ CoreCodiConfigParameter.BASE_NAME + "WINDOW_CONTEXT_TIMEOUT";
+
+ static final int WINDOW_CONTEXT_TIMEOUT_DEFAULT = 2;
}
Added: myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/request/AbstractRequestTypeResolver.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/request/AbstractRequestTypeResolver.java?rev=962936&view=auto
==============================================================================
--- myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/request/AbstractRequestTypeResolver.java (added)
+++ myfaces/extensions/cdi/trunk/jee-modules/jsf-module/api/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/api/request/AbstractRequestTypeResolver.java Sat Jul 10 22:46:47 2010
@@ -0,0 +1,69 @@
+/*
+ * 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.extensions.cdi.javaee.jsf.api.request;
+
+import org.apache.myfaces.extensions.cdi.core.api.resolver.ConfigResolver;
+
+import javax.inject.Inject;
+
+/**
+ * @author Gerhard Petracek
+ */
+public abstract class AbstractRequestTypeResolver implements RequestTypeResolver
+{
+ @Inject
+ @SuppressWarnings({"UnusedDeclaration"})
+ private ConfigResolver configResolver;
+
+ private RequestTypeResolver defaultRequestTypeResolver;
+
+ public final boolean isPartialRequest()
+ {
+ return getCurrentRequestTypeResolver().isPartialRequest();
+ }
+
+ public final boolean isPostRequest()
+ {
+ return getCurrentRequestTypeResolver().isPostRequest();
+ }
+
+ protected abstract RequestTypeResolver createDefaultRequestTypeResolver();
+
+ private RequestTypeResolver getCurrentRequestTypeResolver()
+ {
+ RequestTypeResolver requestTypeResolver = getCustomRequestTypeResolver();
+
+ if (requestTypeResolver != null)
+ {
+ return requestTypeResolver;
+ }
+
+ if (this.defaultRequestTypeResolver == null)
+ {
+ this.defaultRequestTypeResolver = createDefaultRequestTypeResolver();
+ }
+ return this.defaultRequestTypeResolver;
+ }
+
+ private RequestTypeResolver getCustomRequestTypeResolver()
+ {
+ //TODO use the config resolver to get the custom RequestTypeResolver
+ return null;
+ }
+}
\ No newline at end of file