You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by ta...@apache.org on 2017/09/08 22:55:59 UTC
svn commit: r1807839 - in /myfaces/core/branches/2.3.x/impl/src/main:
java/org/apache/myfaces/cdi/ java/org/apache/myfaces/cdi/faces/
java/org/apache/myfaces/cdi/util/
java/org/apache/myfaces/cdi/viewtransient/ resources/META-INF/services/
Author: tandraschko
Date: Fri Sep 8 22:55:58 2017
New Revision: 1807839
URL: http://svn.apache.org/viewvc?rev=1807839&view=rev
Log:
MYFACES-4127 use FlowScoped for FlowMap
Added:
myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactFlowMapProducer.java
myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactProducer.java
myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactProducerExtension.java
myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/util/AbstractDynamicProducer.java
myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/util/DefaultLiteral.java
- copied, changed from r1807817, myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/util/AnyLiteral.java
myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/util/ParameterizedTypeImpl.java
Removed:
myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/faces/ApplicationScopeObjectProducer.java
myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/faces/FacesScopeObjectProducer.java
myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/viewtransient/ViewTransientScopeObjectProducer.java
Modified:
myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/faces/FacesScopeContextExtension.java
myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/viewtransient/ViewTransientScopeContextExtension.java
myfaces/core/branches/2.3.x/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
Added: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactFlowMapProducer.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactFlowMapProducer.java?rev=1807839&view=auto
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactFlowMapProducer.java (added)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactFlowMapProducer.java Fri Sep 8 22:55:58 2017
@@ -0,0 +1,48 @@
+/*
+ * 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.cdi;
+
+import java.lang.reflect.Type;
+import java.util.Map;
+import javax.enterprise.util.AnnotationLiteral;
+import javax.faces.annotation.FlowMap;
+import javax.faces.context.FacesContext;
+import javax.faces.flow.FlowScoped;
+import org.apache.myfaces.cdi.util.AbstractDynamicProducer;
+import org.apache.myfaces.cdi.util.ParameterizedTypeImpl;
+
+public class JsfArtifactFlowMapProducer extends AbstractDynamicProducer
+{
+ class FlowMapAnnotationLiteral extends AnnotationLiteral<FlowMap> implements FlowMap
+ {
+ private static final long serialVersionUID = -8623640277155878657L;
+ }
+
+ public JsfArtifactFlowMapProducer()
+ {
+ super.name("flowScope")
+ .scope(FlowScoped.class)
+ .qualifiers(new FlowMapAnnotationLiteral())
+ .types(new ParameterizedTypeImpl(Map.class, new Type[] { Object.class, Object.class }),
+ Map.class,
+ Object.class)
+ .beanClass(Map.class)
+ .create(e -> FacesContext.getCurrentInstance().getApplication().getFlowHandler().getCurrentFlowScope());
+ }
+}
Added: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactProducer.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactProducer.java?rev=1807839&view=auto
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactProducer.java (added)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactProducer.java Fri Sep 8 22:55:58 2017
@@ -0,0 +1,229 @@
+/*
+ * 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.cdi;
+
+import java.util.Map;
+import javax.enterprise.context.ApplicationScoped;
+import javax.enterprise.inject.Produces;
+import javax.faces.annotation.ApplicationMap;
+import javax.faces.annotation.HeaderMap;
+import javax.faces.annotation.HeaderValuesMap;
+import javax.faces.annotation.InitParameterMap;
+import javax.faces.annotation.RequestCookieMap;
+import javax.faces.annotation.RequestMap;
+import javax.faces.annotation.RequestParameterMap;
+import javax.faces.annotation.RequestParameterValuesMap;
+import javax.faces.annotation.SessionMap;
+import javax.faces.annotation.ViewMap;
+import javax.faces.application.Application;
+import javax.faces.application.ResourceHandler;
+import javax.faces.component.UIViewRoot;
+import javax.faces.context.ExternalContext;
+import javax.faces.context.FacesContext;
+import javax.faces.context.Flash;
+import javax.inject.Named;
+import org.apache.myfaces.cdi.faces.FacesScoped;
+import org.apache.myfaces.cdi.viewtransient.ViewTransientScoped;
+
+public class JsfArtifactProducer
+{
+ @Produces
+ @Named("application")
+ @ApplicationScoped
+ public Application getApplication()
+ {
+ return FacesContext.getCurrentInstance().getApplication();
+ }
+
+ @Produces
+ @Named("applicationScope")
+ @ApplicationMap
+ @ApplicationScoped
+ public Map<String, Object> getApplicationMap()
+ {
+ return FacesContext.getCurrentInstance().getExternalContext().getApplicationMap();
+ }
+
+ @Produces
+ @Named("initParam")
+ @InitParameterMap
+ @ApplicationScoped
+ public Map<String, String> getInitParameterMap()
+ {
+ return FacesContext.getCurrentInstance().getExternalContext().getInitParameterMap();
+ }
+
+ @Produces
+ @Named("resource")
+ @ApplicationScoped
+ public ResourceHandler getResourceHandler()
+ {
+ return FacesContext.getCurrentInstance().getApplication().getResourceHandler();
+ }
+
+ @Produces
+ @Named("facesContext")
+ @FacesScoped
+ public FacesContext getFacesContext()
+ {
+ return FacesContext.getCurrentInstance();
+ }
+
+ @Produces
+ @Named("externalContext")
+ @FacesScoped
+ public ExternalContext getExternalContext()
+ {
+ return FacesContext.getCurrentInstance().getExternalContext();
+ }
+
+ @Produces
+ @Named("flash")
+ @FacesScoped
+ public Flash getFlash()
+ {
+ return FacesContext.getCurrentInstance().getExternalContext().getFlash();
+ }
+
+ @Produces
+ @Named("header")
+ @HeaderMap
+ @FacesScoped
+ public Map<String, String> getHeaderMap()
+ {
+ return FacesContext.getCurrentInstance().getExternalContext().getRequestHeaderMap();
+ }
+
+ @Produces
+ @Named("headerValues")
+ @HeaderValuesMap
+ @FacesScoped
+ public Map<String, String[]> getHeaderValuesMap()
+ {
+ return FacesContext.getCurrentInstance().getExternalContext().getRequestHeaderValuesMap();
+ }
+
+ @Produces
+ @Named("requestScope")
+ @RequestMap
+ @FacesScoped
+ public Map<String, Object> getRequestMap()
+ {
+ return FacesContext.getCurrentInstance().getExternalContext().getRequestMap();
+ }
+
+ @Produces
+ @Named("cookie")
+ @RequestCookieMap
+ @FacesScoped
+ public Map<String, Object> getRequestCookieMap()
+ {
+ return FacesContext.getCurrentInstance().getExternalContext().getRequestCookieMap();
+ }
+
+ @Produces
+ @Named("param")
+ @RequestParameterMap
+ @FacesScoped
+ public Map<String, String> getRequestParameterMap()
+ {
+ return FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap();
+ }
+
+ @Produces
+ @Named("paramValues")
+ @RequestParameterValuesMap
+ @FacesScoped
+ public Map<String, String[]> getRequestParameterValuesMap()
+ {
+ return FacesContext.getCurrentInstance().getExternalContext().getRequestParameterValuesMap();
+ }
+
+ @Produces
+ @Named("sessionScope")
+ @SessionMap
+ @FacesScoped
+ public Map<String, Object> getSessionMap()
+ {
+ return FacesContext.getCurrentInstance().getExternalContext().getSessionMap();
+ }
+
+ @Produces
+ @Named("view")
+ @FacesScoped
+ public UIViewRoot getViewRoot()
+ {
+ return FacesContext.getCurrentInstance().getViewRoot();
+ }
+
+ @Produces
+ @Named("session")
+ @FacesScoped
+ public Object getSession()
+ {
+ return FacesContext.getCurrentInstance().getExternalContext().getSession(false);
+ }
+
+
+ /*
+ The spec actually forces us the use producers for "cc" and "component but it leads to a bad performance.
+ Also @Inject UIComponent doesn't make sense and wouldn't work correctly if we don't create a own "ComponentScoped"
+ or something.
+ We will still use ELResolvers for this - see ImplicitObjectResolver#makeResolverForFacesCDI().
+
+ @Produces
+ @Named("component")
+ @Dependent
+ public UIComponent getComponent()
+ {
+ return UIComponent.getCurrentComponent(FacesContext.getCurrentInstance());
+ }
+
+ @Produces
+ @Named("cc")
+ @Dependent
+ public UIComponent getCompositeComponent()
+ {
+ return UIComponent.getCurrentCompositeComponent(FacesContext.getCurrentInstance());
+ }
+ */
+
+ /*
+ Produced by FlowMapProducer now
+
+ @Produces
+ @Named("flowScope")
+ @FlowMap
+ @FacesScoped
+ public Map<Object, Object> getFlowMap()
+ {
+ return FacesContext.getCurrentInstance().getApplication().getFlowHandler().getCurrentFlowScope();
+ }
+ */
+
+ @Produces
+ @Named("viewScope")
+ @ViewMap
+ @ViewTransientScoped
+ public Map<String, Object> getViewMap()
+ {
+ return FacesContext.getCurrentInstance().getViewRoot().getViewMap();
+ }
+
+}
Added: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactProducerExtension.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactProducerExtension.java?rev=1807839&view=auto
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactProducerExtension.java (added)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/JsfArtifactProducerExtension.java Fri Sep 8 22:55:58 2017
@@ -0,0 +1,43 @@
+/*
+ * 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.cdi;
+
+import javax.enterprise.event.Observes;
+import javax.enterprise.inject.spi.AfterBeanDiscovery;
+import javax.enterprise.inject.spi.AnnotatedType;
+import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.inject.spi.BeforeBeanDiscovery;
+import javax.enterprise.inject.spi.Extension;
+
+public class JsfArtifactProducerExtension implements Extension
+{
+
+ void beforeBeanDiscovery(
+ @Observes final BeforeBeanDiscovery event, BeanManager beanManager)
+ {
+ AnnotatedType<JsfArtifactProducer> jsfArtifactProducer =
+ beanManager.createAnnotatedType(JsfArtifactProducer.class);
+ event.addAnnotatedType(jsfArtifactProducer);
+ }
+
+ void afterBeanDiscovery(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager)
+ {
+ afterBeanDiscovery.addBean(new JsfArtifactFlowMapProducer());
+ }
+}
Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/faces/FacesScopeContextExtension.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/faces/FacesScopeContextExtension.java?rev=1807839&r1=1807838&r2=1807839&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/faces/FacesScopeContextExtension.java (original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/faces/FacesScopeContextExtension.java Fri Sep 8 22:55:58 2017
@@ -20,7 +20,6 @@ package org.apache.myfaces.cdi.faces;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.spi.AfterBeanDiscovery;
-import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.BeforeBeanDiscovery;
import javax.enterprise.inject.spi.Extension;
@@ -37,19 +36,12 @@ public class FacesScopeContextExtension
@Observes final BeforeBeanDiscovery event, BeanManager beanManager)
{
event.addScope(FacesScoped.class, true, false);
-
- AnnotatedType<FacesScopeObjectProducer> flowDiscoveryHelper =
- beanManager.createAnnotatedType(FacesScopeObjectProducer.class);
- event.addAnnotatedType(flowDiscoveryHelper);
-
- AnnotatedType<ApplicationScopeObjectProducer> applicationScopeObjectProducer =
- beanManager.createAnnotatedType(ApplicationScopeObjectProducer.class);
- event.addAnnotatedType(applicationScopeObjectProducer);
}
void afterBeanDiscovery(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager)
{
facesScopeContext = new FacesScopedContextImpl(beanManager);
afterBeanDiscovery.addContext(facesScopeContext);
+
}
}
Added: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/util/AbstractDynamicProducer.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/util/AbstractDynamicProducer.java?rev=1807839&view=auto
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/util/AbstractDynamicProducer.java (added)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/util/AbstractDynamicProducer.java Fri Sep 8 22:55:58 2017
@@ -0,0 +1,185 @@
+/*
+ * 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.cdi.util;
+
+import java.io.Serializable;
+import java.lang.annotation.Annotation;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.function.Function;
+import javax.enterprise.context.Dependent;
+import javax.enterprise.context.spi.CreationalContext;
+import javax.enterprise.inject.spi.Bean;
+import javax.enterprise.inject.spi.InjectionPoint;
+import javax.enterprise.inject.spi.PassivationCapable;
+
+// Inspired by Mojarra's CdiProducer
+public abstract class AbstractDynamicProducer<T> implements Bean<T>, PassivationCapable, Serializable
+{
+ private String id;
+ private String name;
+ private Class<?> beanClass;
+ private Set<Type> types;
+ private Set<Annotation> qualifiers;
+ private Class<? extends Annotation> scope;
+ private Function<CreationalContext<T>, T> create;
+
+ public AbstractDynamicProducer()
+ {
+ this.id = this.getClass().getName();
+ this.beanClass = Object.class;
+ this.types = Collections.singleton(Object.class);
+ this.qualifiers = Collections.unmodifiableSet(asSet(new DefaultLiteral(), new AnyLiteral()));
+ this.scope = Dependent.class;
+ }
+
+ @Override
+ public String getId()
+ {
+ return id;
+ }
+
+ @Override
+ public String getName()
+ {
+ return name;
+ }
+
+ @Override
+ public Class<?> getBeanClass()
+ {
+ return beanClass;
+ }
+
+ @Override
+ public Set<Type> getTypes()
+ {
+ return types;
+ }
+
+ @Override
+ public Set<Annotation> getQualifiers()
+ {
+ return qualifiers;
+ }
+
+ @Override
+ public Class<? extends Annotation> getScope()
+ {
+ return scope;
+ }
+
+ @Override
+ public T create(CreationalContext<T> creationalContext)
+ {
+ return create.apply(creationalContext);
+ }
+
+ @Override
+ public void destroy(T instance, CreationalContext<T> creationalContext)
+ {
+ // not required - we just push a JSF artifact into CDI
+ }
+
+ @Override
+ public Set<InjectionPoint> getInjectionPoints()
+ {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public Set<Class<? extends Annotation>> getStereotypes()
+ {
+ return Collections.emptySet();
+ }
+
+ @Override
+ public boolean isAlternative()
+ {
+ return false;
+ }
+
+ @Override
+ public boolean isNullable()
+ {
+ return false;
+ }
+
+
+
+
+ public AbstractDynamicProducer<T> name(String name)
+ {
+ this.name = name;
+ return this;
+ }
+
+ public AbstractDynamicProducer<T> create(Function<CreationalContext<T>, T> create)
+ {
+ this.create = create;
+ return this;
+ }
+
+ public AbstractDynamicProducer<T> beanClass(Class<?> beanClass)
+ {
+ this.beanClass = beanClass;
+ return this;
+ }
+
+ public AbstractDynamicProducer<T> types(Type... types)
+ {
+ this.types = asSet(types);
+ return this;
+ }
+
+ public AbstractDynamicProducer<T> beanClassAndType(Class<?> beanClass)
+ {
+ beanClass(beanClass);
+ types(beanClass);
+ return this;
+ }
+
+ public AbstractDynamicProducer<T> qualifiers(Annotation... qualifiers)
+ {
+ this.qualifiers = asSet(qualifiers);
+ return this;
+ }
+
+ public AbstractDynamicProducer<T> scope(Class<? extends Annotation> scope)
+ {
+ this.scope = scope;
+ return this;
+ }
+
+ public AbstractDynamicProducer<T> addToId(Object object)
+ {
+ id = id + " " + object.toString();
+ return this;
+ }
+
+ @SafeVarargs
+ public static <T> Set<T> asSet(T... a)
+ {
+ return new HashSet<>(Arrays.asList(a));
+ }
+
+}
Copied: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/util/DefaultLiteral.java (from r1807817, myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/util/AnyLiteral.java)
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/util/DefaultLiteral.java?p2=myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/util/DefaultLiteral.java&p1=myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/util/AnyLiteral.java&r1=1807817&r2=1807839&rev=1807839&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/util/AnyLiteral.java (original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/util/DefaultLiteral.java Fri Sep 8 22:55:58 2017
@@ -18,15 +18,13 @@
*/
package org.apache.myfaces.cdi.util;
-import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Default;
import javax.enterprise.util.AnnotationLiteral;
/**
- * Literal for the {@link javax.enterprise.inject.Any} annotation.
- *
- * NOTE: Taken from Apache DeltaSpike
+ * Literal for the {@link javax.enterprise.inject.Default} annotation.
*/
-public class AnyLiteral extends AnnotationLiteral<Any> implements Any
+public class DefaultLiteral extends AnnotationLiteral<Default> implements Default
{
private static final long serialVersionUID = -8623640277155878657L;
}
\ No newline at end of file
Added: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/util/ParameterizedTypeImpl.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/util/ParameterizedTypeImpl.java?rev=1807839&view=auto
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/util/ParameterizedTypeImpl.java (added)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/util/ParameterizedTypeImpl.java Fri Sep 8 22:55:58 2017
@@ -0,0 +1,99 @@
+/*
+ * 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.cdi.util;
+
+import java.lang.reflect.ParameterizedType;
+import java.lang.reflect.Type;
+import java.util.Arrays;
+import java.util.Objects;
+
+public class ParameterizedTypeImpl implements ParameterizedType
+{
+ private final Type ownerType;
+ private final Class<?> rawType;
+ private final Type[] actualTypeArguments;
+
+ public ParameterizedTypeImpl(Class<?> rawType, Type[] actualTypeArguments)
+ {
+ this(null, rawType, actualTypeArguments);
+ }
+
+ public ParameterizedTypeImpl(Type ownerType, Class<?> rawType, Type[] actualTypeArguments)
+ {
+ this.ownerType = ownerType;
+ this.rawType = rawType;
+ this.actualTypeArguments = actualTypeArguments;
+ }
+
+ @Override
+ public Type getOwnerType()
+ {
+ return ownerType;
+ }
+
+ @Override
+ public Type getRawType()
+ {
+ return rawType;
+ }
+
+ @Override
+ public Type[] getActualTypeArguments()
+ {
+ return actualTypeArguments;
+ }
+
+ @Override
+ public int hashCode()
+ {
+ int hash = 7;
+ return hash;
+ }
+
+ @Override
+ public boolean equals(Object obj)
+ {
+ if (this == obj)
+ {
+ return true;
+ }
+ if (obj == null)
+ {
+ return false;
+ }
+ if (getClass() != obj.getClass())
+ {
+ return false;
+ }
+ final ParameterizedTypeImpl other = (ParameterizedTypeImpl) obj;
+ if (!Objects.equals(this.ownerType, other.ownerType))
+ {
+ return false;
+ }
+ if (!Objects.equals(this.rawType, other.rawType))
+ {
+ return false;
+ }
+ if (!Arrays.deepEquals(this.actualTypeArguments, other.actualTypeArguments))
+ {
+ return false;
+ }
+ return true;
+ }
+}
Modified: myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/viewtransient/ViewTransientScopeContextExtension.java
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/viewtransient/ViewTransientScopeContextExtension.java?rev=1807839&r1=1807838&r2=1807839&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/viewtransient/ViewTransientScopeContextExtension.java (original)
+++ myfaces/core/branches/2.3.x/impl/src/main/java/org/apache/myfaces/cdi/viewtransient/ViewTransientScopeContextExtension.java Fri Sep 8 22:55:58 2017
@@ -20,7 +20,6 @@ package org.apache.myfaces.cdi.viewtrans
import javax.enterprise.event.Observes;
import javax.enterprise.inject.spi.AfterBeanDiscovery;
-import javax.enterprise.inject.spi.AnnotatedType;
import javax.enterprise.inject.spi.BeanManager;
import javax.enterprise.inject.spi.BeforeBeanDiscovery;
import javax.enterprise.inject.spi.Extension;
@@ -36,10 +35,7 @@ public class ViewTransientScopeContextEx
@Observes final BeforeBeanDiscovery event, BeanManager beanManager)
{
event.addScope(ViewTransientScoped.class, true, false);
-
- AnnotatedType<ViewTransientScopeObjectProducer> viewTransientScopeObjectProducer =
- beanManager.createAnnotatedType(ViewTransientScopeObjectProducer.class);
- event.addAnnotatedType(viewTransientScopeObjectProducer);
+
}
void afterBeanDiscovery(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager)
Modified: myfaces/core/branches/2.3.x/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension
URL: http://svn.apache.org/viewvc/myfaces/core/branches/2.3.x/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension?rev=1807839&r1=1807838&r2=1807839&view=diff
==============================================================================
--- myfaces/core/branches/2.3.x/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension (original)
+++ myfaces/core/branches/2.3.x/impl/src/main/resources/META-INF/services/javax.enterprise.inject.spi.Extension Fri Sep 8 22:55:58 2017
@@ -11,4 +11,5 @@ org.apache.myfaces.cdi.converter.FacesCo
org.apache.myfaces.cdi.validator.FacesValidatorExtension
org.apache.myfaces.cdi.behavior.FacesBehaviorExtension
org.apache.myfaces.cdi.model.FacesDataModelExtension
-org.apache.myfaces.cdi.config.FacesConfigExtension
\ No newline at end of file
+org.apache.myfaces.cdi.config.FacesConfigExtension
+org.apache.myfaces.cdi.JsfArtifactProducerExtension
\ No newline at end of file