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/04/06 22:28:16 UTC
svn commit: r931306 - in
/myfaces/extensions/cdi/branches/sandbox_conversations:
core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/
core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conve...
Author: gpetracek
Date: Tue Apr 6 20:28:16 2010
New Revision: 931306
URL: http://svn.apache.org/viewvc?rev=931306&view=rev
Log:
grouped conversations
Added:
myfaces/extensions/cdi/branches/sandbox_conversations/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/
- copied from r930073, myfaces/extensions/cdi/branches/sandbox_conversations/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/named/
myfaces/extensions/cdi/branches/sandbox_conversations/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/ConversationGroup.java
myfaces/extensions/cdi/branches/sandbox_conversations/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/DefaultGroup.java
myfaces/extensions/cdi/branches/sandbox_conversations/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/grouped/
- copied from r931219, myfaces/extensions/cdi/branches/sandbox_conversations/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/named/
myfaces/extensions/cdi/branches/sandbox_conversations/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/grouped/AbstractGroupedConversationContextAdapter.java
- copied, changed from r931247, myfaces/extensions/cdi/branches/sandbox_conversations/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/named/AbstractNamedConversationContextAdapter.java
myfaces/extensions/cdi/branches/sandbox_conversations/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/grouped/spi/
- copied from r931247, myfaces/extensions/cdi/branches/sandbox_conversations/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/named/spi/
myfaces/extensions/cdi/branches/sandbox_conversations/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/grouped/
- copied from r930073, myfaces/extensions/cdi/branches/sandbox_conversations/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/named/
myfaces/extensions/cdi/branches/sandbox_conversations/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/grouped/GroupedConversationContextAdapter.java
myfaces/extensions/cdi/branches/sandbox_conversations/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/grouped/GroupedConversationContextExtension.java
Removed:
myfaces/extensions/cdi/branches/sandbox_conversations/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/named/
myfaces/extensions/cdi/branches/sandbox_conversations/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/grouped/AbstractNamedConversationContextAdapter.java
myfaces/extensions/cdi/branches/sandbox_conversations/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/named/
myfaces/extensions/cdi/branches/sandbox_conversations/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/grouped/NamedConversationContextAdapter.java
myfaces/extensions/cdi/branches/sandbox_conversations/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/grouped/NamedConversationContextExtension.java
myfaces/extensions/cdi/branches/sandbox_conversations/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/named/
Modified:
myfaces/extensions/cdi/branches/sandbox_conversations/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/ConversationScoped.java
myfaces/extensions/cdi/branches/sandbox_conversations/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/grouped/spi/ConversationManager.java
myfaces/extensions/cdi/branches/sandbox_conversations/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/DefaultConversationManager.java
Added: myfaces/extensions/cdi/branches/sandbox_conversations/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/branches/sandbox_conversations/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/ConversationGroup.java?rev=931306&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/sandbox_conversations/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/ConversationGroup.java (added)
+++ myfaces/extensions/cdi/branches/sandbox_conversations/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/ConversationGroup.java Tue Apr 6 20:28:16 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.grouped;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.Target;
+import static java.lang.annotation.ElementType.*;
+import static java.lang.annotation.RetentionPolicy.RUNTIME;
+
+
+/**
+ * @author Gerhard Petracek
+ */
+@Target({PARAMETER,TYPE,FIELD,METHOD})
+@Retention(RUNTIME)
+public @interface ConversationGroup
+{
+ Class value() default DefaultGroup.class;
+}
\ No newline at end of file
Modified: myfaces/extensions/cdi/branches/sandbox_conversations/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/ConversationScoped.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/sandbox_conversations/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/ConversationScoped.java?rev=931306&r1=930073&r2=931306&view=diff
==============================================================================
--- myfaces/extensions/cdi/branches/sandbox_conversations/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/ConversationScoped.java (original)
+++ myfaces/extensions/cdi/branches/sandbox_conversations/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/ConversationScoped.java Tue Apr 6 20:28:16 2010
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.myfaces.extensions.cdi.core.api.scope.conversation.named;
+package org.apache.myfaces.extensions.cdi.core.api.scope.conversation.grouped;
import javax.enterprise.context.NormalScope;
import java.lang.annotation.Inherited;
@@ -29,7 +29,7 @@ import static java.lang.annotation.Reten
/**
* @author Gerhard Petracek
*/
-@Target({METHOD,TYPE,FIELD})
+@Target({PARAMETER,TYPE,FIELD,METHOD})
@Retention(RUNTIME)
@NormalScope
@Inherited
Added: myfaces/extensions/cdi/branches/sandbox_conversations/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/DefaultGroup.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/sandbox_conversations/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/DefaultGroup.java?rev=931306&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/sandbox_conversations/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/DefaultGroup.java (added)
+++ myfaces/extensions/cdi/branches/sandbox_conversations/core/api/src/main/java/org/apache/myfaces/extensions/cdi/core/api/scope/conversation/grouped/DefaultGroup.java Tue Apr 6 20:28:16 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.extensions.cdi.core.api.scope.conversation.grouped;
+
+/**
+ * @author Gerhard Petracek
+ */
+public interface DefaultGroup
+{
+}
Copied: myfaces/extensions/cdi/branches/sandbox_conversations/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/grouped/AbstractGroupedConversationContextAdapter.java (from r931247, myfaces/extensions/cdi/branches/sandbox_conversations/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/named/AbstractNamedConversationContextAdapter.java)
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/sandbox_conversations/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/grouped/AbstractGroupedConversationContextAdapter.java?p2=myfaces/extensions/cdi/branches/sandbox_conversations/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/grouped/AbstractGroupedConversationContextAdapter.java&p1=myfaces/extensions/cdi/branches/sandbox_conversations/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/named/AbstractNamedConversationContextAdapter.java&r1=931247&r2=931306&rev=931306&view=diff
==============================================================================
--- myfaces/extensions/cdi/branches/sandbox_conversations/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/named/AbstractNamedConversationContextAdapter.java (original)
+++ myfaces/extensions/cdi/branches/sandbox_conversations/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/grouped/AbstractGroupedConversationContextAdapter.java Tue Apr 6 20:28:16 2010
@@ -16,10 +16,10 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.named;
+package org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.grouped;
-import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.named.ConversationScoped;
-import org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.named.spi.ConversationManager;
+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 javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.Bean;
@@ -32,11 +32,11 @@ import java.util.Set;
/**
* @author Gerhard Petracek
*/
-public abstract class AbstractNamedConversationContextAdapter implements Context
+public abstract class AbstractGroupedConversationContextAdapter implements Context
{
protected BeanManager beanManager;
- public AbstractNamedConversationContextAdapter(BeanManager beanManager)
+ public AbstractGroupedConversationContextAdapter(BeanManager beanManager)
{
this.beanManager = beanManager;
}
Modified: myfaces/extensions/cdi/branches/sandbox_conversations/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/branches/sandbox_conversations/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/grouped/spi/ConversationManager.java?rev=931306&r1=931247&r2=931306&view=diff
==============================================================================
--- myfaces/extensions/cdi/branches/sandbox_conversations/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/grouped/spi/ConversationManager.java (original)
+++ myfaces/extensions/cdi/branches/sandbox_conversations/core/impl/src/main/java/org/apache/myfaces/extensions/cdi/core/impl/scope/conversation/grouped/spi/ConversationManager.java Tue Apr 6 20:28:16 2010
@@ -16,7 +16,7 @@
* specific language governing permissions and limitations
* under the License.
*/
-package org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.named.spi;
+package org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.grouped.spi;
import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationContext;
Modified: myfaces/extensions/cdi/branches/sandbox_conversations/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/DefaultConversationManager.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/sandbox_conversations/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/DefaultConversationManager.java?rev=931306&r1=931305&r2=931306&view=diff
==============================================================================
--- myfaces/extensions/cdi/branches/sandbox_conversations/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/DefaultConversationManager.java (original)
+++ myfaces/extensions/cdi/branches/sandbox_conversations/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/DefaultConversationManager.java Tue Apr 6 20:28:16 2010
@@ -18,7 +18,7 @@
*/
package org.apache.myfaces.extensions.cdi.javaee.jsf.impl.scope.conversation;
-import org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.named.spi.ConversationManager;
+import org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.grouped.spi.ConversationManager;
import org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationContext;
/**
Added: myfaces/extensions/cdi/branches/sandbox_conversations/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/grouped/GroupedConversationContextAdapter.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/sandbox_conversations/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/grouped/GroupedConversationContextAdapter.java?rev=931306&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/sandbox_conversations/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/grouped/GroupedConversationContextAdapter.java (added)
+++ myfaces/extensions/cdi/branches/sandbox_conversations/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/grouped/GroupedConversationContextAdapter.java Tue Apr 6 20:28:16 2010
@@ -0,0 +1,70 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.myfaces.extensions.cdi.javaee.jsf.impl.scope.conversation.grouped;
+
+import org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.grouped.spi.ConversationManager;
+import org.apache.myfaces.extensions.cdi.core.api.tools.annotate.DefaultAnnotation;
+import org.apache.myfaces.extensions.cdi.core.impl.scope.conversation.grouped.AbstractGroupedConversationContextAdapter;
+import org.apache.myfaces.extensions.cdi.javaee.jsf.api.qualifier.Jsf;
+
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.faces.context.FacesContext;
+import java.util.Set;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class GroupedConversationContextAdapter extends AbstractGroupedConversationContextAdapter
+{
+ public GroupedConversationContextAdapter(BeanManager beanManager)
+ {
+ super(beanManager);
+ }
+
+ /**
+ * @return true as soon as JSF is active the {@link org.apache.myfaces.extensions.cdi.core.api.scope.conversation.ConversationContext}
+ * will be created automatically
+ */
+ public boolean isActive()
+ {
+ return FacesContext.getCurrentInstance().getExternalContext().getSession(false) != null;
+ }
+
+ /**
+ * @return the descriptor of a custom {@link ConversationManager} with the qualifier {@link Jsf} or
+ * the descriptor of the default implementation provided by this module
+ */
+ protected Bean<ConversationManager> resolveConversationManagerBean()
+ {
+ Set<?> conversationManagerBeans = this.beanManager.getBeans(ConversationManager.class, DefaultAnnotation.of(Jsf.class));
+
+ if(conversationManagerBeans.isEmpty())
+ {
+ conversationManagerBeans = getDefaultConversationManager();
+ }
+
+ if(conversationManagerBeans.size() != 1)
+ {
+ throw new IllegalStateException(conversationManagerBeans.size() + " conversation-managers were found");
+ }
+ //noinspection unchecked
+ return (Bean<ConversationManager>)conversationManagerBeans.iterator().next();
+ }
+}
\ No newline at end of file
Added: myfaces/extensions/cdi/branches/sandbox_conversations/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/grouped/GroupedConversationContextExtension.java
URL: http://svn.apache.org/viewvc/myfaces/extensions/cdi/branches/sandbox_conversations/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/grouped/GroupedConversationContextExtension.java?rev=931306&view=auto
==============================================================================
--- myfaces/extensions/cdi/branches/sandbox_conversations/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/grouped/GroupedConversationContextExtension.java (added)
+++ myfaces/extensions/cdi/branches/sandbox_conversations/jee-modules/jsf-module/impl/src/main/java/org/apache/myfaces/extensions/cdi/javaee/jsf/impl/scope/conversation/grouped/GroupedConversationContextExtension.java Tue Apr 6 20:28:16 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.javaee.jsf.impl.scope.conversation.grouped;
+
+import javax.enterprise.inject.spi.Extension;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.event.Observes;
+
+/**
+ * @author Gerhard Petracek
+ */
+public class GroupedConversationContextExtension implements Extension
+{
+ public void afterBeanDiscovery(@Observes AfterBeanDiscovery event, BeanManager manager) {
+ event.addContext(new GroupedConversationContextAdapter(manager));
+ }
+}